From 88b29b7995a27a11dfc241cb236c926e151b0a3e Mon Sep 17 00:00:00 2001 From: Alexey Gorshkov Date: Mon, 11 May 2015 01:51:24 +0300 Subject: [PATCH 001/441] Added jsurl --- jsurl/jsurl-tests.ts | 67 ++++++++++++++++++++++++++++++++++++++++++++ jsurl/jsurl.d.ts | 18 ++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 jsurl/jsurl-tests.ts create mode 100644 jsurl/jsurl.d.ts diff --git a/jsurl/jsurl-tests.ts b/jsurl/jsurl-tests.ts new file mode 100644 index 0000000000..f573feb49e --- /dev/null +++ b/jsurl/jsurl-tests.ts @@ -0,0 +1,67 @@ +/// + +var u = new Url; // curent document URL will be used +// or we can instantiate as +var u2 = new Url("http://example.com/some/path?a=b&c=d#someAnchor"); +// it should support relative URLs also +var u3 = new Url("/my/site/doc/path?foo=bar#baz"); + +// get the value of some query string parameter +alert(u2.query.a); +// or +alert(u3.query["foo"]); + +// Manupulating query string parameters +u.query.a = [1, 2, 3]; // adds/replaces in query string params a=1&a=2&a=3 +u.query.b = 'woohoo'; // adds/replaces in query string param b=woohoo + +if (u.query.a instanceof Array) { // the way to add a parameter + u.query.a.push(4); // now it's "a=1&a=2&a=3&a=4&b=woohoo" +} + +else { // if not an array but scalar value here is a way how to convert to array + u.query.a = [u.query.a]; + u.query.a.push(8) +} + + +// The way to remove the parameter: +delete u.query.a +// or: +delete u.query["a"] + +// If you need to remove all query string params: +u.query.clear(); +alert(u); + +// Lookup URL parts: +alert( + 'protocol = ' + u.protocol + '\n' + + 'user = ' + u.user + '\n' + + 'pass = ' + u.pass + '\n' + + 'host = ' + u.host + '\n' + + 'port = ' + u.port + '\n' + + 'path = ' + u.path + '\n' + + 'query = ' + u.query + '\n' + + 'hash = ' + u.hash + ); + +// Manipulating URL parts +u.path = '/some/new/path'; // the way to change URL path +u.protocol = 'https' // the way to force https protocol on the source URL + +// inject into string +var str = 'My Cool Link'; + +// or use in DOM context +var a = document.createElement('a'); +a.href = u; +a.innerHTML = 'test'; +document.body.appendChild(a); + +// Stringify +u += ''; +String(u); +u.toString(); +// NOTE, that usually it will be done automatically, so only in special +// cases direct stringify is required \ No newline at end of file diff --git a/jsurl/jsurl.d.ts b/jsurl/jsurl.d.ts new file mode 100644 index 0000000000..a5f7902578 --- /dev/null +++ b/jsurl/jsurl.d.ts @@ -0,0 +1,18 @@ +// Type definitions for jsurl 1.2.2 +// Project: https://github.com/Mikhus/jsurl +// Definitions by: Alexey Gorshkov +// Definitions: https://github.com/agorshkov23/DefinitelyTyped + +declare class Url { + constructor(url?: string); + query: any; + protocol: string; + user: string; + pass: string; + host: string; + port: string; + path: string; + hash: string; + href: string; + toString(): string; +} \ No newline at end of file From b775a713961db72ef6b1065ac06e43e06a810dba Mon Sep 17 00:00:00 2001 From: Kirill Chaban Date: Fri, 13 Nov 2015 09:55:32 +0100 Subject: [PATCH 002/441] Update material-ui.d.ts Added missing 'style' property for DatePicker --- material-ui/material-ui-tests.tsx | 3 ++- material-ui/material-ui.d.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/material-ui/material-ui-tests.tsx b/material-ui/material-ui-tests.tsx index 4e1e920d7b..62e8a41a33 100644 --- a/material-ui/material-ui-tests.tsx +++ b/material-ui/material-ui-tests.tsx @@ -20,6 +20,7 @@ import CardText = require("material-ui/lib/card/card-text"); import CardActions = require("material-ui/lib/card/card-actions"); import Dialog = require("material-ui/lib/dialog"); import DropDownMenu = require("material-ui/lib/drop-down-menu"); +import DatePicker = require("material-ui/lib/date-picker/date-picker"); import RadioButtonGroup = require("material-ui/lib/radio-button-group"); import RadioButton = require("material-ui/lib/radio-button"); import Toggle = require("material-ui/lib/toggle"); @@ -162,7 +163,7 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta ; // "http://material-ui.com/#/components/date-picker" - + ; // "http://material-ui.com/#/components/dialog" let standardActions = [ diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index c31925d6f7..549f3e334c 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -317,6 +317,7 @@ declare namespace __MaterialUI { onTouchTap?: React.TouchEventHandler; shouldDisableDate?: (day: Date) => boolean; showYearSelector?: boolean; + style?: React.CSSProperties; textFieldStyle?: React.CSSProperties; } export class DatePicker extends React.Component { From 05d34f0655717b326e8531423f8077b7f0088359 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Mon, 16 Nov 2015 20:46:48 +0100 Subject: [PATCH 003/441] Try to create a definition for karma-coverage --- karma-coverage/karma-coverage-tests.ts | 220 +++++++++++++++++++++++++ karma-coverage/karma-coverage.d.ts | 28 ++++ 2 files changed, 248 insertions(+) create mode 100644 karma-coverage/karma-coverage-tests.ts create mode 100644 karma-coverage/karma-coverage.d.ts diff --git a/karma-coverage/karma-coverage-tests.ts b/karma-coverage/karma-coverage-tests.ts new file mode 100644 index 0000000000..f4bd45f77c --- /dev/null +++ b/karma-coverage/karma-coverage-tests.ts @@ -0,0 +1,220 @@ +/// + +import karma = require('karma'); + + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/README.md#basic +module.exports = function(config: karma.Config) { + config.set({ + files: [ + 'src/**/*.js', + 'test/**/*.js' + ], + + // coverage reporter generates the coverage + reporters: ['progress', 'coverage'], + + preprocessors: { + // source files, that you wanna generate coverage for + // do not include tests or libraries + // (these files will be instrumented by Istanbul) + 'src/**/*.js': ['coverage'] + }, + + // optionally, configure the reporter + coverageReporter: { + type : 'html', + dir : 'coverage/' + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/README.md#advanced-multiple-reporters +module.exports = function(config: karma.Config) { + config.set({ + files: [ + 'src/**/*.js', + 'test/**/*.js' + ], + reporters: ['progress', 'coverage'], + preprocessors: { + 'src/**/*.js': ['coverage'] + }, + coverageReporter: { + // specify a common output directory + dir: 'build/reports/coverage', + reporters: [ + // reporters not supporting the `file` property + { type: 'html', subdir: 'report-html' }, + { type: 'lcov', subdir: 'report-lcov' }, + // reporters supporting the `file` property, use `subdir` to directly + // output them in the `dir` directory + { type: 'cobertura', subdir: '.', file: 'cobertura.txt' }, + { type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt' }, + { type: 'teamcity', subdir: '.', file: 'teamcity.txt' }, + { type: 'text', subdir: '.', file: 'text.txt' }, + { type: 'text-summary', subdir: '.', file: 'text-summary.txt' }, + ] + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/README.md#dont-minify-instrumenter-output +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + instrumenterOptions: { + istanbul: { noCompact: true } + } + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#subdir +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + dir: 'coverage', + subdir: '.' + // Would output the results into: .'/coverage/' + } + }); +}; + +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + dir: 'coverage', + subdir: 'report' + // Would output the results into: .'/coverage/report/' + } + }); +}; + +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + dir: 'coverage', + subdir: function(browser) { + // normalization process to keep a consistent browser name accross different + // OS + return browser.toLowerCase().split(/[ /-]/)[0]; + } + // Would output the results into: './coverage/firefox/' + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#file +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + type : 'text', + dir : 'coverage/', + file : 'coverage.txt' + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#check +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + check: { + global: { + statements: 50, + branches: 50, + functions: 50, + lines: 50, + excludes: [ + 'foo/bar/**/*.js' + ] + }, + each: { + statements: 50, + branches: 50, + functions: 50, + lines: 50, + excludes: [ + 'other/directory/**/*.js' + ], + overrides: { + 'baz/component/**/*.js': { + statements: 98 + } + } + } + } + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#watermarks +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + watermarks: { + statements: [ 50, 75 ], + functions: [ 50, 75 ], + branches: [ 50, 75 ], + lines: [ 50, 75 ] + } + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#sourcestore +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + type : 'text', + dir : 'coverage/', + file : 'coverage.txt', + sourceStore : require('istanbul').Store.create('fslookup') + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#reporters +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + reporters:[ + {type: 'html', dir:'coverage/'}, + {type: 'teamcity'}, + {type: 'text-summary'} + ], + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#instrumenter +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + instrumenters: { ibrik : require('ibrik') }, + instrumenter: { + '**/*.coffee': 'ibrik' + }, + // ... + } + }); +}; + +var to5Options = { experimental: true }; + +// [...] + +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + instrumenters: { isparta : require('isparta') }, + instrumenter: { + '**/*.js': 'isparta' + }, + instrumenterOptions: { + isparta: { to5 : to5Options } + } + } + }); +}; diff --git a/karma-coverage/karma-coverage.d.ts b/karma-coverage/karma-coverage.d.ts new file mode 100644 index 0000000000..07df06105c --- /dev/null +++ b/karma-coverage/karma-coverage.d.ts @@ -0,0 +1,28 @@ +// Type definitions for karma-coverage v0.5.3 +// Project: https://github.com/karma-runner/karma-coverage +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'karma' { + namespace karma { + interface ConfigOptions { + /** + * See https://github.com/karma-runner/karma-coverage/blob/master/docs/configuration.md + */ + coverageReporter?: (Reporter|Reporter[]); + } + + interface Reporter { + type?: string; + dir?: string; + subdir?: string | ((browser: string) => string); + check?: any; + watermarks?: any; + includeAllSources?: boolean; + sourceStore?: any; // Should be istanbul.Store + instrumenter?: any; + } + } +} From 7c167c1e052e46e93a391759f6ab731bae2cad65 Mon Sep 17 00:00:00 2001 From: Kirill Chaban Date: Wed, 18 Nov 2015 23:12:24 +0100 Subject: [PATCH 004/441] Update material-ui.d.ts used spaces instead of tabs --- material-ui/material-ui.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index 549f3e334c..f11864c644 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -317,7 +317,7 @@ declare namespace __MaterialUI { onTouchTap?: React.TouchEventHandler; shouldDisableDate?: (day: Date) => boolean; showYearSelector?: boolean; - style?: React.CSSProperties; + style?: React.CSSProperties; textFieldStyle?: React.CSSProperties; } export class DatePicker extends React.Component { From 05ee7f65587709f0ed5d5a991984939a6a527533 Mon Sep 17 00:00:00 2001 From: Kirill Chaban Date: Thu, 19 Nov 2015 08:23:25 +0100 Subject: [PATCH 005/441] Update material-ui.d.ts used spaces instead of tabs --- material-ui/material-ui-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/material-ui/material-ui-tests.tsx b/material-ui/material-ui-tests.tsx index 62e8a41a33..754a0f20f5 100644 --- a/material-ui/material-ui-tests.tsx +++ b/material-ui/material-ui-tests.tsx @@ -163,7 +163,7 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta ; // "http://material-ui.com/#/components/date-picker" - ; + ; // "http://material-ui.com/#/components/dialog" let standardActions = [ From ae5b3588168c495f77315076f681bc4cbbb0a247 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Sat, 21 Nov 2015 15:32:33 +0100 Subject: [PATCH 006/441] Simplified definition for Istanbul (https://github.com/gotwarlost/istanbul) --- istanbul/istanbul-tests.ts | 27 ++++++++++++++ istanbul/istanbul.d.ts | 73 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 istanbul/istanbul-tests.ts create mode 100644 istanbul/istanbul.d.ts diff --git a/istanbul/istanbul-tests.ts b/istanbul/istanbul-tests.ts new file mode 100644 index 0000000000..b283e2dcce --- /dev/null +++ b/istanbul/istanbul-tests.ts @@ -0,0 +1,27 @@ +/// + +import * as istanbul from 'istanbul'; + +// Instrument code +var instrumenter = new istanbul.Instrumenter(); + +var generatedCode = instrumenter.instrumentSync('function meaningOfLife() { return 42; }', + 'filename.js'); + + +// Generate reports given a bunch of coverage JSON objects +var collector = new istanbul.Collector(), + reporter = new istanbul.Reporter(), + sync = false; + +var obj1 = {}, + obj2 = {}; + +collector.add(obj1); +collector.add(obj2); //etc. + +reporter.add('text'); +reporter.addAll([ 'lcov', 'clover' ]); +reporter.write(collector, sync, function () { + console.log('All reports generated'); +}); diff --git a/istanbul/istanbul.d.ts b/istanbul/istanbul.d.ts new file mode 100644 index 0000000000..026ad8b003 --- /dev/null +++ b/istanbul/istanbul.d.ts @@ -0,0 +1,73 @@ +// Type definitions for Istanbul v0.4.0 +// Project: https://github.com/gotwarlost/istanbul +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'istanbul' { + namespace istanbul { + interface Istanbul { + new (options?: any): Istanbul; + Collector: Collector; + config: Config; + ContentWriter: ContentWriter; + FileWriter: FileWriter; + hook: Hook; + Instrumenter: Instrumenter; + Report: Report; + Reporter: Reporter; + Store: Store; + utils: ObjectUtils; + VERSION: string; + Writer: Writer; + } + + interface Collector { + new (options?: any): Collector; + add(coverage: any, testName?: string): void; + } + + interface Config { + } + + interface ContentWriter { + } + + interface FileWriter { + } + + interface Hook { + } + + interface Instrumenter { + new (options?: any): Instrumenter; + instrumentSync(code: string, filename: string): string; + } + + interface Report { + } + + interface Configuration { + new (obj: any, overrides: any): Configuration; + } + + interface Reporter { + new (cfg?: Configuration, dir?: string): Reporter; + add(fmt: string): void; + addAll(fmts: Array): void; + write(collector: Collector, sync: boolean, callback: Function): void; + } + + interface Store { + } + + interface ObjectUtils { + } + + interface Writer { + } + } + + var istanbul: istanbul.Istanbul; + + export = istanbul; +} From 02dd2f323e1bcb8a823269f89e0909ec9e5e38b5 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Sat, 21 Nov 2015 15:33:11 +0100 Subject: [PATCH 007/441] Remove trailing whitespaces --- karma/karma.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/karma/karma.d.ts b/karma/karma.d.ts index c489535eb3..87d05843d8 100644 --- a/karma/karma.d.ts +++ b/karma/karma.d.ts @@ -82,8 +82,8 @@ declare module 'karma' { interface ServerCallback { (exitCode: number): void; } - - interface Config { + + interface Config { set: (config: ConfigOptions) => void; LOG_DISABLE: string; LOG_ERROR: string; @@ -91,7 +91,7 @@ declare module 'karma' { LOG_INFO: string; LOG_DEBUG: string; } - + interface ConfigFile { configFile: string; } From 507d8b07b457c076028e0fbcf2858c323f3400c6 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Sat, 21 Nov 2015 15:33:37 +0100 Subject: [PATCH 008/441] Fix karma-coverage definition --- karma-coverage/karma-coverage-tests.ts | 2 +- karma-coverage/karma-coverage.d.ts | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/karma-coverage/karma-coverage-tests.ts b/karma-coverage/karma-coverage-tests.ts index f4bd45f77c..8ca9edc63b 100644 --- a/karma-coverage/karma-coverage-tests.ts +++ b/karma-coverage/karma-coverage-tests.ts @@ -1,6 +1,6 @@ /// -import karma = require('karma'); +import * as karma from 'karma-coverage'; // See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/README.md#basic diff --git a/karma-coverage/karma-coverage.d.ts b/karma-coverage/karma-coverage.d.ts index 07df06105c..7b78a36de3 100644 --- a/karma-coverage/karma-coverage.d.ts +++ b/karma-coverage/karma-coverage.d.ts @@ -4,10 +4,20 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// -declare module 'karma' { - namespace karma { - interface ConfigOptions { +declare module 'karma-coverage' { + import * as karma from 'karma'; + import * as istanbul from 'istanbul'; + + namespace karmaCoverage { + interface Karma extends karma.Karma {} + + interface Config extends karma.Config { + set: (config: ConfigOptions) => void; + } + + interface ConfigOptions extends karma.ConfigOptions { /** * See https://github.com/karma-runner/karma-coverage/blob/master/docs/configuration.md */ @@ -21,8 +31,12 @@ declare module 'karma' { check?: any; watermarks?: any; includeAllSources?: boolean; - sourceStore?: any; // Should be istanbul.Store + sourceStore?: istanbul.Store; instrumenter?: any; } } + + var karmaCoverage: karmaCoverage.Karma; + + export = karmaCoverage; } From 4e4ffc7ecf80cd0046b92446abe561b3f6470f5d Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Tue, 1 Dec 2015 22:37:18 +0100 Subject: [PATCH 009/441] Use intersection types to correctly infer the result of _.merge in lodash --- lodash/lodash-tests.ts | 112 +++++++++++++++++++++++++++++------------ lodash/lodash.d.ts | 36 ++++++------- 2 files changed, 98 insertions(+), 50 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bdc08ccdc7..87bc87e496 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6540,48 +6540,96 @@ module TestMapKeys { // _.merge module TestMerge { - let customizer: (value: any, srcValue: any, key?: string, object?: {}, source?: {}) => any; - let result: TResult; + type InitialValue = { a : number }; + type MergingValue = { b : string }; - result = _.merge<{}, {}, TResult>({}, {}); - result = _.merge<{}, {}, TResult>({}, {}, customizer); - result = _.merge<{}, {}, TResult>({}, {}, customizer, any); + var initialValue = { a : 1 }; + var mergingValue = { b : "hi" }; - result = _.merge<{}, {}, {}, TResult>({}, {}, {}); - result = _.merge<{}, {}, {}, TResult>({}, {}, {}, customizer); - result = _.merge<{}, {}, {}, TResult>({}, {}, {}, customizer, any); + type ExpectedResult = { a: number, b: string }; + let result: ExpectedResult; - result = _.merge<{}, {}, {}, {}, TResult>({}, {}, {}, {}); - result = _.merge<{}, {}, {}, {}, TResult>({}, {}, {}, {}, customizer); - result = _.merge<{}, {}, {}, {}, TResult>({}, {}, {}, {}, customizer, any); + let customizer: (value: any, srcValue: any, key?: string, object?: InitialValue, source?: MergingValue) => any; - result = _.merge<{}, {}, {}, {}, {}, TResult>({}, {}, {}, {}, {}); - result = _.merge<{}, {}, {}, {}, {}, TResult>({}, {}, {}, {}, {}, customizer); - result = _.merge<{}, {}, {}, {}, {}, TResult>({}, {}, {}, {}, {}, customizer, any); + // Test for basic merging - result = _.merge<{}, TResult>({}, {}, {}, {}, {}, {}); - result = _.merge<{}, TResult>({}, {}, {}, {}, {}, {}, customizer); - result = _.merge<{}, TResult>({}, {}, {}, {}, {}, {}, customizer, any); + result = _.merge(initialValue, mergingValue); + result = _.merge(initialValue, mergingValue, customizer); + result = _.merge(initialValue, mergingValue, customizer, any); - result = _({}).merge<{}, TResult>({}).value(); - result = _({}).merge<{}, TResult>({}, customizer).value(); - result = _({}).merge<{}, TResult>({}, customizer, any).value(); + result = _.merge(initialValue, {}, mergingValue); + result = _.merge(initialValue, {}, mergingValue, customizer); + result = _.merge(initialValue, {}, mergingValue, customizer, any); - result = _({}).merge<{}, {}, TResult>({}, {}).value(); - result = _({}).merge<{}, {}, TResult>({}, {}, customizer).value(); - result = _({}).merge<{}, {}, TResult>({}, {}, customizer, any).value(); + result = _.merge(initialValue, {}, {}, mergingValue); + result = _.merge(initialValue, {}, {}, mergingValue, customizer); + result = _.merge(initialValue, {}, {}, mergingValue, customizer, any); - result = _({}).merge<{}, {}, {}, TResult>({}, {}, {}).value(); - result = _({}).merge<{}, {}, {}, TResult>({}, {}, {}, customizer).value(); - result = _({}).merge<{}, {}, {}, TResult>({}, {}, {}, customizer, any).value(); + result = _.merge(initialValue, {}, {}, {}, mergingValue); + result = _.merge(initialValue, {}, {}, {}, mergingValue, customizer); + result = _.merge(initialValue, {}, {}, {}, mergingValue, customizer, any); - result = _({}).merge<{}, {}, {}, {}, TResult>({}, {}, {}, {}).value(); - result = _({}).merge<{}, {}, {}, {}, TResult>({}, {}, {}, {}, customizer).value(); - result = _({}).merge<{}, {}, {}, {}, TResult>({}, {}, {}, {}, customizer, any).value(); + // Once we get to the varargs version, you have to specify the result explicitly + result = _.merge(initialValue, {}, {}, {}, {}, mergingValue); + result = _.merge(initialValue, {}, {}, {}, {}, mergingValue, customizer); + result = _.merge(initialValue, {}, {}, {}, {}, mergingValue, customizer, any); + + // Test for multiple combinations of many types + + type ComplicatedExpectedType = { a: number, b: string, c: {}, d: number[], e: boolean }; + + var complicatedResult: ComplicatedExpectedType = _.merge({ a: 1 }, + { b: "string" }, + { c: {} }, + { d: [1] }, + { e: true }); + // Test for type overriding + + type ExpectedTypeAfterOverriding = { a: boolean }; + + var overriddenResult: ExpectedTypeAfterOverriding = _.merge({ a: 1 }, + { a: "string" }, + { a: {} }, + { a: [1] }, + { a: true }); + + // Tests for basic chaining with merge + + result = _(initialValue).merge(mergingValue).value(); + result = _(initialValue).merge(mergingValue, customizer).value(); + result = _(initialValue).merge(mergingValue, customizer, any).value(); + + result = _(initialValue).merge({}, mergingValue).value(); + result = _(initialValue).merge({}, mergingValue, customizer).value(); + result = _(initialValue).merge({}, mergingValue, customizer, any).value(); + + result = _(initialValue).merge({}, {}, mergingValue).value(); + result = _(initialValue).merge({}, {}, mergingValue, customizer).value(); + result = _(initialValue).merge({}, {}, mergingValue, customizer, any).value(); + + result = _(initialValue).merge({}, {}, {}, mergingValue).value(); + result = _(initialValue).merge({}, {}, {}, mergingValue, customizer).value(); + result = _(initialValue).merge({}, {}, {}, mergingValue, customizer, any).value(); + + // Once we get to the varargs version, you have to specify the result explicitly + result = _(initialValue).merge({}, {}, {}, {}, mergingValue).value(); + result = _(initialValue).merge({}, {}, {}, {}, mergingValue, customizer).value(); + result = _(initialValue).merge({}, {}, {}, {}, mergingValue, customizer, any).value(); + + // Test complex multiple combinations with chaining + + var complicatedResult: ComplicatedExpectedType = _({ a: 1 }).merge({ b: "string" }, + { c: {} }, + { d: [1] }, + { e: true }).value(); + + // Test for type overriding with chaining + + var overriddenResult: ExpectedTypeAfterOverriding = _({ a: 1 }).merge({ a: "string" }, + { a: {} }, + { a: [1] }, + { a: true }).value(); - result = _({}).merge({}, {}, {}, {}, {}).value(); - result = _({}).merge({}, {}, {}, {}, {}, customizer).value(); - result = _({}).merge({}, {}, {}, {}, {}, customizer, any).value(); } // _.methods diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c39..d980f64e39 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11107,40 +11107,40 @@ declare module _ { * @param thisArg The this binding of customizer. * @return Returns object. */ - merge( + merge( object: TObject, source: TSource, customizer?: MergeCustomizer, thisArg?: any - ): TResult; + ): TObject & TSource; /** * @see _.merge */ - merge( + merge( object: TObject, source1: TSource1, source2: TSource2, customizer?: MergeCustomizer, thisArg?: any - ): TResult; + ): TObject & TSource1 & TSource2; /** * @see _.merge */ - merge( + merge( object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, customizer?: MergeCustomizer, thisArg?: any - ): TResult; + ): TObject & TSource1 & TSource2 & TSource3; /** * @see _.merge */ - merge( + merge( object: TObject, source1: TSource1, source2: TSource2, @@ -11148,13 +11148,13 @@ declare module _ { source4: TSource4, customizer?: MergeCustomizer, thisArg?: any - ): TResult; + ): TObject & TSource1 & TSource2 & TSource3 & TSource4; /** * @see _.merge */ - merge( - object: TObject, + merge( + object: any, ...otherArgs: any[] ): TResult; } @@ -11163,44 +11163,44 @@ declare module _ { /** * @see _.merge */ - merge( + merge( source: TSource, customizer?: MergeCustomizer, thisArg?: any - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitObjectWrapper; /** * @see _.merge */ - merge( + merge( source1: TSource1, source2: TSource2, customizer?: MergeCustomizer, thisArg?: any - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitObjectWrapper; /** * @see _.merge */ - merge( + merge( source1: TSource1, source2: TSource2, source3: TSource3, customizer?: MergeCustomizer, thisArg?: any - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitObjectWrapper; /** * @see _.merge */ - merge( + merge( source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer?: MergeCustomizer, thisArg?: any - ): LoDashImplicitObjectWrapper; + ): LoDashImplicitObjectWrapper; /** * @see _.merge From 8f5faa4841838aeafdd63d446f9b5339ccfe2e34 Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Wed, 2 Dec 2015 16:18:40 +0100 Subject: [PATCH 010/441] update fs --- foundation-sites/foundation.d.ts | 216 +++++++++++++++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 foundation-sites/foundation.d.ts diff --git a/foundation-sites/foundation.d.ts b/foundation-sites/foundation.d.ts new file mode 100644 index 0000000000..3f0a99adee --- /dev/null +++ b/foundation-sites/foundation.d.ts @@ -0,0 +1,216 @@ +// Type definitions for Foundation Sites v6.0.4 +// Project: http://foundation.zurb.com/ +// Definitions by: Sam Vloeberghs +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +declare module Foundation { + + // http://foundation.zurb.com/sites/docs/abide.html#javascript-reference + export interface Abide { + requiredCheck: (element: Object) => boolean; + findLabel: (element:Object) => boolean; + addErrorClasses: (element: Object) => void; + removeErrorClasses: (element:Object) => void; + validateInput: (element: Object, form: Object) => void; + validateForm: (element: Object) => void; + validateText: (element: Object) => boolean; + validateRadio: (group: String) => boolean; + resetform: ($form: Object) => void; + } + interface AbideOptions { + + } + + // http://foundation.zurb.com/sites/docs/accordion.html#javascript-reference + export interface Accordion { + toggle: ($target : JQuery) => void; + down: ($target : JQuery, firstTime: boolean) => void; + up: ($target: JQuery) => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/accordion-menu.html#javascript-reference + export interface AccordionMenu { + toggle: ($target : JQuery) => void; + down: ($target : JQuery, firstTime: boolean) => void; + up: ($target: JQuery) => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/drilldown-menu.html#javascript-reference + export interface Drilldown { + _hideAll: ($elem : JQuery) => void; + _show: ($elem : JQuery) => void; + _hide: ($elem : JQuery) => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/dropdown.html#javascript-reference + export interface Dropdown { + getPositionClass: () => String; + open: () => void; + close: () => void; + toggle: () => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/dropdown-menu.html#javascript-reference + export interface DropdownMenu { + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/equalizer.html#javascript-reference + export interface Equalizer { + getHeights: (element: Object) => Array; + applyHeight: ($eqParent: Object, heights:Array) => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/interchange.html#javascript-reference + export interface Interchange { + replace: (path: String) => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/magellan.html#javascript-reference + export interface Magellan { + calcPoints: () => void; + reflow: () => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/offcanvas.html#javascript-reference + export interface OffCanvas { + open: (event: Object, trigger : JQuery) => void; + toggle: (event: Object, trigger : JQuery) => void; + close: () => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/orbit.html#javascript-reference + export interface Orbit { + changeSlide: (isLTR: boolean, chosenSlide?: Object, idx?: number) => void; + geoSync: () => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/reveal.html#javascript-reference + export interface Reveal { + open: () => void; + toggle: () => void; + close: () => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/slider.html#javascript-reference + export interface Slider { + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/sticky.html#javascript-reference + export interface Sticky { + _pauseListeners: (scrollListener: String) => void; + _calc: (checkSizes: boolean, scroll: number) => void; + destroy: () => void; + emCalc: (number: any) => void; + } + + // http://foundation.zurb.com/sites/docs/tabs.html#javascript-reference + export interface Tabs { + _handleTabChange: ($target : JQuery) => void; + selectTab: ($target : JQuery) => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/toggler.html#javascript-reference + export interface Toggler { + toggle: () => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/tooltip.html#javascript-reference + export interface Tooltip { + show: () => void; + hide: () =>void; + toggle: () => void; + destroy: () => void; + } + + // Utilities + // --------- + + export interface Box { + ImNotTouchingYou: (element: Object, parent?: Object, lrOnly?:boolean, tbOnly?:boolean) => boolean; + GetDimensions: (element: Object) => Object; + GetOffsets: (element: Object, anchor: Object, position:String, vOffset:number, hOffset:number, isOverflow:boolean) => Object; + } + + export interface KeyBoard { + parseKey: (event:any) => String; + findFocusable: ($element:Object) => Object; + } + + export interface MediaQuery { + get: (size:String) => String; + atLeast: (size:String) => boolean; + queries:Array; + current:any; + } + + export interface Motion { + animateIn: (element: Object, animation:any, cb:Function) => void; + animateOut: (element: Object, animation:any, cb:Function) => void; + } + + interface Move { + // TODO + } + + interface Nest { + // TODO + } + + export interface Timer { + start: () => void; + restart: () => void; + pause: () => void; + } + + interface Touch { + // TODO :extension on jQuery + } + + interface Triggers { + // TODO :extension on jQuery + } + + interface FoundationStatic { + version : string; + + rtl: () => boolean; + plugin: (plugin: Object, name:String) => void; + registerPlugin: (plugin: Object) => void; + unregisterPlugin: (plugin: Object) => void; + GetYoDigits: (length: number, namespace?: String) => String; + reflow: (elem: Object, plugins?: Array|String) => void; + getFnName: (fn: String) => String; + transitionend: () => String; + + util : { + throttle(func : (...args : any[]) => any, delay : number) : (...args : any[]) => any; + }; + onImagesLoaded: (images:Object, cb:Function) => void; + + Abide: (element:Object, options:AbideOptions) => void; + + } +} + +interface JQuery { + foundation(method:String|Array) : JQuery; +} + +declare var Foundation : Foundation.FoundationStatic; From 9e91f2a6c21d668479629c1e708e677176f9a973 Mon Sep 17 00:00:00 2001 From: Sascha Thiel Date: Mon, 7 Dec 2015 14:31:10 +0100 Subject: [PATCH 011/441] PesistenceOptions is actually JQueryAjaxSettings. backbone.js:Backbone.sync > // Make the request, allowing the user to override any Ajax options. > var xhr = options.xhr = Backbone.ajax(_.extend(params, options)); --- backbone/backbone-global.d.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/backbone/backbone-global.d.ts b/backbone/backbone-global.d.ts index 764aa83d75..192377f5f8 100644 --- a/backbone/backbone-global.d.ts +++ b/backbone/backbone-global.d.ts @@ -41,11 +41,7 @@ declare module Backbone { parse?: any; } - interface PersistenceOptions { - url?: string; - beforeSend?: (jqxhr: JQueryXHR) => void; - success?: (modelOrCollection?: any, response?: any, options?: any) => void; - error?: (modelOrCollection?: any, jqxhr?: JQueryXHR, options?: any) => void; + interface PersistenceOptions extends JQueryAjaxSettings { } interface ModelSetOptions extends Silenceable, Validable { From 2f5765d6be3f8f5a0236a841b352d231e0cd257b Mon Sep 17 00:00:00 2001 From: Sascha Thiel Date: Mon, 7 Dec 2015 15:08:00 +0100 Subject: [PATCH 012/441] isn't the same, so just added the "data" attribute. --- backbone/backbone-global.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backbone/backbone-global.d.ts b/backbone/backbone-global.d.ts index 192377f5f8..c16e1a59e3 100644 --- a/backbone/backbone-global.d.ts +++ b/backbone/backbone-global.d.ts @@ -41,7 +41,12 @@ declare module Backbone { parse?: any; } - interface PersistenceOptions extends JQueryAjaxSettings { + interface PersistenceOptions { + url?: string; + data?: any; + beforeSend?: (jqxhr: JQueryXHR) => void; + success?: (modelOrCollection?: any, response?: any, options?: any) => void; + error?: (modelOrCollection?: any, jqxhr?: JQueryXHR, options?: any) => void; } interface ModelSetOptions extends Silenceable, Validable { From ee16e460f7de92a4dd3086599f7ce1035a5d0721 Mon Sep 17 00:00:00 2001 From: Allen Li Date: Wed, 9 Dec 2015 22:38:00 -0800 Subject: [PATCH 013/441] [react-bootstrap] Update to include Navbar.*. Add: Navbar.Brand Navbar.Collapse Navbar.Header Navbar.Toggle --- react-bootstrap/react-bootstrap-tests.tsx | 30 ++++++++++++-------- react-bootstrap/react-bootstrap.d.ts | 34 ++++++++++++++++++++++- 2 files changed, 52 insertions(+), 12 deletions(-) diff --git a/react-bootstrap/react-bootstrap-tests.tsx b/react-bootstrap/react-bootstrap-tests.tsx index 8b0dd0fc0a..2d578a13e9 100644 --- a/react-bootstrap/react-bootstrap-tests.tsx +++ b/react-bootstrap/react-bootstrap-tests.tsx @@ -453,17 +453,25 @@ export class ReactBootstrapTest extends Component {
- + + + React-Bootstrap + + + + + +
diff --git a/react-bootstrap/react-bootstrap.d.ts b/react-bootstrap/react-bootstrap.d.ts index c63c55e9d0..b1d8bd2d36 100644 --- a/react-bootstrap/react-bootstrap.d.ts +++ b/react-bootstrap/react-bootstrap.d.ts @@ -441,6 +441,33 @@ declare module "react-bootstrap" { interface NavItemClass extends React.ComponentClass { } var NavItem: NavItemClass; + // + // ---------------------------------------- + interface NavbarBrandProps extends React.Props { + } + interface NavbarBrand extends React.ReactElement { } + interface NavbarBrandClass extends React.ComponentClass { } + + // + // ---------------------------------------- + interface NavbarCollapseProps extends React.Props { + } + interface NavbarCollapse extends React.ReactElement { } + interface NavbarCollapseClass extends React.ComponentClass { } + + // + // ---------------------------------------- + interface NavbarHeaderProps extends React.Props { + } + interface NavbarHeader extends React.ReactElement { } + interface NavbarHeaderClass extends React.ComponentClass { } + + // + // ---------------------------------------- + interface NavbarToggleProps extends React.Props { + } + interface NavbarToggle extends React.ReactElement { } + interface NavbarToggleClass extends React.ComponentClass { } // // ---------------------------------------- @@ -463,7 +490,12 @@ declare module "react-bootstrap" { toggleNavKey?: string | number; } interface Navbar extends React.ReactElement { } - interface NavbarClass extends React.ComponentClass { } + interface NavbarClass extends React.ComponentClass { + Brand: NavbarBrandClass; + Collapse: NavbarCollapseClass; + Header: NavbarHeaderClass; + Toggle: NavbarToggleClass; + } var Navbar: NavbarClass; // From f8aae5ef40f1084cf4be38b5fa57c8d7f9186db7 Mon Sep 17 00:00:00 2001 From: Chabardes Date: Mon, 14 Dec 2015 11:14:22 +0100 Subject: [PATCH 014/441] add ios optional parameters for cordova media.play See https://github.com/apache/cordova-plugin-media#ios-quirks --- cordova/plugins/Media.d.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cordova/plugins/Media.d.ts b/cordova/plugins/Media.d.ts index 21d1a17e38..74ae3c3f64 100644 --- a/cordova/plugins/Media.d.ts +++ b/cordova/plugins/Media.d.ts @@ -38,7 +38,7 @@ interface Media { /** Returns the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1. */ getDuration(): number; /** Starts or resumes playing an audio file. */ - play(): void; + play(iosPlayOptions?: IosPlayOptions): void; /** Pauses playing an audio file. */ pause(): void; /** @@ -71,3 +71,11 @@ interface Media { /** The duration of the media, in seconds. */ duration: number; } +/** + * iOS optional parameters for media.play + * See https://github.com/apache/cordova-plugin-media#ios-quirks + */ +interface IosPlayOptions { + numberOfLoops?: number; + playAudioWhenScreenIsLocked?: boolean; +} From a9a92323139ad208ca6488ee18a1deab0d976577 Mon Sep 17 00:00:00 2001 From: Chabardes Date: Mon, 14 Dec 2015 15:34:00 +0100 Subject: [PATCH 015/441] add param in play header --- cordova/plugins/Media.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cordova/plugins/Media.d.ts b/cordova/plugins/Media.d.ts index 74ae3c3f64..b691013d8d 100644 --- a/cordova/plugins/Media.d.ts +++ b/cordova/plugins/Media.d.ts @@ -37,7 +37,10 @@ interface Media { mediaError?: (error: MediaError) => void): void; /** Returns the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1. */ getDuration(): number; - /** Starts or resumes playing an audio file. */ + /** + * Starts or resumes playing an audio file. + * @param iosPlayOptions: iOS options quirks + */ play(iosPlayOptions?: IosPlayOptions): void; /** Pauses playing an audio file. */ pause(): void; From c4329e1413cd2dfc53c573d4fd08abaf78b547e7 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Mon, 14 Dec 2015 17:02:46 -0800 Subject: [PATCH 016/441] Replaced deprecated properties with new versions. --- threejs/three-orbitcontrols.d.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/threejs/three-orbitcontrols.d.ts b/threejs/three-orbitcontrols.d.ts index 69cde47a72..b904ab3219 100644 --- a/threejs/three-orbitcontrols.d.ts +++ b/threejs/three-orbitcontrols.d.ts @@ -7,10 +7,10 @@ declare module THREE { class OrbitControls { - constructor(object:Camera, domElement?:HTMLElement); + constructor(object: Camera, domElement?: HTMLElement); - object:Camera; - domElement:HTMLElement; + object: Camera; + domElement: HTMLElement; // API enabled: boolean; @@ -19,13 +19,13 @@ declare module THREE { // deprecated center: THREE.Vector3; - noZoom: boolean; + enableZoom: boolean; zoomSpeed: number; minDistance: number; maxDistance: number; - noRotate: boolean; + enableRotate: boolean; rotateSpeed: number; - noPan: boolean; + enablePan: boolean; keyPanSpeed: number; autoRotate: boolean; autoRotateSpeed: number; @@ -33,24 +33,27 @@ declare module THREE { maxPolarAngle: number; minAzimuthAngle: number; maxAzimuthAngle: number; - noKeys: boolean; + enableKeys: boolean; keys: { LEFT: number; UP: number; RIGHT: number; BOTTOM: number; }; mouseButtons: { ORBIT: MOUSE; ZOOM: MOUSE; PAN: MOUSE; }; + enableDamping: boolean; + dampingFactor: number; + rotateLeft(angle?: number): void; rotateUp(angle?: number): void; panLeft(distance?: number): void; panUp(distance?: number): void; - pan( deltaX: number, deltaY: number): void; + pan(deltaX: number, deltaY: number): void; dollyIn(dollyScale: number): void; dollyOut(dollyScale: number): void; update(): void; reset(): void; - getPolarAngle() : number; + getPolarAngle(): number; getAzimuthalAngle(): number; // EventDispatcher mixins - addEventListener(type: string, listener: (event: any) => void ): void; + addEventListener(type: string, listener: (event: any) => void): void; hasEventListener(type: string, listener: (event: any) => void): void; removeEventListener(type: string, listener: (event: any) => void): void; dispatchEvent(event: { type: string; target: any; }): void; From d275c4c26ae677c4653067fd6901eceefbd835cd Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Mon, 14 Dec 2015 17:11:32 -0800 Subject: [PATCH 017/441] Several fixes, and allow CSS-style string where a hex number is allowed. --- threejs/three.d.ts | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index fb890afe6a..b4231f5668 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -1227,7 +1227,7 @@ declare module THREE { */ computeBoundingSphere(): void; - merge( geometry: Geometry, matrix: Matrix, materialIndexOffset: number): void; + merge( geometry: Geometry, matrix: Matrix, materialIndexOffset?: number): void; mergeMesh( mesh: Mesh ): void; @@ -1677,7 +1677,7 @@ declare module THREE { * Abstract base class for lights. */ export class Light extends Object3D { - constructor(hex?: number); + constructor(hex?: number|string); color: Color; receiveShadow: boolean; @@ -1727,7 +1727,7 @@ declare module THREE { * This creates a Ambientlight with a color. * @param hex Numeric value of the RGB component of the color. */ - constructor(hex?: number); + constructor(hex?: number|string); clone(recursive?: boolean): AmbientLight; copy(source: AmbientLight): AmbientLight; @@ -1746,7 +1746,7 @@ declare module THREE { */ export class DirectionalLight extends Light { - constructor(hex?: number, intensity?: number); + constructor(hex?: number|string, intensity?: number); /** * Target used for shadow camera orientation. @@ -1766,7 +1766,7 @@ declare module THREE { } export class HemisphereLight extends Light { - constructor(skyColorHex?: number, groundColorHex?: number, intensity?: number); + constructor(skyColorHex?: number|string, groundColorHex?: number|string, intensity?: number); groundColor: Color; intensity: number; @@ -1784,7 +1784,7 @@ declare module THREE { * scene.add( light ); */ export class PointLight extends Light { - constructor(hex?: number, intensity?: number, distance?: number, decay?: number); + constructor(hex?: number|string, intensity?: number, distance?: number, decay?: number); /* * Light's intensity. @@ -1810,7 +1810,7 @@ declare module THREE { * A point light that can cast shadow in one direction. */ export class SpotLight extends Light { - constructor(hex?: number, intensity?: number, distance?: number, angle?: number, exponent?: number, decay?: number); + constructor(hex?: number|string, intensity?: number, distance?: number, angle?: number, exponent?: number, decay?: number); /** * Spotlight focus points at target.position. @@ -2244,7 +2244,7 @@ declare module THREE { } export interface LineBasicMaterialParameters extends MaterialParameters { - color?: number; + color?: number|string; linewidth?: number; linecap?: string; linejoin?: string; @@ -2267,7 +2267,7 @@ declare module THREE { } export interface LineDashedMaterialParameters extends MaterialParameters { - color?: number; + color?: number|string; linewidth?: number; scale?: number; dashSize?: number; @@ -2295,7 +2295,7 @@ declare module THREE { * parameters is an object with one or more properties defining the material's appearance. */ export interface MeshBasicMaterialParameters extends MaterialParameters{ - color?: number; + color?: number|string; opacity?: number; map?: Texture; aoMap?: Texture; @@ -2361,7 +2361,7 @@ declare module THREE { } export interface MeshLambertMaterialParameters extends MaterialParameters{ - color?: number; + color?: number|string; emissive?: number; opacity?: number; map?: Texture; @@ -2433,7 +2433,7 @@ declare module THREE { export interface MeshPhongMaterialParameters extends MaterialParameters { /** geometry color in hexadecimal. Default is 0xffffff. */ - color?: number; + color?: number | string; emissive?: number; specular?: number; shininess?: number; @@ -2461,7 +2461,7 @@ declare module THREE { blending?: Blending; depthTest?: boolean; depthWrite?: boolean; - wireframe?: string; + wireframe?: boolean; wireframeLinewidth?: number; vertexColors?: Colors; skinning?: boolean; @@ -2528,7 +2528,7 @@ declare module THREE { } export interface PointsMaterialParameters extends MaterialParameters{ - color?: number; + color?: number|string; opacity?: number; map?: Texture; size?: number; @@ -2604,7 +2604,7 @@ declare module THREE { } export interface SpriteMaterialParameters extends MaterialParameters { - color?: number; + color?: number|string; opacity?: number; map?: Texture; blending?: Blending; @@ -4470,6 +4470,11 @@ declare module THREE { clearAlpha?: number; devicePixelRatio?: number; + + /** + * default is false. + */ + logarithmicDepthBuffer?: boolean; } @@ -5106,7 +5111,7 @@ declare module THREE { * This class contains the parameters that define linear fog, i.e., that grows exponentially denser with the distance. */ export class FogExp2 implements IFog { - constructor(hex: number, density?: number); + constructor(hex: number|string, density?: number); name: string; color: Color; From 5b4d51844315721f62afb5f3b358e4fd2fc9f93d Mon Sep 17 00:00:00 2001 From: mc-petry Date: Tue, 15 Dec 2015 13:27:17 +0200 Subject: [PATCH 018/441] Update redux devtools to v3 --- .../redux-devtools-dock-monitor.d.ts | 63 ++++++++++ .../redux-devtools-log-monitor.d.ts | 43 +++++++ redux-devtools/redux-devtools-2.1.4-tests.tsx | 62 ++++++++++ redux-devtools/redux-devtools-2.1.4.d.ts | 109 +++++++++++++++++ redux-devtools/redux-devtools-tests.tsx | 84 +++++-------- redux-devtools/redux-devtools.d.ts | 113 ++---------------- 6 files changed, 318 insertions(+), 156 deletions(-) create mode 100644 redux-devtools-dock-monitor/redux-devtools-dock-monitor.d.ts create mode 100644 redux-devtools-log-monitor/redux-devtools-log-monitor.d.ts create mode 100644 redux-devtools/redux-devtools-2.1.4-tests.tsx create mode 100644 redux-devtools/redux-devtools-2.1.4.d.ts diff --git a/redux-devtools-dock-monitor/redux-devtools-dock-monitor.d.ts b/redux-devtools-dock-monitor/redux-devtools-dock-monitor.d.ts new file mode 100644 index 0000000000..f7e3ded8c6 --- /dev/null +++ b/redux-devtools-dock-monitor/redux-devtools-dock-monitor.d.ts @@ -0,0 +1,63 @@ +// Type definitions for redux-devtools-dock-monitor 1.0.1 +// Project: https://github.com/gaearon/redux-devtools-dock-monitor +// Definitions by: Petryshyn Sergii +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "redux-devtools-dock-monitor" { + import * as React from 'react' + + interface IDockMonitorProps { + /** + * Any valid Redux DevTools monitor. + */ + children?: React.ReactNode + + /** + * A key or a key combination that toggles the dock visibility. + * Must be recognizable by parse-key (for example, 'ctrl-h') + */ + toggleVisibilityKey: string + + /** + * A key or a key combination that toggles the dock position. + * Must be recognizable by parse-key (for example, 'ctrl-w') + */ + changePositionKey: string + + /** + * When true, the dock size is a fraction of the window size, fixed otherwise. + * + * @default true + */ + fluid?: boolean + + /** + * Size of the dock. When fluid is true, a float (0.5 means half the window size). + * When fluid is false, a width in pixels + * + * @default 0.3 (3/10th of the window size) + */ + defaultSize?: number + + /** + * Where the dock appears on the screen. + * Valid values: 'left', 'top', 'right', 'bottom' + * + * @default 'right' + */ + defaultPosition?: string + + /** + * @default true + */ + defaultIsVisible?: boolean + } + + class DockMonitor extends React.Component { + } + + let dockMonitor: (new () => DockMonitor) + export = dockMonitor +} \ No newline at end of file diff --git a/redux-devtools-log-monitor/redux-devtools-log-monitor.d.ts b/redux-devtools-log-monitor/redux-devtools-log-monitor.d.ts new file mode 100644 index 0000000000..0dbd2e107b --- /dev/null +++ b/redux-devtools-log-monitor/redux-devtools-log-monitor.d.ts @@ -0,0 +1,43 @@ +// Type definitions for redux-devtools-log-monitor 1.0.1 +// Project: https://github.com/gaearon/redux-devtools-log-monitor +// Definitions by: Petryshyn Sergii +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "redux-devtools-log-monitor" { + import * as React from 'react' + + interface ILogMonitorProps { + /** + * Either a string referring to one of the themes provided by + * redux-devtools-themes or a custom object of the same format. + * + * @see https://github.com/gaearon/redux-devtools-themes + */ + theme?: string + + /** + * A function that selects the slice of the state for DevTools to show. + * + * @example state => state.thePart.iCare.about. + * @default state => state. + */ + select?: (state: any) => any + + /** + * When true, records the current scroll top every second so it + * can be restored on refresh. This only has effect when used together + * with persistState() enhancer from Redux DevTools. + * + * @default true + */ + preserveScrollTop?: boolean + } + + class LogMonitor extends React.Component { + } + + var logMonitor: (new () => LogMonitor) + export = logMonitor +} \ No newline at end of file diff --git a/redux-devtools/redux-devtools-2.1.4-tests.tsx b/redux-devtools/redux-devtools-2.1.4-tests.tsx new file mode 100644 index 0000000000..c17aa38abd --- /dev/null +++ b/redux-devtools/redux-devtools-2.1.4-tests.tsx @@ -0,0 +1,62 @@ +/// +/// +/// + +import { compose, createStore, applyMiddleware, Middleware, Reducer } from 'redux'; +import { devTools, persistState } from 'redux-devtools'; +import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react'; +import * as React from 'react'; +import { Component } from 'react'; + +declare var m1: Middleware; +declare var m2: Middleware; +declare var m3: Middleware; +declare var reducer: Reducer; +class CounterApp extends Component { }; +class Provider extends Component<{ store: any }, any> { }; + +const finalCreateStore = compose( + // Enables your middleware: + applyMiddleware(m1, m2, m3), // any Redux middleware, e.g. redux-thunk + // Provides support for DevTools: + devTools(), + // Lets you write ?debug_session= in address bar to persist debug sessions + persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)) +)(createStore); +const store = finalCreateStore(reducer); + +class Root extends Component { + render() { + return ( +
+ + {() => } + + + + +
+ ); + } +} + +// +// https://github.com/gaearon/redux-devtools/blob/master/examples/counter/containers/App.js +// + +class App extends Component { + render() { + return ( +
+ + {() => } + + + + +
+ ); + } +} diff --git a/redux-devtools/redux-devtools-2.1.4.d.ts b/redux-devtools/redux-devtools-2.1.4.d.ts new file mode 100644 index 0000000000..7612adb7c9 --- /dev/null +++ b/redux-devtools/redux-devtools-2.1.4.d.ts @@ -0,0 +1,109 @@ +// Type definitions for redux-devtools 2.1.4 +// Project: https://github.com/gaearon/redux-devtools +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "redux-devtools" { + export function devTools(): Function; + export function persistState(sessionId: any, stateDeserializer?: Function, actionDeserializer?: Function): Function; +} + +declare module "redux-devtools/lib/react" { + import * as React from 'react'; + + export class DevTools extends React.Component { + + } + + export interface DevToolsProps { + monitor: Function; + store: Store; + } + + export interface Store { + devToolStore: DevToolStore; + } + + export class DevToolStore extends React.Component { + dispatch: Function; + } + + export class DebugPanel extends React.Component { } + + export interface DebugPanelProps { + position?: string; + zIndex?: number; + fontSize?: string; + overflow?: string; + opacity?: number; + color?: string; + left?: boolean|number; + right?: boolean|number; + top?: boolean|number; + bottom?: boolean|number; + maxHeight?: string; + maxWidth?: string; + wordWrap?: string; + boxSizing?: string; + boxShadow?: string; + getStyle?: () => DebugPanelProps; + } + + export class LogMonitor extends React.Component { } + + export interface LogMonitorProps { + computedStates?: ComputedState[]; + currentStateIndex?: number; + monitorState?: MonitorState; + stagedActions?: Action[]; + skippedActions?: boolean[]; + reset?: Function; + commit?: Function; + rollback?: Function; + sweep?: Function; + toggleAction?: Function; + jumpToState?: Function; + setMonitorState?: Function; + select?: Function; + visibleOnLoad?: boolean; + theme?: Theme|string; + } + + export interface ComputedState { + state?: any; + error?: string; + } + + export interface MonitorState { + isViaible?: boolean; + } + + export interface Action { + type: string; + } + + export interface Theme { + scheme: string; + author: string; + base00: string; + base01: string; + base02: string; + base03: string; + base04: string; + base05: string; + base06: string; + base07: string; + base08: string; + base09: string; + base0A: string; + base0B: string; + base0C: string; + base0D: string; + base0E: string; + base0F: string; + } +} + diff --git a/redux-devtools/redux-devtools-tests.tsx b/redux-devtools/redux-devtools-tests.tsx index c17aa38abd..45d5410910 100644 --- a/redux-devtools/redux-devtools-tests.tsx +++ b/redux-devtools/redux-devtools-tests.tsx @@ -1,62 +1,34 @@ -/// -/// /// +/// +/// +/// +/// +/// -import { compose, createStore, applyMiddleware, Middleware, Reducer } from 'redux'; -import { devTools, persistState } from 'redux-devtools'; -import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react'; -import * as React from 'react'; -import { Component } from 'react'; +import * as React from 'react' +import { createStore, applyMiddleware, compose } from 'redux' +import { Provider } from 'react-redux' +import { createDevTools, persistState } from 'redux-devtools' +import * as LogMonitor from 'redux-devtools-log-monitor' +import * as DockMonitor from 'redux-devtools-dock-monitor' -declare var m1: Middleware; -declare var m2: Middleware; -declare var m3: Middleware; -declare var reducer: Reducer; -class CounterApp extends Component { }; -class Provider extends Component<{ store: any }, any> { }; +const DevTools = createDevTools( + + + +) const finalCreateStore = compose( - // Enables your middleware: - applyMiddleware(m1, m2, m3), // any Redux middleware, e.g. redux-thunk - // Provides support for DevTools: - devTools(), - // Lets you write ?debug_session= in address bar to persist debug sessions - persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)) -)(createStore); -const store = finalCreateStore(reducer); + DevTools.instrument(), + persistState('test-session') +)(createStore) -class Root extends Component { - render() { - return ( -
- - {() => } - - - - -
- ); - } -} - -// -// https://github.com/gaearon/redux-devtools/blob/master/examples/counter/containers/App.js -// - -class App extends Component { - render() { - return ( -
- - {() => } - - - - -
- ); - } -} +class App extends React.Component { + render() { + return ( + + + + ) + } +} \ No newline at end of file diff --git a/redux-devtools/redux-devtools.d.ts b/redux-devtools/redux-devtools.d.ts index 7612adb7c9..8494b0322c 100644 --- a/redux-devtools/redux-devtools.d.ts +++ b/redux-devtools/redux-devtools.d.ts @@ -1,109 +1,22 @@ -// Type definitions for redux-devtools 2.1.4 +// Type definitions for redux-devtools 3.0.0 // Project: https://github.com/gaearon/redux-devtools -// Definitions by: Qubo -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: Petryshyn Sergii +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// /// declare module "redux-devtools" { - export function devTools(): Function; - export function persistState(sessionId: any, stateDeserializer?: Function, actionDeserializer?: Function): Function; -} + import * as React from 'react' -declare module "redux-devtools/lib/react" { - import * as React from 'react'; + interface IDevTools { + new (): JSX.ElementClass + instrument(): Function + } - export class DevTools extends React.Component { + export function createDevTools(el: React.ReactElement): IDevTools + export function persistState(debugSessionKey: () => string): Function - } - - export interface DevToolsProps { - monitor: Function; - store: Store; - } - - export interface Store { - devToolStore: DevToolStore; - } - - export class DevToolStore extends React.Component { - dispatch: Function; - } - - export class DebugPanel extends React.Component { } - - export interface DebugPanelProps { - position?: string; - zIndex?: number; - fontSize?: string; - overflow?: string; - opacity?: number; - color?: string; - left?: boolean|number; - right?: boolean|number; - top?: boolean|number; - bottom?: boolean|number; - maxHeight?: string; - maxWidth?: string; - wordWrap?: string; - boxSizing?: string; - boxShadow?: string; - getStyle?: () => DebugPanelProps; - } - - export class LogMonitor extends React.Component { } - - export interface LogMonitorProps { - computedStates?: ComputedState[]; - currentStateIndex?: number; - monitorState?: MonitorState; - stagedActions?: Action[]; - skippedActions?: boolean[]; - reset?: Function; - commit?: Function; - rollback?: Function; - sweep?: Function; - toggleAction?: Function; - jumpToState?: Function; - setMonitorState?: Function; - select?: Function; - visibleOnLoad?: boolean; - theme?: Theme|string; - } - - export interface ComputedState { - state?: any; - error?: string; - } - - export interface MonitorState { - isViaible?: boolean; - } - - export interface Action { - type: string; - } - - export interface Theme { - scheme: string; - author: string; - base00: string; - base01: string; - base02: string; - base03: string; - base04: string; - base05: string; - base06: string; - base07: string; - base08: string; - base09: string; - base0A: string; - base0B: string; - base0C: string; - base0D: string; - base0E: string; - base0F: string; - } -} + var factory: { instrument(): Function } + export default factory; +} \ No newline at end of file From 36e2ea37c5b57e0eaa7f2cddf52a1fa255a8b8f3 Mon Sep 17 00:00:00 2001 From: mc-petry Date: Tue, 15 Dec 2015 15:08:54 +0200 Subject: [PATCH 019/441] Add log & dock monitors tests, fix devtools persostState --- .../redux-devtools-dock-monitor-tests.tsx | 7 +++++++ .../redux-devtools-log-monitor-tests.tsx | 7 +++++++ redux-devtools/redux-devtools-tests.tsx | 11 ++++------- redux-devtools/redux-devtools.d.ts | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 redux-devtools-dock-monitor/redux-devtools-dock-monitor-tests.tsx create mode 100644 redux-devtools-log-monitor/redux-devtools-log-monitor-tests.tsx diff --git a/redux-devtools-dock-monitor/redux-devtools-dock-monitor-tests.tsx b/redux-devtools-dock-monitor/redux-devtools-dock-monitor-tests.tsx new file mode 100644 index 0000000000..dee4b39c2a --- /dev/null +++ b/redux-devtools-dock-monitor/redux-devtools-dock-monitor-tests.tsx @@ -0,0 +1,7 @@ +/// +/// + +import * as React from 'react' +import * as DockMonitor from 'redux-devtools-dock-monitor' + +let dockMonitor = \ No newline at end of file diff --git a/redux-devtools-log-monitor/redux-devtools-log-monitor-tests.tsx b/redux-devtools-log-monitor/redux-devtools-log-monitor-tests.tsx new file mode 100644 index 0000000000..a472705e4c --- /dev/null +++ b/redux-devtools-log-monitor/redux-devtools-log-monitor-tests.tsx @@ -0,0 +1,7 @@ +/// +/// + +import * as React from 'react' +import * as LogMonitor from 'redux-devtools-log-monitor' + +let logMonitor = \ No newline at end of file diff --git a/redux-devtools/redux-devtools-tests.tsx b/redux-devtools/redux-devtools-tests.tsx index 45d5410910..2cacd47c7a 100644 --- a/redux-devtools/redux-devtools-tests.tsx +++ b/redux-devtools/redux-devtools-tests.tsx @@ -1,21 +1,18 @@ /// /// /// -/// -/// /// import * as React from 'react' import { createStore, applyMiddleware, compose } from 'redux' import { Provider } from 'react-redux' import { createDevTools, persistState } from 'redux-devtools' -import * as LogMonitor from 'redux-devtools-log-monitor' -import * as DockMonitor from 'redux-devtools-dock-monitor' + +class DevToolsMonitor extends React.Component { +} const DevTools = createDevTools( - - - + ) const finalCreateStore = compose( diff --git a/redux-devtools/redux-devtools.d.ts b/redux-devtools/redux-devtools.d.ts index 8494b0322c..47ad2198d9 100644 --- a/redux-devtools/redux-devtools.d.ts +++ b/redux-devtools/redux-devtools.d.ts @@ -14,7 +14,7 @@ declare module "redux-devtools" { } export function createDevTools(el: React.ReactElement): IDevTools - export function persistState(debugSessionKey: () => string): Function + export function persistState(debugSessionKey: string): Function var factory: { instrument(): Function } From 31c6eea1529cb2d35c87e0c3975ea7c50b87f449 Mon Sep 17 00:00:00 2001 From: mc-petry Date: Tue, 15 Dec 2015 15:16:56 +0200 Subject: [PATCH 020/441] Fix redux-devtools 2.1.4 tests --- redux-devtools/redux-devtools-2.1.4-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redux-devtools/redux-devtools-2.1.4-tests.tsx b/redux-devtools/redux-devtools-2.1.4-tests.tsx index c17aa38abd..a57811f16b 100644 --- a/redux-devtools/redux-devtools-2.1.4-tests.tsx +++ b/redux-devtools/redux-devtools-2.1.4-tests.tsx @@ -1,4 +1,4 @@ -/// +/// /// /// From 08f607cb8bb0014eaba4633e01fc62339ec22e90 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Tue, 15 Dec 2015 21:05:00 +0200 Subject: [PATCH 021/441] Definition file added --- .../react-notification-system.d.ts | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 react-notification-system/react-notification-system.d.ts diff --git a/react-notification-system/react-notification-system.d.ts b/react-notification-system/react-notification-system.d.ts new file mode 100644 index 0000000000..52a5d7d988 --- /dev/null +++ b/react-notification-system/react-notification-system.d.ts @@ -0,0 +1,89 @@ +// Type definitions for React Notification System v0.2.6 +// Project: https://www.npmjs.com/package/react-notification-system +// Definitions by: Giedrius Grabauskas , Deividas Bakanas +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module NotificationSystem { + + import React = __React; + + export interface System extends React.Component { + addNotification(notification: Notification): Notification; + removeNotification(notification: Notification): void; + removeNotification(uid: string): void; + } + + export interface CallBackFunction { + (notification: Notification): void; + } + + export interface Notification { + title?: string; + message?: string; + level?: string; + position?: string; + autoDismiss?: number; + dismissible?: boolean; + action?: ActionObject; + onAdd?: CallBackFunction; + onRemove?: CallBackFunction; + uid?: number | string; + } + + export interface ActionObject { + label: string; + callback?: Function; + } + + export interface ContainersStyle { + DefaultStyle: React.CSSProperties; + tl?: React.CSSProperties; + tr?: React.CSSProperties; + tc?: React.CSSProperties; + bl?: React.CSSProperties; + br?: React.CSSProperties; + bc?: React.CSSProperties; + } + + export interface ItemStyle { + DefaultStyle?: React.CSSProperties; + success?: React.CSSProperties; + error?: React.CSSProperties; + warning?: React.CSSProperties; + info?: React.CSSProperties; + } + + export interface WrapperStyle { + DefaultStyle?: React.CSSProperties; + } + + export interface Style { + Wrapper?: any; + Containers?: ContainersStyle; + NotificationItem?: ItemStyle; + Title?: ItemStyle; + MessageWrapper?: WrapperStyle; + Dismiss?: ItemStyle; + Action?: ItemStyle; + ActionWrapper?: WrapperStyle; + } + + export interface Attributes { + noAnimation?: boolean; + ref?: string; + style?: Style | boolean; + } + + + export interface Component { + (): React.ReactElement; + } +} + + +declare module 'react-notification-system' { + var component: NotificationSystem.Component; + export = component; +} From 13a6bf3c0f418dadec4bc4db85866b83ee817636 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Tue, 15 Dec 2015 21:05:47 +0200 Subject: [PATCH 022/441] Test file added --- .../react-notification-system-test.ts | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 react-notification-system/react-notification-system-test.ts diff --git a/react-notification-system/react-notification-system-test.ts b/react-notification-system/react-notification-system-test.ts new file mode 100644 index 0000000000..07cd8ff2c9 --- /dev/null +++ b/react-notification-system/react-notification-system-test.ts @@ -0,0 +1,62 @@ +/// +/// + +import React = require('react'); +import NotificationSystem = require('react-notification-system'); + + +class MyComponent extends React.Component { + private notificationSystem: NotificationSystem.System = null; + + private notification: NotificationSystem.Notification = { + message: 'Notification message', + level: 'success', + action: { + label: "Button inside this notification", + callback: () => { + this.notificationSystem.removeNotification(this.notification); + } + } + }; + + private addNotification() { + this.notification = this.notificationSystem.addNotification(this.notification); + } + + componentDidMount() { + this.notificationSystem = this.refs['notificationSystem'] as NotificationSystem.System; + this.addNotification(); + } + + render() { + + var style = { + NotificationItem: { // Override the notification item + DefaultStyle: { // Applied to every notification, regardless of the notification level + margin: '10px 5px 2px 1px' + }, + + success: { // Applied only to the success notification item + color: 'red' + } + } + }; + + var attributes: NotificationSystem.Attributes = { + style: { + Containers: { + DefaultStyle: { + margin: '10px 5px 2px 1px' + } + }, + Title: { + success: { + color: 'green' + } + } + } + }; + + return React.createElement(NotificationSystem, { title: "NotificationTitile", style: style, } as NotificationSystem.Attributes); + } +} From a507ed9ef2955734b3cf362a0a74b21c7241cebc Mon Sep 17 00:00:00 2001 From: mc-petry Date: Wed, 16 Dec 2015 12:36:41 +0200 Subject: [PATCH 023/441] Use ES6 default style export --- .../redux-devtools-dock-monitor-tests.tsx | 2 +- .../redux-devtools-dock-monitor.d.ts | 6 +----- .../redux-devtools-log-monitor-tests.tsx | 2 +- redux-devtools-log-monitor/redux-devtools-log-monitor.d.ts | 6 +----- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/redux-devtools-dock-monitor/redux-devtools-dock-monitor-tests.tsx b/redux-devtools-dock-monitor/redux-devtools-dock-monitor-tests.tsx index dee4b39c2a..00845bdc0a 100644 --- a/redux-devtools-dock-monitor/redux-devtools-dock-monitor-tests.tsx +++ b/redux-devtools-dock-monitor/redux-devtools-dock-monitor-tests.tsx @@ -2,6 +2,6 @@ /// import * as React from 'react' -import * as DockMonitor from 'redux-devtools-dock-monitor' +import DockMonitor from 'redux-devtools-dock-monitor' let dockMonitor = \ No newline at end of file diff --git a/redux-devtools-dock-monitor/redux-devtools-dock-monitor.d.ts b/redux-devtools-dock-monitor/redux-devtools-dock-monitor.d.ts index f7e3ded8c6..09e3d96036 100644 --- a/redux-devtools-dock-monitor/redux-devtools-dock-monitor.d.ts +++ b/redux-devtools-dock-monitor/redux-devtools-dock-monitor.d.ts @@ -55,9 +55,5 @@ declare module "redux-devtools-dock-monitor" { defaultIsVisible?: boolean } - class DockMonitor extends React.Component { - } - - let dockMonitor: (new () => DockMonitor) - export = dockMonitor + export default class DockMonitor extends React.Component {} } \ No newline at end of file diff --git a/redux-devtools-log-monitor/redux-devtools-log-monitor-tests.tsx b/redux-devtools-log-monitor/redux-devtools-log-monitor-tests.tsx index a472705e4c..dbcdbcf7a2 100644 --- a/redux-devtools-log-monitor/redux-devtools-log-monitor-tests.tsx +++ b/redux-devtools-log-monitor/redux-devtools-log-monitor-tests.tsx @@ -2,6 +2,6 @@ /// import * as React from 'react' -import * as LogMonitor from 'redux-devtools-log-monitor' +import LogMonitor from 'redux-devtools-log-monitor' let logMonitor = \ No newline at end of file diff --git a/redux-devtools-log-monitor/redux-devtools-log-monitor.d.ts b/redux-devtools-log-monitor/redux-devtools-log-monitor.d.ts index 0dbd2e107b..8c96c804da 100644 --- a/redux-devtools-log-monitor/redux-devtools-log-monitor.d.ts +++ b/redux-devtools-log-monitor/redux-devtools-log-monitor.d.ts @@ -35,9 +35,5 @@ declare module "redux-devtools-log-monitor" { preserveScrollTop?: boolean } - class LogMonitor extends React.Component { - } - - var logMonitor: (new () => LogMonitor) - export = logMonitor + export default class LogMonitor extends React.Component {} } \ No newline at end of file From ea6787006265bcfbb7a051f85dfd2f74506a0a01 Mon Sep 17 00:00:00 2001 From: amritk Date: Wed, 16 Dec 2015 15:25:21 -0800 Subject: [PATCH 024/441] Updated stripe.d.ts Added bank account methods for managed accounts. --- stripe/stripe.d.ts | 48 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/stripe/stripe.d.ts b/stripe/stripe.d.ts index 96d8758bc7..f18dff0ee4 100644 --- a/stripe/stripe.d.ts +++ b/stripe/stripe.d.ts @@ -1,6 +1,6 @@ // Type definitions for stripe // Project: https://stripe.com/ -// Definitions by: Andy Hawkins , Eric J. Smith +// Definitions by: Andy Hawkins , Eric J. Smith , Amrit Kahlon // Definitions: https://github.com/borisyankov/DefinitelyTyped interface StripeStatic { @@ -11,7 +11,8 @@ interface StripeStatic { cardType(cardNumber: string): string; getToken(token: string, responseHandler: (status: number, response: StripeTokenResponse) => void): void; card: StripeCardData; - createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void; + createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void; + bankAccount: StripeBankAccount; } interface StripeTokenData { @@ -40,7 +41,10 @@ interface StripeTokenResponse { } interface StripeError { + type: string; + code: string; message: string; + param?: string; } interface StripeCardData { @@ -60,7 +64,45 @@ interface StripeCardData { address_country?: string; } +interface StripeBankAccount +{ + createToken(params: StripeBankTokenParams, stripeResponseHandler: (response: StripeBankTokenResponse) => void): void; + validateRoutingNumber(routingNumber: number | string, countryCode: string): boolean; + validateAccountNumber(accountNumber: number | string, countryCode: string): boolean; +} + +interface StripeBankTokenParams +{ + country: string; + currency: string; + routing_number?: number | string; + account_number?: number | string; + transit_number?: number | string; + institution_number?: number | string; + bsb?: number | string; + sort_code?: string; + iban?: string; +} + +interface StripeBankTokenResponse +{ + id: string; + bank_account: { + country: string; + bank_name: string; + last4: number; + validated: boolean; + object: string; + }; + created: number; + livemode: boolean; + type: string; + object: string; + used: boolean; + error: StripeError; +} + declare var Stripe: StripeStatic; declare module "Stripe" { - export = StripeStatic; + export = StripeStatic; } From b6f9544291b2fc44e33771c699158a3a0543a331 Mon Sep 17 00:00:00 2001 From: amritk Date: Wed, 16 Dec 2015 15:33:27 -0800 Subject: [PATCH 025/441] update stripe.d.ts Added status to bank token creation response --- stripe/stripe.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stripe/stripe.d.ts b/stripe/stripe.d.ts index f18dff0ee4..3fcf771e35 100644 --- a/stripe/stripe.d.ts +++ b/stripe/stripe.d.ts @@ -66,7 +66,7 @@ interface StripeCardData { interface StripeBankAccount { - createToken(params: StripeBankTokenParams, stripeResponseHandler: (response: StripeBankTokenResponse) => void): void; + createToken(params: StripeBankTokenParams, stripeResponseHandler: (status:number, response: StripeBankTokenResponse) => void): void; validateRoutingNumber(routingNumber: number | string, countryCode: string): boolean; validateAccountNumber(accountNumber: number | string, countryCode: string): boolean; } From 8907ae9ff9c1b62b1883190871aafbe0f5574203 Mon Sep 17 00:00:00 2001 From: amritk Date: Wed, 16 Dec 2015 16:26:17 -0800 Subject: [PATCH 026/441] update stripe.d.ts All those extra bank fields are passed as routing number. --- stripe/stripe.d.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/stripe/stripe.d.ts b/stripe/stripe.d.ts index 3fcf771e35..06901ee9f2 100644 --- a/stripe/stripe.d.ts +++ b/stripe/stripe.d.ts @@ -75,13 +75,8 @@ interface StripeBankTokenParams { country: string; currency: string; + account_number: number | string; routing_number?: number | string; - account_number?: number | string; - transit_number?: number | string; - institution_number?: number | string; - bsb?: number | string; - sort_code?: string; - iban?: string; } interface StripeBankTokenResponse From a30d1017ee9f822c332eaba3d128dd0af5f00816 Mon Sep 17 00:00:00 2001 From: amritk Date: Wed, 16 Dec 2015 18:32:12 -0800 Subject: [PATCH 027/441] Update stripe.d.ts --- stripe/stripe.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/stripe/stripe.d.ts b/stripe/stripe.d.ts index 06901ee9f2..27d60d961a 100644 --- a/stripe/stripe.d.ts +++ b/stripe/stripe.d.ts @@ -83,6 +83,7 @@ interface StripeBankTokenResponse { id: string; bank_account: { + id: string; country: string; bank_name: string; last4: number; From 389b49fc0e89bcdbdc0ca0ec8167099941e60501 Mon Sep 17 00:00:00 2001 From: WAEL BEN ZID Date: Fri, 18 Dec 2015 16:18:08 +0100 Subject: [PATCH 028/441] Definition for prettyjson package added --- prettyjson/prettyjson-tests.ts | 18 +++++++++++ prettyjson/prettyjson.d.ts | 59 ++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 prettyjson/prettyjson-tests.ts create mode 100644 prettyjson/prettyjson.d.ts diff --git a/prettyjson/prettyjson-tests.ts b/prettyjson/prettyjson-tests.ts new file mode 100644 index 0000000000..4df6b1fc87 --- /dev/null +++ b/prettyjson/prettyjson-tests.ts @@ -0,0 +1,18 @@ +/// + +var options: prettyjson.IOptions, + input: string, + output: string; + + +input = 'This is a string'; +output = prettyjson.render(input); + +output = prettyjson.render(input, {}, 4); + +output = prettyjson.render(['first string', ['nested 1', 'nested 2'], 'second string']); + +output = prettyjson.render({param1: 'first string', param2: 'second string'}); + +output = prettyjson.render({first_param: {subparam: 'first string', subparam2: 'another string'}, second_param: 'second string'}); + diff --git a/prettyjson/prettyjson.d.ts b/prettyjson/prettyjson.d.ts new file mode 100644 index 0000000000..f1f0dbf23f --- /dev/null +++ b/prettyjson/prettyjson.d.ts @@ -0,0 +1,59 @@ +// Type definitions for prettyjson +// Project: https://github.com/rafeca/prettyjson +// Definitions by: Wael BEN ZID EL GUEBSI +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare module PrettyJSON { + + /** + * Defines prettyjson version + */ + export var version: string; + + /** + * Render pretty json. + * + * @param data {Object} Data to prettify. + * @param options {IOptions} Hash with different options to configure the renderer. + * @param indentation {number} Indentation size. + * + * @return {string} pretty serialized json data ready to display. + */ + export function render(data: Object, options?: IOptions, indentation?: number): string; + + /** + * Render pretty json from a string. + * + * @param data {string} Serialized JSON data to prettify. + * @param options {IOptions} Hash with different options to configure the renderer. + * @param indentation {number} Indentation size. + * + * @return {string} pretty serialized json data ready to display. + */ + export function renderString(data: string, options?: IOptions, indentation?: number): string; + + export interface IOptions { + + /** + * Define behavior for Array objects + */ + emptyArrayMsg ?: string; // default: (empty) + inlineArrays ?: boolean; + + /** + * Color definition + */ + noColor ?: boolean; + keysColor ?: string; + dashColor ?: string; + numberColor ?: string; + stringColor ?: string; + + defaultIndentation ?: number; + } +} + +declare module "prettyjson" { + export = PrettyJSON; +} From c69185b594b5a846b84ce1f89864b44cda727df1 Mon Sep 17 00:00:00 2001 From: Georgios Valotasios Date: Sun, 20 Dec 2015 20:58:08 +0100 Subject: [PATCH 029/441] Adapted jade not to have a default export --- jade/jade-tests.ts | 2 +- jade/jade.d.ts | 21 +++++++++------------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/jade/jade-tests.ts b/jade/jade-tests.ts index 8a2b6b48de..fa11968eaf 100644 --- a/jade/jade-tests.ts +++ b/jade/jade-tests.ts @@ -1,6 +1,6 @@ /// -import jade from 'jade'; +import jade = require('jade'); jade.compile("b")(); jade.compileFile("foo.jade", {})(); diff --git a/jade/jade.d.ts b/jade/jade.d.ts index 9615fa8c87..0764006e56 100644 --- a/jade/jade.d.ts +++ b/jade/jade.d.ts @@ -4,16 +4,13 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module 'jade' { - module jade { - function compile(template: string, options?: any): (locals?: any) => string; - function compileFile(path: string, options?: any): (locals?: any) => string; - function compileClient(template: string, options?: any): (locals?: any) => string; - function compileClientWithDependenciesTracked(template: string, options?: any): { - body: (locals?: any) => string; - dependencies: string[]; - }; - function render(template: string, options?: any): string; - function renderFile(path: string, options?: any): string; - } - export default jade; + export function compile(template: string, options?: any): (locals?: any) => string; + export function compileFile(path: string, options?: any): (locals?: any) => string; + export function compileClient(template: string, options?: any): (locals?: any) => string; + export function compileClientWithDependenciesTracked(template: string, options?: any): { + body: (locals?: any) => string; + dependencies: string[]; + }; + export function render(template: string, options?: any): string; + export function renderFile(path: string, options?: any): string; } From c09bd959175c3ca80ef4a92bcbac93307f266c12 Mon Sep 17 00:00:00 2001 From: Adi Stadelmann Date: Sun, 20 Dec 2015 20:54:28 +0100 Subject: [PATCH 030/441] Add layout.partition because was removed by commit 7600257 --- d3/d3.d.ts | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 236b87d55e..1f5ebe7a1e 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -3032,6 +3032,46 @@ declare module d3 { padding(padding: number): Pack; } + export function partition(): Partition; + export function partition(): Partition; + + module partition { + interface Link { + source: T; + target: T; + } + + interface Node { + parent?: Node; + children?: number; + value?: number; + depth?: number; + x?: number; + y?: number; + dx?: number; + dy?: number; + } + + } + + export interface Partition { + nodes(root: T): T[]; + + links(nodes: T[]): partition.Link[]; + + children(): (node: T, depth: number) => T[]; + children(children: (node: T, depth: number) => T[]): Partition; + + sort(): (a: T, b: T) => number; + sort(comparator: (a: T, b: T) => number): Partition; + + value(): (node: T) => number; + value(value: (node: T) => number): Partition; + + size(): [number, number]; + size(size: [number, number]): Partition; + } + export function pie(): Pie; export function pie(): Pie; From 3aff56f2323c7217fc8806ab51656e1126ddb3a6 Mon Sep 17 00:00:00 2001 From: PjMitchell Date: Sun, 20 Dec 2015 20:51:20 +0000 Subject: [PATCH 031/441] Added Initial nvd3 definitions --- nvd3/nvd-test-bullet.ts | 46 +++++ nvd3/nvd-test-bulletChart.ts | 72 ++++++++ nvd3/nvd3-test-boxplot.ts | 57 ++++++ nvd3/nvd3-test-historicalBar.ts | 59 +++++++ nvd3/nvd3-test-historicalBarChart.ts | 165 ++++++++++++++++++ nvd3/nvd3-test-legend.ts | 67 +++++++ nvd3/nvd3-test-ohlcChart.ts | 36 ++++ nvd3/nvd3-test-tooltip.ts | 55 ++++++ nvd3/nvd3.d.ts | 252 +++++++++++++++++++++++++++ 9 files changed, 809 insertions(+) create mode 100644 nvd3/nvd-test-bullet.ts create mode 100644 nvd3/nvd-test-bulletChart.ts create mode 100644 nvd3/nvd3-test-boxplot.ts create mode 100644 nvd3/nvd3-test-historicalBar.ts create mode 100644 nvd3/nvd3-test-historicalBarChart.ts create mode 100644 nvd3/nvd3-test-legend.ts create mode 100644 nvd3/nvd3-test-ohlcChart.ts create mode 100644 nvd3/nvd3-test-tooltip.ts create mode 100644 nvd3/nvd3.d.ts diff --git a/nvd3/nvd-test-bullet.ts b/nvd3/nvd-test-bullet.ts new file mode 100644 index 0000000000..7ec2363e0f --- /dev/null +++ b/nvd3/nvd-test-bullet.ts @@ -0,0 +1,46 @@ +/// +/// + +var width = 960, + height = 55, + margin = {top: 5, right: 40, bottom: 20, left: 120}; + + var chart = nv.models.bullet() + .width(width - margin.right - margin.left) + .height(height - margin.top - margin.bottom); + + var data = [ + {"title":"Revenue","subtitle":"US$, in thousands","ranges":[-150,-225,-300],"measures":[-220],"markers":[-250]} + ]; + + //TODO: to be consistent with other models, should be appending a g to an already made svg, not creating the svg element + var vis = d3.select("#chart").selectAll("svg") + .data(data) + .enter().append("svg") + .attr("class", "bullet nvd3") + .attr("width", width) + .attr("height", height); + + vis.transition().duration(1000).call(chart); + + var transition = function() { + vis.datum(randomize); + vis.transition().duration(1000).call(chart); + }; + + function randomize(d) { + if (!d.randomizer) d.randomizer = randomizer(d); + d.ranges = d.ranges.map(d.randomizer); + d.markers = d.markers.map(d.randomizer); + d.measures = d.measures.map(d.randomizer); + return d; + } + + function randomizer(d) { + var k = d3.max(d.ranges) * .2; + return function(d) { + return Math.max(0, d + k * (Math.random() - .5)); + }; + } + + d3.select('body').on('click', transition); \ No newline at end of file diff --git a/nvd3/nvd-test-bulletChart.ts b/nvd3/nvd-test-bulletChart.ts new file mode 100644 index 0000000000..eb727589e9 --- /dev/null +++ b/nvd3/nvd-test-bulletChart.ts @@ -0,0 +1,72 @@ +/// +/// + +var width = 960, + height = 80, + margin = {top: 5, right: 40, bottom: 20, left: 120}; + +var chart = nv.models.bulletChart() + .width(width - margin.right - margin.left) + .height(height - margin.top - margin.bottom); + +var chart2 = nv.models.bulletChart() + .width(width - margin.right - margin.left) + .height(height - margin.top - margin.bottom); + +var data = [ + {"title":"Revenue","subtitle":"US$, in thousands","ranges":[150,225,300],"measures":[220],"markers":[250]}, + {"title":"Order Size","subtitle":"US$, average","ranges":[350,500,600],"measures":[100],"markers":[550]}, + {"title":"Satisfaction","subtitle":"out of 5","ranges":[3.5,4.25,5],"measures":[3.2,4.7],"markers":[4.4]} +]; + +var dataWithLabels = [{ + "title":"Revenue", + "subtitle":"US$, in thousands", + "ranges":[150,225,300], + "measures":[220], + "markers":[250, 100], + "markerLabels":['Target Inventory', 'Low Inventory'], + "rangeLabels":['Maximum Inventory','Average Inventory','Minimum Inventory'], + "measureLabels":['Current Inventory'] +}]; + +//TODO: to be consistent with other models, should be appending a g to an already made svg, not creating the svg element +var vis = d3.select("#chart").selectAll("svg") + .data(data) + .enter().append("svg") + .attr("class", "bullet nvd3") + .attr("width", width) + .attr("height", height); + +vis.transition().duration(1000).call(chart); + +var vis2 = d3.select("#chart2").selectAll("svg") + .data(dataWithLabels) + .enter().append('svg') + .attr('class',"bullet nvd3") + .attr("width",width) + .attr("height",height); + +vis2.transition().duration(1000).call(chart2); + +var transition = function() { + vis.datum(randomize).transition().duration(1000).call(chart); + vis2.datum(randomize).transition().duration(1000).call(chart2); +}; + +function randomize(d) { + if (!d.randomizer) d.randomizer = randomizer(d); + d.ranges = d.ranges.map(d.randomizer); + d.markers = d.markers.map(d.randomizer); + d.measures = d.measures.map(d.randomizer); + return d; +} + +function randomizer(d) { + var k = d3.max(d.ranges) * .2; + return function(d) { + return Math.max(0, d + k * (Math.random() - .5)); + }; + } + + d3.select('body').on('click', transition); \ No newline at end of file diff --git a/nvd3/nvd3-test-boxplot.ts b/nvd3/nvd3-test-boxplot.ts new file mode 100644 index 0000000000..3b78095314 --- /dev/null +++ b/nvd3/nvd3-test-boxplot.ts @@ -0,0 +1,57 @@ +/// +/// +nv.addGraph(function() { + var chart = nv.models.boxPlotChart() + .x(function(d) { return d.label }) + .y(function(d) { return d.values.Q3 }) + .staggerLabels(true) + .maxBoxWidth(75) // prevent boxes from being incredibly wide + .yDomain([0, 500]) + ; + + d3.select('#chart1 svg') + .datum(exampleData()) + .call(chart); + + nv.utils.windowResize(chart.update); + + return chart; + }); + + function exampleData() { + return [ + { + label: "Sample A", + values: { + Q1: 120, + Q2: 150, + Q3: 200, + whisker_low: 115, + whisker_high: 210, + outliers: [50, 100, 225] + }, + }, + { + label: "Sample B", + values: { + Q1: 300, + Q2: 350, + Q3: 400, + whisker_low: 225, + whisker_high: 425, + outliers: [175] + }, + }, + { + label: "Sample C", + values: { + Q1: 50, + Q2: 100, + Q3: 125, + whisker_low: 25, + whisker_high: 175, + outliers: [0] + }, + } + ]; + } \ No newline at end of file diff --git a/nvd3/nvd3-test-historicalBar.ts b/nvd3/nvd3-test-historicalBar.ts new file mode 100644 index 0000000000..dc765cdcda --- /dev/null +++ b/nvd3/nvd3-test-historicalBar.ts @@ -0,0 +1,59 @@ +/// +/// +nv.addGraph({ + generate: function() { + var chart = nv.models.historicalBar(); + + d3.select("#test1") + .datum(sinData()) + .datum(sinData()) + .transition() + .call(chart); + + return chart; + }, + callback: function(graph) { + graph.dispatch.on('elementMouseover', function(e) { + var offsetElement = document.getElementById("chart"), + left = e.pos[0], + top = e.pos[1]; + var content = '

' + e.point.y + '

'; + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's'); + }); + + graph.dispatch.on('elementMouseout', function(e) { + nv.tooltip.cleanup(); + }); + } +}); + +//Simple test data generators +function sinAndCos() { + var sin = [], + cos = []; + + for (var i = 0; i < 100; i++) { + sin.push({x: i, y: Math.sin(i/10)}); + cos.push({x: i, y: .5 * Math.cos(i/10)}); + } + + return [ + {values: sin, key: "Sine Wave", color: "#ff7f0e"}, + {values: cos, key: "Cosine Wave", color: "#2ca02c"} + ]; +} + +function sinData() { + var sin = []; + + for (var i = 0; i < 100; i++) { + sin.push({x: i, y: Math.sin(i/10)}); + } + + return [{ + values: sin, + key: "Sine Wave", + color: "#ff7f0e" + }]; +} \ No newline at end of file diff --git a/nvd3/nvd3-test-historicalBarChart.ts b/nvd3/nvd3-test-historicalBarChart.ts new file mode 100644 index 0000000000..dfd8a30aef --- /dev/null +++ b/nvd3/nvd3-test-historicalBarChart.ts @@ -0,0 +1,165 @@ +/// +/// +var data = [{ + values : [] + }]; + + var i, x; + var gap = false; + var prevVal = 3000; + var tickCount = 100; + var probEnterGap = 0.1; + var probExitGap = 0.2; + var barTimespan = 30 * 60; // thirty minutes in seconds + var startOfTime = 1425096000; + for (i = 0; i < tickCount; i++) { + x = startOfTime + i * barTimespan; + if (!gap) { + if (Math.random() > probEnterGap) { + prevVal += (Math.random() - 0.5) * 500; + if (prevVal <= 0) { + prevVal = Math.random() * 100; + } + data[0].values.push({x: x * 1000, y: prevVal}); + } + else { + gap = true; + } + } + else { + if (Math.random() < probExitGap) { + gap = false; + } + } + } + + var chart : nv.HistoricalBarChart; + + var halfBarXMin = data[0].values[0].x - barTimespan / 2 * 1000; + var halfBarXMax = data[0].values[data[0].values.length-1].x + barTimespan / 2 * 1000; + + function renderChart(location, meaning) { + nv.addGraph(function() { + chart = nv.models.historicalBarChart(); + chart + .xScale(d3.time.scale()) // use a time scale instead of plain numbers in order to get nice round default values in the axis + .color(['#68c']) + .forceX([halfBarXMin, halfBarXMax]) // fix half-bar problem on the first and last bars + .useInteractiveGuideline(true) // check out the css that turns the guideline into this nice thing + .margin({"left": 80, "right": 50, "top": 20, "bottom": 30}) + .duration(0) + ; + + var tickMultiFormat = d3.time.format.multi([ + ["%-I:%M%p", function(d) { return d.getMinutes(); }], // not the beginning of the hour + ["%-I%p", function(d) { return d.getHours(); }], // not midnight + ["%b %-d", function(d) { return d.getDate() != 1; }], // not the first of the month + ["%b %-d", function(d) { return d.getMonth(); }], // not Jan 1st + ["%Y", function() { return true; }] + ]); + chart.xAxis + .showMaxMin(false) + .tickPadding(10) + .tickFormat(function (d) { return tickMultiFormat(new Date(d)); }) + ; + + chart.yAxis + .showMaxMin(false) + .tickFormat(d3.format(",.0f")) + ; + + var svgElem = d3.select(location); + svgElem + .datum(data) + .transition() + .call(chart); + + // make our own x-axis tick marks because NVD3 doesn't provide any + var tickY2 = chart.yAxis.scale().range()[1]; + var lineElems = svgElem + .select('.nv-x.nv-axis.nvd3-svg') + .select('.nvd3.nv-wrap.nv-axis') + .select('g') + .selectAll('.tick') + .data(chart.xScale().ticks()) + .append('line') + .attr('class', 'x-axis-tick-mark') + .attr('x2', 0) + .attr('y1', tickY2 + 4) + .attr('y2', tickY2) + .attr('stroke-width', 1) + ; + + // set up the tooltip to display full dates + var tsFormat = d3.time.format('%b %-d, %Y %I:%M%p'); + var contentGenerator = chart.interactiveLayer.tooltip.contentGenerator(); + var tooltip = chart.interactiveLayer.tooltip; + tooltip.contentGenerator(function (d) { d.value = d.series[0].data.x; return contentGenerator(d); }); + tooltip.headerFormatter(function (d) { return tsFormat(new Date(d)); }); + + // common stuff for the sections below + var xScale = chart.xScale(); + var xPixelFirstBar = xScale(data[0].values[0].x); + var xPixelSecondBar = xScale(data[0].values[0].x + barTimespan * 1000); + var barWidth = xPixelSecondBar - xPixelFirstBar; // number of pixels representing time delta per bar + + // fix the bar widths so they don't overlap when there are gaps + function fixBarWidths(barSpacingFraction) { + svgElem + .selectAll('.nv-bars') + .selectAll('rect') + .attr('width', (1 - barSpacingFraction) * barWidth) + .attr('transform', function(d, i) { + var deltaX = xScale(data[0].values[i].x) - xPixelFirstBar; + deltaX += barSpacingFraction / 2 * barWidth; + return 'translate(' + deltaX + ', 0)'; + }) + ; + } + + /* + If you're representing sample measurements spaced a certain time apart, the tick marks should + be in the middle of the bars and some spacing between bars is recommended to aid with interpretation. + On the other hand, if you want to represent a quantity measured over a span of time (one bar), you're + better off placing the ticks on the edge of the bar and leaving no gap in between bars. + */ + function shiftXAxis() { + var xAxisElem = svgElem.select('.nv-axis.nv-x'); + var transform = xAxisElem.attr('transform'); + var xShift = -barWidth/2; + transform = transform.replace('0,', xShift + ','); + xAxisElem.attr('transform', transform); + } + + if (meaning === 'instant') { + fixBarWidths(0.2); + } + else if (meaning === 'timespan') { + fixBarWidths(0.0); + shiftXAxis(); + } + + return chart; + }); + } + + renderChart('#test1', 'instant'); + renderChart('#test2', 'timespan'); + + window.setTimeout(function() { + window.setTimeout(function() { + document.getElementById('sc-one').style.display = 'block'; + document.getElementById('sc-two').style.display = 'none'; + }, 0); + }, 0); + + function switchChartStyle(style) { + if (style === 'instant') { + document.getElementById('sc-one').style.display = 'block'; + document.getElementById('sc-two').style.display = 'none'; + } + else if (style === 'timespan') { + document.getElementById('sc-one').style.display = 'none'; + document.getElementById('sc-two').style.display = 'block'; + } + } diff --git a/nvd3/nvd3-test-legend.ts b/nvd3/nvd3-test-legend.ts new file mode 100644 index 0000000000..81f39d2dad --- /dev/null +++ b/nvd3/nvd3-test-legend.ts @@ -0,0 +1,67 @@ +/// +/// +var width = 500, + height = 20; + + var legend = nv.models.legend(); + + d3.select('#test1') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()); + + var legend2 = nv.models.legend() + .align(false); + + d3.select('#test2') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()).call(legend2); + + var legend3 = nv.models.legend() + .width(900) + .padding(70); + + d3.select('#test3') + .attr('width', 900) + .attr('height', 200) + .datum(sinAndCos()).call(legend3); + + var update = function() { + d3.select('#test1').call(legend); + } + + update(); + legend.dispatch.on('stateChange', function(d) { + console.log(d); + update(); + }); + + d3.select('#changeData').on('click', function() { + d3.select('#test1') + .datum(differentData()) + .call(legend); + }); + + function sinAndCos() { + return [ + {key: "Sine Wave"}, + {key: "A Very Long Label With Over Twenty Characters"}, + {key: "A Very Long Series Label With Over Twenty Characters"}, + {key: "A Very Long Series Label With Over Twenty Characters"}, + {key: "Cosine Wave"}, + {key: "Another test label"} + ]; + } + + function differentData() { + return [ + {key: "Fixed Income"}, + {key: "Derivatives"}, + {key: "Credit Default Swaps"}, + {key: "Equities"}, + {key: "Bonds"}, + {key: "Stocks"}, + {key: "Apple"} + ]; + } diff --git a/nvd3/nvd3-test-ohlcChart.ts b/nvd3/nvd3-test-ohlcChart.ts new file mode 100644 index 0000000000..b62027f631 --- /dev/null +++ b/nvd3/nvd3-test-ohlcChart.ts @@ -0,0 +1,36 @@ +/// +/// +var data = [{values: [ + {"date": 15707, "open": 145.11, "high": 146.15, "low": 144.73, "close": 146.06, "volume": 192059000, "adjusted": 144.65}, + {"date": 15953, "open": 165.85, "high": 166.4, "low": 165.73, "close": 165.96, "volume": 62930500, "adjusted": 165.96} + ]}]; + +nv.addGraph(function() { + var chart = nv.models.ohlcBarChart() + .x(function(d) { return d['date'] }) + .y(function(d) { return d['close'] }) + .duration(250) + .margin({left: 75, bottom: 50}); + + // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately + chart.xAxis + .axisLabel("Dates") + .tickFormat(function(d) { + // I didn't feel like changing all the above date values + // so I hack it to make each value fall on a different date + return d3.time.format('%x')(new Date(new Date().valueOf() - (20000 * 86400000) + (d * 86400000))); + }); + + chart.yAxis + .axisLabel('Stock Price') + .tickFormat(function(d,i){ return '$' + d3.format(',.1f')(d); }); + + + + d3.select("#chart1 svg") + .datum(data) + .transition().duration(500) + .call(chart); + nv.utils.windowResize(chart.update); + return chart; +}); \ No newline at end of file diff --git a/nvd3/nvd3-test-tooltip.ts b/nvd3/nvd3-test-tooltip.ts new file mode 100644 index 0000000000..ee45f9ea78 --- /dev/null +++ b/nvd3/nvd3-test-tooltip.ts @@ -0,0 +1,55 @@ +/// +/// +var width = 500, + height = 20; + + var tooltip = nv.models.tooltip(); + tooltip.duration(0); + + d3.select('.tooltip_me') + .on('mouseover', function(d,i) { + console.log("mouseover", d, i); + var data = {series: { + key: "title", + value: "the value", + color: "#229922" + }}; + tooltip.data(data).hidden(false); + }) + .on('mouseout', function(d,i) { + console.log("mouseout", d, i); + tooltip.hidden(true); + }) + .on('mousemove', function(d,i) { + console.log("mousemove", d, i); + tooltip.position({top: d3.event.pageY, left: d3.event.pageX})(); + }); + + + // we must also test the scatter/line way of getting position + // Wrapping in nv.addGraph allows for '0 timeout render', stores rendered charts in nv.graphs, and may do more in the future... it's NOT required + var chart; + nv.addGraph(function() { + chart = nv.models.lineChart() + .showXAxis(false) + .showLegend(false) + .clipVoronoi(false) + .showVoronoi(true) + .showYAxis(false); + d3.select('#test2') + .datum(sinAndCos()) + .call(chart); + return chart; + }); + + function sinAndCos() { + var cos = []; + for (var i = 0; i < 5; i++) { + cos.push({x: i, y: Math.round(.5 * Math.cos(i/10) * 100) / 100}); + } + return [{ + values: cos, + key: "Cosine Wave", + color: "#2ca02c" + }]; + } diff --git a/nvd3/nvd3.d.ts b/nvd3/nvd3.d.ts new file mode 100644 index 0000000000..0fb9db4ed7 --- /dev/null +++ b/nvd3/nvd3.d.ts @@ -0,0 +1,252 @@ +// Type definitions for nvd3 1.8.1 +// Project: https://github.com/novus/nvd3 +// Definitions by: Maxime LUCE +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +declare module nv { + +// interface Datum{ +// values: any[], +// key: string, +// color: string +// } + + interface Margin { + left?: number, + right?: number, + top?: number, + bottom?: number + } + + interface Legend extends Chart { + key(): any; + key(value: any): Legend; + align(): boolean; + align(value: boolean): Legend; + maxKeyLength(): number; + maxKeyLength(value: number): Legend; + rightAlign(): boolean; + rightAlign(value: boolean): Legend; + //define how much space between legend items. - recommend 32 for furious version + padding(): number; + //define how much space between legend items. - recommend 32 for furious version + padding(value: number): Legend; + //If true, legend will update data.disabled and trigger a 'stateChange' dispatch. + updateState(): boolean; + //If true, legend will update data.disabled and trigger a 'stateChange' dispatch. + updateState(value: boolean): Legend; + //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at + radioButtonMode(): boolean; + //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at + radioButtonMode(value: boolean): Legend; + expanded(): boolean; + expanded(value: boolean): Legend; + //Options are "classic" and "furious" + vers(): string; + //Options are "classic" and "furious" + vers(value: string): Legend; + } + + /** + *NVD3 extension of D3 Axis + */ + interface NvAxis extends d3.svg.Axis { + (selection: d3.Selection): void; + (selection: d3.Transition): void; + + scale(): any; + scale(scale: any): NvAxis; + + orient(): string; + orient(orientation: string): NvAxis; + + ticks(): any[]; + ticks(...args: any[]): NvAxis; + + tickValues(): any[]; + tickValues(values: any[]): NvAxis; + + tickSize(): number; + tickSize(size: number): NvAxis; + tickSize(inner: number, outer: number): NvAxis; + + innerTickSize(): number; + innerTickSize(size: number): NvAxis; + + outerTickSize(): number; + outerTickSize(size: number): NvAxis; + + tickPadding(): number; + tickPadding(padding: number): NvAxis; + + tickFormat(): (t: any) => string; + tickFormat(format: (t: any) => string): NvAxis; + tickFormat(format:string): NvAxis; + tickFormat(format: (t: any, i: any) => string): NvAxis; + + showMaxMin(value: boolean) : NvAxis; + axisLabel(value: string) : NvAxis; + + } + + interface InteractiveLayer { + tooltip : Tooltip + } + + interface ContentGenerator { + (arg: any) :string + } + + interface Tooltip { + + show([left , top]: [number,number], content: string, gravity: string) //todo sort out use on nv.tooltip. + cleanup():void; //todo sort out use on nv.tooltip. + contentGenerator(): ContentGenerator; + contentGenerator(func: (any) => string): void; + headerFormatter(func: (any)=> string): void; + } + + interface Utils { + windowResize(listener: (ev: Event) => any): void; + } + + interface ChartBase { + update(): void; + interactiveLayer :InteractiveLayer; + + (transition: d3.Transition, ...args: any[]) :any; + (selection: d3.Selection, ...args: any[]) :any; + (transition: d3.Transition, ...args: any[]) :any; + (selection: d3.Selection, ...args: any[]) :any; + } + + interface Chart extends ChartBase { + margin() : Margin; + margin(value: Margin) : TChart; + width(): number; + width(value: number) : TChart; + height(): number; + height(value: number) : TChart; + color(value:string[]) : TChart; + color(value:string) : TChart; + dispatch : d3.Dispatch; + + } + + interface TwoDimensionalChart extends Chart + { + xAxis : NvAxis; + yAxis : NvAxis; + x(func: (any)=> any) : TChart; + y(func: (any)=> any) : TChart; + xScale(scale: d3.time.Scale) : TChart; + xScale() : d3.time.Scale; + yScale(scale: d3.time.Scale) : TChart; + yScale() : d3.time.Scale + forceX([xMin, xMax] : [number,number]) : TChart; + forceY([xMin, xMax] : [number,number]) : TChart; + + } + + interface HistoricalBarBase extends TwoDimensionalChart{ + + + } + + interface HistoricalBar extends HistoricalBarBase{ + + } + + interface HistoricalBarChart extends HistoricalBarBase{ + bars: HistoricalBar; + legend: Legend; + noData(): any //todo; + noData(value: any): HistoricalBarChart //todo; + defaultState(): any //todo; + defaultState(value: any): HistoricalBarChart //todo; + showXAxis(): boolean //todo; + showXAxis(value: boolean): HistoricalBarChart //todo; + showLegend(): boolean //todo; + showLegend(value: boolean): HistoricalBarChart //todo; + showYAxis(): boolean //todo; + showYAxis(value: boolean): HistoricalBarChart //todo; + rightAlignYAxis(): boolean //todo; + rightAlignYAxis(value: boolean): HistoricalBarChart //todo; + useInteractiveGuideline(value : boolean) : HistoricalBarChart; + duration(value: number) : HistoricalBarChart; + interactiveLayer :InteractiveLayer; + } + + + + + + interface BoxPlotChart extends TwoDimensionalChart{ + useInteractiveGuideline(value : boolean) : BoxPlotChart; + duration(value: number) : BoxPlotChart; + + staggerLabels(value : boolean) : BoxPlotChart; + maxBoxWidth(value: number) : BoxPlotChart; + yDomain([xMin, xMax] : [number,number]): BoxPlotChart; + xDomain([xMin, xMax] : [number,number]): BoxPlotChart; + showXAxis(): boolean //todo; + showXAxis(value: boolean): BoxPlotChart //todo; + showYAxis(): boolean //todo; + showYAxis(value: boolean): BoxPlotChart //todo; + rightAlignYAxis(): boolean //todo; + rightAlignYAxis(value: boolean): BoxPlotChart //todo; + } + + interface BulletBase extends Chart { + orient(): string; + orient(orientation: string): TBullet; + tickFormat(): (t: any) => string; + tickFormat(format: (t: any) => string): TBullet; + tickFormat(format:string): NvAxis; + tickFormat(format: (t: any, i: any) => string): TBullet; + forceX([xMin, xMax] : [number,number]) : TBullet; + ranges(): any //todo; + ranges(value: any): TBullet //todo; + markers(): any //todo; + markers(value: any): TBullet //todo; + measures(): any //todo; + measures(value: any): TBullet //todo; + } + + interface Bullet extends BulletBase{ + + } + interface BulletChart extends BulletBase{ + bullet: Bullet + ticks(): any //todo; + ticks(value: any): BulletChart //todo; + noData(): any //todo; + noData(value: any): BulletChart //todo; + } + interface Models{ + historicalBar(): HistoricalBar; + historicalBarChart(bar_model?: HistoricalBar): HistoricalBarChart; + ohlcBarChart(): HistoricalBarChart; + bullet(): Bullet; + bulletChart(): BulletChart; + boxPlotChart(): BoxPlotChart; + legend(): Legend; + tooltip(): Tooltip; + } + + interface ChartFactory { + generate: ()=> Chart; + callback?: (chart:Chart)=> void; + } + + + interface nvStatic{ + models: Models; + tooltip: Tooltip; + utils: Utils; + addGraph(factory: ChartFactory); + addGraph(generate : ()=> Chart, callBack?: (chart:Chart)=> void) ; + } +} +declare var nv : nv.nvStatic; \ No newline at end of file From 4ffee4a839f36d4f13ea7b0bc03ed2ca853e79d5 Mon Sep 17 00:00:00 2001 From: Panu Horsmalahti Date: Sun, 20 Dec 2015 22:58:11 +0200 Subject: [PATCH 032/441] Fix tslint errors in through.d.ts. --- through/through.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/through/through.d.ts b/through/through.d.ts index 6e13e4d623..70a7d989c8 100644 --- a/through/through.d.ts +++ b/through/through.d.ts @@ -6,19 +6,19 @@ /// declare module "through" { - import stream = require("stream"); + import stream = require("stream"); - function through(write?: (data: any) => void, - end?: () => void, - opts?: { - autoDestroy: boolean; - }): through.ThroughStream; + function through(write?: (data: any) => void, + end?: () => void, + opts?: { + autoDestroy: boolean; + }): through.ThroughStream; - module through { - export interface ThroughStream extends stream.Transform { - autoDestroy: boolean; - } - } + module through { + export interface ThroughStream extends stream.Transform { + autoDestroy: boolean; + } + } - export = through; + export = through; } From 121b2306986710c2d47f4a50e73484f22572be63 Mon Sep 17 00:00:00 2001 From: PjMitchell Date: Tue, 22 Dec 2015 10:43:17 +0000 Subject: [PATCH 033/441] Used This keyword to declare fluent api --- nvd3/nvd3.d.ts | 139 +++++++++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 69 deletions(-) diff --git a/nvd3/nvd3.d.ts b/nvd3/nvd3.d.ts index 0fb9db4ed7..97e1ebf921 100644 --- a/nvd3/nvd3.d.ts +++ b/nvd3/nvd3.d.ts @@ -1,6 +1,6 @@ // Type definitions for nvd3 1.8.1 // Project: https://github.com/novus/nvd3 -// Definitions by: Maxime LUCE +// Definitions by: Peter Mitchell // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -19,29 +19,29 @@ declare module nv { bottom?: number } - interface Legend extends Chart { + interface Legend extends Chart { key(): any; - key(value: any): Legend; + key(value: any): this; align(): boolean; - align(value: boolean): Legend; + align(value: boolean): this; maxKeyLength(): number; - maxKeyLength(value: number): Legend; + maxKeyLength(value: number): this; rightAlign(): boolean; - rightAlign(value: boolean): Legend; + rightAlign(value: boolean): this; //define how much space between legend items. - recommend 32 for furious version padding(): number; //define how much space between legend items. - recommend 32 for furious version - padding(value: number): Legend; + padding(value: number): this; //If true, legend will update data.disabled and trigger a 'stateChange' dispatch. updateState(): boolean; //If true, legend will update data.disabled and trigger a 'stateChange' dispatch. - updateState(value: boolean): Legend; + updateState(value: boolean): this; //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at radioButtonMode(): boolean; //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at - radioButtonMode(value: boolean): Legend; + radioButtonMode(value: boolean): this; expanded(): boolean; - expanded(value: boolean): Legend; + expanded(value: boolean): this; //Options are "classic" and "furious" vers(): string; //Options are "classic" and "furious" @@ -112,117 +112,118 @@ declare module nv { } interface ChartBase { - update(): void; - interactiveLayer :InteractiveLayer; - (transition: d3.Transition, ...args: any[]) :any; - (selection: d3.Selection, ...args: any[]) :any; - (transition: d3.Transition, ...args: any[]) :any; - (selection: d3.Selection, ...args: any[]) :any; } - interface Chart extends ChartBase { + interface Chart { margin() : Margin; - margin(value: Margin) : TChart; + margin(value: Margin) : this; width(): number; - width(value: number) : TChart; + width(value: number) : this; height(): number; - height(value: number) : TChart; - color(value:string[]) : TChart; - color(value:string) : TChart; - dispatch : d3.Dispatch; + height(value: number) : this; + color(value:string[]) : this; + color(value:string) : this; + dispatch: d3.Dispatch; + + update(): void; + interactiveLayer: InteractiveLayer; + + (transition: d3.Transition, ...args: any[]): any; + (selection: d3.Selection, ...args: any[]): any; + (transition: d3.Transition, ...args: any[]): any; + (selection: d3.Selection, ...args: any[]): any; } - interface TwoDimensionalChart extends Chart + interface TwoDimensionalChart extends Chart { xAxis : NvAxis; yAxis : NvAxis; - x(func: (any)=> any) : TChart; - y(func: (any)=> any) : TChart; - xScale(scale: d3.time.Scale) : TChart; + x(func: (any)=> any) : this; + y(func: (any) => any): this; + xScale(scale: d3.time.Scale): this; xScale() : d3.time.Scale; - yScale(scale: d3.time.Scale) : TChart; + yScale(scale: d3.time.Scale): this; yScale() : d3.time.Scale - forceX([xMin, xMax] : [number,number]) : TChart; - forceY([xMin, xMax] : [number,number]) : TChart; + forceX([xMin, xMax]: [number, number]): this; + forceY([xMin, xMax]: [number, number]): this; } - interface HistoricalBarBase extends TwoDimensionalChart{ + interface HistoricalBarBase extends TwoDimensionalChart{ } - interface HistoricalBar extends HistoricalBarBase{ + interface HistoricalBar extends HistoricalBarBase{ } - interface HistoricalBarChart extends HistoricalBarBase{ + interface HistoricalBarChart extends HistoricalBarBase{ bars: HistoricalBar; legend: Legend; noData(): any //todo; - noData(value: any): HistoricalBarChart //todo; + noData(value: any): this //todo; defaultState(): any //todo; - defaultState(value: any): HistoricalBarChart //todo; + defaultState(value: any): this //todo; showXAxis(): boolean //todo; - showXAxis(value: boolean): HistoricalBarChart //todo; + showXAxis(value: boolean): this //todo; showLegend(): boolean //todo; - showLegend(value: boolean): HistoricalBarChart //todo; + showLegend(value: boolean): this //todo; showYAxis(): boolean //todo; - showYAxis(value: boolean): HistoricalBarChart //todo; + showYAxis(value: boolean): this //todo; rightAlignYAxis(): boolean //todo; - rightAlignYAxis(value: boolean): HistoricalBarChart //todo; - useInteractiveGuideline(value : boolean) : HistoricalBarChart; - duration(value: number) : HistoricalBarChart; - interactiveLayer :InteractiveLayer; + rightAlignYAxis(value: boolean): this //todo; + useInteractiveGuideline(value: boolean): this; + duration(value: number): this; } - interface BoxPlotChart extends TwoDimensionalChart{ - useInteractiveGuideline(value : boolean) : BoxPlotChart; - duration(value: number) : BoxPlotChart; + interface BoxPlotChart extends TwoDimensionalChart{ + useInteractiveGuideline(value : boolean) : this; + duration(value: number): this; - staggerLabels(value : boolean) : BoxPlotChart; - maxBoxWidth(value: number) : BoxPlotChart; - yDomain([xMin, xMax] : [number,number]): BoxPlotChart; - xDomain([xMin, xMax] : [number,number]): BoxPlotChart; + staggerLabels(value: boolean): this; + maxBoxWidth(value: number): this; + yDomain([xMin, xMax]: [number, number]): this; + xDomain([xMin, xMax]: [number, number]): this; showXAxis(): boolean //todo; - showXAxis(value: boolean): BoxPlotChart //todo; + showXAxis(value: boolean): this //todo; showYAxis(): boolean //todo; - showYAxis(value: boolean): BoxPlotChart //todo; + showYAxis(value: boolean): this //todo; rightAlignYAxis(): boolean //todo; - rightAlignYAxis(value: boolean): BoxPlotChart //todo; + rightAlignYAxis(value: boolean): this //todo; } - interface BulletBase extends Chart { + interface BulletBase extends Chart { orient(): string; - orient(orientation: string): TBullet; + orient(orientation: string): this; tickFormat(): (t: any) => string; - tickFormat(format: (t: any) => string): TBullet; + tickFormat(format: (t: any) => string): this; tickFormat(format:string): NvAxis; - tickFormat(format: (t: any, i: any) => string): TBullet; - forceX([xMin, xMax] : [number,number]) : TBullet; + tickFormat(format: (t: any, i: any) => string): this; + forceX([xMin, xMax]: [number, number]): this; ranges(): any //todo; - ranges(value: any): TBullet //todo; + ranges(value: any): this //todo; markers(): any //todo; - markers(value: any): TBullet //todo; + markers(value: any): this //todo; measures(): any //todo; - measures(value: any): TBullet //todo; + measures(value: any): this //todo; } - interface Bullet extends BulletBase{ + interface Bullet extends BulletBase{ } - interface BulletChart extends BulletBase{ + interface BulletChart extends BulletBase{ bullet: Bullet ticks(): any //todo; - ticks(value: any): BulletChart //todo; + ticks(value: any): this //todo; noData(): any //todo; - noData(value: any): BulletChart //todo; + noData(value: any): this //todo; } interface Models{ historicalBar(): HistoricalBar; @@ -235,9 +236,9 @@ declare module nv { tooltip(): Tooltip; } - interface ChartFactory { - generate: ()=> Chart; - callback?: (chart:Chart)=> void; + interface ChartFactory { + generate: () => TChart; + callback?: (chart: TChart)=> void; } @@ -245,8 +246,8 @@ declare module nv { models: Models; tooltip: Tooltip; utils: Utils; - addGraph(factory: ChartFactory); - addGraph(generate : ()=> Chart, callBack?: (chart:Chart)=> void) ; + addGraph(factory: ChartFactory); + addGraph(generate: () => TChart, callBack?: (chart: TChart)=> void) ; } } declare var nv : nv.nvStatic; \ No newline at end of file From e3dea91f4300f526bbb4d1baa8b558598d69d751 Mon Sep 17 00:00:00 2001 From: WAEL BEN ZID Date: Tue, 22 Dec 2015 12:17:04 +0100 Subject: [PATCH 034/441] More tests added --- prettyjson/prettyjson-tests.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/prettyjson/prettyjson-tests.ts b/prettyjson/prettyjson-tests.ts index 4df6b1fc87..9d7c43918d 100644 --- a/prettyjson/prettyjson-tests.ts +++ b/prettyjson/prettyjson-tests.ts @@ -2,9 +2,13 @@ var options: prettyjson.IOptions, input: string, - output: string; + output: string, + version: string; +console.log("using prettyjson v" + prettyjson.version) +version = prettyjson.version; + input = 'This is a string'; output = prettyjson.render(input); @@ -16,3 +20,4 @@ output = prettyjson.render({param1: 'first string', param2: 'second string'}); output = prettyjson.render({first_param: {subparam: 'first string', subparam2: 'another string'}, second_param: 'second string'}); +prettyjson.renderString('{name: "Wael", nested: {list: ["a", "b"], int: 3}}') From a5f6fa793f206da5521580987d219493014810a1 Mon Sep 17 00:00:00 2001 From: WAEL BEN ZID Date: Tue, 22 Dec 2015 12:17:58 +0100 Subject: [PATCH 035/441] module declaration fixed --- prettyjson/prettyjson.d.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/prettyjson/prettyjson.d.ts b/prettyjson/prettyjson.d.ts index f1f0dbf23f..b2a6399ac8 100644 --- a/prettyjson/prettyjson.d.ts +++ b/prettyjson/prettyjson.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module PrettyJSON { +declare module prettyjson { /** * Defines prettyjson version @@ -14,13 +14,13 @@ declare module PrettyJSON { /** * Render pretty json. * - * @param data {Object} Data to prettify. + * @param data {any} Data to prettify. * @param options {IOptions} Hash with different options to configure the renderer. * @param indentation {number} Indentation size. * * @return {string} pretty serialized json data ready to display. */ - export function render(data: Object, options?: IOptions, indentation?: number): string; + export function render(data: any, options?: IOptions, indentation?: number): string; /** * Render pretty json from a string. @@ -53,7 +53,3 @@ declare module PrettyJSON { defaultIndentation ?: number; } } - -declare module "prettyjson" { - export = PrettyJSON; -} From ddf001276e8532986307c8eb15dbf82bf3243a0f Mon Sep 17 00:00:00 2001 From: Pierre Anctil Date: Tue, 22 Dec 2015 17:24:19 +0100 Subject: [PATCH 036/441] [mssql] add typed queries & batches --- mssql/mssql-tests.ts | 22 ++++++++++++++++++++-- mssql/mssql.d.ts | 6 +++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/mssql/mssql-tests.ts b/mssql/mssql-tests.ts index e508ec3547..eda326c4a5 100644 --- a/mssql/mssql-tests.ts +++ b/mssql/mssql-tests.ts @@ -3,6 +3,10 @@ import sql = require('mssql'); +interface Entity{ + value: number; +} + var config: sql.config = { user: 'user', password: 'password', @@ -33,6 +37,18 @@ var connection: sql.Connection = new sql.Connection(config, function (err: any) } }); + getArticlesQuery = "SELECT 1 as value FROM TABLE"; + + requestQuery.query(getArticlesQuery, function (err, recordSet) { + if (err) { + console.error('Error happened calling Query: ' + err.name + " " + err.message); + + } + // checking to see if the articles returned as at least one. + else if (recordSet.length > 0 && recordSet[0].value) { + } + }); + var requestStoredProcedure = new sql.Request(connection); var testId: number = 0; var testString: string = 'test'; @@ -109,8 +125,10 @@ function test_promise_returns() { var request = new sql.Request(); request.batch('create procedure #temporary as select * from table').then((recordset) => { }); + request.batch('create procedure #temporary as select * from table;select 1 as value').then((recordset) => { }); request.bulk(new sql.Table("table_name")).then(() => { }); request.query('SELECT 1').then((recordset) => { }); + request.query('SELECT 1 as value').then(res => { }); request.execute('procedure_name').then((recordset) => { }); } @@ -120,7 +138,7 @@ function test_request_constructor() { var connection: sql.Connection = new sql.Connection(config); var preparedStatment = new sql.PreparedStatement(connection); var transaction = new sql.Transaction(connection); - + var request1 = new sql.Request(connection); var request2 = new sql.Request(preparedStatment); var request3 = new sql.Request(transaction); @@ -141,4 +159,4 @@ function test_classes_extend_eventemitter() { request.on('error', () => { }); preparedStatment.on('error', () => { }) -} \ No newline at end of file +} diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index c434444d3f..1e203582b2 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -7,7 +7,7 @@ /// declare module "mssql" { - import events = require('events'); + import events = require('events'); type sqlTypeWithNoParams = { type: sqlTypeFactoryWithNoParams } type sqlTypeWithLength = { type: sqlTypeFactoryWithLength, length: number } @@ -206,9 +206,13 @@ declare module "mssql" { public output(name: string, type: any, value?: any): void; public pipe(stream: NodeJS.WritableStream): void; public query(command: string): Promise; + public query(command: string): Promise; public query(command: string, callback: (err?: any, recordset?: any) => void): void; + public query(command: string, callback: (err?: any, recordset?: Entity[]) => void): void; public batch(batch: string): Promise; + public batch(batch: string): Promise; public batch(batch: string, callback: (err?: any, recordset?: any) => void): void; + public batch(batch: string, callback: (err?: any, recordset?: Entity[]) => void): void; public bulk(table: Table): Promise; public bulk(table: Table, callback: (err: any, rowCount: any) => void): void; public cancel(): void; From cf2a968f0edd7d30773f7d23fe3708fa029d5ab7 Mon Sep 17 00:00:00 2001 From: error Date: Tue, 22 Dec 2015 10:26:33 -0600 Subject: [PATCH 037/441] add easing functions to jquery and jqueryui --- jquery/jquery.d.ts | 13 +++++++++++++ jqueryui/jqueryui.d.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 29b7697b2a..ff259e7fbd 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -607,6 +607,16 @@ interface JQueryAnimationOptions { specialEasing?: Object; } +interface JQueryEasingFunction { + ( percent: number ): number; +} + +interface JQueryEasingFunctions { + [ name: string ]: JQueryEasingFunction; + linear: JQueryEasingFunction; + swing: JQueryEasingFunction; +} + /** * Static members of jQuery (those on $ and jQuery themselves) */ @@ -889,6 +899,9 @@ interface JQueryStatic { /** * Effects */ + + easing: JQueryEasingFunctions; + fx: { tick: () => void; /** diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index 9dd576e1a5..197c4dbd1d 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -1804,3 +1804,36 @@ interface JQueryStatic { widget: JQueryUI.Widget; Widget: JQueryUI.Widget; } + +interface JQueryEasingFunctions { + easeInQuad: JQueryEasingFunction; + easeOutQuad: JQueryEasingFunction; + easeInOutQuad: JQueryEasingFunction; + easeInCubic: JQueryEasingFunction; + easeOutCubic: JQueryEasingFunction; + easeInOutCubic: JQueryEasingFunction; + easeInQuart: JQueryEasingFunction; + easeOutQuart: JQueryEasingFunction; + easeInOutQuart: JQueryEasingFunction; + easeInQuint: JQueryEasingFunction; + easeOutQuint: JQueryEasingFunction; + easeInOutQuint: JQueryEasingFunction; + easeInExpo: JQueryEasingFunction; + easeOutExpo: JQueryEasingFunction; + easeInOutExpo: JQueryEasingFunction; + easeInSine: JQueryEasingFunction; + easeOutSine: JQueryEasingFunction; + easeInOutSine: JQueryEasingFunction; + easeInCirc: JQueryEasingFunction; + easeOutCirc: JQueryEasingFunction; + easeInOutCirc: JQueryEasingFunction; + easeInElastic: JQueryEasingFunction; + easeOutElastic: JQueryEasingFunction; + easeInOutElastic: JQueryEasingFunction; + easeInBack: JQueryEasingFunction; + easeOutBack: JQueryEasingFunction; + easeInOutBack: JQueryEasingFunction; + easeInBounce: JQueryEasingFunction; + easeOutBounce: JQueryEasingFunction; + easeInOutBounce: JQueryEasingFunction; +} \ No newline at end of file From a816a7a1d42ceb0fa3e9a223131c0160bbfe659b Mon Sep 17 00:00:00 2001 From: fskorzec Date: Tue, 22 Dec 2015 22:35:55 +0100 Subject: [PATCH 038/441] Add definitions for bliss --- bliss/bliss-tests.ts | 445 ++++++++++++++++++++++++++++ bliss/bliss.d.ts | 670 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1115 insertions(+) create mode 100644 bliss/bliss-tests.ts create mode 100644 bliss/bliss.d.ts diff --git a/bliss/bliss-tests.ts b/bliss/bliss-tests.ts new file mode 100644 index 0000000000..bc2eafa4f2 --- /dev/null +++ b/bliss/bliss-tests.ts @@ -0,0 +1,445 @@ +/// + +function test_overview() { + /*Bliss includes several static methods (on the Bliss or $ object). For example, to copy all properties of an object onto another object, you would + call $.extend():*/ + var yolo = $.extend({ foo: 1 }, { bar: 2 }); + + var element = $.create(); + + /*Many of Bliss’ methods take an element or an array of elements as their first argument. For example, to set both the width and padding of an element to 0, + you could use the $.style() method:*/ + $.style(element, { width: 0, padding: 0 }); + + /*These types of methods are also available on elements and arrays, for convenience. However, since adding convenience methods to elements and arrays directly + would be a JS Mortal Sin™, Bliss only adds a _ property on elements & arrays, on which it hangs all its methods, to avoid conflicts. The previous example would + be written as: */ + element._.style({ + "width": 0, + "padding": 0 + }); + + + var myArray = $$("div"); + /*The ._. sequence of characters that appears all too often when coding with Bliss is where Bliss gets its logo from. However, the property can be + customized to anything you want. + + Methods that are available on elements like this will have an ELEMENT tag in these docs. + + If you wanted to set the width and padding of multiple elements to 0, you could use an array:*/ + myArray._.style({ + "width": 0, + "padding": 0 + }); + + /*Methods that are available on arrays like this will have an ARRAY tag in these docs. + + /*For example, assume that in addition to these CSS changes you also wanted to add a hidden attribute to this element. Bliss methods that don’t return a value + return the element or array they are called on, so you could call more element methods on them, including native ones:*/ + element._.style({ + "width": 0, + "padding": 0 + }).setAttribute("hidden", ""); + + /*Now assume you also wanted to set a second attribute: The "class" attribute to "foo". The native setAttribute() method is not chainable, it returns undefined. + However, all native element methods are also available on the almighty _ property, and there they are also chainable:*/ + element._.style({ + "width": 0, + "padding": 0 + })._.setAttribute("hidden", "").setAttribute("class", "foo"); + + //This works, but it’s a bit unwieldy. Thankfully, Bliss offers an $.attributes() method for setting multiple attributes at once: + element._.style({ + "width": 0, + "padding": 0 + })._.attributes({ + "hidden": "", + "class": "foo" + }); + + //This is better and more readable, but still a bit awkward. Turns out there is a special $.set() method to do both at once: + element._.set({ + attributes: { + "hidden": "", + "class": "foo" + }, + style: { + "width": 0, + "padding": 0 + } + }); + + /*Because $.attributes() and $.style() are also available for $.set() parameters, they will have the special $.SET() tag in these docs. + Note that you don’t actually need attributes: {…} in $.set() at all: if there are any unrecognized properties in the parameter object, + Bliss will first check if there is a property with that name on the element and if not, + set an attribute. So you could rewrite the example above as:*/ + element._.set({ + "hidden": "", + "class": "foo", // or "className": "foo" to use the property + style: { + "width": 0, + "padding": 0 + } + }); + +} + + +function vanilla_test() { + var element = $.create(); + + element.classList.add("my-class"); + element.classList.remove("my-class"); + element.classList.toggle("my-class"); + element.classList.contains("my-class") + element.remove(); + //element.contains(otherElement) // Not working + //element.matches(selector) // Not working + //element.closest(selector) // Not working + element.nextElementSibling + //element.children // Not working + + $$("div")._.remove(); +} + +function $_test() { + // return the first element with a class of .foo + // that is inside the first element with a class of .bar + var ret = $(".foo", $(".bar")); + // Return the first element with a class of .foo + // that is inside any element with a class of .bar + var ret = $(".bar .foo"); + // Get the first element with a class of .foo + // and set its title attribute to "yolo" + // If there is no such element, this will throw an exception! + $(".foo").setAttribute("title", "yolo"); + + // Check if the .foo element exists + // and set an attribute by using a variable "foo" + // as a reference of the element + var foo = $(".foo"); + if (foo) { + foo.setAttribute("title", "yolo"); + } +} + +function $$_test() { + // Add an id to all

headings that don’t already have one + $$("h1:not([id])").forEach(function(h1){ + h1.id = h1.textContent.replace(/\W/g, ""); + }); + // Get an array with all ids on the page + var ids = $$("[id]").map(function(element){ + return element.id; + }); + // Get all of an element’s attributes starting with data-bliss- + var element = $.create("div"); + + $$(element.attributes).filter(function(attribute){ + return attribute.name.indexOf("data-bliss-") === 0; + }).map(function(attribute){ + return attribute.name; + }); +} + +function $_create_test() { + $.create("ul", { + className: "nav", + contents: [ + "Navigation: ", + {tag: "li", + contents: {tag: "a", + href: "index.html", + textContent: "Home" + } + }, + {tag: "li", + contents: {tag: "a", + href: "contact.html", + textContent: "Contact", + target: "_blank" + }} + ] + }); + + var paragraph = $.create("p"); + var div = $.create(); +} + +function $_set_test() { + $.set(document.createElement("nav"), { + style: { + color: "red" + }, + events: { + click: function(evt:Event) { + console.log("YOLO"); + } + }, + contents: ["Navigation: ", {tag: "ul", + className: "buttons", + delegate: { + click: { + li: function() { + console.log("A list item was clicked"); + } + } + }, + contents: [{tag: "li", + contents: {tag: "a", + href: "index.html", + textContent: "Home" + } + }, {tag: "li", + contents: {tag: "a", + href: "docs.html", + textContent: "Docs" + } + } + ] + }], + inside: $("body > header") + }); +} + +function $_contents_test() { + var nav = $.create(); + + nav._.contents(["Navigation: ", {tag: "ul", + className: "buttons", + delegate: { + click: { + li: function() { + console.log("A list item was clicked") + } + } + }, + contents: [{tag: "li", + contents: {tag: "a", + href: "index.html", + textContent: "Home" + } + }, {tag: "li", + contents: {tag: "a", + href: "docs.html", + textContent: "Docs" + } + } + ] + }]) +} + +function $_clone_test() { + var button = $("button"); + button.addEventListener("click", function() { console.log("Click from listener!"); }); + button.onclick = function() { console.log("Click from inline event!"); }; + var button2 = button._.clone(); + // If clicked, button2 will print both messages +} + +function $_after_test() { + var button = $("button"); + $.after(button, $(".selector")); +} + +function $_around_test() { + var button = $("button"); + $.around(button, $(".selector")); + + // Wrap headings with a link to their section + $$("section[id] > h1, article[id] > h1").forEach(function(h1){ + $.create("a", { + href: "#" + (h1.parentNode).id, + around: h1 + }); + }); +} + +function $_attributes_test() { + var button = $("button"); + $.attributes(button, { backgroundColor: "#FFFFFF" }); + + button._.attributes({color: "#000000"}); +} + +function $_before_test() { + var button = $("button"); + $.before(button, $(".selector")); + + button._.before($(".selector")); +} + +function $_inside_test() { + var button = $("button"); + $.inside(button, $(".selector")); + + button._.inside($(".selector")); +} + +function $_properties_test() { + document.createElement("button")._.properties({ + className: "continue", + textContent: "Next Step", + onclick: function() { /*MyApp.next()*/ } + }); +} + +function $_start_test() { + var button = $("button"); + $.start(button, $(".selector")); + + button._.start($(".selector")); +} + +function $_style_test() { + document.body._.style({ + color: "white", + backgroundColor: "red", + cssFloat: "left" + }); +} + +function $_transition_test() { + var element = $(".selector"); + + // Fade out an element then remove it from the DOM + $.transition(element, {opacity: 0}).then($.remove); + + // Fade out and shrink all
s on a page, + // then remove them from the DOM + Promise.all($$("div")._.transition({ + opacity: 0, + transform: "scale(0)" + })).then( (elts) => { + elts.forEach(elt => { + $.remove(elt); + }); + }); +} + +function $_delegate_test() { + var element = $(".selector"); + + $.delegate(element, "locationchange", ".selected", () => {}); + $.delegate(element, "locationchange", { + "callback1" : () => {} + }); + $.delegate(element, { + "locationchange" : { + "callback1" : () => {} + } + }); + + element._.delegate("locationchange", ".selected", () => {}); + element._.delegate( "locationchange", { + "callback1" : () => {} + }); + element._.delegate({ + "locationchange" : { + "callback1" : () => {} + } + }); +} + +function $_events_test() { + $$('input[type="range"]')._.events({ + "input change": function(evt) { this.title = this.value} + }); + + $$("input")._.addEventListener("input", function(){ /* ... */}); +} + +function $_fire_test() { + + var myMap = $(".myMap"); + var myInput = $(".myInput"); + + // Fire a custom event on a map widget + myMap._.fire("locationchange", { + location: [42.361667, -71.092751] + }); + // Fire a fake input event + myInput._.fire("input"); +} + +function $_once_test() { + $$('input[type="range"]')._.once({ + "input change": function(evt) { this.title = this.value} + }); +} + +function $_ready_test() { + // Add a red border to all divs on a page + $.ready().then(function(){ + $$("div")._.style({ border: "1px solid red" }); + }); +} + +function $_all_test() { + // Uppercase all strings in an array + ["Foo", "bar"]._.all("toUpperCase"); // Returns ["FOO", "BAR"] +} + +function $_class_test() { + var cls = $.Class({ + constructor: function() {/* ... */} + }); +} + +function $_each_test() { + var elt = {a:"a", b:"b"}; + + $.each(elt, function (name:string, value:any) { + /* ... */ + }, elt); +} + +function $_extend_test() { + var o1 = {foo: 1, bar:2} + var o2 = $.extend(o1, {foo: 3, baz: 4}); + // o2 is {foo: 3, bar: 2, baz: 4} + // Get typography-related computed style on + var type = $.extend({}, + getComputedStyle(document.body), + /^font|^lineHeight$/); +} + +function $_lazy_test() { + var x = {a:""}; + $.lazy(x, "foo", () => {return "bar";}); + + $.lazy(x, { + "foo" : function() { + return "bar" + } + }); +} + +function $_live_test() { + var x = {a:""}; + $.live(x, "foo", () => {return "bar";}); +} + +function $_type_test(...args: any[]) { + // Check if the second argument of a function is a regexp + if ($.type(args[1]) === "regexp") { + // ... + } +} + +function $_value_test() { + $.value(document, "body", "nodeType"); // 1 + $.value(document, "body", "foo", "bar", "baz"); // undefined, no errors + $.value("document", "body", "nodeType"); // 1, no root, starting from self +} + +function $_fetch_test() { + $.fetch("/api/create", { + method: "POST", + responseType: "json" + }).then(function(){ + alert("success!"); + }).catch(function(error){ + console.error(error); + }); +} \ No newline at end of file diff --git a/bliss/bliss.d.ts b/bliss/bliss.d.ts new file mode 100644 index 0000000000..99ef63e7ea --- /dev/null +++ b/bliss/bliss.d.ts @@ -0,0 +1,670 @@ +// Type definitions for bliss +// Project: http://blissfuljs.com/ +// Definitions by: François Skorzec +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +interface Element { + _: BlissNS.BlissBindedElement; +} + +interface Array { + _: BlissNS.BlissBindedArray & BlissNS.BlissCollectionArray; +} + +declare module BlissNS { + export type BlissDecoratedElement = Element & T; + export type BlissDecoratedArrayElement = Array & BlissNS.BlissCollectionArray; + + interface BlissStatic { + (selector: string, context?: Element): BlissDecoratedElement; + + classProps: Object; + + create(tag: "a"): HTMLAnchorElement; + create(tag: "applet"): HTMLAppletElement; + create(tag: "area"):HTMLAreaElement; + create(tag: "audio"): HTMLAudioElement; + create(tag: "base"): HTMLBaseElement; + create(tag: "basefont"): HTMLBaseFontElement; + create(tag: "blockquote"): HTMLBlockElement; + create(tag: "body"): HTMLBodyElement; + create(tag: "br"): HTMLBRElement; + create(tag: "button"): HTMLButtonElement; + create(tag: "canvas"): HTMLCanvasElement; + create(tag: "datalist"): HTMLDataListElement; + create(tag: "dd"): HTMLDDElement; + create(tag: "directory"): HTMLDirectoryElement; + create(tag: "div"): HTMLDivElement; + create(tag: "embeded"): HTMLEmbedElement; + create(tag: "fieldset"): HTMLFieldSetElement; + create(tag: "form"): HTMLFormElement; + create(tag: "frame"): HTMLFrameElement; + create(tag: "frameset"): HTMLFrameSetElement; + create(tag: "iframe"): HTMLDListElement; + create(tag: "image"): HTMLImageElement; + create(tag: "input"): HTMLInputElement; + create(tag: "i"): HTMLLIElement; + create(tag: "label"): HTMLLabelElement; + create(tag: "legend"): HTMLLegendElement; + create(tag: "li"): HTMLLIElement; + create(tag: "link"): HTMLLinkElement; + create(tag: "map"): HTMLMapElement; + create(tag: "mark"): HTMLMarqueeElement; + create(tag: "menu"): HTMLMenuElement; + create(tag: "meta"): HTMLMetaElement; + create(tag: "object"): HTMLObjectElement; + create(tag: "ol"): HTMLOListElement; + create(tag: "optgroup"): HTMLOptGroupElement; + create(tag: "option"): HTMLOptionElement; + create(tag: "p"): HTMLParagraphElement; + create(tag: "param"): HTMLParamElement; + create(tag: "pre"): HTMLPreElement; + create(tag: "progress"): HTMLProgressElement; + create(tag: "q"): HTMLQuoteElement; + create(tag: "script"): HTMLScriptElement; + create(tag: "select"): HTMLSelectElement; + create(tag: "source"): HTMLSourceElement; + create(tag: "span"): HTMLSpanElement; + create(tag: "style"): HTMLStyleElement; + create(tag: "table"): HTMLTableElement; + create(tag: "thead"): HTMLTableHeaderCellElement; + create(tag: "ul"): HTMLUListElement; + create(tag: "video"): HTMLVideoElement; + create(tag: string): BlissDecoratedElement; + + create(options: Object): BlissDecoratedElement; + + create(tag: "a", options: Object): HTMLAnchorElement; + create(tag: "applet", options: Object): HTMLAppletElement; + create(tag: "area", options: Object): HTMLAreaElement; + create(tag: "audio", options: Object): HTMLAudioElement; + create(tag: "base", options: Object): HTMLBaseElement; + create(tag: "basefont", options: Object): HTMLBaseFontElement; + create(tag: "blockquote", options: Object): HTMLBlockElement; + create(tag: "body", options: Object): HTMLBodyElement; + create(tag: "br", options: Object): HTMLBRElement; + create(tag: "button", options: Object): HTMLButtonElement; + create(tag: "canvas", options: Object): HTMLCanvasElement; + create(tag: "datalist", options: Object): HTMLDataListElement; + create(tag: "dd", options: Object): HTMLDDElement; + create(tag: "directory", options: Object): HTMLDirectoryElement; + create(tag: "div", options: Object): HTMLDivElement; + create(tag: "embeded", options: Object): HTMLEmbedElement; + create(tag: "fieldset", options: Object): HTMLFieldSetElement; + create(tag: "form", options: Object): HTMLFormElement; + create(tag: "frame", options: Object): HTMLFrameElement; + create(tag: "frameset", options: Object): HTMLFrameSetElement; + create(tag: "iframe", options: Object): HTMLDListElement; + create(tag: "image", options: Object): HTMLImageElement; + create(tag: "input", options: Object): HTMLInputElement; + create(tag: "i", options: Object): HTMLLIElement; + create(tag: "label", options: Object): HTMLLabelElement; + create(tag: "legend", options: Object): HTMLLegendElement; + create(tag: "li", options: Object): HTMLLIElement; + create(tag: "link", options: Object): HTMLLinkElement; + create(tag: "map", options: Object): HTMLMapElement; + create(tag: "mark", options: Object): HTMLMarqueeElement; + create(tag: "menu", options: Object): HTMLMenuElement; + create(tag: "meta", options: Object): HTMLMetaElement; + create(tag: "object", options: Object): HTMLObjectElement; + create(tag: "ol", options: Object): HTMLOListElement; + create(tag: "optgroup", options: Object): HTMLOptGroupElement; + create(tag: "option", options: Object): HTMLOptionElement; + create(tag: "p", options: Object): HTMLParagraphElement; + create(tag: "param", options: Object): HTMLParamElement; + create(tag: "pre", options: Object): HTMLPreElement; + create(tag: "progress", options: Object): HTMLProgressElement; + create(tag: "q", options: Object): HTMLQuoteElement; + create(tag: "script", options: Object): HTMLScriptElement; + create(tag: "select", options: Object): HTMLSelectElement; + create(tag: "source", options: Object): HTMLSourceElement; + create(tag: "span", options: Object): HTMLSpanElement; + create(tag: "style", options: Object): HTMLStyleElement; + create(tag: "table", options: Object): HTMLTableElement; + create(tag: "thead", options: Object): HTMLTableHeaderCellElement; + create(tag: "ul", options: Object): HTMLUListElement; + create(tag: "video", options: Object): HTMLVideoElement; + create(tag: string, options: Object): BlissDecoratedElement; + + create(...args:any[]): BlissDecoratedElement; + + set(subject: BlissDecoratedElement, options: Object): BlissDecoratedElement; + contents(subject: BlissDecoratedElement , elements: Object | Array | string | Number | Node): BlissDecoratedElement; + contents(subject: BlissDecoratedElement[], elements: Object | Array | string | Number | Node): BlissDecoratedElement[]; + clone(subject:BlissDecoratedElement) : BlissDecoratedElement; + after(subject:BlissDecoratedElement, element: Element) : BlissDecoratedElement; + around(subject:BlissDecoratedElement, element: Element) : BlissDecoratedElement; + attributes(subject:BlissDecoratedElement, attrs: Object) : BlissDecoratedElement; + attributes(subject:BlissDecoratedElement[], attrs: Object) : BlissDecoratedElement[]; + before(subject:BlissDecoratedElement, element: Element) : BlissDecoratedElement; + inside(subject:BlissDecoratedElement, element: Element) : BlissDecoratedElement; + properties(subject:BlissDecoratedElement, props: Object) : BlissDecoratedElement; + properties(subject:BlissDecoratedElement[], props: Object) : BlissDecoratedElement[]; + start(subject:BlissDecoratedElement, element: Element) : BlissDecoratedElement; + style(subject:BlissDecoratedElement, properties: Object) : BlissDecoratedElement; + style(subject:BlissDecoratedElement[], properties: Object) : BlissDecoratedElement[]; + transition(subject:BlissDecoratedElement | BlissDecoratedElement[], properties: Object, duration?: number) : Promise; + delegate(subject:BlissDecoratedElement , type: string, selector: string, callback: (event: Event) => void): BlissDecoratedElement; + delegate(subject: BlissDecoratedElement[], type: string, selector: string, callback: (event: Event) => void): BlissDecoratedElement[]; + delegate(subject:BlissDecoratedElement , type: string, selectorsToCallbacks: {[selector: string] : (event: Event) => void}): BlissDecoratedElement; + delegate(subject:BlissDecoratedElement[], type: string, selectorsToCallbacks: {[selector: string] : (event: Event) => void}): BlissDecoratedElement[]; + delegate(subject:BlissDecoratedElement , typesToSelectorsToCallbacks: {[type: string] : {[selector: string] : (event: Event) => void}}): BlissDecoratedElement; + delegate(subject:BlissDecoratedElement[], typesToSelectorsToCallbacks: {[type: string] : {[selector: string] : (event: Event) => void}}): BlissDecoratedElement[]; + events(subject:BlissDecoratedElement , handlers: {[eventName:string] : (event: Event) => void} | Element): BlissDecoratedElement; + events(subject: BlissDecoratedElement[], handlers: {[eventName:string] : (event: Event) => void} | Element): BlissDecoratedElement[]; + fire(subject:BlissDecoratedElement, type: string, properties?: {[propertyName: string] : any}): BlissDecoratedElement; + fire(subject:BlissDecoratedElement[], type: string, properties?: {[propertyName: string] : any}): BlissDecoratedElement[]; + once(subject:BlissDecoratedElement, handlers: {[eventName:string] : (event: Event) => void} | Element): BlissDecoratedElement; + once(subject:BlissDecoratedElement[], handlers: {[eventName:string] : (event: Event) => void} | Element): BlissDecoratedElement[]; + ready(context?: Document): Promise; + + remove(subject:Element | BlissStatic): void; + + all(array: Array, method: string, ...args: Array): Array; + all(array: Array, method: string, ...args: Array): Array; + + Class(options: { + constructor?: Function; + extends?: Function; + abstract?: boolean; + lazy?: Object; + live?: Object; + static?: Object; + [propertyName: string]:any; + }): T; + + Class(options: { + constructor?: Function; + extends?: Function; + abstract?: boolean; + lazy?: Object; + live?: Object; + static?: Object; + [propertyName: string]:any; + }): Object; + + each(obj: {[propertyName: string] : any}, callback: Function, ret?: Object): T; + each(obj: {[propertyName: string] : any}, callback: Function, ret?: Object): Object; + + extend(target: Object, source: any, whitelist? : string[] | string | Function | RegExp): Object; + extend(target: Object, source: any, whitelist? : string[] | string | Function | RegExp): T; + + lazy(object: Object, property: string, getter: () => any): Object; + lazy(object:Object, property: string, getter:() => any): T; + + lazy(object: Object, properties: {[propertyName:string]: () => any}): Object; + lazy(object: Object, properties: {[propertyName:string]: () => any}): T; + + live(object: Object, property: string, descriptor: Object | Function): Object; + live(object: Object, property: string, descriptor: Object | Function): T; + + live(object: Object, properties: {[propertyName: string]: Object | Function}): Object; + live(object: Object, properties: {[propertyName: string]: Object | Function}): T; + + type(object: Object): string; + + value(obj: Object, ...properties: string[]): any; + value(obj: Object, ...properties: string[]): T; + + value(property: string, ...properties: string[]): any; + value(property: string , ...properties: string[]): T; + + fetch(url: string, options?: { + method?: string; + data?: string; + headers?:{[key:string]:string}; + + onreadystatechange?: (ev: ProgressEvent) => any; + readyState?: number; + response?: any; + responseBody?: any; + responseText?: string; + responseType?: string; + responseXML?: any; + status?: number; + statusText?: string; + timeout?: number; + upload?: XMLHttpRequestUpload; + withCredentials?: boolean; + + [propertyName: string]: any; + }): Promise; + + include(condition: any, url: string ): Promise; + include(url: string ): Promise; + + add(name: string, callback: Function, on?: BlissStatic | BlissStaticCollection | Element | Array): void; + add(callbacks:{[callbackName: string]: Function}, on?: BlissStatic | BlissStaticCollection | Element | Array): void; + + hooks: { + add(name: string, callback: Function): void; + run(name: string, env: Object): void; + }; + } + + interface BlissStaticCollection extends BlissStatic { + (selector: string, context?: Element): BlissDecoratedArrayElement; + (expr: Object, context?: Element): Array; + (expr: Window, context?: Element): [Window]; + (expr: Node, context?: Element): [Node]; + } + + // Native methods added into "_" property, but methods that return "void" now return thi stype in order to be chainables + // Methods are All HTMLElement a ELement methods + interface BlissNativeExtentions { + blur(): T; + click(): T; + contains(child: HTMLElement): boolean; + dragDrop(): boolean; + focus(): T; + insertAdjacentElement(position: string, insertedElement: Element): Element; + insertAdjacentHTML(where: string, html: string): T; + insertAdjacentText(where: string, text: string): T; + msGetInputContext(): MSInputMethodContext; + scrollIntoView(top?: boolean): T; + setActive(): T; + addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSGotPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSLostPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSManipulationStateChanged", listener: (ev: MSManipulationEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): T; + addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): T; + addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): T; + addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): T; + addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): T; + addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): T; + addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): T; + addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): T; + addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): T; + addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): T; + addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): T; + addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): T; + addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): T; + addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): T; + addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): T; + addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): T; + addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): T; + addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): T; + addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): T; + addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): T; + addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): T; + addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): T; + addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): T; + addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): T; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): T; + addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): T; + addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): T; + addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): T; + addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): T; + addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): T; + addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): T; + addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): T; + addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): T; + addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): T; + addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): T; + addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): T; + addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): T; + addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): T; + addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "touchcancel", listener: (ev: TouchEvent) => any, useCapture?: boolean): T; + addEventListener(type: "touchend", listener: (ev: TouchEvent) => any, useCapture?: boolean): T; + addEventListener(type: "touchmove", listener: (ev: TouchEvent) => any, useCapture?: boolean): T; + addEventListener(type: "touchstart", listener: (ev: TouchEvent) => any, useCapture?: boolean): T; + addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "webkitfullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "webkitfullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): T; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): T; + getAttribute(name?: string): string; + getAttributeNS(namespaceURI: string, localName: string): string; + getAttributeNode(name: string): Attr; + getAttributeNodeNS(namespaceURI: string, localName: string): Attr; + getBoundingClientRect(): ClientRect; + getClientRects(): ClientRectList; + getElementsByTagName(name: "a"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "applet"): NodeListOf; + getElementsByTagName(name: "area"): NodeListOf; + getElementsByTagName(name: "article"): NodeListOf; + getElementsByTagName(name: "aside"): NodeListOf; + getElementsByTagName(name: "audio"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "base"): NodeListOf; + getElementsByTagName(name: "basefont"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "body"): NodeListOf; + getElementsByTagName(name: "br"): NodeListOf; + getElementsByTagName(name: "button"): NodeListOf; + getElementsByTagName(name: "canvas"): NodeListOf; + getElementsByTagName(name: "caption"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "circle"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "clippath"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "col"): NodeListOf; + getElementsByTagName(name: "colgroup"): NodeListOf; + getElementsByTagName(name: "datalist"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "defs"): NodeListOf; + getElementsByTagName(name: "del"): NodeListOf; + getElementsByTagName(name: "desc"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dir"): NodeListOf; + getElementsByTagName(name: "div"): NodeListOf; + getElementsByTagName(name: "dl"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "ellipse"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "embed"): NodeListOf; + getElementsByTagName(name: "feblend"): NodeListOf; + getElementsByTagName(name: "fecolormatrix"): NodeListOf; + getElementsByTagName(name: "fecomponenttransfer"): NodeListOf; + getElementsByTagName(name: "fecomposite"): NodeListOf; + getElementsByTagName(name: "feconvolvematrix"): NodeListOf; + getElementsByTagName(name: "fediffuselighting"): NodeListOf; + getElementsByTagName(name: "fedisplacementmap"): NodeListOf; + getElementsByTagName(name: "fedistantlight"): NodeListOf; + getElementsByTagName(name: "feflood"): NodeListOf; + getElementsByTagName(name: "fefunca"): NodeListOf; + getElementsByTagName(name: "fefuncb"): NodeListOf; + getElementsByTagName(name: "fefuncg"): NodeListOf; + getElementsByTagName(name: "fefuncr"): NodeListOf; + getElementsByTagName(name: "fegaussianblur"): NodeListOf; + getElementsByTagName(name: "feimage"): NodeListOf; + getElementsByTagName(name: "femerge"): NodeListOf; + getElementsByTagName(name: "femergenode"): NodeListOf; + getElementsByTagName(name: "femorphology"): NodeListOf; + getElementsByTagName(name: "feoffset"): NodeListOf; + getElementsByTagName(name: "fepointlight"): NodeListOf; + getElementsByTagName(name: "fespecularlighting"): NodeListOf; + getElementsByTagName(name: "fespotlight"): NodeListOf; + getElementsByTagName(name: "fetile"): NodeListOf; + getElementsByTagName(name: "feturbulence"): NodeListOf; + getElementsByTagName(name: "fieldset"): NodeListOf; + getElementsByTagName(name: "figcaption"): NodeListOf; + getElementsByTagName(name: "figure"): NodeListOf; + getElementsByTagName(name: "filter"): NodeListOf; + getElementsByTagName(name: "font"): NodeListOf; + getElementsByTagName(name: "footer"): NodeListOf; + getElementsByTagName(name: "foreignobject"): NodeListOf; + getElementsByTagName(name: "form"): NodeListOf; + getElementsByTagName(name: "frame"): NodeListOf; + getElementsByTagName(name: "frameset"): NodeListOf; + getElementsByTagName(name: "g"): NodeListOf; + getElementsByTagName(name: "h1"): NodeListOf; + getElementsByTagName(name: "h2"): NodeListOf; + getElementsByTagName(name: "h3"): NodeListOf; + getElementsByTagName(name: "h4"): NodeListOf; + getElementsByTagName(name: "h5"): NodeListOf; + getElementsByTagName(name: "h6"): NodeListOf; + getElementsByTagName(name: "head"): NodeListOf; + getElementsByTagName(name: "header"): NodeListOf; + getElementsByTagName(name: "hgroup"): NodeListOf; + getElementsByTagName(name: "hr"): NodeListOf; + getElementsByTagName(name: "html"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "iframe"): NodeListOf; + getElementsByTagName(name: "image"): NodeListOf; + getElementsByTagName(name: "img"): NodeListOf; + getElementsByTagName(name: "input"): NodeListOf; + getElementsByTagName(name: "ins"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "label"): NodeListOf; + getElementsByTagName(name: "legend"): NodeListOf; + getElementsByTagName(name: "li"): NodeListOf; + getElementsByTagName(name: "line"): NodeListOf; + getElementsByTagName(name: "lineargradient"): NodeListOf; + getElementsByTagName(name: "link"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "map"): NodeListOf; + getElementsByTagName(name: "mark"): NodeListOf; + getElementsByTagName(name: "marker"): NodeListOf; + getElementsByTagName(name: "marquee"): NodeListOf; + getElementsByTagName(name: "mask"): NodeListOf; + getElementsByTagName(name: "menu"): NodeListOf; + getElementsByTagName(name: "meta"): NodeListOf; + getElementsByTagName(name: "metadata"): NodeListOf; + getElementsByTagName(name: "nav"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "noframes"): NodeListOf; + getElementsByTagName(name: "noscript"): NodeListOf; + getElementsByTagName(name: "object"): NodeListOf; + getElementsByTagName(name: "ol"): NodeListOf; + getElementsByTagName(name: "optgroup"): NodeListOf; + getElementsByTagName(name: "option"): NodeListOf; + getElementsByTagName(name: "p"): NodeListOf; + getElementsByTagName(name: "param"): NodeListOf; + getElementsByTagName(name: "path"): NodeListOf; + getElementsByTagName(name: "pattern"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "polygon"): NodeListOf; + getElementsByTagName(name: "polyline"): NodeListOf; + getElementsByTagName(name: "pre"): NodeListOf; + getElementsByTagName(name: "progress"): NodeListOf; + getElementsByTagName(name: "q"): NodeListOf; + getElementsByTagName(name: "radialgradient"): NodeListOf; + getElementsByTagName(name: "rect"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "script"): NodeListOf; + getElementsByTagName(name: "section"): NodeListOf; + getElementsByTagName(name: "select"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "source"): NodeListOf; + getElementsByTagName(name: "span"): NodeListOf; + getElementsByTagName(name: "stop"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "style"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "svg"): NodeListOf; + getElementsByTagName(name: "switch"): NodeListOf; + getElementsByTagName(name: "symbol"): NodeListOf; + getElementsByTagName(name: "table"): NodeListOf; + getElementsByTagName(name: "tbody"): NodeListOf; + getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "text"): NodeListOf; + getElementsByTagName(name: "textpath"): NodeListOf; + getElementsByTagName(name: "textarea"): NodeListOf; + getElementsByTagName(name: "tfoot"): NodeListOf; + getElementsByTagName(name: "th"): NodeListOf; + getElementsByTagName(name: "thead"): NodeListOf; + getElementsByTagName(name: "title"): NodeListOf; + getElementsByTagName(name: "tr"): NodeListOf; + getElementsByTagName(name: "track"): NodeListOf; + getElementsByTagName(name: "tspan"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "ul"): NodeListOf; + getElementsByTagName(name: "use"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "video"): NodeListOf; + getElementsByTagName(name: "view"): NodeListOf; + getElementsByTagName(name: "wbr"): NodeListOf; + getElementsByTagName(name: "x-ms-webview"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; + hasAttribute(name: string): boolean; + hasAttributeNS(namespaceURI: string, localName: string): boolean; + msGetRegionContent(): MSRangeCollection; + msGetUntransformedBounds(): ClientRect; + msMatchesSelector(selectors: string): boolean; + msReleasePointerCapture(pointerId: number): T; + msSetPointerCapture(pointerId: number): T; + msZoomTo(args: MsZoomToOptions): T; + releasePointerCapture(pointerId: number): T; + removeAttribute(name?: string): T; + removeAttributeNS(namespaceURI: string, localName: string): T; + removeAttributeNode(oldAttr: Attr): Attr; + requestFullscreen(): T; + requestPointerLock(): T; + setAttribute(name?: string, value?: string): T; + setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): T; + setAttributeNode(newAttr: Attr): Attr; + setAttributeNodeNS(newAttr: Attr): Attr; + setPointerCapture(pointerId: number): T; + webkitMatchesSelector(selectors: string): boolean; + webkitRequestFullScreen(): T; + webkitRequestFullscreen(): T; + getElementsByClassName(classNames: string): NodeListOf; + addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSGotPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSLostPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): T; + addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): T; + addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): T; + addEventListener(type: "touchcancel", listener: (ev: TouchEvent) => any, useCapture?: boolean): T; + addEventListener(type: "touchend", listener: (ev: TouchEvent) => any, useCapture?: boolean): T; + addEventListener(type: "touchmove", listener: (ev: TouchEvent) => any, useCapture?: boolean): T; + addEventListener(type: "touchstart", listener: (ev: TouchEvent) => any, useCapture?: boolean): T; + addEventListener(type: "webkitfullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "webkitfullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): T; + addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): T; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): T; + } + + interface BlissBindedElement extends BlissNativeExtentions { + set(options: Object): BlissDecoratedElement + contents(elements: Object | Array | string | Number | Node): BlissDecoratedElement + clone(): BlissDecoratedElement; + after(element:Element) : BlissDecoratedElement; + around(element:Element) : BlissDecoratedElement; + attributes(attrs: Object) : BlissDecoratedElement; + before(element:Element) : BlissDecoratedElement; + inside(element:Element) : BlissDecoratedElement; + properties(props: Object) : BlissDecoratedElement; + start(element:Element) : BlissDecoratedElement; + style(properties: Object) : BlissDecoratedElement; + transition(properties: Object, duration?: number) : Promise; + delegate(type: string, selector: string, callback: (event: Event) => void): BlissDecoratedElement; + delegate(type: string, selectorsToCallbacks: {[selector: string] : (event: Event) => void}): BlissDecoratedElement; + delegate(typesToSelectorsToCallbacks: {[type: string] : {[selector: string] : (event: Event) => void}}): BlissDecoratedElement; + events(handlers: {[eventName:string] : (event: Event) => void} | Element): BlissDecoratedElement; + fire(type: string, properties?: {[propertyName: string] : any}): BlissDecoratedElement; + once(handlers: {[eventName:string] : (event: Event) => void} | Element): BlissDecoratedElement; + + remove(): BlissDecoratedElement; + } + + interface BlissBindedArray { + all(method: string, ...args: Array): Array; + all(method: string, ...args: Array): Array; + } + + interface BlissCollectionArray { + set(options: Object): BlissCollectionArray + contents(elements: Object | Array | string | Number | Node): BlissCollectionArray + clone(): BlissCollectionArray; + after(element:Element) : BlissCollectionArray; + around(element:Element) : BlissCollectionArray; + attributes(attrs: Object) : BlissCollectionArray; + before(element:Element) : BlissCollectionArray; + inside(element:Element) : BlissCollectionArray; + properties(props: Object) : BlissCollectionArray; + start(element:Element) : BlissCollectionArray; + style(properties: Object) : BlissCollectionArray; + transition(properties: Object, duration?: number) : Promise[]; + delegate(type: string, selector: string, callback: (event: Event) => void): BlissCollectionArray; + delegate(type: string, selectorsToCallbacks: {[selector: string] : (event: Event) => void}): BlissCollectionArray; + delegate(typesToSelectorsToCallbacks: {[type: string] : {[selector: string] : (event: Event) => void}}): BlissCollectionArray; + events(handlers: {[eventName:string] : (event: Event) => void} | Element): BlissCollectionArray; + fire(type: string, properties?: {[propertyName: string] : any}): BlissCollectionArray; + once(handlers: {[eventName:string] : (event: Event) => void} | Element): BlissCollectionArray; + + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): BlissCollectionArray; + + remove(): BlissCollectionArray; + } +} + +declare var Bliss: BlissNS.BlissStatic; +declare var $: BlissNS.BlissStatic; +declare var $$: BlissNS.BlissStaticCollection; From d21468d8d2ffdb4b2b5b19803308a0bff23aef5c Mon Sep 17 00:00:00 2001 From: jKey Lu Date: Wed, 23 Dec 2015 11:30:17 +0800 Subject: [PATCH 039/441] Export interfaces for cookies --- cookies/cookies.d.ts | 162 ++++++++++++++++++++++--------------------- 1 file changed, 82 insertions(+), 80 deletions(-) diff --git a/cookies/cookies.d.ts b/cookies/cookies.d.ts index 53de9fe090..5cc5f698a3 100644 --- a/cookies/cookies.d.ts +++ b/cookies/cookies.d.ts @@ -8,91 +8,93 @@ declare module "cookies" { import * as http from "http" - interface ICookies { - /** - * This extracts the cookie with the given name from the - * Cookie header in the request. If such a cookie exists, - * its value is returned. Otherwise, nothing is returned. - */ - get(name: string): string; - /** - * This extracts the cookie with the given name from the - * Cookie header in the request. If such a cookie exists, - * its value is returned. Otherwise, nothing is returned. - */ - get(name: string, opts: IOptions): string; - - /** - * This sets the given cookie in the response and returns - * the current context to allow chaining.If the value is omitted, - * an outbound header with an expired date is used to delete the cookie. - */ - set(name: string, value: string): ICookies; - /** - * This sets the given cookie in the response and returns - * the current context to allow chaining.If the value is omitted, - * an outbound header with an expired date is used to delete the cookie. - */ - set(name: string, value: string, opts: IOptions): ICookies; - } + module cookies { + interface ICookies { + /** + * This extracts the cookie with the given name from the + * Cookie header in the request. If such a cookie exists, + * its value is returned. Otherwise, nothing is returned. + */ + get(name: string): string; + /** + * This extracts the cookie with the given name from the + * Cookie header in the request. If such a cookie exists, + * its value is returned. Otherwise, nothing is returned. + */ + get(name: string, opts: IOptions): string; + + /** + * This sets the given cookie in the response and returns + * the current context to allow chaining.If the value is omitted, + * an outbound header with an expired date is used to delete the cookie. + */ + set(name: string, value: string): ICookies; + /** + * This sets the given cookie in the response and returns + * the current context to allow chaining.If the value is omitted, + * an outbound header with an expired date is used to delete the cookie. + */ + set(name: string, value: string, opts: IOptions): ICookies; + } - interface IOptions { - /** - * a number representing the milliseconds from Date.now() for expiry - */ - maxAge?: number; - /** - * a Date object indicating the cookie's expiration - * date (expires at the end of session by default). - */ - expires?: Date; - /** - * a string indicating the path of the cookie (/ by default). - */ - path?: string; - /** - * a string indicating the domain of the cookie (no default). - */ - domain?: string; - /** - * a boolean indicating whether the cookie is only to be sent - * over HTTPS (false by default for HTTP, true by default for HTTPS). - */ - secure?: boolean; - /** - * a boolean indicating whether the cookie is only to be sent - * over HTTPS (use this if you handle SSL not in your node process). - */ - secureProxy?: boolean; - /** - * a boolean indicating whether the cookie is only to be sent over HTTP(S), - * and not made available to client JavaScript (true by default). - */ - httpOnly?: boolean; - /** - * a boolean indicating whether the cookie is to be signed (false by default). - * If this is true, another cookie of the same name with the .sig suffix - * appended will also be sent, with a 27-byte url-safe base64 SHA1 value - * representing the hash of cookie-name=cookie-value against the first Keygrip key. - * This signature key is used to detect tampering the next time a cookie is received. - */ - signed?: boolean; - /** - * a boolean indicating whether to overwrite previously set - * cookies of the same name (false by default). If this is true, - * all cookies set during the same request with the same - * name (regardless of path or domain) are filtered out of - * the Set-Cookie header when setting this cookie. - */ - overwrite?: boolean; + interface IOptions { + /** + * a number representing the milliseconds from Date.now() for expiry + */ + maxAge?: number; + /** + * a Date object indicating the cookie's expiration + * date (expires at the end of session by default). + */ + expires?: Date; + /** + * a string indicating the path of the cookie (/ by default). + */ + path?: string; + /** + * a string indicating the domain of the cookie (no default). + */ + domain?: string; + /** + * a boolean indicating whether the cookie is only to be sent + * over HTTPS (false by default for HTTP, true by default for HTTPS). + */ + secure?: boolean; + /** + * a boolean indicating whether the cookie is only to be sent + * over HTTPS (use this if you handle SSL not in your node process). + */ + secureProxy?: boolean; + /** + * a boolean indicating whether the cookie is only to be sent over HTTP(S), + * and not made available to client JavaScript (true by default). + */ + httpOnly?: boolean; + /** + * a boolean indicating whether the cookie is to be signed (false by default). + * If this is true, another cookie of the same name with the .sig suffix + * appended will also be sent, with a 27-byte url-safe base64 SHA1 value + * representing the hash of cookie-name=cookie-value against the first Keygrip key. + * This signature key is used to detect tampering the next time a cookie is received. + */ + signed?: boolean; + /** + * a boolean indicating whether to overwrite previously set + * cookies of the same name (false by default). If this is true, + * all cookies set during the same request with the same + * name (regardless of path or domain) are filtered out of + * the Set-Cookie header when setting this cookie. + */ + overwrite?: boolean; + } } interface CookiesStatic { - new (request: http.IncomingMessage, response: http.ServerResponse): ICookies; - new (request: http.IncomingMessage, response: http.ServerResponse, keys?: Array): ICookies; + new (request: http.IncomingMessage, response: http.ServerResponse): cookies.ICookies; + new (request: http.IncomingMessage, response: http.ServerResponse, keys?: Array): cookies.ICookies; } - const _tmp: CookiesStatic; + const cookies: CookiesStatic; - export = _tmp + export = cookies } \ No newline at end of file From 8266d4428aedb3da338c92e1490224d5a4582d76 Mon Sep 17 00:00:00 2001 From: Makis Maropoulos Date: Wed, 23 Dec 2015 05:52:31 +0200 Subject: [PATCH 040/441] Update moment-node.d.ts Add the new toObject() from the new version 2.10.5 . --- moment/moment-node.d.ts | 120 +++++++++++++++++++++++----------------- 1 file changed, 68 insertions(+), 52 deletions(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index babde41c92..3471a8fc30 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -1,10 +1,22 @@ -// Type definitions for Moment.js 2.8.0 +// Type definitions for Moment.js 2.10.5 // Project: https://github.com/timrwood/moment // Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya , Matt Brooks // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module moment { + interface MomentDateObject { + years?: number; + /* One digit */ + months?: number; + /* Day of the month */ + date?: number; + hours?: number; + minutes?: number; + seconds?: number; + milliseconds?: number; + } + interface MomentInput { /** Year */ years?: number; @@ -247,8 +259,8 @@ declare module moment { dayOfYear(): number; dayOfYear(d: number): Moment; - from(f: Moment|string|number|Date|number[], suffix?: boolean): string; - to(f: Moment|string|number|Date|number[], suffix?: boolean): string; + from(f: Moment | string | number | Date | number[], suffix?: boolean): string; + to(f: Moment | string | number | Date | number[], suffix?: boolean): string; toNow(withoutPrefix?: boolean): string; diff(b: Moment): number; @@ -272,13 +284,13 @@ declare module moment { isDST(): boolean; isBefore(): boolean; - isBefore(b: Moment|string|number|Date|number[], granularity?: string): boolean; + isBefore(b: Moment | string | number | Date | number[], granularity?: string): boolean; isAfter(): boolean; - isAfter(b: Moment|string|number|Date|number[], granularity?: string): boolean; + isAfter(b: Moment | string | number | Date | number[], granularity?: string): boolean; - isSame(b: Moment|string|number|Date|number[], granularity?: string): boolean; - isBetween(a: Moment|string|number|Date|number[], b: Moment|string|number|Date|number[], granularity?: string): boolean; + isSame(b: Moment | string | number | Date | number[], granularity?: string): boolean; + isBetween(a: Moment | string | number | Date | number[], b: Moment | string | number | Date | number[], granularity?: string): boolean; // Deprecated as of 2.8.0. lang(language: string): Moment; @@ -294,43 +306,47 @@ declare module moment { localeData(): MomentLanguage; // Deprecated as of 2.7.0. - max(date: Moment|string|number|Date|any[]): Moment; + max(date: Moment | string | number | Date | any[]): Moment; max(date: string, format: string): Moment; // Deprecated as of 2.7.0. - min(date: Moment|string|number|Date|any[]): Moment; + min(date: Moment | string | number | Date | any[]): Moment; min(date: string, format: string): Moment; get(unit: string): number; set(unit: string, value: number): Moment; set(objectLiteral: MomentInput): Moment; + + /*This returns an object containing year, month, day-of-month, hour, minute, seconds, milliseconds.*/ + //Works with version 2.10.5+ + toObject(): MomentDateObject; } type formatFunction = () => string; interface MomentCalendar { - lastDay?: string | formatFunction; - sameDay?: string | formatFunction; - nextDay?: string | formatFunction; - lastWeek?: string | formatFunction; - nextWeek?: string | formatFunction; - sameElse?: string | formatFunction; + lastDay?: string | formatFunction; + sameDay?: string | formatFunction; + nextDay?: string | formatFunction; + lastWeek?: string | formatFunction; + nextWeek?: string | formatFunction; + sameElse?: string | formatFunction; } interface BaseMomentLanguage { - months ?: any; - monthsShort ?: any; - weekdays ?: any; - weekdaysShort ?: any; - weekdaysMin ?: any; - relativeTime ?: MomentRelativeTime; - meridiem ?: (hour: number, minute: number, isLowercase: boolean) => string; - calendar ?: MomentCalendar; - ordinal ?: (num: number) => string; + months?: any; + monthsShort?: any; + weekdays?: any; + weekdaysShort?: any; + weekdaysMin?: any; + relativeTime?: MomentRelativeTime; + meridiem?: (hour: number, minute: number, isLowercase: boolean) => string; + calendar?: MomentCalendar; + ordinal?: (num: number) => string; } interface MomentLanguage extends BaseMomentLanguage { - longDateFormat?: MomentLongDateFormat; + longDateFormat?: MomentLongDateFormat; } interface MomentLanguageData extends BaseMomentLanguage { @@ -341,34 +357,34 @@ declare module moment { } interface MomentLongDateFormat { - L: string; - LL: string; - LLL: string; - LLLL: string; - LT: string; - LTS: string; - l?: string; - ll?: string; - lll?: string; - llll?: string; - lt?: string; - lts?: string; + L: string; + LL: string; + LLL: string; + LLLL: string; + LT: string; + LTS: string; + l?: string; + ll?: string; + lll?: string; + llll?: string; + lt?: string; + lts?: string; } interface MomentRelativeTime { - future: any; - past: any; - s: any; - m: any; - mm: any; - h: any; - hh: any; - d: any; - dd: any; - M: any; - MM: any; - y: any; - yy: any; + future: any; + past: any; + s: any; + m: any; + mm: any; + h: any; + hh: any; + d: any; + dd: any; + M: any; + MM: any; + y: any; + yy: any; } interface MomentStatic { @@ -460,8 +476,8 @@ declare module moment { max(...moments: Moment[]): Moment; normalizeUnits(unit: string): string; - relativeTimeThreshold(threshold: string): number|boolean; - relativeTimeThreshold(threshold: string, limit:number): boolean; + relativeTimeThreshold(threshold: string): number | boolean; + relativeTimeThreshold(threshold: string, limit: number): boolean; /** * Constant used to enable explicit ISO_8601 format parsing. From 2bcb76339897101fcac845fb6c5b3c9507dbb0c7 Mon Sep 17 00:00:00 2001 From: Georgios Valotasios Date: Wed, 23 Dec 2015 10:16:06 +0100 Subject: [PATCH 041/441] Make use of es6 import --- jade/jade-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jade/jade-tests.ts b/jade/jade-tests.ts index fa11968eaf..6b4774021f 100644 --- a/jade/jade-tests.ts +++ b/jade/jade-tests.ts @@ -1,10 +1,10 @@ /// -import jade = require('jade'); +import * as jade from 'jade'; jade.compile("b")(); jade.compileFile("foo.jade", {})(); jade.compileClient("a")({ a: 1 }); jade.compileClientWithDependenciesTracked("test").body(); jade.render("h1",{}); -jade.renderFile("foo.jade"); \ No newline at end of file +jade.renderFile("foo.jade"); From 85fa3fbd3366f64712d587e775ca5fd97e0619f0 Mon Sep 17 00:00:00 2001 From: fskorzec Date: Wed, 23 Dec 2015 11:44:23 +0100 Subject: [PATCH 042/441] Rename bliss to blissfuljs --- bliss/bliss-tests.ts => blissfuljs/blissfuljs-tests.ts | 0 bliss/bliss.d.ts => blissfuljs/blissfuljs.d.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename bliss/bliss-tests.ts => blissfuljs/blissfuljs-tests.ts (100%) rename bliss/bliss.d.ts => blissfuljs/blissfuljs.d.ts (100%) diff --git a/bliss/bliss-tests.ts b/blissfuljs/blissfuljs-tests.ts similarity index 100% rename from bliss/bliss-tests.ts rename to blissfuljs/blissfuljs-tests.ts diff --git a/bliss/bliss.d.ts b/blissfuljs/blissfuljs.d.ts similarity index 100% rename from bliss/bliss.d.ts rename to blissfuljs/blissfuljs.d.ts From 4aea060d4c8c30be484102d9ebdf6e85911606a5 Mon Sep 17 00:00:00 2001 From: fskorzec Date: Wed, 23 Dec 2015 11:46:49 +0100 Subject: [PATCH 043/441] Updated reference in blissfuljs-tests.ts --- blissfuljs/blissfuljs-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blissfuljs/blissfuljs-tests.ts b/blissfuljs/blissfuljs-tests.ts index bc2eafa4f2..ea55c63a9a 100644 --- a/blissfuljs/blissfuljs-tests.ts +++ b/blissfuljs/blissfuljs-tests.ts @@ -1,4 +1,4 @@ -/// +/// function test_overview() { /*Bliss includes several static methods (on the Bliss or $ object). For example, to copy all properties of an object onto another object, you would From 8f808f0a03b198505835d65a22897aa998e313d1 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Wed, 23 Dec 2015 11:03:25 +0000 Subject: [PATCH 044/441] Added typings for bcrypt-nodejs --- bcrypt-nodejs/bcrypt-nodejs-tests.ts | 30 ++++++++++++ bcrypt-nodejs/bcrypt-nodejs.d.ts | 68 ++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 bcrypt-nodejs/bcrypt-nodejs-tests.ts create mode 100644 bcrypt-nodejs/bcrypt-nodejs.d.ts diff --git a/bcrypt-nodejs/bcrypt-nodejs-tests.ts b/bcrypt-nodejs/bcrypt-nodejs-tests.ts new file mode 100644 index 0000000000..2a151c1c7e --- /dev/null +++ b/bcrypt-nodejs/bcrypt-nodejs-tests.ts @@ -0,0 +1,30 @@ +/// + +import bCrypt = require("bcrypt-nodejs"); + +function test_sync() { + var salt1 = bCrypt.genSaltSync(); + var salt2 = bCrypt.genSaltSync(8); + + var hash1 = bCrypt.hashSync('super secret'); + var hash2 = bCrypt.hashSync('super secret', salt1); + + var compare1 = bCrypt.compareSync('super secret', hash1); + + var rounds1 = bCrypt.getRounds(hash2); +} + +function test_async() { + var cbString = (error: Error, result: string) => {}; + var cbVoid = () => {}; + var cbBoolean = (error: Error, result: boolean) => {}; + + bCrypt.genSalt(8, cbString); + + var salt = bCrypt.genSaltSync(); + bCrypt.hash('super secret', salt, cbString); + bCrypt.hash('super secret', salt, cbVoid, cbString); + + var hash = bCrypt.hashSync('super secret'); + bCrypt.compare('super secret', hash, cbBoolean); +} \ No newline at end of file diff --git a/bcrypt-nodejs/bcrypt-nodejs.d.ts b/bcrypt-nodejs/bcrypt-nodejs.d.ts new file mode 100644 index 0000000000..e0a46ffa52 --- /dev/null +++ b/bcrypt-nodejs/bcrypt-nodejs.d.ts @@ -0,0 +1,68 @@ +// Type definitions for bcrypt-nodejs +// Project: https://github.com/shaneGirish/bcrypt-nodejs +// Definitions by: David Broder-Rodgers +// Definitions: https://github.com/DavidBR-SW/DefinitelyTyped + +declare module "bcrypt-nodejs" { + /** + * Generate a salt synchronously + * @param rounds Number of rounds to process the data for (default - 10) + * @return Generated salt + */ + export function genSaltSync(rounds?: number): string; + + /** + * Generate a salt asynchronously + * @param rounds Number of rounds to process the data for (default - 10) + * @param callback Callback with error and resulting salt, to be fired once the salt has been generated + */ + export function genSalt(rounds: number, callback: (error: Error, result: string) => void): void; + + /** + * Generate a hash synchronously + * @param data Data to be encrypted + * @param salt Salt to be used in encryption (default - new salt generated with 10 rounds) + * @return Generated hash + */ + export function hashSync(data: string, salt?: string): string; + + /** + * Generate a hash asynchronously + * @param data Data to be encrypted + * @param salt Salt to be used in encryption + * @param callback Callback with error and hashed result, to be fired once the data has been encrypted + */ + export function hash(data: string, salt: string, callback: (error: Error, result: string) => void): void; + + /** + * Generate a hash asynchronously + * @param data Data to be encrypted + * @param salt Salt to be used in encryption + * @param progressCallback Callback to be fired multiple times during the hash calculation to signify progress + * @param callback Callback with error and hashed result, to be fired once the data has been encrypted + */ + export function hash(data: string, salt: string, progressCallback: () => void, callback: (error: Error, result: string) => void): void; + + /** + * Compares data with a hash synchronously + * @param data Data to be compared + * @param hash Hash to be compared to + * @return true if matching, false otherwise + */ + export function compareSync(data: string, hash: string): boolean; + + /** + * Compares data with a hash asynchronously + * @param data Data to be compared + * @param hash Hash to be compared to + * @param callback Callback with error and match result, to be fired once the data has been compared + */ + export function compare(data: string, hash: string, callback: (error: Error, result: boolean) => void): void; + + /** + * Get number of rounds used for hash + * @param hash Hash from which the number of rounds used should be extracted + * @return number of rounds used to encrypt a given hash + */ + export function getRounds(hash: string): number; +} From 492d942da4db5bd03551d6764b1e985afacc678e Mon Sep 17 00:00:00 2001 From: secondwtq Date: Wed, 23 Dec 2015 19:14:29 +0800 Subject: [PATCH 045/441] Added type definitions for rss. --- rss/rss-tests.ts | 71 ++++++++++++++++ rss/rss.d.ts | 209 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 280 insertions(+) create mode 100644 rss/rss-tests.ts create mode 100644 rss/rss.d.ts diff --git a/rss/rss-tests.ts b/rss/rss-tests.ts new file mode 100644 index 0000000000..38ce28a977 --- /dev/null +++ b/rss/rss-tests.ts @@ -0,0 +1,71 @@ +/// + +// this test is copied from https://github.com/dylang/node-rss +// it basically: +// +// * creates an RSS feed with some attributes, +// * add an item to it +// * then generates XML string + +import * as RSS from 'rss'; + +var feed = new RSS({ + title: 'title', + description: 'description', + feed_url: 'http://example.com/rss.xml', + site_url: 'http://example.com', + image_url: 'http://example.com/icon.png', + docs: 'http://example.com/rss/docs.html', + managingEditor: 'Dylan Greene', + webMaster: 'Dylan Greene', + copyright: '2013 Dylan Greene', + language: 'en', + categories: ['Category 1','Category 2','Category 3'], + pubDate: 'May 20, 2012 04:00:00 GMT', + ttl: 60, + custom_namespaces: { + 'itunes': 'http://www.itunes.com/dtds/podcast-1.0.dtd' + }, + custom_elements: [ + { 'itunes:subtitle': 'A show about everything' }, + { 'itunes:author': 'John Doe' }, + { 'itunes:summary': 'All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our podcast in the Podcasts app or in the iTunes Store'}, + { 'itunes:owner': [ + { 'itunes:name': 'John Doe' }, + { 'itunes:email': 'john.doe@example.com' } + ] + }, + { 'itunes:image': { + _attr: { + href: 'http://example.com/podcasts/everything/AllAboutEverything.jpg' + } + } + } + ] +}); + +feed.item({ + title: 'item title', + description: 'use this for the content. It can include html.', + url: 'http://example.com/article4?this&that', + guid: '1123', + categories: ['Category 1','Category 2','Category 3','Category 4'], + author: 'Guest Author', + date: 'May 27, 2012', + lat: 33.417974, + long: -111.933231, + enclosure: { url:'...', file:'path-to-file' }, + custom_elements: [ + { 'itunes:author': 'John Doe' }, + { 'itunes:subtitle': 'A short primer on table spices' }, + { 'itunes:image': { + _attr: { + href: 'http://example.com/podcasts/everything/AllAboutEverything/Episode1.jpg' + } + } + }, + { 'itunes:duration': '7:04' } + ] +}); + +var xml = feed.xml(); diff --git a/rss/rss.d.ts b/rss/rss.d.ts new file mode 100644 index 0000000000..eab2fc70da --- /dev/null +++ b/rss/rss.d.ts @@ -0,0 +1,209 @@ +// Type definitions for rss +// Project: https://github.com/dylang/node-rss +// Definitions by: Second Datke +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module NodeRSS { + interface FeedOptions { + /** + * Title of your site or feed. + */ + title: string; + /** + * A short description of the feed. + */ + description?: string; + /** + * Feed generator. + */ + generator?: string; + /** + * URL to the rss feed. + */ + feed_url: string; + /** + * URL to the site that the feed is for. + */ + site_url: string; + /** + * Small image for feed readers to use. + */ + image_url?: string; + /** + * URL to documentation on this feed. + */ + docs?: string; + /** + * Who manages content in this feed. + */ + managingEditor?: string; + /** + * Who manages feed availability and technical support. + */ + webMaster?: string; + /** + * Copyright information for this feed. + */ + copyright?: string; + /** + * The language of the content of this feed. + */ + language?: string; + /** + * One or more categories this feed belongs to. + */ + categories?: string[]; + /** + * The publication date for content in the feed. + * Accepts Date object or string with any format + * JS Date can parse. + */ + pubDate?: Date | string; + /** + * Number of minutes feed can be cached before refreshing + * from source. + */ + ttl?: number; + /** + * Where is the PubSubHub hub located. + */ + hub?: string; + /** + * Put additional namespaces in element + * (without 'xmlns:' prefix). + */ + custom_namespaces?: Object; + /** + * Put additional elements in the feed (node-xml syntax). + */ + custom_elements?: any[]; + } + + interface EnclosureObject { + /** + * URL to file object (or file). + */ + url: string; + /** + * Path to binary file (or URL). + */ + file: string; + /** + * Size of the file. + */ + size?: number; + /** + * If not provided, the MIME Type will be guessed based + * on the extension of the file or URL, passing type to + * the enclosure will override the guessed type. + */ + type?: string; + } + + interface ItemOptions { + /** + * Title of this particular item. + */ + title: string; + /** + * Content for the item. Can contain HTML but link and image + * URLs must be absolute path including hostname. + */ + description: string; + /** + * URL to the item. This could be a blog entry. + */ + url: string; + /** + * A unique string feed readers use to know if an item is + * new or has already been seen. If you use a guid never + * change it. If you don't provide a guid then your item + * urls must be unique. + * Defaults to url. + */ + guid?: string; + /** + * If provided, each array item will be added as a category + * element. + */ + categories?: string[]; + /** + * If included it is the name of the item's creator. If not + * provided the item author will be the same as the feed author. + * This is typical except on multi-author blogs. + */ + author?: string; + /** + * The date and time of when the item was created. Feed + * readers use this to determine the sort order. Some readers + * will also use it to determine if the content should be + * presented as unread. + * Accepts Date object or string with any format + * JS Date can parse. + */ + date: Date | string; + /** + * The latitude coordinate of the item for GeoRSS. + */ + lat?: number; + /** + * The longitude coordinate of the item for GeoRSS. + */ + long?: number; + /** + * Put additional elements in the item (node-xml syntax). + */ + custom_elements?: any[]; + /** + * An enclosure object. + */ + enclosure?: EnclosureObject; + } + + interface XmlOptions { + /** + * What to use as a tab. Defaults to no tabs (compressed). + * For example you can use '\t' for tab character, or ' ' + * for two-space tabs. If you set it to true it will use + * four spaces. + */ + indent?: boolean | string; + } + + interface RSS { + /** + * Add an item to a feed. An item can be used for a blog + * entry, project update, log entry, etc. + * @param {ItemOptions} itemOptions + * @returns {RSS} + */ + item(itemOptions: ItemOptions): RSS; + /** + * Generate XML and return as a string for this feed. + * @returns {string} + */ + xml(): string; + /** + * Generate XML and return as a string for this feed. + * + * @param {XmlOptions} xmlOptions - You can use indent + * option to specify the tab character to use. + * @returns {string} + */ + xml(xmlOptions: XmlOptions): string; + } + + interface RSSFactory { + /** + * Create an RSS feed with options. + * @param {FeedOptions} feedOptions - Options for the RSS feed. + * @returns {RSS} + */ + new(feedOptions: FeedOptions): RSS; + } +} + +declare module 'rss' { + var factory: NodeRSS.RSSFactory; + export = factory; +} From 860a1399c4884274632140e482378d37e8ebb326 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Wed, 23 Dec 2015 11:28:18 +0000 Subject: [PATCH 046/441] Updated optional flag on object.assert in Joi typings --- joi/joi-tests.ts | 2 ++ joi/joi.d.ts | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index 9e631e3e37..c8c05bf872 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -579,7 +579,9 @@ objSchema = objSchema.without(str, strArr); objSchema = objSchema.rename(str, str); objSchema = objSchema.rename(str, str, renOpts); +objSchema = objSchema.assert(str, schema); objSchema = objSchema.assert(str, schema, str); +objSchema = objSchema.assert(ref, schema); objSchema = objSchema.assert(ref, schema, str); objSchema = objSchema.unknown(); diff --git a/joi/joi.d.ts b/joi/joi.d.ts index 2e230dcb86..c774b36ab4 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -1,6 +1,6 @@ // Type definitions for joi v4.6.0 // Project: https://github.com/spumko/joi -// Definitions by: Bart van der Schoor , Laurence Dougal Myers , Christopher Glantschnig +// Definitions by: Bart van der Schoor , Laurence Dougal Myers , Christopher Glantschnig , David Broder-Rodgers // Definitions: https://github.com/borisyankov/DefinitelyTyped // TODO express type of Schema in a type-parameter (.default, .valid, .example etc) @@ -584,8 +584,8 @@ declare module 'joi' { /** * Verifies an assertion where. */ - assert(ref: string, schema: Schema, message: string): ObjectSchema; - assert(ref: Reference, schema: Schema, message: string): ObjectSchema; + assert(ref: string, schema: Schema, message?: string): ObjectSchema; + assert(ref: Reference, schema: Schema, message?: string): ObjectSchema; /** * Overrides the handling of unknown keys for the scope of the current object only (does not apply to children). From fa3a82e87fb4a6c117180930cfd214fffc9a0507 Mon Sep 17 00:00:00 2001 From: David Reher Date: Wed, 23 Dec 2015 12:58:14 +0100 Subject: [PATCH 047/441] AngularJS: add initial support for component router --- angularjs/angular-component-router.d.ts | 322 ++++++++++++++++++++++++ angularjs/angular.d.ts | 106 +++++++- 2 files changed, 417 insertions(+), 11 deletions(-) create mode 100644 angularjs/angular-component-router.d.ts diff --git a/angularjs/angular-component-router.d.ts b/angularjs/angular-component-router.d.ts new file mode 100644 index 0000000000..b4ee317ccc --- /dev/null +++ b/angularjs/angular-component-router.d.ts @@ -0,0 +1,322 @@ +// Type definitions for Angular JS 1.5 component router +// Project: http://angularjs.org +// Definitions by: David Reher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module angular { + /** + * `Instruction` is a tree of {@link ComponentInstruction}s with all the information needed + * to transition each component in the app to a given route, including all auxiliary routes. + * + * `Instruction`s can be created using {@link Router#generate}, and can be used to + * perform route changes with {@link Router#navigateByInstruction}. + * + * ### Example + * + * ``` + * import {Component} from 'angular2/core'; + * import {bootstrap} from 'angular2/platform/browser'; + * import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from 'angular2/router'; + * + * @Component({directives: [ROUTER_DIRECTIVES]}) + * @RouteConfig([ + * {...}, + * ]) + * class AppCmp { + * constructor(router: Router) { + * var instruction = router.generate(['/MyRoute']); + * router.navigateByInstruction(instruction); + * } + * } + * + * bootstrap(AppCmp, ROUTER_PROVIDERS); + * ``` + */ + interface Instruction { + + urlPath(): string; + + urlParams(): string[]; + + specificity(): number; + + resolveComponent(): Promise; + + /** + * converts the instruction into a URL string + */ + toRootUrl(): string; + + toUrlQuery(): string; + + /** + * Returns a new instruction that shares the state of the existing instruction, but with + * the given child {@link Instruction} replacing the existing child. + */ + replaceChild(child: Instruction): Instruction; + + /** + * If the final URL for the instruction is `` + */ + toUrlPath(): string; + + /** + * default instructions override these + */ + toLinkUrl(): string; + } + + /** + * A router outlet is a placeholder that Angular dynamically fills based on the application's route. + * + * ## Use + * + * ``` + * + * ``` + */ + interface RouterOutlet { + name: string; + + /** + * Called by the Router to instantiate a new component during the commit phase of a navigation. + * This method in turn is responsible for calling the `routerOnActivate` hook of its child. + */ + activate(nextInstruction: ComponentInstruction): Promise; + + /** + * Called by the {@link Router} during the commit phase of a navigation when an outlet + * reuses a component between different routes. + * This method in turn is responsible for calling the `routerOnReuse` hook of its child. + */ + reuse(nextInstruction: ComponentInstruction): Promise; + + /** + * Called by the {@link Router} when an outlet disposes of a component's contents. + * This method in turn is responsible for calling the `routerOnDeactivate` hook of its child. + */ + deactivate(nextInstruction: ComponentInstruction): Promise; + + /** + * Called by the {@link Router} during recognition phase of a navigation. + * + * If this resolves to `false`, the given navigation is cancelled. + * + * This method delegates to the child component's `routerCanDeactivate` hook if it exists, + * and otherwise resolves to true. + */ + routerCanDeactivate(nextInstruction: ComponentInstruction): Promise; + + /** + * Called by the {@link Router} during recognition phase of a navigation. + * + * If the new child component has a different Type than the existing child component, + * this will resolve to `false`. You can't reuse an old component when the new component + * is of a different Type. + * + * Otherwise, this method delegates to the child component's `routerCanReuse` hook if it exists, + * or resolves to true if the hook is not present. + */ + routerCanReuse(nextInstruction: ComponentInstruction): Promise; + } + + interface RouteRegistry { + /** + * Given a component and a configuration object, add the route to this registry + */ + config(parentComponent: any, config: RouteDefinition): void; + + /** + * Reads the annotations of a component and configures the registry based on them + */ + configFromComponent(component: any): void; + + /** + * Given a URL and a parent component, return the most specific instruction for navigating + * the application into the state specified by the url + */ + recognize(url: string, ancestorInstructions: Instruction[]): Promise; + + /** + * Given a normalized list with component names and params like: `['user', {id: 3 }]` + * generates a url with a leading slash relative to the provided `parentComponent`. + * + * If the optional param `_aux` is `true`, then we generate starting at an auxiliary + * route boundary. + */ + generate(linkParams: any[], ancestorInstructions: Instruction[], _aux?: boolean): Instruction; + + hasRoute(name: string, parentComponent: any): boolean; + + generateDefault(componentCursor: any): Instruction; + } + + /** + * The `Router` is responsible for mapping URLs to components. + * + * You can see the state of the router by inspecting the read-only field `router.navigating`. + * This may be useful for showing a spinner, for instance. + * + * ## Concepts + * + * Routers and component instances have a 1:1 correspondence. + * + * The router holds reference to a number of {@link RouterOutlet}. + * An outlet is a placeholder that the router dynamically fills in depending on the current URL. + * + * When the router navigates from a URL, it must first recognize it and serialize it into an + * `Instruction`. + * The router uses the `RouteRegistry` to get an `Instruction`. + */ + interface Router { + navigating: boolean; + lastNavigationAttempt: string; + registry: RouteRegistry; + parent: Router; + hostComponent: any; + + /** + * Constructs a child router. You probably don't need to use this unless you're writing a reusable + * component. + */ + childRouter(hostComponent: any): Router; + + /** + * Constructs a child router. You probably don't need to use this unless you're writing a reusable + * component. + */ + auxRouter(hostComponent: any): Router; + + /** + * Register an outlet to be notified of primary route changes. + * + * You probably don't need to use this unless you're writing a reusable component. + */ + registerPrimaryOutlet(outlet: RouterOutlet): Promise; + + /** + * Register an outlet to notified of auxiliary route changes. + * + * You probably don't need to use this unless you're writing a reusable component. + */ + registerAuxOutlet(outlet: RouterOutlet): Promise; + + /** + * Given an instruction, returns `true` if the instruction is currently active, + * otherwise `false`. + */ + isRouteActive(instruction: Instruction): boolean; + + /** + * Dynamically update the routing configuration and trigger a navigation. + * + * ### Usage + * + * ``` + * router.config([ + * { 'path': '/', 'component': IndexComp }, + * { 'path': '/user/:id', 'component': UserComp }, + * ]); + * ``` + */ + config(definitions: RouteDefinition[]): Promise; + + /** + * Navigate based on the provided Route Link DSL. It's preferred to navigate with this method + * over `navigateByUrl`. + * + * ### Usage + * + * This method takes an array representing the Route Link DSL: + * ``` + * ['./MyCmp', {param: 3}] + * ``` + * See the {@link RouterLink} directive for more. + */ + navigate(linkParams: any[]): Promise; + + /** + * Navigate to a URL. Returns a promise that resolves when navigation is complete. + * It's preferred to navigate with `navigate` instead of this method, since URLs are more brittle. + * + * If the given URL begins with a `/`, router will navigate absolutely. + * If the given URL does not begin with `/`, the router will navigate relative to this component. + */ + navigateByUrl(url: string, _skipLocationChange?: boolean): Promise; + + /** + * Navigate via the provided instruction. Returns a promise that resolves when navigation is + * complete. + */ + navigateByInstruction(instruction: Instruction, + _skipLocationChange?: boolean): Promise; + + /** + * Updates this router and all descendant routers according to the given instruction + */ + commit(instruction: Instruction, _skipLocationChange?: boolean): Promise; + + /** + * Subscribe to URL updates from the router + */ + subscribe(onNext: (value: any) => void): Object; + + /** + * Removes the contents of this router's outlet and all descendant outlets + */ + deactivate(instruction: Instruction): Promise; + + /** + * Given a URL, returns an instruction representing the component graph + */ + recognize(url: string): Promise; + + /** + * Navigates to either the last URL successfully navigated to, or the last URL requested if the + * router has yet to successfully navigate. + */ + renavigate(): Promise; + + /** + * Generate an `Instruction` based on the provided Route Link DSL. + */ + generate(linkParams: any[]): Instruction; + } + + /** + * RouteData is an immutable map of additional data you can configure in your Route. + * You can inject RouteData into the constructor of a component to use it. + */ + interface RouteData { + data: {[key: string]: any}; + get(key: string): any; + } + + /** + * A `ComponentInstruction` represents the route state for a single component. An `Instruction` is + * composed of a tree of these `ComponentInstruction`s. + * + * `ComponentInstructions` is a public API. Instances of `ComponentInstruction` are passed + * to route lifecycle hooks, like {@link CanActivate}. + * + * `ComponentInstruction`s are [https://en.wikipedia.org/wiki/Hash_consing](hash consed). You should + * never construct one yourself with "new." Instead, rely on {@link Router/RouteRecognizer} to + * construct `ComponentInstruction`s. + * + * You should not modify this object. It should be treated as immutable. + */ + interface ComponentInstruction { + reuse: boolean; + routeData: RouteData; + urlPath: string; + urlParams: string[]; + data: RouteData; + componentType: any; + terminal: boolean; + specificity: number; + params: {[key: string]: any}; + } +} diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 713e6681dc..c5ebeaa92f 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -165,7 +165,7 @@ declare module angular { dot: number; codeName: string; }; - + /** * If window.name contains prefix NG_DEFER_BOOTSTRAP! when angular.bootstrap is called, the bootstrap process will be paused until angular.resumeBootstrap() is called. * @param extraModules An optional array of modules that should be added to the original list of modules that the app was about to be bootstrapped with. @@ -1626,22 +1626,106 @@ declare module angular { */ totalPendingRequests: number; } - + /////////////////////////////////////////////////////////////////////////// // Component // see http://angularjs.blogspot.com.br/2015/11/angularjs-15-beta2-and-14-releases.html // and http://toddmotto.com/exploring-the-angular-1-5-component-method/ /////////////////////////////////////////////////////////////////////////// - + + /** + * Runtime representation a type that a Component or other object is instances of. + * + * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by + * the `MyCustomComponent` constructor function. + */ + interface Type extends Function { + } + + /** + * `RouteDefinition` defines a route within a {@link RouteConfig} decorator. + * + * Supported keys: + * - `path` or `aux` (requires exactly one of these) + * - `component`, `loader`, `redirectTo` (requires exactly one of these) + * - `name` or `as` (optional) (requires exactly one of these) + * - `data` (optional) + * + * See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}. + */ + interface RouteDefinition { + path?: string; + aux?: string; + component?: Type | ComponentDefinition | string; + loader?: Function; + redirectTo?: any[]; + as?: string; + name?: string; + data?: any; + useAsDefault?: boolean; + } + + /** + * Represents either a component type (`type` is `component`) or a loader function + * (`type` is `loader`). + * + * See also {@link RouteDefinition}. + */ + interface ComponentDefinition { + type: string; + loader?: Function; + component?: Type; + } + + /** + * Component definition object (a simplified directive definition object) + */ interface IComponentOptions { - bindings?: Object, - controller: Function|string, - controllerAs?: string, - isolate?: boolean, - restrict?: string, - template?: Array|Function, - templateUrl?: string, - transclude?: boolean + /** + * Controller constructor function that should be associated with newly created scope or the name of a registered + * controller if passed as a string. Empty function by default. + */ + controller?: string | Function; + /** + * An identifier name for a reference to the controller. If present, the controller will be published to scope under + * the controllerAs name. If not present, this will default to be the same as the component name. + */ + controllerAs?: string; + /** + * html template as a string or a function that returns an html template as a string which should be used as the + * contents of this component. Empty string by default. + * If template is a function, then it is injected with the following locals: + * $element - Current element + * $attrs - Current attributes object for the element + */ + template?: string | Function; + /** + * path or function that returns a path to an html template that should be used as the contents of this component. + * If templateUrl is a function, then it is injected with the following locals: + * $element - Current element + * $attrs - Current attributes object for the element + */ + templateUrl?: string | Function; + /** + * Define DOM attribute binding to component properties. Component properties are always bound to the component + * controller and not to the scope. + */ + bindings?: any; + /** + * Whether transclusion is enabled. Enabled by default. + */ + transclude?: boolean; + /** + * Whether the new scope is isolated. Isolated by default. + */ + isolate?: boolean; + /** + * String of subset of EACM which restricts the component to specific directive declaration style. If omitted, + * this defaults to 'E'. + */ + restrict?: string; + $canActivate?: () => boolean; + $routeConfig?: RouteDefinition[]; } /////////////////////////////////////////////////////////////////////////// From f7e13755835e249251149f8f438a69f9e036f0de Mon Sep 17 00:00:00 2001 From: David Reher Date: Wed, 23 Dec 2015 13:11:57 +0100 Subject: [PATCH 048/441] added controller interfaces and test file --- angularjs/angular-component-router.d.ts | 107 ++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/angularjs/angular-component-router.d.ts b/angularjs/angular-component-router.d.ts index b4ee317ccc..da93596ca0 100644 --- a/angularjs/angular-component-router.d.ts +++ b/angularjs/angular-component-router.d.ts @@ -319,4 +319,111 @@ declare module angular { specificity: number; params: {[key: string]: any}; } + + /** + * Defines route lifecycle method `routerOnActivate`, which is called by the router at the end of a + * successful route navigation. + * + * For a single component's navigation, only one of either {@link OnActivate} or {@link OnReuse} + * will be called depending on the result of {@link CanReuse}. + * + * The `routerOnActivate` hook is called with two {@link ComponentInstruction}s as parameters, the + * first + * representing the current route being navigated to, and the second parameter representing the + * previous route or `null`. + * + * If `routerOnActivate` returns a promise, the route change will wait until the promise settles to + * instantiate and activate child components. + * + * ### Example + * {@example router/ts/on_activate/on_activate_example.ts region='routerOnActivate'} + */ + interface OnActivate { + $routerOnActivate(next?: angular.ComponentInstruction, prev?: angular.ComponentInstruction): any; + } + + /** + * Defines route lifecycle method `routerCanDeactivate`, which is called by the router to determine + * if a component can be removed as part of a navigation. + * + * The `routerCanDeactivate` hook is called with two {@link ComponentInstruction}s as parameters, + * the + * first representing the current route being navigated to, and the second parameter + * representing the previous route. + * + * If `routerCanDeactivate` returns or resolves to `false`, the navigation is cancelled. If it + * returns or + * resolves to `true`, then the navigation continues, and the component will be deactivated + * (the {@link OnDeactivate} hook will be run) and removed. + * + * If `routerCanDeactivate` throws or rejects, the navigation is also cancelled. + * + * ### Example + * {@example router/ts/can_deactivate/can_deactivate_example.ts region='routerCanDeactivate'} + */ + interface CanDeactivate { + $routerCanDeactivate(next?: ComponentInstruction, prev?: ComponentInstruction): boolean | Promise; + } + + /** + * Defines route lifecycle method `routerOnDeactivate`, which is called by the router before + * destroying + * a component as part of a route change. + * + * The `routerOnDeactivate` hook is called with two {@link ComponentInstruction}s as parameters, the + * first + * representing the current route being navigated to, and the second parameter representing the + * previous route. + * + * If `routerOnDeactivate` returns a promise, the route change will wait until the promise settles. + * + * ### Example + * {@example router/ts/on_deactivate/on_deactivate_example.ts region='routerOnDeactivate'} + */ + interface OnDeactivate { + $routerOnDeactivate(next?: angular.ComponentInstruction, prev?: angular.ComponentInstruction): any; + } + + /** + * Defines route lifecycle method `routerCanReuse`, which is called by the router to determine + * whether a + * component should be reused across routes, or whether to destroy and instantiate a new component. + * + * The `routerCanReuse` hook is called with two {@link ComponentInstruction}s as parameters, the + * first + * representing the current route being navigated to, and the second parameter representing the + * previous route. + * + * If `routerCanReuse` returns or resolves to `true`, the component instance will be reused and the + * {@link OnDeactivate} hook will be run. If `routerCanReuse` returns or resolves to `false`, a new + * component will be instantiated, and the existing component will be deactivated and removed as + * part of the navigation. + * + * If `routerCanReuse` throws or rejects, the navigation will be cancelled. + * + * ### Example + * {@example router/ts/reuse/reuse_example.ts region='reuseCmp'} + */ + interface CanReuse { + $routerCanReuse(next?: angular.ComponentInstruction, prev?: angular.ComponentInstruction): boolean | Promise; + } + + /** + * Defines route lifecycle method `routerOnReuse`, which is called by the router at the end of a + * successful route navigation when {@link CanReuse} is implemented and returns or resolves to true. + * + * For a single component's navigation, only one of either {@link OnActivate} or {@link OnReuse} + * will be called, depending on the result of {@link CanReuse}. + * + * The `routerOnReuse` hook is called with two {@link ComponentInstruction}s as parameters, the + * first + * representing the current route being navigated to, and the second parameter representing the + * previous route or `null`. + * + * ### Example + * {@example router/ts/reuse/reuse_example.ts region='reuseCmp'} + */ + interface OnReuse { + $routerOnReuse(next?: angular.ComponentInstruction, prev?: angular.ComponentInstruction): any; + } } From 5922a58bf11b65c5866b8b9ec654d1dbb8903915 Mon Sep 17 00:00:00 2001 From: kwiateusz Date: Wed, 23 Dec 2015 14:28:50 +0100 Subject: [PATCH 049/441] Updated IonicPopoverController interface Added method remove based on documentation --- ionic/ionic.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ionic/ionic.d.ts b/ionic/ionic.d.ts index a3781f26d0..a767b851bf 100644 --- a/ionic/ionic.d.ts +++ b/ionic/ionic.d.ts @@ -238,6 +238,7 @@ declare module ionic { show($event?: any): ng.IPromise; hide(): ng.IPromise; isShown(): boolean; + remove(): ng.IPromise; } interface IonicPopoverOptions { scope?: any; From 7f1a9bdddb8590f535cea050ac44bb21344ceefe Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Wed, 23 Dec 2015 13:36:32 +0000 Subject: [PATCH 050/441] Updated multer typings --- multer/multer-tests.ts | 29 +++++++++++++- multer/multer.d.ts | 85 +++++++++++++++++++++++++----------------- 2 files changed, 77 insertions(+), 37 deletions(-) diff --git a/multer/multer-tests.ts b/multer/multer-tests.ts index 8131293f5d..009ec4fbd0 100644 --- a/multer/multer-tests.ts +++ b/multer/multer-tests.ts @@ -4,5 +4,30 @@ import express = require('express'); import multer = require('multer'); -var app: express.Express = express(); -app.use(multer()); \ No newline at end of file +var upload = multer({ dest: 'uploads/' }); + +var app = express(); + +app.post('/profile', upload.single('avatar'), (req, res, next) => { +}); + +app.post('/photos/upload', upload.array('photos', 12), (req, res, next) => { +}); + +var cpUpload = upload.fields([{ name: 'avatar', maxCount: 1 }, { name: 'gallery', maxCount: 8 }]) +app.post('/cool-profile', cpUpload, (req, res, next) => { +}); + +var diskStorage = multer.diskStorage({ + destination(req, file, cb) { + cb(null, '/tmp/my-uploads'); + }, + filename(req, file, cb) { + cb(null, file.fieldname + '-' + Date.now()); + } +}) + +var diskUpload = multer({ storage: diskStorage }); + +var memoryStorage = multer.memoryStorage(); +var memoryUpload = multer({ storage: memoryStorage }); diff --git a/multer/multer.d.ts b/multer/multer.d.ts index 06a9d4f7af..facd3da535 100644 --- a/multer/multer.d.ts +++ b/multer/multer.d.ts @@ -1,16 +1,16 @@ // Type definitions for multer // Project: https://github.com/expressjs/multer -// Definitions by: jt000 , vilicvane +// Definitions by: jt000 , vilicvane , David Broder-Rodgers // Definitions: https://github.com/borisyankov/DefinitelyTyped /// - declare module Express { export interface Request { + file: Multer.File; files: { [fieldname: string]: Multer.File - } + }; } module Multer { @@ -40,13 +40,19 @@ declare module Express { declare module "multer" { import express = require('express'); - function multer(options?: multer.Options): express.RequestHandler; - module multer { + interface Field { + /** The field name. */ + name: string; + /** Optional maximum number of files per field to accept. */ + maxCount?: number; + } - type Options = { + interface Options { /** The destination directory for the uploaded files. */ dest?: string; + /** The storage engine to use for uploaded files. */ + storage?: StorageEngine; /** An object specifying the size limits of the following optional properties. This object is passed to busboy directly, and the details of properties can be found on https://github.com/mscdex/busboy#busboy-methods */ limits?: { /** Max field name size (Default: 100 bytes) */ @@ -64,36 +70,45 @@ declare module "multer" { /** For multipart forms, the max number of header key=> value pairs to parse Default: 2000(same as node's http). */ headerPairs?: number; }; - /** A Boolean value to specify whether empty submitted values should be processed and applied to req.body; defaults to false; */ - includeEmptyFields?: boolean; - /** If this Boolean value is true, the file.buffer property holds the data in-memory that Multer would have written to disk. The dest option is still populated and the path property contains the proposed path to save the file. Defaults to false. */ - inMemory?: boolean; - /** Function to rename the uploaded files. Whatever the function returns will become the new name of the uploaded file (extension is not included). The fieldname and filename of the file will be available in this function, use them if you need to. */ - rename?: (fieldname: string, filename: string, req: Express.Request, res: Express.Response) => string; - /** Function to rename the directory in which to place uploaded files. The dest parameter is the default value originally assigned or passed into multer. The req and res parameters are also passed into the function because they may contain information (eg session data) needed to create the path (eg get userid from the session). */ - changeDest?: (dest: string, req: Express.Request, res: Express.Response) => string; - /** Event handler triggered when a file starts to be uploaded. A file object, with the following properties, is available to this function: fieldname, originalname, name, encoding, mimetype, path, and extension. */ - onFileUploadStart?: (file: Express.Multer.File, req: Express.Request, res: Express.Response) => void; - /** Event handler triggered when a chunk of buffer is received. A buffer object along with a file object is available to the function. */ - onFileUploadData?: (file: Express.Multer.File, data: Buffer, req: Express.Request, res: Express.Response) => void; - /** Event handler trigger when a file is completely uploaded. A file object is available to the function. */ - onFileUploadComplete?: (file: Express.Multer.File, req: Express.Request, res: Express.Response) => void; - /** Event handler triggered when the form parsing starts. */ - onParseStart?: () => void; - /** Event handler triggered when the form parsing completes. The request object and the next objects are are passed to the function. */ - onParseEnd?: (req: Express.Request, next: () => void) => void; - /** Event handler for any errors encountering while processing the form. The error object and the next object is available to the function. If you are handling errors yourself, make sure to terminate the request or call the next() function, else the request will be left hanging. */ - onError?: () => void; - /** Event handler triggered when a file size exceeds the specification in the limit object. No more files will be parsed after the limit is reached. */ - onFileSizeLimit?: (file: Express.Multer.File) => void; - /** Event handler triggered when the number of files exceed the specification in the limit object. No more files will be parsed after the limit is reached. */ - onFilesLimit?: () => void; - /** Event handler triggered when the number of fields exceed the specification in the limit object. No more fields will be parsed after the limit is reached. */ - onFieldsLimit?: () => void; - /** Event handler triggered when the number of parts exceed the specification in the limit object. No more files or fields will be parsed after the limit is reached. */ - onPartsLimit?: () => void; - }; + /** A function to control which files to upload and which to skip. */ + fileFilter?: (req: Express.Request, file: Express.Multer.File, callback: (error: Error, acceptFile: boolean) => void) => void; + } + + interface StorageEngine { + _handleFile(req: express.Request, file: Express.Multer.File, callback: (error?: any, info?: Express.Multer.File) => void): void; + _removeFile(req: express.Request, file: Express.Multer.File, callback: (error: Error) => void): void; + } + + interface DiskStorageOptions { + /** A function used to determine within which folder the uploaded files should be stored. Defaults to the system's default temporary directory. */ + destination?: (req: Express.Request, file: Express.Multer.File, callback: (error: Error, destination: string) => void) => void; + /** A function used to determine what the file should be named inside the folder. Defaults to a random name with no file extension. */ + filename?: (req: Express.Request, file: Express.Multer.File, callback: (error: Error, filename: string) => void) => void; + } + + interface Instance { + /** Accept a single file with the name fieldname. The single file will be stored in req.file. */ + single(fieldame: string): express.RequestHandler; + /** Accept an array of files, all with the name fieldname. Optionally error out if more than maxCount files are uploaded. The array of files will be stored in req.files. */ + array(fieldame: string, maxCount?: number): express.RequestHandler; + /** Accept a mix of files, specified by fields. An object with arrays of files will be stored in req.files. */ + fields(fields: Field[]): express.RequestHandler; + /** Accepts all files that comes over the wire. An array of files will be stored in req.files. */ + any(): express.RequestHandler; + } } + interface Multer { + + (options?: multer.Options): multer.Instance; + + /* The disk storage engine gives you full control on storing files to disk. */ + diskStorage(options: multer.DiskStorageOptions): multer.StorageEngine; + /* The memory storage engine stores the files in memory as Buffer objects. */ + memoryStorage(): multer.StorageEngine; + } + + var multer: Multer; + export = multer; } From d61a1c6578c9f0d2612a6a860ebe5f47fc716cc7 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Wed, 23 Dec 2015 13:55:07 +0000 Subject: [PATCH 051/441] Updated comments --- bcrypt-nodejs/bcrypt-nodejs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bcrypt-nodejs/bcrypt-nodejs.d.ts b/bcrypt-nodejs/bcrypt-nodejs.d.ts index e0a46ffa52..32b735d68f 100644 --- a/bcrypt-nodejs/bcrypt-nodejs.d.ts +++ b/bcrypt-nodejs/bcrypt-nodejs.d.ts @@ -1,7 +1,7 @@ // Type definitions for bcrypt-nodejs // Project: https://github.com/shaneGirish/bcrypt-nodejs // Definitions by: David Broder-Rodgers -// Definitions: https://github.com/DavidBR-SW/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare module "bcrypt-nodejs" { /** From 969afec63e373e71323e217b4badb0ed9b6df5af Mon Sep 17 00:00:00 2001 From: kwiateusz Date: Wed, 23 Dec 2015 15:00:35 +0100 Subject: [PATCH 052/441] Added test for remove method --- ionic/ionic-tests.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ionic/ionic-tests.ts b/ionic/ionic-tests.ts index bad5f9d9f1..8491fc13f8 100644 --- a/ionic/ionic-tests.ts +++ b/ionic/ionic-tests.ts @@ -200,8 +200,9 @@ class IonicTestController { }; var ionicPopoverController: ionic.popover.IonicPopoverController = this.$ionicPopover.fromTemplate("template", popoverOptions); ionicPopoverController.initialize(popoverOptions); - ionicPopoverController.show(angular.element("body")).then(() => console.log("shown popover")) - ionicPopoverController.hide().then(() => console.log("hid popover")) + ionicPopoverController.show(angular.element("body")).then(() => console.log("shown popover")); + ionicPopoverController.hide().then(() => console.log("hid popover")); + ionicPopoverController.remove().then(() => console.log("removed popover")); var isShown: boolean = ionicPopoverController.isShown(); this.$ionicPopover.fromTemplateUrl("templateUrl", popoverOptions) From 0254e0068e77f18da583d8144c8747282a344878 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Wed, 23 Dec 2015 16:18:23 +0200 Subject: [PATCH 053/441] Improved visionmedia/debug to include non-amd version Improved visionmedia/debug, a tiny npm package for debugging. Added both AMD and non-AMD definition support --- debug/debug.d.ts | 53 ++++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/debug/debug.d.ts b/debug/debug.d.ts index 1a71725a86..aca5bc0464 100644 --- a/debug/debug.d.ts +++ b/debug/debug.d.ts @@ -1,30 +1,39 @@ // Type definitions for debug // Project: https://github.com/visionmedia/debug // Definitions by: Seon-Wook Park +// Definitions by: Gal Talmor // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module "debug" { - - function d(namespace: string): d.Debugger; - - module d { - export var log: Function; - - function enable(namespaces: string): void; - function disable(): void; - - function enabled(namespace: string): boolean; - - export interface Debugger { - (formatter: any, ...args: any[]): void; - - enabled: boolean; - log: Function; - namespace: string; - } - } - - export = d; +declare var debug:debug.IDebug; +// Support AMD require +declare module 'debug' { + export = debug; } +declare module debug { + export interface IDebug { + (namespace: string):debug.IDebugger, + coerce:(val:any)=>any, + disable:()=>void, + enable:(namespaces:string)=>void, + enabled:(namespaces:string)=>boolean, + + names:string[], + skips:string[], + + formatters:IFormatters + } + + export interface IFormatters { + [formatter:string]: Function + } + + export interface IDebugger { + (formatter: any, ...args: any[]): void; + + enabled:boolean; + log:Function; + namespace:string; + } +} From 962e0432f162ac1f461799d3d4d9ce9175479c00 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Wed, 23 Dec 2015 16:18:50 +0200 Subject: [PATCH 054/441] Improved visionmedia/debug to include non-amd version Improved visionmedia/debug, a tiny npm package for debugging. Added both AMD and non-AMD definition support --- debug/debug-tests.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/debug/debug-tests.ts b/debug/debug-tests.ts index 63a0a3ac4e..a264003409 100644 --- a/debug/debug-tests.ts +++ b/debug/debug-tests.ts @@ -1,4 +1,3 @@ -/// /// import debug = require("debug"); @@ -6,7 +5,7 @@ import debug = require("debug"); debug.disable(); debug.enable("DefinitelyTyped:*"); -var log: debug.Debugger = debug("DefinitelyTyped:log"); +var log:debug.IDebugger = debug("DefinitelyTyped:log"); log("Just text"); log("Formatted test (%d arg)", 1); @@ -15,6 +14,6 @@ log("Formatted %s (%d args)", "test", 2); log("Enabled?: %s", debug.enabled("DefinitelyTyped:log")); log("Namespace: %s", log.namespace); -var error: debug.Debugger = debug("DefinitelyTyped:error"); +var error:debug.IDebugger = debug("DefinitelyTyped:error"); error.log = console.error.bind(console); error("This should be printed to stderr"); From 6df499b659e05b286273b0518fa70e4e63f5a3a2 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Wed, 23 Dec 2015 16:25:21 +0200 Subject: [PATCH 055/441] Improved visionmedia/debug to include non-amd version Improved visionmedia/debug, a tiny npm package for debugging. Added both AMD and non-AMD definition support --- debug/debug.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/debug/debug.d.ts b/debug/debug.d.ts index aca5bc0464..ef750802fd 100644 --- a/debug/debug.d.ts +++ b/debug/debug.d.ts @@ -1,7 +1,6 @@ // Type definitions for debug // Project: https://github.com/visionmedia/debug -// Definitions by: Seon-Wook Park -// Definitions by: Gal Talmor +// Definitions by: Seon-Wook Park , Gal Talmor // Definitions: https://github.com/borisyankov/DefinitelyTyped declare var debug:debug.IDebug; From 5ccca9a4efc3d08724ff14ea3a263c7417db0b3d Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Wed, 23 Dec 2015 16:51:51 +0200 Subject: [PATCH 056/441] Update debug.d.ts --- debug/debug.d.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/debug/debug.d.ts b/debug/debug.d.ts index ef750802fd..b43cd238c3 100644 --- a/debug/debug.d.ts +++ b/debug/debug.d.ts @@ -3,7 +3,7 @@ // Definitions by: Seon-Wook Park , Gal Talmor // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare var debug:debug.IDebug; +declare var debug: debug.IDebug; // Support AMD require declare module 'debug' { @@ -12,27 +12,27 @@ declare module 'debug' { declare module debug { export interface IDebug { - (namespace: string):debug.IDebugger, - coerce:(val:any)=>any, - disable:()=>void, - enable:(namespaces:string)=>void, - enabled:(namespaces:string)=>boolean, + (namespace: string): debug.IDebugger, + coerce: (val: any) => any, + disable: () => void, + enable: (namespaces: string) => void, + enabled: (namespaces: string) => boolean, - names:string[], - skips:string[], + names: string[], + skips: string[], - formatters:IFormatters + formatters: IFormatters } export interface IFormatters { - [formatter:string]: Function + [formatter: string]: Function } export interface IDebugger { (formatter: any, ...args: any[]): void; - enabled:boolean; - log:Function; - namespace:string; + enabled: boolean; + log: Function; + namespace: string; } } From 42ab06c354ccbadeafa60df1efc76b81a22809b1 Mon Sep 17 00:00:00 2001 From: Stephen Lautier Date: Wed, 23 Dec 2015 20:04:18 +0100 Subject: [PATCH 057/441] angular-dynamic-locale: added support for es6 imports --- angular-dynamic-locale/angular-dynamic-locale.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/angular-dynamic-locale/angular-dynamic-locale.d.ts b/angular-dynamic-locale/angular-dynamic-locale.d.ts index a30df1d7ed..e404e95328 100644 --- a/angular-dynamic-locale/angular-dynamic-locale.d.ts +++ b/angular-dynamic-locale/angular-dynamic-locale.d.ts @@ -5,6 +5,11 @@ /// +declare module "angular-dynamic-locale" { + import ng = angular.dynamicLocale; + export = ng; +} + declare module angular.dynamicLocale { interface tmhDynamicLocaleService { From 5c8b9ef68be91a355ec80f831f1b1ab22ce49a4a Mon Sep 17 00:00:00 2001 From: King David Consulting LLC Date: Wed, 23 Dec 2015 15:59:49 -0500 Subject: [PATCH 058/441] Update StatusBar.d.ts Allows to build successfully the IONIC Cordova projects with TypeScript --- cordova/plugins/StatusBar.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cordova/plugins/StatusBar.d.ts b/cordova/plugins/StatusBar.d.ts index 8b52996267..599408e7b0 100644 --- a/cordova/plugins/StatusBar.d.ts +++ b/cordova/plugins/StatusBar.d.ts @@ -73,3 +73,5 @@ interface StatusBar { */ isVisible: boolean; } + +declare var StatusBar: StatusBar; From 4426294361ad14ce1117531691b9ca52f150bbbe Mon Sep 17 00:00:00 2001 From: flyfishMT Date: Wed, 23 Dec 2015 14:18:24 -0700 Subject: [PATCH 059/441] Adding method acceptChanges to class EntityManager --- breeze/breeze.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/breeze/breeze.d.ts b/breeze/breeze.d.ts index 2a60df6d84..f13e1b55fd 100644 --- a/breeze/breeze.d.ts +++ b/breeze/breeze.d.ts @@ -392,6 +392,7 @@ declare module breeze { constructor(config?: EntityManagerOptions); constructor(config?: string); + acceptChanges(); addEntity(entity: Entity): Entity; attachEntity(entity: Entity, entityState?: EntityStateSymbol, mergeStrategy?: MergeStrategySymbol): Entity; clear(): void; From 3209e89f21bd9fef15bd274885c8f7c186c31807 Mon Sep 17 00:00:00 2001 From: flyfishMT Date: Wed, 23 Dec 2015 14:24:08 -0700 Subject: [PATCH 060/441] Adding void return type annotation to method acceptChanges in class EntityManager --- breeze/breeze.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/breeze/breeze.d.ts b/breeze/breeze.d.ts index f13e1b55fd..1cc587c2f2 100644 --- a/breeze/breeze.d.ts +++ b/breeze/breeze.d.ts @@ -392,7 +392,7 @@ declare module breeze { constructor(config?: EntityManagerOptions); constructor(config?: string); - acceptChanges(); + acceptChanges(): void; addEntity(entity: Entity): Entity; attachEntity(entity: Entity, entityState?: EntityStateSymbol, mergeStrategy?: MergeStrategySymbol): Entity; clear(): void; From 95ef7354addd43c725077a739a2ae0c8a8dae4b0 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 24 Dec 2015 09:24:02 +0500 Subject: [PATCH 061/441] lodash: signatures of _.isString have been changed --- lodash/lodash-tests.ts | 39 ++++++++++++++++++++++++++++----------- lodash/lodash.d.ts | 10 +++++++++- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 3f7a26556d..b9a1a35712 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6111,17 +6111,34 @@ module TestIsRegExp { } // _.isString -result = _.isString(any); -result = _(1).isString(); -result = _([]).isString(); -result = _({}).isString(); -{ - let value: string|number = "foo"; - if (_.isString(value)) { - let result: string = value; - } else { - let result: number = value * 42; - } +module TestIsString { + { + let value: number|string; + + if (_.isString(value)) { + let result: string = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isString(any); + result = _(1).isString(); + result = _([]).isString(); + result = _({}).isString(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isString(); + result = _([]).chain().isString(); + result = _({}).chain().isString(); + } } // _.isTypedArray diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 584500c101..21afab387e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10165,9 +10165,10 @@ declare module _ { interface LoDashStatic { /** * Checks if value is classified as a String primitive or object. + * * @param value The value to check. * @return Returns true if value is correctly classified, else false. - **/ + */ isString(value?: any): value is string; } @@ -10178,6 +10179,13 @@ declare module _ { isString(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isString + */ + isString(): LoDashExplicitWrapper; + } + //_.isTypedArray interface LoDashStatic { /** From ffd860e3c0a35633d888cf770c5c81b59fe5fe76 Mon Sep 17 00:00:00 2001 From: Kaoru Hagihara Date: Thu, 24 Dec 2015 15:46:06 +0900 Subject: [PATCH 062/441] create vue-router.d.ts --- vue-router/vue-router-test.ts | 113 ++++++++++++++++++++++++++++++++++ vue-router/vue-router.d.ts | 87 ++++++++++++++++++++++++++ 2 files changed, 200 insertions(+) create mode 100644 vue-router/vue-router-test.ts create mode 100644 vue-router/vue-router.d.ts diff --git a/vue-router/vue-router-test.ts b/vue-router/vue-router-test.ts new file mode 100644 index 0000000000..4456b0a476 --- /dev/null +++ b/vue-router/vue-router-test.ts @@ -0,0 +1,113 @@ +/// + +Vue.use(VueRouter); + +namespace TestBasic { + "use strict"; + + var Foo = Vue.extend({ + template: "

This is foo!

", + route: { + canActivate(transition: vuerouter.Transition) { + return true; + } + } + }); + + var Bar = Vue.extend({ + template: "

This is bar!

" + }); + + var App = Vue.extend({}); + + var router = new VueRouter(); + + router.map({ + "/foo": { + component: Foo + }, + "/bar": { + component: Bar + } + }); + + router.start(App, "#app"); +} + +namespace TestAdvanced { + "use strict"; + + namespace App { + + export class App { + authenticating: boolean; + + data() { + return { + authenticating: false + }; + } + } + } + + namespace Inbox { + export class Index { + static route: vuerouter.TransitionHook = { + canActivate: function(transition) { + var n: number = transition.to.params.id; + transition.next(); + }, + activate: function() { + return new Promise((resolve) => { + resolve(); + }); + }, + deactivate: function({next}) { + next(); + } + }; + } + } + + namespace RouteConfig { + export function configRouter(router: vuerouter.Router) { + router.map({ + "/about": { + component: {}, + auth: false + }, + "*": { + component: {} + } + }); + + router.redirect({ + "/info": "/about", + "/hello/:userId": "/user/:userId" + }); + + router.beforeEach((transition) => { + if (transition.to.path === "/forbidden") { + router.app.authenticating = true; + setTimeout(() => { + router.app.authenticating = false; + alert(""); + transition.abort(); + }, 3000); + } else { + transition.next(); + } + }); + } + } + + import configRouter = RouteConfig.configRouter; + + const router = new VueRouter({ + history: true, + saveScrollPosition: true + }); + + configRouter(router); + router.start(App, "#app"); +} diff --git a/vue-router/vue-router.d.ts b/vue-router/vue-router.d.ts new file mode 100644 index 0000000000..729e8f6efd --- /dev/null +++ b/vue-router/vue-router.d.ts @@ -0,0 +1,87 @@ +// Type definitions for vue-router 0.7.7 +// Project: https://github.com/vuejs/vue-router +// Definitions by: kaorun343 +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare namespace vuerouter { + + interface Transition { + from: $route; + to: $route; + next(data?: any): void; + abort(reason?: any): void; + redirect(path: string): void; + } + + interface RouterOption { + hashbang?: boolean; + history?: boolean; + abstract?: boolean; + root?: string; + linkActiveClass?: string; + saveScrollPosition?: boolean; + transitionOnLoad?: boolean; + suppressTransitionError?: boolean; + } + + interface RouterStatic { + new (option?: RouterOption): Router; + } + + interface RouteMapObject { + component: any; + subRoutes?: { [key: string]: RouteMapObject }; + [key: string]: any; + } + + interface Router { + + app: RootVueApp; + mode: string; + + start(App: any, el: string | Element): void; + stop(): void; + map(routeMap: { [path: string]: RouteMapObject }): void; + on(path: string, config: Object): void; + go(path: string | Object): void; + replace(path: string): void; + redirect(redirectMap: Object): void; + alias(aliasMap: Object): void; + beforeEach(hook: (transition: Transition) => any): void; + afterEach(hook: (transition: Transition) => any): void; + } + + interface $route { + path: string; + params: Params; + query: Query; + router: Router; + matched: string[]; + name: string; + [key: string]: any; + } + + interface TransitionHook { + data?(transition?: Transition): Thenable | void; + activate?(transition?: Transition): Thenable | void; + deactivate?(transition?: Transition): Thenable | void; + canActivate?(transition?: Transition): Thenable | boolean | void; + canDeactivate?(transition?: Transition): Thenable | boolean | void; + canReuse?: boolean | ((transition: Transition) => boolean); + } +} + +declare namespace vuejs { + interface ComponentOption { + route?: vuerouter.TransitionHook; + } +} + +declare var VueRouter: vuerouter.RouterStatic; + +declare module "vue-router" { + export = VueRouter; +} From 5b9d1a8c6a805bac49ceac5ceb33b6921fa4ada4 Mon Sep 17 00:00:00 2001 From: Pierre Anctil Date: Thu, 24 Dec 2015 08:44:46 +0100 Subject: [PATCH 063/441] Add typing for execute methods --- mssql/mssql-tests.ts | 18 ++++++++++++++++++ mssql/mssql.d.ts | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/mssql/mssql-tests.ts b/mssql/mssql-tests.ts index eda326c4a5..f1f1a20b2c 100644 --- a/mssql/mssql-tests.ts +++ b/mssql/mssql-tests.ts @@ -66,6 +66,15 @@ var connection: sql.Connection = new sql.Connection(config, function (err: any) } }); + requestStoredProcedure.execute('StoredProcedureName', function (err, recordsets, returnValue) { + if (err != null) { + console.error('Error happened calling Query: ' + err.name + " " + err.message); + } + else { + console.info(returnValue); + } + }); + var requestStoredProcedureWithOutput = new sql.Request(connection); var testId: number = 0; var testString: string = 'test'; @@ -90,6 +99,15 @@ var connection: sql.Connection = new sql.Connection(config, function (err: any) console.info(requestStoredProcedureWithOutput.parameters['output'].value); } }); + + requestStoredProcedure.execute('StoredProcedureName', function (err, recordsets, returnValue) { + if (err != null) { + console.error('Error happened calling Query: ' + err.name + " " + err.message); + } + else { + console.info(requestStoredProcedureWithOutput.parameters['output'].value); + } + }); } }); diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index 1e203582b2..2b3db48075 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -200,7 +200,7 @@ declare module "mssql" { public constructor(transaction: Transaction); public constructor(preparedStatement: PreparedStatement); public execute(procedure: string): Promise; - public execute(procedure: string, callback: (err?: any, recordsets?: any, returnValue?: any) => void): void; + public execute(procedure: string, callback: (err?: any, recordsets?: Entity[], returnValue?: any) => void): void; public input(name: string, value: any): void; public input(name: string, type: any, value: any): void; public output(name: string, type: any, value?: any): void; @@ -258,7 +258,9 @@ declare module "mssql" { public prepare(statement?: string): Promise; public prepare(statement?: string, callback?: (err?: any) => void): void; public execute(values: Object): Promise; + public execute(values: Object): Promise; public execute(values: Object, callback: (err: any, recordSet: recordSet) => void): void; + public execute(values: Object, callback: (err: any, recordSet: Entity[]) => void): void; public unprepare(): Promise; public unprepare(callback: (err?: any) => void): void; } From fd5229673a59cef244cf4e4ebe7f93d836b64c75 Mon Sep 17 00:00:00 2001 From: Anton Ulyanov Date: Thu, 24 Dec 2015 10:12:30 +0200 Subject: [PATCH 064/441] Added min-height css property to react definitions --- react/react.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/react/react.d.ts b/react/react.d.ts index bd35811119..718daeedda 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -1145,6 +1145,11 @@ declare namespace __React { */ maxWidth?: any; + /** + * Sets the minimum height for an element. It prevents the height of the element to be smaller than the specified value. The value of min-height overrides both max-height and height. + */ + minHeight?: any; + /** * Sets the minimum width of an element. It limits the width property to be not smaller than the value specified in min-width. */ From 9c5ece3a674d1d84b6753c3053e6bfb236cb31b6 Mon Sep 17 00:00:00 2001 From: Denys Krasnoshchok Date: Thu, 24 Dec 2015 10:43:52 +0100 Subject: [PATCH 065/441] Added missing methods to definition file --- dhtmlxscheduler/dhtmlxscheduler.d.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dhtmlxscheduler/dhtmlxscheduler.d.ts b/dhtmlxscheduler/dhtmlxscheduler.d.ts index c79ce78c9a..78537e3935 100644 --- a/dhtmlxscheduler/dhtmlxscheduler.d.ts +++ b/dhtmlxscheduler/dhtmlxscheduler.d.ts @@ -1165,11 +1165,22 @@ interface SchedulerStatic{ */ deleteEvent(id: any); + /** + * removes all blocking sets from the scheduler + */ + deleteMarkedTimespan(); + /** * removes marking/blocking set by the addMarkedTimespan() and blockTime() methods * @param id the timespan id */ deleteMarkedTimespan(id: string); + + /** + * removes marking/blocking set by the addMarkedTimespan() and blockTime() methods + * @param configuration for deleting + */ + deleteMarkedTimespan(config: any); /** * deletes a section from the currently active view (if the opened view isn't Timeline in the 'Tree' mode - the method will be ignored) @@ -1212,6 +1223,13 @@ interface SchedulerStatic{ * expands the scheduler to the full screen view */ expand(); + + /** + * filter events that will be displayed on the week view + * @param id event-id + * @param event event-object + */ + filter_week(id: any, event: any); /** * gives access to the objects of lightbox's sections From 5ae9f05103734c4bdf26bb36df3f4740f0382dec Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Thu, 24 Dec 2015 14:42:51 +0000 Subject: [PATCH 066/441] Type definitions for s3rver --- s3rver/s3rver-tests.ts | 14 ++++++++++++++ s3rver/s3rver.d.ts | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 s3rver/s3rver-tests.ts create mode 100644 s3rver/s3rver.d.ts diff --git a/s3rver/s3rver-tests.ts b/s3rver/s3rver-tests.ts new file mode 100644 index 0000000000..afa7e92273 --- /dev/null +++ b/s3rver/s3rver-tests.ts @@ -0,0 +1,14 @@ +/// + +import S3rver = require('s3rver'); + +var s3rver = new S3rver({ + port: 5694, + hostname: 'localhost', + silent: true, + indexDocument: 'index.html', + errorDocument: '', + directory: '/tmp/s3rver_test_directory' +}).run((err, hostname, port, directory) => {}); + +s3rver.close(); diff --git a/s3rver/s3rver.d.ts b/s3rver/s3rver.d.ts new file mode 100644 index 0000000000..e34650986e --- /dev/null +++ b/s3rver/s3rver.d.ts @@ -0,0 +1,32 @@ +// Type definitions for S3rver +// Project: https://github.com/jamhall/s3rver +// Definitions by: David Broder-Rodgers +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "s3rver" { + import * as http from "http"; + + class S3rver { + constructor(options: S3rverOptions) + setPort(port: number): S3rver; + setHostname(hostname: string): S3rver; + setDirectory(directory: string): S3rver; + setSilent(silent: boolean): S3rver; + setIndexDocument(indexDocument: string): S3rver; + setErrorDocument(errorDocument: string): S3rver; + run(callback: (error: Error, hostname: string, port: number, directory: string) => void): http.Server; + } + + interface S3rverOptions { + port?: number; + hostname?: string; + silent?: boolean; + indexDocument?: string; + errorDocument?: string; + directory: string; + } + + export = S3rver; +} From c56316d7ebe0f8613588ddd513eaa1f76389cd1a Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Thu, 24 Dec 2015 20:40:15 +0100 Subject: [PATCH 067/441] Add tracking.js --- tracking/tracking-tests.ts | 55 ++++++++++++++++++++++++++++++++++++++ tracking/tracking.d.ts | 40 +++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 tracking/tracking-tests.ts create mode 100644 tracking/tracking.d.ts diff --git a/tracking/tracking-tests.ts b/tracking/tracking-tests.ts new file mode 100644 index 0000000000..e1fdd85607 --- /dev/null +++ b/tracking/tracking-tests.ts @@ -0,0 +1,55 @@ +/// + +// All tracking tests below are code taken verbatim (or, as close as possible) from the tracking docs: https://trackingjs.com/docs.html + +var colors = new tracking.ColorTracker(['magenta', 'cyan', 'yellow']); + +colors.on('track', function(event) { + if (event.data.length === 0) { + // No colors were detected in this frame. + } else { + event.data.forEach(function(rect) { + console.log(rect.x, rect.y, rect.height, rect.width, rect.color); + }); + } +}); + +tracking.track('#myVideo', colors); + +var myTracker = new tracking.Tracker('target'); + +myTracker.on('track', function(event) { + if (event.data.length === 0) { + // No targets were detected in this frame. + } else { + event.data.forEach(function(data) { + // Plots the detected targets here. + }); + } +}); + +var trackerTask = tracking.track('#myVideo', myTracker); + +trackerTask.stop(); // Stops the tracking +trackerTask.run(); // Runs it again anytime + +tracking.ColorTracker.registerColor('green', function(r, g, b) { + if (r < 50 && g > 200 && b < 50) { + return true; + } + return false; +}); + +var objects = new tracking.ObjectTracker(['face', 'eye', 'mouth']); + +objects.on('track', function(event) { + if (event.data.length === 0) { + // No objects were detected in this frame. + } else { + event.data.forEach(function(rect) { + // rect.x, rect.y, rect.height, rect.width + }); + } +}); + +tracking.track('#myVideo', objects); diff --git a/tracking/tracking.d.ts b/tracking/tracking.d.ts new file mode 100644 index 0000000000..cf8b228e3c --- /dev/null +++ b/tracking/tracking.d.ts @@ -0,0 +1,40 @@ +// Type definitions for Tracking.js v1.1.2 +// Project: https://github.com/eduardolundgren/tracking.js +// Definitions by: Tim Perry +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module tracking { + export class ColorTracker extends Tracker { + constructor(colours: string[]); + + static registerColor(name: string, predicate: (r: number, g: number, b: number) => boolean): void; + } + + export class ObjectTracker extends Tracker { + constructor(objects: string[]); + } + + class Tracker { + constructor(target: string); + on(eventName: string, callback: (event: TrackEvent) => void): void; + } + + interface TrackEvent { + data: TrackRect[]; + } + + interface TrackRect { + x: number; + y: number; + height: number; + width: number; + color: string; + } + + interface TrackerTask { + stop(): void; + run(): void; + } + + export function track(selector: string, tracker: tracking.Tracker): TrackerTask; +} From 58dceb923ba0a5f245a410491873dd018671ba66 Mon Sep 17 00:00:00 2001 From: Craig Leinoff Date: Thu, 24 Dec 2015 16:33:00 -0500 Subject: [PATCH 068/441] Removing quotes from easystarjs type definition classname. --- easystarjs/easystarjs.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easystarjs/easystarjs.d.ts b/easystarjs/easystarjs.d.ts index 7640b1a8b8..6755543e3f 100755 --- a/easystarjs/easystarjs.d.ts +++ b/easystarjs/easystarjs.d.ts @@ -6,7 +6,7 @@ easystarjs.d.ts may be freely distributed under the MIT license. */ -declare module "easystarjs" +declare module easystarjs { class js { @@ -31,4 +31,4 @@ declare module "easystarjs" } } - \ No newline at end of file + From 855ea19829fca67e72017726b1919e0cb3820977 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Fri, 25 Dec 2015 00:46:29 +0100 Subject: [PATCH 069/441] Add docs to core Hopscotch API methods --- hopscotch/hopscotch.d.ts | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/hopscotch/hopscotch.d.ts b/hopscotch/hopscotch.d.ts index 1baac775b5..46fdf17c6d 100644 --- a/hopscotch/hopscotch.d.ts +++ b/hopscotch/hopscotch.d.ts @@ -77,23 +77,84 @@ interface StepDefinition { } interface HopscotchStatic { + /** + * Actually starts the tour. Optional stepNum argument specifies what step to start at. + */ startTour(tour: TourDefinition, stepNum?: number): void; + + /** + * Skips to a given step in the tour + */ showStep(id: number): void; + + /** + * Goes back one step in the tour + */ prevStep(): void; + + /** + * Goes forward one step in the tour + */ nextStep(): void; + + /** + * Ends the current tour. If clearCookie is set to false, the tour state is preserved. + * Otherwise, if clearCookie is set to true or is not provided, the tour state is cleared. + */ endTour(clearCookie: boolean): void; + + /** + * Sets options for running the tour. + */ configure(options: HopscotchConfiguration): void; + + /** + * Returns the currently running tour. + */ getCurrTour(): TourDefinition; + + /** + * Returns the currently running tour. + */ getCurrStepNum(): number; + + /** + * Checks for tour state saved in sessionStorage/cookies and returns the state if + * it exists. Use this method to determine whether or not you should resume a tour. + */ getState(): string; + /** + * Adds a callback for one of the event types. Valid event types are: + * *start*, *end*, *next*, *prev*, *show*, *close*, *error* + */ listen(eventName: string, callback: () => void): void; + + /** + * Removes a callback for one of the event types. + */ unlisten(eventName: string, callback: () => void): void; + + /** + * Remove callbacks for hopscotch events. If tourOnly is set to true, only removes + * callbacks specified by a tour (callbacks set by hopscotch.configure or hopscotch.listen + * will remain). If eventName is null or undefined, callbacks for all events will be removed. + */ removeCallbacks(eventName?: string, tourOnly?: boolean): void; + /** + * Registers a callback helper. See the section about Helpers below. + */ registerHelper(id: string, helper: (...args: any[]) => void): void; + /** + * Resets i18n strings to original default values. + */ resetDefaultI18N(): void; + + /** + * Resets all config options to original values. + */ resetDefaultOptions(): void; } From 3419482ba9e00de124fb11157a4e9ad33a2898e9 Mon Sep 17 00:00:00 2001 From: Matt Wheatley Date: Fri, 25 Dec 2015 00:32:33 +0000 Subject: [PATCH 070/441] Added jquery.raty definition --- jquery.raty/jquery.raty.d.ts | 60 ++++++++++++++++++++++++++++++++ jquery.raty/jquery.raty.tests.ts | 54 ++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 jquery.raty/jquery.raty.d.ts create mode 100644 jquery.raty/jquery.raty.tests.ts diff --git a/jquery.raty/jquery.raty.d.ts b/jquery.raty/jquery.raty.d.ts new file mode 100644 index 0000000000..0f1bba2630 --- /dev/null +++ b/jquery.raty/jquery.raty.d.ts @@ -0,0 +1,60 @@ +// Type definitions for jQuery.raty 2.7.0 +// Definitions by: Matt Wheatley +/// + +interface JQuery { + raty(): JQuery; + raty(options: JQueryRatyOptions): JQuery; + raty(method: string, parameter: any): any; + raty(method: 'score', score: number): number; + raty(method: 'click', star: number): void; + raty(method: 'readonly', on: boolean): void; + raty(method: 'cancel', on: boolean): void; + raty(method: 'reload'): void; + raty(method: 'set', options: JQueryRatyOptions); + raty(method: 'destroy'): JQuery; + raty(method: 'move', number: number): void; +} + +interface JQueryRatyOptions { + cancel?: boolean, + cancelClass?: string, + cancelHint?: string, + cancelOff?: string, + cancelOn?: string, + cancelPlace?: string, + click?: (score: number, event: JQueryEventObject) => void, + half?: boolean, + halfShow?: boolean, + hints?: string[], + iconRange?: any[][], + mouseout?: (score: number, event: JQueryEventObject) => void, + mouseover?: (score: number, event: JQueryEventObject) => void, + noRatedMsg?: string, + number?: number, + numberMax?: number, + path?: string, + precision?: boolean, + readOnly?: boolean, + round?: JQueryRatyRoundingOptions, + score?: number, + scoreName?: string, + single?: boolean, + space?: boolean, + starHalf?: string, + starOff?: string, + starOn?: string, + target?: string, + targetFormat?: string, + targetKeep?: boolean, + targetScore?: string, + targetText?: string, + targetType?: string, + starType?: string, +} + +interface JQueryRatyRoundingOptions { + down: number, + full: number, + up: number, +} diff --git a/jquery.raty/jquery.raty.tests.ts b/jquery.raty/jquery.raty.tests.ts new file mode 100644 index 0000000000..e324e1ce34 --- /dev/null +++ b/jquery.raty/jquery.raty.tests.ts @@ -0,0 +1,54 @@ +/// +/// + + +var $element: JQuery = $('
'); + +$element.raty(); + +$element.raty({ + cancel: false, + cancelClass: 'raty-cancel', + cancelHint: 'Cancel this rating!', + cancelOff: 'cancel-off.png', + cancelOn: 'cancel-on.png', + cancelPlace: 'left', + click: undefined, + half: false, + halfShow: true, + hints: ['bad', 'poor', 'regular', 'good', 'gorgeous'], + iconRange: undefined, + mouseout: undefined, + mouseover: undefined, + noRatedMsg: 'Not rated yet!', + number: 5, + numberMax: 20, + path: undefined, + precision: false, + readOnly: false, + round: { down: .25, full: .6, up: .76 }, + score: undefined, + scoreName: 'score', + single: false, + space: true, + starHalf: 'star-half.png', + starOff: 'star-off.png', + starOn: 'star-on.png', + target: undefined, + targetFormat: '{score}', + targetKeep: false, + targetScore: undefined, + targetText: '', + targetType: 'hint', + starType: 'img', +}); + +$element.raty('score'); +$element.raty('score', 4); +$element.raty('click', 2); +$element.raty('readOnly', true); +$element.raty('cancel', true); +$element.raty('reload'); +$element.raty('set', { space: false }); +$element.raty('destroy'); +$element.raty('move', 3); From 516e0a1fc0c144af81899d1179725b849c8c415f Mon Sep 17 00:00:00 2001 From: Matt Wheatley Date: Fri, 25 Dec 2015 00:35:57 +0000 Subject: [PATCH 071/441] Added get score --- jquery.raty/jquery.raty.d.ts | 3 ++- jquery.raty/jquery.raty.tests.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/jquery.raty/jquery.raty.d.ts b/jquery.raty/jquery.raty.d.ts index 0f1bba2630..35e0f80ad7 100644 --- a/jquery.raty/jquery.raty.d.ts +++ b/jquery.raty/jquery.raty.d.ts @@ -6,7 +6,8 @@ interface JQuery { raty(): JQuery; raty(options: JQueryRatyOptions): JQuery; raty(method: string, parameter: any): any; - raty(method: 'score', score: number): number; + raty(method: 'score'): number; + raty(method: 'score', score: number): void; raty(method: 'click', star: number): void; raty(method: 'readonly', on: boolean): void; raty(method: 'cancel', on: boolean): void; diff --git a/jquery.raty/jquery.raty.tests.ts b/jquery.raty/jquery.raty.tests.ts index e324e1ce34..65a298bc32 100644 --- a/jquery.raty/jquery.raty.tests.ts +++ b/jquery.raty/jquery.raty.tests.ts @@ -43,7 +43,7 @@ $element.raty({ starType: 'img', }); -$element.raty('score'); +var score: number = $element.raty('score'); $element.raty('score', 4); $element.raty('click', 2); $element.raty('readOnly', true); From 1fcb19166ec6307152ace14a69f87d2e011333c0 Mon Sep 17 00:00:00 2001 From: Matt Wheatley Date: Fri, 25 Dec 2015 00:50:12 +0000 Subject: [PATCH 072/441] Updated files to comply with CI --- jquery.raty/{jquery.raty.tests.ts => jquery.raty-tests.ts} | 0 jquery.raty/jquery.raty.d.ts | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) rename jquery.raty/{jquery.raty.tests.ts => jquery.raty-tests.ts} (100%) diff --git a/jquery.raty/jquery.raty.tests.ts b/jquery.raty/jquery.raty-tests.ts similarity index 100% rename from jquery.raty/jquery.raty.tests.ts rename to jquery.raty/jquery.raty-tests.ts diff --git a/jquery.raty/jquery.raty.d.ts b/jquery.raty/jquery.raty.d.ts index 35e0f80ad7..cc9a1bc0cf 100644 --- a/jquery.raty/jquery.raty.d.ts +++ b/jquery.raty/jquery.raty.d.ts @@ -1,4 +1,5 @@ // Type definitions for jQuery.raty 2.7.0 +// Project: https://github.com/wbotelhos/raty // Definitions by: Matt Wheatley /// @@ -12,7 +13,7 @@ interface JQuery { raty(method: 'readonly', on: boolean): void; raty(method: 'cancel', on: boolean): void; raty(method: 'reload'): void; - raty(method: 'set', options: JQueryRatyOptions); + raty(method: 'set', options: JQueryRatyOptions): void; raty(method: 'destroy'): JQuery; raty(method: 'move', number: number): void; } From cb60271da952a9338b4999efa0f4aaf567611a4f Mon Sep 17 00:00:00 2001 From: Matt Wheatley Date: Fri, 25 Dec 2015 00:52:58 +0000 Subject: [PATCH 073/441] Contributor updates --- jquery.raty/jquery.raty-tests.ts => raty/raty-tests.ts | 0 jquery.raty/jquery.raty.d.ts => raty/raty.d.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename jquery.raty/jquery.raty-tests.ts => raty/raty-tests.ts (100%) rename jquery.raty/jquery.raty.d.ts => raty/raty.d.ts (100%) diff --git a/jquery.raty/jquery.raty-tests.ts b/raty/raty-tests.ts similarity index 100% rename from jquery.raty/jquery.raty-tests.ts rename to raty/raty-tests.ts diff --git a/jquery.raty/jquery.raty.d.ts b/raty/raty.d.ts similarity index 100% rename from jquery.raty/jquery.raty.d.ts rename to raty/raty.d.ts From 33b6ced4220f5c576109409fa7efac4b20f730fc Mon Sep 17 00:00:00 2001 From: Matt Wheatley Date: Fri, 25 Dec 2015 00:58:30 +0000 Subject: [PATCH 074/441] Added proper headers, updated reference to match new path, defined file names properly --- raty/raty-tests.ts | 2 +- raty/raty.d.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/raty/raty-tests.ts b/raty/raty-tests.ts index 65a298bc32..89efb79c3d 100644 --- a/raty/raty-tests.ts +++ b/raty/raty-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// var $element: JQuery = $('
'); diff --git a/raty/raty.d.ts b/raty/raty.d.ts index cc9a1bc0cf..bb02d94752 100644 --- a/raty/raty.d.ts +++ b/raty/raty.d.ts @@ -1,6 +1,8 @@ // Type definitions for jQuery.raty 2.7.0 // Project: https://github.com/wbotelhos/raty // Definitions by: Matt Wheatley +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + /// interface JQuery { From 1310d29845c9ae8d63fddf2fec89a5face97c5a3 Mon Sep 17 00:00:00 2001 From: Kaoru Hagihara Date: Fri, 25 Dec 2015 10:36:12 +0900 Subject: [PATCH 075/441] Rename vue-router-test.ts to vue-router-tests.ts --- vue-router/{vue-router-test.ts => vue-router-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename vue-router/{vue-router-test.ts => vue-router-tests.ts} (100%) diff --git a/vue-router/vue-router-test.ts b/vue-router/vue-router-tests.ts similarity index 100% rename from vue-router/vue-router-test.ts rename to vue-router/vue-router-tests.ts From 2b2353068b57c5f0e10439f5a7cbca5ae41aa3d5 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 25 Dec 2015 12:46:57 +0800 Subject: [PATCH 076/441] add headersSent in ServerResponse missing headersSent in ServerResponse --- node/node.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/node/node.d.ts b/node/node.d.ts index 14b577986a..450facb4a5 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -490,6 +490,7 @@ declare module "http" { writeHead(statusCode: number, headers?: any): void; statusCode: number; statusMessage: string; + headersSent: boolean; setHeader(name: string, value: string): void; sendDate: boolean; getHeader(name: string): string; From 32cd7f2a9349e7eb1ae01f916687b9dd23c08094 Mon Sep 17 00:00:00 2001 From: Vincent Lesierse Date: Fri, 25 Dec 2015 09:03:35 +0100 Subject: [PATCH 077/441] Added typings for react-router-bootstrap --- react-bootstrap/react-bootstrap-tests.tsx | 7 ++++ react-bootstrap/react-router-bootstrap.d.ts | 46 +++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 react-bootstrap/react-router-bootstrap.d.ts diff --git a/react-bootstrap/react-bootstrap-tests.tsx b/react-bootstrap/react-bootstrap-tests.tsx index 8b0dd0fc0a..f5b4e0a6eb 100644 --- a/react-bootstrap/react-bootstrap-tests.tsx +++ b/react-bootstrap/react-bootstrap-tests.tsx @@ -1,6 +1,7 @@ // React-Bootstrap Test // ================================================================================ /// +/// /// // Imports @@ -8,6 +9,7 @@ import * as React from 'react'; import { Component, CSSProperties } from 'react'; import { Button, ButtonToolbar, Modal, Well, ButtonGroup, DropdownButton, MenuItem, Panel, ListGroup, ListGroupItem, Accordion, Tooltip, OverlayTrigger, Popover, ProgressBar, Nav, NavItem, Navbar, NavDropdown, Tabs, Tab, Pager, PageItem, Pagination, Alert, Carousel, CarouselItem, Grid, Row, Col, Thumbnail, Label, Badge, Jumbotron, PageHeader, Glyphicon, Table, Input, ButtonInput } from 'react-bootstrap'; +import { LinkContainer, IndexLinkContainer } from 'react-router-bootstrap' export class ReactBootstrapTest extends Component { @@ -892,6 +894,11 @@ export class ReactBootstrapTest extends Component {
+ +
+ + +
); } diff --git a/react-bootstrap/react-router-bootstrap.d.ts b/react-bootstrap/react-router-bootstrap.d.ts new file mode 100644 index 0000000000..c268a4ad45 --- /dev/null +++ b/react-bootstrap/react-router-bootstrap.d.ts @@ -0,0 +1,46 @@ +// Type definitions for react-router-bootstrap +// Project: https://github.com/react-bootstrap/react-router-bootstrap +// Definitions by: Vincent Lesierse +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare namespace ReactRouterBootstrap { + // Import React + import React = __React; + + interface LinkContainerProps extends ReactRouter.LinkProps { + disabled?: boolean + } + interface LinkContainer extends React.ComponentClass {} + interface LinkContainerElement extends React.ReactElement {} + const LinkContainer: LinkContainer + + const IndexLinkContainer: LinkContainer +} + +declare module "react-router-bootstrap/lib/LinkContainer" { + + export default ReactRouterBootstrap.LinkContainer + +} + +declare module "react-router-bootstrap/lib/IndexLinkContainer" { + + export default ReactRouterBootstrap.IndexLinkContainer + +} + +declare module "react-router-bootstrap" { + + import LinkContainer from "react-router-bootstrap/lib/LinkContainer" + + import IndexLinkContainer from "react-router-bootstrap/lib/IndexLinkContainer" + + export { + LinkContainer, + IndexLinkContainer + } + +} From 2d6b8ff0cf2f110db871368296448b7894e98703 Mon Sep 17 00:00:00 2001 From: Niels Kristian Hansen Skovmand Date: Fri, 25 Dec 2015 11:37:55 +0100 Subject: [PATCH 078/441] Typings for the Spotify Web Api --- spotify-api/spotify-api.d.ts | 679 +++++++++++++++++++++++++++++++++++ 1 file changed, 679 insertions(+) create mode 100644 spotify-api/spotify-api.d.ts diff --git a/spotify-api/spotify-api.d.ts b/spotify-api/spotify-api.d.ts new file mode 100644 index 0000000000..7b6e6c8a79 --- /dev/null +++ b/spotify-api/spotify-api.d.ts @@ -0,0 +1,679 @@ +// Type definitions for The Spotify Web API v1.0 +// Project: https://developer.spotify.com/web-api/ +// Definitions by: Niels Kristian Hansen Skovmand, https://github.com/skovmand +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module SpotifyApi { + + // + // Parameter Objects for searching + // + + /** + * Object for search parameters for searching for tracks, playlists, artists or albums. + * See: [Search for an item](https://developer.spotify.com/web-api/search-item/) + * + * q and type are not optional in the API, however they are marked as optional here, since various libraries + * implement them as function call parameters instead. This could be changed. + * + * @param q Required. The search query's keywords (and optional field filters and operators). + * @param type Required. A comma-separated list of item types to search across. Valid types are: album, artist, playlist, and track. + * @param market Optional. An ISO 3166-1 alpha-2 country code or the string from_token + * @param limit Optional. The maximum number of results to return. Default: 20. Minimum: 1. Maximum: 50. + * @param offset Optional. The index of the first result to return. Default: 0 (i.e., the first result). Maximum offset: 100.000. Use with limit to get the next page of search results. + */ + interface SearchForItemParameterObject { + q?: string; + type?: string; + market?: string; + limit?: number; + offset?: number; + } + + + // + // Responses from the Spotify Web API in the same order as in the API endpoint docs seen here: + // [API Endpoint Reference](https://developer.spotify.com/web-api/endpoint-reference/) + // + + // Generic interfaces for re-use: + + /** + * Void Response + */ + interface VoidResponse {} + + /** + * Response with Playlist Snapshot + */ + interface PlaylistSnapshotResponse { + snapshot_id: string + } + + + // Spotify API Endpoints: + + /** + * Get an Album + * GET /v1/albums/{id} + */ + interface SingleAlbumResponse extends AlbumObjectFull {} + + /** + * Get Several Albums + * GET /v1/albums + */ + interface MultipleAlbumsResponse { + albums: AlbumObjectFull[] + } + + /** + * Get an Album’s Tracks + * GET /v1/albums/{id}/tracks + */ + interface AlbumTracksResponse extends PagingObject {} + + /** + * Get an Artist + * GET /v1/artists/{id} + */ + interface SingleArtistResponse extends ArtistObjectFull {} + + /** + * Get Several Artists + * GET /v1/artists + */ + interface MultipleArtistsResponse { + artists: ArtistObjectFull[] + } + + /** + * Get an Artist’s Albums + * GET /v1/artists/{id}/albums + */ + interface ArtistsAlbumsResponse extends PagingObject {} + + /** + * Get an Artist’s Top Tracks + * GET /v1/artists/{id}/top-tracks + */ + interface ArtistsTopTracksResponse { + tracks: TrackObjectFull[] + } + + /** + * Get an Artist’s Related Artists + * GET /v1/artists/{id}/related-artists + */ + interface ArtistsRelatedArtistsResponse { + artists: PagingObject + } + + /** + * Get a list of featured playlists + * GET /v1/browse/featured-playlists + */ + interface ListOfFeaturedPlaylistsResponse { + message: string, + playlists: PagingObject + } + + /** + * Get a list of new releases + * GET /v1/browse/new-releases + */ + interface ListOfNewReleasesResponse { + message: string, + albums: PagingObject + } + + /** + * Get a list of categories + * GET /v1/browse/categories + */ + interface MultipleCategoriesResponse { + categories: PagingObject + } + + /** + * Get a category + * GET /v1/browse/categories/{category_id} + */ + interface SingleCategoryResponse extends CategoryObject {} + + /** + * Get a categorys playlists + * GET /v1/browse/categories/{id}/playlists + */ + interface CategoryPlaylistsReponse { + playlists: PagingObject + } + + /** + * Get Current User’s Profile + * GET /v1/me + */ + interface CurrentUsersProfileResponse extends UserObjectPrivate {} + + /** + * Get User’s Followed Artists + * GET /v1/me/following?type=artist + */ + interface UsersFollowedArtistsResponse { + artists: PagingObject + } + + /** + * Follow artists or users + * PUT /v1/me/following + */ + interface FollowArtistsOrUsersResponse extends VoidResponse {} + + /** + * Unfollow artists or users + * DELETE /v1/me/following + */ + interface UnfollowArtistsOrUsersResponse extends VoidResponse {} + + /** + * Check if User Follows Users or Artists + * GET /v1/me/following/contains + */ + interface UserFollowsUsersOrArtistsResponse extends Array {} + + /** + * Follow a Playlist + * PUT /v1/users/{owner_id}/playlists/{playlist_id}/followers + */ + interface FollowAPlaylistReponse extends VoidResponse {} + + /** + * Unfollow a Playlist + * DELETE /v1/users/{owner_id}/playlists/{playlist_id}/followers + */ + interface UnfollowPlaylistReponse extends VoidResponse {} + + /** + * Save tracks for user + * PUT /v1/me/tracks?ids={ids} + */ + interface SaveTracksForUserResponse extends VoidResponse {} + + /** + * Get user's saved tracks + * GET /v1/me/tracks + */ + interface UsersSavedTracksResponse extends PagingObject {} + + /** + * Remove User’s Saved Tracks + * DELETE /v1/me/tracks?ids={ids} + */ + interface RemoveUsersSavedTracksResponse extends VoidResponse {} + + /** + * Check User’s Saved Tracks + * GET /v1/me/tracks/contains + */ + interface CheckUsersSavedTracksResponse extends Array {} + + /** + * Save albums for user + * PUT /v1/me/albums?ids={ids} + */ + interface SaveAlbumsForUserResponse extends VoidResponse {} + + /** + * Get user's saved albums + * GET /v1/me/albums + */ + interface UsersSavedAlbumsResponse extends PagingObject {} + + /** + * Remove Albums for Current User + * DELETE /v1/me/albums?ids={ids} + */ + interface RemoveAlbumsForCurrentUserResponse extends VoidResponse {} + + /** + * Check user's saved albums + * DELETE /v1/me/albums/contains?ids={ids} + */ + interface CheckUserSavedAlbumsResponse extends Array {} + + /** + * Search for an album + * GET /v1/search?type=album + */ + interface AlbumSearchResponse { + albums: PagingObject + } + + /** + * Search for an artist + * GET /v1/search?type=artist + */ + interface ArtistSearchResponse { + artists: PagingObject + } + + /** + * Search for a playlist + * GET /v1/search?type=playlist + */ + interface PlaylistSearchResponse { + playlists: PagingObject + } + + /** + * Search for a track + * GET /v1/search?type=track + */ + interface TrackSearchResponse { + tracks: PagingObject + } + + /** + * Get a track + * GET /v1/tracks/{id} + */ + interface SingleTrackResponse extends TrackObjectFull {} + + /** + * Get multiple tracks + * GET /v1/tracks?ids={ids} + */ + interface MultipleTracksResponse { + tracks: TrackObjectFull[] + } + + /** + * Get user profile + * GET /v1/users/{user_id} + */ + interface UserProfileResponse extends UserObjectPublic {} + + /** + * Get a list of a user's playlists + * GET /v1/users/{user_id}/playlists + */ + interface ListOfUsersPlaylistsResponse extends PagingObject {} + + /** + * Get a list of the current user's playlists + * GET /v1/me/playlists + */ + interface ListOfCurrentUsersPlaylistsResponse extends PagingObject {} + + /** + * Get a playlist + * GET /v1/users/{user_id}/playlists/{playlist_id} + */ + interface SinglePlaylistResponse extends PlaylistObjectFull {} + + /** + * Get a playlist's tracks + * GET /v1/users/{user_id}/playlists/{playlist_id}/tracks + */ + interface PlaylistTrackResponse extends PagingObject {} + + /** + * Create a Playlist + * POST /v1/users/{user_id}/playlists + */ + interface CreateAPlaylistResponse extends PlaylistObjectFull {} + + /** + * Change a Playlist’s Details + * PUT /v1/users/{user_id}/playlists/{playlist_id} + */ + interface ChangePlaylistDetailsReponse extends VoidResponse {} + + /** + * Add Tracks to a Playlist + * POST /v1/users/{user_id}/playlists/{playlist_id}/tracks + */ + interface AddTracksToPlaylistResponse extends PlaylistSnapshotResponse {} + + /** + * Remove Tracks from a Playlist + * DELETE /v1/users/{user_id}/playlists/{playlist_id}/tracks + */ + interface RemoveTracksFromPlaylistResponse extends PlaylistSnapshotResponse {} + + /** + * Reorder a Playlist’s Tracks + * PUT /v1/users/{user_id}/playlists/{playlist_id}/tracks + */ + interface ReorderPlaylistTracksResponse extends PlaylistSnapshotResponse {} + + /** + * Replace a Playlist’s Tracks + * PUT /v1/users/{user_id}/playlists/{playlist_id}/tracks + */ + interface ReplacePlaylistTracksResponse extends VoidResponse {} + + /** + * Check if Users Follow a Playlist + * GET /v1/users/{user_id}/playlists/{playlist_id}/followers/contains + */ + interface UsersFollowPlaylistReponse extends Array {} + + + + // + // Objects from the Object Models of the Spotify Web Api + // [Object Model](https://developer.spotify.com/web-api/object-model) + // + + // + // The Paging Object wrappers used for retrieving collections from the Spotify API. + // + + /** + * BasePagingObject which the IPagingObject and ICursorBasedPagingObject extend from. + * Doesn't exist in itself in the spotify API. + */ + interface BasePagingObject { + href: string, + items: T[], + limit: number, + next: string, + offset: number, + total: number + } + + /** + * Paging Object wrapper used for retrieving collections from the Spotify API. + * [](https://developer.spotify.com/web-api/object-model/#paging-object) + */ + interface PagingObject extends BasePagingObject { + previous: string, + } + + /** + * Cursor Based Paging Object wrappers used for retrieving collections from the Spotify API. + * [](https://developer.spotify.com/web-api/object-model/#cursor-based-paging-object) + */ + interface CursorBasedPagingObject extends BasePagingObject { + cursors: CursorObject + } + + + + // + // All other objects of the Object Models from the Spotify Web Api, ordered alphabetically. + // + + /** + * Full Album Object + * [album object (full)](https://developer.spotify.com/web-api/object-model/#album-object-simplified) + */ + interface AlbumObjectFull extends AlbumObjectSimplified { + artists: ArtistObjectSimplified[], + copyrights: CopyrightObject[], + external_ids: ExternalIdObject, + genres: string[], + popularity: number, + release_date: string, + release_date_precision: string, + tracks: PagingObject, + } + + /** + * Simplified Album Object + * [album object (simplified)](https://developer.spotify.com/web-api/object-model/#album-object-simplified) + */ + interface AlbumObjectSimplified { + album_type: string, + available_markets: string[], + external_urls: ExternalUrlObject, + href: string, + id: string, + images: ImageObject[], + name: string, + type: string, + uri: string + } + + /** + * Full Artist Object + * [artist object (full)](https://developer.spotify.com/web-api/object-model/) + */ + interface ArtistObjectFull extends ArtistObjectSimplified { + followers: FollowersObject, + genres: string[], + images: ImageObject[], + popularity: number, + } + + /** + * Simplified Artist Object + * [artist object (simplified)](https://developer.spotify.com/web-api/object-model/) + */ + interface ArtistObjectSimplified { + external_urls: ExternalUrlObject, + href: string, + id: string, + name: string, + type: string, + uri: string + } + + /** + * Category Object + * [category object](https://developer.spotify.com/web-api/object-model/) + */ + interface CategoryObject { + href: string, + icons: ImageObject[], + id: string, + name: string + } + + /** + * Copyright object + * [copyright object](https://developer.spotify.com/web-api/object-model/) + */ + interface CopyrightObject { + text: string, + type: string + } + + /** + * Cursor object + * [cursor object](https://developer.spotify.com/web-api/object-model/) + */ + interface CursorObject { + after: string + } + + /** + * Error object + * [error object](https://developer.spotify.com/web-api/object-model/) + */ + interface ErrorObject { + status: number, + message: string + } + + /** + * External Id object + * [](https://developer.spotify.com/web-api/object-model/) + * + * Note that there might be other types available, it couldn't be found in the docs. + */ + interface ExternalIdObject { + isrc?: string, + ean?: string, + upc?: string + } + + /** + * External Url Object + * [](https://developer.spotify.com/web-api/object-model/) + * + * Note that there might be other types available, it couldn't be found in the docs. + */ + interface ExternalUrlObject { + spotify: string + } + + /** + * Followers Object + * [](https://developer.spotify.com/web-api/object-model/) + */ + interface FollowersObject { + href: string, + total: number + } + + /** + * Image Object + * [](https://developer.spotify.com/web-api/object-model/) + */ + interface ImageObject { + height?: number, + url: string, + width?: number + } + + /** + * Base Playlist Object. Does not in itself exist in Spotify Web Api, + * but needs to be made since the tracks types vary in the Full and Simplified versions. + */ + interface PlaylistBaseObject { + collaborative: boolean, + external_urls: ExternalUrlObject, + href: string, + id: string, + images: ImageObject[], + name: string, + owner: UserObjectPublic, + public: boolean, + snapshot_id: string, + type: string, + uri: string + } + + /** + * Playlist Object Full + * [](https://developer.spotify.com/web-api/object-model/) + */ + interface PlaylistObjectFull extends PlaylistBaseObject { + description: string, + followers: FollowersObject, + tracks: PagingObject + } + + /** + * Playlist Object Simplified + * [](https://developer.spotify.com/web-api/object-model/) + */ + interface PlaylistObjectSimplified extends PlaylistBaseObject { + tracks: { + href: string, + total: number + } + } + + /** + * The Track Object in Playlists + * [](https://developer.spotify.com/web-api/object-model/) + */ + interface PlaylistTrackObject { + added_at: string, + added_by: UserObjectPublic, + is_local: boolean, + track: TrackObjectFull + } + + /** + * Saved Track Object in Playlists + * [](https://developer.spotify.com/web-api/object-model/) + */ + interface SavedTrackObject { + added_at: string, + track: TrackObjectFull + } + + /** + * Saved Track Object in Playlists + * [](https://developer.spotify.com/web-api/object-model/) + */ + interface SavedAlbumObject { + added_at: string, + album: AlbumObjectFull + } + + /** + * Full Track Object + * [track object (full)](https://developer.spotify.com/web-api/object-model/#track-object-full) + */ + interface TrackObjectFull extends TrackObjectSimplified { + album: AlbumObjectSimplified, + external_ids: ExternalIdObject, + popularity: number + } + + /** + * Simplified Track Object + * [track object (simplified)](https://developer.spotify.com/web-api/object-model/#track-object-simplified) + */ + interface TrackObjectSimplified { + artists: ArtistObjectSimplified[], + available_markets: string[], + disc_number: number, + duration_ms: number, + explicit: boolean, + external_urls: ExternalUrlObject, + href: string, + id: string, + is_playable?: boolean, + linked_from?: TrackLinkObject, + name: string, + preview_url: string, + track_number: number, + type: string, + uri: string + } + + /** + * Track Link Object + * [](https://developer.spotify.com/web-api/object-model/#track-object-simplified) + */ + interface TrackLinkObject { + external_urls: ExternalUrlObject, + href: string, + id: string, + type: string, + uri: string + } + + /** + * User Object (Private) + * [](https://developer.spotify.com/web-api/object-model/#track-object-simplified) + */ + interface UserObjectPrivate extends UserObjectPublic { + birthdate: string, + country: string, + email: string, + product: string + } + + /** + * User Object (Public) + * [](https://developer.spotify.com/web-api/object-model/#track-object-simplified) + */ + interface UserObjectPublic { + display_name?: string, + external_urls: ExternalUrlObject, + followers?: FollowersObject, + href: string, + id: string, + images?: ImageObject[], + type: string, + uri: string + } + +} \ No newline at end of file From f250b38f7097696a5788d6aa0ba3b744c3cd6169 Mon Sep 17 00:00:00 2001 From: Niels Kristian Hansen Skovmand Date: Fri, 25 Dec 2015 12:56:57 +0100 Subject: [PATCH 079/441] Removed a comma in the header --- spotify-api/spotify-api.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spotify-api/spotify-api.d.ts b/spotify-api/spotify-api.d.ts index 7b6e6c8a79..614eb9954e 100644 --- a/spotify-api/spotify-api.d.ts +++ b/spotify-api/spotify-api.d.ts @@ -1,6 +1,6 @@ // Type definitions for The Spotify Web API v1.0 // Project: https://developer.spotify.com/web-api/ -// Definitions by: Niels Kristian Hansen Skovmand, https://github.com/skovmand +// Definitions by: Niels Kristian Hansen Skovmand https://github.com/skovmand // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module SpotifyApi { From 186d0b5be4b2594ee47113195f3cdcfc390391fa Mon Sep 17 00:00:00 2001 From: Niels Kristian Hansen Skovmand Date: Fri, 25 Dec 2015 12:59:37 +0100 Subject: [PATCH 080/441] Updated header again --- spotify-api/spotify-api.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spotify-api/spotify-api.d.ts b/spotify-api/spotify-api.d.ts index 614eb9954e..450dad545a 100644 --- a/spotify-api/spotify-api.d.ts +++ b/spotify-api/spotify-api.d.ts @@ -1,6 +1,6 @@ // Type definitions for The Spotify Web API v1.0 // Project: https://developer.spotify.com/web-api/ -// Definitions by: Niels Kristian Hansen Skovmand https://github.com/skovmand +// Definitions by: Niels Kristian Hansen Skovmand // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module SpotifyApi { From 32a01367882f1d254bf79ba45b46d1da3eb7c660 Mon Sep 17 00:00:00 2001 From: Panu Horsmalahti Date: Fri, 25 Dec 2015 14:19:42 +0200 Subject: [PATCH 081/441] Add type definitions for rcloader. --- rcloader/rcloader-tests.ts | 11 +++++++++++ rcloader/rcloader.d.ts | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 rcloader/rcloader-tests.ts create mode 100644 rcloader/rcloader.d.ts diff --git a/rcloader/rcloader-tests.ts b/rcloader/rcloader-tests.ts new file mode 100644 index 0000000000..da6e72f4dd --- /dev/null +++ b/rcloader/rcloader-tests.ts @@ -0,0 +1,11 @@ +/// + +import rcloader = require("rcloader"); + +const rcLoader = new rcloader.RcLoader(".configfilename", { + lookup: true +}); + +rcLoader.for("foo.json", (err, fileOpts) => { + // send the file along +}); diff --git a/rcloader/rcloader.d.ts b/rcloader/rcloader.d.ts new file mode 100644 index 0000000000..cce17377cc --- /dev/null +++ b/rcloader/rcloader.d.ts @@ -0,0 +1,16 @@ +// Type definitions for rcloader +// Project: hhttps://github.com/spalger/rcloader +// Definitions by: Panu Horsmalahti +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "rcloader" { + interface Options { + [property: string]: any; + lookup?: boolean; + } + + export class RcLoader { + constructor(configfilename: string, options: string | Options); + for(path: string, callback?: (error: any, fileOpts: any) => void): void; + } +} From fdaec58796a10b8ee1a89642cb24fc0b8bdecc42 Mon Sep 17 00:00:00 2001 From: Panu Horsmalahti Date: Fri, 25 Dec 2015 14:26:04 +0200 Subject: [PATCH 082/441] Make RcLoader module a class. --- rcloader/rcloader-tests.ts | 4 ++-- rcloader/rcloader.d.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/rcloader/rcloader-tests.ts b/rcloader/rcloader-tests.ts index da6e72f4dd..16ade8c555 100644 --- a/rcloader/rcloader-tests.ts +++ b/rcloader/rcloader-tests.ts @@ -1,8 +1,8 @@ /// -import rcloader = require("rcloader"); +import RcLoader = require("rcloader"); -const rcLoader = new rcloader.RcLoader(".configfilename", { +const rcLoader = new RcLoader(".configfilename", { lookup: true }); diff --git a/rcloader/rcloader.d.ts b/rcloader/rcloader.d.ts index cce17377cc..b3805d0def 100644 --- a/rcloader/rcloader.d.ts +++ b/rcloader/rcloader.d.ts @@ -9,8 +9,10 @@ declare module "rcloader" { lookup?: boolean; } - export class RcLoader { + class RcLoader { constructor(configfilename: string, options: string | Options); for(path: string, callback?: (error: any, fileOpts: any) => void): void; } + + export = RcLoader; } From 0c79a52bc38e153bfb56fc3ad1cfbce021eecd24 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 25 Dec 2015 20:15:49 +0500 Subject: [PATCH 083/441] lodash: signatures of _.isNumber have been changed --- lodash/lodash-tests.ts | 42 ++++++++++++++++++++++++++++++------------ lodash/lodash.d.ts | 9 +++++++++ 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 3f7a26556d..1d211c2ac7 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5987,7 +5987,7 @@ module TestIsNaN { } // _.isNative -module TestIsNull { +module TestIsNative { { let value: number|Function; @@ -6040,17 +6040,35 @@ module TestIsNull { } // _.isNumber -result = _.isNumber(any); -result = _(1).isNumber(); -result = _([]).isNumber(); -result = _({}).isNumber(); -{ - let value: number|string = "foo"; - if (_.isNumber(value)) { - let result: number = value * 42; - } else { - let result: string = value; - } +module TestIsNumber { + { + let value: string|number; + + if (_.isNumber(value)) { + let result: number = value; + } + else { + let result: string = value; + } + } + + { + let result: boolean; + + result = _.isNumber(any); + + result = _(1).isNumber(); + result = _([]).isNumber(); + result = _({}).isNumber(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNumber(); + result = _([]).chain().isNumber(); + result = _({}).chain().isNumber(); + } } // _.isObject diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 584500c101..f0b92ce21a 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10075,7 +10075,9 @@ declare module _ { interface LoDashStatic { /** * Checks if value is classified as a Number primitive or object. + * * Note: To exclude Infinity, -Infinity, and NaN, which are classified as numbers, use the _.isFinite method. + * * @param value The value to check. * @return Returns true if value is correctly classified, else false. */ @@ -10089,6 +10091,13 @@ declare module _ { isNumber(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isNumber + */ + isNumber(): LoDashExplicitWrapper; + } + //_.isObject interface LoDashStatic { /** From c98b1fe244640b6e5bf78764bdfa18769cebd29c Mon Sep 17 00:00:00 2001 From: Niels Kristian Hansen Skovmand Date: Fri, 25 Dec 2015 16:13:09 +0100 Subject: [PATCH 084/441] Added test files and fixed a few issues. --- spotify-api/spotify-api-tests.ts | 6273 ++++++++++++++++++++++++++++++ spotify-api/spotify-api.d.ts | 27 +- 2 files changed, 6290 insertions(+), 10 deletions(-) create mode 100644 spotify-api/spotify-api-tests.ts diff --git a/spotify-api/spotify-api-tests.ts b/spotify-api/spotify-api-tests.ts new file mode 100644 index 0000000000..db90150162 --- /dev/null +++ b/spotify-api/spotify-api-tests.ts @@ -0,0 +1,6273 @@ +/* + * This test file contains the sample output from The Spotify Web Api obtained from [The Web API Console](https://developer.spotify.com/web-api/console/) + * The standard suggested values for input were used. + * + * Combined with the typings it should compile without errors. + * + * The order of tests is the same as on [The Spotify Web Api](https://developer.spotify.com/web-api/endpoint-reference/) + * To find tests, search for "* Tests" instead of scrolling to keep sane. + */ + +/// + + + + +/** + * Tests the response of https://developer.spotify.com/web-api/get-album/ + */ +var getSingleAlbum : SpotifyApi.SingleAlbumResponse = { + "album_type" : "album", + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2BTZIqw0ntH9MvilQ3ewNY" + }, + "href" : "https://api.spotify.com/v1/artists/2BTZIqw0ntH9MvilQ3ewNY", + "id" : "2BTZIqw0ntH9MvilQ3ewNY", + "name" : "Cyndi Lauper", + "type" : "artist", + "uri" : "spotify:artist:2BTZIqw0ntH9MvilQ3ewNY" + } ], + "available_markets" : [ ], + "copyrights" : [ { + "text" : "(P) 2000 Sony Music Entertainment Inc.", + "type" : "P" + } ], + "external_ids" : { + "upc" : "5099749994324" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/album/0sNOF9WDwhWunNAHPD3Baj" + }, + "genres" : [ ], + "href" : "https://api.spotify.com/v1/albums/0sNOF9WDwhWunNAHPD3Baj", + "id" : "0sNOF9WDwhWunNAHPD3Baj", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/07c323340e03e25a8e5dd5b9a8ec72b69c50089d", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/8b662d81966a0ec40dc10563807696a8479cd48b", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/54b3222c8aaa77890d1ac37b3aaaa1fc9ba630ae", + "width" : 64 + } ], + "name" : "She's So Unusual", + "popularity" : 0, + "release_date" : "1983", + "release_date_precision" : "year", + "tracks" : { + "href" : "https://api.spotify.com/v1/albums/0sNOF9WDwhWunNAHPD3Baj/tracks?offset=0&limit=50", + "items" : [ { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2BTZIqw0ntH9MvilQ3ewNY" + }, + "href" : "https://api.spotify.com/v1/artists/2BTZIqw0ntH9MvilQ3ewNY", + "id" : "2BTZIqw0ntH9MvilQ3ewNY", + "name" : "Cyndi Lauper", + "type" : "artist", + "uri" : "spotify:artist:2BTZIqw0ntH9MvilQ3ewNY" + } ], + "available_markets" : [ ], + "disc_number" : 1, + "duration_ms" : 305560, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3f9zqUnrnIq0LANhmnaF0V" + }, + "href" : "https://api.spotify.com/v1/tracks/3f9zqUnrnIq0LANhmnaF0V", + "id" : "3f9zqUnrnIq0LANhmnaF0V", + "name" : "Money Changes Everything", + "preview_url" : null, + "track_number" : 1, + "type" : "track", + "uri" : "spotify:track:3f9zqUnrnIq0LANhmnaF0V" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2BTZIqw0ntH9MvilQ3ewNY" + }, + "href" : "https://api.spotify.com/v1/artists/2BTZIqw0ntH9MvilQ3ewNY", + "id" : "2BTZIqw0ntH9MvilQ3ewNY", + "name" : "Cyndi Lauper", + "type" : "artist", + "uri" : "spotify:artist:2BTZIqw0ntH9MvilQ3ewNY" + } ], + "available_markets" : [ ], + "disc_number" : 1, + "duration_ms" : 238266, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/2joHDtKFVDDyWDHnOxZMAX" + }, + "href" : "https://api.spotify.com/v1/tracks/2joHDtKFVDDyWDHnOxZMAX", + "id" : "2joHDtKFVDDyWDHnOxZMAX", + "name" : "Girls Just Want to Have Fun", + "preview_url" : null, + "track_number" : 2, + "type" : "track", + "uri" : "spotify:track:2joHDtKFVDDyWDHnOxZMAX" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2BTZIqw0ntH9MvilQ3ewNY" + }, + "href" : "https://api.spotify.com/v1/artists/2BTZIqw0ntH9MvilQ3ewNY", + "id" : "2BTZIqw0ntH9MvilQ3ewNY", + "name" : "Cyndi Lauper", + "type" : "artist", + "uri" : "spotify:artist:2BTZIqw0ntH9MvilQ3ewNY" + } ], + "available_markets" : [ ], + "disc_number" : 1, + "duration_ms" : 306706, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/6ClztHzretmPHCeiNqR5wD" + }, + "href" : "https://api.spotify.com/v1/tracks/6ClztHzretmPHCeiNqR5wD", + "id" : "6ClztHzretmPHCeiNqR5wD", + "name" : "When You Were Mine", + "preview_url" : null, + "track_number" : 3, + "type" : "track", + "uri" : "spotify:track:6ClztHzretmPHCeiNqR5wD" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2BTZIqw0ntH9MvilQ3ewNY" + }, + "href" : "https://api.spotify.com/v1/artists/2BTZIqw0ntH9MvilQ3ewNY", + "id" : "2BTZIqw0ntH9MvilQ3ewNY", + "name" : "Cyndi Lauper", + "type" : "artist", + "uri" : "spotify:artist:2BTZIqw0ntH9MvilQ3ewNY" + } ], + "available_markets" : [ ], + "disc_number" : 1, + "duration_ms" : 241333, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/2tVHvZK4YYzTloSCBPm2tg" + }, + "href" : "https://api.spotify.com/v1/tracks/2tVHvZK4YYzTloSCBPm2tg", + "id" : "2tVHvZK4YYzTloSCBPm2tg", + "name" : "Time After Time", + "preview_url" : null, + "track_number" : 4, + "type" : "track", + "uri" : "spotify:track:2tVHvZK4YYzTloSCBPm2tg" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2BTZIqw0ntH9MvilQ3ewNY" + }, + "href" : "https://api.spotify.com/v1/artists/2BTZIqw0ntH9MvilQ3ewNY", + "id" : "2BTZIqw0ntH9MvilQ3ewNY", + "name" : "Cyndi Lauper", + "type" : "artist", + "uri" : "spotify:artist:2BTZIqw0ntH9MvilQ3ewNY" + } ], + "available_markets" : [ ], + "disc_number" : 1, + "duration_ms" : 229266, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/6iLhMDtOr52OVXaZdha5M6" + }, + "href" : "https://api.spotify.com/v1/tracks/6iLhMDtOr52OVXaZdha5M6", + "id" : "6iLhMDtOr52OVXaZdha5M6", + "name" : "She Bop", + "preview_url" : null, + "track_number" : 5, + "type" : "track", + "uri" : "spotify:track:6iLhMDtOr52OVXaZdha5M6" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2BTZIqw0ntH9MvilQ3ewNY" + }, + "href" : "https://api.spotify.com/v1/artists/2BTZIqw0ntH9MvilQ3ewNY", + "id" : "2BTZIqw0ntH9MvilQ3ewNY", + "name" : "Cyndi Lauper", + "type" : "artist", + "uri" : "spotify:artist:2BTZIqw0ntH9MvilQ3ewNY" + } ], + "available_markets" : [ ], + "disc_number" : 1, + "duration_ms" : 272840, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3csiLr2B2wRj4lsExn6jLf" + }, + "href" : "https://api.spotify.com/v1/tracks/3csiLr2B2wRj4lsExn6jLf", + "id" : "3csiLr2B2wRj4lsExn6jLf", + "name" : "All Through the Night", + "preview_url" : null, + "track_number" : 6, + "type" : "track", + "uri" : "spotify:track:3csiLr2B2wRj4lsExn6jLf" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2BTZIqw0ntH9MvilQ3ewNY" + }, + "href" : "https://api.spotify.com/v1/artists/2BTZIqw0ntH9MvilQ3ewNY", + "id" : "2BTZIqw0ntH9MvilQ3ewNY", + "name" : "Cyndi Lauper", + "type" : "artist", + "uri" : "spotify:artist:2BTZIqw0ntH9MvilQ3ewNY" + } ], + "available_markets" : [ ], + "disc_number" : 1, + "duration_ms" : 220333, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/4mRAnuBGYsW4WGbpW0QUkp" + }, + "href" : "https://api.spotify.com/v1/tracks/4mRAnuBGYsW4WGbpW0QUkp", + "id" : "4mRAnuBGYsW4WGbpW0QUkp", + "name" : "Witness", + "preview_url" : null, + "track_number" : 7, + "type" : "track", + "uri" : "spotify:track:4mRAnuBGYsW4WGbpW0QUkp" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2BTZIqw0ntH9MvilQ3ewNY" + }, + "href" : "https://api.spotify.com/v1/artists/2BTZIqw0ntH9MvilQ3ewNY", + "id" : "2BTZIqw0ntH9MvilQ3ewNY", + "name" : "Cyndi Lauper", + "type" : "artist", + "uri" : "spotify:artist:2BTZIqw0ntH9MvilQ3ewNY" + } ], + "available_markets" : [ ], + "disc_number" : 1, + "duration_ms" : 252626, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3AIeUnffkLQaUaX1pkHyeD" + }, + "href" : "https://api.spotify.com/v1/tracks/3AIeUnffkLQaUaX1pkHyeD", + "id" : "3AIeUnffkLQaUaX1pkHyeD", + "name" : "I'll Kiss You", + "preview_url" : null, + "track_number" : 8, + "type" : "track", + "uri" : "spotify:track:3AIeUnffkLQaUaX1pkHyeD" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2BTZIqw0ntH9MvilQ3ewNY" + }, + "href" : "https://api.spotify.com/v1/artists/2BTZIqw0ntH9MvilQ3ewNY", + "id" : "2BTZIqw0ntH9MvilQ3ewNY", + "name" : "Cyndi Lauper", + "type" : "artist", + "uri" : "spotify:artist:2BTZIqw0ntH9MvilQ3ewNY" + } ], + "available_markets" : [ ], + "disc_number" : 1, + "duration_ms" : 45933, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/53eCpAFNbA9MQNfLilN3CH" + }, + "href" : "https://api.spotify.com/v1/tracks/53eCpAFNbA9MQNfLilN3CH", + "id" : "53eCpAFNbA9MQNfLilN3CH", + "name" : "He's so Unusual", + "preview_url" : null, + "track_number" : 9, + "type" : "track", + "uri" : "spotify:track:53eCpAFNbA9MQNfLilN3CH" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2BTZIqw0ntH9MvilQ3ewNY" + }, + "href" : "https://api.spotify.com/v1/artists/2BTZIqw0ntH9MvilQ3ewNY", + "id" : "2BTZIqw0ntH9MvilQ3ewNY", + "name" : "Cyndi Lauper", + "type" : "artist", + "uri" : "spotify:artist:2BTZIqw0ntH9MvilQ3ewNY" + } ], + "available_markets" : [ ], + "disc_number" : 1, + "duration_ms" : 196373, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/51JS0KXziu9U1T8EBdRTUF" + }, + "href" : "https://api.spotify.com/v1/tracks/51JS0KXziu9U1T8EBdRTUF", + "id" : "51JS0KXziu9U1T8EBdRTUF", + "name" : "Yeah Yeah", + "preview_url" : null, + "track_number" : 10, + "type" : "track", + "uri" : "spotify:track:51JS0KXziu9U1T8EBdRTUF" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2BTZIqw0ntH9MvilQ3ewNY" + }, + "href" : "https://api.spotify.com/v1/artists/2BTZIqw0ntH9MvilQ3ewNY", + "id" : "2BTZIqw0ntH9MvilQ3ewNY", + "name" : "Cyndi Lauper", + "type" : "artist", + "uri" : "spotify:artist:2BTZIqw0ntH9MvilQ3ewNY" + } ], + "available_markets" : [ ], + "disc_number" : 1, + "duration_ms" : 275560, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/2BGJvRarwOa2kiIGpLjIXT" + }, + "href" : "https://api.spotify.com/v1/tracks/2BGJvRarwOa2kiIGpLjIXT", + "id" : "2BGJvRarwOa2kiIGpLjIXT", + "name" : "Money Changes Everything", + "preview_url" : null, + "track_number" : 11, + "type" : "track", + "uri" : "spotify:track:2BGJvRarwOa2kiIGpLjIXT" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2BTZIqw0ntH9MvilQ3ewNY" + }, + "href" : "https://api.spotify.com/v1/artists/2BTZIqw0ntH9MvilQ3ewNY", + "id" : "2BTZIqw0ntH9MvilQ3ewNY", + "name" : "Cyndi Lauper", + "type" : "artist", + "uri" : "spotify:artist:2BTZIqw0ntH9MvilQ3ewNY" + } ], + "available_markets" : [ ], + "disc_number" : 1, + "duration_ms" : 320400, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5ggatiDTbCIJsUAa7IUP65" + }, + "href" : "https://api.spotify.com/v1/tracks/5ggatiDTbCIJsUAa7IUP65", + "id" : "5ggatiDTbCIJsUAa7IUP65", + "name" : "She Bop - Live", + "preview_url" : null, + "track_number" : 12, + "type" : "track", + "uri" : "spotify:track:5ggatiDTbCIJsUAa7IUP65" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2BTZIqw0ntH9MvilQ3ewNY" + }, + "href" : "https://api.spotify.com/v1/artists/2BTZIqw0ntH9MvilQ3ewNY", + "id" : "2BTZIqw0ntH9MvilQ3ewNY", + "name" : "Cyndi Lauper", + "type" : "artist", + "uri" : "spotify:artist:2BTZIqw0ntH9MvilQ3ewNY", + } ], + "available_markets" : [ ], + "disc_number" : 1, + "duration_ms" : 288240, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5ZBxoa2kBrBah3qNIV4rm7" + }, + "href" : "https://api.spotify.com/v1/tracks/5ZBxoa2kBrBah3qNIV4rm7", + "id" : "5ZBxoa2kBrBah3qNIV4rm7", + "name" : "All Through The Night - Live", + "preview_url" : null, + "track_number" : 13, + "type" : "track", + "uri" : "spotify:track:5ZBxoa2kBrBah3qNIV4rm7" + } ], + "limit" : 50, + "next" : null, + "offset" : 0, + "previous" : null, + "total" : 13 + }, + "type" : "album", + "uri" : "spotify:album:0sNOF9WDwhWunNAHPD3Baj" +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-several-albums/ + */ +var getMultipleAlbumsResponse : SpotifyApi.MultipleAlbumsResponse = { + "albums" : [ { + "album_type" : "album", + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "copyrights" : [ { + "text" : "(C) 2013 Universal Island Records, a division of Universal Music Operations Limited", + "type" : "C" + }, { + "text" : "(P) 2013 Universal Island Records, a division of Universal Music Operations Limited", + "type" : "P" + } ], + "external_ids" : { + "upc" : "00602537518357" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/album/41MnTivkwTO3UUJ8DrqEJJ" + }, + "genres" : [ ], + "href" : "https://api.spotify.com/v1/albums/41MnTivkwTO3UUJ8DrqEJJ", + "id" : "41MnTivkwTO3UUJ8DrqEJJ", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/89b92c6b59131776c0cd8e5df46301ffcf36ed69", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/eb6f0b2594d81f8d9dced193f3e9a3bc4318aedc", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/21e1ebcd7ebd3b679d9d5084bba1e163638b103a", + "width" : 64 + } ], + "name" : "The Best Of Keane (Deluxe Edition)", + "popularity" : 56, + "release_date" : "2013-01-01", + "release_date_precision" : "day", + "tracks" : { + "href" : "https://api.spotify.com/v1/albums/41MnTivkwTO3UUJ8DrqEJJ/tracks?offset=0&limit=50", + "items" : [ { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 215986, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/4r9PmSmbAOOWqaGWLf6M9Q" + }, + "href" : "https://api.spotify.com/v1/tracks/4r9PmSmbAOOWqaGWLf6M9Q", + "id" : "4r9PmSmbAOOWqaGWLf6M9Q", + "name" : "Everybody's Changing", + "preview_url" : "https://p.scdn.co/mp3-preview/fe9d90cd8a51ea672789c13856d886901125bc05", + "track_number" : 1, + "type" : "track", + "uri" : "spotify:track:4r9PmSmbAOOWqaGWLf6M9Q" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 235880, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/0HJQD8uqX2Bq5HVdLnd3ep" + }, + "href" : "https://api.spotify.com/v1/tracks/0HJQD8uqX2Bq5HVdLnd3ep", + "id" : "0HJQD8uqX2Bq5HVdLnd3ep", + "name" : "Somewhere Only We Know", + "preview_url" : "https://p.scdn.co/mp3-preview/af246a57475c5491157fa21c069b130baaaacccd", + "track_number" : 2, + "type" : "track", + "uri" : "spotify:track:0HJQD8uqX2Bq5HVdLnd3ep" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 218426, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/087AcwkqBIuIebZWpwbOI4" + }, + "href" : "https://api.spotify.com/v1/tracks/087AcwkqBIuIebZWpwbOI4", + "id" : "087AcwkqBIuIebZWpwbOI4", + "name" : "Bend & Break", + "preview_url" : "https://p.scdn.co/mp3-preview/e3bdc5a44b62df8135f893730ce1124526b9c5c1", + "track_number" : 3, + "type" : "track", + "uri" : "spotify:track:087AcwkqBIuIebZWpwbOI4" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 275093, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5s2TY4v3WTECwelIqqqtuS" + }, + "href" : "https://api.spotify.com/v1/tracks/5s2TY4v3WTECwelIqqqtuS", + "id" : "5s2TY4v3WTECwelIqqqtuS", + "name" : "Bedshaped", + "preview_url" : "https://p.scdn.co/mp3-preview/11bcd8e1e5817414e09da5ffdca88ea97925767c", + "track_number" : 4, + "type" : "track", + "uri" : "spotify:track:5s2TY4v3WTECwelIqqqtuS" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 207653, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5Q9h1xA3xqUJyx1dDlq6MI" + }, + "href" : "https://api.spotify.com/v1/tracks/5Q9h1xA3xqUJyx1dDlq6MI", + "id" : "5Q9h1xA3xqUJyx1dDlq6MI", + "name" : "This Is The Last Time", + "preview_url" : "https://p.scdn.co/mp3-preview/4fcf428b407ca80ca4d40ebcde15642ecfda17c8", + "track_number" : 5, + "type" : "track", + "uri" : "spotify:track:5Q9h1xA3xqUJyx1dDlq6MI" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 250786, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/0BIpP7vmh35JEpT1zkv7Sl" + }, + "href" : "https://api.spotify.com/v1/tracks/0BIpP7vmh35JEpT1zkv7Sl", + "id" : "0BIpP7vmh35JEpT1zkv7Sl", + "name" : "Atlantic", + "preview_url" : "https://p.scdn.co/mp3-preview/7c1ba58788479e16da1ed98b73523bfd731683b4", + "track_number" : 6, + "type" : "track", + "uri" : "spotify:track:0BIpP7vmh35JEpT1zkv7Sl" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 185813, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/64rOSkztPrTECtWTB0F2OD" + }, + "href" : "https://api.spotify.com/v1/tracks/64rOSkztPrTECtWTB0F2OD", + "id" : "64rOSkztPrTECtWTB0F2OD", + "name" : "Is It Any Wonder?", + "preview_url" : "https://p.scdn.co/mp3-preview/aeb8fcb164cf337f5233edc62bd74d78441ea096", + "track_number" : 7, + "type" : "track", + "uri" : "spotify:track:64rOSkztPrTECtWTB0F2OD" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 239986, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5XulFHMk0X9foui8If85qV" + }, + "href" : "https://api.spotify.com/v1/tracks/5XulFHMk0X9foui8If85qV", + "id" : "5XulFHMk0X9foui8If85qV", + "name" : "Nothing In My Way", + "preview_url" : "https://p.scdn.co/mp3-preview/f10421f201ba60bcf470da0347ae0fa1eccd2195", + "track_number" : 8, + "type" : "track", + "uri" : "spotify:track:5XulFHMk0X9foui8If85qV" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 277360, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/7EbeyS7knwgd3TtJepU1On" + }, + "href" : "https://api.spotify.com/v1/tracks/7EbeyS7knwgd3TtJepU1On", + "id" : "7EbeyS7knwgd3TtJepU1On", + "name" : "Hamburg Song", + "preview_url" : "https://p.scdn.co/mp3-preview/39f70e54618d6cca3f240edcb552ed39d4fc5202", + "track_number" : 9, + "type" : "track", + "uri" : "spotify:track:7EbeyS7knwgd3TtJepU1On" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 233520, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5faIME3g9Lxo4Myf8ArY9l" + }, + "href" : "https://api.spotify.com/v1/tracks/5faIME3g9Lxo4Myf8ArY9l", + "id" : "5faIME3g9Lxo4Myf8ArY9l", + "name" : "Crystal Ball", + "preview_url" : "https://p.scdn.co/mp3-preview/8eb1a3df454cb9137771b60f26df71034fc80f47", + "track_number" : 10, + "type" : "track", + "uri" : "spotify:track:5faIME3g9Lxo4Myf8ArY9l" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 302813, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3dkTbaMEfF8mqCNSSZKB5S" + }, + "href" : "https://api.spotify.com/v1/tracks/3dkTbaMEfF8mqCNSSZKB5S", + "id" : "3dkTbaMEfF8mqCNSSZKB5S", + "name" : "A Bad Dream", + "preview_url" : "https://p.scdn.co/mp3-preview/264f4474ff324def0e3d454d769be615ab105f94", + "track_number" : 11, + "type" : "track", + "uri" : "spotify:track:3dkTbaMEfF8mqCNSSZKB5S" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 267320, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/38zl5v3L94wzbl3iQHAxNM" + }, + "href" : "https://api.spotify.com/v1/tracks/38zl5v3L94wzbl3iQHAxNM", + "id" : "38zl5v3L94wzbl3iQHAxNM", + "name" : "Try Again", + "preview_url" : "https://p.scdn.co/mp3-preview/5620e5b33fe3f2d2dcbb559029a1370aac341411", + "track_number" : 12, + "type" : "track", + "uri" : "spotify:track:38zl5v3L94wzbl3iQHAxNM" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 204013, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1K4SP6flGBk73cgshPqDCp" + }, + "href" : "https://api.spotify.com/v1/tracks/1K4SP6flGBk73cgshPqDCp", + "id" : "1K4SP6flGBk73cgshPqDCp", + "name" : "Spiralling", + "preview_url" : "https://p.scdn.co/mp3-preview/3dc0aaa8015d0fbb2377b970d9048381831953fd", + "track_number" : 13, + "type" : "track", + "uri" : "spotify:track:1K4SP6flGBk73cgshPqDCp" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 311533, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/7DNKgwHgPgbGhqdXJGkxf6" + }, + "href" : "https://api.spotify.com/v1/tracks/7DNKgwHgPgbGhqdXJGkxf6", + "id" : "7DNKgwHgPgbGhqdXJGkxf6", + "name" : "Perfect Symmetry", + "preview_url" : "https://p.scdn.co/mp3-preview/3475936f1b54849a64ea70eb6467a8a3a3800bad", + "track_number" : 14, + "type" : "track", + "uri" : "spotify:track:7DNKgwHgPgbGhqdXJGkxf6" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 289386, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3CFNKsHlpAleVotCDI78ca" + }, + "href" : "https://api.spotify.com/v1/tracks/3CFNKsHlpAleVotCDI78ca", + "id" : "3CFNKsHlpAleVotCDI78ca", + "name" : "My Shadow", + "preview_url" : "https://p.scdn.co/mp3-preview/bf11da166dc76f5f4392a57146467e36e7173cc9", + "track_number" : 15, + "type" : "track", + "uri" : "spotify:track:3CFNKsHlpAleVotCDI78ca" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 196333, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5OVyLOs64kq6zL12QrQD6o" + }, + "href" : "https://api.spotify.com/v1/tracks/5OVyLOs64kq6zL12QrQD6o", + "id" : "5OVyLOs64kq6zL12QrQD6o", + "name" : "Silenced By The Night", + "preview_url" : "https://p.scdn.co/mp3-preview/ab222c63169f5b847c24ebfe21875d9313ec8bc8", + "track_number" : 16, + "type" : "track", + "uri" : "spotify:track:5OVyLOs64kq6zL12QrQD6o" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 236973, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5AHNNMMn7dApuo4OuqZcPb" + }, + "href" : "https://api.spotify.com/v1/tracks/5AHNNMMn7dApuo4OuqZcPb", + "id" : "5AHNNMMn7dApuo4OuqZcPb", + "name" : "Disconnected", + "preview_url" : "https://p.scdn.co/mp3-preview/8a5201b1a061c5bfca5db879d22c580d7a9eb99a", + "track_number" : 17, + "type" : "track", + "uri" : "spotify:track:5AHNNMMn7dApuo4OuqZcPb" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 208133, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5wPQMzWTFxKI0Aw3I3OJG6" + }, + "href" : "https://api.spotify.com/v1/tracks/5wPQMzWTFxKI0Aw3I3OJG6", + "id" : "5wPQMzWTFxKI0Aw3I3OJG6", + "name" : "Sovereign Light Café", + "preview_url" : "https://p.scdn.co/mp3-preview/5df8fdaa9938b599b9bbc7fbd2cfea2c2bd3a734", + "track_number" : 18, + "type" : "track", + "uri" : "spotify:track:5wPQMzWTFxKI0Aw3I3OJG6" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 201653, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1Vz9mv3ITvzSxm9sH2pAdn" + }, + "href" : "https://api.spotify.com/v1/tracks/1Vz9mv3ITvzSxm9sH2pAdn", + "id" : "1Vz9mv3ITvzSxm9sH2pAdn", + "name" : "Higher Than The Sun", + "preview_url" : "https://p.scdn.co/mp3-preview/75ea8651daefb9da6cbca3e6d4e970e7b8b84693", + "track_number" : 19, + "type" : "track", + "uri" : "spotify:track:1Vz9mv3ITvzSxm9sH2pAdn" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 222426, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3FYyMnHLaImyLctEoXZolK" + }, + "href" : "https://api.spotify.com/v1/tracks/3FYyMnHLaImyLctEoXZolK", + "id" : "3FYyMnHLaImyLctEoXZolK", + "name" : "Won't Be Broken", + "preview_url" : "https://p.scdn.co/mp3-preview/2c8dfeb19ead5b96dcf34858b43b96a9e6d70117", + "track_number" : 20, + "type" : "track", + "uri" : "spotify:track:3FYyMnHLaImyLctEoXZolK" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 229533, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/0wnewiCeFaZQKejFECOzS2" + }, + "href" : "https://api.spotify.com/v1/tracks/0wnewiCeFaZQKejFECOzS2", + "id" : "0wnewiCeFaZQKejFECOzS2", + "name" : "Snowed Under", + "preview_url" : "https://p.scdn.co/mp3-preview/5a04228466a49f12e839bf3001d6c15eef015953", + "track_number" : 1, + "type" : "track", + "uri" : "spotify:track:0wnewiCeFaZQKejFECOzS2" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 217440, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5sqAs4udmaaTWn6xXTpmGL" + }, + "href" : "https://api.spotify.com/v1/tracks/5sqAs4udmaaTWn6xXTpmGL", + "id" : "5sqAs4udmaaTWn6xXTpmGL", + "name" : "Walnut Tree", + "preview_url" : "https://p.scdn.co/mp3-preview/834c91889c0d86d4e3f724150976919844c5baa7", + "track_number" : 2, + "type" : "track", + "uri" : "spotify:track:5sqAs4udmaaTWn6xXTpmGL" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 332973, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1WvLaBfQpk3dv3ciU0we8f" + }, + "href" : "https://api.spotify.com/v1/tracks/1WvLaBfQpk3dv3ciU0we8f", + "id" : "1WvLaBfQpk3dv3ciU0we8f", + "name" : "Fly To Me", + "preview_url" : "https://p.scdn.co/mp3-preview/06bc6f513cb7406660182e0a9a24b19238be019c", + "track_number" : 3, + "type" : "track", + "uri" : "spotify:track:1WvLaBfQpk3dv3ciU0we8f" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 182733, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1UBiGrtXAKjc0C7GG937pD" + }, + "href" : "https://api.spotify.com/v1/tracks/1UBiGrtXAKjc0C7GG937pD", + "id" : "1UBiGrtXAKjc0C7GG937pD", + "name" : "To The End Of The Earth", + "preview_url" : "https://p.scdn.co/mp3-preview/b347bf5ce7c9fc4fc823ab1bc98f119194d06a66", + "track_number" : 4, + "type" : "track", + "uri" : "spotify:track:1UBiGrtXAKjc0C7GG937pD" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ ], + "disc_number" : 2, + "duration_ms" : 196826, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/7eNyrwrLzbO8URXaaSU9g1" + }, + "href" : "https://api.spotify.com/v1/tracks/7eNyrwrLzbO8URXaaSU9g1", + "id" : "7eNyrwrLzbO8URXaaSU9g1", + "name" : "The Way You Want It", + "preview_url" : null, + "track_number" : 5, + "type" : "track", + "uri" : "spotify:track:7eNyrwrLzbO8URXaaSU9g1" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 286200, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5JLkkHYBZHUpQKnrIIVhpV" + }, + "href" : "https://api.spotify.com/v1/tracks/5JLkkHYBZHUpQKnrIIVhpV", + "id" : "5JLkkHYBZHUpQKnrIIVhpV", + "name" : "Something In Me Was Dying", + "preview_url" : "https://p.scdn.co/mp3-preview/79aa74fde8a0da6bb6ebdbbac6fd3b081ececace", + "track_number" : 6, + "type" : "track", + "uri" : "spotify:track:5JLkkHYBZHUpQKnrIIVhpV" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ ], + "disc_number" : 2, + "duration_ms" : 263200, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/6aTi9DrnoLLvVdFSfzUuKP" + }, + "href" : "https://api.spotify.com/v1/tracks/6aTi9DrnoLLvVdFSfzUuKP", + "id" : "6aTi9DrnoLLvVdFSfzUuKP", + "name" : "Allemande", + "preview_url" : null, + "track_number" : 7, + "type" : "track", + "uri" : "spotify:track:6aTi9DrnoLLvVdFSfzUuKP" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 249426, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1igaBkvf5KZFTsu1fMfDfb" + }, + "href" : "https://api.spotify.com/v1/tracks/1igaBkvf5KZFTsu1fMfDfb", + "id" : "1igaBkvf5KZFTsu1fMfDfb", + "name" : "Let It Slide", + "preview_url" : "https://p.scdn.co/mp3-preview/a4905211b213f0443c6302585e241071a25055df", + "track_number" : 8, + "type" : "track", + "uri" : "spotify:track:1igaBkvf5KZFTsu1fMfDfb" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 216200, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/4rCgYClAhCLuf9xD2Y8sI6" + }, + "href" : "https://api.spotify.com/v1/tracks/4rCgYClAhCLuf9xD2Y8sI6", + "id" : "4rCgYClAhCLuf9xD2Y8sI6", + "name" : "He Used To Be A Lovely Boy", + "preview_url" : "https://p.scdn.co/mp3-preview/d238b8f92367915eb08c389a55b35c4353aa4cc5", + "track_number" : 9, + "type" : "track", + "uri" : "spotify:track:4rCgYClAhCLuf9xD2Y8sI6" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 236986, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/2RsfSyrYHjUtGeCVBf6ib2" + }, + "href" : "https://api.spotify.com/v1/tracks/2RsfSyrYHjUtGeCVBf6ib2", + "id" : "2RsfSyrYHjUtGeCVBf6ib2", + "name" : "Thin Air", + "preview_url" : "https://p.scdn.co/mp3-preview/95f2501973e2571c16c85efa1fc8ab92bf187739", + "track_number" : 10, + "type" : "track", + "uri" : "spotify:track:2RsfSyrYHjUtGeCVBf6ib2" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 269880, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/2UwM9vm7I4wx3RxGx8DR17" + }, + "href" : "https://api.spotify.com/v1/tracks/2UwM9vm7I4wx3RxGx8DR17", + "id" : "2UwM9vm7I4wx3RxGx8DR17", + "name" : "The Iron Sea", + "preview_url" : "https://p.scdn.co/mp3-preview/e75172d8becfd594645de8e070e4473edebbedf0", + "track_number" : 11, + "type" : "track", + "uri" : "spotify:track:2UwM9vm7I4wx3RxGx8DR17" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 235440, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/2WMpag1ouW7zIySG8PcrIW" + }, + "href" : "https://api.spotify.com/v1/tracks/2WMpag1ouW7zIySG8PcrIW", + "id" : "2WMpag1ouW7zIySG8PcrIW", + "name" : "Maybe I Can Change", + "preview_url" : "https://p.scdn.co/mp3-preview/e84716f556f8d770605f78c2ddacb5a879bb49a2", + "track_number" : 12, + "type" : "track", + "uri" : "spotify:track:2WMpag1ouW7zIySG8PcrIW" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 229586, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/7ngI6zHe2AA4YncwFytNR1" + }, + "href" : "https://api.spotify.com/v1/tracks/7ngI6zHe2AA4YncwFytNR1", + "id" : "7ngI6zHe2AA4YncwFytNR1", + "name" : "Time To Go", + "preview_url" : "https://p.scdn.co/mp3-preview/5413cb1452a1c5a0a6aaa49d5ec289d8e9f28dc1", + "track_number" : 13, + "type" : "track", + "uri" : "spotify:track:7ngI6zHe2AA4YncwFytNR1" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 230880, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/2BUKGneA8BFCelJhoCIZ7u" + }, + "href" : "https://api.spotify.com/v1/tracks/2BUKGneA8BFCelJhoCIZ7u", + "id" : "2BUKGneA8BFCelJhoCIZ7u", + "name" : "Staring At The Ceiling", + "preview_url" : "https://p.scdn.co/mp3-preview/744949b7bf0d516eac9a7a231ead9b623d073574", + "track_number" : 14, + "type" : "track", + "uri" : "spotify:track:2BUKGneA8BFCelJhoCIZ7u" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 294693, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/7rY5n8rnQnNwAtnNfCUQ0O" + }, + "href" : "https://api.spotify.com/v1/tracks/7rY5n8rnQnNwAtnNfCUQ0O", + "id" : "7rY5n8rnQnNwAtnNfCUQ0O", + "name" : "Myth", + "preview_url" : "https://p.scdn.co/mp3-preview/a69a1fc94953c480bde888dcb82eab9a1cac91fc", + "track_number" : 15, + "type" : "track", + "uri" : "spotify:track:7rY5n8rnQnNwAtnNfCUQ0O" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 224986, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/0SY7oTzyTMpiXgP4ufO7VW" + }, + "href" : "https://api.spotify.com/v1/tracks/0SY7oTzyTMpiXgP4ufO7VW", + "id" : "0SY7oTzyTMpiXgP4ufO7VW", + "name" : "Difficult Child", + "preview_url" : "https://p.scdn.co/mp3-preview/e48a7b0b0fa708312b4850c97d28337c215a2c95", + "track_number" : 16, + "type" : "track", + "uri" : "spotify:track:0SY7oTzyTMpiXgP4ufO7VW" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 221200, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/7dDuGGxttttGh0h9CJ4cUu" + }, + "href" : "https://api.spotify.com/v1/tracks/7dDuGGxttttGh0h9CJ4cUu", + "id" : "7dDuGGxttttGh0h9CJ4cUu", + "name" : "Sea Fog - Live At Arena Ciudad De Mexico, Mexico City / 2012", + "preview_url" : "https://p.scdn.co/mp3-preview/a940bc357a2cd29cae8e5dfe337c874baf334b82", + "track_number" : 17, + "type" : "track", + "uri" : "spotify:track:7dDuGGxttttGh0h9CJ4cUu" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 2, + "duration_ms" : 394786, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/0bxCO9Bbm1SkK9BU2DbsYg" + }, + "href" : "https://api.spotify.com/v1/tracks/0bxCO9Bbm1SkK9BU2DbsYg", + "id" : "0bxCO9Bbm1SkK9BU2DbsYg", + "name" : "Russian Farmer's Song", + "preview_url" : "https://p.scdn.co/mp3-preview/59264a05ed0ce01ba5b78f3b9507fe80b3aea94e", + "track_number" : 18, + "type" : "track", + "uri" : "spotify:track:0bxCO9Bbm1SkK9BU2DbsYg" + } ], + "limit" : 50, + "next" : null, + "offset" : 0, + "previous" : null, + "total" : 38 + }, + "type" : "album", + "uri" : "spotify:album:41MnTivkwTO3UUJ8DrqEJJ" + }, { + "album_type" : "album", + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "copyrights" : [ { + "text" : "(C) 2012 Universal Island Records, a division of Universal Music Operations Limited", + "type" : "C" + }, { + "text" : "(P) 2012 Universal Island Records, a division of Universal Music Operations Limited", + "type" : "P" + } ], + "external_ids" : { + "upc" : "00602537055425" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6JWc4iAiJ9FjyK0B59ABb4" + }, + "genres" : [ ], + "href" : "https://api.spotify.com/v1/albums/6JWc4iAiJ9FjyK0B59ABb4", + "id" : "6JWc4iAiJ9FjyK0B59ABb4", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/be368b4f8b3dbcb7bcb39c0707fd33447c1ec398", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/24f4e188d0bedc8e1d2a8e3f242aa9c3ec4b6729", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/b31365a528a6a8e1e8b4c8a2d5d1d4b48b672122", + "width" : 64 + } ], + "name" : "Strangeland", + "popularity" : 53, + "release_date" : "2012-01-01", + "release_date_precision" : "day", + "tracks" : { + "href" : "https://api.spotify.com/v1/albums/6JWc4iAiJ9FjyK0B59ABb4/tracks?offset=0&limit=50", + "items" : [ { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 214666, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/07h75cQlaZBLwwyeWTeIZX" + }, + "href" : "https://api.spotify.com/v1/tracks/07h75cQlaZBLwwyeWTeIZX", + "id" : "07h75cQlaZBLwwyeWTeIZX", + "name" : "You Are Young", + "preview_url" : "https://p.scdn.co/mp3-preview/77459b8644db7f0b14d1a04f9732619bca75d3c9", + "track_number" : 1, + "type" : "track", + "uri" : "spotify:track:07h75cQlaZBLwwyeWTeIZX" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 196466, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/0BhGZmaQ1SET53qGkGvwxD" + }, + "href" : "https://api.spotify.com/v1/tracks/0BhGZmaQ1SET53qGkGvwxD", + "id" : "0BhGZmaQ1SET53qGkGvwxD", + "name" : "Silenced By The Night", + "preview_url" : "https://p.scdn.co/mp3-preview/801c7eecca00b1880c75a15cff92043dbc0d6878", + "track_number" : 2, + "type" : "track", + "uri" : "spotify:track:0BhGZmaQ1SET53qGkGvwxD" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 237893, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1wL2u2BP9T3cpskdffyfn5" + }, + "href" : "https://api.spotify.com/v1/tracks/1wL2u2BP9T3cpskdffyfn5", + "id" : "1wL2u2BP9T3cpskdffyfn5", + "name" : "Disconnected", + "preview_url" : "https://p.scdn.co/mp3-preview/210fed3f055f5c275bfac85894acd076f84c8d65", + "track_number" : 3, + "type" : "track", + "uri" : "spotify:track:1wL2u2BP9T3cpskdffyfn5" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 220386, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3Wxu8QRCZdTvwFvwtWOMst" + }, + "href" : "https://api.spotify.com/v1/tracks/3Wxu8QRCZdTvwFvwtWOMst", + "id" : "3Wxu8QRCZdTvwFvwtWOMst", + "name" : "Watch How You Go", + "preview_url" : "https://p.scdn.co/mp3-preview/155dd49cb3c54702b139d6de388ace09041d3a16", + "track_number" : 4, + "type" : "track", + "uri" : "spotify:track:3Wxu8QRCZdTvwFvwtWOMst" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 218840, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/4QRkCwqwHFaZ7xeoR9CHL6" + }, + "href" : "https://api.spotify.com/v1/tracks/4QRkCwqwHFaZ7xeoR9CHL6", + "id" : "4QRkCwqwHFaZ7xeoR9CHL6", + "name" : "Sovereign Light Café", + "preview_url" : "https://p.scdn.co/mp3-preview/3f44115c51b854605f707a9d24903cad7b27e6b8", + "track_number" : 5, + "type" : "track", + "uri" : "spotify:track:4QRkCwqwHFaZ7xeoR9CHL6" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 236733, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/4IGKv5K4HbAfufzf2OUEg0" + }, + "href" : "https://api.spotify.com/v1/tracks/4IGKv5K4HbAfufzf2OUEg0", + "id" : "4IGKv5K4HbAfufzf2OUEg0", + "name" : "On The Road", + "preview_url" : "https://p.scdn.co/mp3-preview/0fd8c40ab8fb97a4a9e69b3b5c4669cbcfcef330", + "track_number" : 6, + "type" : "track", + "uri" : "spotify:track:4IGKv5K4HbAfufzf2OUEg0" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 252333, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3jQg3xqVv1H6Y3jp6FzR3M" + }, + "href" : "https://api.spotify.com/v1/tracks/3jQg3xqVv1H6Y3jp6FzR3M", + "id" : "3jQg3xqVv1H6Y3jp6FzR3M", + "name" : "The Starting Line", + "preview_url" : "https://p.scdn.co/mp3-preview/693b6baa37c37ee1a90e12b24e92c3145663c007", + "track_number" : 7, + "type" : "track", + "uri" : "spotify:track:3jQg3xqVv1H6Y3jp6FzR3M" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 226560, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3NT6rwZk7igASQR4HJFP0x" + }, + "href" : "https://api.spotify.com/v1/tracks/3NT6rwZk7igASQR4HJFP0x", + "id" : "3NT6rwZk7igASQR4HJFP0x", + "name" : "Black Rain", + "preview_url" : "https://p.scdn.co/mp3-preview/68932717dfc96a006b3d2f30f0899bc7b5b6e83c", + "track_number" : 8, + "type" : "track", + "uri" : "spotify:track:3NT6rwZk7igASQR4HJFP0x" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 292946, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1QKQ8eP3aEsW4LEd42umP6" + }, + "href" : "https://api.spotify.com/v1/tracks/1QKQ8eP3aEsW4LEd42umP6", + "id" : "1QKQ8eP3aEsW4LEd42umP6", + "name" : "Neon River", + "preview_url" : "https://p.scdn.co/mp3-preview/da1d919d5b2b59392577e3a55335fcd93e4d40bd", + "track_number" : 9, + "type" : "track", + "uri" : "spotify:track:1QKQ8eP3aEsW4LEd42umP6" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 191906, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/7uuSUJdpPRoXeR37IAV1a0" + }, + "href" : "https://api.spotify.com/v1/tracks/7uuSUJdpPRoXeR37IAV1a0", + "id" : "7uuSUJdpPRoXeR37IAV1a0", + "name" : "Day Will Come", + "preview_url" : "https://p.scdn.co/mp3-preview/b2ba652d57410f72e1d4d34f96f72277701aa6d6", + "track_number" : 10, + "type" : "track", + "uri" : "spotify:track:7uuSUJdpPRoXeR37IAV1a0" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 223800, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/6dksuIyuNHcFVcx9ixCMbq" + }, + "href" : "https://api.spotify.com/v1/tracks/6dksuIyuNHcFVcx9ixCMbq", + "id" : "6dksuIyuNHcFVcx9ixCMbq", + "name" : "In Your Own Time", + "preview_url" : "https://p.scdn.co/mp3-preview/a9950ccfb4db1596840e9696a3b7db6cebab200d", + "track_number" : 11, + "type" : "track", + "uri" : "spotify:track:6dksuIyuNHcFVcx9ixCMbq" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 203386, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/7F4jALhmdEQv49Dy6tNYLq" + }, + "href" : "https://api.spotify.com/v1/tracks/7F4jALhmdEQv49Dy6tNYLq", + "id" : "7F4jALhmdEQv49Dy6tNYLq", + "name" : "Sea Fog", + "preview_url" : "https://p.scdn.co/mp3-preview/7e31e76de98d697f17610af2a0e0d7a823b48e71", + "track_number" : 12, + "type" : "track", + "uri" : "spotify:track:7F4jALhmdEQv49Dy6tNYLq" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 276440, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1VI5LFMf7SFbcT3dz8XYHJ" + }, + "href" : "https://api.spotify.com/v1/tracks/1VI5LFMf7SFbcT3dz8XYHJ", + "id" : "1VI5LFMf7SFbcT3dz8XYHJ", + "name" : "Strangeland - Bonus Track", + "preview_url" : "https://p.scdn.co/mp3-preview/873eeb6117633d8d66540ffcfc106fb57564acd2", + "track_number" : 13, + "type" : "track", + "uri" : "spotify:track:1VI5LFMf7SFbcT3dz8XYHJ" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 210986, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/75Zc9ZHq8PY7NMtkIpbwM0" + }, + "href" : "https://api.spotify.com/v1/tracks/75Zc9ZHq8PY7NMtkIpbwM0", + "id" : "75Zc9ZHq8PY7NMtkIpbwM0", + "name" : "Run With Me - Bonus Track", + "preview_url" : "https://p.scdn.co/mp3-preview/068afaf6676c7edd937222f5f916e638481ddaba", + "track_number" : 14, + "type" : "track", + "uri" : "spotify:track:75Zc9ZHq8PY7NMtkIpbwM0" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 212560, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/4dsiRFi3mmpI0pklauyoQx" + }, + "href" : "https://api.spotify.com/v1/tracks/4dsiRFi3mmpI0pklauyoQx", + "id" : "4dsiRFi3mmpI0pklauyoQx", + "name" : "The Boys - Bonus Track", + "preview_url" : "https://p.scdn.co/mp3-preview/f6dc960a09c8e10b7a5525914170101140f8e333", + "track_number" : 15, + "type" : "track", + "uri" : "spotify:track:4dsiRFi3mmpI0pklauyoQx" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 229200, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3GmNkKokMo8RgUxMdgRbiR" + }, + "href" : "https://api.spotify.com/v1/tracks/3GmNkKokMo8RgUxMdgRbiR", + "id" : "3GmNkKokMo8RgUxMdgRbiR", + "name" : "It's Not True - Bonus Track", + "preview_url" : "https://p.scdn.co/mp3-preview/806f8f7110acdf970db90840f0d3d3f95353379f", + "track_number" : 16, + "type" : "track", + "uri" : "spotify:track:3GmNkKokMo8RgUxMdgRbiR" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 210120, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/2BLnrhqfHx6G3ZAnHzIYxI" + }, + "href" : "https://api.spotify.com/v1/tracks/2BLnrhqfHx6G3ZAnHzIYxI", + "id" : "2BLnrhqfHx6G3ZAnHzIYxI", + "name" : "Silenced By The Night - Bonus Track", + "preview_url" : "https://p.scdn.co/mp3-preview/0fb339bdcd390f43c8fd00114fb7b1dac11617a9", + "track_number" : 17, + "type" : "track", + "uri" : "spotify:track:2BLnrhqfHx6G3ZAnHzIYxI" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 272671, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5uwUXAth3No4DVv6x4lXQ9" + }, + "href" : "https://api.spotify.com/v1/tracks/5uwUXAth3No4DVv6x4lXQ9", + "id" : "5uwUXAth3No4DVv6x4lXQ9", + "name" : "The Starting Line - Bonus Track", + "preview_url" : "https://p.scdn.co/mp3-preview/5350d96164b2bb17d5711334b30eefd5dac0043c", + "track_number" : 18, + "type" : "track", + "uri" : "spotify:track:5uwUXAth3No4DVv6x4lXQ9" + } ], + "limit" : 50, + "next" : null, + "offset" : 0, + "previous" : null, + "total" : 18 + }, + "type" : "album", + "uri" : "spotify:album:6JWc4iAiJ9FjyK0B59ABb4" + }, { + "album_type" : "album", + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "copyrights" : [ { + "text" : "(C) 2010 Universal Island Records Ltd. A Universal Music Company.", + "type" : "C" + }, { + "text" : "(P) 2010 Universal Island Records Ltd. A Universal Music Company.", + "type" : "P" + } ], + "external_ids" : { + "upc" : "00602527420608" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6UXCm6bOO4gFlDQZV5yL37" + }, + "genres" : [ ], + "href" : "https://api.spotify.com/v1/albums/6UXCm6bOO4gFlDQZV5yL37", + "id" : "6UXCm6bOO4gFlDQZV5yL37", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/a969ab6750172e5284b1f3a3dd985e3a3839f5c5", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/5a0e940ee6e5d8dc4d7a77df70277709050d10be", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/1e21ac3f484c184c0b168bfed2b4fbff1d03c4ab", + "width" : 64 + } ], + "name" : "Night Train", + "popularity" : 39, + "release_date" : "2010-01-01", + "release_date_precision" : "day", + "tracks" : { + "href" : "https://api.spotify.com/v1/albums/6UXCm6bOO4gFlDQZV5yL37/tracks?offset=0&limit=50", + "items" : [ { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 83546, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3ugblcbYKHrhIvRL4IVY20" + }, + "href" : "https://api.spotify.com/v1/tracks/3ugblcbYKHrhIvRL4IVY20", + "id" : "3ugblcbYKHrhIvRL4IVY20", + "name" : "House Lights", + "preview_url" : "https://p.scdn.co/mp3-preview/36b8ecff155ad6e9d7682f753c642fe48900d19a", + "track_number" : 1, + "type" : "track", + "uri" : "spotify:track:3ugblcbYKHrhIvRL4IVY20" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 232320, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/06qEl8bMI8qCJiB68M0Ab6" + }, + "href" : "https://api.spotify.com/v1/tracks/06qEl8bMI8qCJiB68M0Ab6", + "id" : "06qEl8bMI8qCJiB68M0Ab6", + "name" : "Back In Time", + "preview_url" : "https://p.scdn.co/mp3-preview/bac9cec3411411bdceed91cf18061b3e0bf1646d", + "track_number" : 2, + "type" : "track", + "uri" : "spotify:track:06qEl8bMI8qCJiB68M0Ab6" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/7pGyQZx9thVa8GxMBeXscB" + }, + "href" : "https://api.spotify.com/v1/artists/7pGyQZx9thVa8GxMBeXscB", + "id" : "7pGyQZx9thVa8GxMBeXscB", + "name" : "K'NAAN", + "type" : "artist", + "uri" : "spotify:artist:7pGyQZx9thVa8GxMBeXscB" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 246800, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3R1MKirozQBVYaBErWy8LB" + }, + "href" : "https://api.spotify.com/v1/tracks/3R1MKirozQBVYaBErWy8LB", + "id" : "3R1MKirozQBVYaBErWy8LB", + "name" : "Stop For A Minute", + "preview_url" : "https://p.scdn.co/mp3-preview/e2d22f632e556a8d68d41290f4d64cb11c0fa3ec", + "track_number" : 3, + "type" : "track", + "uri" : "spotify:track:3R1MKirozQBVYaBErWy8LB" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 293106, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5TWT6yV2KdJAMH9lblIRi6" + }, + "href" : "https://api.spotify.com/v1/tracks/5TWT6yV2KdJAMH9lblIRi6", + "id" : "5TWT6yV2KdJAMH9lblIRi6", + "name" : "Clear Skies", + "preview_url" : "https://p.scdn.co/mp3-preview/ec4f00fba6b0ec2ba4ec2b8cc7faac79cbe9bd0a", + "track_number" : 4, + "type" : "track", + "uri" : "spotify:track:5TWT6yV2KdJAMH9lblIRi6" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/0I8EcYNKMh0Pj6CGJovHOT" + }, + "href" : "https://api.spotify.com/v1/artists/0I8EcYNKMh0Pj6CGJovHOT", + "id" : "0I8EcYNKMh0Pj6CGJovHOT", + "name" : "Tigarah", + "type" : "artist", + "uri" : "spotify:artist:0I8EcYNKMh0Pj6CGJovHOT" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 236706, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1IEVCAISZpS9GiAdZkHTR6" + }, + "href" : "https://api.spotify.com/v1/tracks/1IEVCAISZpS9GiAdZkHTR6", + "id" : "1IEVCAISZpS9GiAdZkHTR6", + "name" : "Ishin Denshin (You've Got To Help Yourself)", + "preview_url" : "https://p.scdn.co/mp3-preview/b1217e00e762770534aed53e4109f514f049766f", + "track_number" : 5, + "type" : "track", + "uri" : "spotify:track:1IEVCAISZpS9GiAdZkHTR6" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 276720, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1EAoq7c9LRsJIo2bAt4Lxr" + }, + "href" : "https://api.spotify.com/v1/tracks/1EAoq7c9LRsJIo2bAt4Lxr", + "id" : "1EAoq7c9LRsJIo2bAt4Lxr", + "name" : "Your Love", + "preview_url" : "https://p.scdn.co/mp3-preview/8db14d0124403200fd14c33d7d2b234fa627ff74", + "track_number" : 6, + "type" : "track", + "uri" : "spotify:track:1EAoq7c9LRsJIo2bAt4Lxr" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/7pGyQZx9thVa8GxMBeXscB" + }, + "href" : "https://api.spotify.com/v1/artists/7pGyQZx9thVa8GxMBeXscB", + "id" : "7pGyQZx9thVa8GxMBeXscB", + "name" : "K'NAAN", + "type" : "artist", + "uri" : "spotify:artist:7pGyQZx9thVa8GxMBeXscB" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 226480, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/2ctReR81XVD8JPlJqJqF1C" + }, + "href" : "https://api.spotify.com/v1/tracks/2ctReR81XVD8JPlJqJqF1C", + "id" : "2ctReR81XVD8JPlJqJqF1C", + "name" : "Looking Back", + "preview_url" : "https://p.scdn.co/mp3-preview/a379bcd0dfb21162d2337f51b5d89e67a94ae755", + "track_number" : 7, + "type" : "track", + "uri" : "spotify:track:2ctReR81XVD8JPlJqJqF1C" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 289360, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1lqTqfWG6dOUR1DHav23JH" + }, + "href" : "https://api.spotify.com/v1/tracks/1lqTqfWG6dOUR1DHav23JH", + "id" : "1lqTqfWG6dOUR1DHav23JH", + "name" : "My Shadow", + "preview_url" : "https://p.scdn.co/mp3-preview/63f4dbf7c5e792d19eb773f1dfc351e20fd0f139", + "track_number" : 8, + "type" : "track", + "uri" : "spotify:track:1lqTqfWG6dOUR1DHav23JH" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/53A0W3U0s8diEn9RhXQhVz" + }, + "href" : "https://api.spotify.com/v1/artists/53A0W3U0s8diEn9RhXQhVz", + "id" : "53A0W3U0s8diEn9RhXQhVz", + "name" : "Keane", + "type" : "artist", + "uri" : "spotify:artist:53A0W3U0s8diEn9RhXQhVz" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 619079, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1OiJZvD8pQmgLwA0HU3YLs" + }, + "href" : "https://api.spotify.com/v1/tracks/1OiJZvD8pQmgLwA0HU3YLs", + "id" : "1OiJZvD8pQmgLwA0HU3YLs", + "name" : "Night Train Track By Track Commentary", + "preview_url" : "https://p.scdn.co/mp3-preview/387cd4efd9b9c16425cf8e0e77aa7cf174878572", + "track_number" : 9, + "type" : "track", + "uri" : "spotify:track:1OiJZvD8pQmgLwA0HU3YLs" + } ], + "limit" : 50, + "next" : null, + "offset" : 0, + "previous" : null, + "total" : 9 + }, + "type" : "album", + "uri" : "spotify:album:6UXCm6bOO4gFlDQZV5yL37" + } ] +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-albums-tracks/ + */ +var getAlbumTracks : SpotifyApi.AlbumTracksResponse = { + "href" : "https://api.spotify.com/v1/albums/6akEvsycLGftJxYudPjmqK/tracks?offset=0&limit=2", + "items" : [ { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/08td7MxkoHQkXnWAYD8d6Q" + }, + "href" : "https://api.spotify.com/v1/artists/08td7MxkoHQkXnWAYD8d6Q", + "id" : "08td7MxkoHQkXnWAYD8d6Q", + "name" : "Tania Bowra", + "type" : "artist", + "uri" : "spotify:artist:08td7MxkoHQkXnWAYD8d6Q" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 276773, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/2TpxZ7JUBn3uw46aR7qd6V" + }, + "href" : "https://api.spotify.com/v1/tracks/2TpxZ7JUBn3uw46aR7qd6V", + "id" : "2TpxZ7JUBn3uw46aR7qd6V", + "name" : "All I Want", + "preview_url" : "https://p.scdn.co/mp3-preview/12b8cee72118f995f5494e1b34251e4ac997445e", + "track_number" : 1, + "type" : "track", + "uri" : "spotify:track:2TpxZ7JUBn3uw46aR7qd6V" + }, { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/08td7MxkoHQkXnWAYD8d6Q" + }, + "href" : "https://api.spotify.com/v1/artists/08td7MxkoHQkXnWAYD8d6Q", + "id" : "08td7MxkoHQkXnWAYD8d6Q", + "name" : "Tania Bowra", + "type" : "artist", + "uri" : "spotify:artist:08td7MxkoHQkXnWAYD8d6Q" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 247680, + "explicit" : false, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/4PjcfyZZVE10TFd9EKA72r" + }, + "href" : "https://api.spotify.com/v1/tracks/4PjcfyZZVE10TFd9EKA72r", + "id" : "4PjcfyZZVE10TFd9EKA72r", + "name" : "Someday", + "preview_url" : "https://p.scdn.co/mp3-preview/4a54d83c195d0bc17b1b23fc931d37fb363224d8", + "track_number" : 2, + "type" : "track", + "uri" : "spotify:track:4PjcfyZZVE10TFd9EKA72r" + } ], + "limit" : 2, + "next" : "https://api.spotify.com/v1/albums/6akEvsycLGftJxYudPjmqK/tracks?offset=2&limit=2", + "offset" : 0, + "previous" : null, + "total" : 11 +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-artist/ + */ +var getAnArtist : SpotifyApi.SingleArtistResponse = { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/0OdUWJ0sBjDrqHygGUXeCF" + }, + "followers" : { + "href" : null, + "total" : 416433 + }, + "genres" : [ "indie folk", "indie pop" ], + "href" : "https://api.spotify.com/v1/artists/0OdUWJ0sBjDrqHygGUXeCF", + "id" : "0OdUWJ0sBjDrqHygGUXeCF", + "images" : [ { + "height" : 816, + "url" : "https://i.scdn.co/image/eb266625dab075341e8c4378a177a27370f91903", + "width" : 1000 + }, { + "height" : 522, + "url" : "https://i.scdn.co/image/2f91c3cace3c5a6a48f3d0e2fd21364d4911b332", + "width" : 640 + }, { + "height" : 163, + "url" : "https://i.scdn.co/image/2efc93d7ee88435116093274980f04ebceb7b527", + "width" : 200 + }, { + "height" : 52, + "url" : "https://i.scdn.co/image/4f25297750dfa4051195c36809a9049f6b841a23", + "width" : 64 + } ], + "name" : "Band of Horses", + "popularity" : 66, + "type" : "artist", + "uri" : "spotify:artist:0OdUWJ0sBjDrqHygGUXeCF" +}; + + + +/** + * Tests https://developer.spotify.com/web-api/get-several-artists/ + */ +var getSeveralArtists : SpotifyApi.MultipleArtistsResponse = { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/0oSGxfWSnnOXhD2fKuz2Gy" + }, + "followers" : { + "href" : null, + "total" : 910485 + }, + "genres" : [ "art rock", "glam rock", "permanent wave" ], + "href" : "https://api.spotify.com/v1/artists/0oSGxfWSnnOXhD2fKuz2Gy", + "id" : "0oSGxfWSnnOXhD2fKuz2Gy", + "images" : [ { + "height" : 1000, + "url" : "https://i.scdn.co/image/32bd9707b42a2c081482ec9cd3ffa8879f659f95", + "width" : 1000 + }, { + "height" : 640, + "url" : "https://i.scdn.co/image/865f24753e5e4f40a383bf24a9cdda598a4559a8", + "width" : 640 + }, { + "height" : 200, + "url" : "https://i.scdn.co/image/7ddd6fa5cf78aee2f2e8b347616151393022b7d9", + "width" : 200 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/c8dc28c191432862afce298216458a6f00bbfbd8", + "width" : 64 + } ], + "name" : "David Bowie", + "popularity" : 72, + "type" : "artist", + "uri" : "spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/3dBVyJ7JuOMt4GE9607Qin" + }, + "followers" : { + "href" : null, + "total" : 83707 + }, + "genres" : [ "glam rock", "protopunk" ], + "href" : "https://api.spotify.com/v1/artists/3dBVyJ7JuOMt4GE9607Qin", + "id" : "3dBVyJ7JuOMt4GE9607Qin", + "images" : [ { + "height" : 1300, + "url" : "https://i.scdn.co/image/5515a710c94ccd4edd8b9a0587778ed5e3f997da", + "width" : 1000 + }, { + "height" : 832, + "url" : "https://i.scdn.co/image/c990e667b4ca8240c73b0db06e6d76a3b27ce929", + "width" : 640 + }, { + "height" : 260, + "url" : "https://i.scdn.co/image/de2fa1d11c59e63143117d44ec9990b9e40451a2", + "width" : 200 + }, { + "height" : 83, + "url" : "https://i.scdn.co/image/b39638735adb4a4a54621293b99ab65c546f605e", + "width" : 64 + } ], + "name" : "T. Rex", + "popularity" : 55, + "type" : "artist", + "uri" : "spotify:artist:3dBVyJ7JuOMt4GE9607Qin" + } ] +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-artists-albums/ + */ +var getArtistsAlbums : SpotifyApi.ArtistsAlbumsResponse = { + "href" : "https://api.spotify.com/v1/artists/1vCWHaC5f2uS3yhpwWbIA6/albums?offset=0&limit=2&album_type=single", + "items" : [ { + "album_type" : "single", + "available_markets" : [ "CA", "MX", "US" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/3qmjJVxvSp5k7seea8z0PU" + }, + "href" : "https://api.spotify.com/v1/albums/3qmjJVxvSp5k7seea8z0PU", + "id" : "3qmjJVxvSp5k7seea8z0PU", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/47827fbf1492983ba2eae4d109ca44467126d4c4", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/eec169cb9c70bde4998c437d37cb849b47572f7a", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/df36cadc3eeb0fb6b8da7c6490e53a2f1229775b", + "width" : 64 + } ], + "name" : "Broken Arrows (Remixes)", + "type" : "album", + "uri" : "spotify:album:3qmjJVxvSp5k7seea8z0PU" + }, { + "album_type" : "single", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/4nCNj68SZym6hNxXDkRtjN" + }, + "href" : "https://api.spotify.com/v1/albums/4nCNj68SZym6hNxXDkRtjN", + "id" : "4nCNj68SZym6hNxXDkRtjN", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/c735be011394f4e7cdf1ebbf95d112cb69fd3414", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/7f4221fda86e4daa539fd29233fadad039cc46d9", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/e1930bf1293d89799a0e382b40ebad5455b11857", + "width" : 64 + } ], + "name" : "Broken Arrows (Remixes)", + "type" : "album", + "uri" : "spotify:album:4nCNj68SZym6hNxXDkRtjN" + } ], + "limit" : 2, + "next" : "https://api.spotify.com/v1/artists/1vCWHaC5f2uS3yhpwWbIA6/albums?offset=2&limit=2&album_type=single", + "offset" : 0, + "previous" : null, + "total" : 168 +}; + + + +var getArtistsTopTracks : SpotifyApi.ArtistsTopTracksResponse = { + "tracks" : [ { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6zk4RKl6JFlgLCV4Z7DQ7N" + }, + "href" : "https://api.spotify.com/v1/albums/6zk4RKl6JFlgLCV4Z7DQ7N", + "id" : "6zk4RKl6JFlgLCV4Z7DQ7N", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/1b4845d0abd116eab69a3059ec0a0374030e0261", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/2a12ad8c66ce0ed90bd127fcc5701251e169688c", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/73cf829fee9a9ac481e60b1bf919bc9fb20753e6", + "width" : 64 + } ], + "name" : "Elvis' Christmas Album", + "type" : "album", + "uri" : "spotify:album:6zk4RKl6JFlgLCV4Z7DQ7N" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/43ZHCT0cAZBISjO8DG9PnE" + }, + "href" : "https://api.spotify.com/v1/artists/43ZHCT0cAZBISjO8DG9PnE", + "id" : "43ZHCT0cAZBISjO8DG9PnE", + "name" : "Elvis Presley", + "type" : "artist", + "uri" : "spotify:artist:43ZHCT0cAZBISjO8DG9PnE" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 129173, + "explicit" : false, + "external_ids" : { + "isrc" : "USRC15701155" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3QiAAp20rPC3dcAtKtMaqQ" + }, + "href" : "https://api.spotify.com/v1/tracks/3QiAAp20rPC3dcAtKtMaqQ", + "id" : "3QiAAp20rPC3dcAtKtMaqQ", + "name" : "Blue Christmas", + "popularity" : 80, + "preview_url" : "https://p.scdn.co/mp3-preview/ddcfe1df4783b2e41f494dec4b13917fb8e1465d", + "track_number" : 5, + "type" : "track", + "uri" : "spotify:track:3QiAAp20rPC3dcAtKtMaqQ" + }, { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6zk4RKl6JFlgLCV4Z7DQ7N" + }, + "href" : "https://api.spotify.com/v1/albums/6zk4RKl6JFlgLCV4Z7DQ7N", + "id" : "6zk4RKl6JFlgLCV4Z7DQ7N", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/1b4845d0abd116eab69a3059ec0a0374030e0261", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/2a12ad8c66ce0ed90bd127fcc5701251e169688c", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/73cf829fee9a9ac481e60b1bf919bc9fb20753e6", + "width" : 64 + } ], + "name" : "Elvis' Christmas Album", + "type" : "album", + "uri" : "spotify:album:6zk4RKl6JFlgLCV4Z7DQ7N" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/43ZHCT0cAZBISjO8DG9PnE" + }, + "href" : "https://api.spotify.com/v1/artists/43ZHCT0cAZBISjO8DG9PnE", + "id" : "43ZHCT0cAZBISjO8DG9PnE", + "name" : "Elvis Presley", + "type" : "artist", + "uri" : "spotify:artist:43ZHCT0cAZBISjO8DG9PnE" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 115826, + "explicit" : false, + "external_ids" : { + "isrc" : "USRC15701156" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/7n7VsX3sv66znBwA8b5uhp" + }, + "href" : "https://api.spotify.com/v1/tracks/7n7VsX3sv66znBwA8b5uhp", + "id" : "7n7VsX3sv66znBwA8b5uhp", + "name" : "Here Comes Santa Claus (Right Down Santa Claus Lane)", + "popularity" : 72, + "preview_url" : "https://p.scdn.co/mp3-preview/6a21a6141687ff9b2f0bede600ff1f6c85bcd8d1", + "track_number" : 3, + "type" : "track", + "uri" : "spotify:track:7n7VsX3sv66znBwA8b5uhp" + }, { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/7xe8VI48TxUpU1IIo0RfGi" + }, + "href" : "https://api.spotify.com/v1/albums/7xe8VI48TxUpU1IIo0RfGi", + "id" : "7xe8VI48TxUpU1IIo0RfGi", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/479ec1fcd836348926b576260b5be92503f8b0a4", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/255a1b0e1cb4edda647854db0f438e3af78e3018", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/49e1648ce6f47aa0ccb6cc50929c898528557cf3", + "width" : 64 + } ], + "name" : "Blue Hawaii", + "type" : "album", + "uri" : "spotify:album:7xe8VI48TxUpU1IIo0RfGi" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/43ZHCT0cAZBISjO8DG9PnE" + }, + "href" : "https://api.spotify.com/v1/artists/43ZHCT0cAZBISjO8DG9PnE", + "id" : "43ZHCT0cAZBISjO8DG9PnE", + "name" : "Elvis Presley", + "type" : "artist", + "uri" : "spotify:artist:43ZHCT0cAZBISjO8DG9PnE" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 179773, + "explicit" : false, + "external_ids" : { + "isrc" : "USRC16101350" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/44AyOl4qVkzS48vBsbNXaC" + }, + "href" : "https://api.spotify.com/v1/tracks/44AyOl4qVkzS48vBsbNXaC", + "id" : "44AyOl4qVkzS48vBsbNXaC", + "name" : "Can't Help Falling in Love", + "popularity" : 70, + "preview_url" : "https://p.scdn.co/mp3-preview/26e409b39a2da6dc18fab61020c90be2938dc0e9", + "track_number" : 5, + "type" : "track", + "uri" : "spotify:track:44AyOl4qVkzS48vBsbNXaC" + }, { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/270qabVGN0kCo2SJQn5a72" + }, + "href" : "https://api.spotify.com/v1/albums/270qabVGN0kCo2SJQn5a72", + "id" : "270qabVGN0kCo2SJQn5a72", + "images" : [ { + "height" : 636, + "url" : "https://i.scdn.co/image/258782c56c531d9dff4b7e5f2192764d98e6b99b", + "width" : 640 + }, { + "height" : 298, + "url" : "https://i.scdn.co/image/3a59000a810f7e4ac234b1c4a6acb84f19a43d4e", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/cce7105a3e441834b892a6d5e57893e55ec3ec09", + "width" : 64 + } ], + "name" : "The Classic Christmas Album", + "type" : "album", + "uri" : "spotify:album:270qabVGN0kCo2SJQn5a72" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/43ZHCT0cAZBISjO8DG9PnE" + }, + "href" : "https://api.spotify.com/v1/artists/43ZHCT0cAZBISjO8DG9PnE", + "id" : "43ZHCT0cAZBISjO8DG9PnE", + "name" : "Elvis Presley", + "type" : "artist", + "uri" : "spotify:artist:43ZHCT0cAZBISjO8DG9PnE" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/3P33qFNGBVXl86yQYWspFj" + }, + "href" : "https://api.spotify.com/v1/artists/3P33qFNGBVXl86yQYWspFj", + "id" : "3P33qFNGBVXl86yQYWspFj", + "name" : "Martina McBride", + "type" : "artist", + "uri" : "spotify:artist:3P33qFNGBVXl86yQYWspFj" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 148546, + "explicit" : false, + "external_ids" : { + "isrc" : "USRN10800437" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/7upOqYZUQvA0nyVroaHeSg" + }, + "href" : "https://api.spotify.com/v1/tracks/7upOqYZUQvA0nyVroaHeSg", + "id" : "7upOqYZUQvA0nyVroaHeSg", + "name" : "Blue Christmas", + "popularity" : 48, + "preview_url" : "https://p.scdn.co/mp3-preview/64edbec4b760d1c2bc0606f6d7c11c9a244c0155", + "track_number" : 9, + "type" : "track", + "uri" : "spotify:track:7upOqYZUQvA0nyVroaHeSg" + }, { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/0C3t1htEDTFKcg7F2rNbek" + }, + "href" : "https://api.spotify.com/v1/albums/0C3t1htEDTFKcg7F2rNbek", + "id" : "0C3t1htEDTFKcg7F2rNbek", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/97f150dc58d9900133e895f8e61e2087621dccdc", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/0b45ca0a9e6c03137e7f733a9bd8856f63143702", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/185d20742c42d78ff0f58f3c970565ddc9217c94", + "width" : 64 + } ], + "name" : "Elvis' Golden Records", + "type" : "album", + "uri" : "spotify:album:0C3t1htEDTFKcg7F2rNbek" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/43ZHCT0cAZBISjO8DG9PnE" + }, + "href" : "https://api.spotify.com/v1/artists/43ZHCT0cAZBISjO8DG9PnE", + "id" : "43ZHCT0cAZBISjO8DG9PnE", + "name" : "Elvis Presley", + "type" : "artist", + "uri" : "spotify:artist:43ZHCT0cAZBISjO8DG9PnE" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 146480, + "explicit" : false, + "external_ids" : { + "isrc" : "USRC15705223" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/4gphxUgq0JSFv2BCLhNDiE" + }, + "href" : "https://api.spotify.com/v1/tracks/4gphxUgq0JSFv2BCLhNDiE", + "id" : "4gphxUgq0JSFv2BCLhNDiE", + "name" : "Jailhouse Rock", + "popularity" : 66, + "preview_url" : "https://p.scdn.co/mp3-preview/29990f669b5328b6c40320596a2b14d8660cdb54", + "track_number" : 5, + "type" : "track", + "uri" : "spotify:track:4gphxUgq0JSFv2BCLhNDiE" + }, { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6zk4RKl6JFlgLCV4Z7DQ7N" + }, + "href" : "https://api.spotify.com/v1/albums/6zk4RKl6JFlgLCV4Z7DQ7N", + "id" : "6zk4RKl6JFlgLCV4Z7DQ7N", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/1b4845d0abd116eab69a3059ec0a0374030e0261", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/2a12ad8c66ce0ed90bd127fcc5701251e169688c", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/73cf829fee9a9ac481e60b1bf919bc9fb20753e6", + "width" : 64 + } ], + "name" : "Elvis' Christmas Album", + "type" : "album", + "uri" : "spotify:album:6zk4RKl6JFlgLCV4Z7DQ7N" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/43ZHCT0cAZBISjO8DG9PnE" + }, + "href" : "https://api.spotify.com/v1/artists/43ZHCT0cAZBISjO8DG9PnE", + "id" : "43ZHCT0cAZBISjO8DG9PnE", + "name" : "Elvis Presley", + "type" : "artist", + "uri" : "spotify:artist:43ZHCT0cAZBISjO8DG9PnE" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 113333, + "explicit" : false, + "external_ids" : { + "isrc" : "USRC15701158" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/2hON3z0PTxwx9u4zzEyFRo" + }, + "href" : "https://api.spotify.com/v1/tracks/2hON3z0PTxwx9u4zzEyFRo", + "id" : "2hON3z0PTxwx9u4zzEyFRo", + "name" : "Santa Bring My Baby Back (To Me)", + "popularity" : 66, + "preview_url" : "https://p.scdn.co/mp3-preview/2c83cc06efce130b5dfb855657b308b946689ce2", + "track_number" : 6, + "type" : "track", + "uri" : "spotify:track:2hON3z0PTxwx9u4zzEyFRo" + }, { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/38lhaWsw8PImY1pIIlKyDJ" + }, + "href" : "https://api.spotify.com/v1/albums/38lhaWsw8PImY1pIIlKyDJ", + "id" : "38lhaWsw8PImY1pIIlKyDJ", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/5f52605ad70e4ee4d79fce461d94b6f6142e24ef", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/781849a6b88350d11ffb9c5b095eb1b4fae23b25", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/53dcb2071ce2b77d633eee3a7ae6768dcdc6d60a", + "width" : 64 + } ], + "name" : "Back In Memphis", + "type" : "album", + "uri" : "spotify:album:38lhaWsw8PImY1pIIlKyDJ" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/43ZHCT0cAZBISjO8DG9PnE" + }, + "href" : "https://api.spotify.com/v1/artists/43ZHCT0cAZBISjO8DG9PnE", + "id" : "43ZHCT0cAZBISjO8DG9PnE", + "name" : "Elvis Presley", + "type" : "artist", + "uri" : "spotify:artist:43ZHCT0cAZBISjO8DG9PnE" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 263973, + "explicit" : false, + "external_ids" : { + "isrc" : "USRC16901355" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1OtWwtGFPXVhdAVKZHwrNF" + }, + "href" : "https://api.spotify.com/v1/tracks/1OtWwtGFPXVhdAVKZHwrNF", + "id" : "1OtWwtGFPXVhdAVKZHwrNF", + "name" : "Suspicious Minds", + "popularity" : 66, + "preview_url" : "https://p.scdn.co/mp3-preview/1577e9e4e6f90ef513ff274024db9c7cb56703d7", + "track_number" : 14, + "type" : "track", + "uri" : "spotify:track:1OtWwtGFPXVhdAVKZHwrNF" + }, { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6zk4RKl6JFlgLCV4Z7DQ7N" + }, + "href" : "https://api.spotify.com/v1/albums/6zk4RKl6JFlgLCV4Z7DQ7N", + "id" : "6zk4RKl6JFlgLCV4Z7DQ7N", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/1b4845d0abd116eab69a3059ec0a0374030e0261", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/2a12ad8c66ce0ed90bd127fcc5701251e169688c", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/73cf829fee9a9ac481e60b1bf919bc9fb20753e6", + "width" : 64 + } ], + "name" : "Elvis' Christmas Album", + "type" : "album", + "uri" : "spotify:album:6zk4RKl6JFlgLCV4Z7DQ7N" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/43ZHCT0cAZBISjO8DG9PnE" + }, + "href" : "https://api.spotify.com/v1/artists/43ZHCT0cAZBISjO8DG9PnE", + "id" : "43ZHCT0cAZBISjO8DG9PnE", + "name" : "Elvis Presley", + "type" : "artist", + "uri" : "spotify:artist:43ZHCT0cAZBISjO8DG9PnE" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 145000, + "explicit" : false, + "external_ids" : { + "isrc" : "USRC15706998" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/6cw1OgKsuEWQbmQb5Z4a3T" + }, + "href" : "https://api.spotify.com/v1/tracks/6cw1OgKsuEWQbmQb5Z4a3T", + "id" : "6cw1OgKsuEWQbmQb5Z4a3T", + "name" : "Silent Night", + "popularity" : 66, + "preview_url" : "https://p.scdn.co/mp3-preview/b4d48860e3e19f0449920f5b1e08cd36739e107d", + "track_number" : 8, + "type" : "track", + "uri" : "spotify:track:6cw1OgKsuEWQbmQb5Z4a3T" + }, { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6zk4RKl6JFlgLCV4Z7DQ7N" + }, + "href" : "https://api.spotify.com/v1/albums/6zk4RKl6JFlgLCV4Z7DQ7N", + "id" : "6zk4RKl6JFlgLCV4Z7DQ7N", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/1b4845d0abd116eab69a3059ec0a0374030e0261", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/2a12ad8c66ce0ed90bd127fcc5701251e169688c", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/73cf829fee9a9ac481e60b1bf919bc9fb20753e6", + "width" : 64 + } ], + "name" : "Elvis' Christmas Album", + "type" : "album", + "uri" : "spotify:album:6zk4RKl6JFlgLCV4Z7DQ7N" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/43ZHCT0cAZBISjO8DG9PnE" + }, + "href" : "https://api.spotify.com/v1/artists/43ZHCT0cAZBISjO8DG9PnE", + "id" : "43ZHCT0cAZBISjO8DG9PnE", + "name" : "Elvis Presley", + "type" : "artist", + "uri" : "spotify:artist:43ZHCT0cAZBISjO8DG9PnE" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 142600, + "explicit" : false, + "external_ids" : { + "isrc" : "USRC15701161" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5b1jXYUOgAX5QAHXPVHdld" + }, + "href" : "https://api.spotify.com/v1/tracks/5b1jXYUOgAX5QAHXPVHdld", + "id" : "5b1jXYUOgAX5QAHXPVHdld", + "name" : "Santa Claus Is Back In Town", + "popularity" : 65, + "preview_url" : "https://p.scdn.co/mp3-preview/88e57383420e295ea5ca4c626d2a042d6ac64c1e", + "track_number" : 1, + "type" : "track", + "uri" : "spotify:track:5b1jXYUOgAX5QAHXPVHdld" + }, { + "album" : { + "album_type" : "compilation", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/34EYk8vvJHCUlNrpGxepea" + }, + "href" : "https://api.spotify.com/v1/albums/34EYk8vvJHCUlNrpGxepea", + "id" : "34EYk8vvJHCUlNrpGxepea", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/6324fe377dcedf110025527873dafc9b7ee0bb34", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/d2e2148023e8a87b7a2f8d2abdfa936154e470b8", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/af45f7b48d8a4c7252e1b1ad9240ed8b08c06b31", + "width" : 64 + } ], + "name" : "Elvis 75 - Good Rockin' Tonight", + "type" : "album", + "uri" : "spotify:album:34EYk8vvJHCUlNrpGxepea" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/43ZHCT0cAZBISjO8DG9PnE" + }, + "href" : "https://api.spotify.com/v1/artists/43ZHCT0cAZBISjO8DG9PnE", + "id" : "43ZHCT0cAZBISjO8DG9PnE", + "name" : "Elvis Presley", + "type" : "artist", + "uri" : "spotify:artist:43ZHCT0cAZBISjO8DG9PnE" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/6EkPaTMpQmLwR7CgYiKHha" + }, + "href" : "https://api.spotify.com/v1/artists/6EkPaTMpQmLwR7CgYiKHha", + "id" : "6EkPaTMpQmLwR7CgYiKHha", + "name" : "JXL", + "type" : "artist", + "uri" : "spotify:artist:6EkPaTMpQmLwR7CgYiKHha" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 4, + "duration_ms" : 211173, + "explicit" : false, + "external_ids" : { + "isrc" : "USRC10200288" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/4l2hnfUx0esSbITQa7iJt0" + }, + "href" : "https://api.spotify.com/v1/tracks/4l2hnfUx0esSbITQa7iJt0", + "id" : "4l2hnfUx0esSbITQa7iJt0", + "name" : "A Little Less Conversation - JXL Radio Edit Remix", + "popularity" : 63, + "preview_url" : "https://p.scdn.co/mp3-preview/d257e518f4a17cf3f46475e6759b76b4c934f2ad", + "track_number" : 19, + "type" : "track", + "uri" : "spotify:track:4l2hnfUx0esSbITQa7iJt0" + } ] +}; + + + + +var getArtistRelatedArtists : SpotifyApi.ArtistsRelatedArtistsResponse = { + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/0JDkhL4rjiPNEp92jAgJnS" + }, + "followers" : { + "href" : null, + "total" : 127811 + }, + "genres" : [ "brill building pop", "rock-and-roll", "rockabilly" ], + "href" : "https://api.spotify.com/v1/artists/0JDkhL4rjiPNEp92jAgJnS", + "id" : "0JDkhL4rjiPNEp92jAgJnS", + "images" : [ { + "height" : 1373, + "url" : "https://i.scdn.co/image/7f1b3c37612225eb475418cce5fad6c4b899028d", + "width" : 1000 + }, { + "height" : 879, + "url" : "https://i.scdn.co/image/b5137cd3489bd841acc464f0f381ae2c9adc0a40", + "width" : 640 + }, { + "height" : 275, + "url" : "https://i.scdn.co/image/664df3c8d77780e9871a1e80ee0389e84fa82ddc", + "width" : 200 + }, { + "height" : 88, + "url" : "https://i.scdn.co/image/6479926a4a97dd7ddddc70b7fb87c6b7de0d705d", + "width" : 64 + } ], + "name" : "Roy Orbison", + "popularity" : 60, + "type" : "artist", + "uri" : "spotify:artist:0JDkhL4rjiPNEp92jAgJnS" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2zyz0VJqrDXeFDIyrfVXSo" + }, + "followers" : { + "href" : null, + "total" : 65322 + }, + "genres" : [ "rock-and-roll", "rockabilly" ], + "href" : "https://api.spotify.com/v1/artists/2zyz0VJqrDXeFDIyrfVXSo", + "id" : "2zyz0VJqrDXeFDIyrfVXSo", + "images" : [ { + "height" : 1278, + "url" : "https://i.scdn.co/image/9ff799b50db2f8f5fe8eaec5daac36e1792f3cb3", + "width" : 1000 + }, { + "height" : 818, + "url" : "https://i.scdn.co/image/198a68c93e80bd7384678d62100bddca884ffff7", + "width" : 640 + }, { + "height" : 256, + "url" : "https://i.scdn.co/image/ce87f34433255b9cd3889ee7e6af10f168cee9b4", + "width" : 200 + }, { + "height" : 82, + "url" : "https://i.scdn.co/image/d050407ffb44438e02830d6125b1bd2b955d5731", + "width" : 64 + } ], + "name" : "Jerry Lee Lewis", + "popularity" : 53, + "type" : "artist", + "uri" : "spotify:artist:2zyz0VJqrDXeFDIyrfVXSo" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/3wYyutjgII8LJVVOLrGI0D" + }, + "followers" : { + "href" : null, + "total" : 95371 + }, + "genres" : [ "rock-and-roll", "rockabilly" ], + "href" : "https://api.spotify.com/v1/artists/3wYyutjgII8LJVVOLrGI0D", + "id" : "3wYyutjgII8LJVVOLrGI0D", + "images" : [ { + "height" : 1266, + "url" : "https://i.scdn.co/image/e8246f90d11c6d4985069cc4b29c0a1e41e75241", + "width" : 1000 + }, { + "height" : 810, + "url" : "https://i.scdn.co/image/9a6b7bce7b052c7c12412bbdfd50cf85eb05b81e", + "width" : 640 + }, { + "height" : 253, + "url" : "https://i.scdn.co/image/2c2b311b63e4e91739b419b1e8382d6421e680b3", + "width" : 200 + }, { + "height" : 81, + "url" : "https://i.scdn.co/image/5cef984df6a60c96520c952ef85923de0907a512", + "width" : 64 + } ], + "name" : "Buddy Holly", + "popularity" : 55, + "type" : "artist", + "uri" : "spotify:artist:3wYyutjgII8LJVVOLrGI0D" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/73sSFVlM6pkweLXE8qw1OS" + }, + "followers" : { + "href" : null, + "total" : 26194 + }, + "genres" : [ "rock-and-roll", "rockabilly" ], + "href" : "https://api.spotify.com/v1/artists/73sSFVlM6pkweLXE8qw1OS", + "id" : "73sSFVlM6pkweLXE8qw1OS", + "images" : [ { + "height" : 1129, + "url" : "https://i.scdn.co/image/53b1e360f7e4978410529ee7a971c3f8a4118622", + "width" : 1000 + }, { + "height" : 723, + "url" : "https://i.scdn.co/image/e4eb935b9af1f78735e9e25e8e75e3685b81fdd8", + "width" : 640 + }, { + "height" : 226, + "url" : "https://i.scdn.co/image/d6f709471d825cb9cf991acb77b7fb87667c0de1", + "width" : 200 + }, { + "height" : 72, + "url" : "https://i.scdn.co/image/6ced7f8bcb6a04e22dd357c4110fa0e4349933cd", + "width" : 64 + } ], + "name" : "Ricky Nelson", + "popularity" : 46, + "type" : "artist", + "uri" : "spotify:artist:73sSFVlM6pkweLXE8qw1OS" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/5hIClg6noTaCzMu2s5wp4f" + }, + "followers" : { + "href" : null, + "total" : 15528 + }, + "genres" : [ "rock-and-roll", "rockabilly" ], + "href" : "https://api.spotify.com/v1/artists/5hIClg6noTaCzMu2s5wp4f", + "id" : "5hIClg6noTaCzMu2s5wp4f", + "images" : [ { + "height" : 737, + "url" : "https://i.scdn.co/image/02b340629ddcc41fe48932fba641312f27de49a7", + "width" : 999 + }, { + "height" : 472, + "url" : "https://i.scdn.co/image/c99b5bc0bd9bfd566c6f64eccf9ae6426aaeff20", + "width" : 640 + }, { + "height" : 147, + "url" : "https://i.scdn.co/image/a2240effbf0c00539348d81e90380a14a51651cc", + "width" : 199 + }, { + "height" : 47, + "url" : "https://i.scdn.co/image/9af48c6576925720e3d43aacdd7797c52e1a639b", + "width" : 64 + } ], + "name" : "Carl Perkins", + "popularity" : 44, + "type" : "artist", + "uri" : "spotify:artist:5hIClg6noTaCzMu2s5wp4f" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/4ACplpEqD6JIVgKrafauzs" + }, + "followers" : { + "href" : null, + "total" : 44959 + }, + "genres" : [ "brill building pop", "rock-and-roll", "rockabilly" ], + "href" : "https://api.spotify.com/v1/artists/4ACplpEqD6JIVgKrafauzs", + "id" : "4ACplpEqD6JIVgKrafauzs", + "images" : [ { + "height" : 1035, + "url" : "https://i.scdn.co/image/bf582c9e540c2f12771cfd032f592d31697cfae9", + "width" : 1000 + }, { + "height" : 662, + "url" : "https://i.scdn.co/image/da7c23421146985b7e1583d3bc09ecba9f7ac5c6", + "width" : 640 + }, { + "height" : 207, + "url" : "https://i.scdn.co/image/b430dbc0ed1d6926b9088440683d15270e5154cc", + "width" : 200 + }, { + "height" : 66, + "url" : "https://i.scdn.co/image/985afca7544c6933b7e7ada2018c4ed0b4bba7a0", + "width" : 64 + } ], + "name" : "The Everly Brothers", + "popularity" : 53, + "type" : "artist", + "uri" : "spotify:artist:4ACplpEqD6JIVgKrafauzs" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/4xls23Ye9WR9yy3yYMpAMm" + }, + "followers" : { + "href" : null, + "total" : 62897 + }, + "genres" : [ "rock-and-roll", "rockabilly" ], + "href" : "https://api.spotify.com/v1/artists/4xls23Ye9WR9yy3yYMpAMm", + "id" : "4xls23Ye9WR9yy3yYMpAMm", + "images" : [ { + "height" : 1181, + "url" : "https://i.scdn.co/image/b4db13fb1d2e2872d7b7eac4b17d67870482f16f", + "width" : 1000 + }, { + "height" : 756, + "url" : "https://i.scdn.co/image/217387b531599ffb81751ab8629c4baf78d85c4e", + "width" : 640 + }, { + "height" : 236, + "url" : "https://i.scdn.co/image/82fe8f7a2d139b7c746b5ff6985f6b186113dd75", + "width" : 200 + }, { + "height" : 76, + "url" : "https://i.scdn.co/image/de0d8715aa69bdbbd1236c6c88528ff93804e86d", + "width" : 64 + } ], + "name" : "Little Richard", + "popularity" : 55, + "type" : "artist", + "uri" : "spotify:artist:4xls23Ye9WR9yy3yYMpAMm" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/1p0t3JtUTayV2wb1RGN9mO" + }, + "followers" : { + "href" : null, + "total" : 26019 + }, + "genres" : [ "rock-and-roll", "rockabilly" ], + "href" : "https://api.spotify.com/v1/artists/1p0t3JtUTayV2wb1RGN9mO", + "id" : "1p0t3JtUTayV2wb1RGN9mO", + "images" : [ { + "height" : 752, + "url" : "https://i.scdn.co/image/6c3d2f6c26991828bf2d776fc468b929ca31304a", + "width" : 648 + }, { + "height" : 743, + "url" : "https://i.scdn.co/image/21c81243f2df0b3ce5cdcd7af629beef7e8af76e", + "width" : 640 + }, { + "height" : 232, + "url" : "https://i.scdn.co/image/9a800b3323b9edcdb0267aad068aedd594cc1fd1", + "width" : 200 + }, { + "height" : 74, + "url" : "https://i.scdn.co/image/5b01110b8def5978979b9bd946612e353028828d", + "width" : 64 + } ], + "name" : "Eddie Cochran", + "popularity" : 48, + "type" : "artist", + "uri" : "spotify:artist:1p0t3JtUTayV2wb1RGN9mO" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/293zczrfYafIItmnmM3coR" + }, + "followers" : { + "href" : null, + "total" : 155572 + }, + "genres" : [ "rock-and-roll", "rockabilly" ], + "href" : "https://api.spotify.com/v1/artists/293zczrfYafIItmnmM3coR", + "id" : "293zczrfYafIItmnmM3coR", + "images" : [ { + "height" : 1198, + "url" : "https://i.scdn.co/image/806ae8389df74bb2f8df1adf64c67c0e6dc76048", + "width" : 1000 + }, { + "height" : 766, + "url" : "https://i.scdn.co/image/f07a0dc93bde1aa294355c26b2a75edaa274c8f8", + "width" : 640 + }, { + "height" : 240, + "url" : "https://i.scdn.co/image/c5d23d159328aa908baaeeff6fa4855cf8519999", + "width" : 200 + }, { + "height" : 77, + "url" : "https://i.scdn.co/image/98006c221cbcc29bc9746757e69fa896fd0a5640", + "width" : 64 + } ], + "name" : "Chuck Berry", + "popularity" : 65, + "type" : "artist", + "uri" : "spotify:artist:293zczrfYafIItmnmM3coR" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/5Y9xEAGW4GwGJgbiI6W85P" + }, + "followers" : { + "href" : null, + "total" : 29285 + }, + "genres" : [ "rock-and-roll", "rockabilly" ], + "href" : "https://api.spotify.com/v1/artists/5Y9xEAGW4GwGJgbiI6W85P", + "id" : "5Y9xEAGW4GwGJgbiI6W85P", + "images" : [ { + "height" : 719, + "url" : "https://i.scdn.co/image/02da1b78ba9cad76b662cff4d0fdf41f20bbc67d", + "width" : 1000 + }, { + "height" : 460, + "url" : "https://i.scdn.co/image/be6d7f39b75ff62aadc113d4c2142291821bdc0d", + "width" : 640 + }, { + "height" : 144, + "url" : "https://i.scdn.co/image/1f234198e2d01e415acdc058956993c89f842b32", + "width" : 200 + }, { + "height" : 46, + "url" : "https://i.scdn.co/image/f1a5f9fc9ad095d419313308b38f805e42c05dcf", + "width" : 64 + } ], + "name" : "Ritchie Valens", + "popularity" : 50, + "type" : "artist", + "uri" : "spotify:artist:5Y9xEAGW4GwGJgbiI6W85P" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/4cPHsZM98sKzmV26wlwD2W" + }, + "followers" : { + "href" : null, + "total" : 25168 + }, + "genres" : [ ], + "href" : "https://api.spotify.com/v1/artists/4cPHsZM98sKzmV26wlwD2W", + "id" : "4cPHsZM98sKzmV26wlwD2W", + "images" : [ { + "height" : 1469, + "url" : "https://i.scdn.co/image/b2d04f712c91bcf98a28ce1a8c2f674ddb724ec6", + "width" : 1000 + }, { + "height" : 940, + "url" : "https://i.scdn.co/image/4ca270764861f2e13851b8e5110bb96ba7f39359", + "width" : 640 + }, { + "height" : 294, + "url" : "https://i.scdn.co/image/89ecdb230bcc12e980ce58fd88d20cc6dbc5b388", + "width" : 200 + }, { + "height" : 94, + "url" : "https://i.scdn.co/image/2e615b79eb4c945b7a57e241448e681d7f2da8bd", + "width" : 64 + } ], + "name" : "Brenda Lee", + "popularity" : 68, + "type" : "artist", + "uri" : "spotify:artist:4cPHsZM98sKzmV26wlwD2W" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2XBzvyw3fwtZu4iUz12x0G" + }, + "followers" : { + "href" : null, + "total" : 12228 + }, + "genres" : [ "rock-and-roll", "rockabilly" ], + "href" : "https://api.spotify.com/v1/artists/2XBzvyw3fwtZu4iUz12x0G", + "id" : "2XBzvyw3fwtZu4iUz12x0G", + "images" : [ { + "height" : 809, + "url" : "https://i.scdn.co/image/8e9c925577ff4d563f9f12324453be1b5d026494", + "width" : 1000 + }, { + "height" : 518, + "url" : "https://i.scdn.co/image/37b77aa15c67c4d8763a73301360d405715a7145", + "width" : 640 + }, { + "height" : 162, + "url" : "https://i.scdn.co/image/3b2ae8fdc389ee165b7f5787fd91ae6604ff4fca", + "width" : 200 + }, { + "height" : 52, + "url" : "https://i.scdn.co/image/fb39aac889247b6528b3bbc85c1e2ef773ad2b47", + "width" : 64 + } ], + "name" : "Bill Haley", + "popularity" : 37, + "type" : "artist", + "uri" : "spotify:artist:2XBzvyw3fwtZu4iUz12x0G" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/6KWcxMWVNVIYbdOQyJtsSy" + }, + "followers" : { + "href" : null, + "total" : 46850 + }, + "genres" : [ "brill building pop" ], + "href" : "https://api.spotify.com/v1/artists/6KWcxMWVNVIYbdOQyJtsSy", + "id" : "6KWcxMWVNVIYbdOQyJtsSy", + "images" : [ { + "height" : 857, + "url" : "https://i.scdn.co/image/10557069b43b1059e6490d062a5d21154a78d69d", + "width" : 689 + }, { + "height" : 796, + "url" : "https://i.scdn.co/image/f6fa63eb8267c9381557adbb37119900c49c3734", + "width" : 640 + }, { + "height" : 249, + "url" : "https://i.scdn.co/image/634e2cd425103bfd8766a7f31adcaa0bdfedb3ac", + "width" : 200 + }, { + "height" : 80, + "url" : "https://i.scdn.co/image/864692e8803ffa885e34cbcde41acb218019c17e", + "width" : 64 + } ], + "name" : "The Platters", + "popularity" : 56, + "type" : "artist", + "uri" : "spotify:artist:6KWcxMWVNVIYbdOQyJtsSy" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/5ZKMPRDHc7qElVJFh3uRqB" + }, + "followers" : { + "href" : null, + "total" : 24305 + }, + "genres" : [ "rockabilly" ], + "href" : "https://api.spotify.com/v1/artists/5ZKMPRDHc7qElVJFh3uRqB", + "id" : "5ZKMPRDHc7qElVJFh3uRqB", + "images" : [ { + "height" : 997, + "url" : "https://i.scdn.co/image/beff5827580bcc4d129cbc0872768095eeba8c14", + "width" : 1000 + }, { + "height" : 638, + "url" : "https://i.scdn.co/image/dbabf703779789917c4dd1c0e54da62c7a45ce92", + "width" : 640 + }, { + "height" : 199, + "url" : "https://i.scdn.co/image/74761c343bec27c814b8e44e4bc095cbf1b674bb", + "width" : 200 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/0c30af5647c74fee14fb97981c23b336abbc9f21", + "width" : 64 + } ], + "name" : "Wanda Jackson", + "popularity" : 46, + "type" : "artist", + "uri" : "spotify:artist:5ZKMPRDHc7qElVJFh3uRqB" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/5VAHm7V5mnsxvQrWw3KHmx" + }, + "followers" : { + "href" : null, + "total" : 11286 + }, + "genres" : [ "rock-and-roll", "rockabilly" ], + "href" : "https://api.spotify.com/v1/artists/5VAHm7V5mnsxvQrWw3KHmx", + "id" : "5VAHm7V5mnsxvQrWw3KHmx", + "images" : [ { + "height" : 1224, + "url" : "https://i.scdn.co/image/f3f3a6df9ee1854a32a8a4e635820002c6ef32be", + "width" : 1000 + }, { + "height" : 784, + "url" : "https://i.scdn.co/image/4ebffb55a443fb401fe0233fd6c8bb42f381f235", + "width" : 640 + }, { + "height" : 245, + "url" : "https://i.scdn.co/image/12876b206cc3e3d1133a674c8e02caee88ca5285", + "width" : 200 + }, { + "height" : 78, + "url" : "https://i.scdn.co/image/4d3bf8fc93e3e0c7314c38142d38c74959c9f52d", + "width" : 64 + } ], + "name" : "Gene Vincent", + "popularity" : 40, + "type" : "artist", + "uri" : "spotify:artist:5VAHm7V5mnsxvQrWw3KHmx" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/09C0xjtosNAIXP36wTnWxd" + }, + "followers" : { + "href" : null, + "total" : 40209 + }, + "genres" : [ "new orleans blues", "rock-and-roll", "swamp pop" ], + "href" : "https://api.spotify.com/v1/artists/09C0xjtosNAIXP36wTnWxd", + "id" : "09C0xjtosNAIXP36wTnWxd", + "images" : [ { + "height" : 1170, + "url" : "https://i.scdn.co/image/1e7e3ddbe8c3862d32d35aef5e4a763718f1e370", + "width" : 1000 + }, { + "height" : 749, + "url" : "https://i.scdn.co/image/172221e04fef2e038871248b3abdecbcf8f5c131", + "width" : 640 + }, { + "height" : 234, + "url" : "https://i.scdn.co/image/5ee1c7e5f1a45125ee8315d90ca62e6afb04cc25", + "width" : 200 + }, { + "height" : 75, + "url" : "https://i.scdn.co/image/afe5d30d0286526a60aa0d37c02d5864eb24f67b", + "width" : 64 + } ], + "name" : "Fats Domino", + "popularity" : 52, + "type" : "artist", + "uri" : "spotify:artist:09C0xjtosNAIXP36wTnWxd" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/3MFp4cYuYtTZe3d3xkLLbr" + }, + "followers" : { + "href" : null, + "total" : 9304 + }, + "genres" : [ "rock-and-roll", "rockabilly" ], + "href" : "https://api.spotify.com/v1/artists/3MFp4cYuYtTZe3d3xkLLbr", + "id" : "3MFp4cYuYtTZe3d3xkLLbr", + "images" : [ { + "height" : 587, + "url" : "https://i.scdn.co/image/5ff43c4d5c1131fd5adcc4c3cab712a7ef044148", + "width" : 640 + }, { + "height" : 275, + "url" : "https://i.scdn.co/image/18b454401b7bf1ae7fe7e713ee0406f9d3246727", + "width" : 300 + }, { + "height" : 59, + "url" : "https://i.scdn.co/image/a7b0b3eeae2cfbf7419c2c3fa704992c39cf1c62", + "width" : 64 + } ], + "name" : "Bill Haley & His Comets", + "popularity" : 44, + "type" : "artist", + "uri" : "spotify:artist:3MFp4cYuYtTZe3d3xkLLbr" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/7ceUfdWq2t5nbatS6ollHh" + }, + "followers" : { + "href" : null, + "total" : 34766 + }, + "genres" : [ "adult standards", "brill building pop", "christmas", "lounge" ], + "href" : "https://api.spotify.com/v1/artists/7ceUfdWq2t5nbatS6ollHh", + "id" : "7ceUfdWq2t5nbatS6ollHh", + "images" : [ { + "height" : 1100, + "url" : "https://i.scdn.co/image/2cf68a5624e8a646d51760740d83be8a3361cb71", + "width" : 1000 + }, { + "height" : 704, + "url" : "https://i.scdn.co/image/5a571c35e1840766e3f15dabb42d86adda26da90", + "width" : 640 + }, { + "height" : 220, + "url" : "https://i.scdn.co/image/d9f7f5448bfe1492337d78c1791ab442f9b8b56a", + "width" : 200 + }, { + "height" : 70, + "url" : "https://i.scdn.co/image/5b3f6e1161dff6d711d8d1b0c9a802096aa5b87b", + "width" : 64 + } ], + "name" : "Paul Anka", + "popularity" : 55, + "type" : "artist", + "uri" : "spotify:artist:7ceUfdWq2t5nbatS6ollHh" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/7qQJQ3YtcGlqaLg5tcypN2" + }, + "followers" : { + "href" : null, + "total" : 19394 + }, + "genres" : [ "rock-and-roll" ], + "href" : "https://api.spotify.com/v1/artists/7qQJQ3YtcGlqaLg5tcypN2", + "id" : "7qQJQ3YtcGlqaLg5tcypN2", + "images" : [ { + "height" : 1250, + "url" : "https://i.scdn.co/image/10d80af483070c9a1d4636a36ca2d1f89289c933", + "width" : 1000 + }, { + "height" : 800, + "url" : "https://i.scdn.co/image/0b5b079ad92eac89fad895f309499ff772ce08c1", + "width" : 640 + }, { + "height" : 250, + "url" : "https://i.scdn.co/image/d0a244ebffff84aa94682338ca70b5d0e18790fa", + "width" : 200 + }, { + "height" : 80, + "url" : "https://i.scdn.co/image/0fdfd8a3beef84b7bc9cf9191519f6192a54764e", + "width" : 64 + } ], + "name" : "Chubby Checker", + "popularity" : 47, + "type" : "artist", + "uri" : "spotify:artist:7qQJQ3YtcGlqaLg5tcypN2" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/1T0wRBO0CK0vK8ouUMqEl5" + }, + "followers" : { + "href" : null, + "total" : 119129 + }, + "genres" : [ ], + "href" : "https://api.spotify.com/v1/artists/1T0wRBO0CK0vK8ouUMqEl5", + "id" : "1T0wRBO0CK0vK8ouUMqEl5", + "images" : [ { + "height" : 1376, + "url" : "https://i.scdn.co/image/b50aca00cc09b9f036171ea1c2a47a6db8aac968", + "width" : 1000 + }, { + "height" : 880, + "url" : "https://i.scdn.co/image/da6f2d822801f0af81bde165540f8d6891404a3e", + "width" : 640 + }, { + "height" : 275, + "url" : "https://i.scdn.co/image/37985e105605e760eb7a86866cc8eeb94b513e23", + "width" : 200 + }, { + "height" : 88, + "url" : "https://i.scdn.co/image/7931338574dcf8c2ae09dded11f1668b0110c0b0", + "width" : 64 + } ], + "name" : "Tom Jones", + "popularity" : 59, + "type" : "artist", + "uri" : "spotify:artist:1T0wRBO0CK0vK8ouUMqEl5" + } ] +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-list-featured-playlists/ + */ +var featuredPlaylists : SpotifyApi.ListOfFeaturedPlaylistsResponse = { + "message" : "Enjoy a mellow afternoon.", + "playlists" : { + "href" : "https://api.spotify.com/v1/browse/featured-playlists?country=SE×tamp=2015-12-25T15:10:15&offset=0&limit=2", + "items" : [ { + "collaborative" : false, + "external_urls" : { + "spotify" : "http://open.spotify.com/user/spotify/playlist/16BpjqQV1Ey0HeDueNDSYz" + }, + "href" : "https://api.spotify.com/v1/users/spotify/playlists/16BpjqQV1Ey0HeDueNDSYz", + "id" : "16BpjqQV1Ey0HeDueNDSYz", + "images" : [ { + "height" : 300, + "url" : "https://i.scdn.co/image/6b282f0ad7f5de8c8f04a20268376be638e8241a", + "width" : 300 + } ], + "name" : "Afternoon Acoustic", + "owner" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/spotify" + }, + "href" : "https://api.spotify.com/v1/users/spotify", + "id" : "spotify", + "type" : "user", + "uri" : "spotify:user:spotify" + }, + "public" : null, + "snapshot_id" : "ymcdjXlXzZPZClmP0Pm4iuHaWk4r5OejEOoCOIstJdfxgYNljKWePUZm2v2PzHJT", + "tracks" : { + "href" : "https://api.spotify.com/v1/users/spotify/playlists/16BpjqQV1Ey0HeDueNDSYz/tracks", + "total" : 111 + }, + "type" : "playlist", + "uri" : "spotify:user:spotify:playlist:16BpjqQV1Ey0HeDueNDSYz" + }, { + "collaborative" : false, + "external_urls" : { + "spotify" : "http://open.spotify.com/user/spotify/playlist/7nUikuZL4MgIXS43cMpQZE" + }, + "href" : "https://api.spotify.com/v1/users/spotify/playlists/7nUikuZL4MgIXS43cMpQZE", + "id" : "7nUikuZL4MgIXS43cMpQZE", + "images" : [ { + "height" : 300, + "url" : "https://i.scdn.co/image/7fbae403e487e03098c1050902e3fb83f9e4a606", + "width" : 300 + } ], + "name" : "Jazzy Christmas", + "owner" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/spotify" + }, + "href" : "https://api.spotify.com/v1/users/spotify", + "id" : "spotify", + "type" : "user", + "uri" : "spotify:user:spotify" + }, + "public" : null, + "snapshot_id" : "v2Y0q77RziNFIIFIdUrHIw6om2Wqx/kBny4u5REQYj3mcf8EFVVigOdzg8kRTJxU", + "tracks" : { + "href" : "https://api.spotify.com/v1/users/spotify/playlists/7nUikuZL4MgIXS43cMpQZE/tracks", + "total" : 22 + }, + "type" : "playlist", + "uri" : "spotify:user:spotify:playlist:7nUikuZL4MgIXS43cMpQZE" + } ], + "limit" : 2, + "next" : "https://api.spotify.com/v1/browse/featured-playlists?country=SE×tamp=2015-12-25T15:10:15&offset=2&limit=2", + "offset" : 0, + "previous" : null, + "total" : 13 + } +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-list-new-releases/ + */ +var newReleases : SpotifyApi.ListOfNewReleasesResponse = { + "albums" : { + "href" : "https://api.spotify.com/v1/browse/new-releases?country=SE&offset=0&limit=20", + "items" : [ { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/1PULmKbHeOqlkIwcDMNwD4" + }, + "href" : "https://api.spotify.com/v1/albums/1PULmKbHeOqlkIwcDMNwD4", + "id" : "1PULmKbHeOqlkIwcDMNwD4", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/377d0c66cae914111f5ee721853dc68d2cc53556", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/54ec202ec205ea6430aefce2b644d934ff0a7036", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/5897d86139c6aa6d579e85c7a49b876c70a59334", + "width" : 64 + } ], + "name" : "Sgt. Pepper's Lonely Hearts Club Band (Remastered)", + "type" : "album", + "uri" : "spotify:album:1PULmKbHeOqlkIwcDMNwD4" + }, { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/03Qh833fEdVT30Pfs93ea6" + }, + "href" : "https://api.spotify.com/v1/albums/03Qh833fEdVT30Pfs93ea6", + "id" : "03Qh833fEdVT30Pfs93ea6", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/d6028aea974c75961cb9cdc2263f5d8a8a6582bd", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/adebae7bf6a4a441bc6a5a17ca840f77df6ed3b9", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/3b0ddfadf13b9f3e74da93fcb21e4183a4d9fcc8", + "width" : 64 + } ], + "name" : "The Beatles (Remastered)", + "type" : "album", + "uri" : "spotify:album:03Qh833fEdVT30Pfs93ea6" + }, { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/2Pqkn9Dq2DFtdfkKAeqgMd" + }, + "href" : "https://api.spotify.com/v1/albums/2Pqkn9Dq2DFtdfkKAeqgMd", + "id" : "2Pqkn9Dq2DFtdfkKAeqgMd", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/9cab76ad73ce2adbacbd118ebc632255ce7c1841", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/a650b9dadd2b2d66ab9d7788abdcbfab45b2997d", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/b00a9daeee0a66bd3723d723cce6134cf3c38303", + "width" : 64 + } ], + "name" : "Abbey Road (Remastered)", + "type" : "album", + "uri" : "spotify:album:2Pqkn9Dq2DFtdfkKAeqgMd" + }, { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/3OdI6e43crvyAHhaqpxSyz" + }, + "href" : "https://api.spotify.com/v1/albums/3OdI6e43crvyAHhaqpxSyz", + "id" : "3OdI6e43crvyAHhaqpxSyz", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/a7f271263055adb87353c76b2e5ebbdec07e92a9", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/8bc940347ba801f90614d9cda11f995b096cca52", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/f945ab4ae2c9e9d85dcd6c81cfe012860db9c2bc", + "width" : 64 + } ], + "name" : "Rubber Soul (Remastered)", + "type" : "album", + "uri" : "spotify:album:3OdI6e43crvyAHhaqpxSyz" + }, { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/0PYyrqs9NXtxPhf0CZkq2L" + }, + "href" : "https://api.spotify.com/v1/albums/0PYyrqs9NXtxPhf0CZkq2L", + "id" : "0PYyrqs9NXtxPhf0CZkq2L", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/6ed84deed3993bbdfb644f91cb9db2a85b25da38", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/b868b08257b96def9260e1a7e547be11bd8c26b0", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/1760ab1210d0ebbda3094e6945db559b7483a1dd", + "width" : 64 + } ], + "name" : "Revolver (Remastered)", + "type" : "album", + "uri" : "spotify:album:0PYyrqs9NXtxPhf0CZkq2L" + }, { + "album_type" : "single", + "available_markets" : [ "AU", "HK", "MY", "NZ", "PH", "SG", "TW", "BG", "CY", "EE", "FI", "GR", "LT", "LV", "RO", "TR", "AD", "AT", "BE", "CH", "CZ", "DE", "DK", "ES", "FR", "HU", "IT", "LI", "LU", "MC", "MT", "NL", "NO", "PL", "SE", "SI", "SK", "GB", "IE", "IS", "PT", "BR", "UY", "AR", "CL", "PY", "BO", "DO", "CA", "CO", "EC", "PA", "PE", "US", "CR", "GT", "HN", "MX", "NI", "SV" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/3qm3S8gkGPCdeCwaGUj4WE" + }, + "href" : "https://api.spotify.com/v1/albums/3qm3S8gkGPCdeCwaGUj4WE", + "id" : "3qm3S8gkGPCdeCwaGUj4WE", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/bf891e3702739cb350352dcac45e4243d809ca92", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/4930f0ace2e239840f173487b74a16eb2d266eb5", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/d3ece8847b11a0f45a307f60c74006aa01018728", + "width" : 64 + } ], + "name" : "Stevie Knows (7th Heaven Remix)", + "type" : "album", + "uri" : "spotify:album:3qm3S8gkGPCdeCwaGUj4WE" + }, { + "album_type" : "single", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/0HkanXbi3f3Riv9ISsO11s" + }, + "href" : "https://api.spotify.com/v1/albums/0HkanXbi3f3Riv9ISsO11s", + "id" : "0HkanXbi3f3Riv9ISsO11s", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/4f408ce56d89e4ed6cb350e3f93b76d1e4a55cc3", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/29823623b87bff215519b9d744f55f47984cab18", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/1e987283293d4a50e52e668649f9e79c4b236790", + "width" : 64 + } ], + "name" : "I'm From Long Beach - Single", + "type" : "album", + "uri" : "spotify:album:0HkanXbi3f3Riv9ISsO11s" + }, { + "album_type" : "single", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/3bgOyqPJTjGJyyhcPZTwjQ" + }, + "href" : "https://api.spotify.com/v1/albums/3bgOyqPJTjGJyyhcPZTwjQ", + "id" : "3bgOyqPJTjGJyyhcPZTwjQ", + "images" : [ { + "height" : 600, + "url" : "https://i.scdn.co/image/2dacef968af7cd9bc10ad43c10a5866fdaa431fe", + "width" : 600 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/860edb16f98ad8c422d65714c999c23c56bdb18a", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/1302a1823a425d24f3f6effa9c149a445cf4e20d", + "width" : 64 + } ], + "name" : "Två vägar", + "type" : "album", + "uri" : "spotify:album:3bgOyqPJTjGJyyhcPZTwjQ" + }, { + "album_type" : "single", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/1qqwJHUhez843oBaz5et2S" + }, + "href" : "https://api.spotify.com/v1/albums/1qqwJHUhez843oBaz5et2S", + "id" : "1qqwJHUhez843oBaz5et2S", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/8c02adb97fe766ed2c7cc0e13e445bf987d1edf1", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/c66a7ab5c04e88a6c7ad5ce9ec21dab15bbcd5e6", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/e9274182ce9999095da6118d83aec90834803ac3", + "width" : 64 + } ], + "name" : "Might Not", + "type" : "album", + "uri" : "spotify:album:1qqwJHUhez843oBaz5et2S" + }, { + "album_type" : "single", + "available_markets" : [ "AT", "AU", "CH", "DE", "DK", "FI", "GB", "IE", "IS", "NO", "NZ", "SE" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/0Ux8McYvQSzNFbub73OFqk" + }, + "href" : "https://api.spotify.com/v1/albums/0Ux8McYvQSzNFbub73OFqk", + "id" : "0Ux8McYvQSzNFbub73OFqk", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/892bef68ecad8b6a07181c19ed565b1a7be12009", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/0c3e2c96a9973a82e6ff78ba270421e2db65b4b0", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/7fb9c038d2628fd2b7bef39610aced6f91d49cff", + "width" : 64 + } ], + "name" : "Merry Xmas (feat. Monty)", + "type" : "album", + "uri" : "spotify:album:0Ux8McYvQSzNFbub73OFqk" + }, { + "album_type" : "album", + "available_markets" : [ "BG", "CY", "EE", "FI", "GR", "LT", "LV", "RO", "AD", "AT", "BE", "CH", "CZ", "DE", "DK", "ES", "FR", "HU", "IT", "LI", "LU", "MC", "MT", "NL", "NO", "PL", "SE", "SI", "SK", "GB", "IE", "IS", "PT", "BR", "UY", "AR", "CL", "PY", "BO", "DO", "CA", "CO", "EC", "PA", "PE", "US", "CR", "GT", "HN", "MX", "NI", "SV", "NZ", "AU" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6uG9BscYmPnAbtl6Cy9u91" + }, + "href" : "https://api.spotify.com/v1/albums/6uG9BscYmPnAbtl6Cy9u91", + "id" : "6uG9BscYmPnAbtl6Cy9u91", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/4d26ef97cbfe370350770332fdd45e1152425b4e", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/e43b111ee4ed30b17ae40b1c73326a54df53ffc9", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/96c8941a9ead45c01e65fc615ed5a95f13af869f", + "width" : 64 + } ], + "name" : "Summer In The Winter", + "type" : "album", + "uri" : "spotify:album:6uG9BscYmPnAbtl6Cy9u91" + }, { + "album_type" : "single", + "available_markets" : [ "AU", "HK", "MY", "NZ", "PH", "SG", "TW", "BG", "CY", "EE", "FI", "GR", "LT", "LV", "RO", "TR", "AD", "AT", "BE", "CH", "CZ", "DE", "DK", "ES", "FR", "HU", "IT", "LI", "LU", "MC", "MT", "NL", "NO", "PL", "SE", "SI", "SK", "GB", "IE", "IS", "PT", "BR", "UY", "AR", "CL", "PY", "BO", "DO", "CO", "EC", "PA", "PE", "CR", "GT", "HN", "MX", "NI", "SV" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6U4UXePoZz8jI0WAgOY0QK" + }, + "href" : "https://api.spotify.com/v1/albums/6U4UXePoZz8jI0WAgOY0QK", + "id" : "6U4UXePoZz8jI0WAgOY0QK", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/aedf44f75f661d3b15ccef4afe42d4460e9c1df3", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/b541b9adf17d67f0e5dc88b7b4a91c8f05271c79", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/7e4bdb5457d31d12a0fe191500e1b75b370166f7", + "width" : 64 + } ], + "name" : "Lay It All On Me (feat. Big Sean, Vic Mensa & Ed Sheeran) [Rudi VIP Mix]", + "type" : "album", + "uri" : "spotify:album:6U4UXePoZz8jI0WAgOY0QK" + }, { + "album_type" : "single", + "available_markets" : [ "BG", "CY", "EE", "FI", "GR", "LT", "LV", "RO", "TR", "AD", "AT", "BE", "CH", "CZ", "DE", "DK", "ES", "FR", "HU", "IT", "LI", "LU", "MC", "MT", "NL", "NO", "PL", "SE", "SI", "SK", "GB", "IE", "IS", "PT", "BR", "UY", "AR", "CL", "PY", "BO", "DO", "CA", "CO", "EC", "PA", "PE", "US", "CR", "GT", "HN", "MX", "NI", "SV", "NZ", "AU" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/3skXXEPIZHApEfglcwIlvR" + }, + "href" : "https://api.spotify.com/v1/albums/3skXXEPIZHApEfglcwIlvR", + "id" : "3skXXEPIZHApEfglcwIlvR", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/96a4ed623f6c79b305e06080a976244baefa36eb", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/14f3afa15d40d00db46baa6429fd79bed40a5cdd", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/16875c5e3377ae90ea2f6ea9932977961b2ed1d5", + "width" : 64 + } ], + "name" : "Christmas Will Break Your Heart", + "type" : "album", + "uri" : "spotify:album:3skXXEPIZHApEfglcwIlvR" + }, { + "album_type" : "single", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/0rd1TF9fOXVHoSuHJ9Sckm" + }, + "href" : "https://api.spotify.com/v1/albums/0rd1TF9fOXVHoSuHJ9Sckm", + "id" : "0rd1TF9fOXVHoSuHJ9Sckm", + "images" : [ { + "height" : 600, + "url" : "https://i.scdn.co/image/03e10634c4c654cedf1129ddce00f90f35367bb4", + "width" : 600 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/aed4e0d36ed4f1b9622c7842b6208008a29f5c85", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/af2ad8bd173eac67935201982d357fc865f1ff7a", + "width" : 64 + } ], + "name" : "Snökristaller - EP", + "type" : "album", + "uri" : "spotify:album:0rd1TF9fOXVHoSuHJ9Sckm" + }, { + "album_type" : "single", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/7FideSlOCa2PVAjvK1Ytw4" + }, + "href" : "https://api.spotify.com/v1/albums/7FideSlOCa2PVAjvK1Ytw4", + "id" : "7FideSlOCa2PVAjvK1Ytw4", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/c08c07f4cee62d88f02c8e3cc9c2f3e3b05451c8", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/9e1757f3f64c632bcab34d7ca586bd46a16999b5", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/105fba4aa1f327324cf0fbdebe52ca6a394188d9", + "width" : 64 + } ], + "name" : "Kalla Mig (Black Knight Remix)", + "type" : "album", + "uri" : "spotify:album:7FideSlOCa2PVAjvK1Ytw4" + }, { + "album_type" : "single", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/4Ek2i3GBY8sQGIooFX3mTL" + }, + "href" : "https://api.spotify.com/v1/albums/4Ek2i3GBY8sQGIooFX3mTL", + "id" : "4Ek2i3GBY8sQGIooFX3mTL", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/220fe52d445a678b92cacb418fecf9580ab41761", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/ea4823e62f173366037eacd6cd5ee1406c5f05db", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/ef351095477677c88ee784939dffff5cf87cce7f", + "width" : 64 + } ], + "name" : "Born To Be Loved (Faråker Remix)", + "type" : "album", + "uri" : "spotify:album:4Ek2i3GBY8sQGIooFX3mTL" + }, { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6YBCE5NFQQTVuZVhBCMnSe" + }, + "href" : "https://api.spotify.com/v1/albums/6YBCE5NFQQTVuZVhBCMnSe", + "id" : "6YBCE5NFQQTVuZVhBCMnSe", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/bc0d0ff74393abbb232eb04f0a4bb91439b1cbe1", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/e071dc624ca44264a8ace9a7bfb8bd1407428862", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/efd6dadf26d8a9a692478cdd19152e5cc833546e", + "width" : 64 + } ], + "name" : "Quentin Tarantino's The Hateful Eight (Original Motion Picture Soundtrack)", + "type" : "album", + "uri" : "spotify:album:6YBCE5NFQQTVuZVhBCMnSe" + }, { + "album_type" : "album", + "available_markets" : [ "AD", "AT", "AU", "BE", "BG", "CH", "CY", "DE", "DK", "DO", "EE", "FI", "GB", "HK", "IE", "IS", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NL", "NO", "NZ", "PH", "RO", "SE", "SG", "SI", "SK", "TW" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/4RndEmppoOEWuTGSFQOqJs" + }, + "href" : "https://api.spotify.com/v1/albums/4RndEmppoOEWuTGSFQOqJs", + "id" : "4RndEmppoOEWuTGSFQOqJs", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/8f20aeb3ce6c9d7714bd76fc474220857ad9cfc3", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/1fba47df83950df286cf9cb607b6cf7ada2b0003", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/e7d622fd9257e62c267d0343db34840a7835b521", + "width" : 64 + } ], + "name" : "Star Wars: The Force Awakens (Original Motion Picture Soundtrack)", + "type" : "album", + "uri" : "spotify:album:4RndEmppoOEWuTGSFQOqJs" + }, { + "album_type" : "single", + "available_markets" : [ "AD", "AR", "AU", "BE", "BG", "BO", "BR", "CA", "CL", "CO", "CR", "CY", "CZ", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/4qgWyE8Pp9AZ94src2XEi7" + }, + "href" : "https://api.spotify.com/v1/albums/4qgWyE8Pp9AZ94src2XEi7", + "id" : "4qgWyE8Pp9AZ94src2XEi7", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/7bbb0eb112150c76c27d6ed1fead3c53a02ca303", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/690157ca7a732698f46c815e295d2bafe6492d83", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/1297f1ffa9875ed7e18f9a44d86768f75589bea2", + "width" : 64 + } ], + "name" : "One Call Away (feat. Tyga) [Remix]", + "type" : "album", + "uri" : "spotify:album:4qgWyE8Pp9AZ94src2XEi7" + }, { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/5BFg8l4NYyZ90DWqcBjbt6" + }, + "href" : "https://api.spotify.com/v1/albums/5BFg8l4NYyZ90DWqcBjbt6", + "id" : "5BFg8l4NYyZ90DWqcBjbt6", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/c82b30ae6e4a240bd705e5c1111778d5425df98a", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/5f746a9db4250f544e24d0094a46422d521c6c90", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/19cd283556d61505b8066c0735916395c252c57a", + "width" : 64 + } ], + "name" : "Christmas & Chill", + "type" : "album", + "uri" : "spotify:album:5BFg8l4NYyZ90DWqcBjbt6" + } ], + "limit" : 20, + "next" : "https://api.spotify.com/v1/browse/new-releases?country=SE&offset=20&limit=20", + "offset" : 0, + "previous" : null, + "total" : 500 + } +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-list-categories/ + */ +var listOfCategories : SpotifyApi.MultipleCategoriesResponse = { + "categories" : { + "href" : "https://api.spotify.com/v1/browse/categories?offset=0&limit=20", + "items" : [ { + "href" : "https://api.spotify.com/v1/browse/categories/toplists", + "icons" : [ { + "height" : 275, + "url" : "https://t.scdn.co/media/derived/toplists_11160599e6a04ac5d6f2757f5511778f_0_0_275_275.jpg", + "width" : 275 + } ], + "id" : "toplists", + "name" : "Top Lists" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/holidays", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/links/holidays2015_274x274.jpg", + "width" : 274 + } ], + "id" : "holidays", + "name" : "Happy Holidays" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/yearinmusic", + "icons" : [ { + "height" : null, + "url" : "https://t.scdn.co/media/categories/yearinmusic2015_274x274.png", + "width" : null + } ], + "id" : "yearinmusic", + "name" : "Year in Music" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/mood", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/original/mood-274x274_976986a31ac8c49794cbdc7246fd5ad7_274x274.jpg", + "width" : 274 + } ], + "id" : "mood", + "name" : "Mood" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/party", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/links/partyicon_274x274.jpg", + "width" : 274 + } ], + "id" : "party", + "name" : "Party" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/pop", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/derived/pop-274x274_447148649685019f5e2a03a39e78ba52_0_0_274_274.jpg", + "width" : 274 + } ], + "id" : "pop", + "name" : "Pop" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/popculture", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/derived/trending-274x274_7b238f7217985e79d3664f2734347b98_0_0_274_274.jpg", + "width" : 274 + } ], + "id" : "popculture", + "name" : "Trending" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/focus", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/original/genre-images-square-274x274_5e50d72b846a198fcd2ca9b3aef5f0c8_274x274.jpg", + "width" : 274 + } ], + "id" : "focus", + "name" : "Focus" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/rock", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/derived/rock_9ce79e0a4ef901bbd10494f5b855d3cc_0_0_274_274.jpg", + "width" : 274 + } ], + "id" : "rock", + "name" : "Rock" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/indie_alt", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/derived/indie-274x274_add35b2b767ff7f3897262ad86809bdb_0_0_274_274.jpg", + "width" : 274 + } ], + "id" : "indie_alt", + "name" : "Indie/Alternative" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/edm_dance", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/derived/edm-274x274_0ef612604200a9c14995432994455a6d_0_0_274_274.jpg", + "width" : 274 + } ], + "id" : "edm_dance", + "name" : "EDM/Dance" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/chill", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/derived/chill-274x274_4c46374f007813dd10b37e8d8fd35b4b_0_0_274_274.jpg", + "width" : 274 + } ], + "id" : "chill", + "name" : "Chill" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/dinner", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/original/dinner_1b6506abba0ba52c54e6d695c8571078_274x274.jpg", + "width" : 274 + } ], + "id" : "dinner", + "name" : "Dinner" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/sleep", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/derived/sleep-274x274_0d4f836af8fab7bf31526968073e671c_0_0_274_274.jpg", + "width" : 274 + } ], + "id" : "sleep", + "name" : "Sleep" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/hiphop", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/original/hip-274_0a661854d61e29eace5fe63f73495e68_274x274.jpg", + "width" : 274 + } ], + "id" : "hiphop", + "name" : "Hip Hop" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/latin", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/derived/latin-274x274_befbbd1fbb8e045491576e317cb16cdf_0_0_274_274.jpg", + "width" : 274 + } ], + "id" : "latin", + "name" : "Latino" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/workout", + "icons" : [ { + "height" : null, + "url" : "https://t.scdn.co/media/links/workout-274x274.jpg", + "width" : null + } ], + "id" : "workout", + "name" : "Workout" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/rnb", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/derived/r-b-274x274_fd56efa72f4f63764b011b68121581d8_0_0_274_274.jpg", + "width" : 274 + } ], + "id" : "rnb", + "name" : "RnB" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/country", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/derived/icon-274x274_6a35972b380f65dc348e0c798fe626a4_0_0_274_274.jpg", + "width" : 274 + } ], + "id" : "country", + "name" : "Country" + }, { + "href" : "https://api.spotify.com/v1/browse/categories/folk_americana", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/derived/folk-274x274_ced3f75528ac61faf505863f7d7fae64_0_0_274_274.jpg", + "width" : 274 + } ], + "id" : "folk_americana", + "name" : "Folk & Americana" + } ], + "limit" : 20, + "next" : "https://api.spotify.com/v1/browse/categories?offset=20&limit=20", + "offset" : 0, + "previous" : null, + "total" : 33 + } +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-category/ + */ +var category : SpotifyApi.SingleCategoryResponse = { + "href" : "https://api.spotify.com/v1/browse/categories/rock", + "icons" : [ { + "height" : 274, + "url" : "https://t.scdn.co/media/derived/rock_9ce79e0a4ef901bbd10494f5b855d3cc_0_0_274_274.jpg", + "width" : 274 + } ], + "id" : "rock", + "name" : "Rock" +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-categorys-playlists/ + */ +var categoryPlaylists : SpotifyApi.CategoryPlaylistsReponse = { + "playlists" : { + "href" : "https://api.spotify.com/v1/browse/categories/party/playlists?country=BR&offset=0&limit=2", + "items" : [ { + "collaborative" : false, + "external_urls" : { + "spotify" : "http://open.spotify.com/user/spotifybrazilian/playlist/6U9RHRz1G477YpMNeLy9uI" + }, + "href" : "https://api.spotify.com/v1/users/spotifybrazilian/playlists/6U9RHRz1G477YpMNeLy9uI", + "id" : "6U9RHRz1G477YpMNeLy9uI", + "images" : [ { + "height" : 300, + "url" : "https://i.scdn.co/image/510c519ae934ea4bb26219277f8c1a859e8cb01a", + "width" : 300 + } ], + "name" : "Esquenta Sertanejo", + "owner" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/spotifybrazilian" + }, + "href" : "https://api.spotify.com/v1/users/spotifybrazilian", + "id" : "spotifybrazilian", + "type" : "user", + "uri" : "spotify:user:spotifybrazilian" + }, + "public" : null, + "snapshot_id" : "+jMowNjnBWpQqnkgYk47IRKrEsXLxUXR348Mtg/+kZWjLkpS4HTADpzyV6X/iIJm", + "tracks" : { + "href" : "https://api.spotify.com/v1/users/spotifybrazilian/playlists/6U9RHRz1G477YpMNeLy9uI/tracks", + "total" : 100 + }, + "type" : "playlist", + "uri" : "spotify:user:spotifybrazilian:playlist:6U9RHRz1G477YpMNeLy9uI" + }, { + "collaborative" : false, + "external_urls" : { + "spotify" : "http://open.spotify.com/user/spotifybrazilian/playlist/4k7EZPI3uKMz4aRRrLVfen" + }, + "href" : "https://api.spotify.com/v1/users/spotifybrazilian/playlists/4k7EZPI3uKMz4aRRrLVfen", + "id" : "4k7EZPI3uKMz4aRRrLVfen", + "images" : [ { + "height" : 300, + "url" : "https://i.scdn.co/image/1ec2655266c18dc62a39a270cd89a875705733a2", + "width" : 300 + } ], + "name" : "Noite Eletrônica", + "owner" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/spotifybrazilian" + }, + "href" : "https://api.spotify.com/v1/users/spotifybrazilian", + "id" : "spotifybrazilian", + "type" : "user", + "uri" : "spotify:user:spotifybrazilian" + }, + "public" : null, + "snapshot_id" : "JWtQF9AcG8yXA/xIihTpZNxJuVdcJ0UwPZQrkRi8kP2om0nZJNg/WvwAz1TMBdlX", + "tracks" : { + "href" : "https://api.spotify.com/v1/users/spotifybrazilian/playlists/4k7EZPI3uKMz4aRRrLVfen/tracks", + "total" : 100 + }, + "type" : "playlist", + "uri" : "spotify:user:spotifybrazilian:playlist:4k7EZPI3uKMz4aRRrLVfen" + } ], + "limit" : 2, + "next" : "https://api.spotify.com/v1/browse/categories/party/playlists?country=BR&offset=2&limit=2", + "offset" : 0, + "previous" : null, + "total" : 79 + } +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-current-users-profile/ + */ +var userProfilePrivate : SpotifyApi.CurrentUsersProfileResponse = { + "birthdate" : "1982-06-29", + "country" : "DK", + "display_name" : null, + "email" : "niels@physicalcode.com", + "external_urls" : { + "spotify" : "https://open.spotify.com/user/physicaltunes" + }, + "followers" : { + "href" : null, + "total" : 2 + }, + "href" : "https://api.spotify.com/v1/users/physicaltunes", + "id" : "physicaltunes", + "images" : [ ], + "product" : "premium", + "type" : "user", + "uri" : "spotify:user:physicaltunes" +} + + + + +/** + * Tests https://developer.spotify.com/web-api/get-followed-artists/ + */ +var followedArtists : SpotifyApi.UsersFollowedArtistsResponse = { + "artists" : { + "items" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/1F102kNzMqsmOpF7AfFmm5" + }, + "followers" : { + "href" : null, + "total" : 21835 + }, + "genres" : [ "psychill" ], + "href" : "https://api.spotify.com/v1/artists/1F102kNzMqsmOpF7AfFmm5", + "id" : "1F102kNzMqsmOpF7AfFmm5", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/81716e1e7397e8213f943f6bc34df32025abbbf2", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/4415b0213e0b4fa4c2ee54cb5fb8d547558c7c05", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/47d4847098235891b983de21ea2629015632cc89", + "width" : 64 + } ], + "name" : "Ott", + "popularity" : 44, + "type" : "artist", + "uri" : "spotify:artist:1F102kNzMqsmOpF7AfFmm5" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/1oM1vgebNTCZmVYwC3YYl8" + }, + "followers" : { + "href" : null, + "total" : 12777 + }, + "genres" : [ "funk metal" ], + "href" : "https://api.spotify.com/v1/artists/1oM1vgebNTCZmVYwC3YYl8", + "id" : "1oM1vgebNTCZmVYwC3YYl8", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/ce6f6717f07c969ec41f0c45bf29b9c1f312f9d4", + "width" : 960 + }, { + "height" : 427, + "url" : "https://i.scdn.co/image/bf35aa3fd5bbfdcefac0b1120bc950cc1903dab7", + "width" : 640 + }, { + "height" : 133, + "url" : "https://i.scdn.co/image/2ad4e34ef6341ac8c57c5d4a48507b70234d5bda", + "width" : 200 + }, { + "height" : 43, + "url" : "https://i.scdn.co/image/b0a8ffe5baa974df1cf4f4abbf0ad4037eb14472", + "width" : 64 + } ], + "name" : "Les Claypool", + "popularity" : 32, + "type" : "artist", + "uri" : "spotify:artist:1oM1vgebNTCZmVYwC3YYl8" + } ], + "next" : "https://api.spotify.com/v1/me/following?type=artist&after=1oM1vgebNTCZmVYwC3YYl8&limit=2", + "total" : 10, + "cursors" : { + "after" : "1oM1vgebNTCZmVYwC3YYl8" + }, + "limit" : 2, + "href" : "https://api.spotify.com/v1/me/following?type=artist&limit=2" + } +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/follow-artists-users/ + */ +var followArtistsOrUsers : SpotifyApi.FollowArtistsOrUsersResponse = {} + + + + +/** + * Tests https://developer.spotify.com/web-api/unfollow-artists-users/ + */ +var unfollowArtistsOrUsers : SpotifyApi.UnfollowArtistsOrUsersResponse = {} + + + + +/** + * Tests https://developer.spotify.com/web-api/check-current-user-follows/ + */ +var checkCurrentUserFollows : SpotifyApi.UserFollowsUsersOrArtistsResponse = [ true, true, false ]; + + + + +/** + * Tests https://developer.spotify.com/web-api/follow-playlist/ + */ +var followPlaylist : SpotifyApi.FollowPlaylistReponse = {}; + + + + +/** + * Tests https://developer.spotify.com/web-api/unfollow-playlist/ + */ +var unfollowPlaylist : SpotifyApi.UnfollowPlaylistReponse = {}; + + + + +/** + * Tests https://developer.spotify.com/web-api/save-tracks-user/ + */ +var saveTracksForUser : SpotifyApi.SaveTracksForUserResponse = {}; + + + + +/** + * Tests https://developer.spotify.com/web-api/console/get-current-user-saved-tracks + */ +var getSavedTracks : SpotifyApi.UsersSavedTracksResponse = { + "href" : "https://api.spotify.com/v1/me/tracks?offset=0&limit=5&market=DK", + "items" : [ { + "added_at" : "2015-12-24T08:02:23Z", + "track" : { + "album" : { + "album_type" : "compilation", + "external_urls" : { + "spotify" : "https://open.spotify.com/album/5UtlwR5GMEM3XrF8GdzMmB" + }, + "href" : "https://api.spotify.com/v1/albums/5UtlwR5GMEM3XrF8GdzMmB", + "id" : "5UtlwR5GMEM3XrF8GdzMmB", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/c0fb10c0253dbd63dc063afb2dedc17922da72bb", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/3bb609bb7cb6b63d90ac8cc9f30164cd1dba421e", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/c18d91c939997d3a33251fc7a85cbf552795ecb1", + "width" : 64 + } ], + "name" : "The Beatles 1967 - 1970 (Remastered)", + "type" : "album", + "uri" : "spotify:album:5UtlwR5GMEM3XrF8GdzMmB" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/3WrFJ7ztbogyGnTHbHJFl2" + }, + "href" : "https://api.spotify.com/v1/artists/3WrFJ7ztbogyGnTHbHJFl2", + "id" : "3WrFJ7ztbogyGnTHbHJFl2", + "name" : "The Beatles", + "type" : "artist", + "uri" : "spotify:artist:3WrFJ7ztbogyGnTHbHJFl2" + } ], + "disc_number" : 1, + "duration_ms" : 248933, + "explicit" : false, + "external_ids" : { + "isrc" : "GBAYE0601640" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/0m0lCaz6HZyNx1oOrrzxWE" + }, + "href" : "https://api.spotify.com/v1/tracks/0m0lCaz6HZyNx1oOrrzxWE", + "id" : "0m0lCaz6HZyNx1oOrrzxWE", + "is_playable" : true, + "name" : "Strawberry Fields Forever - Remastered 2009", + "popularity" : 21, + "preview_url" : "https://p.scdn.co/mp3-preview/c6b38e29e03b8308c0f2f6e623fe298d24ff274e", + "track_number" : 1, + "type" : "track", + "uri" : "spotify:track:0m0lCaz6HZyNx1oOrrzxWE" + } + }, { + "added_at" : "2015-12-24T08:02:23Z", + "track" : { + "album" : { + "album_type" : "compilation", + "external_urls" : { + "spotify" : "https://open.spotify.com/album/5UtlwR5GMEM3XrF8GdzMmB" + }, + "href" : "https://api.spotify.com/v1/albums/5UtlwR5GMEM3XrF8GdzMmB", + "id" : "5UtlwR5GMEM3XrF8GdzMmB", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/c0fb10c0253dbd63dc063afb2dedc17922da72bb", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/3bb609bb7cb6b63d90ac8cc9f30164cd1dba421e", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/c18d91c939997d3a33251fc7a85cbf552795ecb1", + "width" : 64 + } ], + "name" : "The Beatles 1967 - 1970 (Remastered)", + "type" : "album", + "uri" : "spotify:album:5UtlwR5GMEM3XrF8GdzMmB" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/3WrFJ7ztbogyGnTHbHJFl2" + }, + "href" : "https://api.spotify.com/v1/artists/3WrFJ7ztbogyGnTHbHJFl2", + "id" : "3WrFJ7ztbogyGnTHbHJFl2", + "name" : "The Beatles", + "type" : "artist", + "uri" : "spotify:artist:3WrFJ7ztbogyGnTHbHJFl2" + } ], + "disc_number" : 1, + "duration_ms" : 181600, + "explicit" : false, + "external_ids" : { + "isrc" : "GBAYE0601641" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/72IGjRtsOv6kde11MBDALW" + }, + "href" : "https://api.spotify.com/v1/tracks/72IGjRtsOv6kde11MBDALW", + "id" : "72IGjRtsOv6kde11MBDALW", + "is_playable" : true, + "name" : "Penny Lane - Remastered 2009", + "popularity" : 18, + "preview_url" : "https://p.scdn.co/mp3-preview/aa92e277779518b8bd12d7332a11c212f45d1da5", + "track_number" : 2, + "type" : "track", + "uri" : "spotify:track:72IGjRtsOv6kde11MBDALW" + } + }, { + "added_at" : "2015-12-24T08:02:23Z", + "track" : { + "album" : { + "album_type" : "compilation", + "external_urls" : { + "spotify" : "https://open.spotify.com/album/5UtlwR5GMEM3XrF8GdzMmB" + }, + "href" : "https://api.spotify.com/v1/albums/5UtlwR5GMEM3XrF8GdzMmB", + "id" : "5UtlwR5GMEM3XrF8GdzMmB", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/c0fb10c0253dbd63dc063afb2dedc17922da72bb", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/3bb609bb7cb6b63d90ac8cc9f30164cd1dba421e", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/c18d91c939997d3a33251fc7a85cbf552795ecb1", + "width" : 64 + } ], + "name" : "The Beatles 1967 - 1970 (Remastered)", + "type" : "album", + "uri" : "spotify:album:5UtlwR5GMEM3XrF8GdzMmB" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/3WrFJ7ztbogyGnTHbHJFl2" + }, + "href" : "https://api.spotify.com/v1/artists/3WrFJ7ztbogyGnTHbHJFl2", + "id" : "3WrFJ7ztbogyGnTHbHJFl2", + "name" : "The Beatles", + "type" : "artist", + "uri" : "spotify:artist:3WrFJ7ztbogyGnTHbHJFl2" + } ], + "disc_number" : 1, + "duration_ms" : 122133, + "explicit" : false, + "external_ids" : { + "isrc" : "GBAYE0601507" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/51UQJuxkNLgtX8UsfoDqRR" + }, + "href" : "https://api.spotify.com/v1/tracks/51UQJuxkNLgtX8UsfoDqRR", + "id" : "51UQJuxkNLgtX8UsfoDqRR", + "is_playable" : true, + "name" : "Sgt. Pepper's Lonely Hearts Club Band - Remastered 2009", + "popularity" : 17, + "preview_url" : "https://p.scdn.co/mp3-preview/b6a5c9b4b23918c11f8e9e93b9d522ab5cb1e881", + "track_number" : 3, + "type" : "track", + "uri" : "spotify:track:51UQJuxkNLgtX8UsfoDqRR" + } + }, { + "added_at" : "2015-12-24T08:02:23Z", + "track" : { + "album" : { + "album_type" : "compilation", + "external_urls" : { + "spotify" : "https://open.spotify.com/album/5UtlwR5GMEM3XrF8GdzMmB" + }, + "href" : "https://api.spotify.com/v1/albums/5UtlwR5GMEM3XrF8GdzMmB", + "id" : "5UtlwR5GMEM3XrF8GdzMmB", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/c0fb10c0253dbd63dc063afb2dedc17922da72bb", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/3bb609bb7cb6b63d90ac8cc9f30164cd1dba421e", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/c18d91c939997d3a33251fc7a85cbf552795ecb1", + "width" : 64 + } ], + "name" : "The Beatles 1967 - 1970 (Remastered)", + "type" : "album", + "uri" : "spotify:album:5UtlwR5GMEM3XrF8GdzMmB" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/3WrFJ7ztbogyGnTHbHJFl2" + }, + "href" : "https://api.spotify.com/v1/artists/3WrFJ7ztbogyGnTHbHJFl2", + "id" : "3WrFJ7ztbogyGnTHbHJFl2", + "name" : "The Beatles", + "type" : "artist", + "uri" : "spotify:artist:3WrFJ7ztbogyGnTHbHJFl2" + } ], + "disc_number" : 1, + "duration_ms" : 164186, + "explicit" : false, + "external_ids" : { + "isrc" : "GBAYE0601508" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/2G5HiV1RpXDTb17jV4WUgU" + }, + "href" : "https://api.spotify.com/v1/tracks/2G5HiV1RpXDTb17jV4WUgU", + "id" : "2G5HiV1RpXDTb17jV4WUgU", + "is_playable" : true, + "name" : "With A Little Help From My Friends - Remastered 2009", + "popularity" : 17, + "preview_url" : "https://p.scdn.co/mp3-preview/e9eda0a7e66d6ee0ccd3b124774e81b1f80bde08", + "track_number" : 4, + "type" : "track", + "uri" : "spotify:track:2G5HiV1RpXDTb17jV4WUgU" + } + }, { + "added_at" : "2015-12-24T08:02:23Z", + "track" : { + "album" : { + "album_type" : "compilation", + "external_urls" : { + "spotify" : "https://open.spotify.com/album/5UtlwR5GMEM3XrF8GdzMmB" + }, + "href" : "https://api.spotify.com/v1/albums/5UtlwR5GMEM3XrF8GdzMmB", + "id" : "5UtlwR5GMEM3XrF8GdzMmB", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/c0fb10c0253dbd63dc063afb2dedc17922da72bb", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/3bb609bb7cb6b63d90ac8cc9f30164cd1dba421e", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/c18d91c939997d3a33251fc7a85cbf552795ecb1", + "width" : 64 + } ], + "name" : "The Beatles 1967 - 1970 (Remastered)", + "type" : "album", + "uri" : "spotify:album:5UtlwR5GMEM3XrF8GdzMmB" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/3WrFJ7ztbogyGnTHbHJFl2" + }, + "href" : "https://api.spotify.com/v1/artists/3WrFJ7ztbogyGnTHbHJFl2", + "id" : "3WrFJ7ztbogyGnTHbHJFl2", + "name" : "The Beatles", + "type" : "artist", + "uri" : "spotify:artist:3WrFJ7ztbogyGnTHbHJFl2" + } ], + "disc_number" : 1, + "duration_ms" : 209666, + "explicit" : false, + "external_ids" : { + "isrc" : "GBAYE0601509" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/5VDZsW2ka4oKuiOkj8xC9a" + }, + "href" : "https://api.spotify.com/v1/tracks/5VDZsW2ka4oKuiOkj8xC9a", + "id" : "5VDZsW2ka4oKuiOkj8xC9a", + "is_playable" : true, + "name" : "Lucy In The Sky With Diamonds - Remastered 2009", + "popularity" : 17, + "preview_url" : "https://p.scdn.co/mp3-preview/0609bc1b13ea40ddfa6a23c09aef08e23848f73f", + "track_number" : 5, + "type" : "track", + "uri" : "spotify:track:5VDZsW2ka4oKuiOkj8xC9a" + } + } ], + "limit" : 5, + "next" : "https://api.spotify.com/v1/me/tracks?offset=5&limit=5&market=DK", + "offset" : 0, + "previous" : null, + "total" : 2884 +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/remove-tracks-user/ + */ +var removeUsersTracks : SpotifyApi.RemoveUsersSavedTracksResponse = {}; + + + + +/** + * Tests https://developer.spotify.com/web-api/check-users-saved-tracks/ + */ +var checkUsersTracks : SpotifyApi.CheckUserSavedAlbumsResponse = [ false, false, true ]; + + + + +/** + * Tests https://developer.spotify.com/web-api/save-albums-user/ + */ +var saveAlbumForUser : SpotifyApi.SaveAlbumsForUserResponse = {}; + + + + +/** + * Tests https://developer.spotify.com/web-api/remove-albums-user/ + */ +var saveAlbumForUser : SpotifyApi.RemoveAlbumsForUserResponse = {}; + + + + + +/** + * Tests https://developer.spotify.com/web-api/check-users-saved-albums/ + */ +var checkUsersSavedAlbums : SpotifyApi.CheckUserSavedAlbumsResponse = [ true, false, false, true ]; + + + + +/** + * Tests https://developer.spotify.com/web-api/search-item/?type=album + */ +var searchAlbums : SpotifyApi.AlbumSearchResponse = { + "albums" : { + "href" : "https://api.spotify.com/v1/search?query=Californication&offset=20&limit=2&type=album", + "items" : [ { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/0ceQvLxLMxAo2VLtphFXnq" + }, + "href" : "https://api.spotify.com/v1/albums/0ceQvLxLMxAo2VLtphFXnq", + "id" : "0ceQvLxLMxAo2VLtphFXnq", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/7a048f1f93f967d3458361970a079648b231767f", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/8cab5da41d6446e5878d92a25a04c4283a512647", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/4f4c4de0b215d8ae5d3d239fe4b4fc26e8fd9d8e", + "width" : 64 + } ], + "name" : "Californication (Karaoke Version) (Karaoke Hits of The Red Hot Chili Peppers)", + "type" : "album", + "uri" : "spotify:album:0ceQvLxLMxAo2VLtphFXnq" + }, { + "album_type" : "single", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/65b1E2nNuRD2o0PVr8fFv1" + }, + "href" : "https://api.spotify.com/v1/albums/65b1E2nNuRD2o0PVr8fFv1", + "id" : "65b1E2nNuRD2o0PVr8fFv1", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/6d5dd24845ed51b795cb6d10898076989a0bdb87", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/e81dff6c380773f6fc1b5997ca5c2b5506b145e9", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/b5e832623b8fa8d4e4c91b4aa1cdc82a35e4c471", + "width" : 64 + } ], + "name" : "Californication (Karaoke Version) (In the Style of Red Hot Chili Peppers)", + "type" : "album", + "uri" : "spotify:album:65b1E2nNuRD2o0PVr8fFv1" + } ], + "limit" : 2, + "next" : "https://api.spotify.com/v1/search?query=Californication&offset=22&limit=2&type=album", + "offset" : 20, + "previous" : "https://api.spotify.com/v1/search?query=Californication&offset=18&limit=2&type=album", + "total" : 27 + } +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/search-item/?type=artist + */ +var searchArtists : SpotifyApi.ArtistSearchResponse = { + "artists" : { + "href" : "https://api.spotify.com/v1/search?query=tania+bowra&offset=0&limit=20&type=artist", + "items" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/08td7MxkoHQkXnWAYD8d6Q" + }, + "followers" : { + "href" : null, + "total" : 26 + }, + "genres" : [ ], + "href" : "https://api.spotify.com/v1/artists/08td7MxkoHQkXnWAYD8d6Q", + "id" : "08td7MxkoHQkXnWAYD8d6Q", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/f2798ddab0c7b76dc2d270b65c4f67ddef7f6718", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/b414091165ea0f4172089c2fc67bb35aa37cfc55", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/8522fc78be4bf4e83fea8e67bb742e7d3dfe21b4", + "width" : 64 + } ], + "name" : "Tania Bowra", + "popularity" : 2, + "type" : "artist", + "uri" : "spotify:artist:08td7MxkoHQkXnWAYD8d6Q" + } ], + "limit" : 20, + "next" : null, + "offset" : 0, + "previous" : null, + "total" : 1 + } +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/search-item/?type=playlist + */ +var searchPlaylists : SpotifyApi.PlaylistSearchResponse = { + "playlists" : { + "href" : "https://api.spotify.com/v1/search?query=Summer&offset=20&limit=2&type=playlist", + "items" : [ { + "collaborative" : false, + "external_urls" : { + "spotify" : "http://open.spotify.com/user/twistoffame/playlist/4atqr0nDMUxQFLd09yhk9w" + }, + "href" : "https://api.spotify.com/v1/users/twistoffame/playlists/4atqr0nDMUxQFLd09yhk9w", + "id" : "4atqr0nDMUxQFLd09yhk9w", + "images" : [ { + "height" : 640, + "url" : "https://mosaic.scdn.co/640/4e1d108995a6947bfc6b1d728f0fcd5b4c5ec64444e09ba9156ae93324850b27f17fe7523178d05dfd3cac76a8f1f3cab516f06873eeec16977efdf0c3c226ca1b710078b9f2d9b01c9fdd0c7823c80d", + "width" : 640 + }, { + "height" : 300, + "url" : "https://mosaic.scdn.co/300/4e1d108995a6947bfc6b1d728f0fcd5b4c5ec64444e09ba9156ae93324850b27f17fe7523178d05dfd3cac76a8f1f3cab516f06873eeec16977efdf0c3c226ca1b710078b9f2d9b01c9fdd0c7823c80d", + "width" : 300 + }, { + "height" : 60, + "url" : "https://mosaic.scdn.co/60/4e1d108995a6947bfc6b1d728f0fcd5b4c5ec64444e09ba9156ae93324850b27f17fe7523178d05dfd3cac76a8f1f3cab516f06873eeec16977efdf0c3c226ca1b710078b9f2d9b01c9fdd0c7823c80d", + "width" : 60 + } ], + "name" : "Summer", + "owner" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/twistoffame" + }, + "href" : "https://api.spotify.com/v1/users/twistoffame", + "id" : "twistoffame", + "type" : "user", + "uri" : "spotify:user:twistoffame" + }, + "public" : null, + "snapshot_id" : "4Hfz5J478TU3Iljnxc5qXAJt/mCS8Q92XNvbRJjd1CPDjiDAP4Aj+3PZKYT5VxZ6", + "tracks" : { + "href" : "https://api.spotify.com/v1/users/twistoffame/playlists/4atqr0nDMUxQFLd09yhk9w/tracks", + "total" : 116 + }, + "type" : "playlist", + "uri" : "spotify:user:twistoffame:playlist:4atqr0nDMUxQFLd09yhk9w" + }, { + "collaborative" : false, + "external_urls" : { + "spotify" : "http://open.spotify.com/user/1174077483/playlist/3fAKyVYIkAiinuipRUGJHj" + }, + "href" : "https://api.spotify.com/v1/users/1174077483/playlists/3fAKyVYIkAiinuipRUGJHj", + "id" : "3fAKyVYIkAiinuipRUGJHj", + "images" : [ { + "height" : 640, + "url" : "https://mosaic.scdn.co/640/5112bb05919320d47d5011d2479515392e995a208a46ad36789d2eba454e16caffca4fb994f5f64cf3cf87bfde0748d389702a69e0ba01f6091e2403f844302197c69972032ba43f3cc73e25f2f562e0", + "width" : 640 + }, { + "height" : 300, + "url" : "https://mosaic.scdn.co/300/5112bb05919320d47d5011d2479515392e995a208a46ad36789d2eba454e16caffca4fb994f5f64cf3cf87bfde0748d389702a69e0ba01f6091e2403f844302197c69972032ba43f3cc73e25f2f562e0", + "width" : 300 + }, { + "height" : 60, + "url" : "https://mosaic.scdn.co/60/5112bb05919320d47d5011d2479515392e995a208a46ad36789d2eba454e16caffca4fb994f5f64cf3cf87bfde0748d389702a69e0ba01f6091e2403f844302197c69972032ba43f3cc73e25f2f562e0", + "width" : 60 + } ], + "name" : "Summer Bash 2015", + "owner" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/1174077483" + }, + "href" : "https://api.spotify.com/v1/users/1174077483", + "id" : "1174077483", + "type" : "user", + "uri" : "spotify:user:1174077483" + }, + "public" : null, + "snapshot_id" : "4hO+Np6z7Pvla+BDmNGTP8cOuBjPcnY0YhpQdH9Kj2AvuvhyokjcIXLhw59Ufsof", + "tracks" : { + "href" : "https://api.spotify.com/v1/users/1174077483/playlists/3fAKyVYIkAiinuipRUGJHj/tracks", + "total" : 162 + }, + "type" : "playlist", + "uri" : "spotify:user:1174077483:playlist:3fAKyVYIkAiinuipRUGJHj" + } ], + "limit" : 2, + "next" : "https://api.spotify.com/v1/search?query=Summer&offset=22&limit=2&type=playlist", + "offset" : 20, + "previous" : "https://api.spotify.com/v1/search?query=Summer&offset=18&limit=2&type=playlist", + "total" : 9721 + } +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/search-item/?type=track + */ +var searchTracks : SpotifyApi.TrackSearchResponse = { + "tracks" : { + "href" : "https://api.spotify.com/v1/search?query=Summer&offset=20&limit=2&type=track", + "items" : [ { + "album" : { + "album_type" : "album", + "available_markets" : [ "BG", "CY", "EE", "FI", "GR", "LT", "LV", "RO", "AD", "BE", "CZ", "DK", "ES", "FR", "HU", "IT", "LU", "MC", "MT", "NL", "NO", "PL", "SE", "SI", "SK", "GB", "IE", "IS", "PT", "UY", "AR", "CL", "PY", "BO", "DO", "CA", "CO", "EC", "PA", "PE", "US", "CR", "GT", "HN", "MX", "NI", "SV", "NZ", "AU", "HK", "MY", "PH", "SG", "TW" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/049UASMZj7hfeDWWY8BzoE" + }, + "href" : "https://api.spotify.com/v1/albums/049UASMZj7hfeDWWY8BzoE", + "id" : "049UASMZj7hfeDWWY8BzoE", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/4d26ef97cbfe370350770332fdd45e1152425b4e", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/e43b111ee4ed30b17ae40b1c73326a54df53ffc9", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/96c8941a9ead45c01e65fc615ed5a95f13af869f", + "width" : 64 + } ], + "name" : "Summer In The Winter", + "type" : "album", + "uri" : "spotify:album:049UASMZj7hfeDWWY8BzoE" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/6KZDXtSj0SzGOV705nNeh3" + }, + "href" : "https://api.spotify.com/v1/artists/6KZDXtSj0SzGOV705nNeh3", + "id" : "6KZDXtSj0SzGOV705nNeh3", + "name" : "Kid Ink", + "type" : "artist", + "uri" : "spotify:artist:6KZDXtSj0SzGOV705nNeh3" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/0z4gvV4rjIZ9wHck67ucSV" + }, + "href" : "https://api.spotify.com/v1/artists/0z4gvV4rjIZ9wHck67ucSV", + "id" : "0z4gvV4rjIZ9wHck67ucSV", + "name" : "Akon", + "type" : "artist", + "uri" : "spotify:artist:0z4gvV4rjIZ9wHck67ucSV" + } ], + "available_markets" : [ "BG", "CY", "EE", "FI", "GR", "LT", "LV", "RO", "AD", "BE", "CZ", "DK", "ES", "FR", "HU", "IT", "LU", "MC", "MT", "NL", "NO", "PL", "SE", "SI", "SK", "GB", "IE", "IS", "PT", "UY", "AR", "CL", "PY", "BO", "DO", "CA", "CO", "EC", "PA", "PE", "US", "CR", "GT", "HN", "MX", "NI", "SV", "NZ", "AU", "HK", "MY", "PH", "SG", "TW" ], + "disc_number" : 1, + "duration_ms" : 240013, + "explicit" : false, + "external_ids" : { + "isrc" : "USRC11503201" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/42BptFJWPANaOHUxDBo7Gf" + }, + "href" : "https://api.spotify.com/v1/tracks/42BptFJWPANaOHUxDBo7Gf", + "id" : "42BptFJWPANaOHUxDBo7Gf", + "name" : "Rewind", + "popularity" : 0, + "preview_url" : "https://p.scdn.co/mp3-preview/257b7e9cf68642f3d96b57a4bcf5824d9ccaab21", + "track_number" : 4, + "type" : "track", + "uri" : "spotify:track:42BptFJWPANaOHUxDBo7Gf" + }, { + "album" : { + "album_type" : "album", + "available_markets" : [ "BG", "CY", "EE", "FI", "GR", "LT", "LV", "RO", "AD", "AT", "BE", "CH", "CZ", "DE", "DK", "ES", "FR", "HU", "IT", "LI", "LU", "MC", "MT", "NL", "NO", "PL", "SE", "SI", "SK", "GB", "IE", "IS", "PT", "BR", "UY", "AR", "CL", "PY", "BO", "DO", "CA", "CO", "EC", "PA", "PE", "US", "CR", "GT", "HN", "MX", "NI", "SV", "NZ", "AU", "HK", "MY", "PH", "SG", "TW" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6uG9BscYmPnAbtl6Cy9u91" + }, + "href" : "https://api.spotify.com/v1/albums/6uG9BscYmPnAbtl6Cy9u91", + "id" : "6uG9BscYmPnAbtl6Cy9u91", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/4d26ef97cbfe370350770332fdd45e1152425b4e", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/e43b111ee4ed30b17ae40b1c73326a54df53ffc9", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/96c8941a9ead45c01e65fc615ed5a95f13af869f", + "width" : 64 + } ], + "name" : "Summer In The Winter", + "type" : "album", + "uri" : "spotify:album:6uG9BscYmPnAbtl6Cy9u91" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/6KZDXtSj0SzGOV705nNeh3" + }, + "href" : "https://api.spotify.com/v1/artists/6KZDXtSj0SzGOV705nNeh3", + "id" : "6KZDXtSj0SzGOV705nNeh3", + "name" : "Kid Ink", + "type" : "artist", + "uri" : "spotify:artist:6KZDXtSj0SzGOV705nNeh3" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/5wd2VuNxYv2rZ3z6qY0Wvx" + }, + "href" : "https://api.spotify.com/v1/artists/5wd2VuNxYv2rZ3z6qY0Wvx", + "id" : "5wd2VuNxYv2rZ3z6qY0Wvx", + "name" : "Bïa", + "type" : "artist", + "uri" : "spotify:artist:5wd2VuNxYv2rZ3z6qY0Wvx" + } ], + "available_markets" : [ "BG", "CY", "EE", "FI", "GR", "LT", "LV", "RO", "AD", "AT", "BE", "CH", "CZ", "DE", "DK", "ES", "FR", "HU", "IT", "LI", "LU", "MC", "MT", "NL", "NO", "PL", "SE", "SI", "SK", "GB", "IE", "IS", "PT", "BR", "UY", "AR", "CL", "PY", "BO", "DO", "CA", "CO", "EC", "PA", "PE", "US", "CR", "GT", "HN", "MX", "NI", "SV", "NZ", "AU", "HK", "MY", "PH", "SG", "TW" ], + "disc_number" : 1, + "duration_ms" : 196146, + "explicit" : true, + "external_ids" : { + "isrc" : "USRC11503196" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3sXcUMhBQLCyr6Cl6z7RP4" + }, + "href" : "https://api.spotify.com/v1/tracks/3sXcUMhBQLCyr6Cl6z7RP4", + "id" : "3sXcUMhBQLCyr6Cl6z7RP4", + "name" : "Good Idea", + "popularity" : 0, + "preview_url" : "https://p.scdn.co/mp3-preview/0f2dae3a28d6cb952576adbf6c613d62ce25af49", + "track_number" : 9, + "type" : "track", + "uri" : "spotify:track:3sXcUMhBQLCyr6Cl6z7RP4" + } ], + "limit" : 2, + "next" : "https://api.spotify.com/v1/search?query=Summer&offset=22&limit=2&type=track", + "offset" : 20, + "previous" : "https://api.spotify.com/v1/search?query=Summer&offset=18&limit=2&type=track", + "total" : 334363 + } +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-track/ + */ +var track : SpotifyApi.SingleTrackResponse = { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6TJmQnO44YE5BtTxH8pop1" + }, + "href" : "https://api.spotify.com/v1/albums/6TJmQnO44YE5BtTxH8pop1", + "id" : "6TJmQnO44YE5BtTxH8pop1", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/8e13218039f81b000553e25522a7f0d7a0600f2e", + "width" : 629 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/8c1e066b5d1045038437d92815d49987f519e44f", + "width" : 295 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/d49268a8fc0768084f4750cf1647709e89a27172", + "width" : 63 + } ], + "name" : "Hot Fuss", + "type" : "album", + "uri" : "spotify:album:6TJmQnO44YE5BtTxH8pop1" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/0C0XlULifJtAgn6ZNCW2eu" + }, + "href" : "https://api.spotify.com/v1/artists/0C0XlULifJtAgn6ZNCW2eu", + "id" : "0C0XlULifJtAgn6ZNCW2eu", + "name" : "The Killers", + "type" : "artist", + "uri" : "spotify:artist:0C0XlULifJtAgn6ZNCW2eu" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 222075, + "explicit" : false, + "external_ids" : { + "isrc" : "USIR20400274" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/0eGsygTp906u18L0Oimnem" + }, + "href" : "https://api.spotify.com/v1/tracks/0eGsygTp906u18L0Oimnem", + "id" : "0eGsygTp906u18L0Oimnem", + "name" : "Mr. Brightside", + "popularity" : 74, + "preview_url" : "https://p.scdn.co/mp3-preview/934da7155ec15deb326635d69d050543ecbee2b4", + "track_number" : 2, + "type" : "track", + "uri" : "spotify:track:0eGsygTp906u18L0Oimnem" +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-several-tracks/ + */ +var tracks : SpotifyApi.MultipleTracksResponse = { + "tracks" : [ { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6TJmQnO44YE5BtTxH8pop1" + }, + "href" : "https://api.spotify.com/v1/albums/6TJmQnO44YE5BtTxH8pop1", + "id" : "6TJmQnO44YE5BtTxH8pop1", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/8e13218039f81b000553e25522a7f0d7a0600f2e", + "width" : 629 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/8c1e066b5d1045038437d92815d49987f519e44f", + "width" : 295 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/d49268a8fc0768084f4750cf1647709e89a27172", + "width" : 63 + } ], + "name" : "Hot Fuss", + "type" : "album", + "uri" : "spotify:album:6TJmQnO44YE5BtTxH8pop1" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/0C0XlULifJtAgn6ZNCW2eu" + }, + "href" : "https://api.spotify.com/v1/artists/0C0XlULifJtAgn6ZNCW2eu", + "id" : "0C0XlULifJtAgn6ZNCW2eu", + "name" : "The Killers", + "type" : "artist", + "uri" : "spotify:artist:0C0XlULifJtAgn6ZNCW2eu" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 222075, + "explicit" : false, + "external_ids" : { + "isrc" : "USIR20400274" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/0eGsygTp906u18L0Oimnem" + }, + "href" : "https://api.spotify.com/v1/tracks/0eGsygTp906u18L0Oimnem", + "id" : "0eGsygTp906u18L0Oimnem", + "name" : "Mr. Brightside", + "popularity" : 74, + "preview_url" : "https://p.scdn.co/mp3-preview/934da7155ec15deb326635d69d050543ecbee2b4", + "track_number" : 2, + "type" : "track", + "uri" : "spotify:track:0eGsygTp906u18L0Oimnem" + }, { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6TJmQnO44YE5BtTxH8pop1" + }, + "href" : "https://api.spotify.com/v1/albums/6TJmQnO44YE5BtTxH8pop1", + "id" : "6TJmQnO44YE5BtTxH8pop1", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/8e13218039f81b000553e25522a7f0d7a0600f2e", + "width" : 629 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/8c1e066b5d1045038437d92815d49987f519e44f", + "width" : 295 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/d49268a8fc0768084f4750cf1647709e89a27172", + "width" : 63 + } ], + "name" : "Hot Fuss", + "type" : "album", + "uri" : "spotify:album:6TJmQnO44YE5BtTxH8pop1" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/0C0XlULifJtAgn6ZNCW2eu" + }, + "href" : "https://api.spotify.com/v1/artists/0C0XlULifJtAgn6ZNCW2eu", + "id" : "0C0XlULifJtAgn6ZNCW2eu", + "name" : "The Killers", + "type" : "artist", + "uri" : "spotify:artist:0C0XlULifJtAgn6ZNCW2eu" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "UY" ], + "disc_number" : 1, + "duration_ms" : 197160, + "explicit" : false, + "external_ids" : { + "isrc" : "USIR20400195" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1lDWb6b6ieDQ2xT7ewTC3G" + }, + "href" : "https://api.spotify.com/v1/tracks/1lDWb6b6ieDQ2xT7ewTC3G", + "id" : "1lDWb6b6ieDQ2xT7ewTC3G", + "name" : "Somebody Told Me", + "popularity" : 68, + "preview_url" : "https://p.scdn.co/mp3-preview/0d07673cfb46218a49c96eed639933f19b45cf9c", + "track_number" : 4, + "type" : "track", + "uri" : "spotify:track:1lDWb6b6ieDQ2xT7ewTC3G" + } ] +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-users-profile/ + */ +var userProfile : SpotifyApi.UserProfileResponse = { + "display_name" : "Ronald Pompa", + "external_urls" : { + "spotify" : "https://open.spotify.com/user/wizzler" + }, + "followers" : { + "href" : null, + "total" : 4259 + }, + "href" : "https://api.spotify.com/v1/users/wizzler", + "id" : "wizzler", + "images" : [ { + "height" : null, + "url" : "http://profile-images.scdn.co/images/userprofile/default/3d8a0ed1317df75d99d152a60494a78bfd30c37f", + "width" : null + } ], + "type" : "user", + "uri" : "spotify:user:wizzler" +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-list-users-playlists/ + */ +var usersPlaylists : SpotifyApi.ListOfUsersPlaylistsResponse = { + "href" : "https://api.spotify.com/v1/users/wizzler/playlists?offset=0&limit=2", + "items" : [ { + "collaborative" : false, + "external_urls" : { + "spotify" : "http://open.spotify.com/user/wizzler/playlist/6yRf9SJ1YiAhNAu7UCwgXQ" + }, + "href" : "https://api.spotify.com/v1/users/wizzler/playlists/6yRf9SJ1YiAhNAu7UCwgXQ", + "id" : "6yRf9SJ1YiAhNAu7UCwgXQ", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/5c383056e25a3e3ec858151afb70afe763c00f9b", + "width" : 640 + } ], + "name" : "My Shazam Tracks", + "owner" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/wizzler" + }, + "href" : "https://api.spotify.com/v1/users/wizzler", + "id" : "wizzler", + "type" : "user", + "uri" : "spotify:user:wizzler" + }, + "public" : true, + "snapshot_id" : "WlQppvajE5kH/Xt5cHfHxJ6mSsFckwYixA06q7y1asdUz+m5v7pq6xb1f0FiFa7I", + "tracks" : { + "href" : "https://api.spotify.com/v1/users/wizzler/playlists/6yRf9SJ1YiAhNAu7UCwgXQ/tracks", + "total" : 1 + }, + "type" : "playlist", + "uri" : "spotify:user:wizzler:playlist:6yRf9SJ1YiAhNAu7UCwgXQ" + }, { + "collaborative" : false, + "external_urls" : { + "spotify" : "http://open.spotify.com/user/wizzler/playlist/3FJd21jWvCjGCLx7eKrext" + }, + "href" : "https://api.spotify.com/v1/users/wizzler/playlists/3FJd21jWvCjGCLx7eKrext", + "id" : "3FJd21jWvCjGCLx7eKrext", + "images" : [ { + "height" : 300, + "url" : "https://i.scdn.co/image/15858d38fdac4af890dcc634f4946c5bf83c0915", + "width" : 300 + } ], + "name" : "Video Game Masterpieces", + "owner" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/wizzler" + }, + "href" : "https://api.spotify.com/v1/users/wizzler", + "id" : "wizzler", + "type" : "user", + "uri" : "spotify:user:wizzler" + }, + "public" : true, + "snapshot_id" : "LO0O/RGsDLEgeDC3xVR4HisMNsDqoPLE8QBRqllyvevTJ09tFWIUbjrYoEJbUhCa", + "tracks" : { + "href" : "https://api.spotify.com/v1/users/wizzler/playlists/3FJd21jWvCjGCLx7eKrext/tracks", + "total" : 33 + }, + "type" : "playlist", + "uri" : "spotify:user:wizzler:playlist:3FJd21jWvCjGCLx7eKrext" + } ], + "limit" : 2, + "next" : "https://api.spotify.com/v1/users/wizzler/playlists?offset=2&limit=2", + "offset" : 0, + "previous" : null, + "total" : 7 +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/get-playlist/ + */ +var playlist : SpotifyApi.SinglePlaylistResponse = { + "collaborative" : false, + "description" : null, + "external_urls" : { + "spotify" : "http://open.spotify.com/user/physicaltunes/playlist/0r6srTg2RFfBWba9WZ6Dlq" + }, + "followers" : { + "href" : null, + "total" : 0 + }, + "href" : "https://api.spotify.com/v1/users/physicaltunes/playlists/0r6srTg2RFfBWba9WZ6Dlq", + "id" : "0r6srTg2RFfBWba9WZ6Dlq", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/4adbb659aac44f3eb198e0d7adb85dcf3faf2578", + "width" : 640 + } ], + "name" : "Grundtræning 2svxw", + "owner" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/physicaltunes" + }, + "href" : "https://api.spotify.com/v1/users/physicaltunes", + "id" : "physicaltunes", + "type" : "user", + "uri" : "spotify:user:physicaltunes" + }, + "public" : true, + "snapshot_id" : "Cy9RoIj+cxQzYP1IYy/QX3DT07he1nKjjk/R1LoR0FwVO9NErLfzJofaJzQYb2kq", + "tracks" : { + "href" : "https://api.spotify.com/v1/users/physicaltunes/playlists/0r6srTg2RFfBWba9WZ6Dlq/tracks?offset=0&limit=100", + "items" : [ { + "added_at" : "2015-10-05T06:04:05Z", + "added_by" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/physicaltunes" + }, + "href" : "https://api.spotify.com/v1/users/physicaltunes", + "id" : "physicaltunes", + "type" : "user", + "uri" : "spotify:user:physicaltunes" + }, + "is_local" : false, + "track" : { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/063f8Ej8rLVTz9KkjQKEMa" + }, + "href" : "https://api.spotify.com/v1/albums/063f8Ej8rLVTz9KkjQKEMa", + "id" : "063f8Ej8rLVTz9KkjQKEMa", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/4adbb659aac44f3eb198e0d7adb85dcf3faf2578", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/42cda2065e164df3f923737f3f40b0a26c6b6bd5", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/6fdee9084e91faaa23bbf5880ad3cf5988aea438", + "width" : 64 + } ], + "name" : "Ambient 1/Music For Airports", + "type" : "album", + "uri" : "spotify:album:063f8Ej8rLVTz9KkjQKEMa" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/7MSUfLeTdDEoZiJPDSBXgi" + }, + "href" : "https://api.spotify.com/v1/artists/7MSUfLeTdDEoZiJPDSBXgi", + "id" : "7MSUfLeTdDEoZiJPDSBXgi", + "name" : "Brian Eno", + "type" : "artist", + "uri" : "spotify:artist:7MSUfLeTdDEoZiJPDSBXgi" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 1041520, + "explicit" : false, + "external_ids" : { + "isrc" : "GBAAA0400426" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3bCmDqflFBHijgJfvtqev5" + }, + "href" : "https://api.spotify.com/v1/tracks/3bCmDqflFBHijgJfvtqev5", + "id" : "3bCmDqflFBHijgJfvtqev5", + "name" : "1/1 - 2004 Digital Remaster", + "popularity" : 58, + "preview_url" : "https://p.scdn.co/mp3-preview/b7cd7208aa6c68607b492c5298234cbe8b86c39d", + "track_number" : 1, + "type" : "track", + "uri" : "spotify:track:3bCmDqflFBHijgJfvtqev5" + } + }, { + "added_at" : "2015-10-05T06:05:23Z", + "added_by" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/physicaltunes" + }, + "href" : "https://api.spotify.com/v1/users/physicaltunes", + "id" : "physicaltunes", + "type" : "user", + "uri" : "spotify:user:physicaltunes" + }, + "is_local" : false, + "track" : { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IT", "LI", "LU", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/3LXNSUpx48PQxUn2StRqfu" + }, + "href" : "https://api.spotify.com/v1/albums/3LXNSUpx48PQxUn2StRqfu", + "id" : "3LXNSUpx48PQxUn2StRqfu", + "images" : [ { + "height" : 575, + "url" : "https://i.scdn.co/image/b455d0dba3b95e1a2550d293e6e6443dc68c7a76", + "width" : 640 + }, { + "height" : 270, + "url" : "https://i.scdn.co/image/5da3b3f3d5ac24aaaf2e4c9d7042d5091f6fef2e", + "width" : 300 + }, { + "height" : 58, + "url" : "https://i.scdn.co/image/ee18c4134b0979437f042ee7b3b4d4a78719bedc", + "width" : 64 + } ], + "name" : "The Very Best Of Little Richard", + "type" : "album", + "uri" : "spotify:album:3LXNSUpx48PQxUn2StRqfu" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/4xls23Ye9WR9yy3yYMpAMm" + }, + "href" : "https://api.spotify.com/v1/artists/4xls23Ye9WR9yy3yYMpAMm", + "id" : "4xls23Ye9WR9yy3yYMpAMm", + "name" : "Little Richard", + "type" : "artist", + "uri" : "spotify:artist:4xls23Ye9WR9yy3yYMpAMm" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IT", "LI", "LU", "MC", "MT", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW" ], + "disc_number" : 1, + "duration_ms" : 127386, + "explicit" : false, + "external_ids" : { + "isrc" : "USC4R0817279" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/1fMMRoalpb7E8m5FsAta2y" + }, + "href" : "https://api.spotify.com/v1/tracks/1fMMRoalpb7E8m5FsAta2y", + "id" : "1fMMRoalpb7E8m5FsAta2y", + "name" : "Good Golly Miss Molly", + "popularity" : 53, + "preview_url" : "https://p.scdn.co/mp3-preview/e3dbf57f76595ec38b11a947fa770af3e63d9da9", + "track_number" : 3, + "type" : "track", + "uri" : "spotify:track:1fMMRoalpb7E8m5FsAta2y" + } + }, { + "added_at" : "2015-10-05T06:03:49Z", + "added_by" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/physicaltunes" + }, + "href" : "https://api.spotify.com/v1/users/physicaltunes", + "id" : "physicaltunes", + "type" : "user", + "uri" : "spotify:user:physicaltunes" + }, + "is_local" : false, + "track" : { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/2Uc0HAF0Cj0LAgyzYZX5e3" + }, + "href" : "https://api.spotify.com/v1/albums/2Uc0HAF0Cj0LAgyzYZX5e3", + "id" : "2Uc0HAF0Cj0LAgyzYZX5e3", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/43660a1f9fd70e3463a782e5f7948a54f4e4cc99", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/517be4be20d34be9a9b27e1ff72d974a3ad86238", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/427ac24b200fb7c6ae2a9d62ea499309702d8675", + "width" : 64 + } ], + "name" : "The Miseducation of Lauryn Hill", + "type" : "album", + "uri" : "spotify:album:2Uc0HAF0Cj0LAgyzYZX5e3" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/2Mu5NfyYm8n5iTomuKAEHl" + }, + "href" : "https://api.spotify.com/v1/artists/2Mu5NfyYm8n5iTomuKAEHl", + "id" : "2Mu5NfyYm8n5iTomuKAEHl", + "name" : "Ms. Lauryn Hill", + "type" : "artist", + "uri" : "spotify:artist:2Mu5NfyYm8n5iTomuKAEHl" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/336vr2M3Va0FjyvB55lJEd" + }, + "href" : "https://api.spotify.com/v1/artists/336vr2M3Va0FjyvB55lJEd", + "id" : "336vr2M3Va0FjyvB55lJEd", + "name" : "D'Angelo", + "type" : "artist", + "uri" : "spotify:artist:336vr2M3Va0FjyvB55lJEd" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 350533, + "explicit" : false, + "external_ids" : { + "isrc" : "USSM19803112" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3xhXKRGahWzcXF8rD5gUvd" + }, + "href" : "https://api.spotify.com/v1/tracks/3xhXKRGahWzcXF8rD5gUvd", + "id" : "3xhXKRGahWzcXF8rD5gUvd", + "name" : "Nothing Even Matters", + "popularity" : 62, + "preview_url" : "https://p.scdn.co/mp3-preview/1911854c887c31b05e3167ca18182da1838ce1ed", + "track_number" : 12, + "type" : "track", + "uri" : "spotify:track:3xhXKRGahWzcXF8rD5gUvd" + } + } ], + "limit" : 100, + "next" : null, + "offset" : 0, + "previous" : null, + "total" : 3 + }, + "type" : "playlist", + "uri" : "spotify:user:physicaltunes:playlist:0r6srTg2RFfBWba9WZ6Dlq" +}; + + + + +/** + * Tests + */ +var playlistTracks : SpotifyApi.PlaylistTrackResponse = { + "href" : "https://api.spotify.com/v1/users/spotify_espa%C3%B1a/playlists/21THa8j9TaSGuXYNBU5tsC/tracks?offset=0&limit=3", + "items" : [ { + "added_at" : "2015-12-09T23:12:56Z", + "added_by" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/spotify_espa%C3%B1a" + }, + "href" : "https://api.spotify.com/v1/users/spotify_espa%C3%B1a", + "id" : "spotify_españa", + "type" : "user", + "uri" : "spotify:user:spotify_espa%C3%B1a" + }, + "is_local" : false, + "track" : { + "album" : { + "album_type" : "single", + "available_markets" : [ "AD", "AR", "AT", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/26vwjM6FkX2nEx9I0FKmih" + }, + "href" : "https://api.spotify.com/v1/albums/26vwjM6FkX2nEx9I0FKmih", + "id" : "26vwjM6FkX2nEx9I0FKmih", + "images" : [ { + "height" : 543, + "url" : "https://i.scdn.co/image/e7fda36ee273b819e4aa12dd1d362c04fe1ec087", + "width" : 640 + }, { + "height" : 255, + "url" : "https://i.scdn.co/image/d7347a32de62dcb1bcac5fa4d0ad9d1d5c7e688e", + "width" : 300 + }, { + "height" : 54, + "url" : "https://i.scdn.co/image/bfb8f8395b8983013dea49d1f18563d4f22476ce", + "width" : 64 + } ], + "name" : "Beautiful Liar", + "type" : "album", + "uri" : "spotify:album:26vwjM6FkX2nEx9I0FKmih" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/6vWDO969PvNqNYHIOW5v0m" + }, + "href" : "https://api.spotify.com/v1/artists/6vWDO969PvNqNYHIOW5v0m", + "id" : "6vWDO969PvNqNYHIOW5v0m", + "name" : "Beyoncé", + "type" : "artist", + "uri" : "spotify:artist:6vWDO969PvNqNYHIOW5v0m" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/0EmeFodog0BfCgMzAIvKQp" + }, + "href" : "https://api.spotify.com/v1/artists/0EmeFodog0BfCgMzAIvKQp", + "id" : "0EmeFodog0BfCgMzAIvKQp", + "name" : "Shakira", + "type" : "artist", + "uri" : "spotify:artist:0EmeFodog0BfCgMzAIvKQp" + } ], + "available_markets" : [ "AD", "AR", "AT", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 201520, + "explicit" : false, + "external_ids" : { + "isrc" : "USSM10700448" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/2P5cIXejqLpHDQeCHAbbBG" + }, + "href" : "https://api.spotify.com/v1/tracks/2P5cIXejqLpHDQeCHAbbBG", + "id" : "2P5cIXejqLpHDQeCHAbbBG", + "name" : "Beautiful Liar - Main Version / Album Version", + "popularity" : 58, + "preview_url" : "https://p.scdn.co/mp3-preview/fe55d5e4879a799186e29d24a3c9ffb0c1f9d9ab", + "track_number" : 1, + "type" : "track", + "uri" : "spotify:track:2P5cIXejqLpHDQeCHAbbBG" + } + }, { + "added_at" : "2015-12-09T23:12:56Z", + "added_by" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/spotify_espa%C3%B1a" + }, + "href" : "https://api.spotify.com/v1/users/spotify_espa%C3%B1a", + "id" : "spotify_españa", + "type" : "user", + "uri" : "spotify:user:spotify_espa%C3%B1a" + }, + "is_local" : false, + "track" : { + "album" : { + "album_type" : "album", + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/33va5yaUhlioHypFUHhsck" + }, + "href" : "https://api.spotify.com/v1/albums/33va5yaUhlioHypFUHhsck", + "id" : "33va5yaUhlioHypFUHhsck", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/f104b4e08885330e5747047635127a965b748d4d", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/738aeecd73221be81a6277b9925b36ee078aa66d", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/f47c9a5a7eb92d86c9f1ad4bf599648cd3b76e8d", + "width" : 64 + } ], + "name" : "El Taxi Compilation - 16 Urban Latin Hits", + "type" : "album", + "uri" : "spotify:album:33va5yaUhlioHypFUHhsck" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/1noWnd8QFQD9VLxWEeo4Zf" + }, + "href" : "https://api.spotify.com/v1/artists/1noWnd8QFQD9VLxWEeo4Zf", + "id" : "1noWnd8QFQD9VLxWEeo4Zf", + "name" : "Don Miguelo", + "type" : "artist", + "uri" : "spotify:artist:1noWnd8QFQD9VLxWEeo4Zf" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/0TnOYISbd1XYRBk9myaseg" + }, + "href" : "https://api.spotify.com/v1/artists/0TnOYISbd1XYRBk9myaseg", + "id" : "0TnOYISbd1XYRBk9myaseg", + "name" : "Pitbull", + "type" : "artist", + "uri" : "spotify:artist:0TnOYISbd1XYRBk9myaseg" + } ], + "available_markets" : [ "AD", "AR", "AT", "AU", "BE", "BG", "BO", "BR", "CA", "CH", "CL", "CO", "CR", "CY", "CZ", "DE", "DK", "DO", "EC", "EE", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "MX", "MY", "NI", "NL", "NO", "NZ", "PA", "PE", "PH", "PL", "PT", "PY", "RO", "SE", "SG", "SI", "SK", "SV", "TR", "TW", "US", "UY" ], + "disc_number" : 1, + "duration_ms" : 262253, + "explicit" : false, + "external_ids" : { + "isrc" : "ITF251400144" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/6toFnL1smMF8zxBpp8GHYE" + }, + "href" : "https://api.spotify.com/v1/tracks/6toFnL1smMF8zxBpp8GHYE", + "id" : "6toFnL1smMF8zxBpp8GHYE", + "name" : "Como Yo Le Doy", + "popularity" : 53, + "preview_url" : "https://p.scdn.co/mp3-preview/6482bab5aa82742ad0e374c3660230c15a35e397", + "track_number" : 2, + "type" : "track", + "uri" : "spotify:track:6toFnL1smMF8zxBpp8GHYE" + } + }, { + "added_at" : "2015-12-09T23:12:56Z", + "added_by" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/spotify_espa%C3%B1a" + }, + "href" : "https://api.spotify.com/v1/users/spotify_espa%C3%B1a", + "id" : "spotify_españa", + "type" : "user", + "uri" : "spotify:user:spotify_espa%C3%B1a" + }, + "is_local" : false, + "track" : { + "album" : { + "album_type" : "single", + "available_markets" : [ "CA", "MX", "US" ], + "external_urls" : { + "spotify" : "https://open.spotify.com/album/6GY8rrxuEzSJI08F0rfigi" + }, + "href" : "https://api.spotify.com/v1/albums/6GY8rrxuEzSJI08F0rfigi", + "id" : "6GY8rrxuEzSJI08F0rfigi", + "images" : [ { + "height" : 640, + "url" : "https://i.scdn.co/image/6538912b146e0dd3a4d981801cc89216f1480648", + "width" : 640 + }, { + "height" : 300, + "url" : "https://i.scdn.co/image/01d1c656b0af77059ca0450c30380c80f761cc15", + "width" : 300 + }, { + "height" : 64, + "url" : "https://i.scdn.co/image/2774d8f8aab91ea59688c5461e7c6cc8fe38af22", + "width" : 64 + } ], + "name" : "Sorry (Latino Remix)", + "type" : "album", + "uri" : "spotify:album:6GY8rrxuEzSJI08F0rfigi" + }, + "artists" : [ { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/1uNFoZAHBGtllmzznpCI3s" + }, + "href" : "https://api.spotify.com/v1/artists/1uNFoZAHBGtllmzznpCI3s", + "id" : "1uNFoZAHBGtllmzznpCI3s", + "name" : "Justin Bieber", + "type" : "artist", + "uri" : "spotify:artist:1uNFoZAHBGtllmzznpCI3s" + }, { + "external_urls" : { + "spotify" : "https://open.spotify.com/artist/1vyhD5VmyZ7KMfW5gqLgo5" + }, + "href" : "https://api.spotify.com/v1/artists/1vyhD5VmyZ7KMfW5gqLgo5", + "id" : "1vyhD5VmyZ7KMfW5gqLgo5", + "name" : "J Balvin", + "type" : "artist", + "uri" : "spotify:artist:1vyhD5VmyZ7KMfW5gqLgo5" + } ], + "available_markets" : [ "CA", "MX", "US" ], + "disc_number" : 1, + "duration_ms" : 219986, + "explicit" : false, + "external_ids" : { + "isrc" : "USUM71517619" + }, + "external_urls" : { + "spotify" : "https://open.spotify.com/track/3grxgV6Ot8KqtysApjYLs1" + }, + "href" : "https://api.spotify.com/v1/tracks/3grxgV6Ot8KqtysApjYLs1", + "id" : "3grxgV6Ot8KqtysApjYLs1", + "name" : "Sorry - Latino Remix", + "popularity" : 80, + "preview_url" : "https://p.scdn.co/mp3-preview/7ddedcc0486b4ba86bd8931f73f6cc67dabdf577", + "track_number" : 1, + "type" : "track", + "uri" : "spotify:track:3grxgV6Ot8KqtysApjYLs1" + } + } ], + "limit" : 3, + "next" : "https://api.spotify.com/v1/users/spotify_espa%C3%B1a/playlists/21THa8j9TaSGuXYNBU5tsC/tracks?offset=3&limit=3", + "offset" : 0, + "previous" : null, + "total" : 69 +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/create-playlist/ + */ +var newPlaylist : SpotifyApi.CreatePlaylistResponse = { + "collaborative" : false, + "description" : null, + "external_urls" : { + "spotify" : "http://open.spotify.com/user/physicaltunes/playlist/7tlEEvpdUKuXsS1EAHYKnD" + }, + "followers" : { + "href" : null, + "total" : 0 + }, + "href" : "https://api.spotify.com/v1/users/physicaltunes/playlists/7tlEEvpdUKuXsS1EAHYKnD", + "id" : "7tlEEvpdUKuXsS1EAHYKnD", + "images" : [ ], + "name" : "New Cool Playlist", + "owner" : { + "external_urls" : { + "spotify" : "http://open.spotify.com/user/physicaltunes" + }, + "href" : "https://api.spotify.com/v1/users/physicaltunes", + "id" : "physicaltunes", + "type" : "user", + "uri" : "spotify:user:physicaltunes" + }, + "public" : false, + "snapshot_id" : "6ZasQLSA1dudU/rJlMKbTESXYRont3Bh8XwhSCGfUI3+bDjCXG8CWycbzWo4mxGu", + "tracks" : { + "href" : "https://api.spotify.com/v1/users/physicaltunes/playlists/7tlEEvpdUKuXsS1EAHYKnD/tracks", + "items" : [ ], + "limit" : 100, + "next" : null, + "offset" : 0, + "previous" : null, + "total" : 0 + }, + "type" : "playlist", + "uri" : "spotify:user:physicaltunes:playlist:7tlEEvpdUKuXsS1EAHYKnD" +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/change-playlist-details/ + */ +var changePlaylistDetails : SpotifyApi.ChangePlaylistDetailsReponse = {}; + + + + +/** + * Tests https://developer.spotify.com/web-api/add-tracks-to-playlist/ + */ +var addTracksToPlaylist : SpotifyApi.AddTracksToPlaylistResponse = { + "snapshot_id" : "4qQeMTnHV5LCL9w/lI9Mlu5shi2pk+iiIm6VEpmKdMPCE6adhRNTG9SXflxh8DTt" +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/remove-tracks-playlist/ + */ +var removeTracksFromPlaylist : SpotifyApi.RemoveTracksFromPlaylistResponse = { + "snapshot_id" : "t3+4ZWOqedj+bmcHHu1HKNqYfIyYAfXKlSHHykvS4KAm7hoVhDoCpn+KIuFZebZp" +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/reorder-playlists-tracks/ + */ +var reorderTracksInPlaylist : SpotifyApi.ReorderPlaylistTracksResponse = { + "snapshot_id" : "t3+4ZWOqedj+bmcHHu1HKNqYfIyYAfXKlSHHykvS4KAm7hoVhDoCpn+KIuFZebZp" +}; + + + + +/** + * Tests https://developer.spotify.com/web-api/replace-playlists-tracks/ + */ +var replacePlaylistTracks : SpotifyApi.ReplacePlaylistTracksResponse = {}; + + + + +/** + * Tests https://developer.spotify.com/web-api/check-user-following-playlist/ + */ +var checkUserFollowsPlaylist : SpotifyApi.UsersFollowPlaylistReponse = [true, false, true]; \ No newline at end of file diff --git a/spotify-api/spotify-api.d.ts b/spotify-api/spotify-api.d.ts index 450dad545a..ffc4597459 100644 --- a/spotify-api/spotify-api.d.ts +++ b/spotify-api/spotify-api.d.ts @@ -3,6 +3,13 @@ // Definitions by: Niels Kristian Hansen Skovmand // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Release comments: +// ----------------- +// TrackObjects and AlbumObjects is specified in the docs as always having the available_markets property, +// but when it is sent in https://developer.spotify.com/web-api/console/get-current-user-saved-tracks +// the available_markets are missing. Therefore it is marked as optional in this source code. + + declare module SpotifyApi { // @@ -106,7 +113,7 @@ declare module SpotifyApi { * GET /v1/artists/{id}/related-artists */ interface ArtistsRelatedArtistsResponse { - artists: PagingObject + artists: ArtistObjectFull[] } /** @@ -114,7 +121,7 @@ declare module SpotifyApi { * GET /v1/browse/featured-playlists */ interface ListOfFeaturedPlaylistsResponse { - message: string, + message?: string, playlists: PagingObject } @@ -123,7 +130,7 @@ declare module SpotifyApi { * GET /v1/browse/new-releases */ interface ListOfNewReleasesResponse { - message: string, + message?: string, albums: PagingObject } @@ -160,7 +167,7 @@ declare module SpotifyApi { * GET /v1/me/following?type=artist */ interface UsersFollowedArtistsResponse { - artists: PagingObject + artists: CursorBasedPagingObject } /** @@ -185,7 +192,7 @@ declare module SpotifyApi { * Follow a Playlist * PUT /v1/users/{owner_id}/playlists/{playlist_id}/followers */ - interface FollowAPlaylistReponse extends VoidResponse {} + interface FollowPlaylistReponse extends VoidResponse {} /** * Unfollow a Playlist @@ -233,7 +240,7 @@ declare module SpotifyApi { * Remove Albums for Current User * DELETE /v1/me/albums?ids={ids} */ - interface RemoveAlbumsForCurrentUserResponse extends VoidResponse {} + interface RemoveAlbumsForUserResponse extends VoidResponse {} /** * Check user's saved albums @@ -321,7 +328,7 @@ declare module SpotifyApi { * Create a Playlist * POST /v1/users/{user_id}/playlists */ - interface CreateAPlaylistResponse extends PlaylistObjectFull {} + interface CreatePlaylistResponse extends PlaylistObjectFull {} /** * Change a Playlist’s Details @@ -379,7 +386,6 @@ declare module SpotifyApi { items: T[], limit: number, next: string, - offset: number, total: number } @@ -389,6 +395,7 @@ declare module SpotifyApi { */ interface PagingObject extends BasePagingObject { previous: string, + offset: number } /** @@ -426,7 +433,7 @@ declare module SpotifyApi { */ interface AlbumObjectSimplified { album_type: string, - available_markets: string[], + available_markets?: string[], external_urls: ExternalUrlObject, href: string, id: string, @@ -622,7 +629,7 @@ declare module SpotifyApi { */ interface TrackObjectSimplified { artists: ArtistObjectSimplified[], - available_markets: string[], + available_markets?: string[], disc_number: number, duration_ms: number, explicit: boolean, From 63c8ef1b78fd33379bbe27109924166a5aaa8e69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladimir=20=C4=90oki=C4=87?= Date: Sat, 26 Dec 2015 12:57:44 +0100 Subject: [PATCH 085/441] Initial commit of jquery-mockjax typescript defintion based on work by Laszlo Jakab. --- jquery-mockjax/jquery-mockjax.d.ts | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 jquery-mockjax/jquery-mockjax.d.ts diff --git a/jquery-mockjax/jquery-mockjax.d.ts b/jquery-mockjax/jquery-mockjax.d.ts new file mode 100644 index 0000000000..ea33969bb1 --- /dev/null +++ b/jquery-mockjax/jquery-mockjax.d.ts @@ -0,0 +1,40 @@ +// Type definitions for jQuery Mockjax 2.0.1 +// Project: https://github.com/jakerella/jquery-mockjax +// Definitions by: Laszlo Jakab , Vladimir Đokić +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface MockJaxSettings { + url?: string | RegExp; + data?: any; + type?: string; + headers?: any; + status?: number; + statusText?: string; + responseTime?: number; + isTimeout?: boolean; + contentType?: string; + response?: (settings: any) => void; + responseText?: string; + responseXml?: string; + proxy?: string; + lastModified?: string; + etag?: string; + onAfterSuccess?: Function; + onAfterError?: Function; + onAfterComplete?: Function; +} + +interface MockJaxStatic { + (options: MockJaxSettings): number; + handler(id?: number): any; + clear(id?: number): void; + mockedAjaxCalls(): any[]; + unfiredHandlers(): any[]; + unmockedAjaxCalls(): any[]; +} + +interface JQueryStatic { + mockjax: MockJaxStatic; +} From bb2f73735cc6a4cc0c4d39cac5fde35518a78dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladimir=20=C4=90oki=C4=87?= Date: Sat, 26 Dec 2015 14:06:58 +0100 Subject: [PATCH 086/441] Add logging, proxyType to MockJaxSettings. Add mockjaxSettings to JQueryStatic. Add several tests. --- jquery-mockjax/jquery-mockjax-tests.ts | 173 +++++++++++++++++++++++++ jquery-mockjax/jquery-mockjax.d.ts | 3 + 2 files changed, 176 insertions(+) create mode 100644 jquery-mockjax/jquery-mockjax-tests.ts diff --git a/jquery-mockjax/jquery-mockjax-tests.ts b/jquery-mockjax/jquery-mockjax-tests.ts new file mode 100644 index 0000000000..3528c0fea5 --- /dev/null +++ b/jquery-mockjax/jquery-mockjax-tests.ts @@ -0,0 +1,173 @@ +/// +/// +/// + +class Tests { + private _noErrorCallbackExpected: (jqXHR: JQueryXHR, textStatus: string, errorThrown: string) => any; + private _defaultMockjaxSettings: MockJaxSettings; + + run(): void { + const self = this; + + var t = QUnit.test; + + QUnit.begin(() => { + + self._noErrorCallbackExpected = (jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any => { + QUnit.assert.ok(false, 'Error callback executed'); + }; + + // Speed up our tests + $.mockjaxSettings.responseTime = 0; + $.mockjaxSettings.logging = false; + self._defaultMockjaxSettings = $.mockjaxSettings; + + }); + + QUnit.testDone(() => { + $.mockjax.clear(); + $.mockjaxSettings = self._defaultMockjaxSettings; + }); + + QUnit.module('Core'); + + t('Return XMLHttpRequest object from $.ajax', (assert) => { + $.mockjax({ + url: '/xmlhttprequest', + responseText: 'Hello Word' + }); + + var xhr = $.ajax({ + url: '/xmlhttprequest', + complete: () => { } + }); + + if (xhr && xhr.abort) { + xhr.abort(); + } + + assert.ok(xhr, 'XHR object is not null or undefined'); + assert.ok(xhr.done && xhr.fail, 'Got Promise methods'); + }); + + t('Intercept synchronized proxy calls and return synchronously', (assert) => { + $.mockjax({ + url: '/proxy', + proxy: 'test_proxy.json' + }); + + $.ajax({ + url: '/proxy', + dataType: 'json', + async: false, + success: (json) => { + assert.ok(json && json.proxy, 'Proxy callback request succeeded'); + }, + error: self._noErrorCallbackExpected + }); + }); + + t('Intercept asynchronized proxy calls', (assert) => { + var done = assert.async(); + $.mockjax({ + url: '/proxy', + proxy: 'test_proxy.json' + }); + + $.ajax({ + url: '/proxy', + dataType: 'json', + success: (json) => { + assert.ok(json && json.proxy, 'Proxy callback request succeeded'); + done(); + }, + error: self._noErrorCallbackExpected + }); + }); + + t('Intercept and proxy (sub-ajax request)', (assert) => { + var done = assert.async(); + + $.mockjax({ + url: '/proxy', + proxy: 'test_proxy.json' + }); + + $.ajax({ + url: '/proxy', + dataType: 'json', + success: (json) => { + assert.ok(json && json.proxy, 'Proxy request succeeded'); + }, + error: self._noErrorCallbackExpected, + complete: done + }); + }); + + t('Proxy type specification', (assert) => { + var done = assert.async(); + + $.mockjax({ + url: '/proxy', + proxy: 'test_proxy.json', + proxyType: 'GET' + }); + + $.ajax({ + url: '/proxy', + error: self._noErrorCallbackExpected, + dataType: 'json', + success: (json) => { + assert.ok(json && json.proxy, 'Proxy request succeeded'); + }, + complete: done + }); + }); + + t('Support 1.5 $.ajax(url, settings) signature.', (assert) => { + var done = assert.async(); + + $.mockjax({ + url: '/resource', + responseText: 'Hello World' + }); + + $.ajax('/resource', { + success: (response) => { + assert.equal(response, 'Hello World'); + }, + error: self._noErrorCallbackExpected, + complete: done + }); + }); + + t('Dynamic response callback', (assert) => { + var done = assert.async(); + + var settings: MockJaxSettings = { + url: '/response-callback', + response: (settings) => { + settings.responseText = settings.data.response + ' 2'; + } + }; + + $.mockjax(settings); + + $.ajax({ + url: '/response-callback', + dataType: 'text', + data: { + response: 'Hello world' + }, + error: self._noErrorCallbackExpected, + complete: (xhr) => { + assert.equal(xhr.responseText, 'Hello world 2', 'Response Text matches'); + done(); + } + }); + }); + } +} + +var tests = new Tests(); +tests.run(); diff --git a/jquery-mockjax/jquery-mockjax.d.ts b/jquery-mockjax/jquery-mockjax.d.ts index ea33969bb1..a3045b503c 100644 --- a/jquery-mockjax/jquery-mockjax.d.ts +++ b/jquery-mockjax/jquery-mockjax.d.ts @@ -10,6 +10,7 @@ interface MockJaxSettings { data?: any; type?: string; headers?: any; + logging?: boolean; status?: number; statusText?: string; responseTime?: number; @@ -19,6 +20,7 @@ interface MockJaxSettings { responseText?: string; responseXml?: string; proxy?: string; + proxyType?: string; lastModified?: string; etag?: string; onAfterSuccess?: Function; @@ -37,4 +39,5 @@ interface MockJaxStatic { interface JQueryStatic { mockjax: MockJaxStatic; + mockjaxSettings: MockJaxSettings; } From 85e3e60db34dcb87f133f08f861ebbecd7a43b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladimir=20=C4=90oki=C4=87?= Date: Sat, 26 Dec 2015 15:14:17 +0100 Subject: [PATCH 087/441] Convert remaining tabs to spaces for jquery-mockjax-tests.ts. --- jquery-mockjax/jquery-mockjax-tests.ts | 243 ++++++++++++------------- 1 file changed, 121 insertions(+), 122 deletions(-) diff --git a/jquery-mockjax/jquery-mockjax-tests.ts b/jquery-mockjax/jquery-mockjax-tests.ts index 3528c0fea5..6fae52eb07 100644 --- a/jquery-mockjax/jquery-mockjax-tests.ts +++ b/jquery-mockjax/jquery-mockjax-tests.ts @@ -11,161 +11,160 @@ class Tests { var t = QUnit.test; - QUnit.begin(() => { + QUnit.begin(() => { - self._noErrorCallbackExpected = (jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any => { - QUnit.assert.ok(false, 'Error callback executed'); - }; + self._noErrorCallbackExpected = (jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any => { + QUnit.assert.ok(false, 'Error callback executed'); + }; - // Speed up our tests - $.mockjaxSettings.responseTime = 0; + // Speed up our tests + $.mockjaxSettings.responseTime = 0; $.mockjaxSettings.logging = false; - self._defaultMockjaxSettings = $.mockjaxSettings; + self._defaultMockjaxSettings = $.mockjaxSettings; + }); - }); - - QUnit.testDone(() => { - $.mockjax.clear(); - $.mockjaxSettings = self._defaultMockjaxSettings; - }); + QUnit.testDone(() => { + $.mockjax.clear(); + $.mockjaxSettings = self._defaultMockjaxSettings; + }); QUnit.module('Core'); t('Return XMLHttpRequest object from $.ajax', (assert) => { - $.mockjax({ - url: '/xmlhttprequest', - responseText: 'Hello Word' - }); + $.mockjax({ + url: '/xmlhttprequest', + responseText: 'Hello Word' + }); - var xhr = $.ajax({ - url: '/xmlhttprequest', - complete: () => { } - }); + var xhr = $.ajax({ + url: '/xmlhttprequest', + complete: () => { } + }); - if (xhr && xhr.abort) { - xhr.abort(); - } + if (xhr && xhr.abort) { + xhr.abort(); + } - assert.ok(xhr, 'XHR object is not null or undefined'); - assert.ok(xhr.done && xhr.fail, 'Got Promise methods'); - }); + assert.ok(xhr, 'XHR object is not null or undefined'); + assert.ok(xhr.done && xhr.fail, 'Got Promise methods'); + }); t('Intercept synchronized proxy calls and return synchronously', (assert) => { - $.mockjax({ - url: '/proxy', - proxy: 'test_proxy.json' - }); + $.mockjax({ + url: '/proxy', + proxy: 'test_proxy.json' + }); - $.ajax({ - url: '/proxy', - dataType: 'json', - async: false, - success: (json) => { - assert.ok(json && json.proxy, 'Proxy callback request succeeded'); - }, - error: self._noErrorCallbackExpected - }); - }); + $.ajax({ + url: '/proxy', + dataType: 'json', + async: false, + success: (json) => { + assert.ok(json && json.proxy, 'Proxy callback request succeeded'); + }, + error: self._noErrorCallbackExpected + }); + }); t('Intercept asynchronized proxy calls', (assert) => { - var done = assert.async(); - $.mockjax({ - url: '/proxy', - proxy: 'test_proxy.json' - }); + var done = assert.async(); + $.mockjax({ + url: '/proxy', + proxy: 'test_proxy.json' + }); - $.ajax({ - url: '/proxy', - dataType: 'json', - success: (json) => { - assert.ok(json && json.proxy, 'Proxy callback request succeeded'); - done(); - }, - error: self._noErrorCallbackExpected - }); - }); + $.ajax({ + url: '/proxy', + dataType: 'json', + success: (json) => { + assert.ok(json && json.proxy, 'Proxy callback request succeeded'); + done(); + }, + error: self._noErrorCallbackExpected + }); + }); t('Intercept and proxy (sub-ajax request)', (assert) => { - var done = assert.async(); + var done = assert.async(); - $.mockjax({ - url: '/proxy', - proxy: 'test_proxy.json' - }); + $.mockjax({ + url: '/proxy', + proxy: 'test_proxy.json' + }); - $.ajax({ - url: '/proxy', - dataType: 'json', - success: (json) => { - assert.ok(json && json.proxy, 'Proxy request succeeded'); - }, - error: self._noErrorCallbackExpected, - complete: done - }); - }); + $.ajax({ + url: '/proxy', + dataType: 'json', + success: (json) => { + assert.ok(json && json.proxy, 'Proxy request succeeded'); + }, + error: self._noErrorCallbackExpected, + complete: done + }); + }); t('Proxy type specification', (assert) => { - var done = assert.async(); + var done = assert.async(); - $.mockjax({ - url: '/proxy', - proxy: 'test_proxy.json', - proxyType: 'GET' - }); + $.mockjax({ + url: '/proxy', + proxy: 'test_proxy.json', + proxyType: 'GET' + }); - $.ajax({ - url: '/proxy', - error: self._noErrorCallbackExpected, - dataType: 'json', - success: (json) => { - assert.ok(json && json.proxy, 'Proxy request succeeded'); - }, - complete: done - }); - }); + $.ajax({ + url: '/proxy', + error: self._noErrorCallbackExpected, + dataType: 'json', + success: (json) => { + assert.ok(json && json.proxy, 'Proxy request succeeded'); + }, + complete: done + }); + }); - t('Support 1.5 $.ajax(url, settings) signature.', (assert) => { - var done = assert.async(); + t('Support 1.5 $.ajax(url, settings) signature.', (assert) => { + var done = assert.async(); - $.mockjax({ - url: '/resource', - responseText: 'Hello World' - }); + $.mockjax({ + url: '/resource', + responseText: 'Hello World' + }); - $.ajax('/resource', { - success: (response) => { - assert.equal(response, 'Hello World'); - }, - error: self._noErrorCallbackExpected, - complete: done - }); - }); + $.ajax('/resource', { + success: (response) => { + assert.equal(response, 'Hello World'); + }, + error: self._noErrorCallbackExpected, + complete: done + }); + }); - t('Dynamic response callback', (assert) => { - var done = assert.async(); + t('Dynamic response callback', (assert) => { + var done = assert.async(); var settings: MockJaxSettings = { - url: '/response-callback', - response: (settings) => { - settings.responseText = settings.data.response + ' 2'; - } - }; + url: '/response-callback', + response: (settings) => { + settings.responseText = settings.data.response + ' 2'; + } + }; - $.mockjax(settings); + $.mockjax(settings); - $.ajax({ - url: '/response-callback', - dataType: 'text', - data: { - response: 'Hello world' - }, - error: self._noErrorCallbackExpected, - complete: (xhr) => { - assert.equal(xhr.responseText, 'Hello world 2', 'Response Text matches'); - done(); - } - }); - }); + $.ajax({ + url: '/response-callback', + dataType: 'text', + data: { + response: 'Hello world' + }, + error: self._noErrorCallbackExpected, + complete: (xhr) => { + assert.equal(xhr.responseText, 'Hello world 2', 'Response Text matches'); + done(); + } + }); + }); } } From 37984e386f6c8268c02bde4f5db4cdd72199f4bc Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 26 Dec 2015 21:30:07 +0500 Subject: [PATCH 088/441] lodash: signatures of _.isFinite have been changed --- lodash/lodash-tests.ts | 22 ++++++++++++++++++---- lodash/lodash.d.ts | 13 +++++++++++-- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 3f7a26556d..eae6e8fa38 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5920,10 +5920,24 @@ result = _({}).isError(); } // _.isFinite -result = _.isFinite(any); -result = _(1).isFinite(); -result = _([]).isFinite(); -result = _({}).isFinite(); +module TestIsFinite { + { + let result: boolean; + + result = _.isFinite(any); + result = _(1).isFinite(); + result = _([]).isFinite(); + result = _({}).isFinite(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isFinite(); + result = _([]).chain().isFinite(); + result = _({}).chain().isFinite(); + } +} // _.isFunction module TestIsFunction { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 584500c101..2a93f0ad9b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9928,11 +9928,13 @@ declare module _ { interface LoDashStatic { /** * Checks if value is a finite primitive number. + * * Note: This method is based on Number.isFinite. + * * @param value The value to check. * @return Returns true if value is a finite number, else false. - **/ - isFinite(value?: any): value is number; + */ + isFinite(value?: any): boolean; } interface LoDashImplicitWrapperBase { @@ -9942,6 +9944,13 @@ declare module _ { isFinite(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.isFinite + */ + isFinite(): LoDashExplicitWrapper; + } + //_.isFunction interface LoDashStatic { /** From 3c5aa7c8f870bd345f5d8f62c47762be8d30cc5c Mon Sep 17 00:00:00 2001 From: Craig Leinoff Date: Sat, 26 Dec 2015 18:02:02 -0500 Subject: [PATCH 089/441] Adding ambient external (in addition to ambient internal) module def. --- easystarjs/easystarjs.d.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/easystarjs/easystarjs.d.ts b/easystarjs/easystarjs.d.ts index 6755543e3f..4c16236db9 100755 --- a/easystarjs/easystarjs.d.ts +++ b/easystarjs/easystarjs.d.ts @@ -3,8 +3,8 @@ // Definitions by: Magnus Gustafsson // Definitions: https://github.com/borisyankov/DefinitelyTyped /* -easystarjs.d.ts may be freely distributed under the MIT license. -*/ + easystarjs.d.ts may be freely distributed under the MIT license. + */ declare module easystarjs { @@ -31,4 +31,6 @@ declare module easystarjs } } - +declare module "easystarjs" { + export = easystarjs; +} \ No newline at end of file From acce45cb00a565e797d822f8509b742a26dd72c7 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Sun, 27 Dec 2015 01:35:59 +0200 Subject: [PATCH 090/441] File renamed react-notification-system-test.ts changed to react-notification-system-tests.ts --- ...fication-system-test.ts => react-notification-system-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename react-notification-system/{react-notification-system-test.ts => react-notification-system-tests.ts} (100%) diff --git a/react-notification-system/react-notification-system-test.ts b/react-notification-system/react-notification-system-tests.ts similarity index 100% rename from react-notification-system/react-notification-system-test.ts rename to react-notification-system/react-notification-system-tests.ts From f64dd4dbd28cafb4b8c601a8c24376ac769789f4 Mon Sep 17 00:00:00 2001 From: Kaoru Hagihara Date: Sun, 27 Dec 2015 21:47:10 +0900 Subject: [PATCH 091/441] fix vue-router --- vue-router/vue-router-tests.ts | 4 ++++ vue-router/vue-router.d.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/vue-router/vue-router-tests.ts b/vue-router/vue-router-tests.ts index 4456b0a476..b0fc1b511d 100644 --- a/vue-router/vue-router-tests.ts +++ b/vue-router/vue-router-tests.ts @@ -19,6 +19,10 @@ namespace TestBasic { }); var App = Vue.extend({}); + var app = new App(); + app.$on("some event", function() { + var name: string = app.$route.name; + }); var router = new VueRouter(); diff --git a/vue-router/vue-router.d.ts b/vue-router/vue-router.d.ts index 729e8f6efd..97f31c922d 100644 --- a/vue-router/vue-router.d.ts +++ b/vue-router/vue-router.d.ts @@ -75,6 +75,10 @@ declare namespace vuerouter { } declare namespace vuejs { + interface Vue { + $route: vuerouter.$route; + } + interface ComponentOption { route?: vuerouter.TransitionHook; } From 7e41f71ee1e232ceddd2791e7a9d84cf696d1208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e?= Date: Fri, 11 Dec 2015 20:17:56 +0100 Subject: [PATCH 092/441] github-electron: Add various missing interfaces --- github-electron/github-electron.d.ts | 90 ++++++++++++++++++++++++---- 1 file changed, 77 insertions(+), 13 deletions(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 46a8f81a7f..37dd602228 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1121,7 +1121,7 @@ declare module GitHubElectron { * Note: This API is only available on Mac. */ setMenu(menu: Menu): void; - } + }; } class AutoUpdater implements NodeJS.EventEmitter { @@ -1353,7 +1353,7 @@ declare module GitHubElectron { * Only string properties are send correctly. * Nested objects are not supported. */ - extra?: {} + extra?: {}; } interface CrashReporterPayload extends Object { @@ -1406,7 +1406,7 @@ declare module GitHubElectron { getLastCrashReport(): CrashReporterPayload; } - interface Shell{ + interface Shell { /** * Show the given file in a file manager. If possible, select the file. */ @@ -1464,7 +1464,7 @@ declare module GitHubElectron { sendToHost(channel: string, ...args: any[]): void; } - interface Remote { + interface Remote extends CommonElectron { /** * @returns The object returned by require(module) in the main process. */ @@ -1472,7 +1472,7 @@ declare module GitHubElectron { /** * @returns The BrowserWindow object which this web page belongs to. */ - getCurrentWindow(): BrowserWindow + getCurrentWindow(): BrowserWindow; /** * @returns The global variable of name (e.g. global[name]) in the main process. */ @@ -1481,7 +1481,7 @@ declare module GitHubElectron { * Returns the process object in the main process. This is the same as * remote.getGlobal('process'), but gets cached. */ - process: any; + process: NodeJS.Process; } interface WebFrame { @@ -1523,7 +1523,7 @@ declare module GitHubElectron { // Type definitions for main process - interface ContentTracing { + interface ContentTracing { /** * Get a set of category groups. The category groups can change as new code paths are reached. * @param callback Called once all child processes have acked to the getCategories request. @@ -1710,30 +1710,94 @@ declare module GitHubElectron { RequestBufferJob: typeof RequestBufferJob; } + interface PowerSaveBlocker { + start(type: string): number; + stop(id: number): void; + isStarted(id: number): boolean; + } - interface Electron { + interface ClearStorageDataOptions { + origin?: string; + storages?: string[]; + quotas?: string[]; + } + + interface NetworkEmulationOptions { + offline?: boolean; + latency?: number; + downloadThroughput?: number; + uploadThroughput?: number; + } + + interface CertificateVerifyProc { + (hostname: string, cert: any, callback: (accepted: boolean) => any): any; + } + + class Session { + static fromPartition(partition: string): Session; + static defaultSession: Session; + + cookies: any; + clearCache(callback: Function): void; + clearStorageData(callback: Function): void; + clearStorageData(options: ClearStorageDataOptions, callback: Function): void; + setProxy(config: string, callback: Function): void; + resolveProxy(url: URL, callback: (proxy: any) => any): void; + setDownloadPath(path: string): void; + enableNetworkEmulation(options: NetworkEmulationOptions): void; + disableNetworkEmulation(): void; + setCertificateVerifyProc(proc: CertificateVerifyProc): void; + webRequest: any; + } + + interface CommonElectron { clipboard: GitHubElectron.Clipboard; crashReporter: GitHubElectron.CrashReporter; nativeImage: typeof GitHubElectron.NativeImage; - screen: GitHubElectron.Screen; shell: GitHubElectron.Shell; - remote: GitHubElectron.Remote; - ipcRenderer: GitHubElectron.IpcRenderer; - webFrame: GitHubElectron.WebFrame; + app: GitHubElectron.App; autoUpdater: GitHubElectron.AutoUpdater; BrowserWindow: typeof GitHubElectron.BrowserWindow; contentTracing: GitHubElectron.ContentTracing; dialog: GitHubElectron.Dialog; - globalShortcut: GitHubElectron.GlobalShortcut; ipcMain: NodeJS.EventEmitter; + globalShortcut: GitHubElectron.GlobalShortcut; Menu: typeof GitHubElectron.Menu; MenuItem: typeof GitHubElectron.MenuItem; powerMonitor: NodeJS.EventEmitter; + powerSaveBlocker: GitHubElectron.PowerSaveBlocker; protocol: GitHubElectron.Protocol; + screen: GitHubElectron.Screen; + session: GitHubElectron.Session; Tray: typeof GitHubElectron.Tray; hideInternalModules(): void; } + + interface DesktopCapturerOptions { + types?: string[]; + thumbnailSize?: { + width: number; + height: number; + }; + } + + interface DesktopCapturerSource { + id: string; + name: string; + thumbnail: NativeImage; + } + + interface DesktopCapturer { + getSources(options: any, callback: (error: Error, sources: DesktopCapturerSource[]) => any): void; + } + + interface Electron extends CommonElectron { + desktopCapturer: GitHubElectron.DesktopCapturer; + ipcRenderer: GitHubElectron.IpcRenderer; + remote: GitHubElectron.Remote; + webFrame: GitHubElectron.WebFrame; + } } interface Window { From e058e7897f9d60012f5e3728fbcc825d623625a7 Mon Sep 17 00:00:00 2001 From: brian ridley Date: Sun, 27 Dec 2015 15:12:20 +0000 Subject: [PATCH 093/441] Add bezier-easing definitions --- bezier-easing/bezier-easing-tests.ts | 21 +++++++++++++++++++++ bezier-easing/bezier-easing.d.ts | 24 ++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 bezier-easing/bezier-easing-tests.ts create mode 100644 bezier-easing/bezier-easing.d.ts diff --git a/bezier-easing/bezier-easing-tests.ts b/bezier-easing/bezier-easing-tests.ts new file mode 100644 index 0000000000..eab1fb4f15 --- /dev/null +++ b/bezier-easing/bezier-easing-tests.ts @@ -0,0 +1,21 @@ +/// + +function test_create_from_array() { + let easing: BezierEasing = BezierEasing([0, 0, 1, 0.5]); +} + +function test_create_from_params() { + let easing: BezierEasing = BezierEasing(0, 0, 1, 0.5); +} + +function test_create_from_builtins() { + let easing: BezierEasing = BezierEasing.css['ease-in']; +} + +function test_methods() { + let easing: BezierEasing = BezierEasing.css['ease-in']; + let easedRatio: number = easing.get(0.5); + let points: Array = easing.getPoints(); + let stringified: string = easing.toString(); + let asCSS: string = easing.toCSS(); +} diff --git a/bezier-easing/bezier-easing.d.ts b/bezier-easing/bezier-easing.d.ts new file mode 100644 index 0000000000..695368e7af --- /dev/null +++ b/bezier-easing/bezier-easing.d.ts @@ -0,0 +1,24 @@ +// Type definitions for bezier-easing +// Project: https://github.com/gre/bezier-easing +// Definitions by: brian ridley +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare interface BezierEasing { + get(ratio: number): number; + getPoints(): Array; + toString(): string; + toCSS(): string; +} + +declare function BezierEasing(points: Array): BezierEasing; +declare function BezierEasing(a: number, b: number, c: number, d: number): BezierEasing; + +declare namespace BezierEasing { + let css: { + 'ease': BezierEasing, + 'linear': BezierEasing, + 'ease-in': BezierEasing, + 'ease-out': BezierEasing, + 'ease-in-out': BezierEasing + }; +} From 3e646c84a56a95b860bcbe5650a4775ebd79c6af Mon Sep 17 00:00:00 2001 From: Mizunashi Mana Date: Sun, 27 Dec 2015 23:54:15 +0900 Subject: [PATCH 094/441] add custom type on parsimmon Reference: https://github.com/jneen/parsimmon#adding-base-parsers --- parsimmon/parsimmon-tests.ts | 3 +++ parsimmon/parsimmon.d.ts | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/parsimmon/parsimmon-tests.ts b/parsimmon/parsimmon-tests.ts index 3f80198917..569328296f 100644 --- a/parsimmon/parsimmon-tests.ts +++ b/parsimmon/parsimmon-tests.ts @@ -110,6 +110,9 @@ fooPar = P.succeed(foo); fooArrPar = P.seq(fooPar, fooPar); anyArrPar = P.seq(barPar, fooPar, numPar); +fooPar = P.custom((success, failure) => (stream, i) => { str = stream; num = i; return success(num, foo); }); +fooPar = P.custom((success, failure) => (stream, i) => failure(num, str)); + fooPar = P.alt(fooPar, fooPar); anyPar = P.alt(barPar, fooPar, numPar); diff --git a/parsimmon/parsimmon.d.ts b/parsimmon/parsimmon.d.ts index 719e9c937d..8a088e256a 100644 --- a/parsimmon/parsimmon.d.ts +++ b/parsimmon/parsimmon.d.ts @@ -1,12 +1,14 @@ // Type definitions for Parsimmon 0.5.0 // Project: https://github.com/jneen/parsimmon -// Definitions by: Bart van der Schoor +// Definitions by: Bart van der Schoor , Mizunashi Mana // Definitions: https://github.com/borisyankov/DefinitelyTyped // TODO convert to generics declare module 'parsimmon' { module Parsimmon { + + export type StreamType = string; export interface Mark { start: number; @@ -103,6 +105,14 @@ declare module 'parsimmon' { export function seq(...parsers: Parser[]): Parser; export function seq(...parsers: Parser[]): Parser; + export type successFunctionType = (index: number, result: U) => Result; + export type failureFunctionType = (index: number, msg: string) => Result; + export type parseFunctionType = (stream: StreamType, index: number) => Result; + /* + allows to add custom primitive parsers. + */ + export function custom(parsingFunction: (success: successFunctionType, failure: failureFunctionType) => parseFunctionType): Parser; + /* accepts a variable number of parsers, and yields the value of the first one that succeeds, backtracking in between. */ From af6a6531122b53795021b0a2e190d90ef7df4fd6 Mon Sep 17 00:00:00 2001 From: Daniel Furtado Date: Sun, 27 Dec 2015 16:58:55 +0100 Subject: [PATCH 095/441] Added _.isMatch function --- underscore/underscore.d.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 8cf98071b6..23646f0441 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -1387,6 +1387,14 @@ interface UnderscoreStatic { **/ isEmpty(object: any): boolean; + /** + * Returns true if the keys and values in `properties` matches with the `object` properties. + * @param object Object to be compared with `properties`. + * @param properties Properties be compared with `object` + * @return True if `object` has matching keys and values, otherwise false. + **/ + isMatch(object:any, properties:any): boolean; + /** * Returns true if object is a DOM element. * @param object Check if this object is a DOM element. @@ -2326,6 +2334,12 @@ interface Underscore { * @see _.isEmpty **/ isEmpty(): boolean; + + /** + * Wrapped type `object`. + * @see _.isMatch + **/ + isMatch(): boolean; /** * Wrapped type `object`. @@ -3204,6 +3218,12 @@ interface _Chain { * @see _.isEmpty **/ isEmpty(): _Chain; + + /** + * Wrapped type `object`. + * @see _.isMatch + **/ + isMatch(): _Chain; /** * Wrapped type `object`. From 05774649a6121ee69c66912c352e20405392c755 Mon Sep 17 00:00:00 2001 From: Daniel Furtado Date: Sun, 27 Dec 2015 20:08:30 +0100 Subject: [PATCH 096/441] Added _.findIndex and _.findLastIndex functions --- underscore/underscore.d.ts | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 23646f0441..feca736882 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -961,6 +961,30 @@ interface UnderscoreStatic { array: _.List, value: T, from?: number): number; + + /** + * Returns the first index of an element in `array` where the predicate truth test passes + * @param array The array to search for the index of the first element where the predicate truth test passes. + * @param predicate Predicate function. + * @param context `this` object in `predicate`, optional. + * @return Returns the index of an element in `array` where the predicate truth test passes or -1.` + **/ + findIndex( + array: _.List, + predicate: _.ListIterator, + context?: any): number; + + /** + * Returns the last index of an element in `array` where the predicate truth test passes + * @param array The array to search for the index of the last element where the predicate truth test passes. + * @param predicate Predicate function. + * @param context `this` object in `predicate`, optional. + * @return Returns the index of an element in `array` where the predicate truth test passes or -1.` + **/ + findLastIndex( + array: _.List, + predicate: _.ListIterator, + context?: any): number; /** * Uses a binary search to determine the index at which the value should be inserted into the list in order @@ -2115,6 +2139,16 @@ interface Underscore { **/ lastIndexOf(value: T, from?: number): number; + /** + * @see _.findIndex + **/ + findIndex(array: _.List, predicate: _.ListIterator, context?: any): number; + + /** + * @see _.findLastIndex + **/ + findLastIndex(array: _.List, predicate: _.ListIterator, context?: any): number; + /** * Wrapped type `any[]`. * @see _.sortedIndex @@ -2999,6 +3033,16 @@ interface _Chain { **/ lastIndexOf(value: T, from?: number): _ChainSingle; + /** + * @see _.findIndex + **/ + findIndex(predicate: _.ListIterator, context?: any): _Chain; + + /** + * @see _.findLastIndex + **/ + findLastIndex(predicate: _.ListIterator, context?: any): _Chain; + /** * Wrapped type `any[]`. * @see _.sortedIndex From a3ff0859bfa11094c1425d3e5ea38f4824c99916 Mon Sep 17 00:00:00 2001 From: pyoungon Date: Mon, 28 Dec 2015 11:11:00 +0900 Subject: [PATCH 097/441] changed callback parameters as optional. --- mongodb/mongodb.d.ts | 164 +++++++++++++++++++++---------------------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 38037f0039..9d5488e32d 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -13,8 +13,8 @@ declare module "mongodb" { export class MongoClient{ constructor(serverConfig: any, options: any); - static connect(uri: string, options: any, callback: (err: Error, db: Db) => void): void; - static connect(uri: string, callback: (err: Error, db: Db) => void): void; + static connect(uri: string, options: any, callback?: (err: Error, db: Db) => void): void; + static connect(uri: string, callback?: (err: Error, db: Db) => void): void; } // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/server.html @@ -30,22 +30,22 @@ declare module "mongodb" { public db(dbName: string): Db; - public open(callback: (err : Error, db : Db) => void ): void; + public open(callback?: (err : Error, db : Db) => void ): void; public close(forceClose?: boolean, callback?: (err: Error, result: any) => void ): void; - public admin(callback: (err: Error, result: any) => void ): any; + public admin(callback?: (err: Error, result: any) => void ): any; public collectionsInfo(collectionName: string, callback?: (err: Error, result: any) => void ): void; public collectionNames(collectionName: string, options: any, callback?: (err: Error, result: any) => void ): void; public collection(collectionName: string): Collection; - public collection(collectionName: string, callback: (err: Error, collection: Collection) => void ): Collection; - public collection(collectionName: string, options: MongoCollectionOptions, callback: (err: Error, collection: Collection) => void ): Collection; + public collection(collectionName: string, callback?: (err: Error, collection: Collection) => void ): Collection; + public collection(collectionName: string, options: MongoCollectionOptions, callback?: (err: Error, collection: Collection) => void ): Collection; - public collections(callback: (err: Error, collections: Collection[]) => void ): void; + public collections(callback?: (err: Error, collections: Collection[]) => void ): void; public eval(code: any, parameters: any[], options?: any, callback?: (err: Error, result: any) => void ): void; - //public dereference(dbRef: DbRef, callback: (err: Error, result: any) => void): void; + //public dereference(dbRef: DbRef, callback?: (err: Error, result: any) => void): void; public logout(options: any, callback?: (err: Error, result: any) => void ): void; - public logout(callback: (err: Error, result: any) => void ): void; + public logout(callback?: (err: Error, result: any) => void ): void; public authenticate(userName: string, password: string, callback?: (err: Error, result: any) => void ): void; public authenticate(userName: string, password: string, options: any, callback?: (err: Error, result: any) => void ): void; @@ -65,8 +65,8 @@ declare module "mongodb" { public dropCollection(collectionName: string, callback?: (err: Error, result: any) => void ): void; public renameCollection(fromCollection: string, toCollection: string, callback?: (err: Error, result: any) => void ): void; - public lastError(options: Object, connectionOptions: any, callback: (err: Error, result: any) => void ): void; - public previousError(options: Object, callback: (err: Error, result: any) => void ): void; + public lastError(options: Object, connectionOptions: any, callback?: (err: Error, result: any) => void ): void; + public previousError(options: Object, callback?: (err: Error, result: any) => void ): void; // error = lastError // lastStatus = lastError @@ -80,28 +80,28 @@ declare module "mongodb" { public resetErrorHistory(callback?: (err: Error, result: any) => void ): void; public resetErrorHistory(options: any, callback?: (err: Error, result: any) => void ): void; - public createIndex(collectionName: any, fieldOrSpec: any, options: IndexOptions, callback: Function): void; - public ensureIndex(collectionName: any, fieldOrSpec: any, options: IndexOptions, callback: Function): void; + public createIndex(collectionName: any, fieldOrSpec: any, options: IndexOptions, callback?: Function): void; + public ensureIndex(collectionName: any, fieldOrSpec: any, options: IndexOptions, callback?: Function): void; - public cursorInfo(options: any, callback: Function): void; + public cursorInfo(options: any, callback?: Function): void; - public dropIndex(collectionName: string, indexName: string, callback: Function): void; - public reIndex(collectionName: string, callback: Function): void; - public indexInformation(collectionName: string, options: any, callback: Function): void; - public dropDatabase(callback: (err: Error, result: any) => void ): void; + public dropIndex(collectionName: string, indexName: string, callback?: Function): void; + public reIndex(collectionName: string, callback?: Function): void; + public indexInformation(collectionName: string, options: any, callback?: Function): void; + public dropDatabase(callback?: (err: Error, result: any) => void ): void; - public stats(options: any, callback: Function): void; - public _registerHandler(db_command: any, raw: any, connection: any, exhaust: any, callback: Function): void; - public _reRegisterHandler(newId: any, object: any, callback: Function): void; + public stats(options: any, callback?: Function): void; + public _registerHandler(db_command: any, raw: any, connection: any, exhaust: any, callback?: Function): void; + public _reRegisterHandler(newId: any, object: any, callback?: Function): void; public _callHandler(id: any, document: any, err: any): any; public _hasHandler(id: any): any; public _removeHandler(id: any): any; - public _findHandler(id: any): { id: string; callback: Function; }; - public __executeQueryCommand(self: any, db_command: any, options: any, callback: any): void; + public _findHandler(id: any): { id: string; callback?: Function; }; + public __executeQueryCommand(self: any, db_command: any, options: any, callback?: any): void; public DEFAULT_URL: string; - public connect(url: string, options: { uri_decode_auth?: boolean; }, callback: (err: Error, result: any) => void ): void; + public connect(url: string, options: { uri_decode_auth?: boolean; }, callback?: (err: Error, result: any) => void ): void; public addListener(event: string, handler:(param: any) => any): any; } @@ -127,11 +127,11 @@ declare module "mongodb" { // Creates an ObjectID from a hex string representation of an ObjectID. // hexString – create a ObjectID from a passed in 24 byte hexstring. public static createFromHexString(hexString: string): ObjectID; - + // Checks if a value is a valid bson ObjectId // id - Value to be checked public static isValid(id: string): Boolean; - + // Generate a 12 byte id string used in ObjectID's // time - optional parameter allowing to pass in a second based timestamp public generate(time?: number): string; @@ -308,16 +308,16 @@ declare module "mongodb" { * @deprecated use insertOne or insertMany * Documentation : http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert */ - insert(query: any, callback: (err: Error, result: any) => void): void; - insert(query: any, options: { safe?: any; continueOnError?: boolean; keepGoing?: boolean; serializeFunctions?: boolean; }, callback: (err: Error, result: any) => void): void; + insert(query: any, callback?: (err: Error, result: any) => void): void; + insert(query: any, options: { safe?: any; continueOnError?: boolean; keepGoing?: boolean; serializeFunctions?: boolean; }, callback?: (err: Error, result: any) => void): void; // Documentation : http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insertOne - insertOne(doc:any, callback: (err: Error, result: any) => void) :void; - insertOne(doc: any, options: { w?: any; wtimeout?: number; j?: boolean; serializeFunctions?: boolean; forceServerObjectId?: boolean }, callback: (err: Error, result: any) => void): void; + insertOne(doc:any, callback?: (err: Error, result: any) => void) :void; + insertOne(doc: any, options: { w?: any; wtimeout?: number; j?: boolean; serializeFunctions?: boolean; forceServerObjectId?: boolean }, callback?: (err: Error, result: any) => void): void; // Documentation : http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insertMany - insertMany(docs: any, callback: (err: Error, result: any) => void): void; - insertMany(docs: any, options: { w?: any; wtimeout?: number; j?: boolean; serializeFunctions?: boolean; forceServerObjectId?: boolean }, callback: (err: Error, result: any) => void): void; + insertMany(docs: any, callback?: (err: Error, result: any) => void): void; + insertMany(docs: any, options: { w?: any; wtimeout?: number; j?: boolean; serializeFunctions?: boolean; forceServerObjectId?: boolean }, callback?: (err: Error, result: any) => void): void; /** * @deprecated use deleteOne or deleteMany * Documentation : http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#remove @@ -326,12 +326,12 @@ declare module "mongodb" { remove(selector: Object, options: { safe?: any; single?: boolean; }, callback?: (err: Error, result: any) => void): void; // Documentation : http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#deleteOne - deleteOne(filter: any, callback: (err: Error, result: any) => void): void; - deleteOne(filter: any, options: { w?: any; wtimeout?: number; j?: boolean;}, callback: (err: Error, result: any) => void): void; + deleteOne(filter: any, callback?: (err: Error, result: any) => void): void; + deleteOne(filter: any, options: { w?: any; wtimeout?: number; j?: boolean;}, callback?: (err: Error, result: any) => void): void; // Documentation : http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#deleteMany - deleteMany(filter: any, callback: (err: Error, result: any) => void): void; - deleteMany(filter: any, options: { w?: any; wtimeout?: number; j?: boolean;}, callback: (err: Error, result: any) => void): void; + deleteMany(filter: any, callback?: (err: Error, result: any) => void): void; + deleteMany(filter: any, options: { w?: any; wtimeout?: number; j?: boolean;}, callback?: (err: Error, result: any) => void): void; rename(newName: String, callback?: (err: Error, result: any) => void): void; @@ -342,30 +342,30 @@ declare module "mongodb" { * Documentation : http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update */ update(selector: Object, document: any, callback?: (err: Error, result: any) => void): void; - update(selector: Object, document: any, options: { safe?: boolean; upsert?: any; multi?: boolean; serializeFunctions?: boolean; }, callback: (err: Error, result: any) => void): void; + update(selector: Object, document: any, options: { safe?: boolean; upsert?: any; multi?: boolean; serializeFunctions?: boolean; }, callback?: (err: Error, result: any) => void): void; // Documentation : http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#updateOne - updateOne(filter: Object, update: any, callback: (err: Error, result: any) => void): void; - updateOne(filter: Object, update: any, options: { upsert?: boolean; w?: any; wtimeout?: number; j?: boolean;}, callback: (err: Error, result: any) => void): void; + updateOne(filter: Object, update: any, callback?: (err: Error, result: any) => void): void; + updateOne(filter: Object, update: any, options: { upsert?: boolean; w?: any; wtimeout?: number; j?: boolean;}, callback?: (err: Error, result: any) => void): void; // Documentation : http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#updateMany - updateMany(filter: Object, update: any, callback: (err: Error, result: any) => void): void; - updateMany(filter: Object, update: any, options: { upsert?: boolean; w?: any; wtimeout?: number; j?: boolean;}, callback: (err: Error, result: any) => void): void; + updateMany(filter: Object, update: any, callback?: (err: Error, result: any) => void): void; + updateMany(filter: Object, update: any, options: { upsert?: boolean; w?: any; wtimeout?: number; j?: boolean;}, callback?: (err: Error, result: any) => void): void; - distinct(key: string, query: Object, callback: (err: Error, result: any) => void): void; - distinct(key: string, query: Object, options: { readPreference: string; }, callback: (err: Error, result: any) => void): void; + distinct(key: string, query: Object, callback?: (err: Error, result: any) => void): void; + distinct(key: string, query: Object, options: { readPreference: string; }, callback?: (err: Error, result: any) => void): void; - count(callback: (err: Error, result: any) => void): void; - count(query: Object, callback: (err: Error, result: any) => void): void; - count(query: Object, options: { readPreference: string; }, callback: (err: Error, result: any) => void): void; + count(callback?: (err: Error, result: any) => void): void; + count(query: Object, callback?: (err: Error, result: any) => void): void; + count(query: Object, options: { readPreference: string; }, callback?: (err: Error, result: any) => void): void; drop(callback?: (err: Error, result: any) => void): void; /** * @deprecated use findOneAndUpdate, findOneAndReplace or findOneAndDelete * Documentation : http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#findAndModify */ - findAndModify(query: Object, sort: any[], doc: Object, callback: (err: Error, result: any) => void): void; - findAndModify(query: Object, sort: any[], doc: Object, options: { safe?: any; remove?: boolean; upsert?: boolean; new?: boolean; }, callback: (err: Error, result: any) => void): void; + findAndModify(query: Object, sort: any[], doc: Object, callback?: (err: Error, result: any) => void): void; + findAndModify(query: Object, sort: any[], doc: Object, options: { safe?: any; remove?: boolean; upsert?: boolean; new?: boolean; }, callback?: (err: Error, result: any) => void): void; /** * @deprecated use findOneAndDelete * Documentation : http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#findAndRemove @@ -374,16 +374,16 @@ declare module "mongodb" { findAndRemove(query : Object, sort? : any[], options?: { safe: any; }, callback?: (err: Error, result: any) => void): void; // Documentation : http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#findOneAndDelete - findOneAndDelete(filter: any, callback: (err: Error, result: any) => void): void; - findOneAndDelete(filter: any, options: { projection?: any; sort?: any; maxTimeMS?: number; }, callback: (err: Error, result: any) => void): void; + findOneAndDelete(filter: any, callback?: (err: Error, result: any) => void): void; + findOneAndDelete(filter: any, options: { projection?: any; sort?: any; maxTimeMS?: number; }, callback?: (err: Error, result: any) => void): void; // Documentation : http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#findOneAndReplace - findOneAndReplace(filter: any, replacement: any, callback: (err: Error, result: any) => void): void; - findOneAndReplace(filter: any, replacement: any, options: { projection?: any; sort?: any; maxTimeMS?: number; upsert?: boolean; returnOriginal?: boolean }, callback: (err: Error, result: any) => void): void; + findOneAndReplace(filter: any, replacement: any, callback?: (err: Error, result: any) => void): void; + findOneAndReplace(filter: any, replacement: any, options: { projection?: any; sort?: any; maxTimeMS?: number; upsert?: boolean; returnOriginal?: boolean }, callback?: (err: Error, result: any) => void): void; // Documentation : http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#findOneAndUpdate - findOneAndUpdate(filter: any, update: any, callback: (err: Error, result: any) => void): void; - findOneAndUpdate(filter: any, update: any, options: { projection?: any; sort?: any; maxTimeMS?: number; upsert?: boolean; returnOriginal?: boolean }, callback: (err: Error, result: any) => void): void; + findOneAndUpdate(filter: any, update: any, callback?: (err: Error, result: any) => void): void; + findOneAndUpdate(filter: any, update: any, options: { projection?: any; sort?: any; maxTimeMS?: number; upsert?: boolean; returnOriginal?: boolean }, callback?: (err: Error, result: any) => void): void; find(callback?: (err: Error, result: Cursor) => void): Cursor; find(selector: Object, callback?: (err: Error, result: Cursor) => void): Cursor; @@ -401,32 +401,32 @@ declare module "mongodb" { findOne(selector: Object, fields: any, skip: number, limit: number, callback?: (err: Error, result: any) => void): Cursor; findOne(selector: Object, fields: any, skip: number, limit: number, timeout: number, callback?: (err: Error, result: any) => void): Cursor; - createIndex(fieldOrSpec: any, callback: (err: Error, indexName: string) => void): void; - createIndex(fieldOrSpec: any, options: IndexOptions, callback: (err: Error, indexName: string) => void): void; + createIndex(fieldOrSpec: any, callback?: (err: Error, indexName: string) => void): void; + createIndex(fieldOrSpec: any, options: IndexOptions, callback?: (err: Error, indexName: string) => void): void; - ensureIndex(fieldOrSpec: any, callback: (err: Error, indexName: string) => void): void; - ensureIndex(fieldOrSpec: any, options: IndexOptions, callback: (err: Error, indexName: string) => void): void; + ensureIndex(fieldOrSpec: any, callback?: (err: Error, indexName: string) => void): void; + ensureIndex(fieldOrSpec: any, options: IndexOptions, callback?: (err: Error, indexName: string) => void): void; - indexInformation(options: any, callback: Function): void; - dropIndex(name: string, callback: Function): void; - dropAllIndexes(callback: Function): void; + indexInformation(options: any, callback?: Function): void; + dropIndex(name: string, callback?: Function): void; + dropAllIndexes(callback?: Function): void; // dropIndexes = dropAllIndexes - reIndex(callback: Function): void; - mapReduce(map: Function, reduce: Function, options: MapReduceOptions, callback: Function): void; - group(keys: Object, condition: Object, initial: Object, reduce: Function, finalize: Function, command: boolean, options: {readPreference: string}, callback: Function): void; - options(callback: Function): void; - isCapped(callback: Function): void; - indexExists(indexes: string, callback: Function): void; - geoNear(x: number, y: number, callback: Function): void; - geoNear(x: number, y: number, options: Object, callback: Function): void; - geoHaystackSearch(x: number, y: number, callback: Function): void; - geoHaystackSearch(x: number, y: number, options: Object, callback: Function): void; - indexes(callback: Function): void; - aggregate(pipeline: any[], callback: (err: Error, results: any) => void): void; - aggregate(pipeline: any[], options: {readPreference: string}, callback: (err: Error, results: any) => void): void; - stats(options: {readPreference: string; scale: number}, callback: (err: Error, results: CollStats) => void): void; - stats(callback: (err: Error, results: CollStats) => void): void; + reIndex(callback?: Function): void; + mapReduce(map: Function, reduce: Function, options: MapReduceOptions, callback?: Function): void; + group(keys: Object, condition: Object, initial: Object, reduce: Function, finalize: Function, command: boolean, options: {readPreference: string}, callback?: Function): void; + options(callback?: Function): void; + isCapped(callback?: Function): void; + indexExists(indexes: string, callback?: Function): void; + geoNear(x: number, y: number, callback?: Function): void; + geoNear(x: number, y: number, options: Object, callback?: Function): void; + geoHaystackSearch(x: number, y: number, callback?: Function): void; + geoHaystackSearch(x: number, y: number, options: Object, callback?: Function): void; + indexes(callback?: Function): void; + aggregate(pipeline: any[], callback?: (err: Error, results: any) => void): void; + aggregate(pipeline: any[], options: {readPreference: string}, callback?: (err: Error, results: any) => void): void; + stats(options: {readPreference: string; scale: number}, callback?: (err: Error, results: CollStats) => void): void; + stats(callback?: (err: Error, results: CollStats) => void): void; hint: any; } @@ -468,9 +468,9 @@ declare module "mongodb" { // constructor(db: Db, collection: Collection, selector, fields, options); rewind() : Cursor; - toArray(callback: (err: Error, results: any[]) => any) : void; - each(callback: (err: Error, item: any) => void) : void; - count(applySkipLimit: boolean, callback: (err: Error, count: number) => void) : void; + toArray(callback?: (err: Error, results: any[]) => any) : void; + each(callback?: (err: Error, item: any) => void) : void; + count(applySkipLimit: boolean, callback?: (err: Error, count: number) => void) : void; sort(keyOrList: any, callback? : (err: Error, result: any) => void): Cursor; @@ -481,12 +481,12 @@ declare module "mongodb" { skip(skip: number, callback?: (err: Error, result: any) => void): Cursor; batchSize(batchSize: number, callback?: (err: Error, result: any) => void): Cursor; - nextObject(callback: (err: Error, doc: any) => void) : void; - explain(callback: (err: Error, result: any) => void) : void; + nextObject(callback?: (err: Error, doc: any) => void) : void; + explain(callback?: (err: Error, result: any) => void) : void; stream(): CursorStream; - close(callback: (err: Error, result: any) => void) : void; + close(callback?: (err: Error, result: any) => void) : void; isClosed(): boolean; public static INIT: number; From 8b2be7dbb22fb9042798c717d10a86a833643365 Mon Sep 17 00:00:00 2001 From: Jasper Patterson Date: Sun, 27 Dec 2015 20:46:15 -0700 Subject: [PATCH 098/441] Changed `autoCapitalize` attribute from boolean to string --- react/react.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react/react.d.ts b/react/react.d.ts index 718daeedda..15146eb9b5 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -1822,7 +1822,7 @@ declare namespace __React { vocab?: string; // Non-standard Attributes - autoCapitalize?: boolean; + autoCapitalize?: string; autoCorrect?: string; autoSave?: string; color?: string; From 0f6f5f6b69f2864eaa40357efc16eb000e1bb30a Mon Sep 17 00:00:00 2001 From: pyoungon Date: Mon, 28 Dec 2015 13:59:47 +0900 Subject: [PATCH 099/441] changed close parameter as optional. --- socket.io/socket.io.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index a34a78b8c4..3556068589 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -647,7 +647,7 @@ declare module SocketIO { * @param close If true, also closes the underlying connection * @return This Socket */ - disconnect( close: boolean ): Socket; + disconnect( close?: boolean ): Socket; /** * Adds a listener for a particular event. Calling multiple times will add From 5f5dea2a151dcf25dcaa9eaab90443bd7a5e422a Mon Sep 17 00:00:00 2001 From: vvakame Date: Mon, 28 Dec 2015 14:39:52 +0900 Subject: [PATCH 100/441] fix typo --- rcloader/rcloader.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rcloader/rcloader.d.ts b/rcloader/rcloader.d.ts index b3805d0def..e06ac5905d 100644 --- a/rcloader/rcloader.d.ts +++ b/rcloader/rcloader.d.ts @@ -1,5 +1,5 @@ // Type definitions for rcloader -// Project: hhttps://github.com/spalger/rcloader +// Project: https://github.com/spalger/rcloader // Definitions by: Panu Horsmalahti // Definitions: https://github.com/borisyankov/DefinitelyTyped From a47a1eebc160b453b5e36e11a65c8b3bd7fc5448 Mon Sep 17 00:00:00 2001 From: kmxz Date: Mon, 28 Dec 2015 14:11:09 +0800 Subject: [PATCH 101/441] fbemitter --- fbemitter/fbemitter-tests.ts | 349 +++++++++++++++++++++++++++++++++++ fbemitter/fbemitter.d.ts | 67 +++++++ 2 files changed, 416 insertions(+) create mode 100644 fbemitter/fbemitter-tests.ts create mode 100644 fbemitter/fbemitter.d.ts diff --git a/fbemitter/fbemitter-tests.ts b/fbemitter/fbemitter-tests.ts new file mode 100644 index 0000000000..614d579634 --- /dev/null +++ b/fbemitter/fbemitter-tests.ts @@ -0,0 +1,349 @@ +/// +/// +/// +/// +'use strict'; + +/** + * The tests are adapted from ../eventemitter3/eventemitter3-tests.ts + */ + +import { EventEmitter, EventSubscription } from 'fbemitter'; +import * as util from 'util'; +import * as assert from 'assert'; + +describe('EventEmitter', function tests() { + 'use strict'; + + it('inherits when used with require(util).inherits', function () { + class Beast extends EventEmitter { + /* rawr, i'm a beast */ + } + + util.inherits(Beast, EventEmitter); + + var moop = new Beast() + , meap = new Beast(); + + assert.strictEqual(moop instanceof Beast, true); + assert.strictEqual(moop instanceof EventEmitter, true); + + moop.listeners('click'); + meap.listeners('click'); + + moop.addListener('data', function () { + throw new Error('I should not emit'); + }); + + meap.emit('data', 'rawr'); + meap.removeAllListeners(); + }); + + describe('EventEmitter#emit', function () { + it('emits with context', function (done) { + var context = { bar: 'baz' } + , e = new EventEmitter(); + + e.addListener('foo', function (bar: string) { + assert.strictEqual(bar, 'bar'); + assert.strictEqual(this, context); + + done(); + }, context); + + e.emit('foo', 'bar'); + }); + + it('can emit the function with multiple arguments', function () { + var e = new EventEmitter(); + + for(var i = 0; i < 100; i++) { + (function (j: number) { + for (var i = 0, args: number[] = []; i < j; i++) { + args.push(j); + } + + e.once('args', function () { + assert.strictEqual(arguments.length, args.length); + assert.deepStrictEqual(Array.prototype.slice.call(arguments), args); + }); + + e.emit.apply(e, (['args'] as any[]).concat(args)); + })(i); + } + }); + + it('can emit the function with multiple arguments, multiple listeners', function () { + var e = new EventEmitter(); + + for(var i = 0; i < 100; i++) { + (function (j: number) { + for (var i = 0, args: number[] = []; i < j; i++) { + args.push(j); + } + + e.once('args', function () { + assert.strictEqual(arguments.length, args.length); + assert.deepStrictEqual(Array.prototype.slice.call(arguments), args); + }); + + e.once('args', function () { + assert.strictEqual(arguments.length, args.length); + assert.deepStrictEqual(Array.prototype.slice.call(arguments), args); + }); + + e.once('args', function () { + assert.strictEqual(arguments.length, args.length); + assert.deepStrictEqual(Array.prototype.slice.call(arguments), args); + }); + + e.once('args', function () { + assert.strictEqual(arguments.length, args.length); + assert.deepStrictEqual(Array.prototype.slice.call(arguments), args); + }); + + e.emit.apply(e, (['args'] as any[]).concat(args)); + })(i); + } + }); + + it('emits with context, multiple listeners (force loop)', function () { + var e = new EventEmitter(); + + e.addListener('foo', function (bar: string) { + assert.deepStrictEqual(this, { foo: 'bar' }); + assert.strictEqual(bar, 'bar'); + }, { foo: 'bar' }); + + e.addListener('foo', function (bar: string) { + assert.deepStrictEqual(this, { bar: 'baz' }); + assert.strictEqual(bar, 'bar'); + }, { bar: 'baz' }); + + e.emit('foo', 'bar'); + }); + + it('emits with different contexts', function () { + var e = new EventEmitter() + , pattern = ''; + + function writer() { + pattern += this; + } + + e.addListener('write', writer, 'foo'); + e.addListener('write', writer, 'baz'); + e.once('write', writer, 'bar'); + e.once('write', writer, 'banana'); + + e.emit('write'); + assert.strictEqual(pattern, 'foobazbarbanana'); + }); + + it('receives the emitted events', function (done) { + var e = new EventEmitter(); + + e.addListener('data', function (a: string, b: EventEmitter, c: Date, d: void, undef: void) { + assert.strictEqual(a, 'foo'); + assert.strictEqual(b, e); + assert.strictEqual(c instanceof Date, true); + assert.strictEqual(undef, undefined); + assert.strictEqual(arguments.length, 3); + + done(); + }); + + e.emit('data', 'foo', e, new Date()); + }); + + it('emits to all event listeners', function () { + var e = new EventEmitter() + , pattern: string[] = []; + + e.addListener('foo', function () { + pattern.push('foo1'); + }); + + e.addListener('foo', function () { + pattern.push('foo2'); + }); + + e.emit('foo'); + + assert.strictEqual(pattern.join(';'), 'foo1;foo2'); + }); + + }); + + describe('EventEmitter#listeners', function () { + it('returns an empty array if no listeners are specified', function () { + var e = new EventEmitter(); + + assert.strictEqual(e.listeners('foo') instanceof Array, true); + assert.strictEqual(e.listeners('foo').length, 0); + }); + + it('returns an array of function', function () { + var e = new EventEmitter(); + + function foo() {} + + e.addListener('foo', foo); + assert.strictEqual(e.listeners('foo') instanceof Array, true); + assert.strictEqual(e.listeners('foo').length, 1); + console.log(e.listeners('foo')[0]); + assert.strictEqual(e.listeners('foo')[0], foo); + }); + + it('is not vulnerable to modifications', function () { + var e = new EventEmitter(); + + function foo() {} + + e.addListener('foo', foo); + + assert.strictEqual(e.listeners('foo')[0], foo); + + e.listeners('foo').length = 0; + assert.strictEqual(e.listeners('foo')[0], foo); + }); + }); + + describe('EventEmitter#once', function () { + it('only emits it once', function () { + var e = new EventEmitter() + , calls = 0; + + e.once('foo', function () { + calls++; + }); + + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + + assert.strictEqual(e.listeners('foo').length, 0); + assert.strictEqual(calls, 1); + }); + + it('only emits once if emits are nested inside the listener', function () { + var e = new EventEmitter() + , calls = 0; + + e.once('foo', function () { + calls++; + e.emit('foo'); + }); + + e.emit('foo'); + assert.strictEqual(e.listeners('foo').length, 0); + assert.strictEqual(calls, 1); + }); + + it('only emits once for multiple events', function () { + var e = new EventEmitter() + , multi = 0 + , foo = 0 + , bar = 0; + + e.once('foo', function () { + foo++; + }); + + e.once('foo', function () { + bar++; + }); + + e.addListener('foo', function () { + multi++; + }); + + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + + assert.strictEqual(e.listeners('foo').length, 1); + assert.strictEqual(multi, 5); + assert.strictEqual(foo, 1); + assert.strictEqual(bar, 1); + }); + + it('only emits once with context', function (done) { + var context = { foo: 'bar' } + , e = new EventEmitter(); + + e.once('foo', function (bar: string) { + assert.strictEqual(this, context); + assert.strictEqual(bar, 'bar'); + done(); + }, context); + + e.emit('foo', 'bar'); + }); + }); + + describe('EventSubscription#remove', function () { + it('should only remove the event with the specified function', function () { + var e = new EventEmitter(); + + function bar() {} + var foo = e.addListener('foo', function () {}); + var bar1 = e.addListener('bar', function () {}); + var bar2 = e.addListener('bar', bar); + + assert.strictEqual(e.listeners('foo').length, 1); + assert.strictEqual(e.listeners('bar').length, 2); + + foo.remove(); + assert.strictEqual(e.listeners('foo').length, 0); + assert.strictEqual(e.listeners('bar').length, 2); + + bar2.remove(); + assert.strictEqual(e.listeners('bar').length, 1); + + bar1.remove(); + assert.strictEqual(e.listeners('bar').length, 0); + }); + }); + + describe('EventEmitter#removeAllListeners', function () { + it('removes all events for the specified events', function () { + var e = new EventEmitter(); + + e.addListener('foo', function () { throw new Error('oops'); }); + e.addListener('foo', function () { throw new Error('oops'); }); + e.addListener('bar', function () { throw new Error('oops'); }); + e.addListener('aaa', function () { throw new Error('oops'); }); + + e.removeAllListeners('foo'); + assert.strictEqual(e.listeners('foo').length, 0); + assert.strictEqual(e.listeners('bar').length, 1); + assert.strictEqual(e.listeners('aaa').length, 1); + + e.removeAllListeners('bar'); + e.removeAllListeners('aaa'); + assert.strictEqual(e.listeners('foo').length, 0); + assert.strictEqual(e.listeners('bar').length, 0); + assert.strictEqual(e.listeners('aaa').length, 0); + }); + + it('just nukes the fuck out of everything', function () { + var e = new EventEmitter(); + + e.addListener('foo', function () { throw new Error('oops'); }); + e.addListener('foo', function () { throw new Error('oops'); }); + e.addListener('bar', function () { throw new Error('oops'); }); + e.addListener('aaa', function () { throw new Error('oops'); }); + + e.removeAllListeners(); + assert.strictEqual(e.listeners('foo').length, 0); + assert.strictEqual(e.listeners('bar').length, 0); + assert.strictEqual(e.listeners('aaa').length, 0); + }); + }); + +}); diff --git a/fbemitter/fbemitter.d.ts b/fbemitter/fbemitter.d.ts new file mode 100644 index 0000000000..b26b1a3162 --- /dev/null +++ b/fbemitter/fbemitter.d.ts @@ -0,0 +1,67 @@ +// Type definitions for Facebook's EventEmitter 2.0.0 +// Project: https://github.com/facebook/emitter +// Definitions by: kmxz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'fbemitter' { + + export class EventSubscription { + + listener: Function; + context: any; + + /** + * Removes this subscription from the subscriber that controls it. + */ + remove(): void; + + } + + export class EventEmitter { + + constructor(); + + /** + * Adds a listener to be invoked when events of the specified type are + * emitted. An optional calling context may be provided. The data arguments + * emitted will be passed to the listener function. + */ + addListener(eventType: string, listener: Function, context?: any): EventSubscription; + + /** + * Similar to addListener, except that the listener is removed after it is + * invoked once. + */ + once(eventType: string, listener: Function, context?: any): EventSubscription; + + /** + * Removes all of the registered listeners, including those registered as + * listener maps. + */ + removeAllListeners(eventType?: string): void; + + /** + * Provides an API that can be called during an eventing cycle to remove the + * last listener that was invoked. This allows a developer to provide an event + * object that can remove the listener (or listener map) during the + * invocation. + * + * If it is called when not inside of an emitting cycle it will throw. + */ + removeCurrentListener(): void; + + /** + * Returns an array of listeners that are currently registered for the given + * event. + */ + listeners(eventType: string): Function[]; + + /** + * Emits an event of the given type with the given data. All handlers of that + * particular type will be notified. + */ + emit(eventType: string, ...data: any[]): void; + + } + +} \ No newline at end of file From 3408d9ad072960ff0c77bc8b93b1fea31a0aea5f Mon Sep 17 00:00:00 2001 From: Vincent Lesierse Date: Mon, 28 Dec 2015 08:41:44 +0100 Subject: [PATCH 102/441] Moved react-router-bootstrap to it's own directory --- .../react-router-bootstrap-tests.tsx | 32 +++++++++++++++++++ .../react-router-bootstrap.d.ts | 0 2 files changed, 32 insertions(+) create mode 100644 react-router-bootstrap/react-router-bootstrap-tests.tsx rename {react-bootstrap => react-router-bootstrap}/react-router-bootstrap.d.ts (100%) diff --git a/react-router-bootstrap/react-router-bootstrap-tests.tsx b/react-router-bootstrap/react-router-bootstrap-tests.tsx new file mode 100644 index 0000000000..0211e97e7e --- /dev/null +++ b/react-router-bootstrap/react-router-bootstrap-tests.tsx @@ -0,0 +1,32 @@ +// React-Router-Bootstrap Test +// ================================================================================ +/// +/// +/// + +// Imports +// -------------------------------------------------------------------------------- +import * as React from 'react'; +import { Component, CSSProperties } from 'react'; +import { Button } from 'react-bootstrap'; +import { LinkContainer, IndexLinkContainer } from 'react-router-bootstrap' + + +export class ReactRouterBootstrapTest extends Component { + callback() { + alert('Callback: ' + JSON.stringify(arguments)); + } + + public render() { + let style: CSSProperties = { padding: '50px' }; + return ( +
+ +
+ + +
+
+ ); + } +} diff --git a/react-bootstrap/react-router-bootstrap.d.ts b/react-router-bootstrap/react-router-bootstrap.d.ts similarity index 100% rename from react-bootstrap/react-router-bootstrap.d.ts rename to react-router-bootstrap/react-router-bootstrap.d.ts From 0b6c7d2b8d618fa01a8b2d0fd7ffbabb5f133c1d Mon Sep 17 00:00:00 2001 From: Vincent Lesierse Date: Mon, 28 Dec 2015 08:44:51 +0100 Subject: [PATCH 103/441] Removed test from React-Bootstrap --- react-bootstrap/react-bootstrap-tests.tsx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/react-bootstrap/react-bootstrap-tests.tsx b/react-bootstrap/react-bootstrap-tests.tsx index f5b4e0a6eb..8b0dd0fc0a 100644 --- a/react-bootstrap/react-bootstrap-tests.tsx +++ b/react-bootstrap/react-bootstrap-tests.tsx @@ -1,7 +1,6 @@ // React-Bootstrap Test // ================================================================================ /// -/// /// // Imports @@ -9,7 +8,6 @@ import * as React from 'react'; import { Component, CSSProperties } from 'react'; import { Button, ButtonToolbar, Modal, Well, ButtonGroup, DropdownButton, MenuItem, Panel, ListGroup, ListGroupItem, Accordion, Tooltip, OverlayTrigger, Popover, ProgressBar, Nav, NavItem, Navbar, NavDropdown, Tabs, Tab, Pager, PageItem, Pagination, Alert, Carousel, CarouselItem, Grid, Row, Col, Thumbnail, Label, Badge, Jumbotron, PageHeader, Glyphicon, Table, Input, ButtonInput } from 'react-bootstrap'; -import { LinkContainer, IndexLinkContainer } from 'react-router-bootstrap' export class ReactBootstrapTest extends Component { @@ -894,11 +892,6 @@ export class ReactBootstrapTest extends Component { - -
- - -
); } From d63d77d56779f60b812d985734e51c4db5c5b469 Mon Sep 17 00:00:00 2001 From: Mizunashi Mana Date: Mon, 28 Dec 2015 19:01:32 +0900 Subject: [PATCH 104/441] use CamelCase for type name --- parsimmon/parsimmon.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parsimmon/parsimmon.d.ts b/parsimmon/parsimmon.d.ts index 8a088e256a..94b1b3be12 100644 --- a/parsimmon/parsimmon.d.ts +++ b/parsimmon/parsimmon.d.ts @@ -105,13 +105,13 @@ declare module 'parsimmon' { export function seq(...parsers: Parser[]): Parser; export function seq(...parsers: Parser[]): Parser; - export type successFunctionType = (index: number, result: U) => Result; - export type failureFunctionType = (index: number, msg: string) => Result; - export type parseFunctionType = (stream: StreamType, index: number) => Result; + export type SuccessFunctionType = (index: number, result: U) => Result; + export type FailureFunctionType = (index: number, msg: string) => Result; + export type ParseFunctionType = (stream: StreamType, index: number) => Result; /* allows to add custom primitive parsers. */ - export function custom(parsingFunction: (success: successFunctionType, failure: failureFunctionType) => parseFunctionType): Parser; + export function custom(parsingFunction: (success: SuccessFunctionType, failure: FailureFunctionType) => ParseFunctionType): Parser; /* accepts a variable number of parsers, and yields the value of the first one that succeeds, backtracking in between. From da3e6dcb13c5a4eb0f09005c709ea7c8f62fc847 Mon Sep 17 00:00:00 2001 From: Klaus Reimer Date: Mon, 28 Dec 2015 11:09:44 +0100 Subject: [PATCH 105/441] Add typings for NodeJS library "fullname" --- fullname/fullname-tests.ts | 5 +++++ fullname/fullname.d.ts | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 fullname/fullname-tests.ts create mode 100644 fullname/fullname.d.ts diff --git a/fullname/fullname-tests.ts b/fullname/fullname-tests.ts new file mode 100644 index 0000000000..a037f2634e --- /dev/null +++ b/fullname/fullname-tests.ts @@ -0,0 +1,5 @@ +/// + +import fullname = require("fullname"); + +fullname().then(function(name) { name === "string"; }); diff --git a/fullname/fullname.d.ts b/fullname/fullname.d.ts new file mode 100644 index 0000000000..a1d44f1672 --- /dev/null +++ b/fullname/fullname.d.ts @@ -0,0 +1,11 @@ +// Type definitions for fullname v2.1.0 +// Project: https://www.npmjs.com/package/fullname +// Definitions by: Klaus Reimer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "fullname" { + function fullname(): Promise; + export = fullname; +} From 536c66c55191a134f7bc89c6d93be4d2325b85d8 Mon Sep 17 00:00:00 2001 From: Klaus Reimer Date: Mon, 28 Dec 2015 11:44:22 +0100 Subject: [PATCH 106/441] Add typings for NodeJS library "username" --- username/username-tests.ts | 10 ++++++++++ username/username.d.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 username/username-tests.ts create mode 100644 username/username.d.ts diff --git a/username/username-tests.ts b/username/username-tests.ts new file mode 100644 index 0000000000..46265958bb --- /dev/null +++ b/username/username-tests.ts @@ -0,0 +1,10 @@ +/// + +import username = require("username"); + +username(function(err, username) { + err === new Error(); + username === "string"; +}); + +username.sync() === "string"; diff --git a/username/username.d.ts b/username/username.d.ts new file mode 100644 index 0000000000..5784f46ff5 --- /dev/null +++ b/username/username.d.ts @@ -0,0 +1,27 @@ +// Type definitions for username v1.0.1 +// Project: https://www.npmjs.com/package/username +// Definitions by: Klaus Reimer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "username" { + /** + * Tries to get the username from the LOGNAME, USER, LNAME or USERNAME environment variables. + * Falls back to `id -un` on OS X / Linux and `whoami` on Windows in the rare case none of the environment + * variables are set. The result is cached. + * + * @param callback The callback function to call asynchronously with the result. + */ + function username(callback: (err: Error, result: string) => void): void; + + module username { + /** + * Tries to get the username from the LOGNAME, USER, LNAME or USERNAME environment variables. Falls back + * to returning an empty string in the reare case none of the environment variables are set. + * + * @return The username or empty string if not found. + */ + function sync(): string; + } + + export = username; +} From 64b25f63f0ec821040a5d3e049a976865062ed9d Mon Sep 17 00:00:00 2001 From: David Sulc Date: Mon, 28 Dec 2015 14:35:04 +0100 Subject: [PATCH 107/441] add getProcessedConfig to IBrowser typing https://angular.github.io/protractor/#/api?view=Protractor.prototype.getProcessedConfig --- angular-protractor/angular-protractor.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/angular-protractor/angular-protractor.d.ts b/angular-protractor/angular-protractor.d.ts index dc969927ed..08f83e27d4 100644 --- a/angular-protractor/angular-protractor.d.ts +++ b/angular-protractor/angular-protractor.d.ts @@ -1806,6 +1806,16 @@ declare module protractor { * @return {Protractor} a protractor instance. */ forkNewDriverInstance(opt_useSameUrl?: boolean, opt_copyMockModules?: boolean): Protractor; + + /** + * Get the processed configuration object that is currently being run. This will contain + * the specs and capabilities properties of the current runner instance. + * + * Set by the runner. + * + * @return {webdriver.promise.Promise} A promise which resolves to the capabilities object. + */ + getProcessedConfig(): webdriver.promise.Promise; } /** From 6a759e63cf6f67326b4aa84314d5d8fd5307447b Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 28 Dec 2015 21:18:43 +0500 Subject: [PATCH 108/441] lodash: signatures of _.isArguments have been changed --- lodash/lodash-tests.ts | 43 +++++++++++++++++++++++++++--------------- lodash/lodash.d.ts | 8 ++++++++ 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2b..81768861ae 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5736,21 +5736,34 @@ module TestGte { } // _.isArguments -result = _.isArguments(any); -result = _(1).isArguments(); -result = _([]).isArguments(); -result = _({}).isArguments(); -{ - let value: IArguments|number = 42; - if (_.isArguments(value)) { - let length: number = value.length; - // compile error - // let i: number = value + 1; - } else { - let i: number = value + 1; - // compile error - // let length: number = value.length; - } +module TestisArguments { + { + let value: number|IArguments; + + if (_.isArguments(value)) { + let result: IArguments = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isArguments(any); + result = _(1).isArguments(); + result = _([]).isArguments(); + result = _({}).isArguments(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isArguments(); + result = _([]).chain().isArguments(); + result = _({}).chain().isArguments(); + } } // _.isArray diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c45ec90eea..bc1db24bca 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9721,6 +9721,7 @@ declare module _ { interface LoDashStatic { /** * Checks if value is classified as an arguments object. + * * @param value The value to check. * @return Returns true if value is correctly classified, else false. */ @@ -9734,6 +9735,13 @@ declare module _ { isArguments(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.isArguments + */ + isArguments(): LoDashExplicitWrapper; + } + //_.isArray interface LoDashStatic { /** From 0a25e19498149a1382126c66aa6d963c7597b9f0 Mon Sep 17 00:00:00 2001 From: hinamiyagk Date: Tue, 29 Dec 2015 01:20:15 +0900 Subject: [PATCH 109/441] Add type definition for IPC Event on main process --- github-electron/github-electron-main-tests.ts | 4 ++-- github-electron/github-electron.d.ts | 20 ++++++++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 8a0d4125f4..55588681fa 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -275,12 +275,12 @@ globalShortcut.unregisterAll(); // ipcMain // https://github.com/atom/electron/blob/master/docs/api/ipc-main-process.md -ipcMain.on('asynchronous-message', (event: any, arg: any) => { +ipcMain.on('asynchronous-message', (event: GitHubElectron.IPCMainEvent, arg: any) => { console.log(arg); // prints "ping" event.sender.send('asynchronous-reply', 'pong'); }); -ipcMain.on('synchronous-message', (event: any, arg: any) => { +ipcMain.on('synchronous-message', (event: GitHubElectron.IPCMainEvent, arg: any) => { console.log(arg); // prints "ping" event.returnValue = 'pong'; }); diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 37dd602228..0c11ee048f 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1464,6 +1464,24 @@ declare module GitHubElectron { sendToHost(channel: string, ...args: any[]): void; } + class IPCMain implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): IPCMain; + once(event: string, listener: Function): IPCMain; + removeListener(event: string, listener: Function): IPCMain; + removeAllListeners(event?: string): IPCMain; + setMaxListeners(n: number): IPCMain; + getMaxListeners(): number; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; + on(event: string, listener: (event: IPCMainEvent, ...args: any[]) => any): IPCMain; + } + + interface IPCMainEvent { + returnValue?: any; + sender: WebContents; + } + interface Remote extends CommonElectron { /** * @returns The object returned by require(module) in the main process. @@ -1761,7 +1779,7 @@ declare module GitHubElectron { BrowserWindow: typeof GitHubElectron.BrowserWindow; contentTracing: GitHubElectron.ContentTracing; dialog: GitHubElectron.Dialog; - ipcMain: NodeJS.EventEmitter; + ipcMain: GitHubElectron.IPCMain; globalShortcut: GitHubElectron.GlobalShortcut; Menu: typeof GitHubElectron.Menu; MenuItem: typeof GitHubElectron.MenuItem; From b8a88f3bbaecf9f0155c8898e1420af212bef0ea Mon Sep 17 00:00:00 2001 From: Daniel Furtado Date: Mon, 28 Dec 2015 18:03:24 +0100 Subject: [PATCH 110/441] Added _.isError function --- underscore/underscore.d.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index feca736882..bdb2bdedd9 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -1454,6 +1454,13 @@ interface UnderscoreStatic { * @return True if `object` is a Function, otherwise false. **/ isFunction(object: any): boolean; + + /** + * Returns true if object inherits from an Error. + * @param object Check if this object is an Error. + * @return True if `object` is a Error, otherwise false. + **/ + isError(object:any): boolean; /** * Returns true if object is a String. @@ -2404,6 +2411,12 @@ interface Underscore { * @see _.isFunction **/ isFunction(): boolean; + + /** + * Wrapped type `object`. + * @see _.isError + **/ + isError(): boolean; /** * Wrapped type `object`. @@ -3299,6 +3312,12 @@ interface _Chain { **/ isFunction(): _Chain; + /** + * Wrapped type `object`. + * @see _.isError + **/ + isError(): _Chain; + /** * Wrapped type `object`. * @see _.isString From 870cb9e2bb705688bf2ac3d61bfc8e678ae5abf1 Mon Sep 17 00:00:00 2001 From: Georgios Valotasios Date: Mon, 28 Dec 2015 18:07:37 +0100 Subject: [PATCH 111/441] Added a MarkedRenderer definition --- marked/marked-tests.ts | 3 ++- marked/marked.d.ts | 31 +++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/marked/marked-tests.ts b/marked/marked-tests.ts index 44be0f0e84..efb6715489 100644 --- a/marked/marked-tests.ts +++ b/marked/marked-tests.ts @@ -14,7 +14,8 @@ var options: MarkedOptions = { return ''; }, langPrefix: 'lang-', - smartypants: false + smartypants: false, + renderer: new marked.Renderer() }; function callback() { diff --git a/marked/marked.d.ts b/marked/marked.d.ts index 198cd26262..bfce2eab5e 100644 --- a/marked/marked.d.ts +++ b/marked/marked.d.ts @@ -3,7 +3,6 @@ // Definitions by: William Orr // Definitions: https://github.com/borisyankov/DefinitelyTyped - interface MarkedStatic { /** * Compiles markdown to HTML. @@ -60,6 +59,34 @@ interface MarkedStatic { * @param options Hash of options */ setOptions(options: MarkedOptions): MarkedStatic; + + Renderer: { + new(): MarkedRenderer + } +} + +interface MarkedRenderer { + code(code: string, language: string): any; + blockquote(quote: string): any; + html(html: string): any; + heading(text: string, level: number): any; + hr(): any; + list(body: string, ordered: boolean): any; + listitem(text: string): any; + paragraph(text: string): any; + table(header: string, body: string): any; + tablerow(content: string): any; + tablecell(content: string, flags: { + header: boolean, + align: string + }): any; + strong(text: string): any; + em(text: string): any; + codespan(code: string): any; + br(): any; + del(text: string): any; + link(href: string, title: string, text: string): any; + image(href: string, title: string, text: string): any; } interface MarkedOptions { @@ -68,7 +95,7 @@ interface MarkedOptions { * * An object containing functions to render tokens to HTML. */ - renderer?: Object; + renderer?: MarkedRenderer; /** * Enable GitHub flavored markdown. From 11bd75b0d8a331010e67afc8c505cf362699c99e Mon Sep 17 00:00:00 2001 From: Daniel Furtado Date: Mon, 28 Dec 2015 18:27:24 +0100 Subject: [PATCH 112/441] Added _.unzip function --- underscore/underscore.d.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index bdb2bdedd9..d4743c63a0 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -900,6 +900,16 @@ interface UnderscoreStatic { **/ zip(...arrays: any[]): any[]; + /** + * The opposite of zip. Given a number of arrays, returns a series of new arrays, the first + * of which contains all of the first elements in the input arrays, the second of which + * contains all of the second elements, and so on. Use with apply to pass in an array + * of arrays + * @param arrays The arrays to unzip. + * @return Unzipped version of `arrays`. + **/ + unzip(...arrays: any[][]): any[][]; + /** * Converts arrays into objects. Pass either a single list of [key, value] pairs, or a * list of keys, and a list of values. @@ -2118,6 +2128,12 @@ interface Underscore { **/ zip(...arrays: any[][]): any[][]; + /** + * Wrapped type `any[][]`. + * @see _.unzip + **/ + unzip(...arrays: any[][]): any[][]; + /** * Wrapped type `any[][]`. * @see _.object @@ -3018,6 +3034,12 @@ interface _Chain { **/ zip(...arrays: any[][]): _Chain; + /** + * Wrapped type `any[][]`. + * @see _.unzip + **/ + unzip(...arrays: any[][]): _Chain; + /** * Wrapped type `any[][]`. * @see _.object From 7f99c0aed229f65ed237d79c09aa25498becff05 Mon Sep 17 00:00:00 2001 From: Daniel Furtado Date: Mon, 28 Dec 2015 18:40:21 +0100 Subject: [PATCH 113/441] Added optional default value property for the _.result function --- underscore/underscore.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index d4743c63a0..87d5b0919c 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -1647,9 +1647,10 @@ interface UnderscoreStatic { * If the value of the named property is a function then invoke it; otherwise, return it. * @param object Object to maybe invoke function `property` on. * @param property The function by name to invoke on `object`. + * @param defaultValue The value to be returned in case `property` doesn't exist or is undefined. * @return The result of invoking the function `property` on `object. **/ - result(object: any, property: string): any; + result(object: any, property: string, defaultValue?:any): any; /** * Compiles JavaScript templates into functions that can be evaluated for rendering. Useful @@ -2561,7 +2562,7 @@ interface Underscore { * Wrapped type `object`. * @see _.result **/ - result(property: string): any; + result(property: string, defaultValue?:any): any; /** * Wrapped type `string`. @@ -3467,7 +3468,7 @@ interface _Chain { * Wrapped type `object`. * @see _.result **/ - result(property: string): _Chain; + result(property: string, defaultValue?:any): _Chain; /** * Wrapped type `string`. From 5566b0981806d02273a95665600c48e03c2e7c6f Mon Sep 17 00:00:00 2001 From: Daniel Furtado Date: Mon, 28 Dec 2015 19:03:37 +0100 Subject: [PATCH 114/441] Added _.propertyOf function --- underscore/underscore.d.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 87d5b0919c..95dbd3bcf2 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -1405,6 +1405,13 @@ interface UnderscoreStatic { **/ property(key: string): (object: Object) => any; + /** + * Returns a function that will itself return the value of a object key property. + * @param key The object to get the property value from. + * @return Function which accept a key property in `object` and returns its value. + **/ + propertyOf(object: Object): (key: string) => any; + /** * Performs an optimized deep comparison between the two objects, * to determine if they should be considered equal. @@ -2380,6 +2387,12 @@ interface Underscore { * @see _.property **/ property(): (object: Object) => any; + + /** + * Wrapped type `object`. + * @see _.propertyOf + **/ + propertyOf(): (key: string) => any; /** * Wrapped type `object`. @@ -3286,6 +3299,12 @@ interface _Chain { * @see _.property **/ property(): _Chain; + + /** + * Wrapped type `object`. + * @see _.propertyOf + **/ + propertyOf(): _Chain; /** * Wrapped type `object`. From 28dfdd9964e4c62bafaf7d4417f2e3b38f9d8e2b Mon Sep 17 00:00:00 2001 From: Daniel Furtado Date: Mon, 28 Dec 2015 19:13:22 +0100 Subject: [PATCH 115/441] Added _.allKeys function --- underscore/underscore.d.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 95dbd3bcf2..bec1dca8c1 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -1226,6 +1226,13 @@ interface UnderscoreStatic { **/ keys(object: any): string[]; + /** + * Retrieve all the names of object's own and inherited properties. + * @param object Retrieve the key or property names from this object. + * @return List of all the property names on `object`. + **/ + allKeys(object: any): string[]; + /** * Return all of the values of the object's properties. * @param object Retrieve the values of all the properties on this object. @@ -2301,6 +2308,12 @@ interface Underscore { **/ keys(): string[]; + /** + * Wrapped type `object`. + * @see _.allKeys + **/ + allKeys(): string[]; + /** * Wrapped type `object`. * @see _.values @@ -3213,6 +3226,12 @@ interface _Chain { **/ keys(): _Chain; + /** + * Wrapped type `object`. + * @see _.allKeys + **/ + allKeys(): _Chain; + /** * Wrapped type `object`. * @see _.values From 0a5ebc36fe759d618728a08811e29cc619e83ecb Mon Sep 17 00:00:00 2001 From: Daniel Furtado Date: Mon, 28 Dec 2015 19:27:45 +0100 Subject: [PATCH 116/441] Fixed comments for the functions _.findIndex and _.findLastIndex --- underscore/underscore.d.ts | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index bec1dca8c1..c0812265e8 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -973,24 +973,24 @@ interface UnderscoreStatic { from?: number): number; /** - * Returns the first index of an element in `array` where the predicate truth test passes - * @param array The array to search for the index of the first element where the predicate truth test passes. - * @param predicate Predicate function. - * @param context `this` object in `predicate`, optional. - * @return Returns the index of an element in `array` where the predicate truth test passes or -1.` - **/ + * Returns the first index of an element in `array` where the predicate truth test passes + * @param array The array to search for the index of the first element where the predicate truth test passes. + * @param predicate Predicate function. + * @param context `this` object in `predicate`, optional. + * @return Returns the index of an element in `array` where the predicate truth test passes or -1.` + **/ findIndex( array: _.List, predicate: _.ListIterator, context?: any): number; /** - * Returns the last index of an element in `array` where the predicate truth test passes - * @param array The array to search for the index of the last element where the predicate truth test passes. - * @param predicate Predicate function. - * @param context `this` object in `predicate`, optional. - * @return Returns the index of an element in `array` where the predicate truth test passes or -1.` - **/ + * Returns the last index of an element in `array` where the predicate truth test passes + * @param array The array to search for the index of the last element where the predicate truth test passes. + * @param predicate Predicate function. + * @param context `this` object in `predicate`, optional. + * @return Returns the index of an element in `array` where the predicate truth test passes or -1.` + **/ findLastIndex( array: _.List, predicate: _.ListIterator, @@ -2178,13 +2178,13 @@ interface Underscore { lastIndexOf(value: T, from?: number): number; /** - * @see _.findIndex - **/ + * @see _.findIndex + **/ findIndex(array: _.List, predicate: _.ListIterator, context?: any): number; /** - * @see _.findLastIndex - **/ + * @see _.findLastIndex + **/ findLastIndex(array: _.List, predicate: _.ListIterator, context?: any): number; /** @@ -3096,13 +3096,13 @@ interface _Chain { lastIndexOf(value: T, from?: number): _ChainSingle; /** - * @see _.findIndex - **/ + * @see _.findIndex + **/ findIndex(predicate: _.ListIterator, context?: any): _Chain; /** - * @see _.findLastIndex - **/ + * @see _.findLastIndex + **/ findLastIndex(predicate: _.ListIterator, context?: any): _Chain; /** From 7f6e0444b14c2779f15c3b0305932b071c5c2485 Mon Sep 17 00:00:00 2001 From: Georgios Valotasios Date: Mon, 28 Dec 2015 20:16:38 +0100 Subject: [PATCH 117/441] Added the text function to the MarkedRenderer interface --- marked/marked.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/marked/marked.d.ts b/marked/marked.d.ts index bfce2eab5e..44850f3dba 100644 --- a/marked/marked.d.ts +++ b/marked/marked.d.ts @@ -87,6 +87,7 @@ interface MarkedRenderer { del(text: string): any; link(href: string, title: string, text: string): any; image(href: string, title: string, text: string): any; + text(text: string): any; } interface MarkedOptions { From 180515d68f03853384c63c13c540f7097d230c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladimir=20=C4=90oki=C4=87?= Date: Mon, 28 Dec 2015 21:07:02 +0100 Subject: [PATCH 118/441] Define headers in MockJaxSettings as MockJaxSettingsHeaders interface in order to have better type safety. Define responseText as string or Object (instead of just string). --- jquery-mockjax/jquery-mockjax.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jquery-mockjax/jquery-mockjax.d.ts b/jquery-mockjax/jquery-mockjax.d.ts index a3045b503c..a86bd856c6 100644 --- a/jquery-mockjax/jquery-mockjax.d.ts +++ b/jquery-mockjax/jquery-mockjax.d.ts @@ -5,11 +5,15 @@ /// +interface MockJaxSettingsHeaders { + [key: string]: string; +} + interface MockJaxSettings { url?: string | RegExp; data?: any; type?: string; - headers?: any; + headers?: MockJaxSettingsHeaders; logging?: boolean; status?: number; statusText?: string; @@ -17,7 +21,7 @@ interface MockJaxSettings { isTimeout?: boolean; contentType?: string; response?: (settings: any) => void; - responseText?: string; + responseText?: string | Object; responseXml?: string; proxy?: string; proxyType?: string; From 38ad9c5fa46b4a9b84d2b5d12fcad3040751f97e Mon Sep 17 00:00:00 2001 From: Georgios Valotasios Date: Mon, 28 Dec 2015 22:33:30 +0100 Subject: [PATCH 119/441] Exposed the Parser --- marked/marked.d.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/marked/marked.d.ts b/marked/marked.d.ts index 44850f3dba..70659dbed0 100644 --- a/marked/marked.d.ts +++ b/marked/marked.d.ts @@ -61,7 +61,11 @@ interface MarkedStatic { setOptions(options: MarkedOptions): MarkedStatic; Renderer: { - new(): MarkedRenderer + new(): MarkedRenderer; + } + + Parser: { + new(options: MarkedOptions): MarkedParser; } } @@ -90,6 +94,10 @@ interface MarkedRenderer { text(text: string): any; } +interface MarkedParser { + parse(source: string): string +} + interface MarkedOptions { /** * Type: object Default: new Renderer() From e31174ef24d252485501c85c67ba626ea735d2c4 Mon Sep 17 00:00:00 2001 From: Georgios Valotasios Date: Mon, 28 Dec 2015 22:41:36 +0100 Subject: [PATCH 120/441] Parser parses tokens --- marked/marked.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/marked/marked.d.ts b/marked/marked.d.ts index 70659dbed0..66030ed946 100644 --- a/marked/marked.d.ts +++ b/marked/marked.d.ts @@ -95,7 +95,7 @@ interface MarkedRenderer { } interface MarkedParser { - parse(source: string): string + parse(source: any[]): string } interface MarkedOptions { From ca0c2f6ea368d7bd89c8d5559b9665ea58182a14 Mon Sep 17 00:00:00 2001 From: Niels Kristian Hansen Skovmand Date: Tue, 29 Dec 2015 00:19:59 +0100 Subject: [PATCH 121/441] Typings and tests for spotify-web-api-js --- .../spotify-web-api-js-tests.ts | 70 +++ spotify-web-api-js/spotify-web-api-js.d.ts | 534 ++++++++++++++++++ 2 files changed, 604 insertions(+) create mode 100644 spotify-web-api-js/spotify-web-api-js-tests.ts create mode 100644 spotify-web-api-js/spotify-web-api-js.d.ts diff --git a/spotify-web-api-js/spotify-web-api-js-tests.ts b/spotify-web-api-js/spotify-web-api-js-tests.ts new file mode 100644 index 0000000000..28f848642a --- /dev/null +++ b/spotify-web-api-js/spotify-web-api-js-tests.ts @@ -0,0 +1,70 @@ +// Test for the type definitions for spotify-web-api-js +// Project: https://github.com/JMPerez/spotify-web-api-js +// Definitions by: Niels Kristian Hansen Skovmand, https://github.com/skovmand +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// This test-file assumes the following two d.ts files to be present. + +/// +/// + +var spotify = new SpotifyWebApi(); + +/** + * Tests getAlbums + */ +spotify.getAlbums(['1uw3ISK6Khq5xVWF1GWTjt', '5R8N32ocA6RqSxibt4W6x3'], { market: 'DK' }) +.then(results => { + results.albums.forEach(album => { + album.images.forEach(image => { + console.log('Image URL: ' + image.url.toUpperCase()); + }) + }); +}); + + + +/** + * Tests getAlbum with an error + */ +function albumSearchCallback(error: SpotifyWebApiJs.ErrorObject, results: SpotifyApi.SingleAlbumResponse) { + console.log(error.status.toString() + " - message is: " + error.statusText); +}; + +spotify.getAlbum('xxx1uw3ISK6Khq5xVWF1GWTjt', albumSearchCallback); + + + +/** + * Tests getCategories with a callback + */ +function trackSearchCallback(error: SpotifyWebApiJs.ErrorObject, results: SpotifyApi.TrackSearchResponse) { + console.log("Found a total of " + results.tracks.total + " tracks"); + var onlyExplicitTracks = results.tracks.items.filter(track => { + return track.explicit; + }); + onlyExplicitTracks.forEach(track => console.log(track.name)); +}; + +spotify.searchTracks("Love itself", {limit: 5, market: 'DK'}, trackSearchCallback); + + +/** + * Tests getting a users public profile + */ +spotify.getUser('physicaltunes') +.then(results => { + console.log(results.id.toUpperCase(), + 'Followers: ' + results.followers.total.toString()); +}); + + +/** + * Tests getting top tracks + */ +spotify.getArtistTopTracks('07QEuhtrNmmZ0zEcqE9SF6', 'DK') +.then(results => { + results.tracks.forEach(track => { + console.log(track.name, track.artists.shift().name); + }) +}); \ No newline at end of file diff --git a/spotify-web-api-js/spotify-web-api-js.d.ts b/spotify-web-api-js/spotify-web-api-js.d.ts new file mode 100644 index 0000000000..c26748353a --- /dev/null +++ b/spotify-web-api-js/spotify-web-api-js.d.ts @@ -0,0 +1,534 @@ +// Type definitions for spotify-web-api-js +// Project: https://github.com/JMPerez/spotify-web-api-js +// Definitions by: Niels Kristian Hansen Skovmand, https://github.com/skovmand +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +/** + * Declare SpotifyWebApi variable, sincle that is the name of the function in spotify-web-api-js. + */ +declare var SpotifyWebApi: SpotifyWebApiJs.SpotifyWebApiJsStatic; + +declare module SpotifyWebApiJs { + /** + * An optional callback that receives 2 parameters. The first + * one is the error object (null if no error), and the second is the value if the request succeeded. + */ + interface ResultsCallback { + (error: ErrorObject, value: T) : any + } + + /** + * Describes the regular error object: https://developer.spotify.com/web-api/user-guide/#error-details + */ + interface ErrorObject { + status: number, + response: string, + statusText: string + } + + /** + * Describes the static side of SpotifyApi. Get a new instance of the SpotifyApi. + */ + interface SpotifyWebApiJsStatic { + new(): SpotifyApiJs; + } + + /** + * Describes an instance of SpotifyApi + */ + interface SpotifyApiJs { + /** + * Fetches a resource through a generic GET request. + * + * @param url The URL to be fetched + * @param callback An optional callback + */ + getGeneric(url: string, callback?: ResultsCallback) : Promise; + + /** + * Fetches information about the current user. + * See [Get Current User's Profile](https://developer.spotify.com/web-api/get-current-users-profile/) + * + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getMe(options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches current user's saved tracks. + * See [Get Current User's Saved Tracks](https://developer.spotify.com/web-api/get-users-saved-tracks/) + * + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getMySavedTracks(options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Adds a list of tracks to the current user's saved tracks. + * See [Save Tracks for Current User](https://developer.spotify.com/web-api/save-tracks-user/) + * + * @param trackIds The ids of the tracks. If you know their Spotify URI it is easy to find their track id (e.g. spotify:track:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + addToMySavedTracks(trackIds: string[], options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Remove a list of tracks from the current user's saved tracks. + * See [Remove Tracks for Current User](https://developer.spotify.com/web-api/remove-tracks-user/) + * + * @param trackIds The ids of the tracks. If you know their Spotify URI it is easy to find their track id (e.g. spotify:track:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + removeFromMySavedTracks(trackIds: string[], options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Checks if the current user's saved tracks contains a certain list of tracks. + * See [Check Current User's Saved Tracks](https://developer.spotify.com/web-api/check-users-saved-tracks/) on the Spotify Developer site for more information about the endpoint. + * + * @param trackIds The ids of the tracks. If you know their Spotify URI it is easy to find their track id (e.g. spotify:track:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + containsMySavedTracks(trackIds: string[], options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Adds the current user as a follower of one or more other Spotify users. + * See [Follow Artists or Users](https://developer.spotify.com/web-api/follow-artists-users/) on the Spotify Developer site for more information about the endpoint. + * + * @param userIds The ids of the users. If you know their Spotify URI it is easy to find their user id (e.g. spotify:user:) + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. one is the error object (null if no error), and the second is an empty value if the request succeeded. + */ + followUsers(userIds: string[], callback?: ResultsCallback) : Promise; + + /** + * Adds the current user as a follower of one or more artists. + * See [Follow Artists or Users](https://developer.spotify.com/web-api/follow-artists-users/) on the Spotify Developer site for more information about the endpoint. + * + * @param artistIds The ids of the artists. If you know their Spotify URI it is easy to find their artist id (e.g. spotify:artist:) + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. one is the error object (null if no error), and the second is an empty value if the request succeeded. + */ + followArtists(artistIds: string[], callback?: ResultsCallback) : Promise; + + /** + * Add the current user as a follower of one playlist. + * See [Follow a Playlist](https://developer.spotify.com/web-api/follow-playlist/) on the Spotify Developer site for more information about the endpoint. + * + * @param ownerId The id of the playlist owner. If you know the Spotify URI of the playlist, it is easy to find the owner's user id (e.g. spotify:user::playlist:xxxx) + * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) + * @param options A JSON object with options that can be passed. For instance, whether you want the playlist to be followed privately ({public: false}) + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + followPlaylist(ownerId: string, playlistId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Removes the current user as a follower of one or more other Spotify users. + * See [Unfollow Artists or Users](https://developer.spotify.com/web-api/unfollow-artists-users/) on the Spotify Developer site for more information about the endpoint. + * + * @param userIds The ids of the users. If you know their Spotify URI it is easy to find their user id (e.g. spotify:user:) + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + unfollowUsers(userIds: string[], callback?: ResultsCallback) : Promise; + + /** + * Removes the current user as a follower of one or more artists. + * See [Unfollow Artists or Users](https://developer.spotify.com/web-api/unfollow-artists-users/) on the Spotify Developer site for more information about the endpoint. + * + * @param artistIds The ids of the artists. If you know their Spotify URI it is easy to find their artist id (e.g. spotify:artist:) + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + unfollowArtists(artistIds: string[], callback?: ResultsCallback) : Promise; + + /** + * Remove the current user as a follower of one playlist. + * See [Unfollow a Playlist](https://developer.spotify.com/web-api/unfollow-playlist/) on the Spotify Developer site for more information about the endpoint. + * + * @param ownerId The id of the playlist owner. If you know the Spotify URI of the playlist, it is easy to find the owner's user id (e.g. spotify:user::playlist:xxxx) + * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + unfollowPlaylist(ownerId: string, playlistId: string, callback?: ResultsCallback) : Promise; + + /** + * Checks to see if the current user is following one or more other Spotify users. + * See [Check if Current User Follows Users or Artists](https://developer.spotify.com/web-api/check-current-user-follows/) on the Spotify Developer site for more information about the endpoint. + * + * @param userIds The ids of the users. If you know their Spotify URI it is easy to find their user id (e.g. spotify:user:) + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + isFollowingUsers(userIds: string[], callback?: ResultsCallback) : Promise + + /** + * Checks to see if the current user is following one or more artists. + * See [Check if Current User Follows](https://developer.spotify.com/web-api/check-current-user-follows/) on the Spotify Developer site for more information about the endpoint. + * + * @param artistIds The ids of the artists. If you know their Spotify URI it is easy to find their artist id (e.g. spotify:artist:) + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + isFollowingArtists(artistIds: string[], callback?: ResultsCallback) : Promise; + + /** + * Check to see if one or more Spotify users are following a specified playlist. + * See [Check if Users Follow a Playlist](https://developer.spotify.com/web-api/check-user-following-playlist/) on the Spotify Developer site for more information about the endpoint. + * + * @param ownerId The id of the playlist owner. If you know the Spotify URI of the playlist, it is easy to find the owner's user id (e.g. spotify:user::playlist:xxxx) + * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) + * @param userIds The ids of the users. If you know their Spotify URI it is easy to find their user id (e.g. spotify:user:) + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + areFollowingPlaylist(ownerId: string, playlistId: string, userIds: string[], callback?: ResultsCallback) : Promise; + + /** + * Get the current user's followed artists. + * See [Get User's Followed Artists](https://developer.spotify.com/web-api/get-followed-artists/) on the Spotify Developer site for more information about the endpoint. + * + * @param options Options, being after and limit. + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getFollowedArtists(options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches information about a specific user. + * See [Get a User's Profile](https://developer.spotify.com/web-api/get-users-profile/) on the Spotify Developer site for more information about the endpoint. + * + * @param userId The id of the user. If you know the Spotify URI it is easy to find the id (e.g. spotify:user:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getUser(userId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches a list of the current user's playlists. + * See [Get a List of a User's Playlists](https://developer.spotify.com/web-api/get-list-users-playlists/) on the Spotify Developer site for more information about the endpoint. + * + * @param userId The id of the user. If you know the Spotify URI it is easy to find the id (e.g. spotify:user:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getUserPlaylists(userId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches a specific playlist. + * See [Get a Playlist](https://developer.spotify.com/web-api/get-playlist/) on the Spotify Developer site for more information about the endpoint. + * + * @param userId The id of the user. If you know the Spotify URI it is easy to find the user id (e.g. spotify:user::playlist:xxxx) + * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getPlaylist(userId: string, playlistId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches the tracks from a specific playlist. + * See [Get a Playlist's Tracks](https://developer.spotify.com/web-api/get-playlists-tracks/) on the Spotify Developer site for more information about the endpoint. + * + * @param userId The id of the user. If you know the Spotify URI it is easy to find the user id (e.g. spotify:user::playlist:xxxx) + * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getPlaylistTracks(userId: string, playlistId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Creates a playlist and stores it in the current user's library. + * See [Create a Playlist](https://developer.spotify.com/web-api/create-playlist/) on the Spotify Developer site for more information about the endpoint. + * + * @param userId The id of the user. You may want to user the "getMe" function to find out the id of the current logged in user + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + createPlaylist(userId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Change a playlist's name and public/private state + * See [Change a Playlist's Details](https://developer.spotify.com/web-api/change-playlist-details/) on the Spotify Developer site for more information about the endpoint. + * + * @param userId The id of the user. You may want to user the "getMe" function to find out the id of the current logged in user + * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) + * @param data A JSON object with the data to update. E.g. {name: 'A new name', public: true} + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + changePlaylistDetails(userId: string, playlistId: string, data: Object, callback?: ResultsCallback) : Promise; + + /** + * Add tracks to a playlist. + * See [Add Tracks to a Playlist](https://developer.spotify.com/web-api/add-tracks-to-playlist/) on the Spotify Developer site for more information about the endpoint. + * + * @param userId The id of the user. If you know the Spotify URI it is easy to find the user id (e.g. spotify:user::playlist:xxxx) + * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) + * @param uris An array of Spotify URIs for the tracks + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + addTracksToPlaylist(userId: string, playlistId: string, uris: string[], options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Replace the tracks of a playlist + * See [Replace a Playlist's Tracks](https://developer.spotify.com/web-api/replace-playlists-tracks/) on the Spotify Developer site for more information about the endpoint. + * + * @param userId The id of the user. If you know the Spotify URI it is easy to find the user id (e.g. spotify:user::playlist:xxxx) + * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) + * @param uris An array of Spotify URIs for the tracks + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + replaceTracksInPlaylist(userId: string, playlistId: string, uris: string[], callback?: ResultsCallback) : Promise; + + /** + * Reorder tracks in a playlist + * See [Reorder a Playlist’s Tracks](https://developer.spotify.com/web-api/reorder-playlists-tracks/) on the Spotify Developer site for more information about the endpoint. + * + * @param userId The id of the user. If you know the Spotify URI it is easy to find the user id (e.g. spotify:user::playlist:xxxx) + * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) + * @param rangeStart The position of the first track to be reordered. + * @param insertBefore The position where the tracks should be inserted. To reorder the tracks to the end of the playlist, simply set insert_before to the position after the last track. + * @param options An object with optional parameters (range_length, snapshot_id) + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + reorderTracksInPlaylist(userId: string, playlistId: string, rangeStart: number, insertBefore: number, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Remove tracks from a playlist + * See [Remove Tracks from a Playlist](https://developer.spotify.com/web-api/remove-tracks-playlist/) on the Spotify Developer site for more information about the endpoint. + * + * @param userId The id of the user. If you know the Spotify URI it is easy to find the user id (e.g. spotify:user::playlist:xxxx) + * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) + * @param uris An array of tracks to be removed. Each element of the array can be either a string, in which case it is treated as a URI, or an object containing the properties `uri` (which is a string) and `positions` (which is an array of integers). + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + removeTracksFromPlaylist(userId: string, playlistId: string, uris: Object[], callback?: ResultsCallback) : Promise; + + /** + * Remove tracks from a playlist, specifying a snapshot id. + * See [Remove Tracks from a Playlist](https://developer.spotify.com/web-api/remove-tracks-playlist/) on the Spotify Developer site for more information about the endpoint. + * + * @param userId The id of the user. If you know the Spotify URI it is easy to find the user id (e.g. spotify:user::playlist:xxxx) + * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) + * @param uris An array of tracks to be removed. Each element of the array can be either a string, in which case it is treated as a URI, or an object containing the properties `uri` (which is a string) and `positions` (which is an array of integers). + * @param snapshotId The playlist's snapshot ID against which you want to make the changes + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + removeTracksFromPlaylistWithSnapshotId(userId: string, playlistId: string, uris: Object[], snapshotId: string, callback?: ResultsCallback) : Promise; + + /** + * Remove tracks from a playlist, specifying the positions of the tracks to be removed. + * See [Remove Tracks from a Playlist](https://developer.spotify.com/web-api/remove-tracks-playlist/) on + * the Spotify Developer site for more information about the endpoint. + * @param userId The id of the user. If you know the Spotify URI it is easy + * to find the user id (e.g. spotify:user::playlist:xxxx) + * @param playlistId The id of the playlist. If you know the Spotify URI it is easy to find the playlist id (e.g. spotify:user:xxxx:playlist:) + * @param positions array of integers containing the positions of the tracks to remove from the playlist. + * @param snapshotId The playlist's snapshot ID against which you want to make the changes + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + removeTracksFromPlaylistInPositions(userId: string, playlistId: string, positions: number[], snapshotId: string, callback?: ResultsCallback) : Promise; + + /** + * Fetches an album from the Spotify catalog. + * See [Get an Album](https://developer.spotify.com/web-api/get-album/) on the Spotify Developer site for more information about the endpoint. + * + * @param albumId The id of the album. If you know the Spotify URI it is easy to find the album id (e.g. spotify:album:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getAlbum(albumId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches the tracks of an album from the Spotify catalog. + * See [Get an Album's Tracks](https://developer.spotify.com/web-api/get-albums-tracks/) on the Spotify Developer site for more information about the endpoint. + * + * @param albumId The id of the album. If you know the Spotify URI it is easy to find the album id (e.g. spotify:album:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getAlbumTracks(albumId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches multiple albums from the Spotify catalog. + * See [Get Several Albums](https://developer.spotify.com/web-api/get-several-albums/) on the Spotify Developer site for more information about the endpoint. + * + * @param albumIds The ids of the albums. If you know their Spotify URI it is easy to find their album id (e.g. spotify:album:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getAlbums(albumIds: string[], options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches a track from the Spotify catalog. + * See [Get a Track](https://developer.spotify.com/web-api/get-track/) on the Spotify Developer site for more information about the endpoint. + * + * @param trackId The id of the track. If you know the Spotify URI it is easy to find the track id (e.g. spotify:track:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getTrack(trackId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches multiple tracks from the Spotify catalog. + * See [Get Several Tracks](https://developer.spotify.com/web-api/get-several-tracks/) on + * the Spotify Developer site for more information about the endpoint. + * @param trackIds The ids of the tracks. If you know their Spotify URI it is easy to find their track id (e.g. spotify:track:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getTracks(trackIds: string[], options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches an artist from the Spotify catalog. + * See [Get an Artist](https://developer.spotify.com/web-api/get-artist/) on the Spotify Developer site for more information about the endpoint. + * + * @param artistId The id of the artist. If you know the Spotify URI it is easy to find the artist id (e.g. spotify:artist:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getArtist(artistId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches multiple artists from the Spotify catalog. + * See [Get Several Artists](https://developer.spotify.com/web-api/get-several-artists/) on the Spotify Developer site for more information about the endpoint. + * + * @param artistIds The ids of the artists. If you know their Spotify URI it is easy to find their artist id (e.g. spotify:artist:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getArtists(artistIds: string[], options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches the albums of an artist from the Spotify catalog. + * See [Get an Artist's Albums](https://developer.spotify.com/web-api/get-artists-albums/) on the Spotify Developer site for more information about the endpoint. + * + * @param artistId The id of the artist. If you know the Spotify URI it is easy to find the artist id (e.g. spotify:artist:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getArtistAlbums(artistId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches a list of top tracks of an artist from the Spotify catalog, for a specific country. + * See [Get an Artist's Top Tracks](https://developer.spotify.com/web-api/get-artists-top-tracks/) on the Spotify Developer site for more information about the endpoint. + * + * @param artistId The id of the artist. If you know the Spotify URI it is easy to find the artist id (e.g. spotify:artist:) + * @param countryId The id of the country (e.g. ES for Spain or US for United States) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getArtistTopTracks(artistId: string, countryId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches a list of artists related with a given one from the Spotify catalog. + * See [Get an Artist's Related Artists](https://developer.spotify.com/web-api/get-related-artists/) on the Spotify Developer site for more information about the endpoint. + * + * @param artistId The id of the artist. If you know the Spotify URI it is easy to find the artist id (e.g. spotify:artist:) + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getArtistRelatedArtists(artistId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches a list of Spotify featured playlists (shown, for example, on a Spotify player's "Browse" tab). + * See [Get a List of Featured Playlists](https://developer.spotify.com/web-api/get-list-featured-playlists/) on the Spotify Developer site for more information about the endpoint. + * + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getFeaturedPlaylists(options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches a list of new album releases featured in Spotify (shown, for example, on a Spotify player's "Browse" tab). + * See [Get a List of New Releases](https://developer.spotify.com/web-api/get-list-new-releases/) on the Spotify Developer site for more information about the endpoint. + * + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getNewReleases(options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Get a list of categories used to tag items in Spotify (on, for example, the Spotify player's "Browse" tab). + * See [Get a List of Categories](https://developer.spotify.com/web-api/get-list-categories/) on the Spotify Developer site for more information about the endpoint. + * + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getCategories(options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Get a single category used to tag items in Spotify (on, for example, the Spotify player's "Browse" tab). + * See [Get a Category](https://developer.spotify.com/web-api/get-category/) on the Spotify Developer site for more information about the endpoint. + * + * @param categoryId The id of the category. These can be found with the getCategories function + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getCategory(categoryId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Get a list of Spotify playlists tagged with a particular category. + * See [Get a Category's Playlists](https://developer.spotify.com/web-api/get-categorys-playlists/) on the Spotify Developer site for more information about the endpoint. + * + * @param categoryId The id of the category. These can be found with the getCategories function + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + getCategoryPlaylists(categoryId: string, options?: Object, callback?: ResultsCallback) : Promise; + + /** + * Fetches albums from the Spotify catalog according to a query. + * See [Search for an Item](https://developer.spotify.com/web-api/search-item/) on the Spotify Developer site for more information about the endpoint. + * + * @param query The search query + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + searchAlbums(query: string, options?: SpotifyApi.SearchForItemParameterObject, callback?: ResultsCallback) : Promise; + + /** + * Fetches artists from the Spotify catalog according to a query. + * See [Search for an Item](https://developer.spotify.com/web-api/search-item/) on the Spotify Developer site for more information about the endpoint. + * + * @param query The search query + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + searchArtists(query: string, options?: SpotifyApi.SearchForItemParameterObject, callback?: ResultsCallback) : Promise; + + /** + * Fetches tracks from the Spotify catalog according to a query. + * See [Search for an Item](https://developer.spotify.com/web-api/search-item/) on the Spotify Developer site for more information about the endpoint. + * + * @param query The search query + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + searchTracks(query: string, options?: SpotifyApi.SearchForItemParameterObject, callback?: ResultsCallback) : Promise; + + /** + * Fetches playlists from the Spotify catalog according to a query. + * See [Search for an Item](https://developer.spotify.com/web-api/search-item/) on the Spotify Developer site for more information about the endpoint. + * + * @param query The search query + * @param options A JSON object with options that can be passed + * @param callback An optional callback that receives 2 parameters. The first one is the error object (null if no error), and the second is the value if the request succeeded. + */ + searchPlaylists(query: string, options?: SpotifyApi.SearchForItemParameterObject, callback?: ResultsCallback) : Promise; + + /** + * Sets the access token to be used. + * See [the Authorization Guide](https://developer.spotify.com/web-api/authorization-guide/) on the Spotify Developer site for more information about obtaining an access token. + * + * @param accessToken The access token + */ + setAccessToken(accessToken: string) : void; + + /** + * Sets an implementation of Promises/A+ to be used. E.g. Q, when. + * See [Conformant Implementations](https://github.com/promises-aplus/promises-spec/blob/master/implementations.md) for a list of some available options + * + * @param promiseImplementation A Promises/A+ valid implementation + * @throws {Error} If the implementation being set doesn't conform with Promises/A+ + */ + setPromiseImplementation(promiseImplementation: Object) : void; + } +} From 53dec8bcbebf1ca9d2bbc5f5be11130bff5f068a Mon Sep 17 00:00:00 2001 From: Niels Kristian Hansen Skovmand Date: Tue, 29 Dec 2015 00:42:56 +0100 Subject: [PATCH 122/441] Fixed the URL. --- spotify-web-api-js/spotify-web-api-js-tests.ts | 2 +- spotify-web-api-js/spotify-web-api-js.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spotify-web-api-js/spotify-web-api-js-tests.ts b/spotify-web-api-js/spotify-web-api-js-tests.ts index 28f848642a..11fcf2b43b 100644 --- a/spotify-web-api-js/spotify-web-api-js-tests.ts +++ b/spotify-web-api-js/spotify-web-api-js-tests.ts @@ -1,6 +1,6 @@ // Test for the type definitions for spotify-web-api-js // Project: https://github.com/JMPerez/spotify-web-api-js -// Definitions by: Niels Kristian Hansen Skovmand, https://github.com/skovmand +// Definitions by: Niels Kristian Hansen Skovmand // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // This test-file assumes the following two d.ts files to be present. diff --git a/spotify-web-api-js/spotify-web-api-js.d.ts b/spotify-web-api-js/spotify-web-api-js.d.ts index c26748353a..bb980b26f5 100644 --- a/spotify-web-api-js/spotify-web-api-js.d.ts +++ b/spotify-web-api-js/spotify-web-api-js.d.ts @@ -1,6 +1,6 @@ // Type definitions for spotify-web-api-js // Project: https://github.com/JMPerez/spotify-web-api-js -// Definitions by: Niels Kristian Hansen Skovmand, https://github.com/skovmand +// Definitions by: Niels Kristian Hansen Skovmand // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 192b0eee4d7c5c98bfc4f26c6495c7c3795ba63a Mon Sep 17 00:00:00 2001 From: Niko Kovacic Date: Tue, 29 Dec 2015 09:43:45 +0100 Subject: [PATCH 123/441] Changed set property from put in IStorage interface --- angular-translate/angular-translate.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index ee855af3d6..77666eacb0 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -22,7 +22,7 @@ declare module angular.translate { interface IStorage { get(name: string): string; - set(name: string, value: string): void; + put(name: string, value: string): void; } interface IStaticFilesLoaderOptions { From fd150ec8405c5c2a0b11fa3223161d18fa83296b Mon Sep 17 00:00:00 2001 From: Sven Reglitzki Date: Tue, 29 Dec 2015 09:47:27 +0100 Subject: [PATCH 124/441] Add verror definitions and tests --- verror/verror-tests.ts | 18 ++++++++++++ verror/verror.d.ts | 63 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 verror/verror-tests.ts create mode 100644 verror/verror.d.ts diff --git a/verror/verror-tests.ts b/verror/verror-tests.ts new file mode 100644 index 0000000000..22957fdea1 --- /dev/null +++ b/verror/verror-tests.ts @@ -0,0 +1,18 @@ +// Type definitions for verror v1.6.0 +// Project: https://github.com/davepacheco/node-verror +// Definitions by: Sven Reglitzki +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +import VError = require("verror"); + +var error = new Error("foo"); +var verror1 = new VError(error, "bar"); +var verror2 = new VError.VError(error, "bar"); +var serror = new VError.SError(error, "bar"); +var multiError = new VError.MultiError([verror1, verror2]); +var werror = new VError.WError(verror1, "foobar"); + +var cause1: Error = verror1.cause(); +var cause2: Error = werror.cause(); diff --git a/verror/verror.d.ts b/verror/verror.d.ts new file mode 100644 index 0000000000..3ad4507763 --- /dev/null +++ b/verror/verror.d.ts @@ -0,0 +1,63 @@ +// Type definitions for verror v1.6.0 +// Project: https://github.com/davepacheco/node-verror +// Definitions by: Sven Reglitzki +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "verror" { + + /* + * VError([cause], fmt[, arg...]): Like JavaScript's built-in Error class, but + * supports a "cause" argument (another error) and a printf-style message. The + * cause argument can be null or omitted entirely. + * + * Examples: + * + * CODE MESSAGE + * new VError('something bad happened') "something bad happened" + * new VError('missing file: "%s"', file) "missing file: "/etc/passwd" + * with file = '/etc/passwd' + * new VError(err, 'open failed') "open failed: file not found" + * with err.message = 'file not found' + */ + class VError extends Error { + static VError: typeof VError; + static SError: typeof SError; + static MultiError: typeof MultiError; + static WError: typeof WError; + cause():Error; + constructor(cause: Error, message: string, ...params: any[]); + constructor(message: string, ...params: any[]); + } + + /* + * SError is like VError, but stricter about types. You cannot pass "null" or + * "undefined" as string arguments to the formatter. Since SError is only a + * different function, not really a different class, we don't set + * SError.prototype.name. + */ + class SError extends VError { + } + + /* + * Represents a collection of errors for the purpose of consumers that generally + * only deal with one error. Callers can extract the individual errors + * contained in this object, but may also just treat it as a normal single + * error, in which case a summary message will be printed. + */ + class MultiError extends VError { + constructor(errors: Error[]); + } + + /* + * Like JavaScript's built-in Error class, but supports a "cause" argument which + * is wrapped, not "folded in" as with VError. Accepts a printf-style message. + * The cause argument can be null. + */ + class WError extends Error { + cause():Error; + constructor(cause: Error, message: string, ...params: any[]); + constructor(message: string, ...params: any[]); + } + + export = VError; +} From 5974b1be295ed7f61ff611459bc06a56cb35fd0c Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Tue, 29 Dec 2015 11:16:13 -0600 Subject: [PATCH 125/441] Fix minimist.Opts.alias possible values (to match minimist docs/functionality) --- minimist/minimist.d.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/minimist/minimist.d.ts b/minimist/minimist.d.ts index abbc5f0280..de767fa4c7 100644 --- a/minimist/minimist.d.ts +++ b/minimist/minimist.d.ts @@ -9,20 +9,17 @@ declare module 'minimist' { module minimist { export interface Opts { // a string or array of strings argument names to always treat as strings - // string?: string; string?: string|string[]; // a string or array of strings to always treat as booleans - // boolean?: string; boolean?: boolean|string|string[]; // an object mapping string names to strings or arrays of string argument names to use - // alias?: {[key:string]: string}; - alias?: {[key:string]: string[]}; + alias?: {[key:string]: string|string[]}; // an object mapping string argument names to default values default?: {[key:string]: any}; // when true, populate argv._ with everything after the first non-option stopEarly?: boolean; // a function which is invoked with a command line parameter not defined in the opts configuration object. - // If the function returns false, the unknown option is not added to argv + // If the function returns false, the unknown option is not added to argv unknown?: (arg: string) => boolean; // when true, populate argv._ with everything before the -- and argv['--'] with everything after the -- '--'?: boolean; From 8d6eff700dc3dfda7c1a995fa7d36b8609a5d8c0 Mon Sep 17 00:00:00 2001 From: Yaroslav Sivakov Date: Tue, 29 Dec 2015 20:19:20 +0300 Subject: [PATCH 126/441] Update three-canvasrenderer.d.ts Minor: add "alpha" to CanvasRendererParameters. --- threejs/three-canvasrenderer.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/threejs/three-canvasrenderer.d.ts b/threejs/three-canvasrenderer.d.ts index cb4e610bcc..4a3b84801a 100644 --- a/threejs/three-canvasrenderer.d.ts +++ b/threejs/three-canvasrenderer.d.ts @@ -23,6 +23,7 @@ declare module THREE { export interface CanvasRendererParameters { canvas?: HTMLCanvasElement; devicePixelRatio?: number; + alpha?: boolean; } export class CanvasRenderer implements Renderer { @@ -55,4 +56,4 @@ declare module THREE { clearStencil(): void; render(scene: Scene, camera: Camera): void; } -} \ No newline at end of file +} From 1ffa6ceef1821e241fe94a16ae832ed0210187a4 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 29 Dec 2015 23:22:59 +0500 Subject: [PATCH 127/441] lodash: signatures of _.countBy have been changed --- lodash/lodash-tests.ts | 137 +++++++++++++++++++++++-- lodash/lodash.d.ts | 222 ++++++++++++++++++++++++++++++----------- 2 files changed, 295 insertions(+), 64 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2b..8df7072c25 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -3241,13 +3241,138 @@ module TestContains { } } -result = <_.Dictionary>_.countBy([4.3, 6.1, 6.4], function (num) { return Math.floor(num); }); -result = <_.Dictionary>_.countBy([4.3, 6.1, 6.4], function (num) { return this.floor(num); }, Math); -result = <_.Dictionary>_.countBy(['one', 'two', 'three'], 'length'); +// _.countBy +module TestCountBy { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; -result = <_.LoDashImplicitObjectWrapper<_.Dictionary>>_([4.3, 6.1, 6.4]).countBy(function (num) { return Math.floor(num); }); -result = <_.LoDashImplicitObjectWrapper<_.Dictionary>>_([4.3, 6.1, 6.4]).countBy(function (num) { return this.floor(num); }, Math); -result = <_.LoDashImplicitObjectWrapper<_.Dictionary>>_(['one', 'two', 'three']).countBy('length'); + let stringIterator: (value: string, index: number, collection: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => any; + + { + let result: _.Dictionary; + + result = _.countBy(''); + result = _.countBy('', stringIterator); + result = _.countBy('', stringIterator, any); + + result = _.countBy(array); + result = _.countBy(array, listIterator); + result = _.countBy(array, listIterator, any); + result = _.countBy(array, ''); + result = _.countBy(array, '', any); + result = _.countBy<{a: number}, TResult>(array, {a: 42}); + result = _.countBy(array, {a: 42}); + + result = _.countBy(list); + result = _.countBy(list, listIterator); + result = _.countBy(list, listIterator, any); + result = _.countBy(list, ''); + result = _.countBy(list, '', any); + result = _.countBy<{a: number}, TResult>(list, {a: 42}); + result = _.countBy(list, {a: 42}); + + result = _.countBy(dictionary); + result = _.countBy(dictionary, dictionaryIterator); + result = _.countBy(dictionary, dictionaryIterator, any); + result = _.countBy(dictionary, ''); + result = _.countBy(dictionary, '', any); + result = _.countBy<{a: number}, TResult>(dictionary, {a: 42}); + result = _.countBy(dictionary, {a: 42}); + + result = _.countBy(numericDictionary); + result = _.countBy(numericDictionary, numericDictionaryIterator); + result = _.countBy(numericDictionary, numericDictionaryIterator, any); + result = _.countBy(numericDictionary, ''); + result = _.countBy(numericDictionary, '', any); + result = _.countBy<{a: number}, TResult>(numericDictionary, {a: 42}); + result = _.countBy(numericDictionary, {a: 42}); + } + + { + let resutl: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _('').countBy(); + result = _('').countBy(stringIterator); + result = _('').countBy(stringIterator, any); + + result = _(array).countBy(); + result = _(array).countBy(listIterator); + result = _(array).countBy(listIterator, any); + result = _(array).countBy(''); + result = _(array).countBy('', any); + result = _(array).countBy<{a: number}>({a: 42}); + result = _(array).countBy({a: 42}); + + result = _(list).countBy(); + result = _(list).countBy(listIterator); + result = _(list).countBy(listIterator, any); + result = _(list).countBy(''); + result = _(list).countBy('', any); + result = _(list).countBy<{a: number}>({a: 42}); + result = _(list).countBy({a: 42}); + + result = _(dictionary).countBy(); + result = _(dictionary).countBy(dictionaryIterator); + result = _(dictionary).countBy(dictionaryIterator, any); + result = _(dictionary).countBy(''); + result = _(dictionary).countBy('', any); + result = _(dictionary).countBy<{a: number}>({a: 42}); + result = _(dictionary).countBy({a: 42}); + + result = _(numericDictionary).countBy(); + result = _(numericDictionary).countBy(numericDictionaryIterator); + result = _(numericDictionary).countBy(numericDictionaryIterator, any); + result = _(numericDictionary).countBy(''); + result = _(numericDictionary).countBy('', any); + result = _(numericDictionary).countBy<{a: number}>({a: 42}); + result = _(numericDictionary).countBy({a: 42}); + } + + { + let resutl: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _('').chain().countBy(); + result = _('').chain().countBy(stringIterator); + result = _('').chain().countBy(stringIterator, any); + + result = _(array).chain().countBy(); + result = _(array).chain().countBy(listIterator); + result = _(array).chain().countBy(listIterator, any); + result = _(array).chain().countBy(''); + result = _(array).chain().countBy('', any); + result = _(array).chain().countBy<{a: number}>({a: 42}); + result = _(array).chain().countBy({a: 42}); + + result = _(list).chain().countBy(); + result = _(list).chain().countBy(listIterator); + result = _(list).chain().countBy(listIterator, any); + result = _(list).chain().countBy(''); + result = _(list).chain().countBy('', any); + result = _(list).chain().countBy<{a: number}>({a: 42}); + result = _(list).chain().countBy({a: 42}); + + result = _(dictionary).chain().countBy(); + result = _(dictionary).chain().countBy(dictionaryIterator); + result = _(dictionary).chain().countBy(dictionaryIterator, any); + result = _(dictionary).chain().countBy(''); + result = _(dictionary).chain().countBy('', any); + result = _(dictionary).chain().countBy<{a: number}>({a: 42}); + result = _(dictionary).chain().countBy({a: 42}); + + result = _(numericDictionary).chain().countBy(); + result = _(numericDictionary).chain().countBy(numericDictionaryIterator); + result = _(numericDictionary).chain().countBy(numericDictionaryIterator, any); + result = _(numericDictionary).chain().countBy(''); + result = _(numericDictionary).chain().countBy('', any); + result = _(numericDictionary).chain().countBy<{a: number}>({a: 42}); + result = _(numericDictionary).chain().countBy({a: 42}); + } +} // _.detect module TestDetect { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c45ec90eea..4320b98ea7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -4913,87 +4913,193 @@ declare module _ { //_.countBy interface LoDashStatic { /** - * Creates an object composed of keys generated from the results of running each element - * of collection through the callback. The corresponding value of each key is the number - * of times the key was returned by the callback. The callback is bound to thisArg and - * invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for callback the created "_.pluck" style callback will - * return the property value of the given element. - * - * If an object is provided for callback the created "_.where" style callback will return - * true for elements that have the properties of the given object, else false. - * @param collection The collection to iterate over. - * @param callback The function called per iteration. - * @param thisArg The this binding of callback. - * @return Returns the composed aggregate object. - **/ - countBy( - collection: Array, - callback?: ListIterator, - thisArg?: any): Dictionary; - - /** - * @see _.countBy - * @param callback Function name - **/ + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ countBy( collection: List, - callback?: ListIterator, - thisArg?: any): Dictionary; + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; /** - * @see _.countBy - * @param callback Function name - **/ + * @see _.countBy + */ countBy( collection: Dictionary, - callback?: DictionaryIterator, - thisArg?: any): Dictionary; + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; /** - * @see _.countBy - * @param callback Function name - **/ + * @see _.countBy + */ countBy( - collection: Array, - callback: string, - thisArg?: any): Dictionary; + collection: NumericDictionary, + iteratee?: NumericDictionaryIterator, + thisArg?: any + ): Dictionary; /** - * @see _.countBy - * @param callback Function name - **/ + * @see _.countBy + */ countBy( - collection: List, - callback: string, - thisArg?: any): Dictionary; + collection: List|Dictionary|NumericDictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; /** - * @see _.countBy - * @param callback Function name - **/ + * @see _.countBy + */ + countBy( + collection: List|Dictionary|NumericDictionary, + iteratee?: W + ): Dictionary; + + /** + * @see _.countBy + */ countBy( - collection: Dictionary, - callback: string, - thisArg?: any): Dictionary; + collection: List|Dictionary|NumericDictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; } interface LoDashImplicitArrayWrapper { /** - * @see _.countBy - **/ + * @see _.countBy + */ countBy( - callback?: ListIterator, - thisArg?: any): LoDashImplicitObjectWrapper>; + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; /** - * @see _.countBy - * @param callback Function name - **/ + * @see _.countBy + */ countBy( - callback: string, - thisArg?: any): LoDashImplicitObjectWrapper>; + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; } //_.detect From 6ae08bfbab7fd9443fb5bfdadef14c4df6fc8d4c Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Tue, 29 Dec 2015 14:30:24 -0500 Subject: [PATCH 128/441] Support optional headers in response send / json calls --- restify/restify.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index c523810eec..47c56240c1 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -41,8 +41,8 @@ declare module "restify" { header: (key: string, value ?: any) => any; cache: (type?: any, options?: Object) => any; status: (code: number) => any; - send: (status?: any, body?: any) => any; - json: (status?: any, body?: any) => any; + send: (status?: any, body?: any, headers?: { [header: string]: string }) => any; + json: (status?: any, body?: any, headers?: { [header: string]: string }) => any; code: number; contentLength: number; charSet(value: string): void; From 597b1a213648e039b5cd0465e98ff61156be3296 Mon Sep 17 00:00:00 2001 From: nkovacic Date: Tue, 29 Dec 2015 20:35:28 +0100 Subject: [PATCH 129/441] Angular toastr added to definitions https://github.com/Foxandxss/angular-toastr --- angular-toastr/angular-toastr-tests.ts | 64 +++++++++++++ angular-toastr/angular-toastr.d.ts | 121 +++++++++++++++++++++++++ 2 files changed, 185 insertions(+) create mode 100644 angular-toastr/angular-toastr-tests.ts create mode 100644 angular-toastr/angular-toastr.d.ts diff --git a/angular-toastr/angular-toastr-tests.ts b/angular-toastr/angular-toastr-tests.ts new file mode 100644 index 0000000000..d9141be7e0 --- /dev/null +++ b/angular-toastr/angular-toastr-tests.ts @@ -0,0 +1,64 @@ +/// +/// + + +angular + .module('toastr-tests', ['toastr']) + .config(function(toastrConfig: angular.toastr.IToastrConfig) { + let toastContainerConfig: angular.toastr.IToastContainerConfig = { + autoDismiss: false, + containerId: 'toast-container', + maxOpened: 0, + newestOnTop: true, + positionClass: 'toast-top-right', + preventDuplicates: false, + preventOpenDuplicates: false, + target: 'body' + }, + toastConfig: angular.toastr.IToastConfig = { + allowHtml: false, + closeButton: false, + closeHtml: '', + extendedTimeOut: 1000, + iconClasses: { + error: 'toast-error', + info: 'toast-info', + success: 'toast-success', + warning: 'toast-warning' + }, + messageClass: 'toast-message', + onHidden: null, + onShown: null, + onTap: null, + progressBar: false, + tapToDismiss: true, + templates: { + + toast: 'directives/toast/toast.html', + progressbar: 'directives/progressbar/progressbar.html' + }, + timeOut: 5000, + titleClass: 'toast-title', + toastClass: 'toast' + }; + + angular.extend(toastrConfig, toastContainerConfig, toastConfig); + }) + .controller('ToastrController', function(toastr: angular.toastr.IToastrService) { + toastr.info(' Success!', 'With HTML', { + allowHtml: true + }); + + toastr.success('What a nice button', 'Button spree', { + closeButton: true + }); + + toastr.info('What a nice apple button', 'Button spree', { + closeButton: true, + closeHtml: '' + }); + + toastr.info('I am totally custom!', 'Happy toast', { + iconClass: 'toast-pink' + }); + });; \ No newline at end of file diff --git a/angular-toastr/angular-toastr.d.ts b/angular-toastr/angular-toastr.d.ts new file mode 100644 index 0000000000..96e8e78cce --- /dev/null +++ b/angular-toastr/angular-toastr.d.ts @@ -0,0 +1,121 @@ +// Type definitions for Angular Toastr v1.6.0 +// Project: https://github.com/Foxandxss/angular-toastr +// Definitions by: Niko Kovačič +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "angular-toastr" { + var _: string; + export = _; +} + +interface IToastBaseConfig { + allowHtml?: boolean; + closeButton?: boolean; + closeHtml?: string; + extendedTimeOut?: number; + messageClass?: string; + onHidden?: Function; + onShown?: Function; + onTap?: Function; + progressBar?: boolean; + tapToDismiss?: boolean; + templates?: { + toast?: string; + progressbar?: string; + }; + timeOut?: number; + titleClass?: string; + toastClass?: string; +} + +declare module angular.toastr { + interface IToastContainerConfig { + autoDismiss?: boolean; + containerId?: string; + maxOpened?: number; + newestOnTop?: boolean; + positionClass?: string; + preventDuplicates?: boolean; + preventOpenDuplicates?: boolean; + target?: string; + } + + interface IToastConfig extends IToastBaseConfig { + iconClasses?: { + error?: string; + info?: string; + success?: string; + warning?: string; + }; + } + + interface IToastrConfig extends IToastContainerConfig, IToastConfig { } + + interface IToastScope extends angular.IScope { + message: string; + options: IToastConfig; + title: string; + toastId: number; + toastType: string; + } + + interface IToast { + el: angular.IAugmentedJQuery; + iconClass: string; + isOpened: boolean; + open: angular.IPromise; + scope: IToastScope; + toastId: number; + } + + interface IToastOptions extends IToastBaseConfig { + iconClass?: string; + } + + interface IToastrService { + /** + * Return the number of active toasts in screen. + */ + active(): number; + /** + * Remove toast from screen. If no toast is passed in, all toasts will be closed. + * + * @param {IToast} toast Optional toast object to delete + */ + clear(toast?: IToast): void; + /** + * Create error toast notification message. + * + * @param {String} message Message to show on toast + * @param {String} title Title to show on toast + * @param {IToastOptions} options Override default toast options + */ + error(message: string, title?: string, options?: IToastOptions): IToast; + /** + * Create info toast notification message. + * + * @param {String} message Message to show on toast + * @param {String} title Title to show on toast + * @param {IToastOptions} options Override default toast options + */ + info(message: string, title?: string, options?: IToastOptions): IToast; + /** + * Create success toast notification message. + * + * @param {String} message Message to show on toast + * @param {String} title Title to show on toast + * @param {IToastOptions} options Override default toast options + */ + success(message: string, title?: string, options?: IToastOptions): IToast; + /** + * Create warning toast notification message. + * + * @param {String} message Message to show on toast + * @param {String} title Title to show on toast + * @param {IToastOptions} options Override default toast options + */ + warning(message: string, title?: string, options?: IToastOptions): IToast; + } +} \ No newline at end of file From 6813273d2d35f47150d340d037db83500693dedd Mon Sep 17 00:00:00 2001 From: nkovacic Date: Tue, 29 Dec 2015 20:39:57 +0100 Subject: [PATCH 130/441] Quick fix to remove semicolon on end of tests --- angular-toastr/angular-toastr-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-toastr/angular-toastr-tests.ts b/angular-toastr/angular-toastr-tests.ts index d9141be7e0..e5701746f7 100644 --- a/angular-toastr/angular-toastr-tests.ts +++ b/angular-toastr/angular-toastr-tests.ts @@ -61,4 +61,4 @@ angular toastr.info('I am totally custom!', 'Happy toast', { iconClass: 'toast-pink' }); - });; \ No newline at end of file + }); \ No newline at end of file From aeb8fefd8bcd341b61055145b4b26a7da79dd436 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Tue, 29 Dec 2015 14:44:13 -0500 Subject: [PATCH 131/441] Add definition for request files --- restify/restify.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 47c56240c1..8baf5da2d1 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -16,6 +16,11 @@ declare module "restify" { family: string; address: string; } + + interface requestFileInterface { + path: string; + type: string; + } interface Request extends http.ServerRequest { header: (key: string, defaultValue?: string) => any; @@ -34,6 +39,7 @@ declare module "restify" { params: any; body?: any; //available when bodyParser plugin is used + files?: { [name: string]: requestFileInterface }; isSecure: () => boolean; } From 3cceead6e0d735be723b61273374a4fa1fba47f1 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Tue, 29 Dec 2015 14:53:28 -0500 Subject: [PATCH 132/441] lwip toBuffer calls should callback with Buffer instead of Image --- lwip/lwip.d.ts | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/lwip/lwip.d.ts b/lwip/lwip.d.ts index 63d2c701b8..0f40c63d25 100644 --- a/lwip/lwip.d.ts +++ b/lwip/lwip.d.ts @@ -12,6 +12,10 @@ declare module "lwip" { interface ImageCallback { (err: any, image: Image): void; } + + interface BufferCallback { + (err: any, buffer: Buffer): void; + } /** * Open an image @@ -386,7 +390,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: "jpg", callback: ImageCallback): void; + toBuffer(format: "jpg", callback: BufferCallback): void; /** * Get encoded binary image data as a NodeJS Buffer. @@ -396,7 +400,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: "jpg", params: JpegBufferParams, callback: ImageCallback): void; + toBuffer(format: "jpg", params: JpegBufferParams, callback: BufferCallback): void; /** * Get encoded binary image data as a NodeJS Buffer. @@ -405,7 +409,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: "png", callback: ImageCallback): void; + toBuffer(format: "png", callback: BufferCallback): void; /** * Get encoded binary image data as a NodeJS Buffer. @@ -415,7 +419,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: "png", params: PngBufferParams, callback: ImageCallback): void; + toBuffer(format: "png", params: PngBufferParams, callback: BufferCallback): void; /** * Get encoded binary image data as a NodeJS Buffer. @@ -424,7 +428,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: "gif", callback: ImageCallback): void; + toBuffer(format: "gif", callback: BufferCallback): void; /** * Get encoded binary image data as a NodeJS Buffer. @@ -434,7 +438,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: "gif", params: GifBufferParams, callback: ImageCallback): void; + toBuffer(format: "gif", params: GifBufferParams, callback: BufferCallback): void; /** * Get encoded binary image data as a NodeJS Buffer. @@ -443,7 +447,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: string, callback: ImageCallback): void; + toBuffer(format: string, callback: BufferCallback): void; /** * Get encoded binary image data as a NodeJS Buffer. @@ -453,7 +457,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: string, params: JpegBufferParams | PngBufferParams | GifBufferParams, callback: ImageCallback): void; + toBuffer(format: string, params: JpegBufferParams | PngBufferParams | GifBufferParams, callback: BufferCallback): void; /** * Write encoded binary image data directly to a file. @@ -848,7 +852,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: "jpg", callback: ImageCallback): void; + toBuffer(format: "jpg", callback: BufferCallback): void; /** * Execute batch and obtain a Buffer object @@ -858,7 +862,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: "jpg", params: JpegBufferParams, callback: ImageCallback): void; + toBuffer(format: "jpg", params: JpegBufferParams, callback: BufferCallback): void; /** * Execute batch and obtain a Buffer object @@ -867,7 +871,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: "png", callback: ImageCallback): void; + toBuffer(format: "png", callback: BufferCallback): void; /** * Execute batch and obtain a Buffer object @@ -877,7 +881,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: "png", params: PngBufferParams, callback: ImageCallback): void; + toBuffer(format: "png", params: PngBufferParams, callback: BufferCallback): void; /** * Execute batch and obtain a Buffer object @@ -886,7 +890,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: "gif", callback: ImageCallback): void; + toBuffer(format: "gif", callback: BufferCallback): void; /** * Execute batch and obtain a Buffer object @@ -896,7 +900,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: "gif", params: GifBufferParams, callback: ImageCallback): void; + toBuffer(format: "gif", params: GifBufferParams, callback: BufferCallback): void; /** * Execute batch and obtain a Buffer object @@ -905,7 +909,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: string, callback: ImageCallback): void; + toBuffer(format: string, callback: BufferCallback): void; /** * Execute batch and obtain a Buffer object @@ -915,7 +919,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: string, params: JpegBufferParams | PngBufferParams | GifBufferParams, callback: ImageCallback): void; + toBuffer(format: string, params: JpegBufferParams | PngBufferParams | GifBufferParams, callback: BufferCallback): void; /** * Execute batch and write to file From a113f5db25fe282e3010a52247ec78cb59c0845b Mon Sep 17 00:00:00 2001 From: nicojs Date: Tue, 29 Dec 2015 21:38:33 +0100 Subject: [PATCH 133/441] [commonmark] Added typings for javascript reference implementation of the commonmark markdown spec --- commonmark/commonmark-tests.ts | 47 ++++++++ commonmark/commonmark.d.ts | 214 +++++++++++++++++++++++++++++++++ 2 files changed, 261 insertions(+) create mode 100644 commonmark/commonmark-tests.ts create mode 100644 commonmark/commonmark.d.ts diff --git a/commonmark/commonmark-tests.ts b/commonmark/commonmark-tests.ts new file mode 100644 index 0000000000..4896c04646 --- /dev/null +++ b/commonmark/commonmark-tests.ts @@ -0,0 +1,47 @@ +/// + +import commonmark = require('commonmark'); + +function logNode(node: commonmark.Node) { + + console.log( + node.destination, + node.firstChild, + node.info, + node.isContainer, + node.lastChild, + node.level, + node.listDelimiter, + node.listStart, + node.listTight, + node.listType, + node.literal, + node.next, + node.onEnter, + node.onExit, + node.parent, + node.prev, + node.sourcepos, + node.title, + node.type); + +} + +var parser = new commonmark.Parser({ smart: true, time: true }); +var node = parser.parse('# a piece of _markdown_'); + + +let w = node.walker(); +let step = w.next(); +if (step.entering) { + logNode(step.node); +} + + +let xmlRenderer = new commonmark.XmlRenderer({ sourcepos: true, time: true }); +let xml = xmlRenderer.render(node); +console.log(xml); + +let htmlRenderer = new commonmark.HtmlRenderer({ safe: true, smart: true, sourcepos: true, time: true}); +let html = htmlRenderer.render(node); +console.log(html); \ No newline at end of file diff --git a/commonmark/commonmark.d.ts b/commonmark/commonmark.d.ts new file mode 100644 index 0000000000..8f12714515 --- /dev/null +++ b/commonmark/commonmark.d.ts @@ -0,0 +1,214 @@ +// Type definitions for commonmark.js 0.22.1 +// Project: https://github.com/jgm/commonmark.js +// Definitions by: Nico Jansen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare module commonmark { + + export interface NodeWalkingStep { + /** + * a boolean, which is true when we enter a Node from a parent or sibling, and false when we reenter it from a child + */ + entering: boolean; + /** + * The node belonging to this step + */ + node: Node; + } + + export interface NodeWalker { + /** + * Returns an object with properties entering and node. Returns null when we have finished walking the tree. + */ + next(): NodeWalkingStep; + /** + * Resets the iterator to resume at the specified node and setting for entering. (Normally this isn't needed unless you do destructive updates to the Node tree.) + */ + resumeAt(node: Node, entering?: boolean): void; + } + + export interface Position extends Array> { + } + + export interface ListData { + type?: string, + tight?: boolean, + delimiter?: string, + bulletChar?: string + } + + export class Node { + constructor(nodeType: string, sourcepos?: Position); + isContainer: boolean; + + /** + * (read-only): one of Text, Softbreak, Hardbreak, Emph, Strong, Html, Link, Image, Code, Document, Paragraph, BlockQuote, Item, List, Heading, CodeBlock, HtmlBlock ThematicBreak. + */ + type: string; + /** + * (read-only): a Node or null. + */ + firstChild: Node; + /** + * (read-only): a Node or null. + */ + lastChild: Node; + /** + * (read-only): a Node or null. + */ + next: Node; + /** + * (read-only): a Node or null. + */ + prev: Node; + /** + * (read-only): a Node or null. + */ + parent: Node; + /** + * (read-only): an Array with the following form: [[startline, startcolumn], [endline, endcolumn]] + */ + sourcepos: Position; + /** + * the literal String content of the node or null. + */ + literal: string; + /** + * link or image destination (String) or null. + */ + destination: string; + /** + * link or image title (String) or null. + */ + title: string; + /** + * fenced code block info string (String) or null. + */ + info: string; + /** + * heading level (Number). + */ + level: number; + /** + * either Bullet or Ordered (or undefined). + */ + listType: string; + /** + * true if list is tight + */ + listTight: boolean; + /** + * a Number, the starting number of an ordered list. + */ + listStart: number; + /** + * a String, either ) or . for an ordered list. + */ + listDelimiter: string; + /** + * used only for CustomBlock or CustomInline. + */ + onEnter: string; + /** + * used only for CustomBlock or CustomInline. + */ + onExit: string; + /** + * Append a Node child to the end of the Node's children. + */ + appendChild(child: Node): void; + /** + * Prepend a Node child to the beginning of the Node's children. + */ + prependChild(child: Node): void; + /** + * Remove the Node from the tree, severing its links with siblings and parents, and closing up gaps as needed. + */ + unlink(): void; + /** + * Insert a Node sibling after the Node. + */ + insertAfter(sibling: Node): void; + /** + * Insert a Node sibling before the Node. + */ + insertBefore(sibling: Node): void; + /** + * Returns a NodeWalker that can be used to iterate through the Node tree rooted in the Node + */ + walker(): NodeWalker; + /** + * Setting the backing object of listType, listTight, listStat and listDelimiter directly. + * Not needed unless creating list nodes directly. Should be fixed from v>0.22.1 + * https://github.com/jgm/commonmark.js/issues/74 + */ + _listData: ListData; + } + + /** + * Instead of converting Markdown directly to HTML, as most converters do, commonmark.js parses Markdown to an AST (abstract syntax tree), and then renders this AST as HTML. + * This opens up the possibility of manipulating the AST between parsing and rendering. For example, one could transform emphasis into ALL CAPS. + */ + export class Parser { + /** + * Constructs a new Parser + */ + constructor(options?: ParserOptions); + parse(input: string): Node; + } + + export interface ParserOptions { + /** + * if true, straight quotes will be made curly, -- will be changed to an en dash, --- will be changed to an em dash, and ... will be changed to ellipses. + */ + smart?: boolean; + time?: boolean; + } + + export interface HtmlRenderingOptions extends XmlRenderingOptions { + /** + * if true, raw HTML will not be passed through to HTML output (it will be replaced by comments), and potentially unsafe URLs in links and images (those beginning with javascript:, vbscript:, file:, and with a few exceptions data:) will be replaced with empty strings. + */ + safe?: boolean; + /** + * if true, straight quotes will be made curly, -- will be changed to an en dash, --- will be changed to an em dash, and ... will be changed to ellipses. + */ + smart?: boolean; + /** + * if true, source position information for block-level elements will be rendered in the data-sourcepos attribute (for HTML) or the sourcepos attribute (for XML). + */ + sourcepos?: boolean; + } + + export class HtmlRenderer { + constructor(options?: HtmlRenderingOptions) + render(root: Node): string; + /** + * Let's you override the softbreak properties of a renderer. So, to make soft breaks render as hard breaks in HTML: + * writer.softbreak = "
"; + */ + softbreak: string; + /** + * Override the function that will be used to escape (sanitize) the html output. Return value is used to add to the html output + * @param input the input to escape + * @param isAttributeValue indicates wheter or not the input value will be used as value of an html attribute. + */ + escape: (input: string, isAttributeValue: boolean) => string; + } + + export interface XmlRenderingOptions { + time?: boolean; + sourcepos?: boolean; + } + + export class XmlRenderer { + constructor(options?: XmlRenderingOptions) + render(root: Node): string; + } + +} + +declare module 'commonmark' { + export = commonmark; +} \ No newline at end of file From 41da14b9d808eadaec76fbf75543729c3b8aab43 Mon Sep 17 00:00:00 2001 From: nkovacic Date: Tue, 29 Dec 2015 21:57:23 +0100 Subject: [PATCH 134/441] Added Angular Locker definition https://github.com/tymondesigns/angular-locke --- angular-locker/angular-locker-tests.ts | 133 +++++++++++++++++++ angular-locker/angular-locker.d.ts | 173 +++++++++++++++++++++++++ 2 files changed, 306 insertions(+) create mode 100644 angular-locker/angular-locker-tests.ts create mode 100644 angular-locker/angular-locker.d.ts diff --git a/angular-locker/angular-locker-tests.ts b/angular-locker/angular-locker-tests.ts new file mode 100644 index 0000000000..0a1e107b0a --- /dev/null +++ b/angular-locker/angular-locker-tests.ts @@ -0,0 +1,133 @@ +/// +/// + +angular +.module('angular-locker-tests', ['angular-locker']) +.config(['lockerProvider', function config(lockerProvider) { + let lockerSettings: angular.locker.ILockerSettings = { + driver: 'session', + namespace: 'myApp', + separator: '.', + eventsEnabled: true, + extend: {} + }; + + lockerProvider.defaults(lockerSettings); +}]) +.controller('LockerController', ['$scope', 'locker', function ($scope: angular.IScope, locker: angular.locker.ILockerService) { + locker.put('someKey', 'someVal'); + + // put an item into session storage + locker.driver('session').put('sessionKey', ['some', 'session', 'data']); + + // add an item within a different namespace + locker.namespace('otherNamespace').put('foo', 'bar'); + + locker.put('someString', 'anyDataType'); + locker.put('someObject', { foo: 'I will be serialized', bar: 'pretty cool eh' }); + locker.put('someArray', ['foo', 'bar', 'baz']); + // etc + + //Inserts specified key and return value of function + locker.put('someKey', function() { + var obj = { foo: 'bar', bar: 'baz' }; + // some other logic + return obj; + }); + + locker.put('someKey', ['foo', 'bar']); + + //The current value will be passed into the function so you can perform logic on the current value, before returning it. e.g. + locker.put('someKey', function(current) { + current.push('baz'); + + return current; + }); + + locker.get('someKey'); // = ['foo', 'bar', 'baz'] + + // given locker.get('foo') is not defined + locker.put('foo', function (current) { + // current will equal 'bar' + }, 'bar'); + + //This will add each key/value pair as a separate item in storage + locker.put({ + someKey: 'johndoe', + anotherKey: ['some', 'random', 'array'], + boolKey: true + }); + + locker.add('someKey', 'someVal'); // true or false - whether the item was added or not + + // locker.put('fooArray', ['bar', 'baz', 'bob']); + + locker.get('fooArray'); // ['bar', 'baz', 'bob'] + + locker.get('keyDoesNotExist', 'a default value'); // 'a default value' + + locker.get(['someKey', 'anotherKey', 'foo']); + /* will return something like... + { + someKey: 'someValue', + anotherKey: true, + foo: 'bar' + }*/ + + // locker.put('someKey', { foo: 'bar', baz: 'bob' }); + + locker.pull('someKey', 'defaultVal'); // { foo: 'bar', baz: 'bob' } + + // then... + + locker.get('someKey', 'defaultVal'); // 'defaultVal' + + locker.all(); + // or + locker.namespace('somethingElse').all(); + + locker.count(); + // or + locker.namespace('somethingElse').count(); + + locker.has('someKey'); // true or false + + // or + locker.namespace('foo').has('bar'); + + // e.g. + if (locker.has('user.authToken') ) { + // we're logged in + } else { + // go to login page or something + } + + locker.forget('keyToRemove'); + // or + locker.driver('session').forget('sessionKey'); + // etc.. + + locker.forget(['keyToRemove', 'anotherKeyToRemove', 'something', 'else']); + + locker.clean(); + // or + locker.namespace('someOtherNamespace').clean(); + + locker.empty(); + + locker.bind($scope, 'foo'); + $scope['foo'] = ['bar', 'baz']; + locker.get('foo'); // = ['bar', 'baz'] + + locker.bind($scope, 'foo', 'someDefault'); + $scope['foo']; // = 'someDefault' + locker.get('foo'); // = 'someDefault' + + locker.unbind($scope, 'foo'); + $scope['foo']; // = undefined + locker.get('foo'); // = undefined + + if (! locker.supported()) { + // load a polyfill? + } +}]); diff --git a/angular-locker/angular-locker.d.ts b/angular-locker/angular-locker.d.ts new file mode 100644 index 0000000000..a3cf4c87fe --- /dev/null +++ b/angular-locker/angular-locker.d.ts @@ -0,0 +1,173 @@ +// Type definitions for Angular Locker v2.0.3 +// Project: https://github.com/tymondesigns/angular-locker +// Definitions by: Niko Kovačič +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "angular-locker" { + var _: string; + export = _; +} + +declare module angular.locker { + interface ILockerServicePutFunction { + (current: any): any + } + + interface ILockerRepository { + /** + * Add an item to storage if it doesn't already exist + * + * @param {String} key The key to add + * @param {Mixed} value The value to add + */ + add(key: string, value: any): boolean; + /** + * Return all items in storage within the current namespace/driver + * + */ + all(): any; + /** + * Remove all items set within the current namespace/driver + */ + clean(): ILockerService; + /** + * Get the total number of items within the current namespace + */ + count(): number; + /** + * Retrieve the specified item from storage + * + * @param {String|Array} key The key to get + * @param {Mixed} def The default value if it does not exist + */ + get(key: string | Array, defaultValue?: any): any; + /** + * Determine whether the item exists in storage + * + * @param {String|Function} key - The key to remove + */ + has(key: string): boolean + /** + * Get the storage keys as an array + */ + keys(): Array; + /** + * Add a new item to storage (even if it already exists) + * + * @param {Object} keyValuePairs Key value object + */ + put(keyValuePairs: Object): ILockerService | boolean; + /** + * Add a new item to storage (even if it already exists) + * + * @param {Mixed} putFunction The default to pass to function if doesn't already exist + */ + put(putFunction: Function): ILockerService | boolean; + /** + * Add a new item to storage (even if it already exists) + * + * @param {Mixed} key The key to add + * @param {Mixed} value The value to add + */ + put(key: string, value: any): ILockerService | boolean; + /** + * Add a new item to storage (even if it already exists) + * + * @param {Mixed} key The key to add + * @param {Mixed} putFunction The default to pass to function if doesn't already exist + * @param {Mixed} value The value to add + */ + put(key: string, putFunction: ILockerServicePutFunction, value: any): ILockerService | boolean; + /** + * Remove specified item(s) from storage + * + * @param {String} key The key to remove + */ + forget(key: string): void; + /** + * Remove specified item(s) from storage + * + * @param {Array} keys The array of keys to remove + * + */ + forget(keys: Array): void; + /** + * Retrieve the specified item from storage and then remove it + * + * @param {String|Array} key The key to pull from storage + * @param {Mixed} def The default value if it does not exist + */ + pull(key: string | Array, defaultValue?: any): any; + } + + interface ILockerService extends ILockerRepository { + /** + * Bind a storage key to a $scope property + * + * @param {Object} $scope The angular $scope object + * @param {String} key The key in storage to bind to + * @param {Mixed} def The default value to initially bind + */ + bind(scope: IScope, property: string, defaultPropertyValue?: any): ILockerService; + /** + * Set the storage driver on a new instance to enable overriding defaults + * + * @param {String} driver The driver to switch to + */ + driver(localStorageType: string): ILockerService; + /** + * Empty the current storage driver completely. careful now. + */ + empty(): ILockerService; + /** + * Get the currently set namespace + */ + getNamespace(): string; + /** + * Get a new instance of Locker + * + * @param {Object} options The config options to instantiate with + */ + instance(lockerSettings: ILockerSettings): ILockerService; + /** + * Set the namespace on a new instance to enable overriding defaults + * + * @param {String} namespace The namespace to switch to + */ + 'namespace'(name: string): ILockerRepository; + /** + * Check browser support + * + * @see github.com/Modernizr/Modernizr/blob/master/feature-detects/storage/localstorage.js#L38-L47 + * + * @param {String} driver The driver to check support with + */ + supported(): boolean; + /** + * Unbind a storage key from a $scope property + * + * @param {Object} $scope The angular $scope object + * @param {String} key The key to remove from bindings + */ + unbind(scope: IScope, property: string): void; + } + + interface ILockerSettings { + driver?: string; + 'namespace'?: string | boolean; + separator?: string; + eventsEnabled?: boolean; + extend?: any; + } + + interface ILockerProvider extends angular.IServiceProvider { + /** + * Allow the defaults to be specified via the `lockerProvider` + * + * @param {ILockerSettings} lockerSettings The defaults to override + */ + defaults(lockerSettings: ILockerSettings): void; + } +} \ No newline at end of file From d52058a1a2e233d77197d98821871694fcd07f5f Mon Sep 17 00:00:00 2001 From: nkovacic Date: Tue, 29 Dec 2015 22:11:49 +0100 Subject: [PATCH 135/441] Fixed tests and ILockerRepository and ILockerService merge --- angular-locker/angular-locker-tests.ts | 8 ++++---- angular-locker/angular-locker.d.ts | 15 ++++++--------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/angular-locker/angular-locker-tests.ts b/angular-locker/angular-locker-tests.ts index 0a1e107b0a..c3c280e776 100644 --- a/angular-locker/angular-locker-tests.ts +++ b/angular-locker/angular-locker-tests.ts @@ -3,13 +3,13 @@ angular .module('angular-locker-tests', ['angular-locker']) -.config(['lockerProvider', function config(lockerProvider) { +.config(['lockerProvider', function config(lockerProvider: angular.locker.ILockerProvider) { let lockerSettings: angular.locker.ILockerSettings = { driver: 'session', namespace: 'myApp', separator: '.', eventsEnabled: true, - extend: {} + extend: {} }; lockerProvider.defaults(lockerSettings); @@ -38,7 +38,7 @@ angular locker.put('someKey', ['foo', 'bar']); //The current value will be passed into the function so you can perform logic on the current value, before returning it. e.g. - locker.put('someKey', function(current) { + locker.put('someKey', function(current: any) { current.push('baz'); return current; @@ -47,7 +47,7 @@ angular locker.get('someKey'); // = ['foo', 'bar', 'baz'] // given locker.get('foo') is not defined - locker.put('foo', function (current) { + locker.put('foo', function (current: any) { // current will equal 'bar' }, 'bar'); diff --git a/angular-locker/angular-locker.d.ts b/angular-locker/angular-locker.d.ts index a3cf4c87fe..e911e3be74 100644 --- a/angular-locker/angular-locker.d.ts +++ b/angular-locker/angular-locker.d.ts @@ -15,7 +15,7 @@ declare module angular.locker { (current: any): any } - interface ILockerRepository { + interface ILockerService { /** * Add an item to storage if it doesn't already exist * @@ -85,14 +85,14 @@ declare module angular.locker { * * @param {String} key The key to remove */ - forget(key: string): void; + forget(key: string): ILockerService; /** * Remove specified item(s) from storage * * @param {Array} keys The array of keys to remove * */ - forget(keys: Array): void; + forget(keys: Array): ILockerService; /** * Retrieve the specified item from storage and then remove it * @@ -100,9 +100,6 @@ declare module angular.locker { * @param {Mixed} def The default value if it does not exist */ pull(key: string | Array, defaultValue?: any): any; - } - - interface ILockerService extends ILockerRepository { /** * Bind a storage key to a $scope property * @@ -136,7 +133,7 @@ declare module angular.locker { * * @param {String} namespace The namespace to switch to */ - 'namespace'(name: string): ILockerRepository; + 'namespace'(name: string): ILockerService; /** * Check browser support * @@ -151,7 +148,7 @@ declare module angular.locker { * @param {Object} $scope The angular $scope object * @param {String} key The key to remove from bindings */ - unbind(scope: IScope, property: string): void; + unbind(scope: IScope, property: string): ILockerService; } interface ILockerSettings { @@ -159,7 +156,7 @@ declare module angular.locker { 'namespace'?: string | boolean; separator?: string; eventsEnabled?: boolean; - extend?: any; + extend?: Object; } interface ILockerProvider extends angular.IServiceProvider { From 40c81d6f5bae009f8961451df2926d5f66fdd0ff Mon Sep 17 00:00:00 2001 From: Jason Travis Date: Tue, 29 Dec 2015 14:13:58 -0700 Subject: [PATCH 136/441] Add middleware to browser-sync Options --- browser-sync/browser-sync.d.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/browser-sync/browser-sync.d.ts b/browser-sync/browser-sync.d.ts index 2276f36e59..9d4cbcce36 100644 --- a/browser-sync/browser-sync.d.ts +++ b/browser-sync/browser-sync.d.ts @@ -34,7 +34,7 @@ declare module "browser-sync" { * Default: undefined * Note: requires at least version 2.6.0 */ - watchOptions?: ChokidarOptions; + watchOptions?: chokidar.WatchOptions; /** * Use the built-in static server for basic HTML/JS/CSS websites. * Default: false @@ -243,19 +243,13 @@ declare module "browser-sync" { * Note: requires at least version 1.6.2 */ socket?: SocketOptions; + middleware?: MiddlewareHandler | MiddlewareHandler[]; } interface Hash { [path: string]: T; } - interface ChokidarOptions { - interval?: number; - debounceDelay?: number; - mode?: string; - cwd?: string; - } - interface UIOptions { /** set the default port */ port?: number; From 57888a3a478e3cb0d0cb10c778f794df99c0a1af Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Tue, 29 Dec 2015 17:12:20 -0600 Subject: [PATCH 137/441] Add test for alias with single string value --- minimist/minimist-tests.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/minimist/minimist-tests.ts b/minimist/minimist-tests.ts index 2266d2739d..efd3076aac 100644 --- a/minimist/minimist-tests.ts +++ b/minimist/minimist-tests.ts @@ -19,6 +19,9 @@ opts.boolean = strArr; opts.alias = { foo: strArr }; +opts.alias = { + foo: str +}; opts.default = { foo: str }; @@ -29,7 +32,7 @@ opts.unknown = (arg: string) => { if(/xyz/.test(arg)){ return true; } - + return false; }; opts.stopEarly = true; From e59b58703f9985064a941f74d0344e2f2cd3aca3 Mon Sep 17 00:00:00 2001 From: Eric Byers Date: Tue, 29 Dec 2015 18:43:49 -0600 Subject: [PATCH 138/441] Adding definition for console-stamp --- console-stamp/console-stamp-tests.ts | 21 +++++++++++++ console-stamp/console-stamp.d.ts | 46 ++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 console-stamp/console-stamp-tests.ts create mode 100644 console-stamp/console-stamp.d.ts diff --git a/console-stamp/console-stamp-tests.ts b/console-stamp/console-stamp-tests.ts new file mode 100644 index 0000000000..e6ae6895b0 --- /dev/null +++ b/console-stamp/console-stamp-tests.ts @@ -0,0 +1,21 @@ +/// + +import consoleStamp = require("console-stamp"); + +consoleStamp(console); + +var options = {}; +consoleStamp(console, options); + +var options2 = { + metadata: function ():string { + return 'string'; + }, + colors: { + stamp: "yellow", + label: "white", + metadata: "green" + }, + label: true +}; +consoleStamp(console, options2); diff --git a/console-stamp/console-stamp.d.ts b/console-stamp/console-stamp.d.ts new file mode 100644 index 0000000000..a798dc66cc --- /dev/null +++ b/console-stamp/console-stamp.d.ts @@ -0,0 +1,46 @@ +// Type definitions for console-stamp 0.2.0 +// Project: https://github.com/starak/node-console-stamp +// Definitions by: Eric Byers +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'console-stamp' { + + function consoleStamp(console:{}, options?: { + /** + * A string with date format based on Javascript Date Format + */ + pattern?: string + + /** + * If true it will show the label (LOG | INFO | WARN | ERROR) + */ + label?: boolean; + + /** + * An array containing the methods to include in the patch + */ + include?: any; + + /** + * An array containing the methods to exclude in the patch) + */ + exclude?: any; + + /** + * Types can be String, Object (interpreted with util.inspect), or Function. See the test-metadata.js for examples. + * Note that metadata can still be sent as the third parameter (as in vesion 1.6) as a backward compatibillity feature, but this is deprecated. + */ + metadata?: any; + + /** + * An object representing a color theme. More info https://www.npmjs.com/package/colors + */ + colors?: { + stamp?: any; + label?: any; + metadata?: any; + }; + }): void; + + export = consoleStamp; +} From b3e3e03bc43723cfad7b3fd92e623545fd4705e5 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 30 Dec 2015 05:17:07 +0500 Subject: [PATCH 139/441] lodash: signatures of _.flatten and _.flattenDeep have been changed --- lodash/lodash-tests.ts | 177 +++++++++++++++++++++++++++++++++-------- lodash/lodash.d.ts | 93 ++++++++++++++-------- 2 files changed, 205 insertions(+), 65 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2b..56cf02927e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -632,68 +632,179 @@ module TestFirst { result = _(list).first(); } -result = >_.flatten([[1, 2], [3, 4]]); -result = >_.flatten([[1, 2], [3, 4], 5, 6]); -result = >>>_.flatten([1, [2], [3, [[4]]]]); +// _.flatten +module TestFlatten { + { + let result: string[]; -result = >_.flatten([1, [2], [[3]]], true); -result = >_.flatten([1, [2], [3, [[4]]]], true); -result = >_.flatten([1, [2], [3, [[false]]]], true); + result = _.flatten('abc'); + } -result = <_.LoDashImplicitArrayWrapper>_([[1, 2], [3, 4], 5, 6]).flatten(); -result = <_.LoDashImplicitArrayWrapper>>>_([1, [2], [3, [[4]]]]).flatten(); + { + let result: number[]; -result = <_.LoDashImplicitArrayWrapper>_([1, [2], [3, [[4]]]]).flatten(true); + result = _.flatten([1, 2, 3]); + result = _.flatten([1, [2, 3]]); + result = _.flatten([1, [2, [3]]], true); + result = _.flatten([1, [2, [3]], [[4]]], true); + + result = _.flatten({0: 1, 1: 2, 2: 3, length: 3}); + result = _.flatten({0: 1, 1: [2, 3], length: 2}); + result = _.flatten({0: 1, 1: [2, [3]], length: 2}, true); + result = _.flatten({0: 1, 1: [2, [3]], 2: [[4]], length: 3}, true); + } + + { + let result: _.RecursiveArray; + + result = _.flatten([1, [2, [3]]]); + result = _.flatten([1, [2, [3]], [[4]]]); + + result = _.flatten({0: 1, 1: [2, [3]], length: 2}); + result = _.flatten({0: 1, 1: [2, [3]], 2: [[4]], length: 3}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').flatten(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _([1, 2, 3]).flatten(); + result = _([1, [2, 3]]).flatten(); + result = _([1, [2, [3]]]).flatten(true); + result = _([1, [2, [3]], [[4]]]).flatten(true); + + result = _({0: 1, 1: 2, 2: 3, length: 3}).flatten(); + result = _({0: 1, 1: [2, 3], length: 2}).flatten(); + result = _({0: 1, 1: [2, [3]], length: 2}).flatten(true); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flatten(true); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _([1, [2, [3]]]).flatten(); + result = _([1, [2, [3]], [[4]]]).flatten(); + + result = _({0: 1, 1: [2, [3]], length: 2}).flatten(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flatten(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().flatten(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, 2, 3]).chain().flatten(); + result = _([1, [2, 3]]).chain().flatten(); + result = _([1, [2, [3]]]).chain().flatten(true); + result = _([1, [2, [3]], [[4]]]).chain().flatten(true); + + result = _({0: 1, 1: 2, 2: 3, length: 3}).chain().flatten(); + result = _({0: 1, 1: [2, 3], length: 2}).chain().flatten(); + result = _({0: 1, 1: [2, [3]], length: 2}).chain().flatten(true); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flatten(true); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, [2, [3]]]).chain().flatten(); + result = _([1, [2, [3]], [[4]]]).chain().flatten(); + + result = _({0: 1, 1: [2, [3]], length: 2}).chain().flatten(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flatten(); + } +} // _.flattenDeep module TestFlattenDeep { - interface RecursiveArray extends Array> {} - interface ListOfRecursiveArraysOrValues extends _.List> {} - interface RecursiveList extends _.List> { } - - let recursiveArray: RecursiveArray; - let listOfMaybeRecursiveArraysOrValues: ListOfRecursiveArraysOrValues; - let recursiveList: RecursiveList; - { - let result: TResult[]; + let result: string[]; - result = _.flattenDeep(recursiveArray); - result = _.flattenDeep(listOfMaybeRecursiveArraysOrValues); + result = _.flattenDeep('abc'); } { - let result: any[]; + let result: number[]; - result = _.flattenDeep(recursiveList); + result = _.flattenDeep([1, 2, 3]); + result = _.flattenDeep([1, [2, 3]]); + result = _.flattenDeep([1, [2, [3]]]); + result = _.flattenDeep([1, [2, [3]], [[4]]]); + + result = _.flattenDeep({0: 1, 1: 2, 2: 3, length: 3}); + result = _.flattenDeep({0: 1, 1: [2, 3], length: 2}); + result = _.flattenDeep({0: 1, 1: [2, [3]], length: 2}); + result = _.flattenDeep({0: 1, 1: [2, [3]], 2: [[4]], length: 3}); } { - let result: _.LoDashImplicitArrayWrapper; + let result: _.LoDashImplicitArrayWrapper; - result = _(recursiveArray).flattenDeep(); - - result = _(listOfMaybeRecursiveArraysOrValues).flattenDeep(); + result = _('abc').flattenDeep(); } { - let result: _.LoDashImplicitArrayWrapper; + let result: _.LoDashImplicitArrayWrapper; - result = _(recursiveList).flattenDeep(); + result = _([1, 2, 3]).flattenDeep(); + result = _([1, [2, 3]]).flattenDeep(); + result = _([1, [2, [3]]]).flattenDeep(); + result = _([1, [2, [3]], [[4]]]).flattenDeep(); + + result = _({0: 1, 1: 2, 2: 3, length: 3}).flattenDeep(); + result = _({0: 1, 1: [2, 3], length: 2}).flattenDeep(); + result = _({0: 1, 1: [2, [3]], length: 2}).flattenDeep(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flattenDeep(); } { - let result: _.LoDashExplicitArrayWrapper; + let result: _.LoDashImplicitArrayWrapper; - result = _(recursiveArray).chain().flattenDeep(); + result = _([1, [2, [3]]]).flattenDeep(); + result = _([1, [2, [3]], [[4]]]).flattenDeep(); - result = _(listOfMaybeRecursiveArraysOrValues).chain().flattenDeep(); + result = _({0: 1, 1: [2, [3]], length: 2}).flattenDeep(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flattenDeep(); } { - let result: _.LoDashExplicitArrayWrapper; + let result: _.LoDashExplicitArrayWrapper; - result = _(recursiveList).chain().flattenDeep(); + result = _('abc').chain().flattenDeep(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, 2, 3]).chain().flattenDeep(); + result = _([1, [2, 3]]).chain().flattenDeep(); + result = _([1, [2, [3]]]).chain().flattenDeep(); + result = _([1, [2, [3]], [[4]]]).chain().flattenDeep(); + + result = _({0: 1, 1: 2, 2: 3, length: 3}).chain().flattenDeep(); + result = _({0: 1, 1: [2, 3], length: 2}).chain().flattenDeep(); + result = _({0: 1, 1: [2, [3]], length: 2}).chain().flattenDeep(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flattenDeep(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, [2, [3]]]).chain().flattenDeep(); + result = _([1, [2, [3]], [[4]]]).chain().flattenDeep(); + + result = _({0: 1, 1: [2, [3]], length: 2}).chain().flattenDeep(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flattenDeep(); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c45ec90eea..fe4d58d1d2 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1138,47 +1138,72 @@ declare module _ { first(): TResult; } - interface MaybeNestedList extends List> { } - interface RecursiveArray extends Array> { } - interface ListOfRecursiveArraysOrValues extends List> { } - interface RecursiveList extends List> { } + interface RecursiveArray extends Array> {} + interface ListOfRecursiveArraysOrValues extends List> {} //_.flatten interface LoDashStatic { /** - * Flattens a nested array a single level. - * - * _.flatten(x) is equivalent to _.flatten(x, false); - * - * @param array The array to flatten. - * @return `array` flattened. - **/ - flatten(array: MaybeNestedList): T[]; - - /** - * Flattens a nested array. If isDeep is true the array is recursively flattened, otherwise it is only + * Flattens a nested array. If isDeep is true the array is recursively flattened, otherwise it’s only * flattened a single level. * - * If you know whether or not this should be recursively at compile time, you typically want to use a - * version without a boolean parameter (i.e. `_.flatten(x)` or `_.flattenDeep(x)`). - * * @param array The array to flatten. - * @param deep Specify a deep flatten. - * @return `array` flattened. - **/ - flatten(array: RecursiveList, isDeep: boolean): List | RecursiveList; + * @param isDeep Specify a deep flatten. + * @return Returns the new flattened array. + */ + flatten(array: ListOfRecursiveArraysOrValues, isDeep: boolean): T[]; + + /** + * @see _.flatten + */ + flatten(array: List): T[]; + + /** + * @see _.flatten + */ + flatten(array: ListOfRecursiveArraysOrValues): RecursiveArray; + } + + interface LoDashImplicitWrapper { + /** + * @see _.flatten + */ + flatten(): LoDashImplicitArrayWrapper; } interface LoDashImplicitArrayWrapper { /** * @see _.flatten - **/ - flatten(): LoDashImplicitArrayWrapper; + */ + flatten(isDeep?: boolean): LoDashImplicitArrayWrapper; + } + interface LoDashImplicitObjectWrapper { /** * @see _.flatten - **/ - flatten(isShallow: boolean): LoDashImplicitArrayWrapper; + */ + flatten(isDeep?: boolean): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.flatten + */ + flatten(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashExplicitArrayWrapper; } //_.flattenDeep @@ -1189,17 +1214,14 @@ declare module _ { * @param array The array to recursively flatten. * @return Returns the new flattened array. */ - flattenDeep(array: RecursiveArray): T[]; - - /** - * @see _.flattenDeep - */ flattenDeep(array: ListOfRecursiveArraysOrValues): T[]; + } + interface LoDashImplicitWrapper { /** * @see _.flattenDeep */ - flattenDeep(array: RecursiveList): any[]; + flattenDeep(): LoDashImplicitArrayWrapper; } interface LoDashImplicitArrayWrapper { @@ -1216,6 +1238,13 @@ declare module _ { flattenDeep(): LoDashImplicitArrayWrapper; } + interface LoDashExplicitWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + interface LoDashExplicitArrayWrapper { /** * @see _.flattenDeep From 6d72f60cc0b9449caac11817ea9448c977f7793c Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 29 Dec 2015 21:53:03 +0800 Subject: [PATCH 140/441] Update gulp-watch.d.ts fix ``` import * as watch from 'gulp-watch' ``` fail --- gulp-watch/gulp-watch-tests.ts | 4 ++-- gulp-watch/gulp-watch.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gulp-watch/gulp-watch-tests.ts b/gulp-watch/gulp-watch-tests.ts index dd237dccc2..d912199fdd 100644 --- a/gulp-watch/gulp-watch-tests.ts +++ b/gulp-watch/gulp-watch-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require('gulp'); -import watch = require('gulp-watch'); +import * as gulp from 'gulp'; +import * as watch from 'gulp-watch'; gulp.task('stream', () => gulp.src('css/**/*.css') diff --git a/gulp-watch/gulp-watch.d.ts b/gulp-watch/gulp-watch.d.ts index 35fb7de955..74af525477 100644 --- a/gulp-watch/gulp-watch.d.ts +++ b/gulp-watch/gulp-watch.d.ts @@ -22,6 +22,6 @@ declare module 'gulp-watch' { } function watch(glob: string | Array, options?: IOptions, callback?: Function): IWatchStream; - + namespace watch {} export = watch; } From bb185bb119818eaf2d11a60f010dd5f526c9cbe1 Mon Sep 17 00:00:00 2001 From: pyoungon Date: Wed, 30 Dec 2015 12:55:45 +0900 Subject: [PATCH 141/441] Run 'npm test' and fix file to pass tests. (Change the definition order) --- mongodb/mongodb.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 9d5488e32d..2458dbdf2a 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -13,8 +13,8 @@ declare module "mongodb" { export class MongoClient{ constructor(serverConfig: any, options: any); - static connect(uri: string, options: any, callback?: (err: Error, db: Db) => void): void; static connect(uri: string, callback?: (err: Error, db: Db) => void): void; + static connect(uri: string, options: any, callback?: (err: Error, db: Db) => void): void; } // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/server.html @@ -44,8 +44,8 @@ declare module "mongodb" { public eval(code: any, parameters: any[], options?: any, callback?: (err: Error, result: any) => void ): void; //public dereference(dbRef: DbRef, callback?: (err: Error, result: any) => void): void; - public logout(options: any, callback?: (err: Error, result: any) => void ): void; public logout(callback?: (err: Error, result: any) => void ): void; + public logout(options: any, callback?: (err: Error, result: any) => void ): void; public authenticate(userName: string, password: string, callback?: (err: Error, result: any) => void ): void; public authenticate(userName: string, password: string, options: any, callback?: (err: Error, result: any) => void ): void; @@ -425,8 +425,8 @@ declare module "mongodb" { indexes(callback?: Function): void; aggregate(pipeline: any[], callback?: (err: Error, results: any) => void): void; aggregate(pipeline: any[], options: {readPreference: string}, callback?: (err: Error, results: any) => void): void; - stats(options: {readPreference: string; scale: number}, callback?: (err: Error, results: CollStats) => void): void; stats(callback?: (err: Error, results: CollStats) => void): void; + stats(options: {readPreference: string; scale: number}, callback?: (err: Error, results: CollStats) => void): void; hint: any; } From 0a5087916b0c7015a5b2a54ce6c0cfab098022af Mon Sep 17 00:00:00 2001 From: sumbad Date: Wed, 30 Dec 2015 08:07:15 +0300 Subject: [PATCH 142/441] Add declare module "dagre" --- dagre/dagre.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dagre/dagre.d.ts b/dagre/dagre.d.ts index fb5bd95d97..d16df52163 100644 --- a/dagre/dagre.d.ts +++ b/dagre/dagre.d.ts @@ -31,3 +31,7 @@ declare module Dagre{ } declare var dagre: Dagre.DagreFactory; + +declare module "dagre" { + export = dagre; +} From d0e64c3dfcfa5e3bb82c03ec1df88b2dbef058ac Mon Sep 17 00:00:00 2001 From: Sven Reglitzki Date: Wed, 30 Dec 2015 09:11:17 +0100 Subject: [PATCH 143/441] Add typings and tests for jasmine-node --- jasmine-node/jasmine-node-tests.ts | 31 +++++++++++++++++++++++++ jasmine-node/jasmine-node.d.ts | 37 ++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 jasmine-node/jasmine-node-tests.ts create mode 100644 jasmine-node/jasmine-node.d.ts diff --git a/jasmine-node/jasmine-node-tests.ts b/jasmine-node/jasmine-node-tests.ts new file mode 100644 index 0000000000..2ec424da42 --- /dev/null +++ b/jasmine-node/jasmine-node-tests.ts @@ -0,0 +1,31 @@ +// Type definitions for jasmine-node v1.14.5 +// Project: https://github.com/mhevery/jasmine-node +// Definitions by: Sven Reglitzki +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +it("should have a timeout parameter", () => {}, 1000); +it("should have an optional timeout parameter", () => {}); + +import jasmine = require("jasmine-node"); + +jasmine.loadHelpersInFolder("root", /\.helper\.ts/); + +jasmine.executeSpecsInFolder({ + specFolders: [], + onComplete: (runner) => {console.log(runner.results().failedCount)}, + isVerbose: true, + showColors: true, + teamcity: false, + useRequireJs: false, + regExpSpec: /\.spec\.ts/, + junitreport: { + report: false, + savePath : "./reports/", + useDotNotation: true, + consolidate: true + }, + includeStackTrace: true, + growl: false +}); diff --git a/jasmine-node/jasmine-node.d.ts b/jasmine-node/jasmine-node.d.ts new file mode 100644 index 0000000000..aa06eb920d --- /dev/null +++ b/jasmine-node/jasmine-node.d.ts @@ -0,0 +1,37 @@ +// Type definitions for jasmine-node v1.14.5 +// Project: https://github.com/mhevery/jasmine-node +// Definitions by: Sven Reglitzki +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare function it(expectation:string, assertion:(done:(err?:any) => void) => void, timeout?:number):void; + +declare module "jasmine-node" { + interface ExecuteSpecsOptions { + specFolders: string[], + onComplete?: (runner:jasmine.Runner) => void, + isVerbose?: boolean, + showColors?: boolean, + teamcity?: string | boolean, + useRequireJs?: boolean, + regExpSpec: RegExp, + junitreport?: { + report: boolean, + savePath: string, + useDotNotation: boolean, + consolidate: boolean + }, + includeStackTrace?: boolean, + growl?: boolean + } + + interface JasmineNode { + executeSpecsInFolder(options:ExecuteSpecsOptions): void; + loadHelpersInFolder(path:string, pattern:RegExp): void; + } + + var jasmine:JasmineNode; + + export = jasmine; +} From f87465736f1143cf51807596383c65da42cae691 Mon Sep 17 00:00:00 2001 From: labrute Date: Wed, 30 Dec 2015 09:35:53 +0100 Subject: [PATCH 144/441] Add missing semicolon in ui-grid.d.ts file --- ui-grid/ui-grid.d.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index e6dd7468d0..1c7eb13707 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -114,11 +114,11 @@ declare module uiGrid { ROW: string; COLUMN: string; OPTIONS: string; - } + }; scrollbars: { NEVER: number; ALWAYS: number; - } + }; } export type IGridInstance = IGridInstanceOf; export interface IGridInstanceOf { @@ -1057,7 +1057,7 @@ declare module uiGrid { * @param {sortChangedHandler} handler callback */ sortChanged: (scope: ng.IScope, handler: sortChangedHandler) => void; - } + }; } export interface columnVisibilityChangedHandler { /** @@ -1211,7 +1211,7 @@ declare module uiGrid { * @param {viewportKeyPressHandler} handler Callback */ viewportKeyPress: (scope: ng.IScope, handler: viewportKeyPressHandler) => void; - } + }; } export interface navigateHandler { @@ -1282,7 +1282,7 @@ declare module uiGrid { KEYDOWN: number; CLICK: number; CLEAR: number; - } + }; } } @@ -1481,7 +1481,7 @@ declare module uiGrid { BEGIN_CELL_EDIT: string; END_CELL_EDIT: string; CANCEL_CELL_EDIT: string; - } + }; } } @@ -1548,7 +1548,7 @@ declare module uiGrid { * @param {rowExpandedStateChangedHandler} handler */ rowExpandedStateChanged: (scope: ng.IScope, handler: rowExpandedStateChangedHandler) => void; - } + }; } export interface rowExpandedStateChangedHandler { @@ -2300,7 +2300,7 @@ declare module uiGrid { * @param {columnPositionChangedHandler} handler Callback Function */ columnPositionChanged?: (scope: ng.IScope, handler: columnPositionChangedHandler) => void; - } + }; } export interface columnPositionChangedHandler { (colDef: IColumnDef, originalPosition: number, finalPosition: number): void; @@ -2387,7 +2387,7 @@ declare module uiGrid { * @param {paginationChangedHandler} handler Callback */ paginationChanged: (scope: ng.IScope, handler: paginationChangedHandler) => void; - } + }; } /** @@ -2469,7 +2469,7 @@ declare module uiGrid { LEFT: string; RIGHT: string; NONE: string; - } + }; } } @@ -2508,7 +2508,7 @@ declare module uiGrid { * @param {columnSizeChangedHandler} handler Callback */ columnSizeChanged: (scope: ng.IScope, handler: columnSizeChangedHandler) => void; - } + }; } export interface columnSizeChangedHandler { @@ -2594,7 +2594,7 @@ declare module uiGrid { * @param {saveRowHandler} handler Callback */ saveRow: (scope: ng.IScope, handler: saveRowHandler) => void; - } + }; } export interface saveRowHandler { @@ -2973,7 +2973,7 @@ declare module uiGrid { * @param {rowSelectionChangedBatchHandler} handler callback */ rowSelectionChangedBatch: (scope: ng.IScope, handler: rowSelectionChangedBatchHandler) => void; - } + }; } export interface rowSelectionChangedHandler { /** @@ -3206,13 +3206,13 @@ declare module uiGrid { * @param {rowExpandedHandler} handler Callback */ rowExpanded: (scope: ng.IScope, handler: rowExpandedHandler) => void; - } + }; } export interface ITreeState { expandedState: { [index: string]: string - } + }; } export interface rowCollapsedHandler { @@ -3275,7 +3275,7 @@ declare module uiGrid { MAX: string; MIN: string; AVG: string; - } + }; } // Tree View From 0d394451f000b55d7365d69692738ceca758fe74 Mon Sep 17 00:00:00 2001 From: Niels Kristian Hansen Skovmand Date: Wed, 30 Dec 2015 11:24:50 +0100 Subject: [PATCH 145/441] Removed the es6-promise reference from the typings. --- spotify-web-api-js/spotify-web-api-js.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/spotify-web-api-js/spotify-web-api-js.d.ts b/spotify-web-api-js/spotify-web-api-js.d.ts index bb980b26f5..6e703588e8 100644 --- a/spotify-web-api-js/spotify-web-api-js.d.ts +++ b/spotify-web-api-js/spotify-web-api-js.d.ts @@ -4,7 +4,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -/// /** * Declare SpotifyWebApi variable, sincle that is the name of the function in spotify-web-api-js. From f69b3b8addb96d9d227546f1175e4dbc32861bb3 Mon Sep 17 00:00:00 2001 From: Niels Kristian Hansen Skovmand Date: Wed, 30 Dec 2015 11:26:49 +0100 Subject: [PATCH 146/441] Revert "Removed the es6-promise reference from the typings." This reverts commit 0d394451f000b55d7365d69692738ceca758fe74. --- spotify-web-api-js/spotify-web-api-js.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/spotify-web-api-js/spotify-web-api-js.d.ts b/spotify-web-api-js/spotify-web-api-js.d.ts index 6e703588e8..bb980b26f5 100644 --- a/spotify-web-api-js/spotify-web-api-js.d.ts +++ b/spotify-web-api-js/spotify-web-api-js.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +/// /** * Declare SpotifyWebApi variable, sincle that is the name of the function in spotify-web-api-js. From 37b6a533837766f0c765e4181dfc11e06dfbd752 Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 18:39:22 +0800 Subject: [PATCH 147/441] fix import --- gulp-mocha/gulp-mocha-tests.ts | 6 +++--- gulp-mocha/gulp-mocha.d.ts | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gulp-mocha/gulp-mocha-tests.ts b/gulp-mocha/gulp-mocha-tests.ts index 09f62b83d9..8d3eda4ea3 100644 --- a/gulp-mocha/gulp-mocha-tests.ts +++ b/gulp-mocha/gulp-mocha-tests.ts @@ -1,9 +1,9 @@ /// /// -import gulp = require("gulp"); -import mocha = require("gulp-mocha"); +import * as gulp from "gulp"; +import * as mocha from "gulp-mocha"; gulp.task('default', function () { return gulp.src('test.js', {read: false}) .pipe(mocha({reporter: 'nyan'})); -}); \ No newline at end of file +}); diff --git a/gulp-mocha/gulp-mocha.d.ts b/gulp-mocha/gulp-mocha.d.ts index 8d21b1323d..b63714b773 100644 --- a/gulp-mocha/gulp-mocha.d.ts +++ b/gulp-mocha/gulp-mocha.d.ts @@ -8,5 +8,6 @@ declare module "gulp-mocha" { function mocha(setupOptions?: MochaSetupOptions): NodeJS.ReadWriteStream; + namespace mocha {} export = mocha; -} \ No newline at end of file +} From 05a3f041b394c7cadb0a93bfb0b9718a4ba7b35c Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 18:47:58 +0800 Subject: [PATCH 148/441] fix import --- gulp-minify-html/gulp-minify-html-tests.ts | 4 ++-- gulp-minify-html/gulp-minify-html.d.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gulp-minify-html/gulp-minify-html-tests.ts b/gulp-minify-html/gulp-minify-html-tests.ts index 9714818f53..2ec41e556a 100644 --- a/gulp-minify-html/gulp-minify-html-tests.ts +++ b/gulp-minify-html/gulp-minify-html-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require('gulp'); -import minifyHtml = require('gulp-minify-html'); +import * as gulp from 'gulp'; +import * as minifyHtml from 'gulp-minify-html'; minifyHtml(); minifyHtml({conditionals: true, loose: true}); diff --git a/gulp-minify-html/gulp-minify-html.d.ts b/gulp-minify-html/gulp-minify-html.d.ts index 7471040847..11ce298a49 100644 --- a/gulp-minify-html/gulp-minify-html.d.ts +++ b/gulp-minify-html/gulp-minify-html.d.ts @@ -31,5 +31,7 @@ declare module 'gulp-minify-html' { function minifyHtml(options?: IOptions): NodeJS.ReadWriteStream; + namespace minifyHtml {} + export = minifyHtml; } From 17705ca1d54f73999b54a7613b98f16f403e59a3 Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 18:50:53 +0800 Subject: [PATCH 149/441] fix import --- gulp-autoprefixer/gulp-autoprefixer-tests.ts | 6 +++--- gulp-autoprefixer/gulp-autoprefixer.d.ts | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gulp-autoprefixer/gulp-autoprefixer-tests.ts b/gulp-autoprefixer/gulp-autoprefixer-tests.ts index 9fca0fa69c..1b3ba0d535 100644 --- a/gulp-autoprefixer/gulp-autoprefixer-tests.ts +++ b/gulp-autoprefixer/gulp-autoprefixer-tests.ts @@ -1,7 +1,7 @@ /// /// -import gulp = require("gulp"); -import autoprefixer = require("gulp-autoprefixer"); +import * as gulp from "gulp"; +import * as autoprefixer from "gulp-autoprefixer"; gulp.src("test.css") .pipe(autoprefixer()) @@ -17,4 +17,4 @@ gulp.src("test.css") gulp.src("test.css") .pipe(autoprefixer({remove: false})) - .pipe(gulp.dest("build")); \ No newline at end of file + .pipe(gulp.dest("build")); diff --git a/gulp-autoprefixer/gulp-autoprefixer.d.ts b/gulp-autoprefixer/gulp-autoprefixer.d.ts index 5abfdc6283..4ab8cf40d8 100644 --- a/gulp-autoprefixer/gulp-autoprefixer.d.ts +++ b/gulp-autoprefixer/gulp-autoprefixer.d.ts @@ -14,5 +14,7 @@ declare module "gulp-autoprefixer" { function autoPrefixer(opts?: Options): NodeJS.ReadWriteStream; + namespace autoPrefixer {} + export = autoPrefixer; } From 0ef4a3104236152d1f30a3951dca096f732bcab5 Mon Sep 17 00:00:00 2001 From: _mb_ Date: Wed, 30 Dec 2015 13:52:13 +0300 Subject: [PATCH 150/441] Update extend.d.ts --- extend/extend.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extend/extend.d.ts b/extend/extend.d.ts index 39b5d1a04c..72dae5314b 100644 --- a/extend/extend.d.ts +++ b/extend/extend.d.ts @@ -5,5 +5,6 @@ declare module "extend" { function extend(deepOrObject:boolean | Object, ...objectN: Object[]): any; + namespace extend {}; export = extend; -} \ No newline at end of file +} From 0caf0e98f8053c0cdd0ce9cdf9ee5168f883e228 Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 18:58:37 +0800 Subject: [PATCH 151/441] fix import --- gulp-csso/gulp-csso-tests.ts | 4 ++-- gulp-csso/gulp-csso.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gulp-csso/gulp-csso-tests.ts b/gulp-csso/gulp-csso-tests.ts index 5f61d4871f..0ddf457c7d 100644 --- a/gulp-csso/gulp-csso-tests.ts +++ b/gulp-csso/gulp-csso-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require('gulp'); -import csso = require('gulp-csso'); +import * as gulp from 'gulp'; +import * as csso from 'gulp-csso'; gulp.task('default', () => gulp.src('./main.css') diff --git a/gulp-csso/gulp-csso.d.ts b/gulp-csso/gulp-csso.d.ts index d5d338c4ac..c2b58777a8 100644 --- a/gulp-csso/gulp-csso.d.ts +++ b/gulp-csso/gulp-csso.d.ts @@ -7,6 +7,6 @@ declare module 'gulp-csso' { function csso(structureMinimization?: boolean): NodeJS.ReadWriteStream; - + namespace csso {} export = csso; } From 9693e563af6b7dd2df27c18c0dd00951f9b52df8 Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 19:02:55 +0800 Subject: [PATCH 152/441] fix import --- gulp-dtsm/gulp-dtsm-tests.ts | 5 ++--- gulp-dtsm/gulp-dtsm.d.ts | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gulp-dtsm/gulp-dtsm-tests.ts b/gulp-dtsm/gulp-dtsm-tests.ts index f97f8705e4..1eb5057380 100644 --- a/gulp-dtsm/gulp-dtsm-tests.ts +++ b/gulp-dtsm/gulp-dtsm-tests.ts @@ -2,10 +2,9 @@ /// /// -import dtsm = require('gulp-dtsm'); -import gulp = require('gulp'); +import * as dtsm from 'gulp-dtsm'; +import * as gulp from 'gulp'; var stream: NodeJS.WritableStream = dtsm(); gulp.task('dtsm', () => gulp.src('./dtsm.json').pipe(dtsm())); - diff --git a/gulp-dtsm/gulp-dtsm.d.ts b/gulp-dtsm/gulp-dtsm.d.ts index a8fe7878f5..63f01e1f59 100644 --- a/gulp-dtsm/gulp-dtsm.d.ts +++ b/gulp-dtsm/gulp-dtsm.d.ts @@ -8,6 +8,7 @@ declare module "gulp-dtsm" { function dtsm(): NodeJS.WritableStream; + namespace dtsm {} + export = dtsm; } - From 806d0f82373a8468d4048b7cfb18d07162204c16 Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 19:04:53 +0800 Subject: [PATCH 153/441] fix import --- gulp-flatten/gulp-flatten-tests.ts | 4 ++-- gulp-flatten/gulp-flatten.d.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gulp-flatten/gulp-flatten-tests.ts b/gulp-flatten/gulp-flatten-tests.ts index ee56225644..5a476195d0 100644 --- a/gulp-flatten/gulp-flatten-tests.ts +++ b/gulp-flatten/gulp-flatten-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require("gulp"); -import flatten = require("gulp-flatten"); +import * as gulp from "gulp"; +import * as flatten from "gulp-flatten"; gulp.task("flatten:simple", () => { gulp.src(["files/**/*.txt"]) diff --git a/gulp-flatten/gulp-flatten.d.ts b/gulp-flatten/gulp-flatten.d.ts index ccd9cedf10..2992aff4f7 100644 --- a/gulp-flatten/gulp-flatten.d.ts +++ b/gulp-flatten/gulp-flatten.d.ts @@ -13,5 +13,7 @@ declare module "gulp-flatten" { function flatten(options?: IOptions): NodeJS.ReadWriteStream; + namespace flatten {} + export = flatten; } From b43adcdb8aba398a9f7fff120e66283d05a1c0e5 Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 19:07:28 +0800 Subject: [PATCH 154/441] fix import --- gulp-gh-pages/gulp-gh-pages-tests.ts | 6 +++--- gulp-gh-pages/gulp-gh-pages.d.ts | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gulp-gh-pages/gulp-gh-pages-tests.ts b/gulp-gh-pages/gulp-gh-pages-tests.ts index a8633c0519..0d12c7329a 100644 --- a/gulp-gh-pages/gulp-gh-pages-tests.ts +++ b/gulp-gh-pages/gulp-gh-pages-tests.ts @@ -1,7 +1,7 @@ /// /// -import gulp = require("gulp"); -import ghPages = require("gulp-gh-pages"); +import * as gulp from "gulp"; +import * as ghPages from "gulp-gh-pages"; gulp.src("test.css") .pipe(ghPages()); @@ -22,4 +22,4 @@ gulp.src("test.css") .pipe(ghPages({push: false})); gulp.src("test.css") - .pipe(ghPages({message: "master"})); \ No newline at end of file + .pipe(ghPages({message: "master"})); diff --git a/gulp-gh-pages/gulp-gh-pages.d.ts b/gulp-gh-pages/gulp-gh-pages.d.ts index ef71465644..228589914e 100644 --- a/gulp-gh-pages/gulp-gh-pages.d.ts +++ b/gulp-gh-pages/gulp-gh-pages.d.ts @@ -17,5 +17,7 @@ declare module "gulp-gh-pages" { function ghPages(opts?: Options): NodeJS.ReadWriteStream; + namespace ghPages {} + export = ghPages; } From 7473219114643f27205051873ceaeae9037ae474 Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 19:20:24 +0800 Subject: [PATCH 155/441] fix import --- gulp-minify-css/gulp-minify-css-tests.ts | 4 ++-- gulp-minify-css/gulp-minify-css.d.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gulp-minify-css/gulp-minify-css-tests.ts b/gulp-minify-css/gulp-minify-css-tests.ts index 1375042dd2..d8ac4d9dfc 100644 --- a/gulp-minify-css/gulp-minify-css-tests.ts +++ b/gulp-minify-css/gulp-minify-css-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require("gulp"); -import minifyCSS = require("gulp-minify-css"); +import * as gulp from "gulp"; +import * as minifyCSS from "gulp-minify-css"; gulp.task("minify-css", () => { gulp.src("css/**/*.css") diff --git a/gulp-minify-css/gulp-minify-css.d.ts b/gulp-minify-css/gulp-minify-css.d.ts index be6d45b8b1..bc990a6e0e 100644 --- a/gulp-minify-css/gulp-minify-css.d.ts +++ b/gulp-minify-css/gulp-minify-css.d.ts @@ -27,5 +27,7 @@ declare module "gulp-minify-css" { function minifyCSS(options?: IOptions): NodeJS.ReadWriteStream; + namespace minifyCSS {} + export = minifyCSS; } From e081148d88b857d66509e3b46edbd08b3f75f96a Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 19:26:51 +0800 Subject: [PATCH 156/441] fix import --- gulp-load-plugins/gulp-load-plugins-tests.ts | 18 +++++++++--------- gulp-load-plugins/gulp-load-plugins.d.ts | 10 ++++++---- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/gulp-load-plugins/gulp-load-plugins-tests.ts b/gulp-load-plugins/gulp-load-plugins-tests.ts index f479be00cd..50930358f0 100644 --- a/gulp-load-plugins/gulp-load-plugins-tests.ts +++ b/gulp-load-plugins/gulp-load-plugins-tests.ts @@ -3,9 +3,9 @@ /// /// -import gulp = require('gulp'); -import gulpConcat = require('gulp-concat'); -import gulpLoadPlugins = require('gulp-load-plugins'); +import * as gulp from 'gulp'; +import * as gulpConcat from 'gulp-concat'; +import * as gulpLoadPlugins from 'gulp-load-plugins'; interface GulpPlugins extends IGulpPlugins { concat: typeof gulpConcat; @@ -29,8 +29,8 @@ gulp.task('taskName', () => { }); /* - * From 0.8.0, you can pass in an object of mappings for renaming plugins. For example, - * imagine you want to load the gulp-ruby-sass plugin, but want to refer to it as just + * From 0.8.0, you can pass in an object of mappings for renaming plugins. For example, + * imagine you want to load the gulp-ruby-sass plugin, but want to refer to it as just * sass : */ plugins = gulpLoadPlugins({ @@ -39,9 +39,9 @@ plugins = gulpLoadPlugins({ } }); /* - * gulp-load-plugins comes with npm scope support. The major difference is that scoped - * plugins are accessible through an object on plugins that represents the scope. For - * example, if the plugin is @myco/gulp-test-plugin then you can access the plugin as + * gulp-load-plugins comes with npm scope support. The major difference is that scoped + * plugins are accessible through an object on plugins that represents the scope. For + * example, if the plugin is @myco/gulp-test-plugin then you can access the plugin as * shown in the following example: */ interface GulpPlugins { @@ -49,5 +49,5 @@ interface GulpPlugins { testPlugin(): NodeJS.ReadWriteStream; } } - + plugins.myco.testPlugin(); diff --git a/gulp-load-plugins/gulp-load-plugins.d.ts b/gulp-load-plugins/gulp-load-plugins.d.ts index c8a11091d2..d72ca87c41 100644 --- a/gulp-load-plugins/gulp-load-plugins.d.ts +++ b/gulp-load-plugins/gulp-load-plugins.d.ts @@ -7,7 +7,7 @@ /** Loads in any gulp plugins and attaches them to an object, freeing you up from having to manually require each gulp plugin. */ declare module 'gulp-load-plugins' { - + interface IOptions { /** the glob(s) to search for, default ['gulp-*', 'gulp.*'] */ pattern?: string[]; @@ -24,14 +24,16 @@ declare module 'gulp-load-plugins' { /** a mapping of plugins to rename, the key being the NPM name of the package, and the value being an alias you define */ rename?: IPluginNameMappings; } - + interface IPluginNameMappings { [npmPackageName: string]: string } - + /** Loads in any gulp plugins and attaches them to an object, freeing you up from having to manually require each gulp plugin. */ function gulpLoadPlugins(options?: IOptions): T; - + + namespace gulpLoadPlugins {} + export = gulpLoadPlugins; } From 45e50efb7cae94e05198a4e3d2449adfe12bf60b Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 19:29:44 +0800 Subject: [PATCH 157/441] fix import --- gulp-less/gulp-less-tests.ts | 4 ++-- gulp-less/gulp-less.d.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gulp-less/gulp-less-tests.ts b/gulp-less/gulp-less-tests.ts index a0671e7665..ba9758649a 100644 --- a/gulp-less/gulp-less-tests.ts +++ b/gulp-less/gulp-less-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require("gulp"); -import less = require("gulp-less"); +import * as gulp from "gulp"; +import * as less from "gulp-less"; // Without options gulp.task("less", () => { diff --git a/gulp-less/gulp-less.d.ts b/gulp-less/gulp-less.d.ts index 84adca370b..8ee0a9b485 100644 --- a/gulp-less/gulp-less.d.ts +++ b/gulp-less/gulp-less.d.ts @@ -15,5 +15,7 @@ declare module "gulp-less" { function less(options?: IOptions): NodeJS.ReadWriteStream; + namespace less {} + export = less; } From ce7eb09fad696bd732545303afc278a9fe1b917f Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 19:31:58 +0800 Subject: [PATCH 158/441] fix import --- gulp-inject/gulp-inject-tests.ts | 4 ++-- gulp-inject/gulp-inject.d.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gulp-inject/gulp-inject-tests.ts b/gulp-inject/gulp-inject-tests.ts index 804e6f9b55..4f535c8d64 100644 --- a/gulp-inject/gulp-inject-tests.ts +++ b/gulp-inject/gulp-inject-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require("gulp"); -import inject = require("gulp-inject"); +import * as gulp from "gulp"; +import * as inject from "gulp-inject"; gulp.task("inject:simple", () => { gulp.src("src/index.html") diff --git a/gulp-inject/gulp-inject.d.ts b/gulp-inject/gulp-inject.d.ts index fb2668a1f7..5e72e06738 100644 --- a/gulp-inject/gulp-inject.d.ts +++ b/gulp-inject/gulp-inject.d.ts @@ -35,5 +35,7 @@ declare module "gulp-inject" { function inject(sources: NodeJS.ReadableStream, options?: IOptions): NodeJS.ReadWriteStream; + namespace inject {} + export = inject; } From 5c44167b702dd333e4a3a179cdaa8c217e7a4001 Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 19:01:06 +0800 Subject: [PATCH 159/441] fix import --- gulp-debug/gulp-debug-tests.ts | 4 ++-- gulp-debug/gulp-debug.d.ts | 2 ++ gulp-size/gulp-size-tests.ts | 6 +++--- gulp-size/gulp-size.d.ts | 2 ++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/gulp-debug/gulp-debug-tests.ts b/gulp-debug/gulp-debug-tests.ts index e6485d8da9..9701074101 100644 --- a/gulp-debug/gulp-debug-tests.ts +++ b/gulp-debug/gulp-debug-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require('gulp'); -import debug = require('gulp-debug'); +import * as gulp from 'gulp'; +import * as debug from 'gulp-debug'; gulp.task('default', () => gulp.src('foo.js') diff --git a/gulp-debug/gulp-debug.d.ts b/gulp-debug/gulp-debug.d.ts index 743f5f5eb1..d7ade91ac8 100644 --- a/gulp-debug/gulp-debug.d.ts +++ b/gulp-debug/gulp-debug.d.ts @@ -13,5 +13,7 @@ declare module 'gulp-debug' { function debug(options?: IOptions): NodeJS.ReadWriteStream; + namespace debug {} + export = debug; } diff --git a/gulp-size/gulp-size-tests.ts b/gulp-size/gulp-size-tests.ts index bfa2c6a04b..8981960f20 100644 --- a/gulp-size/gulp-size-tests.ts +++ b/gulp-size/gulp-size-tests.ts @@ -2,9 +2,9 @@ /// /// -import gulp = require('gulp'); -import size = require('gulp-size'); -import debug = require('gulp-debug'); +import * as gulp from 'gulp'; +import * as size from 'gulp-size'; +import * as debug from 'gulp-debug'; gulp.task('default', () => gulp.src('fixture.js') diff --git a/gulp-size/gulp-size.d.ts b/gulp-size/gulp-size.d.ts index d25f6ed94b..022e9b1713 100644 --- a/gulp-size/gulp-size.d.ts +++ b/gulp-size/gulp-size.d.ts @@ -19,5 +19,7 @@ declare module 'gulp-size' { function size(options?: IOptions): ISizeStream; + namespace size {} + export = size; } From 48a0270a29753972ca846c12190853ea2dc95dc1 Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 19:36:47 +0800 Subject: [PATCH 160/441] fix import --- gulp-sort/gulp-sort-tests.ts | 10 +++++----- gulp-sort/gulp-sort.d.ts | 16 +++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/gulp-sort/gulp-sort-tests.ts b/gulp-sort/gulp-sort-tests.ts index 12685c0859..d94f5cfdcb 100644 --- a/gulp-sort/gulp-sort-tests.ts +++ b/gulp-sort/gulp-sort-tests.ts @@ -3,9 +3,9 @@ /// /// -import gulp = require('gulp'); -import sort = require('gulp-sort'); -import gulpUtil = require('gulp-util'); +import * as gulp from 'gulp'; +import * as sort from 'gulp-sort'; +import * as gulpUtil from 'gulp-util'; // default sort gulp.src('./src/js/**/*.js') @@ -38,7 +38,7 @@ gulp.src('./src/js/**/*.js') } })) .pipe(gulp.dest('./build/js')); - + function customComparator(file1: gulpUtil.File, file2: gulpUtil.File) { if (file1.path.indexOf('build') > -1) { return 1; @@ -47,4 +47,4 @@ function customComparator(file1: gulpUtil.File, file2: gulpUtil.File) { return -1; } return 0; -} \ No newline at end of file +} diff --git a/gulp-sort/gulp-sort.d.ts b/gulp-sort/gulp-sort.d.ts index c06b9c3e07..d4e740fc59 100644 --- a/gulp-sort/gulp-sort.d.ts +++ b/gulp-sort/gulp-sort.d.ts @@ -8,11 +8,11 @@ /** Sort files in stream by path or any custom sort comparator */ declare module 'gulp-sort' { - + import gulpUtil = require('gulp-util'); - + interface IOptions { - /** + /** * A function to compare two files. * Returns: * -1 if file1 should be before file2, @@ -23,9 +23,9 @@ declare module 'gulp-sort' { /** Whether to sort in ascending order, default is true */ asc?: boolean; } - + interface IComparatorFunction { - /** + /** * A function to compare two files. * Returns: * -1 if file1 should be before file2, @@ -34,11 +34,13 @@ declare module 'gulp-sort' { */ (file1: gulpUtil.File, file2: gulpUtil.File): number; } - + /** Sort files in stream by path or any custom sort comparator */ function gulpSort(): NodeJS.ReadWriteStream; function gulpSort(comparator: IComparatorFunction): NodeJS.ReadWriteStream; function gulpSort(options: IOptions): NodeJS.ReadWriteStream; - + + namespace gulpSort {} + export = gulpSort; } From fbc90bdded9f2157ac1b03814440e770220ce283 Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 19:40:36 +0800 Subject: [PATCH 161/441] fix import --- gulp-tsd/gulp-tsd-tests.ts | 4 ++-- gulp-tsd/gulp-tsd.d.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gulp-tsd/gulp-tsd-tests.ts b/gulp-tsd/gulp-tsd-tests.ts index a7c20519cd..734db65e81 100644 --- a/gulp-tsd/gulp-tsd-tests.ts +++ b/gulp-tsd/gulp-tsd-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require("gulp"); -import tsd = require("gulp-tsd"); +import * as gulp from "gulp"; +import * as tsd from "gulp-tsd"; gulp.task("tsd", () => { gulp.src("gulp_tsd.json") diff --git a/gulp-tsd/gulp-tsd.d.ts b/gulp-tsd/gulp-tsd.d.ts index 816d50d25b..4e9380ebf2 100644 --- a/gulp-tsd/gulp-tsd.d.ts +++ b/gulp-tsd/gulp-tsd.d.ts @@ -18,5 +18,7 @@ declare module "gulp-tsd" { function tsd(opts?: IOptions, callback?: gulp.TaskCallback): NodeJS.ReadWriteStream; + namespace tsd {} + export = tsd; } From 8ed499ead51b3c1b2b568bff4996f0c0539006f5 Mon Sep 17 00:00:00 2001 From: Alexey Aylarov Date: Wed, 30 Dec 2015 16:12:27 +0300 Subject: [PATCH 162/441] Big Instant Messaging Upgrade -Big Instant Messaging Upgrade -Fixes --- voximplant-websdk/voximplant-websdk-tests.ts | 10 +- voximplant-websdk/voximplant-websdk.d.ts | 936 +++++++++++++++++-- 2 files changed, 888 insertions(+), 58 deletions(-) diff --git a/voximplant-websdk/voximplant-websdk-tests.ts b/voximplant-websdk/voximplant-websdk-tests.ts index efd1b64992..5dcb6c62e7 100644 --- a/voximplant-websdk/voximplant-websdk-tests.ts +++ b/voximplant-websdk/voximplant-websdk-tests.ts @@ -1,7 +1,8 @@ /// var vox: VoxImplant.Client = VoxImplant.getInstance(), - call: VoxImplant.Call; + call: VoxImplant.Call, + room: string; vox.init({ micRequired: true @@ -83,3 +84,10 @@ vox.addEventListener(VoxImplant.IMEvents.RosterReceived, function(event: VoxImpl console.log("Roster received: " + roster); }); +vox.addEventListener(VoxImplant.IMEvents.ChatRoomBanList, function(event: VoxImplant.IMEvents.ChatRoomBanList) { + console.log("Banned participants: " + event.participants + " in room " + event.room); +}); + +room = vox.createChatRoom(); + +vox.inviteToChatRoom(room, "user1", "Come and join us"); diff --git a/voximplant-websdk/voximplant-websdk.d.ts b/voximplant-websdk/voximplant-websdk.d.ts index 55c160a8b2..e3ba00655d 100644 --- a/voximplant-websdk/voximplant-websdk.d.ts +++ b/voximplant-websdk/voximplant-websdk.d.ts @@ -12,8 +12,7 @@ declare namespace VoxImplant { AuthResult, ConnectionClosed, ConnectionEstablished, - ConnectionFailed, - IMError, + ConnectionFailed, IncomingCall, MicAccessResult, NetStatsReceived, @@ -26,14 +25,40 @@ declare namespace VoxImplant { * VoxImplant.Client Instant Messaging and Presence events */ enum IMEvents { + ChatHistoryReceived, + ChatRoomBanList, + ChatRoomCreated, + ChatRoomError, + ChatRoomHistoryReceived, + ChatRoomInfo, + ChatRoomInvitation, + ChatRoomInviteDeclined, + ChatRoomMessageModified, + ChatRoomMessageNotModified, + ChatRoomMessageReceived, + ChatRoomMessageRemoved, + ChatRoomNewParticipant, + ChatRoomOperation, + ChatRoomParticipantExit, + ChatRoomParticipants, + ChatRoomPresenceUpdate, + ChatRoomStateUpdate, + ChatRoomSubjectChange, + ChatRoomsDataReceived, ChatStateUpdate, + MessageModified, + MessageNotModified, MessageReceived, + MessageRemoved, MessageStatus, - PresenceUpdate, + PresenceUpdate, RosterItemChange, RosterPresenceUpdate, RosterReceived, - SubscriptionRequest + SubscriptionRequest, + SystemError, + UCConnected, + UCDisconnected } /** @@ -43,6 +68,7 @@ declare namespace VoxImplant { Connected, Disconnected, Failed, + ICETimeout, InfoReceived, MessageReceived, ProgressToneStart, @@ -97,21 +123,7 @@ declare namespace VoxImplant { * Failure reason description */ message: string; - } - - /** - * Event dispatched in case of instant messaging subsystem error - */ - interface IMError { - /** - * Error data object, contains the error details - */ - errorData: Object; - /** - * Error type - */ - errorType: IMErrorType; - } + } /** * Event dispatched when there is a new incoming call to current user @@ -221,6 +233,16 @@ declare namespace VoxImplant { reason: string; } + /** + * Event dispatched in case of network connection problem between 2 peers + */ + interface ICETimeout { + /** + * Call that dispatched the event + */ + call: Call; + } + /** * Event dispatched when INFO message is received */ @@ -298,7 +320,415 @@ declare namespace VoxImplant { } } - module IMEvents { + module IMEvents { + + /** + * Event dispatched when chat history received + */ + interface ChatHistoryReceived { + /** + * User id + */ + id: string; + /** + * Message id specified in getInstantMessagingHistory method + */ + message_id: string; + /** + * List of messages + */ + messages: IMHistoryMessage[]; + } + + /** + * Event dispatched when info about banned chat room participants received + */ + interface ChatRoomBanList { + /** + * Participants list + */ + participants: ChatRoomParticipant[]; + /** + * Room id + */ + room: string; + } + + /** + * Event dispatched if chat room was created successfully + */ + interface ChatRoomCreated { + /** + * Room id + */ + room: string; + } + + /** + * Event dispatched in case of error while chat room operation + */ + interface ChatRoomError { + /** + * Error code + */ + code: string; + /** + * Operation name + */ + operation: string; + /** + * Room id + */ + room: string; + /** + * Error description + */ + text: string; + } + + /** + * Event dispatched when chat room history received + */ + interface ChatRoomHistoryReceived { + /** + * Message id specified in getInstantMessagingHistory method + */ + message_id: string; + /** + * List of messages + */ + messages: VoxImplant.IMHistoryMessage[]; + /** + * Room id + */ + room: string; + } + + /** + * Event dispatched when user joins chat room + */ + interface ChatRoomInfo { + /** + * Room features + */ + features: number; + /** + * Room info object + */ + info: ChatRoomInfo; + /** + * Room id + */ + room: string; + /** + * Room name + */ + room_name: string; + } + + /** + * Event dispatched when invitation to chat room received + */ + interface ChatRoomInvitation { + /** + * The body of the message + */ + body: string; + /** + * User id (inviter) + */ + from: string; + /** + * Password for the room + */ + password: string; + /** + * A reason of the invitation + */ + reason: string; + /** + * Room id + */ + room: string; + } + + /** + * Event dispatched if an invitation to chat room was declined by the invitee + */ + interface ChatRoomInviteDeclined { + /** + * User id (invitee) + */ + invitee: string; + /** + * A reason of the invitation + */ + reason: string; + /** + * Room id + */ + room: string; + } + + /** + * Event dispatched when chat room message modified + */ + interface ChatRoomMessageModified { + /** + * New message content + */ + content: string; + /** + * User id + */ + from: string; + /** + * Modified message id + */ + message_id: string; + /** + * Private/public message flag + */ + private_message: string; + /** + * Resource name + */ + resource: string; + /** + * Room id + */ + room: string; + /** + * Message timestamp + */ + timestamp: string; + } + + /** + * Event dispatched in case of error during chat room message modification + */ + interface ChatRoomMessageNotModified { + /** + * Error code + */ + code: number; + /** + * Message id + */ + message_id: string; + /** + * Private/public message flag + */ + private_message: string; + /** + * Room id + */ + room: string; + } + + /** + * Event dispatched when instant message was sent to chat room + */ + interface ChatRoomMessageReceived { + /** + * Message content + */ + content: string; + /** + * User id + */ + from: string; + /** + * Modified message id + */ + message_id: string; + /** + * Private/public message flag + */ + private_message: string; + /** + * Resource name + */ + resource: string; + /** + * Room id + */ + room: string; + /** + * Message timestamp + */ + timestamp: string; + } + + /** + * Event dispatched when chat room message removed + */ + interface ChatRoomMessageRemoved { + /** + * User id + */ + from: string; + /** + * Modified message id + */ + message_id: string; + /** + * Private/public message flag + */ + private_message: string; + /** + * Resource name + */ + resource: string; + /** + * Room id + */ + room: string; + /** + * Message timestamp + */ + timestamp: string; + } + + /** + * Event dispatched when new participant joined the chat room + */ + interface ChatRoomNewParticipant { + /** + * User display name + */ + displayName: string; + /** + * User id + */ + participant: string; + /** + * Room id + */ + room: string; + } + + /** + * Event dispatched when chat room participant was banned/unbanned + */ + interface ChatRoomOperation { + /** + * Room id + */ + room: string; + /** + * Operation type + */ + operation: ChatRoomOperationType; + /** + * Operation result: true/false - success/failure + */ + result: boolean; + } + + /** + * Event dispatched when participant left the chat room + */ + interface ChatRoomParticipantExit { + /** + * User id + */ + participant: string; + /** + * Room id + */ + room: string; + } + + /** + * Event dispatched when info about chat room participants received + */ + interface ChatRoomParticipants { + /** + * Participants list + */ + participants: ChatRoomParticipant[]; + /** + * Room id + */ + room: string; + } + + /** + * Event dispatched if chat room participant presence status was updated + */ + interface ChatRoomPresenceUpdate { + /** + * Optional presence message + */ + message: string; + /** + * Participant info + */ + participant: ParticipantInfo; + /** + * Current presence status + */ + presence: UserStatuses; + /** + * Room id + */ + room: string; + } + + /** + * Event dispatched when chat session state updated + */ + interface ChatRoomStateUpdate { + /** + * User id + */ + from: string; + /** + * Resource name + */ + resource: string; + /** + * Room id + */ + room: string; + /** + * Current chat session state + */ + state: ChatStateType; + } + + /** + * Event dispatched if chat room subject was changed + */ + interface ChatRoomSubjectChange { + /** + * User id who changed the subject + */ + id: string; + /** + * Resource name + */ + resource: string; + /** + * Room id + */ + room: string; + /** + * New subject + */ + subject: string; + } + + /** + * Event dispatched when information about chat rooms where user participates received + */ + interface ChatRoomsDataReceived { + /** + * Rooms list + */ + rooms: ChatRoom[]; + } /** * Event dispatched when chat session state updated @@ -307,15 +737,55 @@ declare namespace VoxImplant { /** * User id */ - id: string, + id: string; /** * Resource name */ - resource?: string, + resource?: string; /** * Current chat session state. See VoxImplant.ChatStateType enum */ - state: ChatStateType + state: ChatStateType; + } + + /** + * Event dispatched when instant message was modified by user + */ + interface MessageModified { + /** + * Message new content + */ + content: string; + /** + * User id (of the user who sent the message) + */ + id: string; + /** + * Message id + */ + message_id: string; + /** + * User id (of the user to whom the message was sent) + */ + to: string; + } + + /** + * Event dispatched if error happened during instant message modification + */ + interface MessageNotModified { + /** + * Message new content + */ + code: number; + /** + * Message id + */ + message_id: string; + /** + * User id (of the user to whom the message was sent) + */ + to: string; } /** @@ -325,19 +795,41 @@ declare namespace VoxImplant { /** * Message content */ - content: string, + content: string; /** - * User id + * User id (of the user who sent the message) */ - id: string, + id: string; /** * Message id */ - message_id: string, + message_id: string; /** * Resource name */ - resource?: string + resource?: string; + /** + * User id (of the user to whom the message was sent) + */ + to: string; + } + + /** + * Event dispatched when instant message was removed by user + */ + interface MessageRemoved { + /** + * User id (of the user who sent the message) + */ + id: string; + /** + * Message id + */ + message_id: string; + /** + * User id (of the user to whom the message was sent) + */ + to: string; } /** @@ -347,19 +839,19 @@ declare namespace VoxImplant { /** * User id */ - id: string, + id: string; /** * Message id */ - message_id: string, + message_id: string; /** * Resource name */ - resource?: string, + resource?: string; /** * Message event type. See VoxImplant.MessageEventType enum */ - type: MessageEventType + type: MessageEventType; } /** @@ -369,19 +861,19 @@ declare namespace VoxImplant { /** * User id */ - id: string, + id: string; /** * Status message */ - message: string, + message: string; /** * Current presence status */ - presence: UserStatuses, + presence: UserStatuses; /** * Resource name */ - resource?: string + resource?: string; } /** @@ -391,19 +883,23 @@ declare namespace VoxImplant { /** * User display name */ - displayName: string, + displayName: string; + /** + * Roster item groups + */ + groups: string[]; /** * User id */ - id: string, + id: string; /** * Resource name */ - resource?: string, + resource?: string; /** * Roster item event type. See VoxImplant.RosterItemEvent enum */ - type: RosterItemEvent + type: RosterItemEvent; } /** @@ -413,19 +909,19 @@ declare namespace VoxImplant { /** * User id */ - id: string, + id: string; /** * Status message */ - message?: string, + message?: string; /** * Current presence status */ - presence: UserStatuses, + presence: UserStatuses; /** * Resource name */ - resource?: string + resource?: string; } /** @@ -435,11 +931,11 @@ declare namespace VoxImplant { /** * User id */ - id: string, + id: string; /** * Array contains VoxImplant.RosterItem elements */ - roster: RosterItem[] + roster: RosterItem[]; } /** @@ -449,25 +945,49 @@ declare namespace VoxImplant { /** * User id */ - id: string, + id: string; /** * Optional message */ - message?: string, + message?: string; /** * Resource name */ - resource?: string, + resource?: string; /** * Message event type. See VoxImplant.SubscriptionRequestType enum */ - type: SubscriptionRequestType + type: SubscriptionRequestType; } + /** + * Event dispatched in case of instant messaging subsystem error + */ + interface SystemError { + /** + * Error data object, contains the error details + */ + errorData: Object; + /** + * Error type + */ + errorType: IMErrorType; + } + + /** + * Event dispatched when instant messaging and presence subsystems (UC) are online + */ + interface UCConnected {} + + /** + * Event dispatched when instant messaging and presence subsystems (UC) are offline + */ + interface UCDisconnected { } + } type VoxImplantEvent = Events.AuthResult | Events.ConnectionClosed | Events.ConnectionEstablished | - Events.ConnectionFailed | Events.IMError | Events.IncomingCall | Events.MicAccessResult | + Events.ConnectionFailed | Events.IncomingCall | Events.MicAccessResult | Events.NetStatsReceived | Events.PlaybackFinished | Events.SDKReady | Events.SourcesInfoUpdated; @@ -475,9 +995,18 @@ declare namespace VoxImplant { CallEvents.InfoReceived | CallEvents.MessageReceived | CallEvents.ProgressToneStart | CallEvents.ProgressToneStop | CallEvents.TransferComplete | CallEvents.TransferFailed; - type VoxImplantIMEvent = IMEvents.ChatStateUpdate | IMEvents.MessageReceived | IMEvents.MessageStatus | - IMEvents.PresenceUpdate | IMEvents.RosterItemChange | IMEvents.RosterPresenceUpdate | - IMEvents.RosterReceived | IMEvents.SubscriptionRequest; + type VoxImplantIMEvent = IMEvents.ChatHistoryReceived | IMEvents.ChatRoomBanList | + IMEvents.ChatRoomCreated | IMEvents.ChatRoomError | IMEvents.ChatRoomHistoryReceived | + IMEvents.ChatRoomInfo | IMEvents.ChatRoomInvitation | IMEvents.ChatRoomInviteDeclined | + IMEvents.ChatRoomMessageModified | IMEvents.ChatRoomMessageNotModified | IMEvents.ChatRoomMessageReceived | + IMEvents.ChatRoomMessageRemoved | IMEvents.ChatRoomNewParticipant | IMEvents.ChatRoomOperation | + IMEvents.ChatRoomParticipantExit | IMEvents.ChatRoomParticipants | IMEvents.ChatRoomPresenceUpdate | + IMEvents.ChatRoomStateUpdate | IMEvents.ChatRoomSubjectChange | IMEvents.ChatRoomsDataReceived | + IMEvents.ChatStateUpdate | IMEvents.MessageModified | IMEvents.MessageNotModified | + IMEvents.MessageReceived | IMEvents.MessageRemoved | IMEvents.MessageStatus | + IMEvents.PresenceUpdate | IMEvents.RosterItemChange | IMEvents.RosterPresenceUpdate | + IMEvents.RosterReceived | IMEvents.SubscriptionRequest | IMEvents.SystemError | + IMEvents.UCConnected | IMEvents.UCDisconnected; /** * VoxImplant SDK Configuration @@ -522,7 +1051,7 @@ declare namespace VoxImplant { /** * Default constraints that will be applied while the next attachRecordingDevice function call or if micRequired set to true */ - videoConstraints?: VideoSettings; + videoConstraints?: VideoSettings | boolean; /** * Video support */ @@ -543,6 +1072,20 @@ declare namespace VoxImplant { serverPresenceControl?: boolean; } + /** + * Audio playback device info + */ + interface AudioOutputInfo { + /** + * Device id that can be used to choose audio playback device + */ + id: number | string; + /** + * Device name , in WebRTC mode populated with real data only when app has been opened using HTTPS protocol + */ + name: string; + } + /** * Audio recording device info */ @@ -702,6 +1245,123 @@ declare namespace VoxImplant { XA } + enum ChatRoomOperationType { + /** + * Ban operation + */ + Ban, + /** + * Unban operation + */ + Unban + } + + /** + * Chat room + */ + interface ChatRoom { + /** + * Chat room id + */ + id: string; + /** + * Chat room password + */ + pass: string; + } + + /** + * Chat room info + */ + interface ChatRoomInfo { + /** + * Creation date + */ + creationdate: string; + /** + * Room description + */ + description: string; + /** + * Number of chat room participants + */ + occupants: number; + /** + * Room's name / subject + */ + subject: string; + } + + /** + * Chat room participant + */ + interface ChatRoomParticipant { + /** + * User id + */ + id: string; + /** + * User display name + */ + name: string; + /** + * True if the user is owner/admin of the room + */ + owner?: boolean; + } + + /** + * Message received from history + */ + interface IMHistoryMessage { + /** + * Message body + */ + body: string; + /** + * User id - author of the message + */ + from: string; + /** + * Message id + */ + id: string; + /** + * Message creation time + */ + time: string; + } + + /** + * Participant info + */ + interface ParticipantInfo { + /** + * The participant's affiliation with the room + */ + affiliation: number; + /** + * Indicate conditions like: user has been kicked or banned from the room + */ + flags: number; + /** + * User id + */ + id: string; + /** + * Reason + */ + reason: string; + /** + * Resource name + */ + resource: string; + /** + * The participant's role with the room + */ + role: number; + } + /** * Client class used to control platform functions. Can't be instantiatied directly (singleton), please use VoxImplant.getInstance to get the class instance */ @@ -736,10 +1396,22 @@ declare namespace VoxImplant { */ attachRecordingDevice(successCallback?: () => any, failedCallback?: () => any): void; /** + * Get a list of all currently available audio playback devices + */ + audioOutputs(): AudioOutputInfo[]; + /** * Get a list of all currently available audio sources / microphones */ audioSources(): AudioSourceInfo[]; /** + * Ban user from the chat room + * + * @param room Room id + * @param user_id User id + * @param reason Ban reason + */ + banChatRoomUser(room: string, user_id: string, reason?: string): void; + /** * Create call * * @param number The number to call @@ -761,6 +1433,21 @@ declare namespace VoxImplant { */ connected(): boolean; /** + * Create multi-user chat room and join it + * + * @param pass Password for room access + * @param users User ids of the invited users to the chat room + */ + createChatRoom(pass?: string, users?: string[]): string; + /** + * Decline invitation to join chat room + * + * @param room Room id + * @param user_id User id (inviter) + * @param reason User-supplied decline reason + */ + declineChatRoomInvite(room: string, user_id: string, reason?: string): void; + /** * Disable microphone/camera if micRequired in VoxImplant.Config was set to false (WebRTC mode only) */ detachRecordingDevice(): void; @@ -769,16 +1456,72 @@ declare namespace VoxImplant { */ disconnect(): void; /** + * Edit message in the chat room + * + * @param room Room id + * @param message_id Message id + * @param msg New message content + */ + editChatRoomMessage(room: string, message_id: string, msg: string): void; + /** + * Edit message sent to user + * + * @param room Room id + * @param message_id Message id + * @param msg New message content + */ + editInstantMessage(room: string, message_id: string, msg: string): void; + /** + * Get chat room history + * + * @param room Room id + * @param message_id Message id (to get messages sent before/after the message) + * @param direction False/true to get messages older/newer than the message with specified id + * @param count Number of messages + */ + getChatRoomHistory(room: string, message_id?: string, direction?: boolean, count?: number): void; + /** + * Get messages in a conversation with particular use + * + * @param user_id User id + * @param message_id Message id (to get messages sent before/after the message) + * @param direction False/true to get messages older/newer than the message with specified id + * @param count Number of messages + */ + getInstantMessagingHistory(user_id: string, message_id?: string, direction?: boolean, count?: number): void; + /** * Initialize SDK. SDKReady event will be dispatched after succesful SDK initialization. SDK can't be used until it's initialized * * @param config Client configuration options */ init(config?: Config): void; /** + * Invite user to join chat room + * + * @param room Room id + * @param user_id User id (invitee) + * @param reason User-supplied reason for the invitation + */ + inviteToChatRoom(room: string, user_id: string, reason?: string): void; + /** * Check if WebRTC support is available */ isRTCsupported(): boolean; /** + * Join multi-user chat room + * + * @param room Room id + * @param pass Password for room access + */ + joinChatRoom(room: string, pass?: string): void; + /** + * Leave multi-user chat room + * + * @param room Room id + * @param msg Message for other participants + */ + leaveChatRoom(room: string, msg?: string): void; + /** * Login into application * * @param username @@ -818,6 +1561,21 @@ declare namespace VoxImplant { */ playToneScript(script: string, loop?: boolean): void; /** + * Remove message in the chat room + * + * @param room Room id + * @param message_id Message id + */ + removeChatRoomMessage(room: string, message_id: string): void; + /** + * Remove user from the chat room + * + * @param room Room id + * @param user_id User id + * @param reason Reason + */ + removeChatRoomUser(room: string, user_id: string, reason?: string): void; + /** * Remove handler for specified event * * @param eventName Event name @@ -825,6 +1583,13 @@ declare namespace VoxImplant { */ removeEventListener(eventName: VoxImplant.Events | VoxImplant.IMEvents, eventHandler: () => any): void; /** + * Remove message sent to user + * + * @param user_id User id + * @param message_id Message id + */ + removeInstantMessage(user_id: string, message_id: string): void; + /** * Remove roster item (IM) * * @param user_id User id @@ -851,6 +1616,13 @@ declare namespace VoxImplant { */ requestOneTimeLoginKey(username: string): void; /** + * Send message to chat room + * + * @param room Room id + * @param msg Message for other participants + */ + sendChatRoomMessage(room: string, msg: string): string; + /** * Send message to user (IM) * * @param user_id User id @@ -871,6 +1643,20 @@ declare namespace VoxImplant { */ setCallActive(call: Call, active: boolean): void; /** + * Set chat room session state info + * + * @param room Room id + * @param status Chat session status + */ + setChatRoomState(room: string, status: ChatStateType): void; + /** + * Set new chat room subject + * + * @param room Room id + * @param subject New subject + */ + setChatRoomSubject(room: string, subject: string): void; + /** * Set chat session state info * * @param user_id User id @@ -956,6 +1742,14 @@ declare namespace VoxImplant { */ transferCall(call1: Call, call2: Call): void; /** + * Remove a ban on a user in the chat room + * + * @param room Room id + * @param user_id User id + * @param reason Reason + */ + unbanChatRoomUser(room: string, user_id: string, reason?: string): void; + /** * Use specified audio source , use audioSources to get the list of available audio sources * * @param id Id of the audio source @@ -1115,14 +1909,42 @@ declare namespace VoxImplant { * WebRTC Video Settings (aka Constraints) */ interface VideoSettings { + /** + * The width or width range, in pixels + */ + width?: number | any; + /** + * The height or height range, in pixels + */ + height?: number | any; + /** + * The exact aspect ratio (width in pixels divided by height in pixels, represented as a double rounded to the tenth decimal place) or aspect ratio range + */ + aspectRatio?: number | any; + /** + * The exact frame rate (frames per second) or frame rate range + */ + frameRate?: number | any; + /** + * This string (or each string, when a list) should be one of the members of VideoFacingModeEnum + */ + facingMode?: string | any; + /** + * The origin-unique identifier for the source of the MediaStreamTrack + */ + deviceId?: string; + /** + * The origin-unique group identifier for the source of the MediaStreamTrack. Two devices have the same group identifier if they belong to the same physical device + */ + groupId?: string; /** * Mandatory constraints object */ - mandatory: Object; + mandatory?: Object; /** * Optional constraints object */ - optional: Object; + optional?: Object; } /** From 871fb69ba68128e449fdfcac3af2d73aacec513f Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Wed, 30 Dec 2015 22:34:23 +0800 Subject: [PATCH 163/441] fix import --- gulp-ruby-sass/gulp-ruby-sass-tests.ts | 4 ++-- gulp-ruby-sass/gulp-ruby-sass.d.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gulp-ruby-sass/gulp-ruby-sass-tests.ts b/gulp-ruby-sass/gulp-ruby-sass-tests.ts index cba0c4c60d..5237527a45 100644 --- a/gulp-ruby-sass/gulp-ruby-sass-tests.ts +++ b/gulp-ruby-sass/gulp-ruby-sass-tests.ts @@ -1,7 +1,7 @@ /// /// -import gulp = require("gulp"); -import sass = require("gulp-ruby-sass"); +import * as gulp from "gulp"; +import * as sass from "gulp-ruby-sass"; gulp.task('sass', function () { sass('./scss/*.scss') diff --git a/gulp-ruby-sass/gulp-ruby-sass.d.ts b/gulp-ruby-sass/gulp-ruby-sass.d.ts index bb0c56328d..2b0d26fdfa 100644 --- a/gulp-ruby-sass/gulp-ruby-sass.d.ts +++ b/gulp-ruby-sass/gulp-ruby-sass.d.ts @@ -64,5 +64,7 @@ declare module "gulp-ruby-sass" { */ function sass(source: string, options?: Options): NodeJS.ReadableStream; + namespace sass {} + export = sass; } From 2032d81a344c3b70b3c5af91d8fcdd45e57d21ab Mon Sep 17 00:00:00 2001 From: _mb_ Date: Wed, 30 Dec 2015 18:20:15 +0300 Subject: [PATCH 164/441] Update extend.d.ts Removed semicolon. --- extend/extend.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extend/extend.d.ts b/extend/extend.d.ts index 72dae5314b..b73ccc00de 100644 --- a/extend/extend.d.ts +++ b/extend/extend.d.ts @@ -5,6 +5,6 @@ declare module "extend" { function extend(deepOrObject:boolean | Object, ...objectN: Object[]): any; - namespace extend {}; + namespace extend {} export = extend; } From 0ed7440a06c209281431c48afa71c6888d3efd8b Mon Sep 17 00:00:00 2001 From: PjMitchell Date: Wed, 30 Dec 2015 16:04:30 +0000 Subject: [PATCH 165/441] Redid definitions based on Docs. Definition WIP (parallelCoordinates) --- nvd3/nvd-test-bullet.ts | 46 - nvd3/nvd-test-bulletChart.ts | 72 - nvd3/nvd3-test-bullet.ts | 47 + nvd3/nvd3-test-bulletChart.ts | 73 + nvd3/nvd3-test-candlestick.ts | 90 + nvd3/nvd3-test-candlestickChart.ts | 108 + nvd3/nvd3-test-cumulativeLineChart.ts | 75 + nvd3/nvd3-test-discreteBarChart.ts | 60 + nvd3/nvd3-test-donutChart.ts | 93 + nvd3/nvd3-test-furiousLegend.ts | 72 + nvd3/nvd3-test-legend.ts | 110 +- nvd3/nvd3-test-line.ts | 71 + nvd3/nvd3-test-lineChart.ts | 103 + nvd3/nvd3-test-lineChartLogScale.ts | 67 + nvd3/nvd3-test-lineChartSVGResize.ts | 108 + nvd3/nvd3-test-linePlusBarChart.ts | 47 + nvd3/nvd3-test-lineWithFocusChart.ts | 33 + ...nvd3-test-lineWithFocusChartx2AxisLabel.ts | 36 + nvd3/nvd3-test-monitoringChart.ts | 135 + nvd3/nvd3-test-multiChart.ts | 53 + nvd3/nvd3-test-multibarChart.ts | 69 + nvd3/nvd3-test-multibarChart2.ts | 47 + nvd3/nvd3-test-multibarHorizontalChart.ts | 159 + nvd3/nvd3-test-ohlc.ts | 192 ++ nvd3/nvd3-test-ohlcChart.ts | 62 +- nvd3/nvd3-test-parallelCoordinates.ts | 47 + nvd3/nvd3-test-parallelCoordinatesChart.ts | 186 ++ nvd3/nvd3-test-scatter.ts | 35 + nvd3/nvd3-test-tooltip.ts | 100 +- nvd3/nvd3.d.ts | 2921 +++++++++++++++-- 30 files changed, 4860 insertions(+), 457 deletions(-) delete mode 100644 nvd3/nvd-test-bullet.ts delete mode 100644 nvd3/nvd-test-bulletChart.ts create mode 100644 nvd3/nvd3-test-bullet.ts create mode 100644 nvd3/nvd3-test-bulletChart.ts create mode 100644 nvd3/nvd3-test-candlestick.ts create mode 100644 nvd3/nvd3-test-candlestickChart.ts create mode 100644 nvd3/nvd3-test-cumulativeLineChart.ts create mode 100644 nvd3/nvd3-test-discreteBarChart.ts create mode 100644 nvd3/nvd3-test-donutChart.ts create mode 100644 nvd3/nvd3-test-furiousLegend.ts create mode 100644 nvd3/nvd3-test-line.ts create mode 100644 nvd3/nvd3-test-lineChart.ts create mode 100644 nvd3/nvd3-test-lineChartLogScale.ts create mode 100644 nvd3/nvd3-test-lineChartSVGResize.ts create mode 100644 nvd3/nvd3-test-linePlusBarChart.ts create mode 100644 nvd3/nvd3-test-lineWithFocusChart.ts create mode 100644 nvd3/nvd3-test-lineWithFocusChartx2AxisLabel.ts create mode 100644 nvd3/nvd3-test-monitoringChart.ts create mode 100644 nvd3/nvd3-test-multiChart.ts create mode 100644 nvd3/nvd3-test-multibarChart.ts create mode 100644 nvd3/nvd3-test-multibarChart2.ts create mode 100644 nvd3/nvd3-test-multibarHorizontalChart.ts create mode 100644 nvd3/nvd3-test-ohlc.ts create mode 100644 nvd3/nvd3-test-parallelCoordinates.ts create mode 100644 nvd3/nvd3-test-parallelCoordinatesChart.ts create mode 100644 nvd3/nvd3-test-scatter.ts diff --git a/nvd3/nvd-test-bullet.ts b/nvd3/nvd-test-bullet.ts deleted file mode 100644 index 7ec2363e0f..0000000000 --- a/nvd3/nvd-test-bullet.ts +++ /dev/null @@ -1,46 +0,0 @@ -/// -/// - -var width = 960, - height = 55, - margin = {top: 5, right: 40, bottom: 20, left: 120}; - - var chart = nv.models.bullet() - .width(width - margin.right - margin.left) - .height(height - margin.top - margin.bottom); - - var data = [ - {"title":"Revenue","subtitle":"US$, in thousands","ranges":[-150,-225,-300],"measures":[-220],"markers":[-250]} - ]; - - //TODO: to be consistent with other models, should be appending a g to an already made svg, not creating the svg element - var vis = d3.select("#chart").selectAll("svg") - .data(data) - .enter().append("svg") - .attr("class", "bullet nvd3") - .attr("width", width) - .attr("height", height); - - vis.transition().duration(1000).call(chart); - - var transition = function() { - vis.datum(randomize); - vis.transition().duration(1000).call(chart); - }; - - function randomize(d) { - if (!d.randomizer) d.randomizer = randomizer(d); - d.ranges = d.ranges.map(d.randomizer); - d.markers = d.markers.map(d.randomizer); - d.measures = d.measures.map(d.randomizer); - return d; - } - - function randomizer(d) { - var k = d3.max(d.ranges) * .2; - return function(d) { - return Math.max(0, d + k * (Math.random() - .5)); - }; - } - - d3.select('body').on('click', transition); \ No newline at end of file diff --git a/nvd3/nvd-test-bulletChart.ts b/nvd3/nvd-test-bulletChart.ts deleted file mode 100644 index eb727589e9..0000000000 --- a/nvd3/nvd-test-bulletChart.ts +++ /dev/null @@ -1,72 +0,0 @@ -/// -/// - -var width = 960, - height = 80, - margin = {top: 5, right: 40, bottom: 20, left: 120}; - -var chart = nv.models.bulletChart() - .width(width - margin.right - margin.left) - .height(height - margin.top - margin.bottom); - -var chart2 = nv.models.bulletChart() - .width(width - margin.right - margin.left) - .height(height - margin.top - margin.bottom); - -var data = [ - {"title":"Revenue","subtitle":"US$, in thousands","ranges":[150,225,300],"measures":[220],"markers":[250]}, - {"title":"Order Size","subtitle":"US$, average","ranges":[350,500,600],"measures":[100],"markers":[550]}, - {"title":"Satisfaction","subtitle":"out of 5","ranges":[3.5,4.25,5],"measures":[3.2,4.7],"markers":[4.4]} -]; - -var dataWithLabels = [{ - "title":"Revenue", - "subtitle":"US$, in thousands", - "ranges":[150,225,300], - "measures":[220], - "markers":[250, 100], - "markerLabels":['Target Inventory', 'Low Inventory'], - "rangeLabels":['Maximum Inventory','Average Inventory','Minimum Inventory'], - "measureLabels":['Current Inventory'] -}]; - -//TODO: to be consistent with other models, should be appending a g to an already made svg, not creating the svg element -var vis = d3.select("#chart").selectAll("svg") - .data(data) - .enter().append("svg") - .attr("class", "bullet nvd3") - .attr("width", width) - .attr("height", height); - -vis.transition().duration(1000).call(chart); - -var vis2 = d3.select("#chart2").selectAll("svg") - .data(dataWithLabels) - .enter().append('svg') - .attr('class',"bullet nvd3") - .attr("width",width) - .attr("height",height); - -vis2.transition().duration(1000).call(chart2); - -var transition = function() { - vis.datum(randomize).transition().duration(1000).call(chart); - vis2.datum(randomize).transition().duration(1000).call(chart2); -}; - -function randomize(d) { - if (!d.randomizer) d.randomizer = randomizer(d); - d.ranges = d.ranges.map(d.randomizer); - d.markers = d.markers.map(d.randomizer); - d.measures = d.measures.map(d.randomizer); - return d; -} - -function randomizer(d) { - var k = d3.max(d.ranges) * .2; - return function(d) { - return Math.max(0, d + k * (Math.random() - .5)); - }; - } - - d3.select('body').on('click', transition); \ No newline at end of file diff --git a/nvd3/nvd3-test-bullet.ts b/nvd3/nvd3-test-bullet.ts new file mode 100644 index 0000000000..6471ef0234 --- /dev/null +++ b/nvd3/nvd3-test-bullet.ts @@ -0,0 +1,47 @@ +/// +/// +module nvd3_test_bullet { + var width = 960, + height = 55, + margin = { top: 5, right: 40, bottom: 20, left: 120 }; + + var chart = nv.models.bullet() + .width(width - margin.right - margin.left) + .height(height - margin.top - margin.bottom); + + var data = [ + { "title": "Revenue", "subtitle": "US$, in thousands", "ranges": [-150, -225, -300], "measures": [-220], "markers": [-250] } + ]; + + //TODO: to be consistent with other models, should be appending a g to an already made svg, not creating the svg element + var vis = d3.select("#chart").selectAll("svg") + .data(data) + .enter().append("svg") + .attr("class", "bullet nvd3") + .attr("width", width) + .attr("height", height); + + vis.transition().duration(1000).call(chart); + + var transition = function () { + vis.datum(randomize); + vis.transition().duration(1000).call(chart); + }; + + function randomize(d) { + if (!d.randomizer) d.randomizer = randomizer(d); + d.ranges = d.ranges.map(d.randomizer); + d.markers = d.markers.map(d.randomizer); + d.measures = d.measures.map(d.randomizer); + return d; + } + + function randomizer(d) { + var k = d3.max(d.ranges) * .2; + return function (d) { + return Math.max(0, d + k * (Math.random() - .5)); + }; + } + + d3.select('body').on('click', transition); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-bulletChart.ts b/nvd3/nvd3-test-bulletChart.ts new file mode 100644 index 0000000000..1d126a4cf7 --- /dev/null +++ b/nvd3/nvd3-test-bulletChart.ts @@ -0,0 +1,73 @@ +/// +/// +module nvd3_test_bulletChart { + var width = 960, + height = 80, + margin = { top: 5, right: 40, bottom: 20, left: 120 }; + + var chart = nv.models.bulletChart() + .width(width - margin.right - margin.left) + .height(height - margin.top - margin.bottom); + + var chart2 = nv.models.bulletChart() + .width(width - margin.right - margin.left) + .height(height - margin.top - margin.bottom); + + var data = [ + { "title": "Revenue", "subtitle": "US$, in thousands", "ranges": [150, 225, 300], "measures": [220], "markers": [250] }, + { "title": "Order Size", "subtitle": "US$, average", "ranges": [350, 500, 600], "measures": [100], "markers": [550] }, + { "title": "Satisfaction", "subtitle": "out of 5", "ranges": [3.5, 4.25, 5], "measures": [3.2, 4.7], "markers": [4.4] } + ]; + + var dataWithLabels = [{ + "title": "Revenue", + "subtitle": "US$, in thousands", + "ranges": [150, 225, 300], + "measures": [220], + "markers": [250, 100], + "markerLabels": ['Target Inventory', 'Low Inventory'], + "rangeLabels": ['Maximum Inventory', 'Average Inventory', 'Minimum Inventory'], + "measureLabels": ['Current Inventory'] + }]; + + //TODO: to be consistent with other models, should be appending a g to an already made svg, not creating the svg element + var vis = d3.select("#chart").selectAll("svg") + .data(data) + .enter().append("svg") + .attr("class", "bullet nvd3") + .attr("width", width) + .attr("height", height); + + vis.transition().duration(1000).call(chart); + + var vis2 = d3.select("#chart2").selectAll("svg") + .data(dataWithLabels) + .enter().append('svg') + .attr('class', "bullet nvd3") + .attr("width", width) + .attr("height", height); + + vis2.transition().duration(1000).call(chart2); + + var transition = function () { + vis.datum(randomize).transition().duration(1000).call(chart); + vis2.datum(randomize).transition().duration(1000).call(chart2); + }; + + function randomize(d) { + if (!d.randomizer) d.randomizer = randomizer(d); + d.ranges = d.ranges.map(d.randomizer); + d.markers = d.markers.map(d.randomizer); + d.measures = d.measures.map(d.randomizer); + return d; + } + + function randomizer(d) { + var k = d3.max(d.ranges) * .2; + return function (d) { + return Math.max(0, d + k * (Math.random() - .5)); + }; + } + + d3.select('body').on('click', transition); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-candlestick.ts b/nvd3/nvd3-test-candlestick.ts new file mode 100644 index 0000000000..6794b553cc --- /dev/null +++ b/nvd3/nvd3-test-candlestick.ts @@ -0,0 +1,90 @@ +/// +module nvd3_test_candlestick { + var data = [{ + values: [ + { "date": 15854, "open": 165.42, "high": 165.8, "low": 164.34, "close": 165.22, "volume": 160363400, "adjusted": 164.35 }, + { "date": 15855, "open": 165.35, "high": 166.59, "low": 165.22, "close": 165.83, "volume": 107793800, "adjusted": 164.96 }, + { "date": 15856, "open": 165.37, "high": 166.31, "low": 163.13, "close": 163.45, "volume": 176850100, "adjusted": 162.59 }, + { "date": 15859, "open": 163.83, "high": 164.46, "low": 162.66, "close": 164.35, "volume": 168390700, "adjusted": 163.48 }, + { "date": 15860, "open": 164.44, "high": 165.1, "low": 162.73, "close": 163.56, "volume": 157631500, "adjusted": 162.7 }, + { "date": 15861, "open": 163.09, "high": 163.42, "low": 161.13, "close": 161.27, "volume": 211737800, "adjusted": 160.42 }, + { "date": 15862, "open": 161.2, "high": 162.74, "low": 160.25, "close": 162.73, "volume": 200225500, "adjusted": 161.87 }, + { "date": 15863, "open": 163.85, "high": 164.95, "low": 163.14, "close": 164.8, "volume": 188337800, "adjusted": 163.93 }, + { "date": 15866, "open": 165.31, "high": 165.4, "low": 164.37, "close": 164.8, "volume": 105667100, "adjusted": 163.93 }, + { "date": 15867, "open": 163.3, "high": 164.54, "low": 162.74, "close": 163.1, "volume": 159505400, "adjusted": 162.24 }, + { "date": 15868, "open": 164.22, "high": 164.39, "low": 161.6, "close": 161.75, "volume": 177361500, "adjusted": 160.9 }, + { "date": 15869, "open": 161.66, "high": 164.5, "low": 161.3, "close": 164.21, "volume": 163587800, "adjusted": 163.35 }, + { "date": 15870, "open": 164.03, "high": 164.67, "low": 162.91, "close": 163.18, "volume": 141197500, "adjusted": 162.32 }, + { "date": 15873, "open": 164.29, "high": 165.22, "low": 163.22, "close": 164.44, "volume": 136295600, "adjusted": 163.57 }, + { "date": 15874, "open": 164.53, "high": 165.99, "low": 164.52, "close": 165.74, "volume": 114695600, "adjusted": 164.87 }, + { "date": 15875, "open": 165.6, "high": 165.89, "low": 163.38, "close": 163.45, "volume": 206149500, "adjusted": 162.59 }, + { "date": 15876, "open": 161.86, "high": 163.47, "low": 158.98, "close": 159.4, "volume": 321255900, "adjusted": 158.56 }, + { "date": 15877, "open": 159.64, "high": 159.76, "low": 157.47, "close": 159.07, "volume": 271956800, "adjusted": 159.07 }, + { "date": 15880, "open": 157.41, "high": 158.43, "low": 155.73, "close": 157.06, "volume": 222329000, "adjusted": 157.06 }, + { "date": 15881, "open": 158.48, "high": 160.1, "low": 157.42, "close": 158.57, "volume": 162262200, "adjusted": 158.57 }, + { "date": 15882, "open": 159.87, "high": 160.5, "low": 159.25, "close": 160.14, "volume": 134848000, "adjusted": 160.14 }, + { "date": 15883, "open": 161.1, "high": 161.82, "low": 160.95, "close": 161.08, "volume": 129483700, "adjusted": 161.08 }, + { "date": 15884, "open": 160.63, "high": 161.4, "low": 159.86, "close": 160.42, "volume": 160402900, "adjusted": 160.42 }, + { "date": 15887, "open": 161.26, "high": 162.48, "low": 161.08, "close": 161.36, "volume": 131954800, "adjusted": 161.36 }, + { "date": 15888, "open": 161.12, "high": 162.3, "low": 160.5, "close": 161.21, "volume": 154863700, "adjusted": 161.21 }, + { "date": 15889, "open": 160.48, "high": 161.77, "low": 160.22, "close": 161.28, "volume": 75216400, "adjusted": 161.28 }, + { "date": 15891, "open": 162.47, "high": 163.08, "low": 161.3, "close": 163.02, "volume": 122416900, "adjusted": 163.02 }, + { "date": 15894, "open": 163.86, "high": 164.39, "low": 163.08, "close": 163.95, "volume": 108092500, "adjusted": 163.95 }, + { "date": 15895, "open": 164.98, "high": 165.33, "low": 164.27, "close": 165.13, "volume": 119298000, "adjusted": 165.13 }, + { "date": 15896, "open": 164.97, "high": 165.75, "low": 164.63, "close": 165.19, "volume": 121410100, "adjusted": 165.19 }, + { "date": 15897, "open": 167.11, "high": 167.61, "low": 165.18, "close": 167.44, "volume": 135592200, "adjusted": 167.44 }, + { "date": 15898, "open": 167.39, "high": 167.93, "low": 167.13, "close": 167.51, "volume": 104212700, "adjusted": 167.51 }, + { "date": 15901, "open": 167.97, "high": 168.39, "low": 167.68, "close": 168.15, "volume": 69450600, "adjusted": 168.15 }, + { "date": 15902, "open": 168.26, "high": 168.36, "low": 167.07, "close": 167.52, "volume": 88702100, "adjusted": 167.52 }, + { "date": 15903, "open": 168.16, "high": 168.48, "low": 167.73, "close": 167.95, "volume": 92873900, "adjusted": 167.95 }, + { "date": 15904, "open": 168.31, "high": 169.27, "low": 168.2, "close": 168.87, "volume": 103620100, "adjusted": 168.87 }, + { "date": 15905, "open": 168.52, "high": 169.23, "low": 168.31, "close": 169.17, "volume": 103831700, "adjusted": 169.17 }, + { "date": 15908, "open": 169.41, "high": 169.74, "low": 169.01, "close": 169.5, "volume": 79428600, "adjusted": 169.5 }, + { "date": 15909, "open": 169.8, "high": 169.83, "low": 169.05, "close": 169.14, "volume": 80829700, "adjusted": 169.14 }, + { "date": 15910, "open": 169.79, "high": 169.86, "low": 168.18, "close": 168.52, "volume": 112914000, "adjusted": 168.52 }, + { "date": 15911, "open": 168.22, "high": 169.08, "low": 167.94, "close": 168.93, "volume": 111088600, "adjusted": 168.93 }, + { "date": 15912, "open": 168.22, "high": 169.16, "low": 167.52, "close": 169.11, "volume": 107814600, "adjusted": 169.11 }, + { "date": 15915, "open": 168.68, "high": 169.06, "low": 168.11, "close": 168.59, "volume": 79695000, "adjusted": 168.59 }, + { "date": 15916, "open": 169.1, "high": 169.28, "low": 168.19, "close": 168.59, "volume": 85209600, "adjusted": 168.59 }, + { "date": 15917, "open": 168.94, "high": 169.85, "low": 168.49, "close": 168.71, "volume": 142388700, "adjusted": 168.71 }, + { "date": 15918, "open": 169.99, "high": 170.81, "low": 169.9, "close": 170.66, "volume": 110438400, "adjusted": 170.66 }, + { "date": 15919, "open": 170.28, "high": 170.97, "low": 170.05, "close": 170.95, "volume": 91116700, "adjusted": 170.95 }, + { "date": 15922, "open": 170.57, "high": 170.96, "low": 170.35, "close": 170.7, "volume": 54072700, "adjusted": 170.7 }, + { "date": 15923, "open": 170.37, "high": 170.74, "low": 169.35, "close": 169.73, "volume": 87495000, "adjusted": 169.73 }, + { "date": 15924, "open": 169.19, "high": 169.43, "low": 168.55, "close": 169.18, "volume": 84854700, "adjusted": 169.18 }, + { "date": 15925, "open": 169.98, "high": 170.18, "low": 168.93, "close": 169.8, "volume": 102181300, "adjusted": 169.8 }, + { "date": 15926, "open": 169.58, "high": 170.1, "low": 168.72, "close": 169.31, "volume": 91757700, "adjusted": 169.31 }, + { "date": 15929, "open": 168.46, "high": 169.31, "low": 168.38, "close": 169.11, "volume": 68593300, "adjusted": 169.11 }, + { "date": 15930, "open": 169.41, "high": 169.9, "low": 168.41, "close": 169.61, "volume": 80806000, "adjusted": 169.61 }, + { "date": 15931, "open": 169.53, "high": 169.8, "low": 168.7, "close": 168.74, "volume": 79829200, "adjusted": 168.74 }, + { "date": 15932, "open": 167.41, "high": 167.43, "low": 166.09, "close": 166.38, "volume": 152931800, "adjusted": 166.38 }, + { "date": 15933, "open": 166.06, "high": 166.63, "low": 165.5, "close": 165.83, "volume": 130868200, "adjusted": 165.83 }, + { "date": 15936, "open": 165.64, "high": 166.21, "low": 164.76, "close": 164.77, "volume": 96437600, "adjusted": 164.77 }, + { "date": 15937, "open": 165.04, "high": 166.2, "low": 164.86, "close": 165.58, "volume": 89294400, "adjusted": 165.58 }, + { "date": 15938, "open": 165.12, "high": 166.03, "low": 164.19, "close": 164.56, "volume": 159530500, "adjusted": 164.56 }, + { "date": 15939, "open": 164.9, "high": 166.3, "low": 164.89, "close": 166.06, "volume": 101471400, "adjusted": 166.06 }, + { "date": 15940, "open": 166.55, "high": 166.83, "low": 165.77, "close": 166.62, "volume": 90888900, "adjusted": 166.62 }, + { "date": 15943, "open": 166.79, "high": 167.3, "low": 165.89, "close": 166, "volume": 89702100, "adjusted": 166 }, + { "date": 15944, "open": 164.36, "high": 166, "low": 163.21, "close": 163.33, "volume": 158619400, "adjusted": 163.33 }, + { "date": 15945, "open": 163.26, "high": 164.49, "low": 163.05, "close": 163.91, "volume": 108113000, "adjusted": 163.91 }, + { "date": 15946, "open": 163.55, "high": 165.04, "low": 163.4, "close": 164.17, "volume": 119200500, "adjusted": 164.17 }, + { "date": 15947, "open": 164.51, "high": 164.53, "low": 163.17, "close": 163.65, "volume": 134560800, "adjusted": 163.65 }, + { "date": 15951, "open": 165.23, "high": 165.58, "low": 163.7, "close": 164.39, "volume": 142322300, "adjusted": 164.39 }, + { "date": 15952, "open": 164.43, "high": 166.03, "low": 164.13, "close": 165.75, "volume": 97304000, "adjusted": 165.75 }, + { "date": 15953, "open": 165.85, "high": 166.4, "low": 165.73, "close": 165.96, "volume": 62930500, "adjusted": 165.96 } + ] + }]; + + nv.addGraph(function () { + var chart = nv.models.candlestickBar() + .x(function (d) { return d['date'] }) + .y(function (d) { return d['close'] }); + d3.select("#chart1 svg") + .datum(data) + .transition().duration(500) + .call(chart); + + nv.utils.windowResize(chart.update); + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-candlestickChart.ts b/nvd3/nvd3-test-candlestickChart.ts new file mode 100644 index 0000000000..ac753341e7 --- /dev/null +++ b/nvd3/nvd3-test-candlestickChart.ts @@ -0,0 +1,108 @@ +/// +module nvd3_test_candlestickChart { + var data = [{ + values: [ + { "date": 15854, "open": 165.42, "high": 165.8, "low": 164.34, "close": 165.22, "volume": 160363400, "adjusted": 164.35 }, + { "date": 15855, "open": 165.35, "high": 166.59, "low": 165.22, "close": 165.83, "volume": 107793800, "adjusted": 164.96 }, + { "date": 15856, "open": 165.37, "high": 166.31, "low": 163.13, "close": 163.45, "volume": 176850100, "adjusted": 162.59 }, + { "date": 15859, "open": 163.83, "high": 164.46, "low": 162.66, "close": 164.35, "volume": 168390700, "adjusted": 163.48 }, + { "date": 15860, "open": 164.44, "high": 165.1, "low": 162.73, "close": 163.56, "volume": 157631500, "adjusted": 162.7 }, + { "date": 15861, "open": 163.09, "high": 163.42, "low": 161.13, "close": 161.27, "volume": 211737800, "adjusted": 160.42 }, + { "date": 15862, "open": 161.2, "high": 162.74, "low": 160.25, "close": 162.73, "volume": 200225500, "adjusted": 161.87 }, + { "date": 15863, "open": 163.85, "high": 164.95, "low": 163.14, "close": 164.8, "volume": 188337800, "adjusted": 163.93 }, + { "date": 15866, "open": 165.31, "high": 165.4, "low": 164.37, "close": 164.8, "volume": 105667100, "adjusted": 163.93 }, + { "date": 15867, "open": 163.3, "high": 164.54, "low": 162.74, "close": 163.1, "volume": 159505400, "adjusted": 162.24 }, + { "date": 15868, "open": 164.22, "high": 164.39, "low": 161.6, "close": 161.75, "volume": 177361500, "adjusted": 160.9 }, + { "date": 15869, "open": 161.66, "high": 164.5, "low": 161.3, "close": 164.21, "volume": 163587800, "adjusted": 163.35 }, + { "date": 15870, "open": 164.03, "high": 164.67, "low": 162.91, "close": 163.18, "volume": 141197500, "adjusted": 162.32 }, + { "date": 15873, "open": 164.29, "high": 165.22, "low": 163.22, "close": 164.44, "volume": 136295600, "adjusted": 163.57 }, + { "date": 15874, "open": 164.53, "high": 165.99, "low": 164.52, "close": 165.74, "volume": 114695600, "adjusted": 164.87 }, + { "date": 15875, "open": 165.6, "high": 165.89, "low": 163.38, "close": 163.45, "volume": 206149500, "adjusted": 162.59 }, + { "date": 15876, "open": 161.86, "high": 163.47, "low": 158.98, "close": 159.4, "volume": 321255900, "adjusted": 158.56 }, + { "date": 15877, "open": 159.64, "high": 159.76, "low": 157.47, "close": 159.07, "volume": 271956800, "adjusted": 159.07 }, + { "date": 15880, "open": 157.41, "high": 158.43, "low": 155.73, "close": 157.06, "volume": 222329000, "adjusted": 157.06 }, + { "date": 15881, "open": 158.48, "high": 160.1, "low": 157.42, "close": 158.57, "volume": 162262200, "adjusted": 158.57 }, + { "date": 15882, "open": 159.87, "high": 160.5, "low": 159.25, "close": 160.14, "volume": 134848000, "adjusted": 160.14 }, + { "date": 15883, "open": 161.1, "high": 161.82, "low": 160.95, "close": 161.08, "volume": 129483700, "adjusted": 161.08 }, + { "date": 15884, "open": 160.63, "high": 161.4, "low": 159.86, "close": 160.42, "volume": 160402900, "adjusted": 160.42 }, + { "date": 15887, "open": 161.26, "high": 162.48, "low": 161.08, "close": 161.36, "volume": 131954800, "adjusted": 161.36 }, + { "date": 15888, "open": 161.12, "high": 162.3, "low": 160.5, "close": 161.21, "volume": 154863700, "adjusted": 161.21 }, + { "date": 15889, "open": 160.48, "high": 161.77, "low": 160.22, "close": 161.28, "volume": 75216400, "adjusted": 161.28 }, + { "date": 15891, "open": 162.47, "high": 163.08, "low": 161.3, "close": 163.02, "volume": 122416900, "adjusted": 163.02 }, + { "date": 15894, "open": 163.86, "high": 164.39, "low": 163.08, "close": 163.95, "volume": 108092500, "adjusted": 163.95 }, + { "date": 15895, "open": 164.98, "high": 165.33, "low": 164.27, "close": 165.13, "volume": 119298000, "adjusted": 165.13 }, + { "date": 15896, "open": 164.97, "high": 165.75, "low": 164.63, "close": 165.19, "volume": 121410100, "adjusted": 165.19 }, + { "date": 15897, "open": 167.11, "high": 167.61, "low": 165.18, "close": 167.44, "volume": 135592200, "adjusted": 167.44 }, + { "date": 15898, "open": 167.39, "high": 167.93, "low": 167.13, "close": 167.51, "volume": 104212700, "adjusted": 167.51 }, + { "date": 15901, "open": 167.97, "high": 168.39, "low": 167.68, "close": 168.15, "volume": 69450600, "adjusted": 168.15 }, + { "date": 15902, "open": 168.26, "high": 168.36, "low": 167.07, "close": 167.52, "volume": 88702100, "adjusted": 167.52 }, + { "date": 15903, "open": 168.16, "high": 168.48, "low": 167.73, "close": 167.95, "volume": 92873900, "adjusted": 167.95 }, + { "date": 15904, "open": 168.31, "high": 169.27, "low": 168.2, "close": 168.87, "volume": 103620100, "adjusted": 168.87 }, + { "date": 15905, "open": 168.52, "high": 169.23, "low": 168.31, "close": 169.17, "volume": 103831700, "adjusted": 169.17 }, + { "date": 15908, "open": 169.41, "high": 169.74, "low": 169.01, "close": 169.5, "volume": 79428600, "adjusted": 169.5 }, + { "date": 15909, "open": 169.8, "high": 169.83, "low": 169.05, "close": 169.14, "volume": 80829700, "adjusted": 169.14 }, + { "date": 15910, "open": 169.79, "high": 169.86, "low": 168.18, "close": 168.52, "volume": 112914000, "adjusted": 168.52 }, + { "date": 15911, "open": 168.22, "high": 169.08, "low": 167.94, "close": 168.93, "volume": 111088600, "adjusted": 168.93 }, + { "date": 15912, "open": 168.22, "high": 169.16, "low": 167.52, "close": 169.11, "volume": 107814600, "adjusted": 169.11 }, + { "date": 15915, "open": 168.68, "high": 169.06, "low": 168.11, "close": 168.59, "volume": 79695000, "adjusted": 168.59 }, + { "date": 15916, "open": 169.1, "high": 169.28, "low": 168.19, "close": 168.59, "volume": 85209600, "adjusted": 168.59 }, + { "date": 15917, "open": 168.94, "high": 169.85, "low": 168.49, "close": 168.71, "volume": 142388700, "adjusted": 168.71 }, + { "date": 15918, "open": 169.99, "high": 170.81, "low": 169.9, "close": 170.66, "volume": 110438400, "adjusted": 170.66 }, + { "date": 15919, "open": 170.28, "high": 170.97, "low": 170.05, "close": 170.95, "volume": 91116700, "adjusted": 170.95 }, + { "date": 15922, "open": 170.57, "high": 170.96, "low": 170.35, "close": 170.7, "volume": 54072700, "adjusted": 170.7 }, + { "date": 15923, "open": 170.37, "high": 170.74, "low": 169.35, "close": 169.73, "volume": 87495000, "adjusted": 169.73 }, + { "date": 15924, "open": 169.19, "high": 169.43, "low": 168.55, "close": 169.18, "volume": 84854700, "adjusted": 169.18 }, + { "date": 15925, "open": 169.98, "high": 170.18, "low": 168.93, "close": 169.8, "volume": 102181300, "adjusted": 169.8 }, + { "date": 15926, "open": 169.58, "high": 170.1, "low": 168.72, "close": 169.31, "volume": 91757700, "adjusted": 169.31 }, + { "date": 15929, "open": 168.46, "high": 169.31, "low": 168.38, "close": 169.11, "volume": 68593300, "adjusted": 169.11 }, + { "date": 15930, "open": 169.41, "high": 169.9, "low": 168.41, "close": 169.61, "volume": 80806000, "adjusted": 169.61 }, + { "date": 15931, "open": 169.53, "high": 169.8, "low": 168.7, "close": 168.74, "volume": 79829200, "adjusted": 168.74 }, + { "date": 15932, "open": 167.41, "high": 167.43, "low": 166.09, "close": 166.38, "volume": 152931800, "adjusted": 166.38 }, + { "date": 15933, "open": 166.06, "high": 166.63, "low": 165.5, "close": 165.83, "volume": 130868200, "adjusted": 165.83 }, + { "date": 15936, "open": 165.64, "high": 166.21, "low": 164.76, "close": 164.77, "volume": 96437600, "adjusted": 164.77 }, + { "date": 15937, "open": 165.04, "high": 166.2, "low": 164.86, "close": 165.58, "volume": 89294400, "adjusted": 165.58 }, + { "date": 15938, "open": 165.12, "high": 166.03, "low": 164.19, "close": 164.56, "volume": 159530500, "adjusted": 164.56 }, + { "date": 15939, "open": 164.9, "high": 166.3, "low": 164.89, "close": 166.06, "volume": 101471400, "adjusted": 166.06 }, + { "date": 15940, "open": 166.55, "high": 166.83, "low": 165.77, "close": 166.62, "volume": 90888900, "adjusted": 166.62 }, + { "date": 15943, "open": 166.79, "high": 167.3, "low": 165.89, "close": 166, "volume": 89702100, "adjusted": 166 }, + { "date": 15944, "open": 164.36, "high": 166, "low": 163.21, "close": 163.33, "volume": 158619400, "adjusted": 163.33 }, + { "date": 15945, "open": 163.26, "high": 164.49, "low": 163.05, "close": 163.91, "volume": 108113000, "adjusted": 163.91 }, + { "date": 15946, "open": 163.55, "high": 165.04, "low": 163.4, "close": 164.17, "volume": 119200500, "adjusted": 164.17 }, + { "date": 15947, "open": 164.51, "high": 164.53, "low": 163.17, "close": 163.65, "volume": 134560800, "adjusted": 163.65 }, + { "date": 15951, "open": 165.23, "high": 165.58, "low": 163.7, "close": 164.39, "volume": 142322300, "adjusted": 164.39 }, + { "date": 15952, "open": 164.43, "high": 166.03, "low": 164.13, "close": 165.75, "volume": 97304000, "adjusted": 165.75 }, + { "date": 15953, "open": 165.85, "high": 166.4, "low": 165.73, "close": 165.96, "volume": 62930500, "adjusted": 165.96 } + ] + }]; + + nv.addGraph(function () { + var chart = nv.models.candlestickBarChart() + .x(function (d) { return d['date'] }) + .y(function (d) { return d['close'] }) + .duration(250) + .margin({ left: 75, bottom: 50 }); + + // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately + chart.xAxis + .axisLabel("Dates") + .tickFormat(function (d) { + // I didn't feel like changing all the above date values + // so I hack it to make each value fall on a different date + return d3.time.format('%x')(new Date(new Date().valueOf() - (20000 * 86400000) + (d * 86400000))); + }); + + chart.yAxis + .axisLabel('Stock Price') + .tickFormat(function (d, i) { return '$' + d3.format(',.1f')(d); }); + + + + d3.select("#chart1 svg") + .datum(data) + .transition().duration(500) + .call(chart); + + nv.utils.windowResize(chart.update); + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-cumulativeLineChart.ts b/nvd3/nvd3-test-cumulativeLineChart.ts new file mode 100644 index 0000000000..fc7df21edc --- /dev/null +++ b/nvd3/nvd3-test-cumulativeLineChart.ts @@ -0,0 +1,75 @@ +/// +module nvd3_test_cumulativeLineChart { + // Wrapping in nv.addGraph allows for '0 timeout render', stores rendered charts in nv.graphs, + // and may do more in the future... it's NOT required + nv.addGraph(function () { + var chart = nv.models.cumulativeLineChart() + .useInteractiveGuideline(true) + .x(function (d) { return d[0] }) + .y(function (d) { return d[1] / 100 }) + .color(d3.scale.category10().range()) + .average(function (d) { return d.mean / 100; }) + .duration(300) + .clipVoronoi(false); + chart.dispatch.on('renderEnd', function () { + console.log('render complete: cumulative line with guide line'); + }); + + chart.xAxis.tickFormat(function (d) { + return d3.time.format('%m/%d/%y')(new Date(d)) + }); + + chart.yAxis.tickFormat(d3.format(',.1%')); + + d3.select('#chart1 svg') + .datum(cumulativeTestData()) + .call(chart); + + //TODO: Figure out a good way to do this automatically + nv.utils.windowResize(chart.update); + + chart.dispatch.on('stateChange', function (e) { nv.log('New State:', JSON.stringify(e)); }); + chart.state.dispatch.on('change', function (state) { + nv.log('state', JSON.stringify(state)); + }); + + return chart; + }); + + function flatTestData() { + return [{ + key: "Snakes", + values: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map(function (d) { + var currentDate = new Date(); + currentDate.setDate(currentDate.getDate() + d); + return [currentDate, 0] + }) + }]; + } + + function cumulativeTestData() { + return [ + { + key: "Long", + values: [[1083297600000, -2.974623048543], [1085976000000, -1.7740300785979], [1088568000000, 4.4681318138177], [1091246400000, 7.0242541001353], [1093924800000, 7.5709603667586], [1096516800000, 20.612245065736], [1099195200000, 21.698065237316], [1101790800000, 40.501189458018], [1104469200000, 50.464679413194], [1107147600000, 48.917421973355], [1109566800000, 63.750936549160], [1112245200000, 59.072499126460], [1114833600000, 43.373158880492], [1117512000000, 54.490918947556], [1120104000000, 56.661178852079], [1122782400000, 73.450103545496], [1125460800000, 71.714526354907], [1128052800000, 85.221664349607], [1130734800000, 77.769261392481], [1133326800000, 95.966528716500], [1136005200000, 107.59132116397], [1138683600000, 127.25740096723], [1141102800000, 122.13917498830], [1143781200000, 126.53657279774], [1146369600000, 132.39300992970], [1149048000000, 120.11238242904], [1151640000000, 118.41408917750], [1154318400000, 107.92918924621], [1156996800000, 110.28057249569], [1159588800000, 117.20485334692], [1162270800000, 141.33556756948], [1164862800000, 159.59452727893], [1167541200000, 167.09801853304], [1170219600000, 185.46849659215], [1172638800000, 184.82474099990], [1175313600000, 195.63155213887], [1177905600000, 207.40597044171], [1180584000000, 230.55966698196], [1183176000000, 239.55649035292], [1185854400000, 241.35915085208], [1188532800000, 239.89428956243], [1191124800000, 260.47781917715], [1193803200000, 276.39457482225], [1196398800000, 258.66530682672], [1199077200000, 250.98846121893], [1201755600000, 226.89902618127], [1204261200000, 227.29009273807], [1206936000000, 218.66476654350], [1209528000000, 232.46605902918], [1212206400000, 253.25667081117], [1214798400000, 235.82505363925], [1217476800000, 229.70112774254], [1220155200000, 225.18472705952], [1222747200000, 189.13661746552], [1225425600000, 149.46533007301], [1228021200000, 131.00340772114], [1230699600000, 135.18341728866], [1233378000000, 109.15296887173], [1235797200000, 84.614772549760], [1238472000000, 100.60810015326], [1241064000000, 141.50134895610], [1243742400000, 142.50405083675], [1246334400000, 139.81192372672], [1249012800000, 177.78205544583], [1251691200000, 194.73691933074], [1254283200000, 209.00838460225], [1256961600000, 198.19855877420], [1259557200000, 222.37102417812], [1262235600000, 234.24581081250], [1264914000000, 228.26087689346], [1267333200000, 248.81895126250], [1270008000000, 270.57301075186], [1272600000000, 292.64604322550], [1275278400000, 265.94088520518], [1277870400000, 237.82887467569], [1280548800000, 265.55973314204], [1283227200000, 248.30877330928], [1285819200000, 278.14870066912], [1288497600000, 292.69260960288], [1291093200000, 300.84263809599], [1293771600000, 326.17253914628], [1296450000000, 337.69335966505], [1298869200000, 339.73260965121], [1301544000000, 346.87865120765], [1304136000000, 347.92991526628], [1306814400000, 342.04627502669], [1309406400000, 333.45386231233], [1312084800000, 323.15034181243], [1314763200000, 295.66126882331], [1317355200000, 251.48014579253], [1320033600000, 295.15424257905], [1322629200000, 294.54766764397], [1325307600000, 295.72906119051], [1327986000000, 325.73351347613], [1330491600000, 340.16106061186], [1333166400000, 345.15514071490], [1335758400000, 337.10259395679], [1338436800000, 318.68216333837], [1341028800000, 317.03683945246], [1343707200000, 318.53549659997], [1346385600000, 332.85381464104], [1348977600000, 337.36534373477], [1351656000000, 350.27872156161], [1354251600000, 349.45128876100]] + , + mean: 250 + }, + { + key: "Short", + values: [[1083297600000, -0.77078283705125], [1085976000000, -1.8356366650335], [1088568000000, -5.3121322073127], [1091246400000, -4.9320975829662], [1093924800000, -3.9835408823225], [1096516800000, -6.8694685316805], [1099195200000, -8.4854877428545], [1101790800000, -15.933627197384], [1104469200000, -15.920980069544], [1107147600000, -12.478685045651], [1109566800000, -17.297761889305], [1112245200000, -15.247129891020], [1114833600000, -11.336459046839], [1117512000000, -13.298990907415], [1120104000000, -16.360027000056], [1122782400000, -18.527929522030], [1125460800000, -22.176516738685], [1128052800000, -23.309665368330], [1130734800000, -21.629973409748], [1133326800000, -24.186429093486], [1136005200000, -29.116707312531], [1138683600000, -37.188037874864], [1141102800000, -34.689264821198], [1143781200000, -39.505932105359], [1146369600000, -45.339572492759], [1149048000000, -43.849353192764], [1151640000000, -45.418353922571], [1154318400000, -44.579281059919], [1156996800000, -44.027098363370], [1159588800000, -41.261306759439], [1162270800000, -47.446018534027], [1164862800000, -53.413782948909], [1167541200000, -50.700723647419], [1170219600000, -56.374090913296], [1172638800000, -61.754245220322], [1175313600000, -66.246241587629], [1177905600000, -75.351650899999], [1180584000000, -81.699058262032], [1183176000000, -82.487023368081], [1185854400000, -86.230055113277], [1188532800000, -84.746914818507], [1191124800000, -100.77134971977], [1193803200000, -109.95435565947], [1196398800000, -99.605672965057], [1199077200000, -99.607249394382], [1201755600000, -94.874614950188], [1204261200000, -105.35899063105], [1206936000000, -106.01931193802], [1209528000000, -110.28883571771], [1212206400000, -119.60256203030], [1214798400000, -115.62201315802], [1217476800000, -106.63824185202], [1220155200000, -99.848746318951], [1222747200000, -85.631219602987], [1225425600000, -63.547909262067], [1228021200000, -59.753275364457], [1230699600000, -63.874977883542], [1233378000000, -56.865697387488], [1235797200000, -54.285579501988], [1238472000000, -56.474659581885], [1241064000000, -63.847137745644], [1243742400000, -68.754247867325], [1246334400000, -69.474257009155], [1249012800000, -75.084828197067], [1251691200000, -77.101028237237], [1254283200000, -80.454866854387], [1256961600000, -78.984349952220], [1259557200000, -83.041230807854], [1262235600000, -84.529748348935], [1264914000000, -83.837470195508], [1267333200000, -87.174487671969], [1270008000000, -90.342293007487], [1272600000000, -93.550928464991], [1275278400000, -85.833102140765], [1277870400000, -79.326501831592], [1280548800000, -87.986196903537], [1283227200000, -85.397862121771], [1285819200000, -94.738167050020], [1288497600000, -98.661952897151], [1291093200000, -99.609665952708], [1293771600000, -103.57099836183], [1296450000000, -104.04353411322], [1298869200000, -108.21382792587], [1301544000000, -108.74006900920], [1304136000000, -112.07766650960], [1306814400000, -109.63328199118], [1309406400000, -106.53578966772], [1312084800000, -103.16480871469], [1314763200000, -95.945078001828], [1317355200000, -81.226687340874], [1320033600000, -90.782206596168], [1322629200000, -89.484445370113], [1325307600000, -88.514723135326], [1327986000000, -93.381292724320], [1330491600000, -97.529705609172], [1333166400000, -99.520481439189], [1335758400000, -99.430184898669], [1338436800000, -93.349934521973], [1341028800000, -95.858475286491], [1343707200000, -95.522755836605], [1346385600000, -98.503848862036], [1348977600000, -101.49415251896], [1351656000000, -101.50099325672], [1354251600000, -99.487094927489]] + , + mean: -60 + }, + { + key: "Gross", + mean: 125, + values: [[1083297600000, -3.7454058855943], [1085976000000, -3.6096667436314], [1088568000000, -0.8440003934950], [1091246400000, 2.0921565171691], [1093924800000, 3.5874194844361], [1096516800000, 13.742776534056], [1099195200000, 13.212577494462], [1101790800000, 24.567562260634], [1104469200000, 34.543699343650], [1107147600000, 36.438736927704], [1109566800000, 46.453174659855], [1112245200000, 43.825369235440], [1114833600000, 32.036699833653], [1117512000000, 41.191928040141], [1120104000000, 40.301151852023], [1122782400000, 54.922174023466], [1125460800000, 49.538009616222], [1128052800000, 61.911998981277], [1130734800000, 56.139287982733], [1133326800000, 71.780099623014], [1136005200000, 78.474613851439], [1138683600000, 90.069363092366], [1141102800000, 87.449910167102], [1143781200000, 87.030640692381], [1146369600000, 87.053437436941], [1149048000000, 76.263029236276], [1151640000000, 72.995735254929], [1154318400000, 63.349908186291], [1156996800000, 66.253474132320], [1159588800000, 75.943546587481], [1162270800000, 93.889549035453], [1164862800000, 106.18074433002], [1167541200000, 116.39729488562], [1170219600000, 129.09440567885], [1172638800000, 123.07049577958], [1175313600000, 129.38531055124], [1177905600000, 132.05431954171], [1180584000000, 148.86060871993], [1183176000000, 157.06946698484], [1185854400000, 155.12909573880], [1188532800000, 155.14737474392], [1191124800000, 159.70646945738], [1193803200000, 166.44021916278], [1196398800000, 159.05963386166], [1199077200000, 151.38121182455], [1201755600000, 132.02441123108], [1204261200000, 121.93110210702], [1206936000000, 112.64545460548], [1209528000000, 122.17722331147], [1212206400000, 133.65410878087], [1214798400000, 120.20304048123], [1217476800000, 123.06288589052], [1220155200000, 125.33598074057], [1222747200000, 103.50539786253], [1225425600000, 85.917420810943], [1228021200000, 71.250132356683], [1230699600000, 71.308439405118], [1233378000000, 52.287271484242], [1235797200000, 30.329193047772], [1238472000000, 44.133440571375], [1241064000000, 77.654211210456], [1243742400000, 73.749802969425], [1246334400000, 70.337666717565], [1249012800000, 102.69722724876], [1251691200000, 117.63589109350], [1254283200000, 128.55351774786], [1256961600000, 119.21420882198], [1259557200000, 139.32979337027], [1262235600000, 149.71606246357], [1264914000000, 144.42340669795], [1267333200000, 161.64446359053], [1270008000000, 180.23071774437], [1272600000000, 199.09511476051], [1275278400000, 180.10778306442], [1277870400000, 158.50237284410], [1280548800000, 177.57353623850], [1283227200000, 162.91091118751], [1285819200000, 183.41053361910], [1288497600000, 194.03065670573], [1291093200000, 201.23297214328], [1293771600000, 222.60154078445], [1296450000000, 233.35556801977], [1298869200000, 231.22452435045], [1301544000000, 237.84432503045], [1304136000000, 235.55799131184], [1306814400000, 232.11873570751], [1309406400000, 226.62381538123], [1312084800000, 219.34811113539], [1314763200000, 198.69242285581], [1317355200000, 168.90235629066], [1320033600000, 202.64725756733], [1322629200000, 203.05389378105], [1325307600000, 204.85986680865], [1327986000000, 229.77085616585], [1330491600000, 239.65202435959], [1333166400000, 242.33012622734], [1335758400000, 234.11773262149], [1338436800000, 221.47846307887], [1341028800000, 216.98308827912], [1343707200000, 218.37781386755], [1346385600000, 229.39368622736], [1348977600000, 230.54656412916], [1351656000000, 243.06087025523], [1354251600000, 244.24733578385]] + }, + { + key: "S&P 1500", + values: [[1083297600000, -1.7798428181819], [1085976000000, -0.36883324836999], [1088568000000, 1.7312581046040], [1091246400000, -1.8356125950460], [1093924800000, -1.5396564170877], [1096516800000, -0.16867791409247], [1099195200000, 1.3754263993413], [1101790800000, 5.8171640898041], [1104469200000, 9.4350145241608], [1107147600000, 6.7649081510160], [1109566800000, 9.1568499314776], [1112245200000, 7.2485090994419], [1114833600000, 4.8762222306595], [1117512000000, 8.5992339354652], [1120104000000, 9.0896517982086], [1122782400000, 13.394644048577], [1125460800000, 12.311842010760], [1128052800000, 13.221003650717], [1130734800000, 11.218481009206], [1133326800000, 15.565352598445], [1136005200000, 15.623703865926], [1138683600000, 19.275255326383], [1141102800000, 19.432433717836], [1143781200000, 21.232881244655], [1146369600000, 22.798299192958], [1149048000000, 19.006125095476], [1151640000000, 19.151889158536], [1154318400000, 19.340022855452], [1156996800000, 22.027934841859], [1159588800000, 24.903300681329], [1162270800000, 29.146492833877], [1164862800000, 31.781626082589], [1167541200000, 33.358770738428], [1170219600000, 35.622684613497], [1172638800000, 33.332821711366], [1175313600000, 34.878748635832], [1177905600000, 40.582332613844], [1180584000000, 45.719535502920], [1183176000000, 43.239344722386], [1185854400000, 38.550955100342], [1188532800000, 40.585368816283], [1191124800000, 45.601374057981], [1193803200000, 48.051404337892], [1196398800000, 41.582581696032], [1199077200000, 40.650580792748], [1201755600000, 32.252222066493], [1204261200000, 28.106390258553], [1206936000000, 27.532698196687], [1209528000000, 33.986390463852], [1212206400000, 36.302660526438], [1214798400000, 25.015574480172], [1217476800000, 23.989494069029], [1220155200000, 25.934351445531], [1222747200000, 14.627592011699], [1225425600000, -5.2249403809749], [1228021200000, -12.330933408050], [1230699600000, -11.000291508188], [1233378000000, -18.563864948088], [1235797200000, -27.213097001687], [1238472000000, -20.834133840523], [1241064000000, -12.717886701719], [1243742400000, -8.1644613083526], [1246334400000, -7.9108408918201], [1249012800000, -0.77002391591209], [1251691200000, 2.8243816569672], [1254283200000, 6.8761411421070], [1256961600000, 4.5060912230294], [1259557200000, 10.487179794349], [1262235600000, 13.251375597594], [1264914000000, 9.2207594803415], [1267333200000, 12.836276936538], [1270008000000, 19.816793904978], [1272600000000, 22.156787167211], [1275278400000, 12.518039090576], [1277870400000, 6.4253587440854], [1280548800000, 13.847372028409], [1283227200000, 8.5454736090364], [1285819200000, 18.542801953304], [1288497600000, 23.037064683183], [1291093200000, 23.517422401888], [1293771600000, 31.804723416068], [1296450000000, 34.778247386072], [1298869200000, 39.584883855230], [1301544000000, 40.080647664875], [1304136000000, 44.180050667889], [1306814400000, 42.533535927221], [1309406400000, 40.105374449011], [1312084800000, 37.014659267156], [1314763200000, 29.263745084262], [1317355200000, 19.637463417584], [1320033600000, 33.157645345770], [1322629200000, 32.895053150988], [1325307600000, 34.111544824647], [1327986000000, 40.453985817473], [1330491600000, 46.435700783313], [1333166400000, 51.062385488671], [1335758400000, 50.130448220658], [1338436800000, 41.035476682018], [1341028800000, 46.591932296457], [1343707200000, 48.349391180634], [1346385600000, 51.913011286919], [1348977600000, 55.747238313752], [1351656000000, 52.991824077209], [1354251600000, 49.556311883284]] + } + ]; + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-discreteBarChart.ts b/nvd3/nvd3-test-discreteBarChart.ts new file mode 100644 index 0000000000..cb7b444c60 --- /dev/null +++ b/nvd3/nvd3-test-discreteBarChart.ts @@ -0,0 +1,60 @@ +/// +module nvd3_test_discreteBarChart { + var historicalBarChart = [ + { + key: "Cumulative Return", + values: [ + { + "label": "A", + "value": 29.765957771107 + }, + { + "label": "B", + "value": 0 + }, + { + "label": "C", + "value": 32.807804682612 + }, + { + "label": "D", + "value": 196.45946739256 + }, + { + "label": "E", + "value": 0.19434030906893 + }, + { + "label": "F", + "value": 98.079782601442 + }, + { + "label": "G", + "value": 13.925743130903 + }, + { + "label": "H", + "value": 5.1387322875705 + } + ] + } + ]; + + nv.addGraph(function () { + var chart = nv.models.discreteBarChart() + .x(function (d) { return d.label }) + .y(function (d) { return d.value }) + .staggerLabels(true) + //.staggerLabels(historicalBarChart[0].values.length > 8) + .showValues(true) + .duration(250) + ; + + d3.select('#chart1 svg') + .datum(historicalBarChart) + .call(chart); + + nv.utils.windowResize(chart.update); + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-donutChart.ts b/nvd3/nvd3-test-donutChart.ts new file mode 100644 index 0000000000..69f4d6c1f9 --- /dev/null +++ b/nvd3/nvd3-test-donutChart.ts @@ -0,0 +1,93 @@ +/// +module nvd3_test_donutChart { + var testdata = [ + { key: "One", y: 5 }, + { key: "Two", y: 2 }, + { key: "Three", y: 9 }, + { key: "Four", y: 7 }, + { key: "Five", y: 4 }, + { key: "Six", y: 3 }, + { key: "Seven", y: 0.5 } + ]; + + var height = 350; + var width = 350; + + var chart1; + nv.addGraph(function () { + var chart1 = nv.models.pieChart() + .x(function (d) { return d.key }) + .y(function (d) { return d.y }) + .donut(true) + .width(width) + .height(height) + .padAngle(.08) + .cornerRadius(5) + .id('donut1'); // allow custom CSS for this one svg + + chart1.title("100%"); + chart1.pie.donutLabelsOutside(true).donut(true); + + d3.select("#test1") + .datum(testdata) + .transition().duration(1200) + .call(chart1); + + // LISTEN TO WINDOW RESIZE + // nv.utils.windowResize(chart1.update); + + // LISTEN TO CLICK EVENTS ON SLICES OF THE PIE/DONUT + // chart.pie.dispatch.on('elementClick', function() { + // code... + // }); + + // chart.pie.dispatch.on('chartClick', function() { + // code... + // }); + + // LISTEN TO DOUBLECLICK EVENTS ON SLICES OF THE PIE/DONUT + // chart.pie.dispatch.on('elementDblClick', function() { + // code... + // }); + + // LISTEN TO THE renderEnd EVENT OF THE PIE/DONUT + // chart.pie.dispatch.on('renderEnd', function() { + // code... + // }); + + // OTHER EVENTS DISPATCHED BY THE PIE INCLUDE: elementMouseover, elementMouseout, elementMousemove + // @see nv.models.pie + + return chart1; + + }); + + var chart2; + nv.addGraph(function () { + var chart2 = nv.models.pieChart() + .x(function (d) { return d.key }) + .y(function (d) { return d.y }) + //.labelThreshold(.08) + //.showLabels(false) + .color(d3.scale.category20().range().slice(10)) + .width(width) + .height(height) + .donut(true) + .id('donut2') + .titleOffset(-30) + .title("woot"); + + // MAKES IT HALF CIRCLE + chart2.pie + .startAngle(function (d) { return d.startAngle / 2 - Math.PI / 2 }) + .endAngle(function (d) { return d.endAngle / 2 - Math.PI / 2 }); + + d3.select("#test2") + //.datum(historicalBarChart) + .datum(testdata) + .transition().duration(1200) + .call(chart2); + + return chart2; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-furiousLegend.ts b/nvd3/nvd3-test-furiousLegend.ts new file mode 100644 index 0000000000..3477d064b7 --- /dev/null +++ b/nvd3/nvd3-test-furiousLegend.ts @@ -0,0 +1,72 @@ +/// +module nvd3_test_furiousLegend { + var width = 500, + height = 40; + + var legend = nv.models.legend().vers('furious'); + + d3.select('#test1') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()); + + var legend2 = nv.models.legend().vers('furious') + .align(false); + + d3.select('#test2') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()).call(legend2); + + var legend3 = nv.models.legend().vers('furious') + .width(900) + .padding(70); + + d3.select('#test3') + .attr('width', 900) + .attr('height', 200) + .datum(sinAndCos()).call(legend3); + + var update = function (i, l) { + d3.select('#test' + i).call(l); + } + + update(1, legend); + legend.dispatch.on('stateChange', function (d) { + console.log(d); + update(1, legend); + }); + + legend2.dispatch.on('stateChange', function (d) { + console.log(d); + update(2, legend2); + }); + + legend3.dispatch.on('stateChange', function (d) { + console.log(d); + update(3, legend3); + }); + + d3.select('#changeData').on('click', function () { + var exp = legend.expanded(); + + legend.expanded(!exp); + + d3.select('#test1') + .call(legend); + }); + + function sinAndCos() { + return [ + { key: "Sine Wave" }, + { key: "averylongserieslabelthatcontainsmorethantwentycharacters" }, + { key: "A Very Long Series Label" }, + { key: "A Very Long Series Label" }, + { key: "Cosine Wave" }, + { key: "Another test label" }, + { key: "Bonds", disengaged: true }, + { key: "Stocks", disengaged: true }, + { key: "Apple", disengaged: true } + ]; + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-legend.ts b/nvd3/nvd3-test-legend.ts index 81f39d2dad..99f4de2b79 100644 --- a/nvd3/nvd3-test-legend.ts +++ b/nvd3/nvd3-test-legend.ts @@ -1,67 +1,69 @@ /// /// -var width = 500, - height = 20; +module nvd3_test_legend { + var width = 500, + height = 20; - var legend = nv.models.legend(); + var legend = nv.models.legend(); - d3.select('#test1') - .attr('width', width) - .attr('height', height) - .datum(sinAndCos()); + d3.select('#test1') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()); - var legend2 = nv.models.legend() - .align(false); + var legend2 = nv.models.legend() + .align(false); - d3.select('#test2') - .attr('width', width) - .attr('height', height) - .datum(sinAndCos()).call(legend2); + d3.select('#test2') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()).call(legend2); - var legend3 = nv.models.legend() - .width(900) - .padding(70); + var legend3 = nv.models.legend() + .width(900) + .padding(70); - d3.select('#test3') - .attr('width', 900) - .attr('height', 200) - .datum(sinAndCos()).call(legend3); + d3.select('#test3') + .attr('width', 900) + .attr('height', 200) + .datum(sinAndCos()).call(legend3); - var update = function() { - d3.select('#test1').call(legend); - } + var update = function () { + d3.select('#test1').call(legend); + } - update(); - legend.dispatch.on('stateChange', function(d) { - console.log(d); - update(); - }); + update(); + legend.dispatch.on('stateChange', function (d) { + console.log(d); + update(); + }); - d3.select('#changeData').on('click', function() { - d3.select('#test1') - .datum(differentData()) - .call(legend); - }); + d3.select('#changeData').on('click', function () { + d3.select('#test1') + .datum(differentData()) + .call(legend); + }); - function sinAndCos() { - return [ - {key: "Sine Wave"}, - {key: "A Very Long Label With Over Twenty Characters"}, - {key: "A Very Long Series Label With Over Twenty Characters"}, - {key: "A Very Long Series Label With Over Twenty Characters"}, - {key: "Cosine Wave"}, - {key: "Another test label"} - ]; - } + function sinAndCos() { + return [ + { key: "Sine Wave" }, + { key: "A Very Long Label With Over Twenty Characters" }, + { key: "A Very Long Series Label With Over Twenty Characters" }, + { key: "A Very Long Series Label With Over Twenty Characters" }, + { key: "Cosine Wave" }, + { key: "Another test label" } + ]; + } - function differentData() { - return [ - {key: "Fixed Income"}, - {key: "Derivatives"}, - {key: "Credit Default Swaps"}, - {key: "Equities"}, - {key: "Bonds"}, - {key: "Stocks"}, - {key: "Apple"} - ]; - } + function differentData() { + return [ + { key: "Fixed Income" }, + { key: "Derivatives" }, + { key: "Credit Default Swaps" }, + { key: "Equities" }, + { key: "Bonds" }, + { key: "Stocks" }, + { key: "Apple" } + ]; + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-line.ts b/nvd3/nvd3-test-line.ts new file mode 100644 index 0000000000..b96bbfcb93 --- /dev/null +++ b/nvd3/nvd3-test-line.ts @@ -0,0 +1,71 @@ +/// +module nvd3_test_line { + nv.addGraph({ + generate: function () { + var width = nv.utils.windowSize().width - 40, + height = nv.utils.windowSize().height - 40; + + var chart = nv.models.line() + .width(width) + .height(height) + .margin({ top: 20, right: 20, bottom: 20, left: 20 }); + + chart.dispatch.on('renderEnd', function () { + console.log('render complete'); + }); + + d3.select('#test1') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()) + .call(chart); + + return chart; + }, + callback: function (graph) { + window.onresize = function () { + var width = nv.utils.windowSize().width - 40, + height = nv.utils.windowSize().height - 40, + margin = graph.margin(); + + if (width < margin.left + margin.right + 20) + width = margin.left + margin.right + 20; + + if (height < margin.top + margin.bottom + 20) + height = margin.top + margin.bottom + 20; + + graph.width(width).height(height); + + d3.select('#test1') + .attr('width', width) + .attr('height', height) + .call(graph); + }; + } + }); + + function sinAndCos() { + var sin = [], + cos = []; + + for (var i = 0; i < 100; i++) { + sin.push({ x: i, y: Math.sin(i / 10) }); + cos.push({ x: i, y: .5 * Math.cos(i / 10) }); + } + + return [ + { + values: sin, + key: "Sine Wave", + color: "#ff7f0e" + }, + { + values: cos, + key: "Cosine Wave", + color: "#2ca02c", + strokeWidth: 3 + } + ]; + } + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-lineChart.ts b/nvd3/nvd3-test-lineChart.ts new file mode 100644 index 0000000000..6591899ee7 --- /dev/null +++ b/nvd3/nvd3-test-lineChart.ts @@ -0,0 +1,103 @@ +/// +module nvd3_test_lineChart { + // Wrapping in nv.addGraph allows for '0 timeout render', stores rendered charts in nv.graphs, and may do more in the future... it's NOT required + var chart; + var data; + + var randomizeFillOpacity = function () { + var rand = Math.random(); + for (var i = 0; i < 100; i++) { // modify sine amplitude + data[4].values[i].y = Math.sin(i / (5 + rand)) * .4 * rand - .25; + } + data[4].fillOpacity = rand; + chart.update(); + }; + + nv.addGraph(function () { + chart = nv.models.lineChart() + .options({ + transitionDuration: 300, + useInteractiveGuideline: true + }) + ; + + // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately + chart.xAxis + .axisLabel("Time (s)") + .tickFormat(d3.format(',.1f')) + .staggerLabels(true) + ; + + chart.yAxis + .axisLabel('Voltage (v)') + .tickFormat(function (d) { + if (d == null) { + return 'N/A'; + } + return d3.format(',.2f')(d); + }) + ; + + data = sinAndCos(); + + d3.select('#chart1').append('svg') + .datum(data) + .call(chart); + + nv.utils.windowResize(chart.update); + + return chart; + }); + + function sinAndCos() { + var sin = [], + sin2 = [], + cos = [], + rand = [], + rand2 = [] + ; + + for (var i = 0; i < 100; i++) { + sin.push({ x: i, y: i % 10 == 5 ? null : Math.sin(i / 10) }); //the nulls are to show how defined works + sin2.push({ x: i, y: Math.sin(i / 5) * 0.4 - 0.25 }); + cos.push({ x: i, y: .5 * Math.cos(i / 10) }); + rand.push({ x: i, y: Math.random() / 10 }); + rand2.push({ x: i, y: Math.cos(i / 10) + Math.random() / 10 }) + } + + return [ + { + area: true, + values: sin, + key: "Sine Wave", + color: "#ff7f0e", + strokeWidth: 4, + classed: 'dashed' + }, + { + values: cos, + key: "Cosine Wave", + color: "#2ca02c" + }, + { + values: rand, + key: "Random Points", + color: "#2222ff" + }, + { + values: rand2, + key: "Random Cosine", + color: "#667711", + strokeWidth: 3.5 + }, + { + area: true, + values: sin2, + key: "Fill opacity", + color: "#EF9CFB", + fillOpacity: .1 + } + ]; + } + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-lineChartLogScale.ts b/nvd3/nvd3-test-lineChartLogScale.ts new file mode 100644 index 0000000000..bea43a5dc2 --- /dev/null +++ b/nvd3/nvd3-test-lineChartLogScale.ts @@ -0,0 +1,67 @@ +/// +module nvd3_test_lineChartLogScale { +var chart; + var data; + + + nv.addGraph(function () { + chart = nv.models.lineChart() + .x(function (d) { return d.x; }) + .options({ + showLegend: true, + showYAxis: true, + showXAxis: true, + useInteractiveGuideline: true + }); + + data = GenerateData(); + + chart.xAxis + .axisLabel("x axis") + .tickFormat(d3.format('0.2f')); + + chart.yScale(d3.scale.log()); + chart.yAxis + .axisLabel("Log axis") + .tickFormat(d3.format('.4e')); + + d3.select('#chart1').append('svg') + .datum(data) + .call(chart); + + nv.utils.windowResize(chart.update); + + return chart; + + }); + + function GenerateData() { + var sin = [], + sin2 = []; + + for (var i = 0; i < 100; i++) { + sin.push({ x: i, y: Math.abs(i % 10 == 5 ? null : Math.sin(i / 10)) }); //the nulls are to show how defined works + sin2.push({ x: i, y: Math.abs(Math.sin(i / 5) * 0.4 - 0.25) }); + + } + + return [ + { + area: true, + values: sin, + key: "l1", + color: "#ff7f0e", + strokeWidth: 4, + classed: 'dashed' + }, + { + values: sin2, + key: "l2", + color: "#2ca02c" + } + ]; + + } + + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-lineChartSVGResize.ts b/nvd3/nvd3-test-lineChartSVGResize.ts new file mode 100644 index 0000000000..3c6f7cd8de --- /dev/null +++ b/nvd3/nvd3-test-lineChartSVGResize.ts @@ -0,0 +1,108 @@ +/// +module nvd3_test_lineChartSVGResize { + nv.addGraph(function () { + var chart = nv.models.lineChart(); + var fitScreen = false; + var width = 600; + var height = 300; + var zoom = 1; + + chart.useInteractiveGuideline(true); + chart.xAxis + .tickFormat(d3.format(',r')); + + chart.lines.dispatch.on("elementClick", function (evt) { + console.log(evt); + }); + + chart.yAxis + .axisLabel('Voltage (v)') + .tickFormat(d3.format(',.2f')); + + d3.select('#chart1 svg') + .attr('perserveAspectRatio', 'xMinYMid') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()); + + setChartViewBox(); + resizeChart(); + + nv.utils.windowResize(resizeChart); + + d3.select('#zoomIn').on('click', zoomIn); + d3.select('#zoomOut').on('click', zoomOut); + + + function setChartViewBox() { + var w = width * zoom, + h = height * zoom; + + chart + .width(w) + .height(h); + + d3.select('#chart1 svg') + .attr('viewBox', '0 0 ' + w + ' ' + h) + .transition().duration(500) + .call(chart); + } + + function zoomOut() { + zoom += .25; + setChartViewBox(); + } + + function zoomIn() { + if (zoom <= .5) return; + zoom -= .25; + setChartViewBox(); + } + + // This resize simply sets the SVG's dimensions, without a need to recall the chart code + // Resizing because of the viewbox and perserveAspectRatio settings + // This scales the interior of the chart unlike the above + function resizeChart() { + var container = d3.select('#chart1'); + var svg = container.select('svg'); + + if (fitScreen) { + // resize based on container's width AND HEIGHT + var windowSize = nv.utils.windowSize(); + svg.attr("width", windowSize.width); + svg.attr("height", windowSize.height); + } else { + // resize based on container's width + var aspect = chart.width() / chart.height(); + var targetWidth = parseInt(container.style('width')); + svg.attr("width", targetWidth); + svg.attr("height", Math.round(targetWidth / aspect)); + } + } + return chart; + }); + + function sinAndCos() { + var sin = [], + cos = []; + + for (var i = 0; i < 100; i++) { + sin.push({ x: i, y: Math.sin(i / 10) }); + cos.push({ x: i, y: .5 * Math.cos(i / 10) }); + } + return [ + { + values: sin, + key: "Sine Wave", + color: "#ff7f0e" + }, + { + values: cos, + key: "Cosine Wave", + color: "#2ca02c" + } + ]; + } + + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-linePlusBarChart.ts b/nvd3/nvd3-test-linePlusBarChart.ts new file mode 100644 index 0000000000..1d7e71915a --- /dev/null +++ b/nvd3/nvd3-test-linePlusBarChart.ts @@ -0,0 +1,47 @@ +/// +module nvd3_test_linePlusBarChart { + var testdata = [ + { + "key": "Quantity", + "bar": true, + "values": [[1136005200000, 1271000.0], [1138683600000, 1271000.0], [1141102800000, 1271000.0], [1143781200000, 0], [1146369600000, 0], [1149048000000, 0], [1151640000000, 0], [1154318400000, 0], [1156996800000, 0], [1159588800000, 3899486.0], [1162270800000, 3899486.0], [1164862800000, 3899486.0], [1167541200000, 3564700.0], [1170219600000, 3564700.0], [1172638800000, 3564700.0], [1175313600000, 2648493.0], [1177905600000, 2648493.0], [1180584000000, 2648493.0], [1183176000000, 2522993.0], [1185854400000, 2522993.0], [1188532800000, 2522993.0], [1191124800000, 2906501.0], [1193803200000, 2906501.0], [1196398800000, 2906501.0], [1199077200000, 2206761.0], [1201755600000, 2206761.0], [1204261200000, 2206761.0], [1206936000000, 2287726.0], [1209528000000, 2287726.0], [1212206400000, 2287726.0], [1214798400000, 2732646.0], [1217476800000, 2732646.0], [1220155200000, 2732646.0], [1222747200000, 2599196.0], [1225425600000, 2599196.0], [1228021200000, 2599196.0], [1230699600000, 1924387.0], [1233378000000, 1924387.0], [1235797200000, 1924387.0], [1238472000000, 1756311.0], [1241064000000, 1756311.0], [1243742400000, 1756311.0], [1246334400000, 1743470.0], [1249012800000, 1743470.0], [1251691200000, 1743470.0], [1254283200000, 1519010.0], [1256961600000, 1519010.0], [1259557200000, 1519010.0], [1262235600000, 1591444.0], [1264914000000, 1591444.0], [1267333200000, 1591444.0], [1270008000000, 1543784.0], [1272600000000, 1543784.0], [1275278400000, 1543784.0], [1277870400000, 1309915.0], [1280548800000, 1309915.0], [1283227200000, 1309915.0], [1285819200000, 1331875.0], [1288497600000, 1331875.0], [1291093200000, 1331875.0], [1293771600000, 1331875.0], [1296450000000, 1154695.0], [1298869200000, 1154695.0], [1301544000000, 1194025.0], [1304136000000, 1194025.0], [1306814400000, 1194025.0], [1309406400000, 1194025.0], [1312084800000, 1194025.0], [1314763200000, 1244525.0], [1317355200000, 475000.0], [1320033600000, 475000.0], [1322629200000, 475000.0], [1325307600000, 690033.0], [1327986000000, 690033.0], [1330491600000, 690033.0], [1333166400000, 514733.0], [1335758400000, 514733.0]] + }, + { + "key": "Price", + "values": [[1136005200000, 71.89], [1138683600000, 75.51], [1141102800000, 68.49], [1143781200000, 62.72], [1146369600000, 70.39], [1149048000000, 59.77], [1151640000000, 57.27], [1154318400000, 67.96], [1156996800000, 67.85], [1159588800000, 76.98], [1162270800000, 81.08], [1164862800000, 91.66], [1167541200000, 84.84], [1170219600000, 85.73], [1172638800000, 84.61], [1175313600000, 92.91], [1177905600000, 99.8], [1180584000000, 121.191], [1183176000000, 122.04], [1185854400000, 131.76], [1188532800000, 138.48], [1191124800000, 153.47], [1193803200000, 189.95], [1196398800000, 182.22], [1199077200000, 198.08], [1201755600000, 135.36], [1204261200000, 125.02], [1206936000000, 143.5], [1209528000000, 173.95], [1212206400000, 188.75], [1214798400000, 167.44], [1217476800000, 158.95], [1220155200000, 169.53], [1222747200000, 113.66], [1225425600000, 107.59], [1228021200000, 92.67], [1230699600000, 85.35], [1233378000000, 90.13], [1235797200000, 89.31], [1238472000000, 105.12], [1241064000000, 125.83], [1243742400000, 135.81], [1246334400000, 142.43], [1249012800000, 163.39], [1251691200000, 168.21], [1254283200000, 185.35], [1256961600000, 188.5], [1259557200000, 199.91], [1262235600000, 210.732], [1264914000000, 192.063], [1267333200000, 204.62], [1270008000000, 235.0], [1272600000000, 261.09], [1275278400000, 256.88], [1277870400000, 251.53], [1280548800000, 257.25], [1283227200000, 243.1], [1285819200000, 283.75], [1288497600000, 300.98], [1291093200000, 311.15], [1293771600000, 322.56], [1296450000000, 339.32], [1298869200000, 353.21], [1301544000000, 348.5075], [1304136000000, 350.13], [1306814400000, 347.83], [1309406400000, 335.67], [1312084800000, 390.48], [1314763200000, 384.83], [1317355200000, 381.32], [1320033600000, 404.78], [1322629200000, 382.2], [1325307600000, 405.0], [1327986000000, 456.48], [1330491600000, 542.44], [1333166400000, 599.55], [1335758400000, 583.98]] + } + ].map(function (series) { + series.values = series.values.map(function (d) { return { x: d[0], y: d[1] } }); + return series; + }); + + var chart; + nv.addGraph(function () { + chart = nv.models.linePlusBarChart() + .margin({ top: 50, right: 80, bottom: 30, left: 80 }) + .legendRightAxisHint(' [Using Right Axis]') + .color(d3.scale.category10().range()); + + chart.xAxis.tickFormat(function (d) { + return d3.time.format('%x')(new Date(d)) + }) + .showMaxMin(false); + + chart.y1Axis.tickFormat(function (d) { return '$' + d3.format(',f')(d) }); + chart.bars.forceY([0]).padData(false); + + chart.x2Axis.tickFormat(function (d) { + return d3.time.format('%x')(new Date(d)) + }).showMaxMin(false); + + d3.select('#chart1 svg') + .datum(testdata) + .transition().duration(500).call(chart); + + nv.utils.windowResize(chart.update); + + chart.dispatch.on('stateChange', function (e) { nv.log('New State:', JSON.stringify(e)); }); + + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-lineWithFocusChart.ts b/nvd3/nvd3-test-lineWithFocusChart.ts new file mode 100644 index 0000000000..5a0347647b --- /dev/null +++ b/nvd3/nvd3-test-lineWithFocusChart.ts @@ -0,0 +1,33 @@ +/// +module nvd3_test_lineWithFocusChart { + nv.addGraph(function () { + var chart = nv.models.lineWithFocusChart(); + + chart.brushExtent([50, 70]); + + chart.xAxis.tickFormat(d3.format(',f')).axisLabel("Stream - 3,128,.1"); + chart.x2Axis.tickFormat(d3.format(',f')); + chart.yAxis.tickFormat(d3.format(',.2f')); + chart.y2Axis.tickFormat(d3.format(',.2f')); + chart.useInteractiveGuideline(true); + + d3.select('#chart svg') + .datum(testData()) + .call(chart); + + nv.utils.windowResize(chart.update); + + return chart; + }); + + function testData() { + return [3, 128, .1].map(function (data, i) { + //todo resolve this return stream_layers(3, 128, .1).map(function (data, i) { + return { + key: 'Stream' + i, + area: i === 1, + values: data + }; + }); + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-lineWithFocusChartx2AxisLabel.ts b/nvd3/nvd3-test-lineWithFocusChartx2AxisLabel.ts new file mode 100644 index 0000000000..16d79414c9 --- /dev/null +++ b/nvd3/nvd3-test-lineWithFocusChartx2AxisLabel.ts @@ -0,0 +1,36 @@ +/// +module nvd3_test_lineWithFocusChartx2AxisLabel { + + nv.addGraph(function () { + var chart = nv.models.lineWithFocusChart(); + + chart.brushExtent([50, 70]); + + chart.xAxis.tickFormat(d3.format(',f')); + chart.focusHeight(50 + 20); + chart.focusMargin({ "bottom": 20 + 20 }); + chart.x2Axis.tickFormat(d3.format(',f')).axisLabel("Stream - 3,128,.1"); + chart.yAxis.tickFormat(d3.format(',.2f')); + chart.y2Axis.tickFormat(d3.format(',.2f')); + chart.useInteractiveGuideline(true); + + d3.select('#chart svg') + .datum(testData()) + .call(chart); + + nv.utils.windowResize(chart.update); + + return chart; + }); + + function testData() { + return [3, 128, .1].map(function (data, i) { + // todo reolve stream_layers return stream_layers(3, 128, .1).map(function (data, i) { + return { + key: 'Stream' + i, + area: i === 1, + values: data + }; + }); + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-monitoringChart.ts b/nvd3/nvd3-test-monitoringChart.ts new file mode 100644 index 0000000000..20e28da4f6 --- /dev/null +++ b/nvd3/nvd3-test-monitoringChart.ts @@ -0,0 +1,135 @@ +/// +module nvd3_test_monitoringChart { + + var testdata1 = [ + { key: "Updated", y: 0 }, + { key: "Pending", y: 100 } + ]; + + var arcRadius1 = [ + { inner: 0.6, outer: 1 }, + { inner: 0.65, outer: 0.95 } + ]; + + var colors = ["green", "gray"]; + + var testdata2 = [ + { key: "One", y: 1 }, + { key: "Two", y: 1 }, + { key: "Three", y: 1 }, + { key: "Four", y: 1 }, + { key: "Five", y: 1 }, + { key: "Six", y: 1 }, + { key: "Seven", y: 1 } + ]; + + var arcRadius2 = [ + { inner: 0.9, outer: 1 }, + { inner: 0.8, outer: 1 }, + { inner: 0.7, outer: 1 }, + { inner: 0.6, outer: 1 }, + { inner: 0.5, outer: 1 }, + { inner: 0.4, outer: 1 }, + { inner: 0.3, outer: 1 } + ]; + + var testdata3 = [ + { key: "Updated", y: 80 }, + { key: "Pending", y: 20 } + ]; + + var arcRadius3 = [ + { inner: 0, outer: 1 }, + { inner: 0, outer: 0.8 } + ]; + + var height = 350; + var width = 350; + + nv.addGraph(function () { + var chart = nv.models.pieChart() + .x(function (d) { return d.key }) + .y(function (d) { return d.y }) + .donut(true) + .showLabels(false) + .color(colors) + .width(width) + .height(height) + .growOnHover(false) + .arcsRadius(arcRadius1) + .id('donut1'); // allow custom CSS for this one svg + + chart.title("0%"); + + d3.select("#test1") + .datum(testdata1) + .transition().duration(1200) + .attr('width', width) + .attr('height', height) + .call(chart); + + // update chart data values randomly + setInterval(function () { + if (testdata1[0].y < 100) { + testdata1[0].y = testdata1[0].y + 1; + testdata1[1].y = testdata1[1].y - 1; + } + else { + testdata1[0].y = 0; + testdata1[1].y = 100; + } + chart.title(testdata1[0].y + "%"); + chart.update(); + }, 4000); + + return chart; + + }); + + nv.addGraph(function () { + var chart = nv.models.pieChart() + .x(function (d) { return d.key }) + .y(function (d) { return d.y }) + .donut(true) + .width(width) + .height(height) + .arcsRadius(arcRadius2) + .donutLabelsOutside(true) + .labelSunbeamLayout(true) + .id('donut2'); // allow custom CSS for this one svg + + d3.select("#test2") + .datum(testdata2) + .transition().duration(1200) + .attr('width', width) + .attr('height', height) + .call(chart); + + return chart; + + }); + + nv.addGraph(function () { + var chart = nv.models.pieChart() + .x(function (d) { return d.key }) + .y(function (d) { return d.y }) + .donut(true) + .showLabels(true) + .width(width) + .height(height) + .arcsRadius(arcRadius3) + .donutLabelsOutside(true) + .id('donut3'); // allow custom CSS for this one svg + + d3.select("#test3") + .datum(testdata3) + .transition().duration(1200) + .attr('width', width) + .attr('height', height) + .call(chart); + + return chart; + + }); + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-multiChart.ts b/nvd3/nvd3-test-multiChart.ts new file mode 100644 index 0000000000..7e30ff4cea --- /dev/null +++ b/nvd3/nvd3-test-multiChart.ts @@ -0,0 +1,53 @@ +/// +module nvd3_test_multiChart { + //todo resolve stream_layersIssue var testdata = stream_layers(9, 10 + Math.random() * 100, .1).map(function (data, i) { + // return { + // key: 'Stream' + i, + // values: data.map(function (a) { a.y = a.y * (i <= 1 ? -1 : 1); return a }) + // }; + //}); + + var testdata = [1, 2, 3, 4, 5, 6, 7, 8, 9].map(function (data, i) { + return { + key: 'Stream' + i, + values: [1, 2], + type: '', + yAxis: 1 + }; + }); + + testdata[0].type = "area"; + testdata[0].yAxis = 1; + testdata[1].type = "area"; + testdata[1].yAxis = 1; + testdata[2].type = "line"; + testdata[2].yAxis = 1; + testdata[3].type = "line"; + testdata[3].yAxis = 2; + testdata[4].type = "scatter"; + testdata[4].yAxis = 1; + testdata[5].type = "scatter"; + testdata[5].yAxis = 2; + testdata[6].type = "bar"; + testdata[6].yAxis = 2; + testdata[7].type = "bar"; + testdata[7].yAxis = 2; + testdata[8].type = "bar"; + testdata[8].yAxis = 2; + + nv.addGraph(function () { + var chart = nv.models.multiChart() + .margin({ top: 30, right: 60, bottom: 50, left: 70 }) + .color(d3.scale.category10().range()); + + chart.xAxis.tickFormat(d3.format(',f')); + chart.yAxis1.tickFormat(d3.format(',.1f')); + chart.yAxis2.tickFormat(d3.format(',.1f')); + + d3.select('#chart1 svg') + .datum(testdata) + .transition().duration(500).call(chart); + + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-multibarChart.ts b/nvd3/nvd3-test-multibarChart.ts new file mode 100644 index 0000000000..c478d7e167 --- /dev/null +++ b/nvd3/nvd3-test-multibarChart.ts @@ -0,0 +1,69 @@ +/// +module nvd3_test_multibarChart { + //todo resolve stream_layers var test_data = stream_layers(3, 10 + Math.random() * 100, .1).map(function (data, i) { + var test_data = [3, 10 + Math.random() * 100, .1].map(function (data, i) { + return { + key: 'Stream' + i, + values: data + }; + }); + + console.log('td', test_data); + + var negative_test_data = d3.range(0, 3).map(function (d, i) { + return { + key: 'Stream' + i, + values: d3.range(0, 11).map(function (f, j) { + return { + y: 10 + Math.random() * 100 * (Math.floor(Math.random() * 100) % 2 ? 1 : -1), + x: j + } + }) + }; + }); + + var chart; + nv.addGraph(function () { + chart = nv.models.multiBarChart() + .barColor(d3.scale.category20().range()) + .duration(300) + .margin({ bottom: 100, left: 70 }) + .rotateLabels(45) + .groupSpacing(0.1) + ; + + chart.reduceXTicks(false).staggerLabels(true); + + chart.xAxis + .axisLabel("ID of Furry Cat Households") + .axisLabelDistance(35) + .showMaxMin(false) + .tickFormat(d3.format(',.6f')) + ; + + chart.yAxis + .axisLabel("Change in Furry Cat Population") + .axisLabelDistance(-5) + .tickFormat(d3.format(',.01f')) + ; + + chart.dispatch.on('renderEnd', function () { + nv.log('Render Complete'); + }); + + d3.select('#chart1 svg') + .datum(negative_test_data) + .call(chart); + + nv.utils.windowResize(chart.update); + + chart.dispatch.on('stateChange', function (e) { + nv.log('New State:', JSON.stringify(e)); + }); + chart.state.dispatch.on('change', function (state) { + nv.log('state', JSON.stringify(state)); + }); + + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-multibarChart2.ts b/nvd3/nvd3-test-multibarChart2.ts new file mode 100644 index 0000000000..4623514e97 --- /dev/null +++ b/nvd3/nvd3-test-multibarChart2.ts @@ -0,0 +1,47 @@ +/// +module nvd3_test_multibarChart2 { + //todo resolve stream_layers var test_data = stream_layers(3, 128, .1).map(function (data, i) { + var test_data = [3, 128, .1].map(function (data, i) { + return { + key: (i == 1) ? 'Non-stackable Stream' + i : 'Stream' + i, + nonStackable: (i == 1), + values: data + }; + }); + nv.addGraph({ + generate: function () { + var width = nv.utils.windowSize().width, + height = nv.utils.windowSize().height; + + var chart = nv.models.multiBarChart() + .width(width) + .height(height) + .stacked(true) + ; + + chart.dispatch.on('renderEnd', function () { + console.log('Render Complete'); + }); + + var svg = d3.select('#test1 svg').datum(test_data); + console.log('calling chart'); + svg.transition().duration(0).call(chart); + + return chart; + }, + callback: function (graph) { + nv.utils.windowResize(function () { + var width = nv.utils.windowSize().width; + var height = nv.utils.windowSize().height; + graph.width(width).height(height); + + d3.select('#test1 svg') + .attr('width', width) + .attr('height', height) + .transition().duration(0) + .call(graph); + + }); + } + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-multibarHorizontalChart.ts b/nvd3/nvd3-test-multibarHorizontalChart.ts new file mode 100644 index 0000000000..61e6ee86d4 --- /dev/null +++ b/nvd3/nvd3-test-multibarHorizontalChart.ts @@ -0,0 +1,159 @@ +/// +module nvd3_test_multibarHorizontalChart { + var long_short_data = [ + { + key: 'Series1', + values: [ + { + "label": "Group A", + "value": -1.8746444827653 + }, + { + "label": "Group B", + "value": -8.0961543492239 + }, + { + "label": "Group C", + "value": -0.57072943117674 + }, + { + "label": "Group D", + "value": -2.4174010336624 + }, + { + "label": "Group E", + "value": -0.72009071426284 + }, + { + "label": "Group F", + "value": -2.77154485523777 + }, + { + "label": "Group G", + "value": -9.90152097798131 + }, + { + "label": "Group H", + "value": 14.91445417330854 + }, + { + "label": "Group I", + "value": -3.055746319141851 + } + ] + }, + { + key: 'Series2', + values: [ + { + "label": "Group A", + "value": 25.307646510375 + }, + { + "label": "Group B", + "value": 16.756779544553 + }, + { + "label": "Group C", + "value": 18.451534877007 + }, + { + "label": "Group D", + "value": 8.6142352811805 + }, + { + "label": "Group E", + "value": 7.8082472075876 + }, + { + "label": "Group F", + "value": 5.259101026956 + }, + { + "label": "Group G", + "value": 7.0947953487127 + }, + { + "label": "Group H", + "value": 8 + }, + { + "label": "Group I", + "value": 21 + } + ] + }, + { + key: 'Series3', + values: [ + { + "label": "Group A", + "value": -14.307646510375 + }, + { + "label": "Group B", + "value": 16.756779544553 + }, + { + "label": "Group C", + "value": -18.451534877007 + }, + { + "label": "Group D", + "value": 8.6142352811805 + }, + { + "label": "Group E", + "value": -7.8082472075876 + }, + { + "label": "Group F", + "value": 15.259101026956 + }, + { + "label": "Group G", + "value": -0.30947953487127 + }, + { + "label": "Group H", + "value": 0 + }, + { + "label": "Group I", + "value": 0 + } + ] + } + ]; + + + var chart; + nv.addGraph(function () { + chart = nv.models.multiBarHorizontalChart() + .x(function (d) { return d.label }) + .y(function (d) { return d.value }) + .yErr(function (d) { return [-Math.abs(d.value * Math.random() * 0.3), Math.abs(d.value * Math.random() * 0.3)] }) + .barColor(d3.scale.category20().range()) + .duration(250) + .margin({ left: 100 }) + .stacked(true); + + chart.yAxis.tickFormat(d3.format(',.2f')); + + chart.yAxis.axisLabel('Y Axis'); + chart.xAxis.axisLabel('X Axis').axisLabelDistance(20); + + d3.select('#chart1 svg') + .datum(long_short_data) + .call(chart); + + nv.utils.windowResize(chart.update); + + chart.dispatch.on('stateChange', function (e) { nv.log('New State:', JSON.stringify(e)); }); + chart.state.dispatch.on('change', function (state) { + nv.log('state', JSON.stringify(state)); + }); + return chart; + }); + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-ohlc.ts b/nvd3/nvd3-test-ohlc.ts new file mode 100644 index 0000000000..efd0693016 --- /dev/null +++ b/nvd3/nvd3-test-ohlc.ts @@ -0,0 +1,192 @@ +/// +/// +module nvd3_test_ohlc { + var data = [{ + values: [ + { "date": 15707, "open": 145.11, "high": 146.15, "low": 144.73, "close": 146.06, "volume": 192059000, "adjusted": 144.65 }, + { "date": 15708, "open": 145.99, "high": 146.37, "low": 145.34, "close": 145.73, "volume": 144761800, "adjusted": 144.32 }, + { "date": 15709, "open": 145.97, "high": 146.61, "low": 145.67, "close": 146.37, "volume": 116817700, "adjusted": 144.95 }, + { "date": 15712, "open": 145.85, "high": 146.11, "low": 145.43, "close": 145.97, "volume": 110002500, "adjusted": 144.56 }, + { "date": 15713, "open": 145.71, "high": 145.91, "low": 144.98, "close": 145.55, "volume": 121265100, "adjusted": 144.14 }, + { "date": 15714, "open": 145.87, "high": 146.32, "low": 145.64, "close": 145.92, "volume": 90745600, "adjusted": 144.51 }, + { "date": 15715, "open": 146.73, "high": 147.09, "low": 145.97, "close": 147.08, "volume": 130735400, "adjusted": 145.66 }, + { "date": 15716, "open": 147.04, "high": 147.15, "low": 146.61, "close": 147.07, "volume": 113917300, "adjusted": 145.65 }, + { "date": 15719, "open": 146.89, "high": 147.07, "low": 146.43, "close": 146.97, "volume": 89567200, "adjusted": 145.55 }, + { "date": 15720, "open": 146.29, "high": 147.21, "low": 146.2, "close": 147.07, "volume": 93172600, "adjusted": 145.65 }, + { "date": 15721, "open": 146.77, "high": 147.28, "low": 146.61, "close": 147.05, "volume": 104849500, "adjusted": 145.63 }, + { "date": 15722, "open": 147.7, "high": 148.42, "low": 147.15, "close": 148, "volume": 133833500, "adjusted": 146.57 }, + { "date": 15723, "open": 147.97, "high": 148.49, "low": 147.43, "close": 148.33, "volume": 169906000, "adjusted": 146.9 }, + { "date": 15727, "open": 148.33, "high": 149.13, "low": 147.98, "close": 149.13, "volume": 111797300, "adjusted": 147.69 }, + { "date": 15728, "open": 149.13, "high": 149.5, "low": 148.86, "close": 149.37, "volume": 104596100, "adjusted": 147.93 }, + { "date": 15729, "open": 149.15, "high": 150.14, "low": 149.01, "close": 149.41, "volume": 146426400, "adjusted": 147.97 }, + { "date": 15730, "open": 149.88, "high": 150.25, "low": 149.37, "close": 150.25, "volume": 147211600, "adjusted": 148.8 }, + { "date": 15733, "open": 150.29, "high": 150.33, "low": 149.51, "close": 150.07, "volume": 113357700, "adjusted": 148.62 }, + { "date": 15734, "open": 149.77, "high": 150.85, "low": 149.67, "close": 150.66, "volume": 105694400, "adjusted": 149.2 }, + { "date": 15735, "open": 150.64, "high": 150.94, "low": 149.93, "close": 150.07, "volume": 137447700, "adjusted": 148.62 }, + { "date": 15736, "open": 149.89, "high": 150.38, "low": 149.6, "close": 149.7, "volume": 108975800, "adjusted": 148.25 }, + { "date": 15737, "open": 150.65, "high": 151.42, "low": 150.39, "close": 151.24, "volume": 131173000, "adjusted": 149.78 }, + { "date": 15740, "open": 150.32, "high": 151.27, "low": 149.43, "close": 149.54, "volume": 159073600, "adjusted": 148.09 }, + { "date": 15741, "open": 150.35, "high": 151.48, "low": 150.29, "close": 151.05, "volume": 113912400, "adjusted": 149.59 }, + { "date": 15742, "open": 150.52, "high": 151.26, "low": 150.41, "close": 151.16, "volume": 138762800, "adjusted": 149.7 }, + { "date": 15743, "open": 151.21, "high": 151.35, "low": 149.86, "close": 150.96, "volume": 162490000, "adjusted": 149.5 }, + { "date": 15744, "open": 151.22, "high": 151.89, "low": 151.22, "close": 151.8, "volume": 103133700, "adjusted": 150.33 }, + { "date": 15747, "open": 151.74, "high": 151.9, "low": 151.39, "close": 151.77, "volume": 73775000, "adjusted": 150.3 }, + { "date": 15748, "open": 151.78, "high": 152.3, "low": 151.61, "close": 152.02, "volume": 65392700, "adjusted": 150.55 }, + { "date": 15749, "open": 152.33, "high": 152.61, "low": 151.72, "close": 152.15, "volume": 82322600, "adjusted": 150.68 }, + { "date": 15750, "open": 151.69, "high": 152.47, "low": 151.52, "close": 152.29, "volume": 80834300, "adjusted": 150.82 }, + { "date": 15751, "open": 152.43, "high": 152.59, "low": 151.55, "close": 152.11, "volume": 215226500, "adjusted": 150.64 }, + { "date": 15755, "open": 152.37, "high": 153.28, "low": 152.16, "close": 153.25, "volume": 95105400, "adjusted": 151.77 }, + { "date": 15756, "open": 153.14, "high": 153.19, "low": 151.26, "close": 151.34, "volume": 160574800, "adjusted": 149.88 }, + { "date": 15757, "open": 150.96, "high": 151.42, "low": 149.94, "close": 150.42, "volume": 183257000, "adjusted": 148.97 }, + { "date": 15758, "open": 151.15, "high": 151.89, "low": 150.49, "close": 151.89, "volume": 106356600, "adjusted": 150.42 }, + { "date": 15761, "open": 152.63, "high": 152.86, "low": 149, "close": 149, "volume": 245824800, "adjusted": 147.56 }, + { "date": 15762, "open": 149.72, "high": 150.2, "low": 148.73, "close": 150.02, "volume": 186596200, "adjusted": 148.57 }, + { "date": 15763, "open": 149.89, "high": 152.33, "low": 149.76, "close": 151.91, "volume": 150781900, "adjusted": 150.44 }, + { "date": 15764, "open": 151.9, "high": 152.87, "low": 151.41, "close": 151.61, "volume": 126866000, "adjusted": 150.14 }, + { "date": 15765, "open": 151.09, "high": 152.34, "low": 150.41, "close": 152.11, "volume": 170634800, "adjusted": 150.64 }, + { "date": 15768, "open": 151.76, "high": 152.92, "low": 151.52, "close": 152.92, "volume": 99010200, "adjusted": 151.44 }, + { "date": 15769, "open": 153.66, "high": 154.7, "low": 153.64, "close": 154.29, "volume": 121431900, "adjusted": 152.8 }, + { "date": 15770, "open": 154.84, "high": 154.92, "low": 154.16, "close": 154.5, "volume": 94469900, "adjusted": 153.01 }, + { "date": 15771, "open": 154.7, "high": 154.98, "low": 154.52, "close": 154.78, "volume": 86101400, "adjusted": 153.28 }, + { "date": 15772, "open": 155.46, "high": 155.65, "low": 154.66, "close": 155.44, "volume": 123477800, "adjusted": 153.94 }, + { "date": 15775, "open": 155.32, "high": 156.04, "low": 155.13, "close": 156.03, "volume": 83746800, "adjusted": 154.52 }, + { "date": 15776, "open": 155.92, "high": 156.1, "low": 155.21, "close": 155.68, "volume": 105755800, "adjusted": 154.17 }, + { "date": 15777, "open": 155.76, "high": 156.12, "low": 155.23, "close": 155.9, "volume": 92550900, "adjusted": 154.39 }, + { "date": 15778, "open": 156.31, "high": 156.8, "low": 155.91, "close": 156.73, "volume": 126329900, "adjusted": 155.21 }, + { "date": 15779, "open": 155.85, "high": 156.04, "low": 155.31, "close": 155.83, "volume": 138601100, "adjusted": 155.01 }, + { "date": 15782, "open": 154.34, "high": 155.64, "low": 154.2, "close": 154.97, "volume": 126704300, "adjusted": 154.15 }, + { "date": 15783, "open": 155.3, "high": 155.51, "low": 153.59, "close": 154.61, "volume": 167567300, "adjusted": 153.8 }, + { "date": 15784, "open": 155.52, "high": 155.95, "low": 155.26, "close": 155.69, "volume": 113759300, "adjusted": 154.87 }, + { "date": 15785, "open": 154.76, "high": 155.64, "low": 154.1, "close": 154.36, "volume": 128605000, "adjusted": 153.55 }, + { "date": 15786, "open": 154.85, "high": 155.6, "low": 154.73, "close": 155.6, "volume": 111163600, "adjusted": 154.78 }, + { "date": 15789, "open": 156.01, "high": 156.27, "low": 154.35, "close": 154.95, "volume": 151322300, "adjusted": 154.13 }, + { "date": 15790, "open": 155.59, "high": 156.23, "low": 155.42, "close": 156.19, "volume": 86856600, "adjusted": 155.37 }, + { "date": 15791, "open": 155.26, "high": 156.24, "low": 155, "close": 156.19, "volume": 99950600, "adjusted": 155.37 }, + { "date": 15792, "open": 156.09, "high": 156.85, "low": 155.75, "close": 156.67, "volume": 102932800, "adjusted": 155.85 }, + { "date": 15796, "open": 156.59, "high": 156.91, "low": 155.67, "close": 156.05, "volume": 99194100, "adjusted": 155.23 }, + { "date": 15797, "open": 156.61, "high": 157.21, "low": 156.37, "close": 156.82, "volume": 101504300, "adjusted": 155.99 }, + { "date": 15798, "open": 156.91, "high": 157.03, "low": 154.82, "close": 155.23, "volume": 154167400, "adjusted": 154.41 }, + { "date": 15799, "open": 155.43, "high": 156.17, "low": 155.09, "close": 155.86, "volume": 131885000, "adjusted": 155.04 }, + { "date": 15800, "open": 153.95, "high": 155.35, "low": 153.77, "close": 155.16, "volume": 159666000, "adjusted": 154.34 }, + { "date": 15803, "open": 155.27, "high": 156.22, "low": 154.75, "close": 156.21, "volume": 86571200, "adjusted": 155.39 }, + { "date": 15804, "open": 156.5, "high": 157.32, "low": 155.98, "close": 156.75, "volume": 101922200, "adjusted": 155.92 }, + { "date": 15805, "open": 157.17, "high": 158.87, "low": 157.13, "close": 158.67, "volume": 135711100, "adjusted": 157.83 }, + { "date": 15806, "open": 158.7, "high": 159.71, "low": 158.54, "close": 159.19, "volume": 110142500, "adjusted": 158.35 }, + { "date": 15807, "open": 158.68, "high": 159.04, "low": 157.92, "close": 158.8, "volume": 116359900, "adjusted": 157.96 }, + { "date": 15810, "open": 158, "high": 158.13, "low": 155.1, "close": 155.12, "volume": 217259000, "adjusted": 154.3 }, + { "date": 15811, "open": 156.29, "high": 157.49, "low": 155.91, "close": 157.41, "volume": 147507800, "adjusted": 156.58 }, + { "date": 15812, "open": 156.29, "high": 156.32, "low": 154.28, "close": 155.11, "volume": 226834800, "adjusted": 154.29 }, + { "date": 15813, "open": 155.37, "high": 155.41, "low": 153.55, "close": 154.14, "volume": 167583200, "adjusted": 153.33 }, + { "date": 15814, "open": 154.5, "high": 155.55, "low": 154.12, "close": 155.48, "volume": 149687600, "adjusted": 154.66 }, + { "date": 15817, "open": 155.78, "high": 156.54, "low": 154.75, "close": 156.17, "volume": 106553500, "adjusted": 155.35 }, + { "date": 15818, "open": 156.95, "high": 157.93, "low": 156.17, "close": 157.78, "volume": 166141300, "adjusted": 156.95 }, + { "date": 15819, "open": 157.83, "high": 158.3, "low": 157.54, "close": 157.88, "volume": 96781200, "adjusted": 157.05 }, + { "date": 15820, "open": 158.34, "high": 159.27, "low": 158.1, "close": 158.52, "volume": 131060600, "adjusted": 157.69 }, + { "date": 15821, "open": 158.33, "high": 158.6, "low": 157.73, "close": 158.24, "volume": 95918800, "adjusted": 157.41 }, + { "date": 15824, "open": 158.67, "high": 159.65, "low": 158.42, "close": 159.3, "volume": 88572800, "adjusted": 158.46 }, + { "date": 15825, "open": 159.27, "high": 159.72, "low": 158.61, "close": 159.68, "volume": 116010700, "adjusted": 158.84 }, + { "date": 15826, "open": 159.33, "high": 159.41, "low": 158.1, "close": 158.28, "volume": 138874200, "adjusted": 157.45 }, + { "date": 15827, "open": 158.68, "high": 159.89, "low": 158.53, "close": 159.75, "volume": 96407600, "adjusted": 158.91 }, + { "date": 15828, "open": 161.14, "high": 161.88, "low": 159.78, "close": 161.37, "volume": 144202300, "adjusted": 160.52 }, + { "date": 15831, "open": 161.49, "high": 162.01, "low": 161.42, "close": 161.78, "volume": 66882100, "adjusted": 160.93 }, + { "date": 15832, "open": 162.13, "high": 162.65, "low": 161.67, "close": 162.6, "volume": 90359200, "adjusted": 161.74 }, + { "date": 15833, "open": 162.42, "high": 163.39, "low": 162.33, "close": 163.34, "volume": 97419200, "adjusted": 162.48 }, + { "date": 15834, "open": 163.27, "high": 163.7, "low": 162.47, "close": 162.88, "volume": 106738600, "adjusted": 162.02 }, + { "date": 15835, "open": 162.99, "high": 163.55, "low": 162.51, "close": 163.41, "volume": 103203000, "adjusted": 162.55 }, + { "date": 15838, "open": 163.2, "high": 163.81, "low": 162.82, "close": 163.54, "volume": 81843200, "adjusted": 162.68 }, + { "date": 15839, "open": 163.67, "high": 165.35, "low": 163.67, "close": 165.23, "volume": 119000900, "adjusted": 164.36 }, + { "date": 15840, "open": 164.96, "high": 166.45, "low": 164.91, "close": 166.12, "volume": 120718500, "adjusted": 165.25 }, + { "date": 15841, "open": 165.78, "high": 166.36, "low": 165.09, "close": 165.34, "volume": 109913600, "adjusted": 164.47 }, + { "date": 15842, "open": 165.95, "high": 167.04, "low": 165.73, "close": 166.94, "volume": 129801000, "adjusted": 166.06 }, + { "date": 15845, "open": 166.78, "high": 167.58, "low": 166.61, "close": 166.93, "volume": 85071200, "adjusted": 166.05 }, + { "date": 15846, "open": 167.08, "high": 167.8, "low": 166.5, "close": 167.17, "volume": 95804200, "adjusted": 166.29 }, + { "date": 15847, "open": 167.34, "high": 169.07, "low": 165.17, "close": 165.93, "volume": 244031800, "adjusted": 165.06 }, + { "date": 15848, "open": 164.16, "high": 165.91, "low": 163.94, "close": 165.45, "volume": 211064400, "adjusted": 164.58 }, + { "date": 15849, "open": 164.47, "high": 165.38, "low": 163.98, "close": 165.31, "volume": 151573900, "adjusted": 164.44 }, + { "date": 15853, "open": 167.04, "high": 167.78, "low": 165.81, "close": 166.3, "volume": 143679800, "adjusted": 165.42 }, + { "date": 15854, "open": 165.42, "high": 165.8, "low": 164.34, "close": 165.22, "volume": 160363400, "adjusted": 164.35 }, + { "date": 15855, "open": 165.35, "high": 166.59, "low": 165.22, "close": 165.83, "volume": 107793800, "adjusted": 164.96 }, + { "date": 15856, "open": 165.37, "high": 166.31, "low": 163.13, "close": 163.45, "volume": 176850100, "adjusted": 162.59 }, + { "date": 15859, "open": 163.83, "high": 164.46, "low": 162.66, "close": 164.35, "volume": 168390700, "adjusted": 163.48 }, + { "date": 15860, "open": 164.44, "high": 165.1, "low": 162.73, "close": 163.56, "volume": 157631500, "adjusted": 162.7 }, + { "date": 15861, "open": 163.09, "high": 163.42, "low": 161.13, "close": 161.27, "volume": 211737800, "adjusted": 160.42 }, + { "date": 15862, "open": 161.2, "high": 162.74, "low": 160.25, "close": 162.73, "volume": 200225500, "adjusted": 161.87 }, + { "date": 15863, "open": 163.85, "high": 164.95, "low": 163.14, "close": 164.8, "volume": 188337800, "adjusted": 163.93 }, + { "date": 15866, "open": 165.31, "high": 165.4, "low": 164.37, "close": 164.8, "volume": 105667100, "adjusted": 163.93 }, + { "date": 15867, "open": 163.3, "high": 164.54, "low": 162.74, "close": 163.1, "volume": 159505400, "adjusted": 162.24 }, + { "date": 15868, "open": 164.22, "high": 164.39, "low": 161.6, "close": 161.75, "volume": 177361500, "adjusted": 160.9 }, + { "date": 15869, "open": 161.66, "high": 164.5, "low": 161.3, "close": 164.21, "volume": 163587800, "adjusted": 163.35 }, + { "date": 15870, "open": 164.03, "high": 164.67, "low": 162.91, "close": 163.18, "volume": 141197500, "adjusted": 162.32 }, + { "date": 15873, "open": 164.29, "high": 165.22, "low": 163.22, "close": 164.44, "volume": 136295600, "adjusted": 163.57 }, + { "date": 15874, "open": 164.53, "high": 165.99, "low": 164.52, "close": 165.74, "volume": 114695600, "adjusted": 164.87 }, + { "date": 15875, "open": 165.6, "high": 165.89, "low": 163.38, "close": 163.45, "volume": 206149500, "adjusted": 162.59 }, + { "date": 15876, "open": 161.86, "high": 163.47, "low": 158.98, "close": 159.4, "volume": 321255900, "adjusted": 158.56 }, + { "date": 15877, "open": 159.64, "high": 159.76, "low": 157.47, "close": 159.07, "volume": 271956800, "adjusted": 159.07 }, + { "date": 15880, "open": 157.41, "high": 158.43, "low": 155.73, "close": 157.06, "volume": 222329000, "adjusted": 157.06 }, + { "date": 15881, "open": 158.48, "high": 160.1, "low": 157.42, "close": 158.57, "volume": 162262200, "adjusted": 158.57 }, + { "date": 15882, "open": 159.87, "high": 160.5, "low": 159.25, "close": 160.14, "volume": 134848000, "adjusted": 160.14 }, + { "date": 15883, "open": 161.1, "high": 161.82, "low": 160.95, "close": 161.08, "volume": 129483700, "adjusted": 161.08 }, + { "date": 15884, "open": 160.63, "high": 161.4, "low": 159.86, "close": 160.42, "volume": 160402900, "adjusted": 160.42 }, + { "date": 15887, "open": 161.26, "high": 162.48, "low": 161.08, "close": 161.36, "volume": 131954800, "adjusted": 161.36 }, + { "date": 15888, "open": 161.12, "high": 162.3, "low": 160.5, "close": 161.21, "volume": 154863700, "adjusted": 161.21 }, + { "date": 15889, "open": 160.48, "high": 161.77, "low": 160.22, "close": 161.28, "volume": 75216400, "adjusted": 161.28 }, + { "date": 15891, "open": 162.47, "high": 163.08, "low": 161.3, "close": 163.02, "volume": 122416900, "adjusted": 163.02 }, + { "date": 15894, "open": 163.86, "high": 164.39, "low": 163.08, "close": 163.95, "volume": 108092500, "adjusted": 163.95 }, + { "date": 15895, "open": 164.98, "high": 165.33, "low": 164.27, "close": 165.13, "volume": 119298000, "adjusted": 165.13 }, + { "date": 15896, "open": 164.97, "high": 165.75, "low": 164.63, "close": 165.19, "volume": 121410100, "adjusted": 165.19 }, + { "date": 15897, "open": 167.11, "high": 167.61, "low": 165.18, "close": 167.44, "volume": 135592200, "adjusted": 167.44 }, + { "date": 15898, "open": 167.39, "high": 167.93, "low": 167.13, "close": 167.51, "volume": 104212700, "adjusted": 167.51 }, + { "date": 15901, "open": 167.97, "high": 168.39, "low": 167.68, "close": 168.15, "volume": 69450600, "adjusted": 168.15 }, + { "date": 15902, "open": 168.26, "high": 168.36, "low": 167.07, "close": 167.52, "volume": 88702100, "adjusted": 167.52 }, + { "date": 15903, "open": 168.16, "high": 168.48, "low": 167.73, "close": 167.95, "volume": 92873900, "adjusted": 167.95 }, + { "date": 15904, "open": 168.31, "high": 169.27, "low": 168.2, "close": 168.87, "volume": 103620100, "adjusted": 168.87 }, + { "date": 15905, "open": 168.52, "high": 169.23, "low": 168.31, "close": 169.17, "volume": 103831700, "adjusted": 169.17 }, + { "date": 15908, "open": 169.41, "high": 169.74, "low": 169.01, "close": 169.5, "volume": 79428600, "adjusted": 169.5 }, + { "date": 15909, "open": 169.8, "high": 169.83, "low": 169.05, "close": 169.14, "volume": 80829700, "adjusted": 169.14 }, + { "date": 15910, "open": 169.79, "high": 169.86, "low": 168.18, "close": 168.52, "volume": 112914000, "adjusted": 168.52 }, + { "date": 15911, "open": 168.22, "high": 169.08, "low": 167.94, "close": 168.93, "volume": 111088600, "adjusted": 168.93 }, + { "date": 15912, "open": 168.22, "high": 169.16, "low": 167.52, "close": 169.11, "volume": 107814600, "adjusted": 169.11 }, + { "date": 15915, "open": 168.68, "high": 169.06, "low": 168.11, "close": 168.59, "volume": 79695000, "adjusted": 168.59 }, + { "date": 15916, "open": 169.1, "high": 169.28, "low": 168.19, "close": 168.59, "volume": 85209600, "adjusted": 168.59 }, + { "date": 15917, "open": 168.94, "high": 169.85, "low": 168.49, "close": 168.71, "volume": 142388700, "adjusted": 168.71 }, + { "date": 15918, "open": 169.99, "high": 170.81, "low": 169.9, "close": 170.66, "volume": 110438400, "adjusted": 170.66 }, + { "date": 15919, "open": 170.28, "high": 170.97, "low": 170.05, "close": 170.95, "volume": 91116700, "adjusted": 170.95 }, + { "date": 15922, "open": 170.57, "high": 170.96, "low": 170.35, "close": 170.7, "volume": 54072700, "adjusted": 170.7 }, + { "date": 15923, "open": 170.37, "high": 170.74, "low": 169.35, "close": 169.73, "volume": 87495000, "adjusted": 169.73 }, + { "date": 15924, "open": 169.19, "high": 169.43, "low": 168.55, "close": 169.18, "volume": 84854700, "adjusted": 169.18 }, + { "date": 15925, "open": 169.98, "high": 170.18, "low": 168.93, "close": 169.8, "volume": 102181300, "adjusted": 169.8 }, + { "date": 15926, "open": 169.58, "high": 170.1, "low": 168.72, "close": 169.31, "volume": 91757700, "adjusted": 169.31 }, + { "date": 15929, "open": 168.46, "high": 169.31, "low": 168.38, "close": 169.11, "volume": 68593300, "adjusted": 169.11 }, + { "date": 15930, "open": 169.41, "high": 169.9, "low": 168.41, "close": 169.61, "volume": 80806000, "adjusted": 169.61 }, + { "date": 15931, "open": 169.53, "high": 169.8, "low": 168.7, "close": 168.74, "volume": 79829200, "adjusted": 168.74 }, + { "date": 15932, "open": 167.41, "high": 167.43, "low": 166.09, "close": 166.38, "volume": 152931800, "adjusted": 166.38 }, + { "date": 15933, "open": 166.06, "high": 166.63, "low": 165.5, "close": 165.83, "volume": 130868200, "adjusted": 165.83 }, + { "date": 15936, "open": 165.64, "high": 166.21, "low": 164.76, "close": 164.77, "volume": 96437600, "adjusted": 164.77 }, + { "date": 15937, "open": 165.04, "high": 166.2, "low": 164.86, "close": 165.58, "volume": 89294400, "adjusted": 165.58 }, + { "date": 15938, "open": 165.12, "high": 166.03, "low": 164.19, "close": 164.56, "volume": 159530500, "adjusted": 164.56 }, + { "date": 15939, "open": 164.9, "high": 166.3, "low": 164.89, "close": 166.06, "volume": 101471400, "adjusted": 166.06 }, + { "date": 15940, "open": 166.55, "high": 166.83, "low": 165.77, "close": 166.62, "volume": 90888900, "adjusted": 166.62 }, + { "date": 15943, "open": 166.79, "high": 167.3, "low": 165.89, "close": 166, "volume": 89702100, "adjusted": 166 }, + { "date": 15944, "open": 164.36, "high": 166, "low": 163.21, "close": 163.33, "volume": 158619400, "adjusted": 163.33 }, + { "date": 15945, "open": 163.26, "high": 164.49, "low": 163.05, "close": 163.91, "volume": 108113000, "adjusted": 163.91 }, + { "date": 15946, "open": 163.55, "high": 165.04, "low": 163.4, "close": 164.17, "volume": 119200500, "adjusted": 164.17 }, + { "date": 15947, "open": 164.51, "high": 164.53, "low": 163.17, "close": 163.65, "volume": 134560800, "adjusted": 163.65 }, + { "date": 15951, "open": 165.23, "high": 165.58, "low": 163.7, "close": 164.39, "volume": 142322300, "adjusted": 164.39 }, + { "date": 15952, "open": 164.43, "high": 166.03, "low": 164.13, "close": 165.75, "volume": 97304000, "adjusted": 165.75 }, + { "date": 15953, "open": 165.85, "high": 166.4, "low": 165.73, "close": 165.96, "volume": 62930500, "adjusted": 165.96 } + ] + }]; + + nv.addGraph(function () { + var chart = nv.models.ohlcBar() + .x(function (d) { return d['date'] }) + .y(function (d) { return d['close'] }); + d3.select("#chart1 svg") + .datum(data) + .transition().duration(500) + .call(chart); + + nv.utils.windowResize(chart.update); + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-ohlcChart.ts b/nvd3/nvd3-test-ohlcChart.ts index b62027f631..b9d5d3560d 100644 --- a/nvd3/nvd3-test-ohlcChart.ts +++ b/nvd3/nvd3-test-ohlcChart.ts @@ -1,36 +1,40 @@ /// /// -var data = [{values: [ - {"date": 15707, "open": 145.11, "high": 146.15, "low": 144.73, "close": 146.06, "volume": 192059000, "adjusted": 144.65}, - {"date": 15953, "open": 165.85, "high": 166.4, "low": 165.73, "close": 165.96, "volume": 62930500, "adjusted": 165.96} - ]}]; - -nv.addGraph(function() { - var chart = nv.models.ohlcBarChart() - .x(function(d) { return d['date'] }) - .y(function(d) { return d['close'] }) - .duration(250) - .margin({left: 75, bottom: 50}); +module nvd3_test_ohlcChart { + var data = [{ + values: [ + { "date": 15707, "open": 145.11, "high": 146.15, "low": 144.73, "close": 146.06, "volume": 192059000, "adjusted": 144.65 }, + { "date": 15953, "open": 165.85, "high": 166.4, "low": 165.73, "close": 165.96, "volume": 62930500, "adjusted": 165.96 } + ] + }]; - // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately - chart.xAxis - .axisLabel("Dates") - .tickFormat(function(d) { - // I didn't feel like changing all the above date values - // so I hack it to make each value fall on a different date - return d3.time.format('%x')(new Date(new Date().valueOf() - (20000 * 86400000) + (d * 86400000))); - }); + nv.addGraph(function () { + var chart = nv.models.ohlcBarChart() + .x(function (d) { return d['date'] }) + .y(function (d) { return d['close'] }) + .duration(250) + .margin({ left: 75, bottom: 50 }); - chart.yAxis - .axisLabel('Stock Price') - .tickFormat(function(d,i){ return '$' + d3.format(',.1f')(d); }); + // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately + chart.xAxis + .axisLabel("Dates") + .tickFormat(function (d) { + // I didn't feel like changing all the above date values + // so I hack it to make each value fall on a different date + return d3.time.format('%x')(new Date(new Date().valueOf() - (20000 * 86400000) + (d * 86400000))); + }); + + chart.yAxis + .axisLabel('Stock Price') + .tickFormat(function (d, i) { return '$' + d3.format(',.1f')(d); }); - d3.select("#chart1 svg") - .datum(data) - .transition().duration(500) - .call(chart); - nv.utils.windowResize(chart.update); - return chart; -}); \ No newline at end of file + d3.select("#chart1 svg") + .datum(data) + .transition().duration(500) + .call(chart); + nv.utils.windowResize(chart.update); + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-parallelCoordinates.ts b/nvd3/nvd3-test-parallelCoordinates.ts new file mode 100644 index 0000000000..37d74a94ba --- /dev/null +++ b/nvd3/nvd3-test-parallelCoordinates.ts @@ -0,0 +1,47 @@ +/// +/// +module nvd3_test_parallelCoordinates { + var chart; + nv.addGraph(function () { + + chart = nv.models.parallelCoordinates() + .dimensionNames(["economy (mpg)", "cylinders", "displacement (cc)", "power (hp)", "weight (lb)", "0-60 mph (s)", "year"]) + .dimensionFormats(["0.5f", "e", "g", "d", "", "%", "p"]) + .lineTension(0.85); + + + d3.select('#chart1 svg') + .datum(data()) + .call(chart); + + nv.utils.windowResize(chart.update); + + return chart; + }); + + function data() { + return [ + { + "name": "AMC Ambassador Brougham", + "economy (mpg)": "13", + "cylinders": "8", + "displacement (cc)": "360", + "power (hp)": "175", + "weight (lb)": "3821", + "0-60 mph (s)": "11", + "year": "73" + }, +//skip to the end... + { + "name": "Volvo Diesel", + "economy (mpg)": "30.7", + "cylinders": "6", + "displacement (cc)": "145", + "power (hp)": "76", + "weight (lb)": "3160", + "0-60 mph (s)": "19.6", + "year": "81" + } + ] + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-parallelCoordinatesChart.ts b/nvd3/nvd3-test-parallelCoordinatesChart.ts new file mode 100644 index 0000000000..842caca6a6 --- /dev/null +++ b/nvd3/nvd3-test-parallelCoordinatesChart.ts @@ -0,0 +1,186 @@ +/// +/// +module nvd3_test_parallelCoordinatesChart { + var chart; + function resetBrush() { + chart.filters([]); + chart.active([]); + chart.displayBrush(true); + d3.select("#resetBrushButton").style("visibility", "hidden"); + chart.update(); + } + + function resetSorting() { + var dim = chart.dimensionData(); + dim.map(function (d) { return d.currentPosition = d.originalPosition; }); + dim.sort(function (a, b) { return a.originalPosition - b.originalPosition; }); + chart.dimensionData(dim); + d3.select("#resetSortingButton").style("visibility", "hidden"); + chart.update(); + } + + nv.addGraph(function () { + + var dim = dimensions(); + chart = nv.models.parallelCoordinatesChart() + .dimensionData(dim) + .displayBrush(false) + .lineTension(0.85); + + var data = mydata(); + d3.select('#test') + .datum(data) + .call(chart); + + nv.utils.windowResize(chart.update); + + chart.dispatch.on('brushEnd', function (e) { + d3.select("#resetBrushButton").style("visibility", "visible"); + }); + + chart.dispatch.on('dimensionsOrder', function (e, b) { + if (b) { + d3.select("#resetSortingButton").style("visibility", "visible"); + } + }); + + // update chart data values randomly + setInterval(function () { + data[0].values.P1 = Math.floor(Math.random() * 100).toString(); + chart.update(); + }, 4000); + + // update chart data dimension randomly + setInterval(function () { + var element = { + key: "P7", + format: "p", + tooltip: "year", + } + if (dim.length === 7) { + dim.splice(dim.indexOf(element), 1); + } else { + dim.push(element); + } + chart.dimensionData(dim); + chart.update(); + }, 10000); + + return chart; + }); + + function dimensions() { + return [ + { + key: "P1", + format: "0.5f", + tooltip: "economy (mpg)", + }, + { + key: "P2", + format: "e", + tooltip: "cylinders", + }, + { + key: "P3", + format: "g", + tooltip: "displacement (cc)", + }, + { + key: "P4", + format: "d", + tooltip: "power (hp)", + }, + { + key: "P5", + format: "", + tooltip: "weight (lb)", + }, + { + key: "P6", + format: "%", + tooltip: "0-60 mph (s)", + }, + { + key: "P7", + format: "p", + tooltip: "year", + } + ]; + } + + function mydata() { + return [ + { + name: "Current design point", + values: { + "P1": "13", + "P2": "8", + "P3": "360", + "P4": "175", + "P5": "3821", + "P6": "11", + "P7": "73" + }, + color: "red", + strokeWidth: 2 + }, + { + name: "DP1", + values: { + "P1": "15", + "P2": "8", + "P3": "390", + "P4": "190", + "P5": "3850", + "P6": "8.5", + "P7": "70" + }, + color: "blue", + strokeWidth: 1 + }, + { + name: "DP2", + values: { + "P1": "17", + "P2": "8", + "P3": "304", + "P4": "150", + "P5": "3672", + "P6": "11.5", + "P7": "72" + }, + color: "blue", + strokeWidth: 2 + }, + { + name: "DP3", + values: { + "P1": "20.2", + "P2": "6", + "P3": "232", + "P4": "", + "P5": "3265", + "P6": "18.2", + "P7": "79" + }, + color: "blue", + strokeWidth: 1 + }, + { + name: "DP4", + values: { + "P1": "18.1", + "P2": "6", + "P3": "258", + "P4": "120", + "P5": "3410", + "P6": "15.1", + "P7": "78" + }, + color: "blue", + strokeWidth: 1 + } + ]; + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-scatter.ts b/nvd3/nvd3-test-scatter.ts new file mode 100644 index 0000000000..d8ffe959d8 --- /dev/null +++ b/nvd3/nvd3-test-scatter.ts @@ -0,0 +1,35 @@ +/// +module nvd3_test_scatter { + nv.addGraph(function () { + + var chart = nv.models.scatter() + .margin({ top: 20, right: 20, bottom: 20, left: 20 }) + .pointSize(function (d) { return d.z }) + .useVoronoi(false); + + d3.select('#test1') + .datum(randomData()) + .transition().duration(500) + .call(chart); + + nv.utils.windowResize(chart.update); + return chart; + }); + + function randomData() { + var data = []; + + for (var i = 0; i < 2; i++) { + data.push({ + key: 'Group ' + i, + values: [] + }); + + for (var j = 0; j < 100; j++) { + data[i].values.push({ x: Math.random(), y: Math.random(), z: Math.random() }); + } + } + + return data; + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-tooltip.ts b/nvd3/nvd3-test-tooltip.ts index ee45f9ea78..24a090922b 100644 --- a/nvd3/nvd3-test-tooltip.ts +++ b/nvd3/nvd3-test-tooltip.ts @@ -1,55 +1,59 @@ /// /// -var width = 500, - height = 20; +module nvd3_test_tooltip { + var width = 500, + height = 20; - var tooltip = nv.models.tooltip(); - tooltip.duration(0); + var tooltip = nv.models.tooltip(); + tooltip.duration(0); - d3.select('.tooltip_me') - .on('mouseover', function(d,i) { - console.log("mouseover", d, i); - var data = {series: { - key: "title", - value: "the value", - color: "#229922" - }}; - tooltip.data(data).hidden(false); - }) - .on('mouseout', function(d,i) { - console.log("mouseout", d, i); - tooltip.hidden(true); - }) - .on('mousemove', function(d,i) { - console.log("mousemove", d, i); - tooltip.position({top: d3.event.pageY, left: d3.event.pageX})(); - }); + d3.select('.tooltip_me') + .on('mouseover', function (d, i) { + console.log("mouseover", d, i); + var data = { + series: { + key: "title", + value: "the value", + color: "#229922" + } + }; + tooltip.data(data).hidden(false); + }) + .on('mouseout', function (d, i) { + console.log("mouseout", d, i); + tooltip.hidden(true); + }) + .on('mousemove', function (d, i) { + console.log("mousemove", d, i); + //tooltip.position({ top: d3.event.pageY, left: d3.event.pageX })(); todo pageY and X not found on d3 definition + }); - // we must also test the scatter/line way of getting position - // Wrapping in nv.addGraph allows for '0 timeout render', stores rendered charts in nv.graphs, and may do more in the future... it's NOT required - var chart; - nv.addGraph(function() { - chart = nv.models.lineChart() - .showXAxis(false) - .showLegend(false) - .clipVoronoi(false) - .showVoronoi(true) - .showYAxis(false); - d3.select('#test2') - .datum(sinAndCos()) - .call(chart); - return chart; - }); + // we must also test the scatter/line way of getting position + // Wrapping in nv.addGraph allows for '0 timeout render', stores rendered charts in nv.graphs, and may do more in the future... it's NOT required + var chart; + nv.addGraph(function () { + chart = nv.models.lineChart() + .showXAxis(false) + .showLegend(false) + .clipVoronoi(false) + .showVoronoi(true) + .showYAxis(false); + d3.select('#test2') + .datum(sinAndCos()) + .call(chart); + return chart; + }); - function sinAndCos() { - var cos = []; - for (var i = 0; i < 5; i++) { - cos.push({x: i, y: Math.round(.5 * Math.cos(i/10) * 100) / 100}); - } - return [{ - values: cos, - key: "Cosine Wave", - color: "#2ca02c" - }]; - } + function sinAndCos() { + var cos = []; + for (var i = 0; i < 5; i++) { + cos.push({ x: i, y: Math.round(.5 * Math.cos(i / 10) * 100) / 100 }); + } + return [{ + values: cos, + key: "Cosine Wave", + color: "#2ca02c" + }]; + } +} \ No newline at end of file diff --git a/nvd3/nvd3.d.ts b/nvd3/nvd3.d.ts index 97e1ebf921..7e462248cc 100644 --- a/nvd3/nvd3.d.ts +++ b/nvd3/nvd3.d.ts @@ -5,249 +5,2754 @@ /// declare module nv { - -// interface Datum{ -// values: any[], -// key: string, -// color: string -// } - +//#region Chart Component interface Margin { left?: number, right?: number, top?: number, bottom?: number } - - interface Legend extends Chart { - key(): any; - key(value: any): this; - align(): boolean; - align(value: boolean): this; - maxKeyLength(): number; - maxKeyLength(value: number): this; - rightAlign(): boolean; - rightAlign(value: boolean): this; - //define how much space between legend items. - recommend 32 for furious version - padding(): number; - //define how much space between legend items. - recommend 32 for furious version - padding(value: number): this; - //If true, legend will update data.disabled and trigger a 'stateChange' dispatch. - updateState(): boolean; - //If true, legend will update data.disabled and trigger a 'stateChange' dispatch. - updateState(value: boolean): this; - //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at - radioButtonMode(): boolean; - //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at - radioButtonMode(value: boolean): this; - expanded(): boolean; - expanded(value: boolean): this; - //Options are "classic" and "furious" - vers(): string; - //Options are "classic" and "furious" - vers(value: string): Legend; - } - - /** - *NVD3 extension of D3 Axis - */ - interface NvAxis extends d3.svg.Axis { - (selection: d3.Selection): void; - (selection: d3.Transition): void; - scale(): any; - scale(scale: any): NvAxis; + interface Size { + height: number; + width: number; + } - orient(): string; - orient(orientation: string): NvAxis; + interface Offset { + left?: number; + top?: number; + } - ticks(): any[]; - ticks(...args: any[]): NvAxis; - - tickValues(): any[]; - tickValues(values: any[]): NvAxis; - - tickSize(): number; - tickSize(size: number): NvAxis; - tickSize(inner: number, outer: number): NvAxis; - - innerTickSize(): number; - innerTickSize(size: number): NvAxis; - - outerTickSize(): number; - outerTickSize(size: number): NvAxis; - - tickPadding(): number; - tickPadding(padding: number): NvAxis; - - tickFormat(): (t: any) => string; - tickFormat(format: (t: any) => string): NvAxis; - tickFormat(format:string): NvAxis; - tickFormat(format: (t: any, i: any) => string): NvAxis; - - showMaxMin(value: boolean) : NvAxis; - axisLabel(value: string) : NvAxis; - - } - - interface InteractiveLayer { - tooltip : Tooltip - } - - interface ContentGenerator { - (arg: any) :string - } - - interface Tooltip { - - show([left , top]: [number,number], content: string, gravity: string) //todo sort out use on nv.tooltip. - cleanup():void; //todo sort out use on nv.tooltip. - contentGenerator(): ContentGenerator; - contentGenerator(func: (any) => string): void; - headerFormatter(func: (any)=> string): void; - } - - interface Utils { - windowResize(listener: (ev: Event) => any): void; - } - - interface ChartBase { - - } - - interface Chart { - margin() : Margin; - margin(value: Margin) : this; - width(): number; - width(value: number) : this; - height(): number; - height(value: number) : this; - color(value:string[]) : this; - color(value:string) : this; + interface State { dispatch: d3.Dispatch; + } + interface InteractiveLayer { + tooltip: Tooltip + } + + interface Nvd3Element { + dispatch: d3.Dispatch; + options(options: any) update(): void; - interactiveLayer: InteractiveLayer; - (transition: d3.Transition, ...args: any[]): any; (selection: d3.Selection, ...args: any[]): any; (transition: d3.Transition, ...args: any[]): any; (selection: d3.Selection, ...args: any[]): any; + } - } - - interface TwoDimensionalChart extends Chart - { - xAxis : NvAxis; - yAxis : NvAxis; - x(func: (any)=> any) : this; - y(func: (any) => any): this; - xScale(scale: d3.time.Scale): this; - xScale() : d3.time.Scale; - yScale(scale: d3.time.Scale): this; - yScale() : d3.time.Scale - forceX([xMin, xMax]: [number, number]): this; - forceY([xMin, xMax]: [number, number]): this; - - } - - interface HistoricalBarBase extends TwoDimensionalChart{ - - - } - - interface HistoricalBar extends HistoricalBarBase{ - - } - - interface HistoricalBarChart extends HistoricalBarBase{ - bars: HistoricalBar; - legend: Legend; - noData(): any //todo; - noData(value: any): this //todo; - defaultState(): any //todo; - defaultState(value: any): this //todo; - showXAxis(): boolean //todo; - showXAxis(value: boolean): this //todo; - showLegend(): boolean //todo; - showLegend(value: boolean): this //todo; - showYAxis(): boolean //todo; - showYAxis(value: boolean): this //todo; - rightAlignYAxis(): boolean //todo; - rightAlignYAxis(value: boolean): this //todo; - useInteractiveGuideline(value: boolean): this; - duration(value: number): this; - } - - - + interface Chart extends Nvd3Element { + state: State; + interactiveLayer: InteractiveLayer; + + } + //#region Chart Component + + interface Legend extends Nvd3Element { + align(): boolean; + align(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + expanded(): boolean; + expanded(value: boolean): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + key(): any; + key(value: any): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /*Specifies how much spacing there is between legend items.*/ + padding(): number; + /*Specifies how much spacing there is between legend items.*/ + padding(value: number): this; + radioButtonMode(): boolean; + //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at + radioButtonMode(value: boolean): this; + rightAlign(): boolean; + rightAlign(value: boolean): this; + //If true, legend will update data.disabled and trigger a 'stateChange' dispatch. + updateState(): boolean; + //If true, legend will update data.disabled and trigger a 'stateChange' dispatch. + updateState(value: boolean): this; + //Options are "classic" and "furious" + vers(): string; + //Options are "classic" and "furious" + vers(value: string): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + } - interface BoxPlotChart extends TwoDimensionalChart{ - useInteractiveGuideline(value : boolean) : this; + /** + *NVD3 extension of D3 Axis + */ + interface Nvd3Axis extends d3.svg.Axis { + axisLabel(): string; + axisLabel(value: string): this; + axisLabelDistance(): number; + axisLabelDistance(value: number): this; + domain(): number[]; + domain(domain: number[]): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ duration(value: number): this; - - staggerLabels(value: boolean): this; - maxBoxWidth(value: number): this; - yDomain([xMin, xMax]: [number, number]): this; - xDomain([xMin, xMax]: [number, number]): this; - showXAxis(): boolean //todo; - showXAxis(value: boolean): this //todo; - showYAxis(): boolean //todo; - showYAxis(value: boolean): this //todo; - rightAlignYAxis(): boolean //todo; - rightAlignYAxis(value: boolean): this //todo; - } - - interface BulletBase extends Chart { - orient(): string; - orient(orientation: string): this; - tickFormat(): (t: any) => string; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + orient(): string; + orient(orientation: string): this; + range(): number[]; + range(range: number[]): this; + rangeBand(): number; + rangeBands(interval: [number, number], padding?: number, outerPadding?: number): this; + /*Rotates the X axis labels by the specified degree.*/ + rotateLabels(): number; + /*Rotates the X axis labels by the specified degree.*/ + rotateLabels(range: number): this; + rotateYLabels(): number; + rotateYLabels(range: number): this; + scale(): any; + scale(scale: any): this; + showMaxMin(value: boolean): this; + staggerLabels(): boolean; + staggerLabels(value: boolean): this; + tickFormat(): (d: any) => string; tickFormat(format: (t: any) => string): this; - tickFormat(format:string): NvAxis; - tickFormat(format: (t: any, i: any) => string): this; - forceX([xMin, xMax]: [number, number]): this; - ranges(): any //todo; - ranges(value: any): this //todo; - markers(): any //todo; - markers(value: any): this //todo; - measures(): any //todo; - measures(value: any): this //todo; + tickFormat(format: string): this; + tickFormat(format: (d: any, i: any) => string): this; + tickPadding(): number; + tickPadding(padding: number): this; + tickSize(): number; + tickSize(size: number): this; + tickSize(inner: number, outer: number): this; + tickValues(): any[]; + tickValues(values: any[]): this; + ticks(): any[]; + ticks(...args: any[]): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; } - interface Bullet extends BulletBase{ - + interface Tooltip { + + /*For tooltip: Parent dom element of the SVG that holds the chart. This will make the tooltip dom be created inside this container instead of on the document body.*/ + chartContainer(el: HTMLElement): this + /*For tooltip: Parent dom element of the SVG that holds the chart. This will make the tooltip dom be created inside this container instead of on the document body.*/ + chartContainer(): HTMLElement + /*Attaches additional CSS classes to the tooltip DIV that is created.*/ + classes(el: string): this + /*Attaches additional CSS classes to the tooltip DIV that is created.*/ + classes(): string + /*Function that generates the tooltip content html.*/ + contentGenerator(): (d :any) => string; + /*Function that generates the tooltip content html.*/ + contentGenerator(func: (d: any) => string): this; + data(): any; + data(value: any): this; + distance(): number; + distance(value: number): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*For tooltip: completely enables or disabled the tooltip*/ + enabled(): boolean; + /*For tooltip: completely enables or disabled the tooltip*/ + enabled(value: boolean): this; + /*For tooltip: If not null, this fixes the top position of the tooltip.*/ + fixedTop(): number; + /*For tooltip: If not null, this fixes the top position of the tooltip.*/ + fixedTop(value: number): this; + /*Can be 'n','s','e','w'. Determines how tooltip is positioned*/ + gravity(): string; + /*Can be 'n','s','e','w'. Determines how tooltip is positioned*/ + gravity(value: string): this; + /*For tooltip: show the x axis value in the tooltip or not (not valid for pie charts for instance)*/ + headerEnabled(): boolean; + /*For tooltip: show the x axis value in the tooltip or not (not valid for pie charts for instance)*/ + headerEnabled(value: boolean): this; + /*For tooltip: formats the x axis value in the tooltip*/ + headerFormatter(func: (d: any) => string): this; + /*For tooltip: formats the x axis value in the tooltip*/ + headerFormatter(): (d: any) => string; + /*For tooltip: show or hide the tooltip by setting this to true or false. Tooltips used to be created and destroyed, but now we re-used the element and set opacity to 1 or 0.*/ + hidden(): boolean; + /*For tooltip: show or hide the tooltip by setting this to true or false. Tooltips used to be created and destroyed, but now we re-used the element and set opacity to 1 or 0.*/ + hidden(value: boolean): this; + /*Delay in ms before the tooltip hides itself after a mouseout event. A new mouseover event cancels the hide if within this timeout period.*/ + hideDelay(): number; + /*Delay in ms before the tooltip hides itself after a mouseout event. A new mouseover event cancels the hide if within this timeout period.*/ + hideDelay(value: number): this; + /**/ + id(): number; + keyFormatter(): (d: any, i: number) => string; + keyFormatter(func: (d: any, i: number) => string): this; + offset(): Offset; + offset(value: Offset): this; + /*sets the top/left positioning for the tooltip. Should be given an object with 'left' and/or 'top' attributes. You can override just one, just like the 'margin' option on charts*/ + position(): Offset; + /*sets the top/left positioning for the tooltip. Should be given an object with 'left' and/or 'top' attributes. You can override just one, just like the 'margin' option on charts*/ + position(value: Offset): this; + /*Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect)*/ + snapDistance(): number; + /*Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect)*/ + snapDistance(value: number): this; + /*returns the dom element of the tooltip.*/ + tooltipElem(): HTMLElement; + /*formats the y axis value(s) in the tooltip*/ + valueFormatter(): (d: any) => string; + /*formats the y axis value(s) in the tooltip*/ + valueFormatter(func: (d: any) => string): this; + } + + interface BoxPlot extends Nvd3Element { + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): number; + id(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + maxBoxWidth(): number; + maxBoxWidth(value: number): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface Bullet extends Nvd3Element { + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + markers(): (d: any) => any //todo; + markers(func: (d: any) => any): this //todo; + measures(): (d: any) => any //todo; + measures(func: (d: any) => any): this //todo; + orient(): string; + orient(orientation: string): this; + ranges(): (d: any) => any //todo; + ranges(func: (d: any) => any): this //todo; + tickFormat(): (d: any) => string; + tickFormat(format: (d: any) => string): this; + tickFormat(format: string): this; + tickFormat(format: (d: any, i: any) => string): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + } + + interface CandlestickBar extends Nvd3Element { + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + close(): (d: any) => number; + close(func: (d:any) => number): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + high(): (d: any) => number; + high(func: (d: any) => number): this; + id(): number; + id(value: number): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + low(): (d: any) => number; + low(func: (d: any) => number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + open(): (d: any) => number; + open(func: (d: any) => number): this; + padData(): boolean; + padData(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface DiscreteBar extends Nvd3Element { + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): number; + id(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + rectClass(): string; + rectClass(value: string): this; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(): boolean; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(value: boolean): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(): string; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(value: string): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface HistoricalBar extends Nvd3Element { + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceX(): number[]; + /* List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceX(value: number[]): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): number; + id(value: number): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /*.*/ + padData(): boolean; + /**/ + padData(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface Scatter extends Nvd3Element { + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(func: (d: any) => number): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(value: number): this; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(): boolean; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(): number[]; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(value: number[]): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): number; + id(value: number): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /**/ + padData(): boolean; + /**/ + padData(value: boolean): this; + /**/ + padDataOuter(): number; + /**/ + padDataOuter(value: number): this; + /* Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(): (d: any) => boolean; + /*Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(func: (d: any) => boolean): this; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointxDomain(): number[]; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointDomain(value: number[]): this; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(): number[]; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(value: number[]): this; + /* Override the default scale type for the point axis*/ + pointScale(): any; + /* Override the default scale type for the point axis*/ + pointScale(value: any): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(): (d: any) => number; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(func: (d: any) => number): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(value: number): this; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(): boolean; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(value: boolean): this; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(): boolean; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + + } + + interface Line extends Scatter { + scatter: Scatter; + clearHighlights(): this; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(): (d: any, i: number) => boolean; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(func: (d: any, i: number) => boolean): this; + /**/ + highlightPoint(): (d: any) => boolean; + /**/ + highlightPoint(func: (d: any) => boolean): this; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(): string; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(value: string): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(): (d: any) => boolean; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(value: boolean): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(func: (d: any) => boolean): this; + + + } + + interface MultiBar extends Nvd3Element { + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(value: string[]): this; + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(func: (d: any, i: number) => string): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /**/ + disabled(): boolean[]; + /**/ + disabled(value: boolean[]): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(): number; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(value: number): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*.*/ + hideable(): boolean; + /**/ + hideable(value: boolean): this; + id(): number; + id(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /*.*/ + stacked(): boolean; + /**/ + stacked(value: boolean): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'silhouette'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'wiggle'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'expand'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'zero'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: string): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: (data: Array<[number, number]>) => number[]): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface MultiBarHorizontal extends Nvd3Element { + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(value: string[]): this; + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(func: (d: any, i: number) => string): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /**/ + disabled(): boolean[]; + /**/ + disabled(value: boolean[]): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(): number; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(value: number): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): number; + id(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(): boolean; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(value: boolean): this; + /*.*/ + stacked(): boolean; + /**/ + stacked(value: boolean): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'silhouette'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'wiggle'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'expand'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'zero'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: string): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: (data: Array<[number, number]>) => number[]): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(): string; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(value: string): this; + /*.*/ + valuePadding(): number; + /**/ + valuePadding(value: number): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /**/ + yErr(): (d: any, i: number) => number|number[]; + /**/ + yErr(func: (d: any, i: number) => number | number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface OhlcBar extends Nvd3Element { + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + close(): (d: any) => number; + close(func: (d: any) => number): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + high(): (d: any) => number; + high(func: (d: any) => number): this; + id(): number; + id(value: number): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + low(): (d: any) => number; + low(func: (d: any) => number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + open(): (d: any) => number; + open(func: (d: any) => number): this; + padData(): boolean; + padData(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface ParallelCoordinates extends Nvd3Element { + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + dimensionData(): any + dimensionData(d: any): this + /*D3 format for each x axis*/ + dimensionFormats(): string[]; + /*D3 format for each x axis*/ + dimensionFormats(value: string[]): this; + /*Name of each dimension, used for each axis.*/ + dimensionNames(): string[]; + /*Name of each dimension, used for each axis.*/ + dimensionNames(value: string[]): this; + /*Deprecated. Use dimensionsNames instead. */ + dimensions(): any; + /*Deprecated. Use dimensionsNames instead. .*/ + dimensions(value: any): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*Specifies each line tension. Values between 0 and 1.*/ + lineTension(): number; + /*Specifies each line tension. Values between 0 and 1.*/ + lineTension(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + } +//#endregion + +//#region Charts + interface BoxPlotChart extends Chart { + boxplot: BoxPlot; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): number; + id(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + maxBoxWidth(): number; + maxBoxWidth(value: number): this; + noData(): string; + noData(value: string): this; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Makes the X labels stagger at different distances from the axis so they're less likely to overlap.*/ + staggerLabels(): boolean; + /*Makes the X labels stagger at different distances from the axis so they're less likely to overlap.*/ + staggerLabels(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } - interface BulletChart extends BulletBase{ - bullet: Bullet - ticks(): any //todo; - ticks(value: any): this //todo; - noData(): any //todo; - noData(value: any): this //todo; + + interface BulletChart extends Chart{ + bullet: Bullet; + tooltip: Tooltip; + + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + markers(): (d: any) => any //todo; + markers(func: (d: any) => any): this //todo; + measures(): (d: any) => any //todo; + measures(func: (d: any) => any): this //todo; + noData(): string; + noData(value: string): this; + orient(): string; + orient(orientation: string): this; + ranges(): (d: any) => any //todo; + ranges(func: (d: any) => any): this //todo; + tickFormat(): (d: any) => string; + tickFormat(format: (d: any) => string): this; + tickFormat(format: string): this; + tickFormat(format: (d: any, i: any) => string): this; + ticks(): any[]; + ticks(...args: any[]): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; } - interface Models{ + + interface CandlestickBarChart extends Chart { + bars: CandlestickBar; + legend: Legend; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + close(): (d: any) => number; + close(func: (d: any) => number): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + high(): (d: any) => number; + high(func: (d: any) => number): this; + id(): number; + id(value: number): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + low(): (d: any) => number; + low(func: (d: any) => number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + open(): (d: any) => number; + open(func: (d: any) => number): this; + padData(): boolean; + padData(value: boolean): this; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /*Whether to display the legend or not*/ + showLegend(): boolean; + /*Whether to display the legend or not*/ + showLegend(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface CumulativeLineChart extends LineChart { + controls: Legend; + average(func: (d: any) => number): this; + average(): (d: any) => number; + noErrorCheck(value: boolean): this; + noErrorCheck(): boolean; + } + + interface DiscreteBarChart extends Chart { + discretebar: DiscreteBar; + legend: Legend; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): number; + id(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + rectClass(): string; + rectClass(value: string): this; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(): boolean; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Makes the X labels stagger at different distances from the axis so they're less likely to overlap.*/ + staggerLabels(): boolean; + /*Makes the X labels stagger at different distances from the axis so they're less likely to overlap.*/ + staggerLabels(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(): string; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(value: string): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface HistoricalBarChart extends Chart { + bars: HistoricalBar; + legend: Legend; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceX(): number[]; + /* List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceX(value: number[]): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): number; + id(value: number): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + /**/ + padData(): boolean; + /**/ + padData(value: boolean): this; + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface LineChart extends Chart { + lines: Line; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + legend: Legend; + + clearHighlights(): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(func: (d: any) => number): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(value: number): this; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(): boolean; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(): (d: any, i: number) => boolean; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(func: (d: any, i: number) => boolean): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(): number[]; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(value: number[]): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /**/ + highlightPoint(): (d: any) => boolean; + /**/ + highlightPoint(func: (d: any) => boolean): this; + id(): number; + id(value: number): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(): string; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(value: string): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(): (d: any) => boolean; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(value: boolean): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(func: (d: any) => boolean): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + /**/ + padData(): boolean; + /**/ + padData(value: boolean): this; + /**/ + padDataOuter(): number; + /**/ + padDataOuter(value: number): this; + /* Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(): (d: any) => boolean; + /*Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(func: (d: any) => boolean): this; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointxDomain(): number[]; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointDomain(value: number[]): this; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(): number[]; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(value: number[]): this; + /* Override the default scale type for the point axis*/ + pointScale(): any; + /* Override the default scale type for the point axis*/ + pointScale(value: any): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(): (d: any) => number; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(func: (d: any) => number): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(value: number): this; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(): boolean; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(): boolean; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface LinePlusBarChart extends Chart { + legend: Legend; + lines: Line; + lines2: Line; + bars: HistoricalBar; + bars2: HistoricalBar; + xAxis: Nvd3Axis; + x2Axis: Nvd3Axis; + y1Axis: Nvd3Axis; + y2Axis: Nvd3Axis; + y3Axis: Nvd3Axis; + y4Axis: Nvd3Axis; + tooltip: Tooltip; + + brushExtent(): [number, number] | [[number, number], [number, number]]; + brushExtent(value: [number, number] | [[number, number], [number, number]]) : this; + clearHighlights(): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(func: (d: any) => number): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(value: number): this; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(): boolean; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(): (d: any, i: number) => boolean; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(func: (d: any, i: number) => boolean): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + focusEnable(): boolean; + focusEnable(value: boolean): this; + focusHeight(): number; + focusHeight(value: number): this; + focusShowAxisX(): boolean; + focusShowAxisX(value: boolean): this; + focusShowAxisY(): boolean; + focusShowAxisY(value: boolean): this; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(): number[]; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(value: number[]): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /**/ + highlightPoint(): (d: any) => boolean; + /**/ + highlightPoint(func: (d: any) => boolean): this; + id(): number; + id(value: number): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(): string; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(value: string): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(): (d: any) => boolean; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(value: boolean): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(func: (d: any) => boolean): this; + /*The extra text after the label in the legend that tells what axis the series belongs to, for any series on the left axis.*/ + legendLeftAxisHint(): string; + /*The extra text after the label in the legend that tells what axis the series belongs to, for any series on the left axis.*/ + legendLeftAxisHint(value: string): this + /*The extra text after the label in the legend that tells what axis the series belongs to, for any seris on the right axis.*/ + legendRightAxisHint(): string; + /*The extra text after the label in the legend that tells what axis the series belongs to, for any seris on the right axis.*/ + legendRightAxisHint(value: string): this + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + /**/ + padData(): boolean; + /**/ + padData(value: boolean): this; + /**/ + padDataOuter(): number; + /**/ + padDataOuter(value: number): this; + /* Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(): (d: any) => boolean; + /*Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(func: (d: any) => boolean): this; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointxDomain(): number[]; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointDomain(value: number[]): this; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(): number[]; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(value: number[]): this; + /* Override the default scale type for the point axis*/ + pointScale(): any; + /* Override the default scale type for the point axis*/ + pointScale(value: any): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(): (d: any) => number; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(func: (d: any) => number): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(value: number): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(): boolean; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(): boolean; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface LineWithFocusChart extends Chart { + legend: Legend; + lines: Line; + lines2: Line; + xAxis: Nvd3Axis; + x2Axis: Nvd3Axis; + yAxis: Nvd3Axis; + y2Axis: Nvd3Axis; + tooltip: Tooltip; + + brushExtent(): [number, number] | [[number, number], [number, number]]; + brushExtent(value: [number, number] | [[number, number], [number, number]]): this; + clearHighlights(): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(func: (d: any) => number): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(value: number): this; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(): boolean; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(): (d: any, i: number) => boolean; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(func: (d: any, i: number) => boolean): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + focusHeight(): number; + focusHeight(value: number): this; + focusMargin(): Margin; + focusMargin(value: Margin): this; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(): number[]; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(value: number[]): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /**/ + highlightPoint(): (d: any) => boolean; + /**/ + highlightPoint(func: (d: any) => boolean): this; + id(): number; + id(value: number): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(): string; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(value: string): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(): (d: any) => boolean; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(value: boolean): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(func: (d: any) => boolean): this; + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + /**/ + padData(): boolean; + /**/ + padData(value: boolean): this; + /**/ + padDataOuter(): number; + /**/ + padDataOuter(value: number): this; + /* Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(): (d: any) => boolean; + /*Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(func: (d: any) => boolean): this; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointxDomain(): number[]; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointDomain(value: number[]): this; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(): number[]; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(value: number[]): this; + /* Override the default scale type for the point axis*/ + pointScale(): any; + /* Override the default scale type for the point axis*/ + pointScale(value: any): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(): (d: any) => number; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(func: (d: any) => number): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(value: number): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(): boolean; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(): boolean; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + xTickFormat(): (d: any) => string; + xTickFormat(format: (t: any) => string): this; + xTickFormat(format: string): this; + xTickFormat(format: (d: any, i: any) => string): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + yTickFormat(): (d: any) => string; + yTickFormat(format: (t: any) => string): this; + yTickFormat(format: string): this; + yTickFormat(format: (d: any, i: any) => string): this; + } + + interface MultiBarChart extends Chart { + multibar: MultiBar; + legend: Legend; + controls: Legend; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(value: string[]): this; + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(func: (d: any, i: number) => string): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Object that defines the labels for control items in the graph. For instance, in the stackedAreaChart, there are controls for making it stacked, expanded, or stream. For stacked bar charts, there is stacked and grouped.*/ + controlLabels(): any; + /*Object that defines the labels for control items in the graph. For instance, in the stackedAreaChart, there are controls for making it stacked, expanded, or stream. For stacked bar charts, there is stacked and grouped.*/ + controlLabels(value: any): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /**/ + disabled(): boolean[]; + /**/ + disabled(value: boolean[]): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(): number; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(value: number): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*.*/ + hideable(): boolean; + /**/ + hideable(value: boolean): this; + id(): number; + id(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + reduceXTicks(): boolean; + reduceXTicks(value: boolean): this; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /*Rotates the X axis labels by the specified degree.*/ + rotateLabels(): number; + /*Rotates the X axis labels by the specified degree.*/ + rotateLabels(value: number): this; + /*Whether to show extra controls or not. Extra controls include things like making mulitBar charts stacked or side by side.*/ + showControls(): boolean; + /*Whether to show extra controls or not. Extra controls include things like making mulitBar charts stacked or side by side.*/ + showControls(value: boolean): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*.*/ + stacked(): boolean; + /**/ + stacked(value: boolean): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'silhouette'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'wiggle'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'expand'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'zero'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: string): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: (data: Array<[number, number]>) => number[]): this; + /*Makes the X labels stagger at different distances from the axis so they're less likely to overlap.*/ + staggerLabels(): boolean; + /*Makes the X labels stagger at different distances from the axis so they're less likely to overlap.*/ + staggerLabels(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + + } + + interface MultiBarHorizontalChart extends Chart { + multibar: MultiBar; + legend: Legend; + controls: Legend; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(value: string[]): this; + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(func: (d: any, i: number) => string): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Object that defines the labels for control items in the graph. For instance, in the stackedAreaChart, there are controls for making it stacked, expanded, or stream. For stacked bar charts, there is stacked and grouped.*/ + controlLabels(): any; + /*Object that defines the labels for control items in the graph. For instance, in the stackedAreaChart, there are controls for making it stacked, expanded, or stream. For stacked bar charts, there is stacked and grouped.*/ + controlLabels(value: any): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /**/ + disabled(): boolean[]; + /**/ + disabled(value: boolean[]): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(): number; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(value: number): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): number; + id(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + showControls(): boolean; + /*Whether to show extra controls or not. Extra controls include things like making mulitBar charts stacked or side by side.*/ + showControls(value: boolean): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(): boolean; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*.*/ + stacked(): boolean; + /**/ + stacked(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(): string; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(value: string): this; + /*.*/ + valuePadding(): number; + /**/ + valuePadding(value: number): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /**/ + yErr(): (d: any, i: number) => number | number[]; + /**/ + yErr(func: (d: any, i: number) => number | number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + + } + //todo complete + interface MultiChart extends Chart { + lines1: Line; + lines2: Line; + bars1: HistoricalBar; + bars2: HistoricalBar; + stack1: HistoricalBar; + stack2: HistoricalBar; + xAxis: Nvd3Axis; + yAxis1: Nvd3Axis; + yAxis2: Nvd3Axis; + tooltip: Tooltip; + + brushExtent(): [number, number] | [[number, number], [number, number]]; + brushExtent(value: [number, number] | [[number, number], [number, number]]): this; + clearHighlights(): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(func: (d: any) => number): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(value: number): this; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(): boolean; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(): (d: any, i: number) => boolean; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(func: (d: any, i: number) => boolean): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + focusEnable(): boolean; + focusEnable(value: boolean): this; + focusHeight(): number; + focusHeight(value: number): this; + focusShowAxisX(): boolean; + focusShowAxisX(value: boolean): this; + focusShowAxisY(): boolean; + focusShowAxisY(value: boolean): this; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(): number[]; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(value: number[]): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /**/ + highlightPoint(): (d: any) => boolean; + /**/ + highlightPoint(func: (d: any) => boolean): this; + id(): number; + id(value: number): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(): string; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(value: string): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(): (d: any) => boolean; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(value: boolean): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(func: (d: any) => boolean): this; + /*The extra text after the label in the legend that tells what axis the series belongs to, for any series on the left axis.*/ + legendLeftAxisHint(): string; + /*The extra text after the label in the legend that tells what axis the series belongs to, for any series on the left axis.*/ + legendLeftAxisHint(value: string): this + /*The extra text after the label in the legend that tells what axis the series belongs to, for any seris on the right axis.*/ + legendRightAxisHint(): string; + /*The extra text after the label in the legend that tells what axis the series belongs to, for any seris on the right axis.*/ + legendRightAxisHint(value: string): this + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + /**/ + padData(): boolean; + /**/ + padData(value: boolean): this; + /**/ + padDataOuter(): number; + /**/ + padDataOuter(value: number): this; + /* Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(): (d: any) => boolean; + /*Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(func: (d: any) => boolean): this; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointxDomain(): number[]; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointDomain(value: number[]): this; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(): number[]; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(value: number[]): this; + /* Override the default scale type for the point axis*/ + pointScale(): any; + /* Override the default scale type for the point axis*/ + pointScale(value: any): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(): (d: any) => number; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(func: (d: any) => number): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(value: number): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(): boolean; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(): boolean; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface OhlcBarChart extends Chart { + bars: OhlcBar; + legend: Legend; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + close(): (d: any) => number; + close(func: (d: any) => number): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + high(): (d: any) => number; + high(func: (d: any) => number): this; + id(): number; + id(value: number): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + low(): (d: any) => number; + low(func: (d: any) => number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + open(): (d: any) => number; + open(func: (d: any) => number): this; + padData(): boolean; + padData(value: boolean): this; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /*Whether to display the legend or not*/ + showLegend(): boolean; + /*Whether to display the legend or not*/ + showLegend(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface ParallelCoordinatesChart extends Chart { + parallelCoordinates: ParallelCoordinates; + legend: Legend; + tooltip: Tooltip; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + dimensionData(): any + dimensionData(d:any) : this + /*D3 format for each x axis*/ + dimensionFormats(): string[]; + /*D3 format for each x axis*/ + dimensionFormats(value: string[]): this; + /*Name of each dimension, used for each axis.*/ + dimensionNames(): string[]; + /*Name of each dimension, used for each axis.*/ + dimensionNames(value: string[]): this; + /*Deprecated. Use dimensionsNames instead. */ + dimensions(): any; + /*Deprecated. Use dimensionsNames instead. .*/ + dimensions(value: any): this; + /**/ + displayBrush(): boolean; + /**/ + displayBrush(value: boolean): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*Specifies each line tension. Values between 0 and 1.*/ + lineTension(): number; + /*Specifies each line tension. Values between 0 and 1.*/ + lineTension(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /**/ + noData(): string; + /**/ + noData(value: string): this; + /**/ + showLegend(): boolean; + /**/ + showLegend(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + } + +//#endregion + + + interface Models{ + boxPlotChart(): BoxPlotChart; + bullet(): Bullet; + bulletChart(): BulletChart; + candlestickBar(): CandlestickBar; + candlestickBarChart(): CandlestickBarChart; + cumulativeLineChart(): CumulativeLineChart; + discreteBar(): DiscreteBar; + discreteBarChart(): DiscreteBarChart; historicalBar(): HistoricalBar; - historicalBarChart(bar_model?: HistoricalBar): HistoricalBarChart; - ohlcBarChart(): HistoricalBarChart; - bullet(): Bullet; - bulletChart(): BulletChart; - boxPlotChart(): BoxPlotChart; - legend(): Legend; + historicalBarChart(bar_model?: HistoricalBar): HistoricalBarChart; + ohlcBar(): OhlcBar; + ohlcBarChart(): OhlcBarChart; + legend(): Legend; + line(): Line; + lineChart(): LineChart; + linePlusBarChart(): LinePlusBarChart; + lineWithFocusChart(): LineWithFocusChart; + multiBarChart(): MultiBarChart; + multiBarHorizontalChart(): MultiBarHorizontalChart; + parallelCoordinates(): ParallelCoordinates; + parallelCoordinatesChart(): ParallelCoordinatesChart; + scatter(): Scatter; tooltip(): Tooltip; } - - interface ChartFactory { + + interface Utils { + windowResize(listener: (ev: Event) => any): void; + windowSize(): Size; + state(): State; + } + interface ChartFactory { generate: () => TChart; callback?: (chart: TChart)=> void; } - + + interface nvTooltipStatic { + show([left, top]: [number, number], content: string, gravity: string) //todo sort out use on nv.tooltip. + cleanup(): void; //todo sort out use on nv.tooltip. + } interface nvStatic{ models: Models; - tooltip: Tooltip; + tooltip: nvTooltipStatic; utils: Utils; - addGraph(factory: ChartFactory); - addGraph(generate: () => TChart, callBack?: (chart: TChart)=> void) ; + addGraph(factory: ChartFactory); + addGraph(generate: () => TChart, callBack?: (chart: TChart) => void); + log: (topic:string, value?:string)=> void } } declare var nv : nv.nvStatic; \ No newline at end of file From 493d3b6882c79289cd9597a45c287250297d5b9d Mon Sep 17 00:00:00 2001 From: Georgios Valotasios Date: Wed, 30 Dec 2015 17:51:07 +0100 Subject: [PATCH 166/441] Changed the MarkedRendere's functions return type from any to string --- marked/marked.d.ts | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/marked/marked.d.ts b/marked/marked.d.ts index 66030ed946..85103b0202 100644 --- a/marked/marked.d.ts +++ b/marked/marked.d.ts @@ -70,28 +70,28 @@ interface MarkedStatic { } interface MarkedRenderer { - code(code: string, language: string): any; - blockquote(quote: string): any; - html(html: string): any; - heading(text: string, level: number): any; - hr(): any; - list(body: string, ordered: boolean): any; - listitem(text: string): any; - paragraph(text: string): any; - table(header: string, body: string): any; - tablerow(content: string): any; + code(code: string, language: string): string; + blockquote(quote: string): string; + html(html: string): string; + heading(text: string, level: number): string; + hr(): string; + list(body: string, ordered: boolean): string; + listitem(text: string): string; + paragraph(text: string): string; + table(header: string, body: string): string; + tablerow(content: string): string; tablecell(content: string, flags: { header: boolean, align: string - }): any; - strong(text: string): any; - em(text: string): any; - codespan(code: string): any; - br(): any; - del(text: string): any; - link(href: string, title: string, text: string): any; - image(href: string, title: string, text: string): any; - text(text: string): any; + }): string; + strong(text: string): string; + em(text: string): string; + codespan(code: string): string; + br(): string; + del(text: string): string; + link(href: string, title: string, text: string): string; + image(href: string, title: string, text: string): string; + text(text: string): string; } interface MarkedParser { From 9e4b7a31d54fb69111e00daedabc2473e8e19814 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Wed, 30 Dec 2015 12:24:56 -0500 Subject: [PATCH 167/441] Changes to support authorizationParser --- restify/restify.d.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 8baf5da2d1..6fb2e6718c 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -21,6 +21,18 @@ declare module "restify" { path: string; type: string; } + + /** + * Comes from authorizationParser plugin + */ + interface requestAuthorization { + scheme: string; + credentials: string; + basic?: { + username: string; + password: string; + } + } interface Request extends http.ServerRequest { header: (key: string, defaultValue?: string) => any; @@ -37,10 +49,14 @@ declare module "restify" { secure: boolean; time: number; params: any; - - body?: any; //available when bodyParser plugin is used files?: { [name: string]: requestFileInterface }; isSecure: () => boolean; + /** available when bodyParser plugin is used */ + body?: any; + /** available when authorizationParser plugin is used */ + username?: string; + /** available when authorizationParser plugin is used */ + authorization?: requestAuthorization; } interface Response extends http.ServerResponse { From 468527700e73ca3a30ea464a84891dfbc9dea70a Mon Sep 17 00:00:00 2001 From: Marwan Aouida Date: Wed, 30 Dec 2015 19:14:39 +0100 Subject: [PATCH 168/441] updated couchbase definition to work with the latest node.js sdk 2.1.2 --- couchbase/couchbase-1.0.0-tests.ts | 21 + couchbase/couchbase-1.0.0.d.ts | 729 +++++++++++++ couchbase/couchbase-tests.ts | 32 +- couchbase/couchbase.d.ts | 1609 +++++++++++++++++----------- 4 files changed, 1767 insertions(+), 624 deletions(-) create mode 100644 couchbase/couchbase-1.0.0-tests.ts create mode 100644 couchbase/couchbase-1.0.0.d.ts diff --git a/couchbase/couchbase-1.0.0-tests.ts b/couchbase/couchbase-1.0.0-tests.ts new file mode 100644 index 0000000000..4305300eea --- /dev/null +++ b/couchbase/couchbase-1.0.0-tests.ts @@ -0,0 +1,21 @@ +/// + +import couchbase = require('couchbase'); +var db = new couchbase.Connection({ bucket: "default" }, function (err) { + if (err) throw err; + + // TS 0.9.5 bug https://typescript.codeplex.com/workitem/2035, todo: remove cast after fix + (db).set('testdoc', { name: 'Frank' }, function (err, result) { + if (err) throw err; + + var s: string = err.message; + + // TS 0.9.5 bug https://typescript.codeplex.com/workitem/2035, todo: remove cast after fix + (db).get('testdoc', function (err, result) { + if (err) throw err; + + console.log(result.value); + // {name: Frank} + }); + }); +}); \ No newline at end of file diff --git a/couchbase/couchbase-1.0.0.d.ts b/couchbase/couchbase-1.0.0.d.ts new file mode 100644 index 0000000000..3a8605b731 --- /dev/null +++ b/couchbase/couchbase-1.0.0.d.ts @@ -0,0 +1,729 @@ +// Type definitions for Couchbase Couchnode +// Project: https://github.com/couchbase/couchnode +// Definitions by: Basarat Ali Syed +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'couchbase' { + + /** + * Enumeration of all error codes. See libcouchbase documentation + * for more details on what these errors represent. + * + * @global + * @readonly + * @enum {number} + */ + export var errors: { + /** Operation was successful **/ + success: number; + + /** Authentication should continue. **/ + authContinue: number; + + /** Error authenticating. **/ + authError: number; + + /** The passed incr/decr delta was invalid. **/ + deltaBadVal: number; + + /** Object is too large to be stored on the cluster. **/ + objectTooBig: number; + + /** Server is too busy to handle your request right now. **/ + serverBusy: number; + + /** Internal libcouchbase error. **/ + cLibInternal: number; + + /** An invalid arguement was passed. **/ + cLibInvalidArgument: number; + + /** The server is out of memory. **/ + cLibOutOfMemory: number; + + /** An invalid range was specified. **/ + invalidRange: number; + + /** An unknown error occured within libcouchbase. **/ + cLibGenericError: number; + + /** A temporary error occured. Try again. **/ + temporaryError: number; + + /** The key already exists on the server. **/ + keyAlreadyExists: number; + + /** The key does not exist on the server. **/ + keyNotFound: number; + + /** Failed to open library. **/ + failedToOpenLibrary: number; + + /** Failed to find expected symbol in library. **/ + failedToFindSymbol: number; + + /** A network error occured. **/ + networkError: number; + + /** Operations were performed on the incorrect server. **/ + wrongServer: number; + + /** Operations were performed on the incorrect server. **/ + notMyVBucket: number; + + /** The document was not stored. */ + notStored: number; + + /** An unsupported operation was sent to the server. **/ + notSupported: number; + + /** An unknown command was sent to the server. **/ + unknownCommand: number; + + /** An unknown host was specified. **/ + unknownHost: number; + + /** A protocol error occured. **/ + protocolError: number; + + /** The operation timed out. **/ + timedOut: number; + + /** Error connecting to the server. **/ + connectError: number; + + /** The bucket you request was not found. **/ + bucketNotFound: number; + + /** libcouchbase is out of memory. **/ + clientOutOfMemory: number; + + /** A temporary error occured in libcouchbase. Try again. **/ + clientTemporaryError: number; + + /** A bad handle was passed. */ + badHandle: number; + + /** A server bug caused the operation to fail. **/ + serverBug: number; + + /** The host format specified is invalid. **/ + invalidHostFormat: number; + + /** Not enough nodes to meet the operations durability requirements. **/ + notEnoughNodes: number; + + /** Duplicate items. **/ + duplicateItems: number; + + /** Key mapping failed and could not match a server. **/ + noMatchingServerForKey: number; + + /** A bad environment variable was specified. **/ + badEnvironmentVariable: number; + /** Couchnode is out of memory. **/ + outOfMemory: number; + + /** Invalid arguements were passed. **/ + invalidArguments: number; + + /** An error occured while trying to schedule the operation. **/ + schedulingError: number; + + /** Not all operations completed successfully. **/ + checkResults: number; + + /** A generic error occured in Couchnode. **/ + genericError: number; + + /** The specified durability requirements could not be satisfied. **/ + durabilityFailed: number; + + /** An error occured during a RESTful operation. **/ + restError: number; + } + + /** + * Enumeration of all value encoding formats. + * + * @global + * @readonly + * @enum {number} + */ + export var format: { + /** Store as raw bytes. **/ + raw: number; + + /** Store as JSON encoded string. **/ + json: number; + + /** Store as UTF-8 encoded string. **/ + utf8: number; + + /** Automatically determine best storage format. **/ + auto: number; + }; + + /** + * The *CAS* value is a special object which indicates the current state + * of the item on the server. Each time an object is mutated on the server, the + * value is changed. CAS objects can be used in conjunction with + * mutation operations to ensure that the value on the server matches the local + * value retrieved by the client. This is useful when doing document updates + * on the server as you can ensure no changes were applied by other clients + * while you were in the process of mutating the document locally. + * + * In Couchnode, this is an opaque value. As such, you cannot generate + * CAS objects, but should rather use the values returned from a + * {@link KeyCallback}. + * + * @typedef {object} CAS + */ + export interface CAS extends Object { + } + + /** + * @class Result + * @classdesc + * The virtual class used for results of various operations. + * @private + */ + export class Result { + /** + * The CAS value for the document that was affected by the operation. + * @var {CAS} Result#cas + */ + cas: CAS; + /** + * The flags associate with the document. + * @var {integer} Result#flags + */ + flags: number; + /** + * The resulting document from the retrieval operation that was executed. + * @var {Mixed} Result#value + */ + value: any; + } + + /** + * @class CouchbaseError + * @classdesc + * The virtual class thrown for all Couchnode errors. + * @private + * @extends node#Error + */ + export interface CouchbaseError extends Error { + /** + * The error code for this error. + * @var {errors} Error#code + */ + code: number; + + /** + * The internal error that occured to cause this one. This is used to wrap + * low-level errors before throwing them from couchnode to simplify error + * handling. + * @var {(node#Error)} Error#innerError + */ + innerError: Error; + + /** + * A reason string describing the reason this error occured. This value is + * almost exclusively used for REST request errors. + * @var {string} Error#reason + */ + reason: string; + } + + /** + * Connect callback + * This callback is invoked when a connection is successfully established. + * + * @typedef {function} ConnectCallback + * + * @param {undefined|Error} error + * The error that occurred while trying to connect to the cluster. + */ + export interface ConnectCallback { + (error: CouchbaseError): any; + } + + /** + * Design Document Management callbacks + * This callback is invoked by the *DesignDoc operations. + * + * @typedef {function} DDocCallback + * + * @param {undefined|Error} error + * An error indicator. Note that this error value may be ignored, but its + * absence is indicative that the response in the *result* parameter is ok. + * If it is set, then the request likely failed. + * @param {object} result + * The result returned from the server + */ + export interface DDocCallback { + (error: CouchbaseError, result: any): any; + } + + /** + * Single-Key callbacks. + * This callback is passed to all of the single key functions. + * + * A typical use pattern is to pass the result> parameter from the + * callback as the options parameter to one of the next operations. + * + * @typedef {function} KeyCallback + * + * @param {undefined|Error} error + * The error for the operation. This can either be an Error object + * or a false value. The error contains the following fields: + * @param {Result} result + * The result of the operation that was executed. + */ + export interface KeyCallback { + (error: CouchbaseError, result: Result): any; + } + + /** + * Multi-Key callbacks + * This callback is invoked by the *Multi operations. + * It differs from the in {@linkcode KeyCallback} that the + * response object is an object of {key: response} + * where each response object contains the response for that particular + * key. + * + * @typedef {function} MultiCallback + * + * @param {undefined|Error} error + * An error indicator. Note that this error + * value may be ignored, but its absence is indicative that each + * response in the results parameter is ok. If it + * is set, then at least one of the result objects failed + * @param {Object.} results + * The results of the operation as a dictionary of keys mapped to Result + * objects. + */ + export interface MultiCallback { + (error: CouchbaseError, result: { [key: string]: Result }): any; + } + + /** + * Query callback. + * This callback is invoked by the query operations. + * + * @typedef {function} QueryCallback + * + * @param {undefined|Error} error + * An error indicator. Note that this error + * value may be ignored, but its absence is indicative that the + * response in the results parameter is ok. If it + * is set, then the request failed. + * @param {object} results + * The results returned from the server + */ + export interface QueryCallback { + (error: CouchbaseError, result: any): any; + } + + /** + * @typedef {function} StatsCallback + * + * @param {Error} error + * @param {Object.} results + * An object containing per-server, per key entries + * + * @see Connection#stats + */ + export interface StatsCallback { + (error: CouchbaseError, result: any): any; + } + + + ///////////////////////// + // Various options structures + ///////////////////////// + + export interface ConnectionOptions { + host?: any; // string | string[] + bucket?: string; + password?: string; + } + + // Not comming up with a base interface system as that is not how the original code is written. + // Use a custom base interface system has the potential to become difficult to keep up to date. + + export interface AddOptions { + expiry?: number; + flags?: number; + format?: number + persist_to?: number; + replicate_to?: number; + } + + export interface AddMultiOptionsForValue { + value: any; + expiry?: number; + flags?: number; + format?: number; + } + + export interface AddMultiOptions { + expiry?: number; + flags?: number; + format?: number + persist_to?: number; + replicate_to?: number; + + spooled?: boolean; + } + + export interface AppendOptions { + expiry?: number; + flags?: number; + format?: number; + persist_to?: number; + replicate_to?: number; + + cas: CAS; + } + + export interface AppendMultiOptionsForValue { + value: any; + cas?: CAS; + expiry?: number; + } + + export interface AppendMultiOptions { + expiry?: number; + persist_to?: number; + replicate_to?: number; + + spooled?: boolean; + } + + export interface DecrOptions { + offset?: number; + initial?: number; + + expiry?: number; + persist_to?: number; + replicate_to?: number; + } + + export interface DecrMultiOptionsForValue { + offset?: number; + initial?: number; + + expiry?: number; + } + + export interface DecrMultiOptions { + spooled?: boolean; + } + + export interface GetOptions { + expiry?: number; + format?: number; + } + + export interface GetMultiOptions { + spooled?: boolean; + format?: number; + } + + export interface GetReplicaOptions { + index?: number; + format?: number; + } + + export interface GetReplicaMultiOptions { + spooled?: boolean; + format?: number; + } + + export interface IncrOptions extends DecrOptions { } + + export interface IncrMultiOptionsForValue extends DecrMultiOptionsForValue { } + + export interface IncrMultiOptions extends DecrMultiOptions { } + + export interface LockOptions { + lockTime?: number + } + + export interface LockMultiOptions { + spooled?: boolean; + format?: number; + } + + export interface ObserveOptions { + cas: CAS; // verified not optional + } + + export interface ObserveMultiOptionsForValue { + cas: CAS; // verified not optional + } + + export interface ObserveMultiOptions { + spooled?: boolean; + } + + export interface PrependOptions { + expiry?: number; + flags?: number; + format?: number; + persist_to?: number; + replicate_to?: number; + + cas?: CAS; + } + + export interface PrependMultiOptionsFoValue { + value: any; + cas: CAS; + expiry?: number; + } + + export interface PrependMultiOptions { + spooled?: boolean; + + expiry?: number; + persist_to?: number; + replicate_to?: number; + } + + export interface RemoveOptions { + cas?: CAS; + persist_to?: number; + replicate_to?: number; + } + + export interface RemoveMultiOptionsForValue { + cas?: CAS; + } + + export interface RemoveMultiOptions { + spooled?: boolean; + + persist_to?: number; + replicate_to?: number; + } + + // Options for Replace functions follow Set Options and this is mentioned explicitly in the documentation + + export interface ReplaceOptions extends SetOptions { } + + export interface ReplaceMultiOptionsForValue extends SetMultiOptionsForValue { } + + export interface ReplaceMultiOptions extends SetMultiOptions { } + + export interface SetOptions { + expiry?: number; + flags?: number; + format?: number; + persist_to?: number; + replicate_to?: number; + + cas?: CAS; + } + + export interface SetMultiOptionsForValue { + value: any; + cas?: CAS; + expiry?: number; + flags?: number; + format?: number; + } + + export interface SetMultiOptions { + expiry?: number; + flags?: number; + format?: number + persist_to?: number; + replicate_to?: number; + + spooled?: boolean; + } + + export interface TouchOptions { + expiry?: number; + persist_to?: number; + replicate_to?: number; + + cas?: CAS; + } + + export interface UnlockOptions { + cas: CAS; // verified not optional + } + + export interface UnlockMultiOptionsForValue { + cas: CAS; // verified not optional + } + + export interface UnlockMultiOptions { + spooled?: boolean; + } + + /** + * @class + * A class representing a connection to a Couchbase cluster. + * Normally, your application should only need to create one of these per + * bucket and use it continuously. Operations are executed asynchronously + * and pipelined when possible. + * + * @desc + * Instantiate a new Connection object. Note that it is safe to perform + * operations before the connect callback is invoked. In this case, the + * operations are queued until the connection is ready (or an unrecoverable + * error has taken place). + * + * @param {Object} [options] + * A dictionary of options to use. You may pass + * other options than those defined below which correspond to the various + * options available on the Connection object (see their documentation). + * For example, it may be helpful to set timeout properties before connecting. + * @param {string|string[]} [options.host="localhost:8091"] + * A string or array of strings indicating the hosts to connect to. If the + * value is an array, all the hosts in the array will be tried until one of + * them succeeds. + * @param {string} [options.bucket="default"] + * The bucket to connect to. If not specified, the default is + * 'default'. + * @param {string} [options.password=""] + * The password for a password protected bucket. + * @param {ConnectCallback} callback + * A callback that will be invoked when the instance has completed connecting + * to the server. Note that this isn't required - however if the connection + * fails, an exception will be thrown if the callback is not provided. + * + * @example + * var couchbase = require('couchbase'); + * var db = new couchbase.Connection({}, function(err) { + * if (err) { + * console.log('Connection Error', err); + * } else { + * console.log('Connected!'); + * } + * }); + */ + export class Connection { + constructor(callback: ConnectCallback); + constructor(options: ConnectionOptions, callback: ConnectCallback); + + ///////////////////////// + // Members + ///////////////////////// + + /** + * Get information about the Couchnode version (i.e. this library) as an array + * of [versionNumber, versionString]. + * + * @member {Mixed[]} Connection#clientVersion + */ + clientVersion: any[]; + + connectionTimeout: number; + + lcbVersion: any[]; + + operationTimeout: number; + + serverNodes: string[]; + + ///////////////////////// + // Methods + ///////////////////////// + + // TODO: not sure if these methods return void. Docmentation mentions nothing. + // TODO: For "multi" key methods the documentation says callback can be either KeyCallback | MultiCallback. Sticking with MultiCallback. + // TODO: Verify that kv is not a key value and indeed is string[] e.g. getMulti , getReplicaMulti, lockMulti + + add(key: string, value: any, callback: KeyCallback): void; + add(key: string, value: any, options: AddOptions, callback: KeyCallback): void; + addMulti(kv: { [key: string]: AddMultiOptionsForValue }, options: AddMultiOptions, callback: MultiCallback): void; + + append(key: string, fragment: string, callback: KeyCallback): void; + append(key: string, fragment: string, options: AppendOptions, callback: KeyCallback): void; + append(key: string, fragment: Buffer, callback: KeyCallback): void; + append(key: string, fragment: Buffer, options: AppendOptions, callback: KeyCallback): void; + appendMulti(kv: { [key: string]: AppendMultiOptionsForValue }, options: AppendMultiOptions, callback: MultiCallback): void; + + decr(key: string, callback: KeyCallback): void; + decr(key: string, options: DecrOptions, callback: KeyCallback): void; + decrMulti(kv: { [key: string]: DecrMultiOptionsForValue }, options: DecrMultiOptions, callback: MultiCallback): void; + + get(key: string, callback: KeyCallback): void; + get(key: string, options: GetOptions, callback: KeyCallback): void; + getMulti(kv: string[], options: { [key: string]: GetMultiOptions }, callback:MultiCallback): void; + + getDesignDoc(name: string, callback: DDocCallback): void; + + getReplica(key: string, callback: KeyCallback): void; + getReplica(key: string, options: GetReplicaOptions, callback: KeyCallback): void; + getReplicaMulti(kv: string[], options: GetReplicaMultiOptions, callback: MultiCallback): void; + + incr(key: string, callback: KeyCallback): void; + incr(key: string, options: IncrOptions, callback: KeyCallback): void; + incrMulti(kv: { [key: string]: IncrMultiOptionsForValue }, options: IncrMultiOptions, callback: MultiCallback): void; + + lock(key: string, callback: KeyCallback): void; + lock(key: string, options: LockOptions, callback: KeyCallback): void; + lockMulti(kv: string[], options: { [key: string]: LockMultiOptions }, callback: MultiCallback): void; + + observe(key: string, options: ObserveOptions, callback: KeyCallback): void; + observeMulti(kv: { [key: string]: ObserveMultiOptionsForValue }, options: { [key: string]: ObserveMultiOptions }, callback: MultiCallback): void; + + on(event: string, listener: Function): void; + on(event: 'connect', listener: (err: Error) => any): void; + on(event: 'error', listener: (err: Error) => any): void; + + prepend(key: string, fragment: string, callback: KeyCallback): void; + prepend(key: string, fragment: string, options: PrependOptions, callback: KeyCallback): void; + prepend(key: string, fragment: Buffer, callback: KeyCallback): void; + prepend(key: string, fragment: Buffer, options: PrependOptions, callback: KeyCallback): void; + prependMulti(kv: { [key: string]: PrependMultiOptionsFoValue }, options: { [key: string]: PrependMultiOptions }, callback: MultiCallback): void; + + remove(key: string, callback: KeyCallback): void; + remove(key: string, options: RemoveOptions, callback: KeyCallback): void; + removeMulti(kv: { [key: string]: RemoveMultiOptionsForValue }, options: RemoveMultiOptions, callback: MultiCallback): void; + removeMulti(kv: string[], options: RemoveMultiOptions, callback: MultiCallback): void; + + removeDesignDoc(name: string, callback: DDocCallback): void; + + replace(key: string, value: any, callback: KeyCallback): void; + replace(key: string, value: any, options: ReplaceOptions, callback: KeyCallback): void; + replaceMulti(kv: { [key: string]: ReplaceMultiOptionsForValue }, options: ReplaceMultiOptions, callback: MultiCallback): void; + + set(key: string, value: any, callback: KeyCallback): void; + set(key: string, value: any, options: SetOptions, callback: KeyCallback): void; + setMulti(kv: { [key: string]: SetMultiOptionsForValue }, options: SetMultiOptions, callback: MultiCallback): void; + + setDesignDoc(name: string, data: any, callback: DDocCallback): void; + + shutdown(): void; + + stats(callback: StatsCallback): void; + stats(key: string, callback: StatsCallback): void; + + strError(code: number): string; + + touch(key: string, callback: KeyCallback): void; + touch(key: string, options: TouchOptions, callback: KeyCallback): void; + + unlock(key: string, options: UnlockOptions, callback: KeyCallback): void; + unlockMulti(kv: { [key: string]: UnlockMultiOptionsForValue }, options: { [key: string]: UnlockMultiOptions }, callback: UnlockMultiOptions): void; + + view(ddoc: string, name: string): ViewQuery; + view(ddoc: string, name: string, query: any): ViewQuery; + } + + export class ViewQuery { + firstPage(q: any, callback: Function): void; + query(q: any, callback: Function): void; + } + +} diff --git a/couchbase/couchbase-tests.ts b/couchbase/couchbase-tests.ts index 4305300eea..92864edc61 100644 --- a/couchbase/couchbase-tests.ts +++ b/couchbase/couchbase-tests.ts @@ -1,21 +1,25 @@ /// import couchbase = require('couchbase'); -var db = new couchbase.Connection({ bucket: "default" }, function (err) { - if (err) throw err; +import Cluster = couchbase.Cluster; +import ViewQuery = couchbase.ViewQuery; +import Errors = couchbase.errors; - // TS 0.9.5 bug https://typescript.codeplex.com/workitem/2035, todo: remove cast after fix - (db).set('testdoc', { name: 'Frank' }, function (err, result) { - if (err) throw err; +var cluster = new Cluster('my_connection_string'); +var clusterManager = cluster.manager(); +var bucket = cluster.openBucket('my_bucket'); +var bucketManager = bucket.manager(); - var s: string = err.message; +var query = ViewQuery.from('users', 'date') + .group_level(2) + .stale(ViewQuery.Update.BEFORE) + .limit(5) + .range([2015, 1, 2, 13, 56, 0], [2015, 1, 2, 16, 43, 57], true); - // TS 0.9.5 bug https://typescript.codeplex.com/workitem/2035, todo: remove cast after fix - (db).get('testdoc', function (err, result) { - if (err) throw err; - - console.log(result.value); - // {name: Frank} - }); - }); +bucket.query(query, (err, result) => { + if (err != null && err.code === Errors.genericError) { + // do something + } else { + // do something + } }); \ No newline at end of file diff --git a/couchbase/couchbase.d.ts b/couchbase/couchbase.d.ts index 3a8605b731..1f9121bde1 100644 --- a/couchbase/couchbase.d.ts +++ b/couchbase/couchbase.d.ts @@ -1,729 +1,1118 @@ -// Type definitions for Couchbase Couchnode +// Type definitions for Couchbase Node.js SDK 2.1.2 // Project: https://github.com/couchbase/couchnode -// Definitions by: Basarat Ali Syed +// Definitions by: Marwan Aouida // Definitions: https://github.com/borisyankov/DefinitelyTyped /// + declare module 'couchbase' { - /** - * Enumeration of all error codes. See libcouchbase documentation - * for more details on what these errors represent. - * - * @global - * @readonly - * @enum {number} - */ - export var errors: { - /** Operation was successful **/ - success: number; + import events = require('events'); + /** + * Enumeration of all error codes. See libcouchbase documentation for more details on what these errors represent. + */ + enum errors { + /** Operation was successful. **/ + success, + /** Authentication should continue. **/ - authContinue: number; - + authContinue, + /** Error authenticating. **/ - authError: number; - + authError, + /** The passed incr/decr delta was invalid. **/ - deltaBadVal: number; - + deltaBadVal, + /** Object is too large to be stored on the cluster. **/ - objectTooBig: number; - + objectTooBig, + + /** Operation was successful. **/ + serverBusy, + /** Server is too busy to handle your request right now. **/ - serverBusy: number; - - /** Internal libcouchbase error. **/ - cLibInternal: number; - + cLibInternal, + /** An invalid arguement was passed. **/ - cLibInvalidArgument: number; - + cLinInvalidArgument, + /** The server is out of memory. **/ - cLibOutOfMemory: number; - + cLibOutOfMemory, + /** An invalid range was specified. **/ - invalidRange: number; - + invalidRange, + /** An unknown error occured within libcouchbase. **/ - cLibGenericError: number; - + cLibGenericError, + /** A temporary error occured. Try again. **/ - temporaryError: number; - + temporaryError, + /** The key already exists on the server. **/ - keyAlreadyExists: number; - + keyAlreadyExists, + /** The key does not exist on the server. **/ - keyNotFound: number; - + keyNotFound, + /** Failed to open library. **/ - failedToOpenLibrary: number; - + failedToOpenLibrary, + /** Failed to find expected symbol in library. **/ - failedToFindSymbol: number; - + failedToFindSymbol, + /** A network error occured. **/ - networkError: number; - + networkError, + /** Operations were performed on the incorrect server. **/ - wrongServer: number; - + wrongServer, + /** Operations were performed on the incorrect server. **/ - notMyVBucket: number; - - /** The document was not stored. */ - notStored: number; - + notMyVBucket, + + /** The document was not stored. **/ + notSorted, + /** An unsupported operation was sent to the server. **/ - notSupported: number; - + notSupported, + /** An unknown command was sent to the server. **/ - unknownCommand: number; - + unknownCommand, + /** An unknown host was specified. **/ - unknownHost: number; - + unknownHost, + /** A protocol error occured. **/ - protocolError: number; - + protocolError, + /** The operation timed out. **/ - timedOut: number; - + timedOut, + /** Error connecting to the server. **/ - connectError: number; - + connectError, + /** The bucket you request was not found. **/ - bucketNotFound: number; - + bukcketNotFound, + /** libcouchbase is out of memory. **/ - clientOutOfMemory: number; - + clientOutOfMemory, + /** A temporary error occured in libcouchbase. Try again. **/ - clientTemporaryError: number; - - /** A bad handle was passed. */ - badHandle: number; - + clientTemporaryError, + + /** A bad handle was passed. **/ + badHandle, + /** A server bug caused the operation to fail. **/ - serverBug: number; - + serverBug, + /** The host format specified is invalid. **/ - invalidHostFormat: number; - - /** Not enough nodes to meet the operations durability requirements. **/ - notEnoughNodes: number; - + invalidHostFormat, + + /** Not enough nodes to meet the operations durability requirements. **/ + notEnoughNodes, + /** Duplicate items. **/ - duplicateItems: number; - + duplicateItems, + /** Key mapping failed and could not match a server. **/ - noMatchingServerForKey: number; - + noMatchingServerForKey, + /** A bad environment variable was specified. **/ - badEnvironmentVariable: number; + badEnvironmentVariable, + /** Couchnode is out of memory. **/ - outOfMemory: number; - + outOfMemory, + /** Invalid arguements were passed. **/ - invalidArguments: number; - + invalidArguments, + /** An error occured while trying to schedule the operation. **/ - schedulingError: number; - + schedulingError, + /** Not all operations completed successfully. **/ - checkResults: number; - + checkResults, + /** A generic error occured in Couchnode. **/ - genericError: number; - + genericError, + /** The specified durability requirements could not be satisfied. **/ - durabilityFailed: number; - + durabilityFailed, + /** An error occured during a RESTful operation. **/ - restError: number; + restError } /** - * Enumeration of all value encoding formats. - * - * @global - * @readonly - * @enum {number} + * Represents a singular cluster containing your buckets. */ - export var format: { - /** Store as raw bytes. **/ - raw: number; + class Cluster { + /** + * Create a new instance of the Cluster class. + * @param cnstr The connection string for your cluster. + * @param options The options object. + */ + constructor(cnstr?: string, options?: ClusterConstructorOptions); - /** Store as JSON encoded string. **/ - json: number; + /** + * Creates a manager allowing the management of a Couchbase cluster. + */ + manager(): ClusterManager; - /** Store as UTF-8 encoded string. **/ - utf8: number; + /** + * Open a bucket to perform operations. This will begin the handshake process immediately and operations will complete later. Subscribe to the connect event to be alerted when the connection is ready, though be aware operations can be successfully queued before this. + * @param name The name of the bucket to open. + */ + openBucket(name?: string): Bucket; - /** Automatically determine best storage format. **/ - auto: number; - }; - /** - * The *CAS* value is a special object which indicates the current state - * of the item on the server. Each time an object is mutated on the server, the - * value is changed. CAS objects can be used in conjunction with - * mutation operations to ensure that the value on the server matches the local - * value retrieved by the client. This is useful when doing document updates - * on the server as you can ensure no changes were applied by other clients - * while you were in the process of mutating the document locally. - * - * In Couchnode, this is an opaque value. As such, you cannot generate - * CAS objects, but should rather use the values returned from a - * {@link KeyCallback}. - * - * @typedef {object} CAS - */ - export interface CAS extends Object { + /** + * Open a bucket to perform operations. This will begin the handshake process immediately and operations will complete later. Subscribe to the connect event to be alerted when the connection is ready, though be aware operations can be successfully queued before this. + * @param name The name of the bucket to open. + * @param password Password for the bucket. + */ + openBucket(name?: string, password?: string): Bucket; + + /** + * Open a bucket to perform operations. This will begin the handshake process immediately and operations will complete later. Subscribe to the connect event to be alerted when the connection is ready, though be aware operations can be successfully queued before this. + * @param name The name of the bucket to open. + * @param callback Callback to invoke on connection success or failure. + */ + openBucket(name?: string, callback?: Function): Bucket; + + /** + * Open a bucket to perform operations. This will begin the handshake process immediately and operations will complete later. Subscribe to the connect event to be alerted when the connection is ready, though be aware operations can be successfully queued before this. + * @param name The name of the bucket to open. + * @param password Password for the bucket. + * @param callback Callback to invoke on connection success or failure. + */ + openBucket(name?: string, password?: string, callback?: Function): Bucket; + } + + interface ClusterConstructorOptions { + /** + * The path to the certificate to use for SSL connections + */ + certpath: string; } /** - * @class Result - * @classdesc - * The virtual class used for results of various operations. - * @private + * Class for performing management operations against a cluster. */ - export class Result { + interface ClusterManager { /** - * The CAS value for the document that was affected by the operation. - * @var {CAS} Result#cas + * + * @param name + * @param callback */ - cas: CAS; + createBucket(name: string, callback: Function); + /** - * The flags associate with the document. - * @var {integer} Result#flags + * + * @param name + * @param opts + * @param callback */ - flags: number; + createBucket(name: string, opts: any, callback: Function); + /** - * The resulting document from the retrieval operation that was executed. - * @var {Mixed} Result#value + * + * @param callback */ - value: any; + listBuckets(callback: Function); + + /** + * + * @param name + * @param callback + */ + removeBucket(name: string, callback: Function); } /** - * @class CouchbaseError - * @classdesc * The virtual class thrown for all Couchnode errors. - * @private - * @extends node#Error */ - export interface CouchbaseError extends Error { + interface CouchbaseError extends Error { /** * The error code for this error. - * @var {errors} Error#code */ - code: number; + code: errors; + } + + interface AppendOptions { + /** + * The CAS value to check. If the item on the server contains a different CAS value, the operation will fail. Note that if this option is undefined, no comparison will be performed. + */ + cas: Bucket.CAS; /** - * The internal error that occured to cause this one. This is used to wrap - * low-level errors before throwing them from couchnode to simplify error - * handling. - * @var {(node#Error)} Error#innerError + * Ensures this operation is persisted to this many nodes. */ - innerError: Error; + persist_to: number; /** - * A reason string describing the reason this error occured. This value is - * almost exclusively used for REST request errors. - * @var {string} Error#reason + * Ensures this operation is replicated to this many nodes. */ - reason: string; + replicate_to: number; } - /** - * Connect callback - * This callback is invoked when a connection is successfully established. - * - * @typedef {function} ConnectCallback - * - * @param {undefined|Error} error - * The error that occurred while trying to connect to the cluster. - */ - export interface ConnectCallback { - (error: CouchbaseError): any; + interface PrependOptions extends AppendOptions { } + + interface RemoveOptions extends AppendOptions { } + + interface ReplaceOptions extends AppendOptions { + /** + * Set the initial expiration time for the document. A value of 0 represents never expiring. + */ + expiry: number; } - /** - * Design Document Management callbacks - * This callback is invoked by the *DesignDoc operations. - * - * @typedef {function} DDocCallback - * - * @param {undefined|Error} error - * An error indicator. Note that this error value may be ignored, but its - * absence is indicative that the response in the *result* parameter is ok. - * If it is set, then the request likely failed. - * @param {object} result - * The result returned from the server - */ - export interface DDocCallback { - (error: CouchbaseError, result: any): any; - } + interface UpsertOptions extends ReplaceOptions { } - /** - * Single-Key callbacks. - * This callback is passed to all of the single key functions. - * - * A typical use pattern is to pass the result> parameter from the - * callback as the options parameter to one of the next operations. - * - * @typedef {function} KeyCallback - * - * @param {undefined|Error} error - * The error for the operation. This can either be an Error object - * or a false value. The error contains the following fields: - * @param {Result} result - * The result of the operation that was executed. - */ - export interface KeyCallback { - (error: CouchbaseError, result: Result): any; - } - - /** - * Multi-Key callbacks - * This callback is invoked by the *Multi operations. - * It differs from the in {@linkcode KeyCallback} that the - * response object is an object of {key: response} - * where each response object contains the response for that particular - * key. - * - * @typedef {function} MultiCallback - * - * @param {undefined|Error} error - * An error indicator. Note that this error - * value may be ignored, but its absence is indicative that each - * response in the results parameter is ok. If it - * is set, then at least one of the result objects failed - * @param {Object.} results - * The results of the operation as a dictionary of keys mapped to Result - * objects. - */ - export interface MultiCallback { - (error: CouchbaseError, result: { [key: string]: Result }): any; - } - - /** - * Query callback. - * This callback is invoked by the query operations. - * - * @typedef {function} QueryCallback - * - * @param {undefined|Error} error - * An error indicator. Note that this error - * value may be ignored, but its absence is indicative that the - * response in the results parameter is ok. If it - * is set, then the request failed. - * @param {object} results - * The results returned from the server - */ - export interface QueryCallback { - (error: CouchbaseError, result: any): any; - } - - /** - * @typedef {function} StatsCallback - * - * @param {Error} error - * @param {Object.} results - * An object containing per-server, per key entries - * - * @see Connection#stats - */ - export interface StatsCallback { - (error: CouchbaseError, result: any): any; - } - - - ///////////////////////// - // Various options structures - ///////////////////////// - - export interface ConnectionOptions { - host?: any; // string | string[] - bucket?: string; - password?: string; - } - - // Not comming up with a base interface system as that is not how the original code is written. - // Use a custom base interface system has the potential to become difficult to keep up to date. - - export interface AddOptions { - expiry?: number; - flags?: number; - format?: number - persist_to?: number; - replicate_to?: number; - } - - export interface AddMultiOptionsForValue { - value: any; - expiry?: number; - flags?: number; - format?: number; - } - - export interface AddMultiOptions { - expiry?: number; - flags?: number; - format?: number - persist_to?: number; - replicate_to?: number; - - spooled?: boolean; - } - - export interface AppendOptions { - expiry?: number; - flags?: number; - format?: number; - persist_to?: number; - replicate_to?: number; - - cas: CAS; - } - - export interface AppendMultiOptionsForValue { - value: any; - cas?: CAS; - expiry?: number; - } - - export interface AppendMultiOptions { - expiry?: number; - persist_to?: number; - replicate_to?: number; - - spooled?: boolean; - } - - export interface DecrOptions { - offset?: number; - initial?: number; - - expiry?: number; - persist_to?: number; - replicate_to?: number; - } - - export interface DecrMultiOptionsForValue { - offset?: number; - initial?: number; - - expiry?: number; - } - - export interface DecrMultiOptions { - spooled?: boolean; - } - - export interface GetOptions { - expiry?: number; - format?: number; - } - - export interface GetMultiOptions { - spooled?: boolean; - format?: number; - } - - export interface GetReplicaOptions { - index?: number; - format?: number; - } - - export interface GetReplicaMultiOptions { - spooled?: boolean; - format?: number; - } - - export interface IncrOptions extends DecrOptions { } - - export interface IncrMultiOptionsForValue extends DecrMultiOptionsForValue { } - - export interface IncrMultiOptions extends DecrMultiOptions { } - - export interface LockOptions { - lockTime?: number - } - - export interface LockMultiOptions { - spooled?: boolean; - format?: number; - } - - export interface ObserveOptions { - cas: CAS; // verified not optional - } - - export interface ObserveMultiOptionsForValue { - cas: CAS; // verified not optional - } - - export interface ObserveMultiOptions { - spooled?: boolean; - } - - export interface PrependOptions { - expiry?: number; - flags?: number; - format?: number; - persist_to?: number; - replicate_to?: number; - - cas?: CAS; - } - - export interface PrependMultiOptionsFoValue { - value: any; - cas: CAS; - expiry?: number; - } - - export interface PrependMultiOptions { - spooled?: boolean; - - expiry?: number; - persist_to?: number; - replicate_to?: number; - } - - export interface RemoveOptions { - cas?: CAS; - persist_to?: number; - replicate_to?: number; - } - - export interface RemoveMultiOptionsForValue { - cas?: CAS; - } - - export interface RemoveMultiOptions { - spooled?: boolean; - - persist_to?: number; - replicate_to?: number; - } - - // Options for Replace functions follow Set Options and this is mentioned explicitly in the documentation - - export interface ReplaceOptions extends SetOptions { } - - export interface ReplaceMultiOptionsForValue extends SetMultiOptionsForValue { } - - export interface ReplaceMultiOptions extends SetMultiOptions { } - - export interface SetOptions { - expiry?: number; - flags?: number; - format?: number; - persist_to?: number; - replicate_to?: number; - - cas?: CAS; - } - - export interface SetMultiOptionsForValue { - value: any; - cas?: CAS; - expiry?: number; - flags?: number; - format?: number; - } - - export interface SetMultiOptions { - expiry?: number; - flags?: number; - format?: number - persist_to?: number; - replicate_to?: number; - - spooled?: boolean; - } - - export interface TouchOptions { - expiry?: number; - persist_to?: number; - replicate_to?: number; - - cas?: CAS; - } - - export interface UnlockOptions { - cas: CAS; // verified not optional - } - - export interface UnlockMultiOptionsForValue { - cas: CAS; // verified not optional - } - - export interface UnlockMultiOptions { - spooled?: boolean; - } - - /** - * @class - * A class representing a connection to a Couchbase cluster. - * Normally, your application should only need to create one of these per - * bucket and use it continuously. Operations are executed asynchronously - * and pipelined when possible. - * - * @desc - * Instantiate a new Connection object. Note that it is safe to perform - * operations before the connect callback is invoked. In this case, the - * operations are queued until the connection is ready (or an unrecoverable - * error has taken place). - * - * @param {Object} [options] - * A dictionary of options to use. You may pass - * other options than those defined below which correspond to the various - * options available on the Connection object (see their documentation). - * For example, it may be helpful to set timeout properties before connecting. - * @param {string|string[]} [options.host="localhost:8091"] - * A string or array of strings indicating the hosts to connect to. If the - * value is an array, all the hosts in the array will be tried until one of - * them succeeds. - * @param {string} [options.bucket="default"] - * The bucket to connect to. If not specified, the default is - * 'default'. - * @param {string} [options.password=""] - * The password for a password protected bucket. - * @param {ConnectCallback} callback - * A callback that will be invoked when the instance has completed connecting - * to the server. Note that this isn't required - however if the connection - * fails, an exception will be thrown if the callback is not provided. - * - * @example - * var couchbase = require('couchbase'); - * var db = new couchbase.Connection({}, function(err) { - * if (err) { - * console.log('Connection Error', err); - * } else { - * console.log('Connected!'); - * } - * }); - */ - export class Connection { - constructor(callback: ConnectCallback); - constructor(options: ConnectionOptions, callback: ConnectCallback); - - ///////////////////////// - // Members - ///////////////////////// + interface TouchOptions { + /** + * Ensures this operation is persisted to this many nodes. + */ + persist_to: number; /** - * Get information about the Couchnode version (i.e. this library) as an array - * of [versionNumber, versionString]. - * - * @member {Mixed[]} Connection#clientVersion + * Ensures this operation is replicated to this many nodes. */ - clientVersion: any[]; + replicate_to: number; + } + interface CounterOptions { + /** + * Sets the initial value for the document if it does not exist. Specifying a value of undefined will cause the operation to fail if the document does not exist, otherwise this value must be equal to or greater than 0. + */ + initial: number; + + /** + * Set the initial expiration time for the document. A value of 0 represents never expiring. + */ + expiry: number; + + /** + * Ensures this operation is persisted to this many nodes + */ + persist_to: number; + + /** + * Ensures this operation is replicated to this many nodes + */ + replicate_to: number; + } + + interface GetAndLockOptions { + lockTime: number; + } + + interface GetReplicaOptions { + + /** + * The index for which replica you wish to retrieve this value from, or if undefined, use the value from the first server that replies. + */ + index: number; + } + + interface InsertOptions { + + /** + * Set the initial expiration time for the document. A value of 0 represents never expiring. + */ + expiry: number; + + /** + * Ensures this operation is persisted to this many nodes. + */ + persist_to: number; + + /** + * Ensures this operation is replicated to this many nodes. + */ + replicate_to: number; + } + + /** + * A class for performing management operations against a bucket. This class should not be instantiated directly, but instead through the use of the Bucket#manager method instead. + */ + interface BucketManager { + + /** + * Flushes the cluster, deleting all data stored within this bucket. Note that this method requires the Flush permission to be enabled on the bucket from the management console before it will work. + * @param callback The callback function. + */ + flush(callback: Function); + + /** + * Retrieves a specific design document from this bucket. + * @param name + * @param callback The callback function. + */ + getDesignDocument(name: string, callback: Function); + + /** + * Retrieves a list of all design documents registered to a bucket. + * @param callback The callback function. + */ + getDesignDocuments(callback: Function); + + /** + * Registers a design document to this bucket, failing if it already exists. + * @param name + * @param data + * @param callback The callback function. + * @returns {} + */ + insertDesignDocument(name: string, data: any, callback: Function); + + /** + * Unregisters a design document from this bucket. + * @param name + * @param callback The callback function. + * @returns {} + */ + removeDesignDocument(name: string, callback: Function); + + /** + * Registers a design document to this bucket, overwriting any existing design document that was previously registered. + * @param name + * @param data + * @param callback The callback function. + * @returns {} + */ + upsertDesignDocument(name: string, data: any, callback: Function); + } + + /** + * Class for dynamically construction of view queries. This class should never be constructed directly, instead you should use ViewQuery.from to construct this object. + */ + class ViewQuery { + /** + * Instantiates a ViewQuery object for the specified design document and view name. + * @param ddoc The design document to use. + * @param name The view to use. + */ + static from(ddoc: string, name: string): ViewQuery; + + /** + * Specifies the design document and view name to use for this query. + * @param ddoc The design document to use. + * @param name The view to use. + */ + from(ddoc: string, name: string): ViewQuery; + + /** + * Allows you to specify custom view options that may not be available though the fluent interface defined by this class. + * @param opts + */ + custom(opts: any): ViewQuery; + + /** + * Flag to request a view request accross all nodes in the case of a development view. + * @param full_set + */ + full_set(full_set: boolean): ViewQuery; + + /** + * Specifies whether to preform grouping during view execution. + * @param group + */ + group(group: boolean): ViewQuery; + + /** + * Specifies the level at which to perform view grouping. + * @param group_level + */ + group_level(group_level: number): ViewQuery; + + /** + * Specifies a range of document id's to retrieve from the index. + * @param start + * @param end + */ + id_range(start: any, end: any): ViewQuery; + + /** + * Flag to request a view request include the full document value. + * @param include_docs + */ + include_docs(include_docs: boolean): ViewQuery; + + /** + * Specifies a specified key to retrieve from the index. + * @param key + */ + key(key: any): ViewQuery; + + /** + * Specifies a list of keys you wish to retrieve from the index. + * @param keys + */ + keys(key: any[]): ViewQuery; + + /** + * Specifies the maximum number of results to return. + * @param limit + */ + limit(limit: number): ViewQuery; + + /** + * Sets the error handling mode for this query. + * @param mode + */ + on_error(mode: ViewQuery.ErrorMode): ViewQuery; + + /** + * Specifies the desired ordering for the results. + * @param order + */ + order(order: ViewQuery.Order): ViewQuery; + + /** + * Specifies a range of keys to retrieve from the index. You may specify both a start and an end point and additionally specify whether or not the end value is inclusive or exclusive. + * @param start + * @param end + * @param inclusive_end + */ + range(start: any | any[], end: any | any[], inclusive_end?: boolean): ViewQuery; + + /** + * Specifies whether to execute the map-reduce reduce step. + * @param reduce + */ + reduce(reduce: boolean): ViewQuery; + + /** + * Specifies how many results to skip from the beginning of the result set. + * @param skip + */ + skip(skip: number): ViewQuery; + + /** + * Specifies how this query will affect view indexing, both before and after the query is executed. + * @param stale + */ + stale(stale: ViewQuery.Update): ViewQuery; + } + + module ViewQuery { + /** + * Enumeration for specifying on_error behaviour. + */ + enum ErrorMode { + /** + * Continues querying when an error occurs. + */ + CONTINUE, + + /** + * Stops and errors query when an error occurs. + */ + STOP + } + + /** + * Enumeration for specifying view result ordering. + */ + enum Order { + /** + * Orders with lower values first and higher values last. + */ + ASCENDING, + + /** + * Orders with higher values first and lower values last. + */ + DESCENDING + } + + /** + * Enumeration for specifying view update semantics. + */ + enum Update { + /** + * Causes the view to be fully indexed before results are retrieved. + */ + BEFORE, + + /** + * Allows the index to stay in whatever state it is already in prior retrieval of the query results. + */ + NONE, + + /** + * Forces the view to be indexed after the results of this query has been fetched. + */ + AFTER + } + } + + /** + * Class for dynamically construction of N1QL queries. This class should never be constructed directly, instead you should use the N1qlQuery.fromString static method to instantiate a N1qlStringQuery. + */ + class N1qlQuery { + /** + * Creates a query object directly from the passed query string. + * @param str + */ + static fromString(str: string): N1qlStringQuery; + + /** + * Returns the fully prepared string representation of this query. + */ + toString(): string; + } + + module N1qlQuery { + /** + * Enumeration for specifying N1QL consistency semantics. + */ + enum Consistency { + /** + * This is the default (for single-statement requests). + */ + NOT_BOUND, + + /** + * This implements strong consistency per request. + */ + REQUEST_PLUS, + + /** + * This implements strong consistency per statement. + */ + STATEMENT_PLUS + } + } + + /** + * Class for holding a explicitly defined N1QL query string. + */ + class N1qlStringQuery extends N1qlQuery { + /** + * Specifies whether this query is adhoc or should be prepared. + * @param adhoc + */ + adhoc(adhoc: boolean): N1qlStringQuery; + + /** + * Specify the consistency level for this query. + * @param val + */ + consistency(val: N1qlQuery.Consistency): N1qlStringQuery; + + /** + * Returns the fully prepared object representation of this query. + */ + toObject(): any; + + /** + * Returns the fully prepared string representation of this query. + */ + toString(): string; + } + + /** + * Class for dynamically construction of spatial queries. This class should never be constructed directly, instead you should use SpatialQuery.from to construct this object. + */ + class SpatialQuery { + /** + * Instantiates a SpatialQuery object for the specified design document and view name. + * @param ddoc The design document to use. + * @param name The view to use. + */ + static from(ddoc: string, name: string): SpatialQuery; + + /** + * Specifies the design document and view name to use for this query. + * @param ddoc + * @param name + */ + from(ddoc: string, name: string): SpatialQuery; + + /** + * Specifies a bounding box to query the index for. This value must be an array of exactly 4 numbers which represents the left, top, right and bottom edges of the bounding box (in that order). + * @param bbox + */ + bbox(bbox: number[]): SpatialQuery; + + /** + * Allows you to specify custom view options that may not be available though the fluent interface defined by this class. + * @param opts + */ + custom(opts: any): SpatialQuery; + + /** + * Specifies the maximum number of results to return. + * @param limit + */ + limit(limit: number): SpatialQuery; + + /** + * Specifies how many results to skip from the beginning of the result set. + * @param skip + */ + skip(skip: number): SpatialQuery; + + /** + * Specifies how this query will affect view indexing, both before and after the query is executed. + * @param stale + */ + stale(stale: SpatialQuery.Update): SpatialQuery; + } + + module SpatialQuery { + /** + * Enumeration for specifying view update semantics. + */ + enum Update { + /** + * Causes the view to be fully indexed before results are retrieved. + */ + BEFORE, + + /** + * Allows the index to stay in whatever state it is already in prior retrieval of the query results. + */ + NONE, + + /** + * Forces the view to be indexed after the results of this query has been fetched. + */ + AFTER + } + } + + /** + * The Bucket class represents a connection to a Couchbase bucket. Never instantiate this class directly. Instead use the Cluster#openBucket method instead. + */ + interface Bucket { + /** + * Returns the version of the Node.js library as a string. + */ + clientVersion: string; + + /** + * Gets or sets the config throttling in milliseconds. The config throttling is the time that Bucket will wait before forcing a configuration refresh. If no refresh occurs before this period while a configuration is marked invalid, an update will be triggered. + */ + configThrottle: number; + + /** + * Sets or gets the connection timeout in milliseconds. This is the timeout value used when connecting to the configuration port during the initial connection (in this case, use this as a key in the 'options' parameter in the constructor) and/or when Bucket attempts to reconnect in-situ (if the current connection has failed). + */ connectionTimeout: number; - lcbVersion: any[]; + /** + * Gets or sets the durability interval in milliseconds. The durability interval is the time that Bucket will wait between requesting new durability information during a durability poll. + */ + durabilityInterval: number; + /** + * Gets or sets the durability timeout in milliseconds. The durability timeout is the time that Bucket will wait for a response from the server in regards to a durability request. If there are no responses received within this time frame, the request fails with an error. + */ + durabilityTimeout: number; + + /** + * Returns the libcouchbase version as a string. This information will usually be in the format of 2.4.0-fffffff representing the major, minor, patch and git-commit that the built libcouchbase is based upon. + */ + lcbVersion: string; + + /** + * Gets or sets the management timeout in milliseconds. The management timeout is the time that Bucket will wait for a response from the server for a management request. If the response is not received within this time frame, the request is failed out with an error. + */ + managementTimeout: number; + + /** + * Sets or gets the node connection timeout in msecs. This value is similar to Bucket#connectionTimeout, but defines the time to wait for a particular node to respond before trying the next one. + */ + nodeConnectionTimeout: number; + + /** + * Gets or sets the operation timeout in milliseconds. The operation timeout is the time that Bucket will wait for a response from the server for a CRUD operation. If the response is not received within this time frame, the operation is failed with an error. + */ operationTimeout: number; - serverNodes: string[]; + /** + * Gets or sets the view timeout in milliseconds. The view timeout is the time that Bucket will wait for a response from the server for a view request. If the response is not received within this time frame, the request fails with an error. + */ + viewTimeout: number; - ///////////////////////// - // Methods - ///////////////////////// + /** + * Similar to Bucket#upsert, but instead of setting a new key, it appends data to the existing key. Note that this function only makes sense when the stored data is a string; 'appending' to a JSON document may result in parse errors when the document is later retrieved. + * @param key The target document key. + * @param fragment The document's contents to append. + * @param callback The callback function. + */ + append(key: any | Buffer, fragment: any, callback: Bucket.OpCallback); - // TODO: not sure if these methods return void. Docmentation mentions nothing. - // TODO: For "multi" key methods the documentation says callback can be either KeyCallback | MultiCallback. Sticking with MultiCallback. - // TODO: Verify that kv is not a key value and indeed is string[] e.g. getMulti , getReplicaMulti, lockMulti + /** + * + * @param key The target document key. + * @param fragment The document's contents to append. + * @param options The options object. + * @param callback The callback function. + */ + append(key: any | Buffer, fragment: any, options: AppendOptions, callback: Bucket.OpCallback); - add(key: string, value: any, callback: KeyCallback): void; - add(key: string, value: any, options: AddOptions, callback: KeyCallback): void; - addMulti(kv: { [key: string]: AddMultiOptionsForValue }, options: AddMultiOptions, callback: MultiCallback): void; + /** + * Increments or decrements a key's numeric value. + * Note that JavaScript does not support 64-bit integers (while libcouchbase and the server do). You might receive an inaccurate value if the number is greater than 53-bits (JavaScript's maximum integer precision). + * @param key The target document key. + * @param delta The amount to add or subtract from the counter value. This value may be any non-zero integer. + * @param callback The callback function. + */ + counter(key: any | Buffer, delta: number, callback: Bucket.OpCallback); + + /** + * + * @param key The target document key. + * @param delta The amount to add or subtract from the counter value. This value may be any non-zero integer. + * @param options The options object. + * @param callback The callback function. + */ + counter(key: any | Buffer, delta: number, options: CounterOptions, callback: Bucket.OpCallback); - append(key: string, fragment: string, callback: KeyCallback): void; - append(key: string, fragment: string, options: AppendOptions, callback: KeyCallback): void; - append(key: string, fragment: Buffer, callback: KeyCallback): void; - append(key: string, fragment: Buffer, options: AppendOptions, callback: KeyCallback): void; - appendMulti(kv: { [key: string]: AppendMultiOptionsForValue }, options: AppendMultiOptions, callback: MultiCallback): void; + /** + * Shuts down this connection. + */ + disconnect(): void; - decr(key: string, callback: KeyCallback): void; - decr(key: string, options: DecrOptions, callback: KeyCallback): void; - decrMulti(kv: { [key: string]: DecrMultiOptionsForValue }, options: DecrMultiOptions, callback: MultiCallback): void; + /** + * Enables N1QL support on the client. A cbq-server URI must be passed. This method will be deprecated in the future in favor of automatic configuration through the connected cluster. + * @param hosts An array of host/port combinations which are N1QL servers attached to this cluster. + */ + enableN1ql(hosts: string | string[]); - get(key: string, callback: KeyCallback): void; - get(key: string, options: GetOptions, callback: KeyCallback): void; - getMulti(kv: string[], options: { [key: string]: GetMultiOptions }, callback:MultiCallback): void; + /** + * Retrieves a document. + * @param key The target document key. + * @param callback The callback function. + */ + get(key: any | Buffer, callback: Bucket.OpCallback); - getDesignDoc(name: string, callback: DDocCallback): void; + /** + * @param key The target document key. + * @param options The options object. + * @param callback The callback function. + */ + get(key: any | Buffer, options: any, callback: Bucket.OpCallback); - getReplica(key: string, callback: KeyCallback): void; - getReplica(key: string, options: GetReplicaOptions, callback: KeyCallback): void; - getReplicaMulti(kv: string[], options: GetReplicaMultiOptions, callback: MultiCallback): void; + /** + * Lock the document on the server and retrieve it. When an document is locked, its CAS changes and subsequent operations on the document (without providing the current CAS) will fail until the lock is no longer held. + * This function behaves identically to Bucket#get in that it will return the value. It differs in that the document is also locked. This ensures that attempts by other client instances to access this document while the lock is held will fail. + * Once locked, a document can be unlocked either by explicitly calling Bucket#unlock or by performing a storage operation (e.g. Bucket#upsert, Bucket#replace, Bucket::append) with the current CAS value. Note that any other lock operations on this key will fail while a document is locked. + * @param key The target document key. + * @param callback The callback function. + */ + getAndLock(key: any, callback: Bucket.OpCallback); - incr(key: string, callback: KeyCallback): void; - incr(key: string, options: IncrOptions, callback: KeyCallback): void; - incrMulti(kv: { [key: string]: IncrMultiOptionsForValue }, options: IncrMultiOptions, callback: MultiCallback): void; + /** + * Lock the document on the server and retrieve it. When an document is locked, its CAS changes and subsequent operations on the document (without providing the current CAS) will fail until the lock is no longer held. + * This function behaves identically to Bucket#get in that it will return the value. It differs in that the document is also locked. This ensures that attempts by other client instances to access this document while the lock is held will fail. + * Once locked, a document can be unlocked either by explicitly calling Bucket#unlock or by performing a storage operation (e.g. Bucket#upsert, Bucket#replace, Bucket::append) with the current CAS value. Note that any other lock operations on this key will fail while a document is locked. + * @param key The target document key. + * @param options The options object. + * @param callback The callback function. + * @returns {} + */ + getAndLock(key: any, options: GetAndLockOptions, callback: Bucket.OpCallback); - lock(key: string, callback: KeyCallback): void; - lock(key: string, options: LockOptions, callback: KeyCallback): void; - lockMulti(kv: string[], options: { [key: string]: LockMultiOptions }, callback: MultiCallback): void; + /** + * Retrieves a document and updates the expiry of the item at the same time. + * @param key The target document key. + * @param expiry The expiration time to use. If a value of 0 is provided, then the current expiration time is cleared and the key is set to never expire. Otherwise, the key is updated to expire in the time provided (in seconds). + * @param options The options object. + * @param callback The callback function. + */ + getAndTouch(key: any | Buffer, expiry: number, options: any, callback: Bucket.OpCallback); + + /** + * Retrieves a document and updates the expiry of the item at the same time. + * @param key The target document key. + * @param expiry The expiration time to use. If a value of 0 is provided, then the current expiration time is cleared and the key is set to never expire. Otherwise, the key is updated to expire in the time provided (in seconds). + * @param callback The callback function. + */ + getAndTouch(key: any | Buffer, expiry: number, callback: Bucket.OpCallback); - observe(key: string, options: ObserveOptions, callback: KeyCallback): void; - observeMulti(kv: { [key: string]: ObserveMultiOptionsForValue }, options: { [key: string]: ObserveMultiOptions }, callback: MultiCallback): void; + /** + * Retrieves a list of keys + * @param keys The target document keys. + * @param callback The callback function. + */ + getMulti(key: any[] | Buffer[], callback: Bucket.MultiGetCallback); - on(event: string, listener: Function): void; - on(event: 'connect', listener: (err: Error) => any): void; - on(event: 'error', listener: (err: Error) => any): void; + /** + * Get a document from a replica server in your cluster. + * @param key The target document key. + * @param callback The callback function. + */ + getReplica(key: any | Buffer, callback: Bucket.OpCallback); - prepend(key: string, fragment: string, callback: KeyCallback): void; - prepend(key: string, fragment: string, options: PrependOptions, callback: KeyCallback): void; - prepend(key: string, fragment: Buffer, callback: KeyCallback): void; - prepend(key: string, fragment: Buffer, options: PrependOptions, callback: KeyCallback): void; - prependMulti(kv: { [key: string]: PrependMultiOptionsFoValue }, options: { [key: string]: PrependMultiOptions }, callback: MultiCallback): void; + /** + * Get a document from a replica server in your cluster. + * @param key The target document key. + * @param options The options object. + * @param callback The callback function. + */ + getReplica(key: any | Buffer, options: GetReplicaOptions, callback: Bucket.OpCallback); - remove(key: string, callback: KeyCallback): void; - remove(key: string, options: RemoveOptions, callback: KeyCallback): void; - removeMulti(kv: { [key: string]: RemoveMultiOptionsForValue }, options: RemoveMultiOptions, callback: MultiCallback): void; - removeMulti(kv: string[], options: RemoveMultiOptions, callback: MultiCallback): void; + /** + * Identical to Bucket#upsert but will fail if the document already exists. + * @param key The target document key. + * @param value The document's contents. + * @param callback The callback function. + */ + insert(key: any | Buffer, value: any, callback: Bucket.OpCallback); + + /** + * Identical to Bucket#upsert but will fail if the document already exists. + * @param key The target document key. + * @param value The document's contents. + * @param options The options object. + * @param callback The callback function. + */ + insert(key: any | Buffer, value: any, options: InsertOptions, callback: Bucket.OpCallback); - removeDesignDoc(name: string, callback: DDocCallback): void; + /** + * Returns an instance of a BuckerManager for performing management operations against a bucket. + */ + manager(): BucketManager; - replace(key: string, value: any, callback: KeyCallback): void; - replace(key: string, value: any, options: ReplaceOptions, callback: KeyCallback): void; - replaceMulti(kv: { [key: string]: ReplaceMultiOptionsForValue }, options: ReplaceMultiOptions, callback: MultiCallback): void; + /** + * Like Bucket#append, but prepends data to the existing value. + * @param key The target document key. + * @param fragment The document's contents to prepend. + * @param callback The callback function. + */ + prepend(key: any, fragment: any, callback: Bucket.OpCallback); - set(key: string, value: any, callback: KeyCallback): void; - set(key: string, value: any, options: SetOptions, callback: KeyCallback): void; - setMulti(kv: { [key: string]: SetMultiOptionsForValue }, options: SetMultiOptions, callback: MultiCallback): void; + /** + * Like Bucket#append, but prepends data to the existing value. + * @param key The target document key. + * @param fragment The document's contents to prepend. + * @param options The options object. + * @param callback The callback function. + */ + prepend(key: any, fragment: any, options: PrependOptions, callback: Bucket.OpCallback); - setDesignDoc(name: string, data: any, callback: DDocCallback): void; + /** + * Executes a previously prepared query object. This could be a ViewQuery or a N1qlQuery. + * Note: N1qlQuery queries are currently an uncommitted interface and may be subject to change in 2.0.0's final release. + * @param query The query to execute. + * @param callback The callback function. + */ + query(query: ViewQuery | N1qlQuery, callback: Bucket.QueryCallback): Bucket.ViewQueryResponse | Bucket.N1qlQueryResponse; - shutdown(): void; + /** + * Executes a previously prepared query object. This could be a ViewQuery or a N1qlQuery. + * Note: N1qlQuery queries are currently an uncommitted interface and may be subject to change in 2.0.0's final release. + * @param query The query to execute. + * @param params A list or map to do replacements on a N1QL query. + * @param callback The callback function. + */ + query(query: ViewQuery | N1qlQuery, params: Object | Array, callback: Bucket.QueryCallback): Bucket.ViewQueryResponse | Bucket.N1qlQueryResponse; - stats(callback: StatsCallback): void; - stats(key: string, callback: StatsCallback): void; + /** + * Deletes a document on the server. + * @param key The target document key. + * @param callback The callback function. + */ + remove(key: any | Buffer, callback: Bucket.OpCallback); - strError(code: number): string; + /** + * Deletes a document on the server. + * @param key The target document key. + * @param options The options object. + * @param callback The callback function. + */ + remove(key: any | Buffer, options: RemoveOptions, callback: Bucket.OpCallback); - touch(key: string, callback: KeyCallback): void; - touch(key: string, options: TouchOptions, callback: KeyCallback): void; + /** + * Identical to Bucket#upsert, but will only succeed if the document exists already (i.e. the inverse of Bucket#insert). + * @param key The target document key. + * @param value The document's contents. + * @param callback The callback function. + */ + replace(key: any | Buffer, value: any, callback: Bucket.OpCallback); - unlock(key: string, options: UnlockOptions, callback: KeyCallback): void; - unlockMulti(kv: { [key: string]: UnlockMultiOptionsForValue }, options: { [key: string]: UnlockMultiOptions }, callback: UnlockMultiOptions): void; + /** + * Identical to Bucket#upsert, but will only succeed if the document exists already (i.e. the inverse of Bucket#insert). + * @param key The target document key. + * @param value The document's contents. + * @param options The options object. + * @param callback The callback function. + */ + replace(key: any | Buffer, value: any, options: ReplaceOptions, callback: Bucket.OpCallback); - view(ddoc: string, name: string): ViewQuery; - view(ddoc: string, name: string, query: any): ViewQuery; + /** + * Configures a custom set of transcoder functions for encoding and decoding values that are being stored or retreived from the server. + * @param encoder The function for encoding. + * @param decoder The function for decoding. + */ + setTranscoder(encoder: Bucket.EncoderFunction, decoder: Bucket.DecoderFunction); + + /** + * Update the document expiration time. + * @param key The target document key. + * @param expiry The expiration time to use. If a value of 0 is provided, then the current expiration time is cleared and the key is set to never expire. Otherwise, the key is updated to expire in the time provided (in seconds). Values larger than 302460*60 seconds (30 days) are interpreted as absolute times (from the epoch). + * @param options The options object. + * @param callback The callback function. + */ + touch(key: any | Buffer, expiry: number, options: TouchOptions, callback: Bucket.OpCallback); + + /** + * Unlock a previously locked document on the server. See the Bucket#lock method for more details on locking. + * @param key The target document key. + * @param cas The CAS value returned when the key was locked. This operation will fail if the CAS value provided does not match that which was the result of the original lock operation. + * @param callback The callback function. + */ + unlock(key: any | Buffer, cas: Bucket.CAS, callback: Bucket.OpCallback); + + /** + * Unlock a previously locked document on the server. See the Bucket#lock method for more details on locking. + * @param key The target document key. + * @param cas The CAS value returned when the key was locked. This operation will fail if the CAS value provided does not match that which was the result of the original lock operation. + * @param options The options object. + * @param callback The callback function. + */ + unlock(key: any | Buffer, cas: Bucket.CAS, options: any, callback: Bucket.OpCallback); + + /** + * Stores a document to the bucket. + * @param key The target document key. + * @param value The document's contents. + * @param callback The callback function. + */ + upsert(key: any | Buffer, value: any, callback: Bucket.OpCallback); + + /** + * Stores a document to the bucket. + * @param key The target document key. + * @param value The document's contents. + * @param options The options object. + * @param callback The callback function. + */ + upsert(key: any | Buffer, value: any, options: UpsertOptions, callback: Bucket.OpCallback); } - export class ViewQuery { - firstPage(q: any, callback: Function): void; - query(q: any, callback: Function): void; - } + module Bucket { + + /** + * his is used as a callback from executed queries. It is a shortcut method that automatically subscribes to the rows and error events of the Bucket.ViewQueryResponse. + */ + interface QueryCallback { + /** + * @param error The error for the operation. This can either be an Error object or a falsy value. + * @param rows The rows returned from the query. + * @param meta The metadata returned by the query. + */ + (error: CouchbaseError, rows: any[], meta: Bucket.ViewQueryResponse.Meta); + } -} + /** + * Single-Key callbacks. + * This callback is passed to all of the single key functions. + * It returns a result objcet containing a combination of a CAS and a value, depending on which operation was invoked. + */ + interface OpCallback { + /** + * @param error The error for the operation. This can either be an Error object or a value which evaluates to false (null, undefined, 0 or false). + * @param result The result of the operation that was executed. This usually contains at least a cas property, and on some operations will contain a value property as well. + */ + (error: CouchbaseError | number, result: any); + } + + /** + * Multi-Get Callback. + * This callback is used to return results from a getMulti operation. + */ + interface MultiGetCallback { + /** + * @param error The number of keys that failed to be retrieved. The precise errors are available by checking the error property of the individual documents. + * @param results This is a map of keys to results. The result for each key will optionally contain an error if one occured, or if no error occured will contain the CAS and value of the document. + */ + (error: number, results: any[]); + } + + /** + * Transcoder Encoding Function. + * This function will receive a value when a storage operation is invoked that needs to encode user-provided data for storage into Couchbase. It expects to be returned a Buffer object to store along with an integer representing any flag metadata relating to how to decode the key later using the matching DecoderFunction. + */ + interface EncoderFunction { + /** + * Transcoder Encoding Function. + * This function will receive a value when a storage operation is invoked that needs to encode user-provided data for storage into Couchbase. It expects to be returned a Buffer object to store along with an integer representing any flag metadata relating to how to decode the key later using the matching DecoderFunction. + * @param value The value needing encoding. + */ + (value: any): Bucket.TranscoderDoc; + } + + /** + * Transcoder Decoding Function. + * This function will receive an object containing a Buffer value and an integer value representing any flags metadata whenever a retrieval operation is executed. It is expected that this function will return a value representing the original value stored and encoded with its matching EncoderFunction. + */ + interface DecoderFunction { + /** + * + * @param doc The data from Couchbase to decode. + */ + (doc: Bucket.TranscoderDoc): any + } + + /** + * The CAS value is a special object that indicates the current state of the item on the server. Each time an object is mutated on the server, the value is changed. CAS objects can be used in conjunction with mutation operations to ensure that the value on the server matches the local value retrieved by the client. This is useful when doing document updates on the server as you can ensure no changes were applied by other clients while you were in the process of mutating the document locally. + * In the Node.js SDK, the CAS is represented as an opaque value. As such,y ou cannot generate CAS objects, but should rather use the values returned from a Bucket.OpCallback. + */ + interface CAS { + + } + + /** + * An event emitter allowing you to bind to various query result set events. + */ + interface N1qlQueryResponse extends events.EventEmitter { + + } + + module N1qlQueryResponse { + /** + * The meta-information available from a view query response. + */ + interface Meta { + /** + * The identifier for this query request. + */ + requestID: number; + } + } + + /** + * A class used in relation to transcoders. + */ + class TranscoderDoc { + value: Buffer; + flags: number; + } + + /** + * An event emitter allowing you to bind to various query result set events. + */ + interface ViewQueryResponse extends events.EventEmitter { + + } + + module ViewQueryResponse { + /** + * The meta-information available from a view query response. + */ + interface Meta { + /** + * The total number of rows available in the index of the view that was queried. + */ + total_rows: number; + } + } + } +} \ No newline at end of file From f869c1eaefa23e1ea2a69d0dbf47ab2a05192d9b Mon Sep 17 00:00:00 2001 From: Tom Dietrich Date: Wed, 30 Dec 2015 15:17:33 -0500 Subject: [PATCH 169/441] Make properties of IOptions optional. According to the [documentation](http://www.jointjs.com/api#joint.dia.Paper), the options **may** contain any of these properties, and as such they should not be required by the interface. --- jointjs/jointjs.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jointjs/jointjs.d.ts b/jointjs/jointjs.d.ts index 1c7e915715..cbabf0095a 100644 --- a/jointjs/jointjs.d.ts +++ b/jointjs/jointjs.d.ts @@ -60,12 +60,12 @@ declare module joint { } interface IOptions { - width: number; - height: number; - gridSize: number; - perpendicularLinks: boolean; - elementView: ElementView; - linkView: LinkView; + width?: number; + height?: number; + gridSize?: number; + perpendicularLinks?: boolean; + elementView?: ElementView; + linkView?: LinkView; } class Paper extends Backbone.View { From b289c6d249ec45a3cd1696a85c8e66614577be3d Mon Sep 17 00:00:00 2001 From: PjMitchell Date: Wed, 30 Dec 2015 20:51:19 +0000 Subject: [PATCH 170/441] Finished Nvd3 definitions... for now --- nvd3/nvd3-test-pie.ts | 71 ++ nvd3/nvd3-test-pieChart.ts | 110 ++ nvd3/nvd3-test-scatterChart.ts | 66 ++ nvd3/nvd3-test-scatterPlusLineChart.ts | 53 + nvd3/nvd3-test-sparkLine.ts | 27 + nvd3/nvd3-test-sparkLinePlus.ts | 54 + nvd3/nvd3-test-stackArea.ts | 96 ++ nvd3/nvd3-test-stackAreaChart.ts | 79 ++ nvd3/nvd3-test-sunburst.ts | 402 +++++++ nvd3/nvd3-test-timeSeries.ts | 167 +++ nvd3/nvd3.d.ts | 1467 +++++++++++++++++------- 11 files changed, 2155 insertions(+), 437 deletions(-) create mode 100644 nvd3/nvd3-test-pie.ts create mode 100644 nvd3/nvd3-test-pieChart.ts create mode 100644 nvd3/nvd3-test-scatterChart.ts create mode 100644 nvd3/nvd3-test-scatterPlusLineChart.ts create mode 100644 nvd3/nvd3-test-sparkLine.ts create mode 100644 nvd3/nvd3-test-sparkLinePlus.ts create mode 100644 nvd3/nvd3-test-stackArea.ts create mode 100644 nvd3/nvd3-test-stackAreaChart.ts create mode 100644 nvd3/nvd3-test-sunburst.ts create mode 100644 nvd3/nvd3-test-timeSeries.ts diff --git a/nvd3/nvd3-test-pie.ts b/nvd3/nvd3-test-pie.ts new file mode 100644 index 0000000000..1a0270a206 --- /dev/null +++ b/nvd3/nvd3-test-pie.ts @@ -0,0 +1,71 @@ +/// +/// +module nvd3_test_pie { + + var testdata = [ + { key: "One", y: 5 }, + { key: "Two", y: 2 }, + { key: "Three", y: 9 }, + { key: "Four", y: 7 }, + { key: "Five", y: 4 }, + { key: "Six", y: 3 }, + { key: "Seven", y: 0.5 } + ]; + + var width = 300; + var height = 300; + + nv.addGraph(function () { + var chart = nv.models.pie() + .x(function (d) { return d.key; }) + .y(function (d) { return d.y; }) + .width(width) + .height(height) + .labelType(function (d, i, values) { + return values.key + ':' + values.value; + }) + ; + + d3.select("#test1") + .datum([testdata]) + .transition().duration(1200) + .attr('width', width) + .attr('height', height) + .call(chart); + + // LISTEN TO CLICK EVENTS ON THE PIE CONTAINER + // chart.dispatch.on('chartClick', function() { + // code... + // }); + + // LISTEN TO CLICK EVENTS ON THE SLICES OF THE PIE + // chart.dispatch.on('elementClick', function() { + // code... + // }); + + // OTHER EVENTS DISPATCHED BY THE PIE INCLUDE: elementDblClick, elementMouseover, elementMouseout, elementMousemove, renderEnd + // @see nv.models.pie + return chart; + }); + + nv.addGraph(function () { + var chart = nv.models.pie() + .x(function (d) { return d.key; }) + .y(function (d) { return d.y; }) + .width(width) + .height(height) + .labelType('percent') + .valueFormat(d3.format('%')) + .donut(true); + + d3.select("#test2") + .datum([testdata]) + .transition().duration(1200) + .attr('width', width) + .attr('height', height) + .call(chart); + + return chart; + }); + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-pieChart.ts b/nvd3/nvd3-test-pieChart.ts new file mode 100644 index 0000000000..688da56ffd --- /dev/null +++ b/nvd3/nvd3-test-pieChart.ts @@ -0,0 +1,110 @@ +/// +/// +module nvd3_test_pieChart { + + var testdata = [ + { key: "One", y: 5, color: "#5F5" }, + { key: "Two", y: 2 }, + { key: "Three", y: 9 }, + { key: "Four", y: 7 }, + { key: "Five", y: 4 }, + { key: "Six", y: 3 }, + { key: "Seven", y: 0.5 } + ]; + var testdata2 = [ + { key: "One", y: 5 }, + { key: "Two", y: 2 }, + { key: "Three", y: 9 }, + { key: "Four", y: 7 }, + { key: "Five", y: 4 }, + { key: "Six", y: 3 }, + { key: "Seven", y: 0.5 } + ]; + + var height = 350; + var width = 350; + + nv.addGraph(function () { + var chart = nv.models.pieChart() + .x(function (d) { return d.key }) + .y(function (d) { return d.y }) + .width(width) + .height(height); + + d3.select("#test1") + .datum(testdata2) + .transition().duration(1200) + .attr('width', width) + .attr('height', height) + .call(chart); + + // update chart data values randomly + setInterval(function () { + testdata2[0].y = Math.floor(Math.random() * 10); + testdata2[1].y = Math.floor(Math.random() * 10); + chart.update(); + }, 4000); + + return chart; + }); + + nv.addGraph(function () { + var chart = nv.models.pieChart() + .x(function (d) { return d.key }) + .y(function (d) { return d.y }) + //.labelThreshold(.08) + //.showLabels(false) + .color(d3.scale.category20().range().slice(8)) + .growOnHover(false) + .labelType('value') + .width(width) + .height(height); + + // make it a half circle + chart.pie + .startAngle(function (d) { return d.startAngle / 2 - Math.PI / 2 }) + .endAngle(function (d) { return d.endAngle / 2 - Math.PI / 2 }); + + // MAKES LABELS OUTSIDE OF PIE/DONUT + //chart.pie.donutLabelsOutside(true).donut(true); + + // LISTEN TO CLICK EVENTS ON SLICES OF THE PIE/DONUT + // chart.pie.dispatch.on('elementClick', function() { + // code... + // }); + + // chart.pie.dispatch.on('chartClick', function() { + // code... + // }); + + // LISTEN TO DOUBLECLICK EVENTS ON SLICES OF THE PIE/DONUT + // chart.pie.dispatch.on('elementDblClick', function() { + // code... + // }); + + // LISTEN TO THE renderEnd EVENT OF THE PIE/DONUT + // chart.pie.dispatch.on('renderEnd', function() { + // code... + // }); + + // OTHER EVENTS DISPATCHED BY THE PIE INCLUDE: elementMouseover, elementMouseout, elementMousemove + // @see nv.models.pie + + d3.select("#test2") + .datum(testdata) + .transition().duration(1200) + .attr('width', width) + .attr('height', height) + .call(chart); + + // disable and enable some of the sections + var is_disabled = false; + setInterval(function () { + chart.dispatch['changeState']({ disabled: { 2: !is_disabled, 4: !is_disabled } }); + is_disabled = !is_disabled; + }, 3000); + + return chart; + }); + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-scatterChart.ts b/nvd3/nvd3-test-scatterChart.ts new file mode 100644 index 0000000000..29ba71cf5a --- /dev/null +++ b/nvd3/nvd3-test-scatterChart.ts @@ -0,0 +1,66 @@ +/// +module nvd3_test_scatterChart { + // register our custom symbols to nvd3 + // make sure your path is valid given any size because size scales if the chart scales. + nv.utils.symbolMap.set('thin-x', function (size) { + size = Math.sqrt(size); + return 'M' + (-size / 2) + ',' + (-size / 2) + + 'l' + size + ',' + size + + 'm0,' + -(size) + + 'l' + (-size) + ',' + size; + }); + + // create the chart + var chart; + nv.addGraph(function () { + chart = nv.models.scatterChart() + .showDistX(true) + .showDistY(true) + .useVoronoi(true) + .color(d3.scale.category10().range()) + .duration(300) + ; + chart.dispatch.on('renderEnd', function () { + console.log('render complete'); + }); + + chart.xAxis.tickFormat(d3.format('.02f')); + chart.yAxis.tickFormat(d3.format('.02f')); + + d3.select('#test1 svg') + .datum(randomData(4, 40)) + .call(chart); + + nv.utils.windowResize(chart.update); + + chart.dispatch.on('stateChange', function (e) { ('New State:', JSON.stringify(e)); }); + return chart; + }); + + + function randomData(groups, points) { //# groups,# points per group + // smiley and thin-x are our custom symbols! + var data = [], + shapes = ['thin-x', 'circle', 'cross', 'triangle-up', 'triangle-down', 'diamond', 'square'], + random = d3.random.normal(); + + for (i = 0; i < groups; i++) { + data.push({ + key: 'Group ' + i, + values: [] + }); + + for (var j = 0; j < points; j++) { + data[i].values.push({ + x: random(), + y: random(), + size: Math.round(Math.random() * 100) / 100, + shape: shapes[j % shapes.length] + }); + } + } + + return data; + } + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-scatterPlusLineChart.ts b/nvd3/nvd3-test-scatterPlusLineChart.ts new file mode 100644 index 0000000000..8238c24042 --- /dev/null +++ b/nvd3/nvd3-test-scatterPlusLineChart.ts @@ -0,0 +1,53 @@ +/// +module nvd3_test_scatterPlusLineChart { + var chart; + nv.addGraph(function () { + chart = nv.models.scatterChart() + .showDistX(true) + .showDistY(true) + .duration(300) + .color(d3.scale.category10().range()); + + chart.dispatch.on('renderEnd', function () { + console.log('render complete'); + }); + + chart.xAxis.tickFormat(d3.format('.02f')); + chart.yAxis.tickFormat(d3.format('.02f')); + + d3.select('#test1 svg') + .datum(nv.log(randomData(4, 40))) + .call(chart); + + nv.utils.windowResize(chart.update); + chart.dispatch.on('stateChange', function (e) { nv.log('New State:', JSON.stringify(e)); }); + return chart; + }); + + + function randomData(groups, points) { //# groups,# points per group + var data = [], + shapes = ['circle'], + random = d3.random.normal(); + + for (i = 0; i < groups; i++) { + data.push({ + key: 'Group ' + i, + values: [], + slope: Math.random() - .01, + intercept: Math.random() - .5 + }); + + for (var j = 0; j < points; j++) { + data[i].values.push({ + x: random(), + y: random(), + size: Math.random(), + shape: shapes[j % shapes.length] + }); + } + } + return data; + } + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-sparkLine.ts b/nvd3/nvd3-test-sparkLine.ts new file mode 100644 index 0000000000..ef872bc2da --- /dev/null +++ b/nvd3/nvd3-test-sparkLine.ts @@ -0,0 +1,27 @@ +/// +module nvd3_test_sparkLine { + + nv.addGraph({ + generate: function () { + var chart = nv.models.sparkline() + .width(400) + .height(30) + + d3.select("#chart1") + .datum(sine()) + .call(chart); + + return chart; + } + }); + + function sine() { + var sin = []; + + for (var i = 0; i < 100; i++) { + sin.push({ x: i, y: Math.sin(i / 10) }); + } + + return sin; + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-sparkLinePlus.ts b/nvd3/nvd3-test-sparkLinePlus.ts new file mode 100644 index 0000000000..94003e21e1 --- /dev/null +++ b/nvd3/nvd3-test-sparkLinePlus.ts @@ -0,0 +1,54 @@ +/// +module nvd3_test_sparkLinePlus { + function defaultChartConfig(containerId, data) { + nv.addGraph(function () { + + var chart = nv.models.sparklinePlus(); + chart.margin({ left: 70 }) + .x(function (d, i) { return i }) + .showLastValue(true) + .xTickFormat(function (d) { + return d3.time.format('%x')(new Date(data[d].x)) + }); + + d3.select(containerId) + .datum(data) + .call(chart); + + return chart; + }); + } + + defaultChartConfig("#chart1", sine()); + defaultChartConfig("#chart2", volatileChart(130.0, 0.02)); + defaultChartConfig("#chart3", volatileChart(25.0, 0.09, 30)); + + function sine() { + var sin = []; + var now = +new Date(); + + for (var i = 0; i < 100; i++) { + sin.push({ x: now + i * 1000 * 60 * 60 * 24, y: Math.sin(i / 10) }); + } + + return sin; + } + + function volatileChart(startPrice, volatility, numPoints?) { + var rval = []; + var now = +new Date(); + numPoints = numPoints || 100; + for (var i = 1; i < numPoints; i++) { + + rval.push({ x: now + i * 1000 * 60 * 60 * 24, y: startPrice }); + var rnd = Math.random(); + var changePct = 2 * volatility * rnd; + if (changePct > volatility) { + changePct -= (2 * volatility); + } + startPrice = startPrice + startPrice * changePct; + } + return rval; + } + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-stackArea.ts b/nvd3/nvd3-test-stackArea.ts new file mode 100644 index 0000000000..9153de1a43 --- /dev/null +++ b/nvd3/nvd3-test-stackArea.ts @@ -0,0 +1,96 @@ +/// +module nvd3_test_stackArea { + nv.addGraph({ + generate: function () { + var n = 10, // number of layers + m = 200; // number of samples per layer + + //var data = stream_layers(n, m).map(function (data, i) { + // return { + // key: 'Stream' + i, + // values: data + // }; + //}); + var data: any; + + + var width = nv.utils.windowSize().width; + var height = nv.utils.windowSize().height; + + var chart = nv.models.stackedArea() + .width(width) + .height(height); + + var svg = d3.select('#chart svg').datum(data); + svg.transition().duration(500).call(chart); + return chart; + }, + callback: function (graph) { + + graph.dispatch.on('tooltipShow', function (e) { + var offsetElement = document.getElementById("chart"), + left = e.pos[0] + offsetElement.offsetLeft, + top = e.pos[1] + offsetElement.offsetTop, + formatterY = d3.format(",.2%"), + formatterX = function (d) { + return d3.time.format('%x')(new Date(d)) + }; + + var content = '

' + e.series.key + '

' + + '

' + + formatterY(graph.y()(e.point)) + ' at ' + formatterX(graph.x()(e.point)) + + '

'; + + nv.tooltip.show([left, top], content); + }); + + graph.dispatch.on('tooltipHide', function (e) { + nv.tooltip.cleanup(); + }); + + nv.utils.windowResize(function () { + var width = nv.utils.windowSize().width; + var height = nv.utils.windowSize().height; + + graph.width(width).height(height); + d3.select('#chart svg').call(graph); + }); + } + }); + + /* Inspired by Lee Byron's test data generator. */ + function stream_layers(n, m, o) { + if (arguments.length < 3) o = 0; + function bump(a) { + var x = 1 / (.1 + Math.random()), + y = 2 * Math.random() - .5, + z = 10 / (.1 + Math.random()); + for (var i = 0; i < m; i++) { + var w = (i / m - y) * z; + a[i] += x * Math.exp(-w * w); + } + } + return d3.range(n).map(function () { + var a = [], i; + for (i = 0; i < m; i++) a[i] = o + o * Math.random(); + for (i = 0; i < 5; i++) bump(a); + return a.map(stream_index); + }); + } + + /* Another layer generator using gamma distributions. */ + function stream_waves(n, m) { + return d3.range(n).map(function (i) { + return d3.range(m).map(function (j) { + var x = 20 * j / m - i / 3; + return 2 * x * Math.exp(-.5 * x); + }).map(stream_index); + }); + } + + function stream_index(d, i) { + return { x: i, y: Math.max(0, d) }; + } + + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-stackAreaChart.ts b/nvd3/nvd3-test-stackAreaChart.ts new file mode 100644 index 0000000000..f20938680c --- /dev/null +++ b/nvd3/nvd3-test-stackAreaChart.ts @@ -0,0 +1,79 @@ +/// +module nvd3_test_stackAreaChart { + var histcatexplong = [ + { + "key": "Consumer Discretionary", + "values": [[1138683600000, 27.38478809681], [1141102800000, 27.371377218208], [1143781200000, 26.309915460827], [1146369600000, 26.425199957521], [1149048000000, 26.823411519395], [1151640000000, 23.850443591584], [1154318400000, 23.158355444054], [1156996800000, 22.998689393694], [1159588800000, 27.977128511299], [1162270800000, 29.073672469721], [1164862800000, 28.587640408904], [1167541200000, 22.788453687638], [1170219600000, 22.429199073597], [1172638800000, 22.324103271051], [1175313600000, 17.558388444186], [1177905600000, 16.769518096208], [1180584000000, 16.214738201302], [1183176000000, 18.729632971228], [1185854400000, 18.814523318848], [1188532800000, 19.789986451358], [1191124800000, 17.070049054933], [1193803200000, 16.121349575715], [1196398800000, 15.141659430091], [1199077200000, 17.175388025298], [1201755600000, 17.286592443521], [1204261200000, 16.323141626569], [1206936000000, 19.231263773952], [1209528000000, 18.446256391094], [1212206400000, 17.822632399764], [1214798400000, 15.539366475979], [1217476800000, 15.255131790216], [1220155200000, 15.660963922593], [1222747200000, 13.254482273697], [1225425600000, 11.920796202299], [1228021200000, 12.122809090925], [1230699600000, 15.691026271393], [1233378000000, 14.720881635107], [1235797200000, 15.387939360044], [1238472000000, 13.765436672229], [1241064000000, 14.6314458648], [1243742400000, 14.292446536221], [1246334400000, 16.170071367016], [1249012800000, 15.948135554337], [1251691200000, 16.612872685134], [1254283200000, 18.778338719091], [1256961600000, 16.75602606542], [1259557200000, 19.385804443147], [1262235600000, 22.950590240168], [1264914000000, 23.61159018141], [1267333200000, 25.708586989581], [1270008000000, 26.883915999885], [1272600000000, 25.893486687065], [1275278400000, 24.678914263176], [1277870400000, 25.937275793023], [1280548800000, 29.46138169384], [1283227200000, 27.357322961862], [1285819200000, 29.057235285673], [1288497600000, 28.549434189386], [1291093200000, 28.506352379723], [1293771600000, 29.449241421597], [1296450000000, 25.796838168807], [1298869200000, 28.740145449189], [1301544000000, 22.091744141872], [1304136000000, 25.079662545409], [1306814400000, 23.674906973064], [1309406400000, 23.41800274293], [1312084800000, 23.243644138871], [1314763200000, 31.591854066817], [1317355200000, 31.497112374114], [1320033600000, 26.672380820431], [1322629200000, 27.297080015495], [1325307600000, 20.174315530051], [1327986000000, 19.631084213899], [1330491600000, 20.366462219462], [1333166400000, 17.429019937289], [1335758400000, 16.75543633539], [1338436800000, 16.182906906042]] + }, + { + "key": "Consumer Staples", + "values": [[1138683600000, 7.2800122043237], [1141102800000, 7.1187787503354], [1143781200000, 8.351887016482], [1146369600000, 8.4156698763993], [1149048000000, 8.1673298604231], [1151640000000, 5.5132447126042], [1154318400000, 6.1152537710599], [1156996800000, 6.076765091942], [1159588800000, 4.6304473798646], [1162270800000, 4.6301068469402], [1164862800000, 4.3466656309389], [1167541200000, 6.830104897003], [1170219600000, 7.241633040029], [1172638800000, 7.1432372054153], [1175313600000, 10.608942063374], [1177905600000, 10.914964549494], [1180584000000, 10.933223880565], [1183176000000, 8.3457524851265], [1185854400000, 8.1078413081882], [1188532800000, 8.2697185922474], [1191124800000, 8.4742436475968], [1193803200000, 8.4994601179319], [1196398800000, 8.7387319683243], [1199077200000, 6.8829183612895], [1201755600000, 6.984133637885], [1204261200000, 7.0860136043287], [1206936000000, 4.3961787956053], [1209528000000, 3.8699674365231], [1212206400000, 3.6928925238305], [1214798400000, 6.7571718894253], [1217476800000, 6.4367313362344], [1220155200000, 6.4048441521454], [1222747200000, 5.4643833239669], [1225425600000, 5.3150786833374], [1228021200000, 5.3011272612576], [1230699600000, 4.1203601430809], [1233378000000, 4.0881783200525], [1235797200000, 4.1928665957189], [1238472000000, 7.0249415663205], [1241064000000, 7.006530880769], [1243742400000, 6.994835633224], [1246334400000, 6.1220222336254], [1249012800000, 6.1177436137653], [1251691200000, 6.1413396231981], [1254283200000, 4.8046006145874], [1256961600000, 4.6647600660544], [1259557200000, 4.544865006255], [1262235600000, 6.0488249316539], [1264914000000, 6.3188669540206], [1267333200000, 6.5873958262306], [1270008000000, 6.2281189839578], [1272600000000, 5.8948915746059], [1275278400000, 5.5967320482214], [1277870400000, 0.99784432084837], [1280548800000, 1.0950794175359], [1283227200000, 0.94479734407491], [1285819200000, 1.222093988688], [1288497600000, 1.335093106856], [1291093200000, 1.3302565104985], [1293771600000, 1.340824670897], [1296450000000, 0], [1298869200000, 0], [1301544000000, 0], [1304136000000, 0], [1306814400000, 0], [1309406400000, 0], [1312084800000, 0], [1314763200000, 0], [1317355200000, 4.4583692315], [1320033600000, 3.6493043348059], [1322629200000, 3.8610064091761], [1325307600000, 5.5144800685202], [1327986000000, 5.1750695220792], [1330491600000, 5.6710066952691], [1333166400000, 8.5658461590953], [1335758400000, 8.6135447714243], [1338436800000, 8.0231460925212]] + }, + { + "key": "Energy", + "values": [[1138683600000, 1.544303464167], [1141102800000, 1.4387289432421], [1143781200000, 0], [1146369600000, 0], [1149048000000, 0], [1151640000000, 1.328626801128], [1154318400000, 1.2874050802627], [1156996800000, 1.0872743105593], [1159588800000, 0.96042562635813], [1162270800000, 0.93139372870616], [1164862800000, 0.94432167305385], [1167541200000, 1.277750166208], [1170219600000, 1.2204893886811], [1172638800000, 1.207489123122], [1175313600000, 1.2490651414113], [1177905600000, 1.2593129913052], [1180584000000, 1.373329808388], [1183176000000, 0], [1185854400000, 0], [1188532800000, 0], [1191124800000, 0], [1193803200000, 0], [1196398800000, 0], [1199077200000, 0], [1201755600000, 0], [1204261200000, 0], [1206936000000, 0], [1209528000000, 0], [1212206400000, 0], [1214798400000, 0], [1217476800000, 0], [1220155200000, 0], [1222747200000, 1.4516108933695], [1225425600000, 1.1856025268225], [1228021200000, 1.3430470355439], [1230699600000, 2.2752595354509], [1233378000000, 2.4031560010523], [1235797200000, 2.0822430731926], [1238472000000, 1.5640902826938], [1241064000000, 1.5812873972356], [1243742400000, 1.9462448548894], [1246334400000, 2.9464870223957], [1249012800000, 3.0744699383222], [1251691200000, 2.9422304628446], [1254283200000, 2.7503075599999], [1256961600000, 2.6506701800427], [1259557200000, 2.8005425319977], [1262235600000, 2.6816184971185], [1264914000000, 2.681206271327], [1267333200000, 2.8195488011259], [1270008000000, 0], [1272600000000, 0], [1275278400000, 0], [1277870400000, 1.0687057346382], [1280548800000, 1.2539400544134], [1283227200000, 1.1862969445955], [1285819200000, 0], [1288497600000, 0], [1291093200000, 0], [1293771600000, 0], [1296450000000, 1.941972859484], [1298869200000, 2.1142247697552], [1301544000000, 2.3788590206824], [1304136000000, 2.5337302877545], [1306814400000, 2.3163370395199], [1309406400000, 2.0645451843195], [1312084800000, 2.1004446672411], [1314763200000, 3.6301875804303], [1317355200000, 2.454204664652], [1320033600000, 2.196082370894], [1322629200000, 2.3358418255202], [1325307600000, 0], [1327986000000, 0], [1330491600000, 0], [1333166400000, 0.39001201038526], [1335758400000, 0.30945472725559], [1338436800000, 0.31062439305591]] + }, + { + "key": "Financials", + "values": [[1138683600000, 13.356778764352], [1141102800000, 13.611196863271], [1143781200000, 6.895903006119], [1146369600000, 6.9939633271352], [1149048000000, 6.7241510257675], [1151640000000, 5.5611293669516], [1154318400000, 5.6086488714041], [1156996800000, 5.4962849907033], [1159588800000, 6.9193153169279], [1162270800000, 7.0016334389777], [1164862800000, 6.7865422443273], [1167541200000, 9.0006454225383], [1170219600000, 9.2233916171431], [1172638800000, 8.8929316009479], [1175313600000, 10.345937520404], [1177905600000, 10.075914677026], [1180584000000, 10.089006188111], [1183176000000, 10.598330295008], [1185854400000, 9.968954653301], [1188532800000, 9.7740580198146], [1191124800000, 10.558483060626], [1193803200000, 9.9314651823603], [1196398800000, 9.3997715873769], [1199077200000, 8.4086493387262], [1201755600000, 8.9698309085926], [1204261200000, 8.2778357995396], [1206936000000, 8.8585045600123], [1209528000000, 8.7013756413322], [1212206400000, 7.7933605469443], [1214798400000, 7.0236183483064], [1217476800000, 6.9873088186829], [1220155200000, 6.8031713070097], [1222747200000, 6.6869531315723], [1225425600000, 6.138256993963], [1228021200000, 5.6434994016354], [1230699600000, 5.495220262512], [1233378000000, 4.6885326869846], [1235797200000, 4.4524349883438], [1238472000000, 5.6766520778185], [1241064000000, 5.7675774480752], [1243742400000, 5.7882863168337], [1246334400000, 7.2666010034924], [1249012800000, 7.519182132226], [1251691200000, 7.849651451445], [1254283200000, 10.383992037985], [1256961600000, 9.0653691861818], [1259557200000, 9.6705248324159], [1262235600000, 10.856380561349], [1264914000000, 11.27452370892], [1267333200000, 11.754156529088], [1270008000000, 8.2870811422456], [1272600000000, 8.0210264360699], [1275278400000, 7.5375074474865], [1277870400000, 8.3419527338039], [1280548800000, 9.4197471818443], [1283227200000, 8.7321733185797], [1285819200000, 9.6627062648126], [1288497600000, 10.187962234549], [1291093200000, 9.8144201733476], [1293771600000, 10.275723361713], [1296450000000, 16.796066079353], [1298869200000, 17.543254984075], [1301544000000, 16.673660675084], [1304136000000, 17.963944353609], [1306814400000, 16.637740867211], [1309406400000, 15.84857094609], [1312084800000, 14.767303362182], [1314763200000, 24.778452182432], [1317355200000, 18.370353229999], [1320033600000, 15.2531374291], [1322629200000, 14.989600840649], [1325307600000, 16.052539160125], [1327986000000, 16.424390322793], [1330491600000, 17.884020741105], [1333166400000, 7.1424929577921], [1335758400000, 7.8076213051482], [1338436800000, 7.2462684949232]] + }, + { + "key": "Health Care", + "values": [[1138683600000, 14.212410956029], [1141102800000, 13.973193618249], [1143781200000, 15.218233920665], [1146369600000, 14.38210972745], [1149048000000, 13.894310878491], [1151640000000, 15.593086090032], [1154318400000, 16.244839695188], [1156996800000, 16.017088850646], [1159588800000, 14.183951830055], [1162270800000, 14.148523245697], [1164862800000, 13.424326059972], [1167541200000, 12.974450435753], [1170219600000, 13.23247041802], [1172638800000, 13.318762655574], [1175313600000, 15.961407746104], [1177905600000, 16.287714639805], [1180584000000, 16.246590583889], [1183176000000, 17.564505594809], [1185854400000, 17.872725373165], [1188532800000, 18.018998508757], [1191124800000, 15.584518016603], [1193803200000, 15.480850647181], [1196398800000, 15.699120036984], [1199077200000, 19.184281817226], [1201755600000, 19.691226605207], [1204261200000, 18.982314051295], [1206936000000, 18.707820309008], [1209528000000, 17.459630929761], [1212206400000, 16.500616076782], [1214798400000, 18.086324003979], [1217476800000, 18.929464156258], [1220155200000, 18.233728682084], [1222747200000, 16.315776297325], [1225425600000, 14.63289219025], [1228021200000, 14.667835024478], [1230699600000, 13.946993947308], [1233378000000, 14.394304684397], [1235797200000, 13.724462792967], [1238472000000, 10.930879035806], [1241064000000, 9.8339915513708], [1243742400000, 10.053858541872], [1246334400000, 11.786998438287], [1249012800000, 11.780994901769], [1251691200000, 11.305889670276], [1254283200000, 10.918452290083], [1256961600000, 9.6811395055706], [1259557200000, 10.971529744038], [1262235600000, 13.330210480209], [1264914000000, 14.592637568961], [1267333200000, 14.605329141157], [1270008000000, 13.936853794037], [1272600000000, 12.189480759072], [1275278400000, 11.676151385046], [1277870400000, 13.058852800017], [1280548800000, 13.62891543203], [1283227200000, 13.811107569918], [1285819200000, 13.786494560787], [1288497600000, 14.04516285753], [1291093200000, 13.697412447288], [1293771600000, 13.677681376221], [1296450000000, 19.961511864531], [1298869200000, 21.049198298158], [1301544000000, 22.687631094008], [1304136000000, 25.469010617433], [1306814400000, 24.883799437121], [1309406400000, 24.203843814248], [1312084800000, 22.138760964038], [1314763200000, 16.034636966228], [1317355200000, 15.394958944556], [1320033600000, 12.625642461969], [1322629200000, 12.973735699739], [1325307600000, 15.786018336149], [1327986000000, 15.227368020134], [1330491600000, 15.899752650734], [1333166400000, 18.994731295388], [1335758400000, 18.450055817702], [1338436800000, 17.863719889669]] + }, + { + "key": "Industrials", + "values": [[1138683600000, 7.1590087090398], [1141102800000, 7.1297210970108], [1143781200000, 5.5774588290586], [1146369600000, 5.4977254491156], [1149048000000, 5.5138153113634], [1151640000000, 4.3198084032122], [1154318400000, 3.9179295839125], [1156996800000, 3.8110093051479], [1159588800000, 5.5629020916939], [1162270800000, 5.7241673711336], [1164862800000, 5.4715049695004], [1167541200000, 4.9193763571618], [1170219600000, 5.136053947247], [1172638800000, 5.1327258759766], [1175313600000, 5.1888943925082], [1177905600000, 5.5191481293345], [1180584000000, 5.6093625614921], [1183176000000, 4.2706312987397], [1185854400000, 4.4453235132117], [1188532800000, 4.6228003109761], [1191124800000, 5.0645764756954], [1193803200000, 5.0723447230959], [1196398800000, 5.1457765818846], [1199077200000, 5.4067851597282], [1201755600000, 5.472241916816], [1204261200000, 5.3742740389688], [1206936000000, 6.251751933664], [1209528000000, 6.1406852153472], [1212206400000, 5.8164385627465], [1214798400000, 5.4255846656171], [1217476800000, 5.3738499417204], [1220155200000, 5.1815627753979], [1222747200000, 5.0305983235349], [1225425600000, 4.6823058607165], [1228021200000, 4.5941481589093], [1230699600000, 5.4669598474575], [1233378000000, 5.1249037357], [1235797200000, 4.3504421250742], [1238472000000, 4.6260881026002], [1241064000000, 5.0140402458946], [1243742400000, 4.7458462454774], [1246334400000, 6.0437019654564], [1249012800000, 6.4595216249754], [1251691200000, 6.6420468254155], [1254283200000, 5.8927271960913], [1256961600000, 5.4712108838003], [1259557200000, 6.1220254207747], [1262235600000, 5.5385935169255], [1264914000000, 5.7383377612639], [1267333200000, 6.1715976730415], [1270008000000, 4.0102262681174], [1272600000000, 3.769389679692], [1275278400000, 3.5301571031152], [1277870400000, 2.7660252652526], [1280548800000, 3.1409983385775], [1283227200000, 3.0528024863055], [1285819200000, 4.3126123157971], [1288497600000, 4.594654041683], [1291093200000, 4.5424126126793], [1293771600000, 4.7790043987302], [1296450000000, 7.4969154058289], [1298869200000, 7.9424751557821], [1301544000000, 7.1560736250547], [1304136000000, 7.9478117337855], [1306814400000, 7.4109214848895], [1309406400000, 7.5966457641101], [1312084800000, 7.165754444071], [1314763200000, 5.4816702524302], [1317355200000, 4.9893656089584], [1320033600000, 4.498385105327], [1322629200000, 4.6776090358151], [1325307600000, 8.1350814368063], [1327986000000, 8.0732769990652], [1330491600000, 8.5602340387277], [1333166400000, 5.1293714074325], [1335758400000, 5.2586794619016], [1338436800000, 5.1100853569977]] + }, + { + "key": "Information Technology", + "values": [[1138683600000, 13.242301508051], [1141102800000, 12.863536342042], [1143781200000, 21.034044171629], [1146369600000, 21.419084618803], [1149048000000, 21.142678863691], [1151640000000, 26.568489677529], [1154318400000, 24.839144939905], [1156996800000, 25.456187462167], [1159588800000, 26.350164502826], [1162270800000, 26.47833320519], [1164862800000, 26.425979547847], [1167541200000, 28.191461582256], [1170219600000, 28.930307448808], [1172638800000, 29.521413891117], [1175313600000, 28.188285966466], [1177905600000, 27.704619625832], [1180584000000, 27.490862424829], [1183176000000, 28.770679721286], [1185854400000, 29.060480671449], [1188532800000, 28.240998844973], [1191124800000, 33.004893194127], [1193803200000, 34.075180359928], [1196398800000, 32.548560664833], [1199077200000, 30.629727432728], [1201755600000, 28.642858788159], [1204261200000, 27.973575227842], [1206936000000, 27.393351882726], [1209528000000, 28.476095288523], [1212206400000, 29.29667866426], [1214798400000, 29.222333802896], [1217476800000, 28.092966093843], [1220155200000, 28.107159262922], [1222747200000, 25.482974832098], [1225425600000, 21.208115993834], [1228021200000, 20.295043095268], [1230699600000, 15.925754618401], [1233378000000, 17.162864628346], [1235797200000, 17.084345773174], [1238472000000, 22.246007102281], [1241064000000, 24.530543998509], [1243742400000, 25.084184918242], [1246334400000, 16.606166527358], [1249012800000, 17.239620011628], [1251691200000, 17.336739127379], [1254283200000, 25.478492475753], [1256961600000, 23.017152085245], [1259557200000, 25.617745423683], [1262235600000, 24.061133998642], [1264914000000, 23.223933318644], [1267333200000, 24.425887263937], [1270008000000, 35.501471156693], [1272600000000, 33.775013878676], [1275278400000, 30.417993630285], [1277870400000, 30.023598978467], [1280548800000, 33.327519522436], [1283227200000, 31.963388450371], [1285819200000, 30.498967232092], [1288497600000, 32.403696817912], [1291093200000, 31.47736071922], [1293771600000, 31.53259666241], [1296450000000, 41.760282761548], [1298869200000, 45.605771243237], [1301544000000, 39.986557966215], [1304136000000, 43.846330510051], [1306814400000, 39.857316881857], [1309406400000, 37.675127768208], [1312084800000, 35.775077970313], [1314763200000, 48.631009702577], [1317355200000, 42.830831754505], [1320033600000, 35.611502589362], [1322629200000, 35.320136981738], [1325307600000, 31.564136901516], [1327986000000, 32.074407502433], [1330491600000, 35.053013769976], [1333166400000, 26.434568573937], [1335758400000, 25.305617871002], [1338436800000, 24.520919418236]] + }, + { + "key": "Materials", + "values": [[1138683600000, 5.5806167415681], [1141102800000, 5.4539047069985], [1143781200000, 7.6728842432362], [1146369600000, 7.719946716654], [1149048000000, 8.0144619912942], [1151640000000, 7.942223133434], [1154318400000, 8.3998279827444], [1156996800000, 8.532324572605], [1159588800000, 4.7324285199763], [1162270800000, 4.7402397487697], [1164862800000, 4.9042069355168], [1167541200000, 5.9583963430882], [1170219600000, 6.3693899239171], [1172638800000, 6.261153903813], [1175313600000, 5.3443942184584], [1177905600000, 5.4932111235361], [1180584000000, 5.5747393101109], [1183176000000, 5.3833633060013], [1185854400000, 5.5125898831832], [1188532800000, 5.8116112661327], [1191124800000, 4.3962296939996], [1193803200000, 4.6967663605521], [1196398800000, 4.7963004350914], [1199077200000, 4.1817985183351], [1201755600000, 4.3797643870182], [1204261200000, 4.6966642197965], [1206936000000, 4.3609995132565], [1209528000000, 4.4736290996496], [1212206400000, 4.3749762738128], [1214798400000, 3.3274661194507], [1217476800000, 3.0316184691337], [1220155200000, 2.5718140204728], [1222747200000, 2.7034994044603], [1225425600000, 2.2033786591364], [1228021200000, 1.9850621240805], [1230699600000, 0], [1233378000000, 0], [1235797200000, 0], [1238472000000, 0], [1241064000000, 0], [1243742400000, 0], [1246334400000, 0], [1249012800000, 0], [1251691200000, 0], [1254283200000, 0.44495950017788], [1256961600000, 0.33945469262483], [1259557200000, 0.38348269455195], [1262235600000, 0], [1264914000000, 0], [1267333200000, 0], [1270008000000, 0], [1272600000000, 0], [1275278400000, 0], [1277870400000, 0], [1280548800000, 0], [1283227200000, 0], [1285819200000, 0], [1288497600000, 0], [1291093200000, 0], [1293771600000, 0], [1296450000000, 0.52216435716176], [1298869200000, 0.59275786698454], [1301544000000, 0], [1304136000000, 0], [1306814400000, 0], [1309406400000, 0], [1312084800000, 0], [1314763200000, 0], [1317355200000, 0], [1320033600000, 0], [1322629200000, 0], [1325307600000, 0], [1327986000000, 0], [1330491600000, 0], [1333166400000, 0], [1335758400000, 0], [1338436800000, 0]] + }, + { + "key": "Telecommunication Services", + "values": [[1138683600000, 3.7056975170243], [1141102800000, 3.7561118692318], [1143781200000, 2.861913700854], [1146369600000, 2.9933744103381], [1149048000000, 2.7127537218463], [1151640000000, 3.1195497076283], [1154318400000, 3.4066964004508], [1156996800000, 3.3754571113569], [1159588800000, 2.2965579982924], [1162270800000, 2.4486818633018], [1164862800000, 2.4002308848517], [1167541200000, 1.9649579750349], [1170219600000, 1.9385263638056], [1172638800000, 1.9128975336387], [1175313600000, 2.3412869836298], [1177905600000, 2.4337870351445], [1180584000000, 2.62179703171], [1183176000000, 3.2642864957929], [1185854400000, 3.3200396223709], [1188532800000, 3.3934212707572], [1191124800000, 4.2822327088179], [1193803200000, 4.1474964228541], [1196398800000, 4.1477082879801], [1199077200000, 5.2947122916128], [1201755600000, 5.2919843508028], [1204261200000, 5.1989783050309], [1206936000000, 3.5603057673513], [1209528000000, 3.3009087690692], [1212206400000, 3.1784852603792], [1214798400000, 4.5889503538868], [1217476800000, 4.401779617494], [1220155200000, 4.2208301828278], [1222747200000, 3.89396671475], [1225425600000, 3.0423832241354], [1228021200000, 3.135520611578], [1230699600000, 1.9631418164089], [1233378000000, 1.8963543874958], [1235797200000, 1.8266636017025], [1238472000000, 0.93136635895188], [1241064000000, 0.92737801918888], [1243742400000, 0.97591889805002], [1246334400000, 2.6841193805515], [1249012800000, 2.5664341140531], [1251691200000, 2.3887523699873], [1254283200000, 1.1737801663681], [1256961600000, 1.0953582317281], [1259557200000, 1.2495674976653], [1262235600000, 0.36607452464754], [1264914000000, 0.3548719047291], [1267333200000, 0.36769242398939], [1270008000000, 0], [1272600000000, 0], [1275278400000, 0], [1277870400000, 0], [1280548800000, 0], [1283227200000, 0], [1285819200000, 0.85450741275337], [1288497600000, 0.91360317921637], [1291093200000, 0.89647678692269], [1293771600000, 0.87800687192639], [1296450000000, 0], [1298869200000, 0], [1301544000000, 0.43668720882994], [1304136000000, 0.4756523602692], [1306814400000, 0.46947368328469], [1309406400000, 0.45138896152316], [1312084800000, 0.43828726648117], [1314763200000, 2.0820861395316], [1317355200000, 0.9364411075395], [1320033600000, 0.60583907839773], [1322629200000, 0.61096950747437], [1325307600000, 0], [1327986000000, 0], [1330491600000, 0], [1333166400000, 0], [1335758400000, 0], [1338436800000, 0]] + }, + { + "key": "Utilities", + "values": [[1138683600000, 0], [1141102800000, 0], [1143781200000, 0], [1146369600000, 0], [1149048000000, 0], [1151640000000, 0], [1154318400000, 0], [1156996800000, 0], [1159588800000, 0], [1162270800000, 0], [1164862800000, 0], [1167541200000, 0], [1170219600000, 0], [1172638800000, 0], [1175313600000, 0], [1177905600000, 0], [1180584000000, 0], [1183176000000, 0], [1185854400000, 0], [1188532800000, 0], [1191124800000, 0], [1193803200000, 0], [1196398800000, 0], [1199077200000, 0], [1201755600000, 0], [1204261200000, 0], [1206936000000, 0], [1209528000000, 0], [1212206400000, 0], [1214798400000, 0], [1217476800000, 0], [1220155200000, 0], [1222747200000, 0], [1225425600000, 0], [1228021200000, 0], [1230699600000, 0], [1233378000000, 0], [1235797200000, 0], [1238472000000, 0], [1241064000000, 0], [1243742400000, 0], [1246334400000, 0], [1249012800000, 0], [1251691200000, 0], [1254283200000, 0], [1256961600000, 0], [1259557200000, 0], [1262235600000, 0], [1264914000000, 0], [1267333200000, 0], [1270008000000, 0], [1272600000000, 0], [1275278400000, 0], [1277870400000, 0], [1280548800000, 0], [1283227200000, 0], [1285819200000, 0], [1288497600000, 0], [1291093200000, 0], [1293771600000, 0], [1296450000000, 0], [1298869200000, 0], [1301544000000, 0], [1304136000000, 0], [1306814400000, 0], [1309406400000, 0], [1312084800000, 0], [1314763200000, 0], [1317355200000, 0], [1320033600000, 0], [1322629200000, 0], [1325307600000, 0], [1327986000000, 0], [1330491600000, 0], [1333166400000, 0], [1335758400000, 0], [1338436800000, 0]] + } + ]; + + var colors = d3.scale.category20(); + + var chart; + nv.addGraph(function () { + chart = nv.models.stackedAreaChart() + .useInteractiveGuideline(true) + .x(function (d) { return d[0] }) + .y(function (d) { return d[1] }) + .controlLabels({ stacked: "Stacked" }) + .duration(300); + + chart.xAxis.tickFormat(function (d) { return d3.time.format('%x')(new Date(d)) }); + chart.yAxis.tickFormat(d3.format(',.4f')); + + chart.legend.vers('furious'); + + d3.select('#chart1') + .datum(histcatexplong) + .transition().duration(1000) + .call(chart) + .each('start', function () { + setTimeout(function () { + d3.selectAll('#chart1 *').each(function () { + if (this.__transition__) + this.__transition__.duration = 1; + }) + }, 0) + }); + + nv.utils.windowResize(chart.update); + return chart; + }); + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-sunburst.ts b/nvd3/nvd3-test-sunburst.ts new file mode 100644 index 0000000000..cb299e0849 --- /dev/null +++ b/nvd3/nvd3-test-sunburst.ts @@ -0,0 +1,402 @@ +/// +module nvd3_test_sunburst { + + var chart; + + nv.addGraph(function () { + chart = nv.models.sunburstChart(); + + chart.color(d3.scale.category20c()); + + d3.select("#test1") + .datum(getData()) + .call(chart); + + nv.utils.windowResize(chart.update); + + return chart; + }); + + function getData() { + return [{ + "name": "flare", + "children": [ + { + "name": "analytics", + "children": [ + { + "name": "cluster", + "children": [ + { "name": "AgglomerativeCluster", "size": 3938 }, + { "name": "CommunityStructure", "size": 3812 }, + { "name": "HierarchicalCluster", "size": 6714 }, + { "name": "MergeEdge", "size": 743 } + ] + }, + { + "name": "graph", + "children": [ + { "name": "BetweennessCentrality", "size": 3534 }, + { "name": "LinkDistance", "size": 5731 }, + { "name": "MaxFlowMinCut", "size": 7840 }, + { "name": "ShortestPaths", "size": 5914 }, + { "name": "SpanningTree", "size": 3416 } + ] + }, + { + "name": "optimization", + "children": [ + { "name": "AspectRatioBanker", "size": 7074 } + ] + } + ] + }, + { + "name": "animate", + "children": [ + { "name": "Easing", "size": 17010 }, + { "name": "FunctionSequence", "size": 5842 }, + { + "name": "interpolate", + "children": [ + { "name": "ArrayInterpolator", "size": 1983 }, + { "name": "ColorInterpolator", "size": 2047 }, + { "name": "DateInterpolator", "size": 1375 }, + { "name": "Interpolator", "size": 8746 }, + { "name": "MatrixInterpolator", "size": 2202 }, + { "name": "NumberInterpolator", "size": 1382 }, + { "name": "ObjectInterpolator", "size": 1629 }, + { "name": "PointInterpolator", "size": 1675 }, + { "name": "RectangleInterpolator", "size": 2042 } + ] + }, + { "name": "ISchedulable", "size": 1041 }, + { "name": "Parallel", "size": 5176 }, + { "name": "Pause", "size": 449 }, + { "name": "Scheduler", "size": 5593 }, + { "name": "Sequence", "size": 5534 }, + { "name": "Transition", "size": 9201 }, + { "name": "Transitioner", "size": 19975 }, + { "name": "TransitionEvent", "size": 1116 }, + { "name": "Tween", "size": 6006 } + ] + }, + { + "name": "data", + "children": [ + { + "name": "converters", + "children": [ + { "name": "Converters", "size": 721 }, + { "name": "DelimitedTextConverter", "size": 4294 }, + { "name": "GraphMLConverter", "size": 9800 }, + { "name": "IDataConverter", "size": 1314 }, + { "name": "JSONConverter", "size": 2220 } + ] + }, + { "name": "DataField", "size": 1759 }, + { "name": "DataSchema", "size": 2165 }, + { "name": "DataSet", "size": 586 }, + { "name": "DataSource", "size": 3331 }, + { "name": "DataTable", "size": 772 }, + { "name": "DataUtil", "size": 3322 } + ] + }, + { + "name": "display", + "children": [ + { "name": "DirtySprite", "size": 8833 }, + { "name": "LineSprite", "size": 1732 }, + { "name": "RectSprite", "size": 3623 }, + { "name": "TextSprite", "size": 10066 } + ] + }, + { + "name": "flex", + "children": [ + { "name": "FlareVis", "size": 4116 } + ] + }, + { + "name": "physics", + "children": [ + { "name": "DragForce", "size": 1082 }, + { "name": "GravityForce", "size": 1336 }, + { "name": "IForce", "size": 319 }, + { "name": "NBodyForce", "size": 10498 }, + { "name": "Particle", "size": 2822 }, + { "name": "Simulation", "size": 9983 }, + { "name": "Spring", "size": 2213 }, + { "name": "SpringForce", "size": 1681 } + ] + }, + { + "name": "query", + "children": [ + { "name": "AggregateExpression", "size": 1616 }, + { "name": "And", "size": 1027 }, + { "name": "Arithmetic", "size": 3891 }, + { "name": "Average", "size": 891 }, + { "name": "BinaryExpression", "size": 2893 }, + { "name": "Comparison", "size": 5103 }, + { "name": "CompositeExpression", "size": 3677 }, + { "name": "Count", "size": 781 }, + { "name": "DateUtil", "size": 4141 }, + { "name": "Distinct", "size": 933 }, + { "name": "Expression", "size": 5130 }, + { "name": "ExpressionIterator", "size": 3617 }, + { "name": "Fn", "size": 3240 }, + { "name": "If", "size": 2732 }, + { "name": "IsA", "size": 2039 }, + { "name": "Literal", "size": 1214 }, + { "name": "Match", "size": 3748 }, + { "name": "Maximum", "size": 843 }, + { + "name": "methods", + "children": [ + { "name": "add", "size": 593 }, + { "name": "and", "size": 330 }, + { "name": "average", "size": 287 }, + { "name": "count", "size": 277 }, + { "name": "distinct", "size": 292 }, + { "name": "div", "size": 595 }, + { "name": "eq", "size": 594 }, + { "name": "fn", "size": 460 }, + { "name": "gt", "size": 603 }, + { "name": "gte", "size": 625 }, + { "name": "iff", "size": 748 }, + { "name": "isa", "size": 461 }, + { "name": "lt", "size": 597 }, + { "name": "lte", "size": 619 }, + { "name": "max", "size": 283 }, + { "name": "min", "size": 283 }, + { "name": "mod", "size": 591 }, + { "name": "mul", "size": 603 }, + { "name": "neq", "size": 599 }, + { "name": "not", "size": 386 }, + { "name": "or", "size": 323 }, + { "name": "orderby", "size": 307 }, + { "name": "range", "size": 772 }, + { "name": "select", "size": 296 }, + { "name": "stddev", "size": 363 }, + { "name": "sub", "size": 600 }, + { "name": "sum", "size": 280 }, + { "name": "update", "size": 307 }, + { "name": "variance", "size": 335 }, + { "name": "where", "size": 299 }, + { "name": "xor", "size": 354 }, + { "name": "_", "size": 264 } + ] + }, + { "name": "Minimum", "size": 843 }, + { "name": "Not", "size": 1554 }, + { "name": "Or", "size": 970 }, + { "name": "Query", "size": 13896 }, + { "name": "Range", "size": 1594 }, + { "name": "StringUtil", "size": 4130 }, + { "name": "Sum", "size": 791 }, + { "name": "Variable", "size": 1124 }, + { "name": "Variance", "size": 1876 }, + { "name": "Xor", "size": 1101 } + ] + }, + { + "name": "scale", + "children": [ + { "name": "IScaleMap", "size": 2105 }, + { "name": "LinearScale", "size": 1316 }, + { "name": "LogScale", "size": 3151 }, + { "name": "OrdinalScale", "size": 3770 }, + { "name": "QuantileScale", "size": 2435 }, + { "name": "QuantitativeScale", "size": 4839 }, + { "name": "RootScale", "size": 1756 }, + { "name": "Scale", "size": 4268 }, + { "name": "ScaleType", "size": 1821 }, + { "name": "TimeScale", "size": 5833 } + ] + }, + { + "name": "util", + "children": [ + { "name": "Arrays", "size": 8258 }, + { "name": "Colors", "size": 10001 }, + { "name": "Dates", "size": 8217 }, + { "name": "Displays", "size": 12555 }, + { "name": "Filter", "size": 2324 }, + { "name": "Geometry", "size": 10993 }, + { + "name": "heap", + "children": [ + { "name": "FibonacciHeap", "size": 9354 }, + { "name": "HeapNode", "size": 1233 } + ] + }, + { "name": "IEvaluable", "size": 335 }, + { "name": "IPredicate", "size": 383 }, + { "name": "IValueProxy", "size": 874 }, + { + "name": "math", + "children": [ + { "name": "DenseMatrix", "size": 3165 }, + { "name": "IMatrix", "size": 2815 }, + { "name": "SparseMatrix", "size": 3366 } + ] + }, + { "name": "Maths", "size": 17705 }, + { "name": "Orientation", "size": 1486 }, + { + "name": "palette", + "children": [ + { "name": "ColorPalette", "size": 6367 }, + { "name": "Palette", "size": 1229 }, + { "name": "ShapePalette", "size": 2059 }, + { "name": "SizePalette", "size": 2291 } + ] + }, + { "name": "Property", "size": 5559 }, + { "name": "Shapes", "size": 19118 }, + { "name": "Sort", "size": 6887 }, + { "name": "Stats", "size": 6557 }, + { "name": "Strings", "size": 22026 } + ] + }, + { + "name": "vis", + "children": [ + { + "name": "axis", + "children": [ + { "name": "Axes", "size": 1302 }, + { "name": "Axis", "size": 24593 }, + { "name": "AxisGridLine", "size": 652 }, + { "name": "AxisLabel", "size": 636 }, + { "name": "CartesianAxes", "size": 6703 } + ] + }, + { + "name": "controls", + "children": [ + { "name": "AnchorControl", "size": 2138 }, + { "name": "ClickControl", "size": 3824 }, + { "name": "Control", "size": 1353 }, + { "name": "ControlList", "size": 4665 }, + { "name": "DragControl", "size": 2649 }, + { "name": "ExpandControl", "size": 2832 }, + { "name": "HoverControl", "size": 4896 }, + { "name": "IControl", "size": 763 }, + { "name": "PanZoomControl", "size": 5222 }, + { "name": "SelectionControl", "size": 7862 }, + { "name": "TooltipControl", "size": 8435 } + ] + }, + { + "name": "data", + "children": [ + { "name": "Data", "size": 20544 }, + { "name": "DataList", "size": 19788 }, + { "name": "DataSprite", "size": 10349 }, + { "name": "EdgeSprite", "size": 3301 }, + { "name": "NodeSprite", "size": 19382 }, + { + "name": "render", + "children": [ + { "name": "ArrowType", "size": 698 }, + { "name": "EdgeRenderer", "size": 5569 }, + { "name": "IRenderer", "size": 353 }, + { "name": "ShapeRenderer", "size": 2247 } + ] + }, + { "name": "ScaleBinding", "size": 11275 }, + { "name": "Tree", "size": 7147 }, + { "name": "TreeBuilder", "size": 9930 } + ] + }, + { + "name": "events", + "children": [ + { "name": "DataEvent", "size": 2313 }, + { "name": "SelectionEvent", "size": 1880 }, + { "name": "TooltipEvent", "size": 1701 }, + { "name": "VisualizationEvent", "size": 1117 } + ] + }, + { + "name": "legend", + "children": [ + { "name": "Legend", "size": 20859 }, + { "name": "LegendItem", "size": 4614 }, + { "name": "LegendRange", "size": 10530 } + ] + }, + { + "name": "operator", + "children": [ + { + "name": "distortion", + "children": [ + { "name": "BifocalDistortion", "size": 4461 }, + { "name": "Distortion", "size": 6314 }, + { "name": "FisheyeDistortion", "size": 3444 } + ] + }, + { + "name": "encoder", + "children": [ + { "name": "ColorEncoder", "size": 3179 }, + { "name": "Encoder", "size": 4060 }, + { "name": "PropertyEncoder", "size": 4138 }, + { "name": "ShapeEncoder", "size": 1690 }, + { "name": "SizeEncoder", "size": 1830 } + ] + }, + { + "name": "filter", + "children": [ + { "name": "FisheyeTreeFilter", "size": 5219 }, + { "name": "GraphDistanceFilter", "size": 3165 }, + { "name": "VisibilityFilter", "size": 3509 } + ] + }, + { "name": "IOperator", "size": 1286 }, + { + "name": "label", + "children": [ + { "name": "Labeler", "size": 9956 }, + { "name": "RadialLabeler", "size": 3899 }, + { "name": "StackedAreaLabeler", "size": 3202 } + ] + }, + { + "name": "layout", + "children": [ + { "name": "AxisLayout", "size": 6725 }, + { "name": "BundledEdgeRouter", "size": 3727 }, + { "name": "CircleLayout", "size": 9317 }, + { "name": "CirclePackingLayout", "size": 12003 }, + { "name": "DendrogramLayout", "size": 4853 }, + { "name": "ForceDirectedLayout", "size": 8411 }, + { "name": "IcicleTreeLayout", "size": 4864 }, + { "name": "IndentedTreeLayout", "size": 3174 }, + { "name": "Layout", "size": 7881 }, + { "name": "NodeLinkTreeLayout", "size": 12870 }, + { "name": "PieLayout", "size": 2728 }, + { "name": "RadialTreeLayout", "size": 12348 }, + { "name": "RandomLayout", "size": 870 }, + { "name": "StackedAreaLayout", "size": 9121 }, + { "name": "TreeMapLayout", "size": 9191 } + ] + }, + { "name": "Operator", "size": 2490 }, + { "name": "OperatorList", "size": 5248 }, + { "name": "OperatorSequence", "size": 4190 }, + { "name": "OperatorSwitch", "size": 2581 }, + { "name": "SortOperator", "size": 2023 } + ] + }, + { "name": "Visualization", "size": 16540 } + ] + } + ] + }]; + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-timeSeries.ts b/nvd3/nvd3-test-timeSeries.ts new file mode 100644 index 0000000000..2eec0dcbd2 --- /dev/null +++ b/nvd3/nvd3-test-timeSeries.ts @@ -0,0 +1,167 @@ +/// +module nvd3_test_timeSeries { + var data = [{ + values: [] + }]; + + var i, x; + var gap = false; + var prevVal = 3000; + var tickCount = 100; + var probEnterGap = 0.1; + var probExitGap = 0.2; + var barTimespan = 30 * 60; // thirty minutes in seconds + var startOfTime = 1425096000; + for (i = 0; i < tickCount; i++) { + x = startOfTime + i * barTimespan; + if (!gap) { + if (Math.random() > probEnterGap) { + prevVal += (Math.random() - 0.5) * 500; + if (prevVal <= 0) { + prevVal = Math.random() * 100; + } + data[0].values.push({ x: x * 1000, y: prevVal }); + } + else { + gap = true; + } + } + else { + if (Math.random() < probExitGap) { + gap = false; + } + } + } + + var chart; + + var halfBarXMin = data[0].values[0].x - barTimespan / 2 * 1000; + var halfBarXMax = data[0].values[data[0].values.length - 1].x + barTimespan / 2 * 1000; + + function renderChart(location, meaning) { + nv.addGraph(function () { + chart = nv.models.historicalBarChart(); + chart + .xScale(d3.time.scale()) // use a time scale instead of plain numbers in order to get nice round default values in the axis + .color(['#68c']) + .forceX([halfBarXMin, halfBarXMax]) // fix half-bar problem on the first and last bars + .useInteractiveGuideline(true) // check out the css that turns the guideline into this nice thing + .margin({ "left": 80, "right": 50, "top": 20, "bottom": 30 }) + .duration(0) + ; + + var tickMultiFormat = d3.time.format.multi([ + ["%-I:%M%p", function (d) { return d.getMinutes(); }], // not the beginning of the hour + ["%-I%p", function (d) { return d.getHours(); }], // not midnight + ["%b %-d", function (d) { return d.getDate() != 1; }], // not the first of the month + ["%b %-d", function (d) { return d.getMonth(); }], // not Jan 1st + ["%Y", function () { return true; }] + ]); + chart.xAxis + .showMaxMin(false) + .tickPadding(10) + .tickFormat(function (d) { return tickMultiFormat(new Date(d)); }) + ; + + chart.yAxis + .showMaxMin(false) + .tickFormat(d3.format(",.0f")) + ; + + var svgElem = d3.select(location); + svgElem + .datum(data) + .transition() + .call(chart); + + // make our own x-axis tick marks because NVD3 doesn't provide any + var tickY2 = chart.yAxis.scale().range()[1]; + var lineElems = svgElem + .select('.nv-x.nv-axis.nvd3-svg') + .select('.nvd3.nv-wrap.nv-axis') + .select('g') + .selectAll('.tick') + .data(chart.xScale().ticks()) + .append('line') + .attr('class', 'x-axis-tick-mark') + .attr('x2', 0) + .attr('y1', tickY2 + 4) + .attr('y2', tickY2) + .attr('stroke-width', 1) + ; + + // set up the tooltip to display full dates + var tsFormat = d3.time.format('%b %-d, %Y %I:%M%p'); + var contentGenerator = chart.interactiveLayer.tooltip.contentGenerator(); + var tooltip = chart.interactiveLayer.tooltip; + tooltip.contentGenerator(function (d) { d.value = d.series[0].data.x; return contentGenerator(d); }); + tooltip.headerFormatter(function (d) { return tsFormat(new Date(d)); }); + + // common stuff for the sections below + var xScale = chart.xScale(); + var xPixelFirstBar = xScale(data[0].values[0].x); + var xPixelSecondBar = xScale(data[0].values[0].x + barTimespan * 1000); + var barWidth = xPixelSecondBar - xPixelFirstBar; // number of pixels representing time delta per bar + + // fix the bar widths so they don't overlap when there are gaps + function fixBarWidths(barSpacingFraction) { + svgElem + .selectAll('.nv-bars') + .selectAll('rect') + .attr('width', (1 - barSpacingFraction) * barWidth) + .attr('transform', function (d, i) { + var deltaX = xScale(data[0].values[i].x) - xPixelFirstBar; + deltaX += barSpacingFraction / 2 * barWidth; + return 'translate(' + deltaX + ', 0)'; + }) + ; + } + + /* + If you're representing sample measurements spaced a certain time apart, the tick marks should + be in the middle of the bars and some spacing between bars is recommended to aid with interpretation. + On the other hand, if you want to represent a quantity measured over a span of time (one bar), you're + better off placing the ticks on the edge of the bar and leaving no gap in between bars. + */ + function shiftXAxis() { + var xAxisElem = svgElem.select('.nv-axis.nv-x'); + var transform = xAxisElem.attr('transform'); + var xShift = -barWidth / 2; + transform = transform.replace('0,', xShift + ','); + xAxisElem.attr('transform', transform); + } + + if (meaning === 'instant') { + fixBarWidths(0.2); + } + else if (meaning === 'timespan') { + fixBarWidths(0.0); + shiftXAxis(); + } + + return chart; + }); + } + + renderChart('#test1', 'instant'); + renderChart('#test2', 'timespan'); + + window.setTimeout(function () { + window.setTimeout(function () { + document.getElementById('sc-one').style.display = 'block'; + document.getElementById('sc-two').style.display = 'none'; + }, 0); + }, 0); + + function switchChartStyle(style) { + if (style === 'instant') { + document.getElementById('sc-one').style.display = 'block'; + document.getElementById('sc-two').style.display = 'none'; + } + else if (style === 'timespan') { + document.getElementById('sc-one').style.display = 'none'; + document.getElementById('sc-two').style.display = 'block'; + } + } + +} \ No newline at end of file diff --git a/nvd3/nvd3.d.ts b/nvd3/nvd3.d.ts index 7e462248cc..19c03d6dcd 100644 --- a/nvd3/nvd3.d.ts +++ b/nvd3/nvd3.d.ts @@ -5,7 +5,8 @@ /// declare module nv { -//#region Chart Component + +//#region Core Interfaces interface Margin { left?: number, right?: number, @@ -18,6 +19,11 @@ declare module nv { width: number; } + interface ArcsRadius { + inner: number; + outer: number; + } + interface Offset { left?: number; top?: number; @@ -31,6 +37,34 @@ declare module nv { tooltip: Tooltip } + interface SymbolMap { + set(name:string,func: (size: any)=>void): void + } + + interface Utils { + /* Default color chooser uses a color scale of 20 colors from D3 https://github.com/mbostock/d3/wiki/Ordinal-Scales#categorical-colors */ + defaultColor(): string[]; + + getColor(arg: any): string[]; + + /* Binds callback function to run when window is resized */ + windowResize(listener: (ev: Event) => any): void; + /* Gets the browser window size */ + windowSize(): Size; + state(): State; + symbolMap: SymbolMap; + } + + interface ChartFactory { + generate: () => TChart; + callback?: (chart: TChart) => void; + } + + interface Nvd3TooltipStatic { + show([left, top]: [number, number], content: string, gravity?: string) //todo sort out use on nv.tooltip. + cleanup(): void; //todo sort out use on nv.tooltip. + } + interface Nvd3Element { dispatch: d3.Dispatch; options(options: any) @@ -42,12 +76,13 @@ declare module nv { } interface Chart extends Nvd3Element { - state: State; interactiveLayer: InteractiveLayer; - } - //#region Chart Component + +//#endregion + +//#region Chart Component interface Legend extends Nvd3Element { align(): boolean; @@ -91,9 +126,6 @@ declare module nv { width(value: number): this; } - /** - *NVD3 extension of D3 Axis - */ interface Nvd3Axis extends d3.svg.Axis { axisLabel(): string; axisLabel(value: string): this; @@ -148,78 +180,6 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; } - - interface Tooltip { - - /*For tooltip: Parent dom element of the SVG that holds the chart. This will make the tooltip dom be created inside this container instead of on the document body.*/ - chartContainer(el: HTMLElement): this - /*For tooltip: Parent dom element of the SVG that holds the chart. This will make the tooltip dom be created inside this container instead of on the document body.*/ - chartContainer(): HTMLElement - /*Attaches additional CSS classes to the tooltip DIV that is created.*/ - classes(el: string): this - /*Attaches additional CSS classes to the tooltip DIV that is created.*/ - classes(): string - /*Function that generates the tooltip content html.*/ - contentGenerator(): (d :any) => string; - /*Function that generates the tooltip content html.*/ - contentGenerator(func: (d: any) => string): this; - data(): any; - data(value: any): this; - distance(): number; - distance(value: number): this; - /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ - duration(): number; - /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ - duration(value: number): this; - /*For tooltip: completely enables or disabled the tooltip*/ - enabled(): boolean; - /*For tooltip: completely enables or disabled the tooltip*/ - enabled(value: boolean): this; - /*For tooltip: If not null, this fixes the top position of the tooltip.*/ - fixedTop(): number; - /*For tooltip: If not null, this fixes the top position of the tooltip.*/ - fixedTop(value: number): this; - /*Can be 'n','s','e','w'. Determines how tooltip is positioned*/ - gravity(): string; - /*Can be 'n','s','e','w'. Determines how tooltip is positioned*/ - gravity(value: string): this; - /*For tooltip: show the x axis value in the tooltip or not (not valid for pie charts for instance)*/ - headerEnabled(): boolean; - /*For tooltip: show the x axis value in the tooltip or not (not valid for pie charts for instance)*/ - headerEnabled(value: boolean): this; - /*For tooltip: formats the x axis value in the tooltip*/ - headerFormatter(func: (d: any) => string): this; - /*For tooltip: formats the x axis value in the tooltip*/ - headerFormatter(): (d: any) => string; - /*For tooltip: show or hide the tooltip by setting this to true or false. Tooltips used to be created and destroyed, but now we re-used the element and set opacity to 1 or 0.*/ - hidden(): boolean; - /*For tooltip: show or hide the tooltip by setting this to true or false. Tooltips used to be created and destroyed, but now we re-used the element and set opacity to 1 or 0.*/ - hidden(value: boolean): this; - /*Delay in ms before the tooltip hides itself after a mouseout event. A new mouseover event cancels the hide if within this timeout period.*/ - hideDelay(): number; - /*Delay in ms before the tooltip hides itself after a mouseout event. A new mouseover event cancels the hide if within this timeout period.*/ - hideDelay(value: number): this; - /**/ - id(): number; - keyFormatter(): (d: any, i: number) => string; - keyFormatter(func: (d: any, i: number) => string): this; - offset(): Offset; - offset(value: Offset): this; - /*sets the top/left positioning for the tooltip. Should be given an object with 'left' and/or 'top' attributes. You can override just one, just like the 'margin' option on charts*/ - position(): Offset; - /*sets the top/left positioning for the tooltip. Should be given an object with 'left' and/or 'top' attributes. You can override just one, just like the 'margin' option on charts*/ - position(value: Offset): this; - /*Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect)*/ - snapDistance(): number; - /*Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect)*/ - snapDistance(value: number): this; - /*returns the dom element of the tooltip.*/ - tooltipElem(): HTMLElement; - /*formats the y axis value(s) in the tooltip*/ - valueFormatter(): (d: any) => string; - /*formats the y axis value(s) in the tooltip*/ - valueFormatter(func: (d: any) => string): this; - } interface BoxPlot extends Nvd3Element { /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ @@ -234,8 +194,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(value: number): this; + id(): any; + id(value: number|string): this; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ margin(): Margin; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ @@ -247,9 +207,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -339,8 +299,8 @@ declare module nv { height(value: number): this; high(): (d: any) => number; high(func: (d: any) => number): this; - id(): number; - id(value: number): this; + id(): any; +id(value: number|string): this; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ interactive(): boolean; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ @@ -360,9 +320,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -409,8 +369,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(value: number): this; + id(): any; +id(value: number|string): this; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ margin(): Margin; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ @@ -430,9 +390,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -462,6 +422,32 @@ declare module nv { yScale(value: any): this; } + interface Distribution extends Nvd3Element { + axis(): string; + axis(value: 'x'): this; + axis(value: 'y'): this; + axis(value: string): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + domain(): number[]; + domain(value: number[]): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + getData(func: (d: any) => number): this; + scale(): any; + scale(value: any): this; + size(): number; + size(value: number): this; + width(): number; + width(value: number): this; + + + } + interface HistoricalBar extends Nvd3Element { /*If true, masks lines within the X and Y scales using a clip-path*/ clipEdge(): boolean; @@ -487,8 +473,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(value: number): this; + id(): any; +id(value: number|string): this; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ interactive(): boolean; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ @@ -506,9 +492,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -538,140 +524,12 @@ declare module nv { yScale(value: any): this; } - interface Scatter extends Nvd3Element { - /*If true, masks lines within the X and Y scales using a clip-path*/ - clipEdge(): boolean; - /*If true, masks lines within the X and Y scales using a clip-path*/ - clipEdge(value: boolean): this; - /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ - clipRadius(func: (d: any) => number): this; - /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ - clipRadius(value: number): this; - /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ - clipVoronoi(): boolean; - /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ - clipVoronoi(value: boolean): this; - /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ - color(value: string[]): this; - /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ - color(func: (d: any, i: number) => string): this; - /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ - duration(): number; - /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ - duration(value: number): this; - /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ - forcePoint(): number[]; - /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ - forcePoint(value: number[]): this; - /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ - forceX(): number[]; - /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ - forceX(value: number[]): this; - /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ - forceY(): number[]; - /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ - forceY(value: number[]): this; - /*The height the graph or component created inside the SVG should be made*/ - height(): number; - /*The height the graph or component created inside the SVG should be made.*/ - height(value: number): this; - id(): number; - id(value: number): this; - /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ - interactive(): boolean; - /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ - interactive(value: boolean): this; - /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ - margin(): Margin; - /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ - margin(value: Margin): this; - /**/ - padData(): boolean; - /**/ - padData(value: boolean): this; - /**/ - padDataOuter(): number; - /**/ - padDataOuter(value: number): this; - /* Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ - pointActive(): (d: any) => boolean; - /*Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ - pointActive(func: (d: any) => boolean): this; - /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ - pointxDomain(): number[]; - /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ - pointDomain(value: number[]): this; - /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ - pointRange(): number[]; - /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ - pointRange(value: number[]): this; - /* Override the default scale type for the point axis*/ - pointScale(): any; - /* Override the default scale type for the point axis*/ - pointScale(value: any): this; - /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ - pointSize(): (d: any) => number; - /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ - pointSize(func: (d: any) => number): this; - /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ - pointSize(value: number): this; - /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ - showVoronoi(): boolean; - /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ - showVoronoi(value: boolean): this; - /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ - useVoronoi(): boolean; - /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ - useVoronoi(value: boolean): this; - /* The width the graph or component created inside the SVG should be made*/ - width(): number; - /*The width the graph or component created inside the SVG should be made.*/ - width(value: number): this; - /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; - /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; - /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ - xDomain(): number[]; - /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ - xDomain(value: number[]): this; - /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ - xRange(): number[]; - /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ - xRange(value: number[]): this; - /* Override the default scale type for the X axis*/ - xScale(): any; - /* Override the default scale type for the X axis*/ - xScale(value: any): this; - y(): (d: any) => number; - /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - y(func: (d: any) => number): this; - /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ - yDomain(): number[]; - /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ - yDomain(value: number[]): this; - /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ - yRange(): number[]; - /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ - yRange(value: number[]): this; - /* Override the default scale type for the y axis*/ - yScale(): any; - /* Override the default scale type for the y axis*/ - yScale(value: any): this; - - } - interface Line extends Scatter { scatter: Scatter; - clearHighlights(): this; /*A provided function that allows a line to be non-continuous when not defined.*/ defined(): (d: any, i: number) => boolean; /*A provided function that allows a line to be non-continuous when not defined.*/ defined(func: (d: any, i: number) => boolean): this; - /**/ - highlightPoint(): (d: any) => boolean; - /**/ - highlightPoint(func: (d: any) => boolean): this; /*controls the line interpolation between points, many options exist, see the D3 reference:*/ interpolate(): string; /*controls the line interpolation between points, many options exist, see the D3 reference:*/ @@ -681,9 +539,7 @@ declare module nv { /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ isArea(value: boolean): this; /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ - isArea(func: (d: any) => boolean): this; - - + isArea(func: (d: any) => boolean): this; } interface MultiBar extends Nvd3Element { @@ -723,8 +579,8 @@ declare module nv { hideable(): boolean; /**/ hideable(value: boolean): this; - id(): number; - id(value: number): this; + id(): any; +id(value: number|string): this; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ margin(): Margin; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ @@ -750,9 +606,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -811,8 +667,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(value: number): this; + id(): any; +id(value: number|string): this; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ margin(): Margin; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ @@ -850,9 +706,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -911,8 +767,8 @@ declare module nv { height(value: number): this; high(): (d: any) => number; high(func: (d: any) => number): this; - id(): number; - id(value: number): this; + id(): any; +id(value: number|string): this; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ interactive(): boolean; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ @@ -932,9 +788,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -1000,6 +856,457 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; } + + interface Pie extends Nvd3Element { + /*Specifies each slice size, by an inner and a outer radius. Values between 0 and 1*/ + arcsRadius(): ArcsRadius[]; + /*Specifies each slice size, by an inner and a outer radius. Values between 0 and 1*/ + arcsRadius(value: ArcsRadius[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*D3 3.4+, For donut charts only, the corner radius of the slices. Typically used with padAngle.*/ + cornerRadius(): number; + /*D3 3.4+, For donut charts only, the corner radius of the slices. Typically used with padAngle.*/ + cornerRadius(value: number): this; + /*Whether to make a pie graph a donut graph or not.*/ + donut(): boolean; + /*Whether to make a pie graph a donut graph or not.*/ + donut(value: boolean): this; + /**/ + donutLabelsOutside(): boolean; + /**/ + donutLabelsOutside(value: boolean): this; + /*Percent of pie radius to cut out of the middle to make the donut. It is multiplied by the outer radius to calculate the inner radius, thus it should be between 0 and 1.*/ + donutRatio(): number; + /*Percent of pie radius to cut out of the middle to make the donut. It is multiplied by the outer radius to calculate the inner radius, thus it should be between 0 and 1.*/ + donutRatio(value: number): this; + /*Function used to manage the ending angle of the pie/donut chart*/ + endAngle(): (d: any) => number; + /*Function used to manage the ending angle of the pie/donut chart*/ + endAngle(func: (d: any) => number): this; + /*For pie/donut charts, whether to increase slice radius on hover or not*/ + growOnHover(): boolean; + /*For pie/donut charts, whether to increase slice radius on hover or not*/ + growOnHover(value: boolean): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; +id(value: number|string): this; + /**/ + labelFormat(): string; + /**/ + labelFormat(value: string): this; + /**/ + labelFormat(format: (d: any) => string): this; + /**/ + labelSunbeamLayout(): boolean; + /**/ + labelSunbeamLayout(value: boolean): this; + /*Pie/donut charts: The slice threshold size to not display the label because it woudl be too small of a space*/ + labelThreshold(): number; + /*Pie/donut charts: The slice threshold size to not display the label because it woudl be too small of a space*/ + labelThreshold(value: number): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(): string; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: 'key'): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: 'value'): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: 'percent'): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: string): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(func: (d: any, i: number, values:any)=> string): this; + /*Whether pie/donut chart labels should be outside the slices instead of inside them*/ + labelsOutside(): boolean; + /*Whether pie/donut chart labels should be outside the slices instead of inside them*/ + labelsOutside(value: boolean): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /*D3 3.4+, For donut charts only, the percent of the chart that should be spacing between slices.*/ + padAngle(): number; + /*D3 3.4+, For donut charts only, the percent of the chart that should be spacing between slices.*/ + padAngle(value: number): this; + /**/ + pieLabelsOutside(): boolean; + /**/ + pieLabelsOutside(value: boolean): this; + /*Show pie/donut chart labels for each slice*/ + showLabels(): boolean; + /*Show pie/donut chart labels for each slice*/ + showLabels(value: boolean): this; + /*Function used to manage the starting angle of the pie/donut chart*/ + startAngle(): (d: any) => number; + /*Function used to manage the starting angle of the pie/donut chart*/ + startAngle(func: (d: any) => number): this; + /*Text to include within the middle of a donut chart*/ + title(): string; + /*Text to include within the middle of a donut chart*/ + title(value: string): this; + /*Vertical offset for the donut chart title*/ + titleOffset(): number; + /*Vertical offset for the donut chart title*/ + titleOffset(value: number): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(): string; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(value: string): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(format: (d: any) => string): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /*Proxy function to return the Y value so adjustments can be made if needed.For pie/ donut chart this returns the value for the slice.*/ + y(): (d: any) => number; + /*Proxy function to return the Y value so adjustments can be made if needed. For pie/donut chart this returns the value for the slice.*/ + y(func: (d: any) => number): this; + /**/ + } + + interface Scatter extends Nvd3Element { + clearHighlights(): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(func: (d: any) => number): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(value: number): this; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(): boolean; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(): number[]; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(value: number[]): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; + id(value: number | string): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /**/ + padData(): boolean; + /**/ + padData(value: boolean): this; + /**/ + padDataOuter(): number; + /**/ + padDataOuter(value: number): this; + /* Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(): (d: any) => boolean; + /*Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(func: (d: any) => boolean): this; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointxDomain(): number[]; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointDomain(value: number[]): this; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(): number[]; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(value: number[]): this; + /* Override the default scale type for the point axis*/ + pointScale(): any; + /* Override the default scale type for the point axis*/ + pointScale(value: any): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(): (d: any) => number; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(func: (d: any) => number): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(value: number): this; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(): boolean; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(value: boolean): this; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(): boolean; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + + } + + interface SparkLine extends Nvd3Element { + animate(): boolean; + animate(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any, i?: number) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any, i?: number) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any, i?: number) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any, i?: number) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface SparkLinePlus extends SparkLine { + sparkline: SparkLine; + + alignValue(): boolean; + alignValue(value: boolean): this; + /*Message to display if no data is provided*/ + noData(): string; + /*Message to display if no data is provided*/ + noData(value: string): this; + rightAlignValue(): boolean; + rightAlignValue(value: boolean): this; + /*Shows the last value in the sparkline to the right of the line.*/ + showLastValue(): boolean; + /*Shows the last value in the sparkline to the right of the line.*/ + showLastValue(value: boolean): this; + xTickFormat(format: (d: any) => string): this; + xTickFormat(format: string): this; + xTickFormat(format: (d: any, i: any) => string); + yTickFormat(format: (d: any) => string): this; + yTickFormat(format: string): this; + yTickFormat(format: (d: any, i: any) => string); + } + + interface StackedArea extends Scatter { + scatter: Scatter; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(): (d: any, i: number) => boolean; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(func: (d: any, i: number) => boolean): this; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(): string; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(value: string): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + offset(offset: 'silhouette'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + offset(offset: 'wiggle'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + offset(offset: 'expand'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + offset(offset: 'zero'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + offset(offset: string): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + offset(offset: (data: Array<[number, number]>) => number[]): this; + order(): string; + order(value: string): this; + style(offset: 'stack'): this; + style(offset: 'stream'): this; + style(offset: 'stream-center'): this; + style(offset: 'expand'): this; + style(offset: 'stack_percent'): this; + style(offset: string): this; + } + + interface Sunburst extends Nvd3Element { + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; + id(value: number|string): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /*For sunburst only: specifies the mode of drawing the sunburst segments. Can be 'size' or 'count'. 'size' draws the segments according to the 'size' attribute of the leaf nodes, 'count' draws according to the amount of siblings a node has.*/ + mode(): string; + /*For sunburst only: specifies the mode of drawing the sunburst segments. Can be 'size' or 'count'. 'size' draws the segments according to the 'size' attribute of the leaf nodes, 'count' draws according to the amount of siblings a node has.*/ + mode(value: 'size'): this; + /*For sunburst only: specifies the mode of drawing the sunburst segments. Can be 'size' or 'count'. 'size' draws the segments according to the 'size' attribute of the leaf nodes, 'count' draws according to the amount of siblings a node has.*/ + mode(value: 'count'): this; + /*For sunburst only: specifies the mode of drawing the sunburst segments. Can be 'size' or 'count'. 'size' draws the segments according to the 'size' attribute of the leaf nodes, 'count' draws according to the amount of siblings a node has.*/ + mode(value: string): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + } + + interface Tooltip { + + /*For tooltip: Parent dom element of the SVG that holds the chart. This will make the tooltip dom be created inside this container instead of on the document body.*/ + chartContainer(el: HTMLElement): this + /*For tooltip: Parent dom element of the SVG that holds the chart. This will make the tooltip dom be created inside this container instead of on the document body.*/ + chartContainer(): HTMLElement + /*Attaches additional CSS classes to the tooltip DIV that is created.*/ + classes(el: string): this + /*Attaches additional CSS classes to the tooltip DIV that is created.*/ + classes(): string + /*Function that generates the tooltip content html.*/ + contentGenerator(): (d: any) => string; + /*Function that generates the tooltip content html.*/ + contentGenerator(func: (d: any) => string): this; + data(): any; + data(value: any): this; + distance(): number; + distance(value: number): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*For tooltip: completely enables or disabled the tooltip*/ + enabled(): boolean; + /*For tooltip: completely enables or disabled the tooltip*/ + enabled(value: boolean): this; + /*For tooltip: If not null, this fixes the top position of the tooltip.*/ + fixedTop(): number; + /*For tooltip: If not null, this fixes the top position of the tooltip.*/ + fixedTop(value: number): this; + /*Can be 'n','s','e','w'. Determines how tooltip is positioned*/ + gravity(): string; + /*Can be 'n','s','e','w'. Determines how tooltip is positioned*/ + gravity(value: string): this; + /*For tooltip: show the x axis value in the tooltip or not (not valid for pie charts for instance)*/ + headerEnabled(): boolean; + /*For tooltip: show the x axis value in the tooltip or not (not valid for pie charts for instance)*/ + headerEnabled(value: boolean): this; + /*For tooltip: formats the x axis value in the tooltip*/ + headerFormatter(func: (d: any) => string): this; + /*For tooltip: formats the x axis value in the tooltip*/ + headerFormatter(): (d: any) => string; + /*For tooltip: show or hide the tooltip by setting this to true or false. Tooltips used to be created and destroyed, but now we re-used the element and set opacity to 1 or 0.*/ + hidden(): boolean; + /*For tooltip: show or hide the tooltip by setting this to true or false. Tooltips used to be created and destroyed, but now we re-used the element and set opacity to 1 or 0.*/ + hidden(value: boolean): this; + /*Delay in ms before the tooltip hides itself after a mouseout event. A new mouseover event cancels the hide if within this timeout period.*/ + hideDelay(): number; + /*Delay in ms before the tooltip hides itself after a mouseout event. A new mouseover event cancels the hide if within this timeout period.*/ + hideDelay(value: number): this; + /**/ + id(): any; + keyFormatter(): (d: any, i: number) => string; + keyFormatter(func: (d: any, i: number) => string): this; + offset(): Offset; + offset(value: Offset): this; + /*sets the top/left positioning for the tooltip. Should be given an object with 'left' and/or 'top' attributes. You can override just one, just like the 'margin' option on charts*/ + position(): Offset; + /*sets the top/left positioning for the tooltip. Should be given an object with 'left' and/or 'top' attributes. You can override just one, just like the 'margin' option on charts*/ + position(value: Offset): this; + /*Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect)*/ + snapDistance(): number; + /*Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect)*/ + snapDistance(value: number): this; + /*returns the dom element of the tooltip.*/ + tooltipElem(): HTMLElement; + /*formats the y axis value(s) in the tooltip*/ + valueFormatter(): (d: any) => string; + /*formats the y axis value(s) in the tooltip*/ + valueFormatter(func: (d: any) => string): this; + } + //#endregion //#region Charts @@ -1021,8 +1328,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(value: number): this; + id(): any; + id(value: number|string): this; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ margin(): Margin; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ @@ -1060,9 +1367,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -1182,8 +1489,8 @@ declare module nv { height(value: number): this; high(): (d: any) => number; high(func: (d: any) => number): this; - id(): number; - id(value: number): this; + id(): any; + id(value: number|string): this; this; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ interactive(): boolean; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ @@ -1233,9 +1540,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -1295,8 +1602,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(value: number): this; + id(): any; + id(value: number|string): this; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ margin(): Margin; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ @@ -1342,9 +1649,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -1408,8 +1715,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(value: number): this; + id(): any; +id(value: number|string): this; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ interactive(): boolean; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ @@ -1456,9 +1763,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -1493,6 +1800,7 @@ declare module nv { xAxis: Nvd3Axis; yAxis: Nvd3Axis; legend: Legend; + tooltip: Tooltip; clearHighlights(): this; /*If true, masks lines within the X and Y scales using a clip-path*/ @@ -1543,8 +1851,8 @@ declare module nv { highlightPoint(): (d: any) => boolean; /**/ highlightPoint(func: (d: any) => boolean): this; - id(): number; - id(value: number): this; + id(): any; +id(value: number|string): this; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ interactive(): boolean; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ @@ -1636,9 +1944,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -1741,8 +2049,8 @@ declare module nv { highlightPoint(): (d: any) => boolean; /**/ highlightPoint(func: (d: any) => boolean): this; - id(): number; - id(value: number): this; + id(): any; +id(value: number|string): this; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ interactive(): boolean; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ @@ -1830,9 +2138,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -1927,8 +2235,8 @@ declare module nv { highlightPoint(): (d: any) => boolean; /**/ highlightPoint(func: (d: any) => boolean): this; - id(): number; - id(value: number): this; + id(): any; +id(value: number|string): this; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ interactive(): boolean; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ @@ -2007,9 +2315,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -2099,8 +2407,8 @@ declare module nv { hideable(): boolean; /**/ hideable(value: boolean): this; - id(): number; - id(value: number): this; + id(): any; +id(value: number|string): this; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ margin(): Margin; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ @@ -2166,9 +2474,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -2243,8 +2551,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(value: number): this; + id(): any; +id(value: number|string): this; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ margin(): Margin; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ @@ -2295,9 +2603,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -2331,84 +2639,25 @@ declare module nv { yScale(value: any): this; } - //todo complete + interface MultiChart extends Chart { lines1: Line; lines2: Line; - bars1: HistoricalBar; - bars2: HistoricalBar; - stack1: HistoricalBar; - stack2: HistoricalBar; + bars1: MultiBar; + bars2: MultiBar; + scatters1: Scatter; + scatters2: Scatter; + stack1: StackedArea; + stack2: StackedArea; xAxis: Nvd3Axis; yAxis1: Nvd3Axis; yAxis2: Nvd3Axis; tooltip: Tooltip; - brushExtent(): [number, number] | [[number, number], [number, number]]; - brushExtent(value: [number, number] | [[number, number], [number, number]]): this; - clearHighlights(): this; - /*If true, masks lines within the X and Y scales using a clip-path*/ - clipEdge(): boolean; - /*If true, masks lines within the X and Y scales using a clip-path*/ - clipEdge(value: boolean): this; - /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ - clipRadius(func: (d: any) => number): this; - /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ - clipRadius(value: number): this; - /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ - clipVoronoi(): boolean; - /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ - clipVoronoi(value: boolean): this; /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ color(value: string[]): this; /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ color(func: (d: any, i: number) => string): this; - /*No longer used.Use chart.dispatch.changeState(...) instead*/ - defaultState(): any; - /*No longer used.Use chart.dispatch.changeState(...) instead*/ - defaultState(value: any): this; - /*A provided function that allows a line to be non-continuous when not defined.*/ - defined(): (d: any, i: number) => boolean; - /*A provided function that allows a line to be non-continuous when not defined.*/ - defined(func: (d: any, i: number) => boolean): this; - /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ - duration(): number; - /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ - duration(value: number): this; - focusEnable(): boolean; - focusEnable(value: boolean): this; - focusHeight(): number; - focusHeight(value: number): this; - focusShowAxisX(): boolean; - focusShowAxisX(value: boolean): this; - focusShowAxisY(): boolean; - focusShowAxisY(value: boolean): this; - /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ - forcePoint(): number[]; - /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ - forcePoint(value: number[]): this; - /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ - forceX(): number[]; - /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ - forceX(value: number[]): this; - /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ - forceY(): number[]; - /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ - forceY(value: number[]): this; - /*The height the graph or component created inside the SVG should be made*/ - height(): number; - /*The height the graph or component created inside the SVG should be made.*/ - height(value: number): this; - /**/ - highlightPoint(): (d: any) => boolean; - /**/ - highlightPoint(func: (d: any) => boolean): this; - id(): number; - id(value: number): this; - /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ - interactive(): boolean; - /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ - interactive(value: boolean): this; /*controls the line interpolation between points, many options exist, see the D3 reference:*/ interpolate(): string; /*controls the line interpolation between points, many options exist, see the D3 reference:*/ @@ -2419,58 +2668,16 @@ declare module nv { isArea(value: boolean): this; /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ isArea(func: (d: any) => boolean): this; - /*The extra text after the label in the legend that tells what axis the series belongs to, for any series on the left axis.*/ - legendLeftAxisHint(): string; - /*The extra text after the label in the legend that tells what axis the series belongs to, for any series on the left axis.*/ - legendLeftAxisHint(value: string): this - /*The extra text after the label in the legend that tells what axis the series belongs to, for any seris on the right axis.*/ - legendRightAxisHint(): string; - /*The extra text after the label in the legend that tells what axis the series belongs to, for any seris on the right axis.*/ - legendRightAxisHint(value: string): this /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ margin(): Margin; /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ margin(value: Margin): this; noData(): string; noData(value: string): this; - /**/ - padData(): boolean; - /**/ - padData(value: boolean): this; - /**/ - padDataOuter(): number; - /**/ - padDataOuter(value: number): this; - /* Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ - pointActive(): (d: any) => boolean; - /*Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ - pointActive(func: (d: any) => boolean): this; - /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ - pointxDomain(): number[]; - /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ - pointDomain(value: number[]): this; - /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ - pointRange(): number[]; - /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ - pointRange(value: number[]): this; - /* Override the default scale type for the point axis*/ - pointScale(): any; - /* Override the default scale type for the point axis*/ - pointScale(value: any): this; - /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ - pointSize(): (d: any) => number; - /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ - pointSize(func: (d: any) => number): this; - /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ - pointSize(value: number): this; /*Whether to display the legend or not.*/ showLegend(): boolean; /*Whether to display the legend or not.*/ showLegend(value: boolean): this; - /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ - showVoronoi(): boolean; - /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ - showVoronoi(value: boolean): this; /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ tooltipContent(): (d: any) => string; /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ @@ -2479,10 +2686,6 @@ declare module nv { tooltips(): boolean; /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ tooltips(value: boolean): this; - /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ - useInteractiveGuideline(): boolean; - /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ - useInteractiveGuideline(value: boolean): this; /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ useVoronoi(): boolean; /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ @@ -2492,36 +2695,21 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ - xDomain(): number[]; - /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ - xDomain(value: number[]): this; - /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ - xRange(): number[]; - /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ - xRange(value: number[]): this; - /* Override the default scale type for the X axis*/ - xScale(): any; - /* Override the default scale type for the X axis*/ - xScale(value: any): this; y(): (d: any) => number; /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ y(func: (d: any) => number): this; - /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ - yDomain(): number[]; - /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ - yDomain(value: number[]): this; - /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ - yRange(): number[]; - /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ - yRange(value: number[]): this; - /* Override the default scale type for the y axis*/ - yScale(): any; - /* Override the default scale type for the y axis*/ - yScale(value: any): this; + /* */ + yDomain1(): number[]; + /* */ + yDomain1(value: number[]): this; + /* */ + yDomain2(): number[]; + /* */ + yDomain2(value: number[]): this; } interface OhlcBarChart extends Chart { @@ -2563,8 +2751,8 @@ declare module nv { height(value: number): this; high(): (d: any) => number; high(func: (d: any) => number): this; - id(): number; - id(value: number): this; + id(): any; + id(value: number|string): this; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ interactive(): boolean; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ @@ -2614,9 +2802,9 @@ declare module nv { /*The width the graph or component created inside the SVG should be made.*/ width(value: number): this; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(): (d: any) => number; + x(): (d: any) => any; /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ - x(func: (d: any) => number): this; + x(func: (d: any) => any): this; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ xDomain(): number[]; /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ @@ -2702,8 +2890,406 @@ declare module nv { width(value: number): this; } -//#endregion - + interface PieChart extends Chart { + legend: Legend; + pie: Pie; + tooltip: Tooltip; + + /*Specifies each slice size, by an inner and a outer radius. Values between 0 and 1*/ + arcsRadius(): ArcsRadius[]; + /*Specifies each slice size, by an inner and a outer radius. Values between 0 and 1*/ + arcsRadius(value: ArcsRadius[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*D3 3.4+, For donut charts only, the corner radius of the slices. Typically used with padAngle.*/ + cornerRadius(): number; + /*D3 3.4+, For donut charts only, the corner radius of the slices. Typically used with padAngle.*/ + cornerRadius(value: number): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*Whether to make a pie graph a donut graph or not.*/ + donut(): boolean; + /*Whether to make a pie graph a donut graph or not.*/ + donut(value: boolean): this; + /**/ + donutLabelsOutside(): boolean; + /**/ + donutLabelsOutside(value: boolean): this; + /*Percent of pie radius to cut out of the middle to make the donut. It is multiplied by the outer radius to calculate the inner radius, thus it should be between 0 and 1.*/ + donutRatio(): number; + /*Percent of pie radius to cut out of the middle to make the donut. It is multiplied by the outer radius to calculate the inner radius, thus it should be between 0 and 1.*/ + donutRatio(value: number): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*Function used to manage the ending angle of the pie/donut chart*/ + endAngle(): (d: any) => number; + /*Function used to manage the ending angle of the pie/donut chart*/ + endAngle(func: (d: any) => number): this; + /*For pie/donut charts, whether to increase slice radius on hover or not*/ + growOnHover(): boolean; + /*For pie/donut charts, whether to increase slice radius on hover or not*/ + growOnHover(value: boolean): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; +id(value: number|string): this; + /**/ + labelFormat(): string; + /**/ + labelFormat(value: string): this; + /**/ + labelFormat(format: (d: any) => string): this; + /**/ + labelSunbeamLayout(): boolean; + /**/ + labelSunbeamLayout(value: boolean): this; + /*Pie/donut charts: The slice threshold size to not display the label because it woudl be too small of a space*/ + labelThreshold(): number; + /*Pie/donut charts: The slice threshold size to not display the label because it woudl be too small of a space*/ + labelThreshold(value: number): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(): string; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: 'key'): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: 'value'): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: 'percent'): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: string): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(func: (d: any, i: number, values: any) => string): this; + /*Whether pie/donut chart labels should be outside the slices instead of inside them*/ + labelsOutside(): boolean; + /*Whether pie/donut chart labels should be outside the slices instead of inside them*/ + labelsOutside(value: boolean): this; + /*Position of the legend (top or right). */ + legendPosition(): string; + /*Position of the legend (top or right). */ + legendPosition(value: 'top'): this; + /*Position of the legend (top or right). */ + legendPosition(value: 'right'): this; + /*Position of the legend (top or right). */ + legendPosition(value: string): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /*Message to display if no data is provided*/ + noData(): string; + /*Message to display if no data is provided*/ + noData(value : string): this; + /*D3 3.4+, For donut charts only, the percent of the chart that should be spacing between slices.*/ + padAngle(): number; + /*D3 3.4+, For donut charts only, the percent of the chart that should be spacing between slices.*/ + padAngle(value: number): this; + /**/ + pieLabelsOutside(): boolean; + /**/ + pieLabelsOutside(value: boolean): this; + /*Show pie/donut chart labels for each slice*/ + showLabels(): boolean; + /*Show pie/donut chart labels for each slice*/ + showLabels(value: boolean): this; + /*Whether to display the legend or not*/ + showLegend(): boolean; + /*Whether to display the legend or not*/ + showLegend(value: boolean): this; + /*Function used to manage the starting angle of the pie/donut chart*/ + startAngle(): (d: any) => number; + /*Function used to manage the starting angle of the pie/donut chart*/ + startAngle(func: (d: any) => number): this; + /*Text to include within the middle of a donut chart*/ + title(): string; + /*Text to include within the middle of a donut chart*/ + title(value: string): this; + /*Vertical offset for the donut chart title*/ + titleOffset(): number; + /*Vertical offset for the donut chart title*/ + titleOffset(value: number): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(): string; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(value: string): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(format: (d: any) => string): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /*Proxy function to return the Y value so adjustments can be made if needed.For pie/ donut chart this returns the value for the slice.*/ + y(): (d: any) => number; + /*Proxy function to return the Y value so adjustments can be made if needed. For pie/donut chart this returns the value for the slice.*/ + y(func: (d: any) => number): this; + } + + interface ScatterChart extends Chart { + scatter: Scatter; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + legend: Legend; + tooltip: Tooltip; + distX: Distribution; + distY: Distribution; + + clearHighlights(): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(func: (d: any) => number): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(value: number): this; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(): boolean; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(): number[]; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(value: number[]): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /**/ + highlightPoint(): (d: any) => boolean; + /**/ + highlightPoint(func: (d: any) => boolean): this; + id(): any; +id(value: number|string): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + /**/ + padData(): boolean; + /**/ + padData(value: boolean): this; + /**/ + padDataOuter(): number; + /**/ + padDataOuter(value: number): this; + /* Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(): (d: any) => boolean; + /*Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(func: (d: any) => boolean): this; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointxDomain(): number[]; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointDomain(value: number[]): this; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(): number[]; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(value: number[]): this; + /* Override the default scale type for the point axis*/ + pointScale(): any; + /* Override the default scale type for the point axis*/ + pointScale(value: any): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(): (d: any) => number; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(func: (d: any) => number): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(value: number): this; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /**/ + showDistX(): boolean; + /**/ + showDistX(value: boolean): this; + /**/ + showDistY(): boolean; + /**/ + showDistY(value: boolean): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(): boolean; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /**/ + tooltipXContent(): (d: any) => string; + /**/ + tooltipXContent(func: (d: any) => string): this; + /**/ + tooltipYContent(): (d: any) => string; + /**/ + tooltipYContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(): boolean; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + + } + + interface StackedAreaChart extends StackedArea, Chart { + stacked: StackedArea; + legend: Legend; + controls: Legend; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + + controlLabels(): any; + /*Object that defines the labels for control items in the graph. For instance, in the stackedAreaChart, there are controls for making it stacked, expanded, or stream. For stacked bar charts, there is stacked and grouped.*/ + controlLabels(value: any): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*Message to display if no data is provided*/ + noData(): string; + /*Message to display if no data is provided*/ + noData(value: string): this; + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + showLegend(): boolean; + /*Whether to display the legend or not*/ + showLegend(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + } + + interface SunburstChart extends Sunburst, Chart { + sunburst: Sunburst; + tooltip: Tooltip; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*Message to display if no data is provided*/ + noData(): string; + /*Message to display if no data is provided*/ + noData(value: string): this; + } + +//#endregion interface Models{ boxPlotChart(): BoxPlotChart; @@ -2714,6 +3300,7 @@ declare module nv { cumulativeLineChart(): CumulativeLineChart; discreteBar(): DiscreteBar; discreteBarChart(): DiscreteBarChart; + distribution(): Distribution; historicalBar(): HistoricalBar; historicalBarChart(bar_model?: HistoricalBar): HistoricalBarChart; ohlcBar(): OhlcBar; @@ -2725,34 +3312,40 @@ declare module nv { lineWithFocusChart(): LineWithFocusChart; multiBarChart(): MultiBarChart; multiBarHorizontalChart(): MultiBarHorizontalChart; + multiChart(): MultiChart; parallelCoordinates(): ParallelCoordinates; parallelCoordinatesChart(): ParallelCoordinatesChart; + pie(): Pie; + pieChart(): PieChart; scatter(): Scatter; + scatterChart(): ScatterChart; + sparkline(): SparkLine; + sparklinePlus(): SparkLinePlus; + stackedArea(): StackedArea; + stackedAreaChart(): StackedAreaChart; + sunburst(): Sunburst; + sunburstChart(): SunburstChart; tooltip(): Tooltip; } - interface Utils { - windowResize(listener: (ev: Event) => any): void; - windowSize(): Size; - state(): State; - } - interface ChartFactory { - generate: () => TChart; - callback?: (chart: TChart)=> void; - } + interface Nvd3Static{ + /*set to false in production*/ + dev: boolean + /*stores all the ready to use charts*/ + charts: any + models: Models; + tooltip: Nvd3TooltipStatic; + utils: Utils; + + /*stores some statistics and potential error messages*/ + logs: any; - interface nvTooltipStatic { - show([left, top]: [number, number], content: string, gravity: string) //todo sort out use on nv.tooltip. - cleanup(): void; //todo sort out use on nv.tooltip. - } - - interface nvStatic{ - models: Models; - tooltip: nvTooltipStatic; - utils: Utils; addGraph(factory: ChartFactory); addGraph(generate: () => TChart, callBack?: (chart: TChart) => void); - log: (topic:string, value?:string)=> void + + + log(topic: string, value?: string): string //returns last argument + log(arg: any[]): any //returns last argument } } -declare var nv : nv.nvStatic; \ No newline at end of file +declare var nv : nv.Nvd3Static; \ No newline at end of file From 5099d1cf5bbf8d358e68a55bc941c3246b9329b4 Mon Sep 17 00:00:00 2001 From: robbiev Date: Wed, 30 Dec 2015 12:57:25 -0800 Subject: [PATCH 171/441] Adding helpers to IScope to keep up-to-date with angular-meteor 1.3.1+ --- angular-meteor/angular-meteor.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/angular-meteor/angular-meteor.d.ts b/angular-meteor/angular-meteor.d.ts index b3f520ac5b..6df5bc63d2 100644 --- a/angular-meteor/angular-meteor.d.ts +++ b/angular-meteor/angular-meteor.d.ts @@ -39,6 +39,18 @@ declare module angular.meteor { * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. */ subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; + + /** + * The helpers method is part of the ReactiveContext, and available on every context and $scope. + * These method are defined as Object, where each key is the name of the variable that will be available on the context we run, and each value is a function with a return value. + * Under the hood, each helper starts a new Tracker.autorun. When its reactive dependencies change, the helper is rerun. + * To trigger a rerun every time an specific Angular variable change, use getReactively](/api/1.3.1/get-reactively) to make your Angular variable reactive inside the helper its used in. + * Each helper function should return a MongoDB Cursor and the helpers will expose it as a normal array to the context. + * + * @param definitions - Object containing `name` => `function` definition, where each name is a string and each function is the helper function. Should return a [MongoDB Cursor](http://docs.meteor.com/#/full/mongo_cursor) + * @return This method returns this, which the the reactive context, in order to provide the ability to chain the logic. + */ + helpers(definitions : { [helperName : string] : () => Mongo.Cursor }): IScope; } /** From 5a8a7ab18146aeb82cc61b0f960bd4fd9794ef7b Mon Sep 17 00:00:00 2001 From: PjMitchell Date: Wed, 30 Dec 2015 21:42:46 +0000 Subject: [PATCH 172/441] Fixed implicit anys --- nvd3/nvd3.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nvd3/nvd3.d.ts b/nvd3/nvd3.d.ts index 19c03d6dcd..e7cfe39ff5 100644 --- a/nvd3/nvd3.d.ts +++ b/nvd3/nvd3.d.ts @@ -61,13 +61,13 @@ declare module nv { } interface Nvd3TooltipStatic { - show([left, top]: [number, number], content: string, gravity?: string) //todo sort out use on nv.tooltip. + show([left, top]: [number, number], content: string, gravity?: string): void; //todo sort out use on nv.tooltip. cleanup(): void; //todo sort out use on nv.tooltip. } interface Nvd3Element { dispatch: d3.Dispatch; - options(options: any) + options(options: any): this; update(): void; (transition: d3.Transition, ...args: any[]): any; (selection: d3.Selection, ...args: any[]): any; @@ -1168,10 +1168,10 @@ id(value: number|string): this; showLastValue(value: boolean): this; xTickFormat(format: (d: any) => string): this; xTickFormat(format: string): this; - xTickFormat(format: (d: any, i: any) => string); + xTickFormat(format: (d: any, i: any) => string) : this; yTickFormat(format: (d: any) => string): this; yTickFormat(format: string): this; - yTickFormat(format: (d: any, i: any) => string); + yTickFormat(format: (d: any, i: any) => string) :this; } interface StackedArea extends Scatter { @@ -1490,7 +1490,7 @@ id(value: number|string): this; high(): (d: any) => number; high(func: (d: any) => number): this; id(): any; - id(value: number|string): this; this; + id(value: number|string): this; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ interactive(): boolean; /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ @@ -3340,8 +3340,8 @@ id(value: number|string): this; /*stores some statistics and potential error messages*/ logs: any; - addGraph(factory: ChartFactory); - addGraph(generate: () => TChart, callBack?: (chart: TChart) => void); + addGraph(factory: ChartFactory): void; + addGraph(generate: () => TChart, callBack?: (chart: TChart) => void): void; log(topic: string, value?: string): string //returns last argument From 32a17c5a78f0afd6d79ff2b3c12b29d12dbcc394 Mon Sep 17 00:00:00 2001 From: filipszu Date: Wed, 30 Dec 2015 21:23:14 -0500 Subject: [PATCH 173/441] Added properties to RaphaelFont interface --- raphael/raphael.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/raphael/raphael.d.ts b/raphael/raphael.d.ts index 4d174fa717..58c7aa156f 100644 --- a/raphael/raphael.d.ts +++ b/raphael/raphael.d.ts @@ -19,7 +19,9 @@ interface RaphaelAnimation { } interface RaphaelFont { - + w:number; + face:any; + glyphs:any; } interface RaphaelElement { From 65482201ec7b9ba1c7042bd94e2db6adf64a462b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e?= Date: Thu, 31 Dec 2015 06:02:05 +0100 Subject: [PATCH 174/441] stylus: Add missing Renderer.render() variant --- stylus/stylus.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stylus/stylus.d.ts b/stylus/stylus.d.ts index b0c8db62f0..dcaa07902a 100644 --- a/stylus/stylus.d.ts +++ b/stylus/stylus.d.ts @@ -647,6 +647,11 @@ declare module Stylus { */ render(callback: RenderCallback): void; + /** + * Parse and evaluate AST and return the result. + */ + render(): string; + /** * Get dependencies of the compiled file. */ From c0049815d6217cdd6a4969018f5f4c33363b6010 Mon Sep 17 00:00:00 2001 From: Marwan Aouida Date: Thu, 31 Dec 2015 08:20:06 +0100 Subject: [PATCH 175/441] updated test using a sample code from official documentation --- couchbase/couchbase-tests.ts | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/couchbase/couchbase-tests.ts b/couchbase/couchbase-tests.ts index 92864edc61..a1a3ee6bba 100644 --- a/couchbase/couchbase-tests.ts +++ b/couchbase/couchbase-tests.ts @@ -1,25 +1,16 @@ /// import couchbase = require('couchbase'); -import Cluster = couchbase.Cluster; -import ViewQuery = couchbase.ViewQuery; -import Errors = couchbase.errors; +var cluster = new couchbase.Cluster('couchbase://127.0.0.1'); +var bucket = cluster.openBucket('default'); -var cluster = new Cluster('my_connection_string'); -var clusterManager = cluster.manager(); -var bucket = cluster.openBucket('my_bucket'); -var bucketManager = bucket.manager(); +bucket.upsert('testdoc', { name: 'Frank' }, (error) => { + if (error) throw error; -var query = ViewQuery.from('users', 'date') - .group_level(2) - .stale(ViewQuery.Update.BEFORE) - .limit(5) - .range([2015, 1, 2, 13, 56, 0], [2015, 1, 2, 16, 43, 57], true); + bucket.get('testdoc', (err, result) => { + if (err) throw err; -bucket.query(query, (err, result) => { - if (err != null && err.code === Errors.genericError) { - // do something - } else { - // do something - } + console.log(result.value); + // {name: Frank} + }); }); \ No newline at end of file From 11b4d3ab95462979372f3e5f493886ce2628abb7 Mon Sep 17 00:00:00 2001 From: Marwan Aouida Date: Thu, 31 Dec 2015 08:39:01 +0100 Subject: [PATCH 176/441] fixed build errors + removed old version definition --- couchbase/couchbase-1.0.0-tests.ts | 21 - couchbase/couchbase-1.0.0.d.ts | 729 ----------------------------- couchbase/couchbase.d.ts | 117 ++--- 3 files changed, 64 insertions(+), 803 deletions(-) delete mode 100644 couchbase/couchbase-1.0.0-tests.ts delete mode 100644 couchbase/couchbase-1.0.0.d.ts diff --git a/couchbase/couchbase-1.0.0-tests.ts b/couchbase/couchbase-1.0.0-tests.ts deleted file mode 100644 index 4305300eea..0000000000 --- a/couchbase/couchbase-1.0.0-tests.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// - -import couchbase = require('couchbase'); -var db = new couchbase.Connection({ bucket: "default" }, function (err) { - if (err) throw err; - - // TS 0.9.5 bug https://typescript.codeplex.com/workitem/2035, todo: remove cast after fix - (db).set('testdoc', { name: 'Frank' }, function (err, result) { - if (err) throw err; - - var s: string = err.message; - - // TS 0.9.5 bug https://typescript.codeplex.com/workitem/2035, todo: remove cast after fix - (db).get('testdoc', function (err, result) { - if (err) throw err; - - console.log(result.value); - // {name: Frank} - }); - }); -}); \ No newline at end of file diff --git a/couchbase/couchbase-1.0.0.d.ts b/couchbase/couchbase-1.0.0.d.ts deleted file mode 100644 index 3a8605b731..0000000000 --- a/couchbase/couchbase-1.0.0.d.ts +++ /dev/null @@ -1,729 +0,0 @@ -// Type definitions for Couchbase Couchnode -// Project: https://github.com/couchbase/couchnode -// Definitions by: Basarat Ali Syed -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module 'couchbase' { - - /** - * Enumeration of all error codes. See libcouchbase documentation - * for more details on what these errors represent. - * - * @global - * @readonly - * @enum {number} - */ - export var errors: { - /** Operation was successful **/ - success: number; - - /** Authentication should continue. **/ - authContinue: number; - - /** Error authenticating. **/ - authError: number; - - /** The passed incr/decr delta was invalid. **/ - deltaBadVal: number; - - /** Object is too large to be stored on the cluster. **/ - objectTooBig: number; - - /** Server is too busy to handle your request right now. **/ - serverBusy: number; - - /** Internal libcouchbase error. **/ - cLibInternal: number; - - /** An invalid arguement was passed. **/ - cLibInvalidArgument: number; - - /** The server is out of memory. **/ - cLibOutOfMemory: number; - - /** An invalid range was specified. **/ - invalidRange: number; - - /** An unknown error occured within libcouchbase. **/ - cLibGenericError: number; - - /** A temporary error occured. Try again. **/ - temporaryError: number; - - /** The key already exists on the server. **/ - keyAlreadyExists: number; - - /** The key does not exist on the server. **/ - keyNotFound: number; - - /** Failed to open library. **/ - failedToOpenLibrary: number; - - /** Failed to find expected symbol in library. **/ - failedToFindSymbol: number; - - /** A network error occured. **/ - networkError: number; - - /** Operations were performed on the incorrect server. **/ - wrongServer: number; - - /** Operations were performed on the incorrect server. **/ - notMyVBucket: number; - - /** The document was not stored. */ - notStored: number; - - /** An unsupported operation was sent to the server. **/ - notSupported: number; - - /** An unknown command was sent to the server. **/ - unknownCommand: number; - - /** An unknown host was specified. **/ - unknownHost: number; - - /** A protocol error occured. **/ - protocolError: number; - - /** The operation timed out. **/ - timedOut: number; - - /** Error connecting to the server. **/ - connectError: number; - - /** The bucket you request was not found. **/ - bucketNotFound: number; - - /** libcouchbase is out of memory. **/ - clientOutOfMemory: number; - - /** A temporary error occured in libcouchbase. Try again. **/ - clientTemporaryError: number; - - /** A bad handle was passed. */ - badHandle: number; - - /** A server bug caused the operation to fail. **/ - serverBug: number; - - /** The host format specified is invalid. **/ - invalidHostFormat: number; - - /** Not enough nodes to meet the operations durability requirements. **/ - notEnoughNodes: number; - - /** Duplicate items. **/ - duplicateItems: number; - - /** Key mapping failed and could not match a server. **/ - noMatchingServerForKey: number; - - /** A bad environment variable was specified. **/ - badEnvironmentVariable: number; - /** Couchnode is out of memory. **/ - outOfMemory: number; - - /** Invalid arguements were passed. **/ - invalidArguments: number; - - /** An error occured while trying to schedule the operation. **/ - schedulingError: number; - - /** Not all operations completed successfully. **/ - checkResults: number; - - /** A generic error occured in Couchnode. **/ - genericError: number; - - /** The specified durability requirements could not be satisfied. **/ - durabilityFailed: number; - - /** An error occured during a RESTful operation. **/ - restError: number; - } - - /** - * Enumeration of all value encoding formats. - * - * @global - * @readonly - * @enum {number} - */ - export var format: { - /** Store as raw bytes. **/ - raw: number; - - /** Store as JSON encoded string. **/ - json: number; - - /** Store as UTF-8 encoded string. **/ - utf8: number; - - /** Automatically determine best storage format. **/ - auto: number; - }; - - /** - * The *CAS* value is a special object which indicates the current state - * of the item on the server. Each time an object is mutated on the server, the - * value is changed. CAS objects can be used in conjunction with - * mutation operations to ensure that the value on the server matches the local - * value retrieved by the client. This is useful when doing document updates - * on the server as you can ensure no changes were applied by other clients - * while you were in the process of mutating the document locally. - * - * In Couchnode, this is an opaque value. As such, you cannot generate - * CAS objects, but should rather use the values returned from a - * {@link KeyCallback}. - * - * @typedef {object} CAS - */ - export interface CAS extends Object { - } - - /** - * @class Result - * @classdesc - * The virtual class used for results of various operations. - * @private - */ - export class Result { - /** - * The CAS value for the document that was affected by the operation. - * @var {CAS} Result#cas - */ - cas: CAS; - /** - * The flags associate with the document. - * @var {integer} Result#flags - */ - flags: number; - /** - * The resulting document from the retrieval operation that was executed. - * @var {Mixed} Result#value - */ - value: any; - } - - /** - * @class CouchbaseError - * @classdesc - * The virtual class thrown for all Couchnode errors. - * @private - * @extends node#Error - */ - export interface CouchbaseError extends Error { - /** - * The error code for this error. - * @var {errors} Error#code - */ - code: number; - - /** - * The internal error that occured to cause this one. This is used to wrap - * low-level errors before throwing them from couchnode to simplify error - * handling. - * @var {(node#Error)} Error#innerError - */ - innerError: Error; - - /** - * A reason string describing the reason this error occured. This value is - * almost exclusively used for REST request errors. - * @var {string} Error#reason - */ - reason: string; - } - - /** - * Connect callback - * This callback is invoked when a connection is successfully established. - * - * @typedef {function} ConnectCallback - * - * @param {undefined|Error} error - * The error that occurred while trying to connect to the cluster. - */ - export interface ConnectCallback { - (error: CouchbaseError): any; - } - - /** - * Design Document Management callbacks - * This callback is invoked by the *DesignDoc operations. - * - * @typedef {function} DDocCallback - * - * @param {undefined|Error} error - * An error indicator. Note that this error value may be ignored, but its - * absence is indicative that the response in the *result* parameter is ok. - * If it is set, then the request likely failed. - * @param {object} result - * The result returned from the server - */ - export interface DDocCallback { - (error: CouchbaseError, result: any): any; - } - - /** - * Single-Key callbacks. - * This callback is passed to all of the single key functions. - * - * A typical use pattern is to pass the result> parameter from the - * callback as the options parameter to one of the next operations. - * - * @typedef {function} KeyCallback - * - * @param {undefined|Error} error - * The error for the operation. This can either be an Error object - * or a false value. The error contains the following fields: - * @param {Result} result - * The result of the operation that was executed. - */ - export interface KeyCallback { - (error: CouchbaseError, result: Result): any; - } - - /** - * Multi-Key callbacks - * This callback is invoked by the *Multi operations. - * It differs from the in {@linkcode KeyCallback} that the - * response object is an object of {key: response} - * where each response object contains the response for that particular - * key. - * - * @typedef {function} MultiCallback - * - * @param {undefined|Error} error - * An error indicator. Note that this error - * value may be ignored, but its absence is indicative that each - * response in the results parameter is ok. If it - * is set, then at least one of the result objects failed - * @param {Object.} results - * The results of the operation as a dictionary of keys mapped to Result - * objects. - */ - export interface MultiCallback { - (error: CouchbaseError, result: { [key: string]: Result }): any; - } - - /** - * Query callback. - * This callback is invoked by the query operations. - * - * @typedef {function} QueryCallback - * - * @param {undefined|Error} error - * An error indicator. Note that this error - * value may be ignored, but its absence is indicative that the - * response in the results parameter is ok. If it - * is set, then the request failed. - * @param {object} results - * The results returned from the server - */ - export interface QueryCallback { - (error: CouchbaseError, result: any): any; - } - - /** - * @typedef {function} StatsCallback - * - * @param {Error} error - * @param {Object.} results - * An object containing per-server, per key entries - * - * @see Connection#stats - */ - export interface StatsCallback { - (error: CouchbaseError, result: any): any; - } - - - ///////////////////////// - // Various options structures - ///////////////////////// - - export interface ConnectionOptions { - host?: any; // string | string[] - bucket?: string; - password?: string; - } - - // Not comming up with a base interface system as that is not how the original code is written. - // Use a custom base interface system has the potential to become difficult to keep up to date. - - export interface AddOptions { - expiry?: number; - flags?: number; - format?: number - persist_to?: number; - replicate_to?: number; - } - - export interface AddMultiOptionsForValue { - value: any; - expiry?: number; - flags?: number; - format?: number; - } - - export interface AddMultiOptions { - expiry?: number; - flags?: number; - format?: number - persist_to?: number; - replicate_to?: number; - - spooled?: boolean; - } - - export interface AppendOptions { - expiry?: number; - flags?: number; - format?: number; - persist_to?: number; - replicate_to?: number; - - cas: CAS; - } - - export interface AppendMultiOptionsForValue { - value: any; - cas?: CAS; - expiry?: number; - } - - export interface AppendMultiOptions { - expiry?: number; - persist_to?: number; - replicate_to?: number; - - spooled?: boolean; - } - - export interface DecrOptions { - offset?: number; - initial?: number; - - expiry?: number; - persist_to?: number; - replicate_to?: number; - } - - export interface DecrMultiOptionsForValue { - offset?: number; - initial?: number; - - expiry?: number; - } - - export interface DecrMultiOptions { - spooled?: boolean; - } - - export interface GetOptions { - expiry?: number; - format?: number; - } - - export interface GetMultiOptions { - spooled?: boolean; - format?: number; - } - - export interface GetReplicaOptions { - index?: number; - format?: number; - } - - export interface GetReplicaMultiOptions { - spooled?: boolean; - format?: number; - } - - export interface IncrOptions extends DecrOptions { } - - export interface IncrMultiOptionsForValue extends DecrMultiOptionsForValue { } - - export interface IncrMultiOptions extends DecrMultiOptions { } - - export interface LockOptions { - lockTime?: number - } - - export interface LockMultiOptions { - spooled?: boolean; - format?: number; - } - - export interface ObserveOptions { - cas: CAS; // verified not optional - } - - export interface ObserveMultiOptionsForValue { - cas: CAS; // verified not optional - } - - export interface ObserveMultiOptions { - spooled?: boolean; - } - - export interface PrependOptions { - expiry?: number; - flags?: number; - format?: number; - persist_to?: number; - replicate_to?: number; - - cas?: CAS; - } - - export interface PrependMultiOptionsFoValue { - value: any; - cas: CAS; - expiry?: number; - } - - export interface PrependMultiOptions { - spooled?: boolean; - - expiry?: number; - persist_to?: number; - replicate_to?: number; - } - - export interface RemoveOptions { - cas?: CAS; - persist_to?: number; - replicate_to?: number; - } - - export interface RemoveMultiOptionsForValue { - cas?: CAS; - } - - export interface RemoveMultiOptions { - spooled?: boolean; - - persist_to?: number; - replicate_to?: number; - } - - // Options for Replace functions follow Set Options and this is mentioned explicitly in the documentation - - export interface ReplaceOptions extends SetOptions { } - - export interface ReplaceMultiOptionsForValue extends SetMultiOptionsForValue { } - - export interface ReplaceMultiOptions extends SetMultiOptions { } - - export interface SetOptions { - expiry?: number; - flags?: number; - format?: number; - persist_to?: number; - replicate_to?: number; - - cas?: CAS; - } - - export interface SetMultiOptionsForValue { - value: any; - cas?: CAS; - expiry?: number; - flags?: number; - format?: number; - } - - export interface SetMultiOptions { - expiry?: number; - flags?: number; - format?: number - persist_to?: number; - replicate_to?: number; - - spooled?: boolean; - } - - export interface TouchOptions { - expiry?: number; - persist_to?: number; - replicate_to?: number; - - cas?: CAS; - } - - export interface UnlockOptions { - cas: CAS; // verified not optional - } - - export interface UnlockMultiOptionsForValue { - cas: CAS; // verified not optional - } - - export interface UnlockMultiOptions { - spooled?: boolean; - } - - /** - * @class - * A class representing a connection to a Couchbase cluster. - * Normally, your application should only need to create one of these per - * bucket and use it continuously. Operations are executed asynchronously - * and pipelined when possible. - * - * @desc - * Instantiate a new Connection object. Note that it is safe to perform - * operations before the connect callback is invoked. In this case, the - * operations are queued until the connection is ready (or an unrecoverable - * error has taken place). - * - * @param {Object} [options] - * A dictionary of options to use. You may pass - * other options than those defined below which correspond to the various - * options available on the Connection object (see their documentation). - * For example, it may be helpful to set timeout properties before connecting. - * @param {string|string[]} [options.host="localhost:8091"] - * A string or array of strings indicating the hosts to connect to. If the - * value is an array, all the hosts in the array will be tried until one of - * them succeeds. - * @param {string} [options.bucket="default"] - * The bucket to connect to. If not specified, the default is - * 'default'. - * @param {string} [options.password=""] - * The password for a password protected bucket. - * @param {ConnectCallback} callback - * A callback that will be invoked when the instance has completed connecting - * to the server. Note that this isn't required - however if the connection - * fails, an exception will be thrown if the callback is not provided. - * - * @example - * var couchbase = require('couchbase'); - * var db = new couchbase.Connection({}, function(err) { - * if (err) { - * console.log('Connection Error', err); - * } else { - * console.log('Connected!'); - * } - * }); - */ - export class Connection { - constructor(callback: ConnectCallback); - constructor(options: ConnectionOptions, callback: ConnectCallback); - - ///////////////////////// - // Members - ///////////////////////// - - /** - * Get information about the Couchnode version (i.e. this library) as an array - * of [versionNumber, versionString]. - * - * @member {Mixed[]} Connection#clientVersion - */ - clientVersion: any[]; - - connectionTimeout: number; - - lcbVersion: any[]; - - operationTimeout: number; - - serverNodes: string[]; - - ///////////////////////// - // Methods - ///////////////////////// - - // TODO: not sure if these methods return void. Docmentation mentions nothing. - // TODO: For "multi" key methods the documentation says callback can be either KeyCallback | MultiCallback. Sticking with MultiCallback. - // TODO: Verify that kv is not a key value and indeed is string[] e.g. getMulti , getReplicaMulti, lockMulti - - add(key: string, value: any, callback: KeyCallback): void; - add(key: string, value: any, options: AddOptions, callback: KeyCallback): void; - addMulti(kv: { [key: string]: AddMultiOptionsForValue }, options: AddMultiOptions, callback: MultiCallback): void; - - append(key: string, fragment: string, callback: KeyCallback): void; - append(key: string, fragment: string, options: AppendOptions, callback: KeyCallback): void; - append(key: string, fragment: Buffer, callback: KeyCallback): void; - append(key: string, fragment: Buffer, options: AppendOptions, callback: KeyCallback): void; - appendMulti(kv: { [key: string]: AppendMultiOptionsForValue }, options: AppendMultiOptions, callback: MultiCallback): void; - - decr(key: string, callback: KeyCallback): void; - decr(key: string, options: DecrOptions, callback: KeyCallback): void; - decrMulti(kv: { [key: string]: DecrMultiOptionsForValue }, options: DecrMultiOptions, callback: MultiCallback): void; - - get(key: string, callback: KeyCallback): void; - get(key: string, options: GetOptions, callback: KeyCallback): void; - getMulti(kv: string[], options: { [key: string]: GetMultiOptions }, callback:MultiCallback): void; - - getDesignDoc(name: string, callback: DDocCallback): void; - - getReplica(key: string, callback: KeyCallback): void; - getReplica(key: string, options: GetReplicaOptions, callback: KeyCallback): void; - getReplicaMulti(kv: string[], options: GetReplicaMultiOptions, callback: MultiCallback): void; - - incr(key: string, callback: KeyCallback): void; - incr(key: string, options: IncrOptions, callback: KeyCallback): void; - incrMulti(kv: { [key: string]: IncrMultiOptionsForValue }, options: IncrMultiOptions, callback: MultiCallback): void; - - lock(key: string, callback: KeyCallback): void; - lock(key: string, options: LockOptions, callback: KeyCallback): void; - lockMulti(kv: string[], options: { [key: string]: LockMultiOptions }, callback: MultiCallback): void; - - observe(key: string, options: ObserveOptions, callback: KeyCallback): void; - observeMulti(kv: { [key: string]: ObserveMultiOptionsForValue }, options: { [key: string]: ObserveMultiOptions }, callback: MultiCallback): void; - - on(event: string, listener: Function): void; - on(event: 'connect', listener: (err: Error) => any): void; - on(event: 'error', listener: (err: Error) => any): void; - - prepend(key: string, fragment: string, callback: KeyCallback): void; - prepend(key: string, fragment: string, options: PrependOptions, callback: KeyCallback): void; - prepend(key: string, fragment: Buffer, callback: KeyCallback): void; - prepend(key: string, fragment: Buffer, options: PrependOptions, callback: KeyCallback): void; - prependMulti(kv: { [key: string]: PrependMultiOptionsFoValue }, options: { [key: string]: PrependMultiOptions }, callback: MultiCallback): void; - - remove(key: string, callback: KeyCallback): void; - remove(key: string, options: RemoveOptions, callback: KeyCallback): void; - removeMulti(kv: { [key: string]: RemoveMultiOptionsForValue }, options: RemoveMultiOptions, callback: MultiCallback): void; - removeMulti(kv: string[], options: RemoveMultiOptions, callback: MultiCallback): void; - - removeDesignDoc(name: string, callback: DDocCallback): void; - - replace(key: string, value: any, callback: KeyCallback): void; - replace(key: string, value: any, options: ReplaceOptions, callback: KeyCallback): void; - replaceMulti(kv: { [key: string]: ReplaceMultiOptionsForValue }, options: ReplaceMultiOptions, callback: MultiCallback): void; - - set(key: string, value: any, callback: KeyCallback): void; - set(key: string, value: any, options: SetOptions, callback: KeyCallback): void; - setMulti(kv: { [key: string]: SetMultiOptionsForValue }, options: SetMultiOptions, callback: MultiCallback): void; - - setDesignDoc(name: string, data: any, callback: DDocCallback): void; - - shutdown(): void; - - stats(callback: StatsCallback): void; - stats(key: string, callback: StatsCallback): void; - - strError(code: number): string; - - touch(key: string, callback: KeyCallback): void; - touch(key: string, options: TouchOptions, callback: KeyCallback): void; - - unlock(key: string, options: UnlockOptions, callback: KeyCallback): void; - unlockMulti(kv: { [key: string]: UnlockMultiOptionsForValue }, options: { [key: string]: UnlockMultiOptions }, callback: UnlockMultiOptions): void; - - view(ddoc: string, name: string): ViewQuery; - view(ddoc: string, name: string, query: any): ViewQuery; - } - - export class ViewQuery { - firstPage(q: any, callback: Function): void; - query(q: any, callback: Function): void; - } - -} diff --git a/couchbase/couchbase.d.ts b/couchbase/couchbase.d.ts index 1f9121bde1..907ddda9fe 100644 --- a/couchbase/couchbase.d.ts +++ b/couchbase/couchbase.d.ts @@ -197,6 +197,17 @@ declare module 'couchbase' { certpath: string; } + interface CreateBucketOptions { + /** + * The bucket name + */ + name?: string; + authType?: string, + bucketType?: string; + ramQuotaMB?: number; + replicaNumber?: number; + } + /** * Class for performing management operations against a cluster. */ @@ -206,7 +217,7 @@ declare module 'couchbase' { * @param name * @param callback */ - createBucket(name: string, callback: Function); + createBucket(name: string, callback: Function): void; /** * @@ -214,20 +225,20 @@ declare module 'couchbase' { * @param opts * @param callback */ - createBucket(name: string, opts: any, callback: Function); + createBucket(name: string, opts: any, callback: Function): void; /** * * @param callback */ - listBuckets(callback: Function); + listBuckets(callback: Function): void; /** * * @param name * @param callback */ - removeBucket(name: string, callback: Function); + removeBucket(name: string, callback: Function): void; } /** @@ -244,17 +255,17 @@ declare module 'couchbase' { /** * The CAS value to check. If the item on the server contains a different CAS value, the operation will fail. Note that if this option is undefined, no comparison will be performed. */ - cas: Bucket.CAS; + cas?: Bucket.CAS; /** * Ensures this operation is persisted to this many nodes. */ - persist_to: number; + persist_to?: number; /** * Ensures this operation is replicated to this many nodes. */ - replicate_to: number; + replicate_to?: number; } interface PrependOptions extends AppendOptions { } @@ -265,7 +276,7 @@ declare module 'couchbase' { /** * Set the initial expiration time for the document. A value of 0 represents never expiring. */ - expiry: number; + expiry?: number; } interface UpsertOptions extends ReplaceOptions { } @@ -274,38 +285,38 @@ declare module 'couchbase' { /** * Ensures this operation is persisted to this many nodes. */ - persist_to: number; + persist_to?: number; /** * Ensures this operation is replicated to this many nodes. */ - replicate_to: number; + replicate_to?: number; } interface CounterOptions { /** * Sets the initial value for the document if it does not exist. Specifying a value of undefined will cause the operation to fail if the document does not exist, otherwise this value must be equal to or greater than 0. */ - initial: number; + initial?: number; /** * Set the initial expiration time for the document. A value of 0 represents never expiring. */ - expiry: number; + expiry?: number; /** * Ensures this operation is persisted to this many nodes */ - persist_to: number; + persist_to?: number; /** * Ensures this operation is replicated to this many nodes */ - replicate_to: number; + replicate_to?: number; } interface GetAndLockOptions { - lockTime: number; + lockTime?: number; } interface GetReplicaOptions { @@ -313,7 +324,7 @@ declare module 'couchbase' { /** * The index for which replica you wish to retrieve this value from, or if undefined, use the value from the first server that replies. */ - index: number; + index?: number; } interface InsertOptions { @@ -321,17 +332,17 @@ declare module 'couchbase' { /** * Set the initial expiration time for the document. A value of 0 represents never expiring. */ - expiry: number; + expiry?: number; /** * Ensures this operation is persisted to this many nodes. */ - persist_to: number; + persist_to?: number; /** * Ensures this operation is replicated to this many nodes. */ - replicate_to: number; + replicate_to?: number; } /** @@ -343,20 +354,20 @@ declare module 'couchbase' { * Flushes the cluster, deleting all data stored within this bucket. Note that this method requires the Flush permission to be enabled on the bucket from the management console before it will work. * @param callback The callback function. */ - flush(callback: Function); + flush(callback: Function): void; /** * Retrieves a specific design document from this bucket. * @param name * @param callback The callback function. */ - getDesignDocument(name: string, callback: Function); + getDesignDocument(name: string, callback: Function): void; /** * Retrieves a list of all design documents registered to a bucket. * @param callback The callback function. */ - getDesignDocuments(callback: Function); + getDesignDocuments(callback: Function): void; /** * Registers a design document to this bucket, failing if it already exists. @@ -365,7 +376,7 @@ declare module 'couchbase' { * @param callback The callback function. * @returns {} */ - insertDesignDocument(name: string, data: any, callback: Function); + insertDesignDocument(name: string, data: any, callback: Function): void; /** * Unregisters a design document from this bucket. @@ -373,7 +384,7 @@ declare module 'couchbase' { * @param callback The callback function. * @returns {} */ - removeDesignDocument(name: string, callback: Function); + removeDesignDocument(name: string, callback: Function): void; /** * Registers a design document to this bucket, overwriting any existing design document that was previously registered. @@ -382,7 +393,7 @@ declare module 'couchbase' { * @param callback The callback function. * @returns {} */ - upsertDesignDocument(name: string, data: any, callback: Function); + upsertDesignDocument(name: string, data: any, callback: Function): void; } /** @@ -745,7 +756,7 @@ declare module 'couchbase' { * @param fragment The document's contents to append. * @param callback The callback function. */ - append(key: any | Buffer, fragment: any, callback: Bucket.OpCallback); + append(key: any | Buffer, fragment: any, callback: Bucket.OpCallback): void; /** * @@ -754,7 +765,7 @@ declare module 'couchbase' { * @param options The options object. * @param callback The callback function. */ - append(key: any | Buffer, fragment: any, options: AppendOptions, callback: Bucket.OpCallback); + append(key: any | Buffer, fragment: any, options: AppendOptions, callback: Bucket.OpCallback): void; /** * Increments or decrements a key's numeric value. @@ -763,7 +774,7 @@ declare module 'couchbase' { * @param delta The amount to add or subtract from the counter value. This value may be any non-zero integer. * @param callback The callback function. */ - counter(key: any | Buffer, delta: number, callback: Bucket.OpCallback); + counter(key: any | Buffer, delta: number, callback: Bucket.OpCallback): void; /** * @@ -772,7 +783,7 @@ declare module 'couchbase' { * @param options The options object. * @param callback The callback function. */ - counter(key: any | Buffer, delta: number, options: CounterOptions, callback: Bucket.OpCallback); + counter(key: any | Buffer, delta: number, options: CounterOptions, callback: Bucket.OpCallback): void; /** * Shuts down this connection. @@ -783,21 +794,21 @@ declare module 'couchbase' { * Enables N1QL support on the client. A cbq-server URI must be passed. This method will be deprecated in the future in favor of automatic configuration through the connected cluster. * @param hosts An array of host/port combinations which are N1QL servers attached to this cluster. */ - enableN1ql(hosts: string | string[]); + enableN1ql(hosts: string | string[]): void; /** * Retrieves a document. * @param key The target document key. * @param callback The callback function. */ - get(key: any | Buffer, callback: Bucket.OpCallback); + get(key: any | Buffer, callback: Bucket.OpCallback): void; /** * @param key The target document key. * @param options The options object. * @param callback The callback function. */ - get(key: any | Buffer, options: any, callback: Bucket.OpCallback); + get(key: any | Buffer, options: any, callback: Bucket.OpCallback): void; /** * Lock the document on the server and retrieve it. When an document is locked, its CAS changes and subsequent operations on the document (without providing the current CAS) will fail until the lock is no longer held. @@ -806,7 +817,7 @@ declare module 'couchbase' { * @param key The target document key. * @param callback The callback function. */ - getAndLock(key: any, callback: Bucket.OpCallback); + getAndLock(key: any, callback: Bucket.OpCallback): void; /** * Lock the document on the server and retrieve it. When an document is locked, its CAS changes and subsequent operations on the document (without providing the current CAS) will fail until the lock is no longer held. @@ -817,7 +828,7 @@ declare module 'couchbase' { * @param callback The callback function. * @returns {} */ - getAndLock(key: any, options: GetAndLockOptions, callback: Bucket.OpCallback); + getAndLock(key: any, options: GetAndLockOptions, callback: Bucket.OpCallback): void; /** * Retrieves a document and updates the expiry of the item at the same time. @@ -826,7 +837,7 @@ declare module 'couchbase' { * @param options The options object. * @param callback The callback function. */ - getAndTouch(key: any | Buffer, expiry: number, options: any, callback: Bucket.OpCallback); + getAndTouch(key: any | Buffer, expiry: number, options: any, callback: Bucket.OpCallback): void; /** * Retrieves a document and updates the expiry of the item at the same time. @@ -834,21 +845,21 @@ declare module 'couchbase' { * @param expiry The expiration time to use. If a value of 0 is provided, then the current expiration time is cleared and the key is set to never expire. Otherwise, the key is updated to expire in the time provided (in seconds). * @param callback The callback function. */ - getAndTouch(key: any | Buffer, expiry: number, callback: Bucket.OpCallback); + getAndTouch(key: any | Buffer, expiry: number, callback: Bucket.OpCallback): void; /** * Retrieves a list of keys * @param keys The target document keys. * @param callback The callback function. */ - getMulti(key: any[] | Buffer[], callback: Bucket.MultiGetCallback); + getMulti(key: any[] | Buffer[], callback: Bucket.MultiGetCallback): void; /** * Get a document from a replica server in your cluster. * @param key The target document key. * @param callback The callback function. */ - getReplica(key: any | Buffer, callback: Bucket.OpCallback); + getReplica(key: any | Buffer, callback: Bucket.OpCallback): void; /** * Get a document from a replica server in your cluster. @@ -856,7 +867,7 @@ declare module 'couchbase' { * @param options The options object. * @param callback The callback function. */ - getReplica(key: any | Buffer, options: GetReplicaOptions, callback: Bucket.OpCallback); + getReplica(key: any | Buffer, options: GetReplicaOptions, callback: Bucket.OpCallback): void; /** * Identical to Bucket#upsert but will fail if the document already exists. @@ -864,7 +875,7 @@ declare module 'couchbase' { * @param value The document's contents. * @param callback The callback function. */ - insert(key: any | Buffer, value: any, callback: Bucket.OpCallback); + insert(key: any | Buffer, value: any, callback: Bucket.OpCallback): void; /** * Identical to Bucket#upsert but will fail if the document already exists. @@ -873,7 +884,7 @@ declare module 'couchbase' { * @param options The options object. * @param callback The callback function. */ - insert(key: any | Buffer, value: any, options: InsertOptions, callback: Bucket.OpCallback); + insert(key: any | Buffer, value: any, options: InsertOptions, callback: Bucket.OpCallback): void; /** * Returns an instance of a BuckerManager for performing management operations against a bucket. @@ -886,7 +897,7 @@ declare module 'couchbase' { * @param fragment The document's contents to prepend. * @param callback The callback function. */ - prepend(key: any, fragment: any, callback: Bucket.OpCallback); + prepend(key: any, fragment: any, callback: Bucket.OpCallback): void; /** * Like Bucket#append, but prepends data to the existing value. @@ -895,7 +906,7 @@ declare module 'couchbase' { * @param options The options object. * @param callback The callback function. */ - prepend(key: any, fragment: any, options: PrependOptions, callback: Bucket.OpCallback); + prepend(key: any, fragment: any, options: PrependOptions, callback: Bucket.OpCallback): void; /** * Executes a previously prepared query object. This could be a ViewQuery or a N1qlQuery. @@ -919,7 +930,7 @@ declare module 'couchbase' { * @param key The target document key. * @param callback The callback function. */ - remove(key: any | Buffer, callback: Bucket.OpCallback); + remove(key: any | Buffer, callback: Bucket.OpCallback): void; /** * Deletes a document on the server. @@ -927,7 +938,7 @@ declare module 'couchbase' { * @param options The options object. * @param callback The callback function. */ - remove(key: any | Buffer, options: RemoveOptions, callback: Bucket.OpCallback); + remove(key: any | Buffer, options: RemoveOptions, callback: Bucket.OpCallback): void; /** * Identical to Bucket#upsert, but will only succeed if the document exists already (i.e. the inverse of Bucket#insert). @@ -935,7 +946,7 @@ declare module 'couchbase' { * @param value The document's contents. * @param callback The callback function. */ - replace(key: any | Buffer, value: any, callback: Bucket.OpCallback); + replace(key: any | Buffer, value: any, callback: Bucket.OpCallback): void; /** * Identical to Bucket#upsert, but will only succeed if the document exists already (i.e. the inverse of Bucket#insert). @@ -944,14 +955,14 @@ declare module 'couchbase' { * @param options The options object. * @param callback The callback function. */ - replace(key: any | Buffer, value: any, options: ReplaceOptions, callback: Bucket.OpCallback); + replace(key: any | Buffer, value: any, options: ReplaceOptions, callback: Bucket.OpCallback): void; /** * Configures a custom set of transcoder functions for encoding and decoding values that are being stored or retreived from the server. * @param encoder The function for encoding. * @param decoder The function for decoding. */ - setTranscoder(encoder: Bucket.EncoderFunction, decoder: Bucket.DecoderFunction); + setTranscoder(encoder: Bucket.EncoderFunction, decoder: Bucket.DecoderFunction): void; /** * Update the document expiration time. @@ -960,7 +971,7 @@ declare module 'couchbase' { * @param options The options object. * @param callback The callback function. */ - touch(key: any | Buffer, expiry: number, options: TouchOptions, callback: Bucket.OpCallback); + touch(key: any | Buffer, expiry: number, options: TouchOptions, callback: Bucket.OpCallback): void; /** * Unlock a previously locked document on the server. See the Bucket#lock method for more details on locking. @@ -968,7 +979,7 @@ declare module 'couchbase' { * @param cas The CAS value returned when the key was locked. This operation will fail if the CAS value provided does not match that which was the result of the original lock operation. * @param callback The callback function. */ - unlock(key: any | Buffer, cas: Bucket.CAS, callback: Bucket.OpCallback); + unlock(key: any | Buffer, cas: Bucket.CAS, callback: Bucket.OpCallback): void; /** * Unlock a previously locked document on the server. See the Bucket#lock method for more details on locking. @@ -977,7 +988,7 @@ declare module 'couchbase' { * @param options The options object. * @param callback The callback function. */ - unlock(key: any | Buffer, cas: Bucket.CAS, options: any, callback: Bucket.OpCallback); + unlock(key: any | Buffer, cas: Bucket.CAS, options: any, callback: Bucket.OpCallback): void; /** * Stores a document to the bucket. @@ -985,7 +996,7 @@ declare module 'couchbase' { * @param value The document's contents. * @param callback The callback function. */ - upsert(key: any | Buffer, value: any, callback: Bucket.OpCallback); + upsert(key: any | Buffer, value: any, callback: Bucket.OpCallback): void; /** * Stores a document to the bucket. @@ -994,7 +1005,7 @@ declare module 'couchbase' { * @param options The options object. * @param callback The callback function. */ - upsert(key: any | Buffer, value: any, options: UpsertOptions, callback: Bucket.OpCallback); + upsert(key: any | Buffer, value: any, options: UpsertOptions, callback: Bucket.OpCallback): void; } module Bucket { From 32e6383dffe0c2394e09ca3eb0cf86c508091558 Mon Sep 17 00:00:00 2001 From: Marwan Aouida Date: Thu, 31 Dec 2015 08:44:01 +0100 Subject: [PATCH 177/441] fixed build errors --- couchbase/couchbase.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/couchbase/couchbase.d.ts b/couchbase/couchbase.d.ts index 907ddda9fe..6afd3a7819 100644 --- a/couchbase/couchbase.d.ts +++ b/couchbase/couchbase.d.ts @@ -1019,7 +1019,7 @@ declare module 'couchbase' { * @param rows The rows returned from the query. * @param meta The metadata returned by the query. */ - (error: CouchbaseError, rows: any[], meta: Bucket.ViewQueryResponse.Meta); + (error: CouchbaseError, rows: any[], meta: Bucket.ViewQueryResponse.Meta): void; } /** @@ -1032,7 +1032,7 @@ declare module 'couchbase' { * @param error The error for the operation. This can either be an Error object or a value which evaluates to false (null, undefined, 0 or false). * @param result The result of the operation that was executed. This usually contains at least a cas property, and on some operations will contain a value property as well. */ - (error: CouchbaseError | number, result: any); + (error: CouchbaseError | number, result: any): void; } /** @@ -1044,7 +1044,7 @@ declare module 'couchbase' { * @param error The number of keys that failed to be retrieved. The precise errors are available by checking the error property of the individual documents. * @param results This is a map of keys to results. The result for each key will optionally contain an error if one occured, or if no error occured will contain the CAS and value of the document. */ - (error: number, results: any[]); + (error: number, results: any[]): void; } /** From d6fb5790465a86d18267e2babfb83555483cbc5d Mon Sep 17 00:00:00 2001 From: Evander Tino Date: Thu, 31 Dec 2015 11:45:41 +0300 Subject: [PATCH 178/441] Update typeahead.d.ts For some reasons when using typeahead dataset display field with angular, the bindings dont work properly across every field mapped. But displayKey works. According to the api https://github.com/twitter/typeahead.js/blob/master/src/typeahead/dataset.js#L47 both fields are accepted. --- typeahead/typeahead.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index e01e0d509a..8164d430e1 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -181,7 +181,13 @@ declare module Twitter.Typeahead { * Defaults to value. */ display?: string | ((obj: any) => string); - + + /** + * Can be used in place of display above. + * + */ + displayKey?: string | ((obj: any) => string); + /** * 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. From 29171e8fbfbda8346f482ed3c54fc4f6da599af1 Mon Sep 17 00:00:00 2001 From: Chiyu Zhong Date: Thu, 31 Dec 2015 17:01:54 +0800 Subject: [PATCH 179/441] fix handlebar also support register multiple helpers --- handlebars/handlebars.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/handlebars/handlebars.d.ts b/handlebars/handlebars.d.ts index 54dc7e9aef..95dd5cc790 100644 --- a/handlebars/handlebars.d.ts +++ b/handlebars/handlebars.d.ts @@ -6,6 +6,7 @@ declare module Handlebars { export function registerHelper(name: string, fn: Function, inverse?: boolean): void; + export function registerHelper(name: Object): void; export function registerPartial(name: string, str: any): void; export function unregisterHelper(name: string): void; export function unregisterPartial(name: string): void; From a4019d0c25ba7667ccd70444336db5210b87d2bf Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 31 Dec 2015 14:31:29 +0500 Subject: [PATCH 180/441] lodash: signatures of _.wrap have been changed --- lodash/lodash-tests.ts | 88 +++++++++++++++++++++++++++++++-- lodash/lodash.d.ts | 108 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 182 insertions(+), 14 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2b..01ed7bf57b 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5576,11 +5576,89 @@ module TestThrottle { } } -var helloWrap = function (name: string) { return 'hello ' + name; }; -var helloWrap2 = _.wrap(helloWrap, function (func) { - return 'before, ' + func('moe') + ', after'; -}); -helloWrap2(); +// _.wrap +module TestWrap { + type SampleValue = {a: number; b: string; c: boolean} + type SampleResult = (arg2: number, arg3: string) => boolean; + + { + type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; + + let value: SampleValue; + let wrapper: SampleWrapper; + let result: SampleResult; + + result = _.wrap(value, wrapper); + result = _.wrap(value, wrapper); + result = _.wrap(value, wrapper); + } + + { + type SampleWrapper = (arg1: number, arg2: number, arg3: string) => boolean; + + let value: number; + let wrapper: SampleWrapper; + let result: _.LoDashImplicitObjectWrapper; + + result = _(value).wrap(wrapper); + result = _(value).wrap(wrapper); + } + + { + type SampleWrapper = (arg1: number[], arg2: number, arg3: string) => boolean; + + let value: number[]; + let wrapper: SampleWrapper; + let result: _.LoDashImplicitObjectWrapper; + + result = _(value).wrap(wrapper); + result = _(value).wrap(wrapper); + } + + { + type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; + + let value: SampleValue; + let wrapper: SampleWrapper; + let result: _.LoDashImplicitObjectWrapper; + + result = _(value).wrap(wrapper); + result = _(value).wrap(wrapper); + } + + { + type SampleWrapper = (arg1: number, arg2: number, arg3: string) => boolean; + + let value: number; + let wrapper: SampleWrapper; + let result: _.LoDashExplicitObjectWrapper; + + result = _(value).chain().wrap(wrapper); + result = _(value).chain().wrap(wrapper); + } + + { + type SampleWrapper = (arg1: number[], arg2: number, arg3: string) => boolean; + + let value: number[]; + let wrapper: SampleWrapper; + let result: _.LoDashExplicitObjectWrapper; + + result = _(value).chain().wrap(wrapper); + result = _(value).chain().wrap(wrapper); + } + + { + type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; + + let value: SampleValue; + let wrapper: SampleWrapper; + let result: _.LoDashExplicitObjectWrapper; + + result = _(value).chain().wrap(wrapper); + result = _(value).chain().wrap(wrapper); + } +} /******** * Lang * diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c45ec90eea..edc63a80a8 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9479,16 +9479,106 @@ declare module _ { //_.wrap interface LoDashStatic { /** - * Creates a function that provides value to the wrapper function as its first argument. - * Additional arguments provided to the function are appended to those provided to the - * wrapper function. The wrapper is executed with the this binding of the created function. - * @param value The value to wrap. - * @param wrapper The wrapper function. - * @return The new function. - **/ - wrap( + * Creates a function that provides value to the wrapper function as its first argument. Any additional + * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is + * invoked with the this binding of the created function. + * + * @param value The value to wrap. + * @param wrapper The wrapper function. + * @return Returns the new function. + */ + wrap( + value: V, + wrapper: W + ): R; + + /** + * @see _.wrap + */ + wrap( + value: V, + wrapper: Function + ): R; + + /** + * @see _.wrap + */ + wrap( value: any, - wrapper: (func: Function, ...args: any[]) => any): Function; + wrapper: Function + ): R; + } + + interface LoDashImplicitWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; } /******** From 3930e52ab5991be869c69d9b0d1e720427e5e469 Mon Sep 17 00:00:00 2001 From: pragmat1c Date: Thu, 31 Dec 2015 12:46:25 -0600 Subject: [PATCH 181/441] Update success signature. The success method can return either a json object or a string object in dropzone 4.0.1. Dropzone checks the type and if it's application/json it automatically converts it to json. --- dropzone/dropzone.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dropzone/dropzone.d.ts b/dropzone/dropzone.d.ts index 93f9ca25b0..5588ac48d4 100644 --- a/dropzone/dropzone.d.ts +++ b/dropzone/dropzone.d.ts @@ -96,7 +96,7 @@ interface DropzoneOptions { sending?(file:DropzoneFile, xhr:XMLHttpRequest, formData:{}):void; sendingmultiple?(files:DropzoneFile[], xhr:XMLHttpRequest, formData:{}):void; - success?(file:DropzoneFile, responseText:string):void; + success?(file: DropzoneFile, response: Object|string): void; successmultiple?(files:DropzoneFile[], responseText:string):void; canceled?(file:DropzoneFile):void; From be440624b6d83889530547db0266d128a65a204b Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 1 Jan 2016 13:22:59 +0500 Subject: [PATCH 182/441] lodash: signatures of _.spread have been changed --- lodash/lodash-tests.ts | 29 ++++++++++++++++++++++++----- lodash/lodash.d.ts | 18 ++++++++++++++++-- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2b..8630a049f5 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5525,12 +5525,31 @@ module TestRestParam { } //_.spread -var testSpreadFn = (who: string, what: string) => who + ' says ' + what; -interface TestSpreadResultFn { - (args: string[]): string; +module TestSpread { + type SampleFunc = (args: (number|string)[]) => boolean; + type SampleResult = (a: number, b: string) => boolean; + + let func: SampleFunc; + + { + let result: SampleResult; + + result = _.spread(func); + result = _.spread(func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).spread(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().spread(); + } } -result = (_.spread(testSpreadFn))(['fred', 'hello']); -result = (_(testSpreadFn).spread().value())(['fred', 'hello']); // _.throttle module TestThrottle { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c45ec90eea..a9daac2b91 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9405,19 +9405,33 @@ declare module _ { /** * Creates a function that invokes func with the this binding of the created function and an array of arguments * much like Function#apply. + * + * Note: This method is based on the spread operator. + * * @param func The function to spread arguments over. * @return Returns the new function. */ - spread(func: Function): TResult; + spread(func: F): T; + + /** + * @see _.spread + */ + spread(func: Function): T; } interface LoDashImplicitObjectWrapper { /** * @see _.spread */ - spread(): LoDashImplicitObjectWrapper; + spread(): LoDashImplicitObjectWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.spread + */ + spread(): LoDashExplicitObjectWrapper; + } //_.throttle interface ThrottleSettings { From feb349538006cd672afa79b03cf25edd5d444f2a Mon Sep 17 00:00:00 2001 From: Mark Bouwman Date: Fri, 1 Jan 2016 22:30:39 +0100 Subject: [PATCH 183/441] Added properties to BarChartOptions --- chartjs/chart.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chartjs/chart.d.ts b/chartjs/chart.d.ts index 62f393b8a1..464655f78c 100644 --- a/chartjs/chart.d.ts +++ b/chartjs/chart.d.ts @@ -136,6 +136,8 @@ interface BarChartOptions extends ChartOptions { barStrokeWidth?: number; barValueSpacing?: number; barDatasetSpacing?: number; + scaleShowHorizontalLines?: boolean; + scaleShowVerticalLines?: boolean; } interface RadarChartOptions extends ChartSettings { From e04cece6247e0f71960f2f456c66dcd0dc844190 Mon Sep 17 00:00:00 2001 From: Will Date: Fri, 1 Jan 2016 22:37:35 -0800 Subject: [PATCH 184/441] get_workflowSubscriptionId should return a SP.Guid --- sharepoint/SharePoint.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sharepoint/SharePoint.d.ts b/sharepoint/SharePoint.d.ts index 4e32dade4c..0cb60b5c64 100644 --- a/sharepoint/SharePoint.d.ts +++ b/sharepoint/SharePoint.d.ts @@ -8448,7 +8448,7 @@ declare module SP.WorkflowServices { /** Specifies the custom status set by workflow authors. */ set_userStatus(value: string): string; /** Gets the unique identifier (GUID) of the subscription that instantiates the WorkflowInstance */ - get_workflowSubscriptionId(): string; + get_workflowSubscriptionId(): SP.Guid; /** This method is internal and is not intended to be used in your code. */ initPropertiesFromJson(parentNode: any): void; @@ -11205,4 +11205,4 @@ declare module SP { get_Columns(): SP.JsGrid.ColumnInfo[]; } -} \ No newline at end of file +} From 02ac8e494e73e093555cdb4ece76047a77994e3a Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sat, 2 Jan 2016 15:50:07 +0900 Subject: [PATCH 185/441] Update kefir.d.ts 2.8.1 -> 3.2.0 --- kefir/kefir-tests.ts | 13 +++++---- kefir/kefir.d.ts | 64 ++++++++++++++++++++++++-------------------- 2 files changed, 43 insertions(+), 34 deletions(-) diff --git a/kefir/kefir-tests.ts b/kefir/kefir-tests.ts index a0d0a96186..94300550b4 100644 --- a/kefir/kefir-tests.ts +++ b/kefir/kefir-tests.ts @@ -30,7 +30,7 @@ import { Observable, ObservablePool, Stream, Property, Event, Emitter } from 'ke let stream10: Stream = Kefir.stream(emitter => { let count = 0; emitter.emit(count); - + let intervalId = setInterval(() => { count++; if (count < 4) { @@ -39,7 +39,7 @@ import { Observable, ObservablePool, Stream, Property, Event, Emitter } from 'ke emitter.end(); } }, 1000); - + return () => clearInterval(intervalId); }); } @@ -77,6 +77,7 @@ import { Observable, ObservablePool, Stream, Property, Event, Emitter } from 'ke let observable01: Stream = Kefir.sequentially(100, [1, 2, 3]).map(x => x + 1); let observable02: Stream = Kefir.sequentially(100, [1, 2, 3]).filter(x => x > 1); let observable03: Stream = Kefir.sequentially(100, [1, 2, 3]).take(2); + let observable29: Stream = Kefir.sequentially(100, [1, 2, 3]).takeErrors(2); let observable04: Stream = Kefir.sequentially(100, [1, 2, 3]).takeWhile(x => x < 3); let observable05: Stream = Kefir.sequentially(100, [1, 2, 3]).last(); let observable06: Stream = Kefir.sequentially(100, [1, 2, 3]).skip(2); @@ -103,14 +104,16 @@ import { Observable, ObservablePool, Stream, Property, Event, Emitter } from 'ke }).endOnError(); let observable22: Stream = Kefir.sequentially(100, [0, -1, 2, -3]).valuesToErrors(x => { return {convert: x < 0, error: x}; - }).skipValues(); + }).ignoreValues(); let observable23: Stream = Kefir.sequentially(100, [0, -1, 2, -3]).valuesToErrors(x => { return {convert: x < 0, error: x}; - }).skipErrors(); - let observable24: Stream = Kefir.sequentially(100, [1, 2, 3]).skipEnd(); + }).ignoreErrors(); + let observable24: Stream = Kefir.sequentially(100, [1, 2, 3]).ignoreEnd(); let ovservable25: Stream = Kefir.sequentially(100, [1, 2, 3]).beforeEnd(() => 0); let observable26: Stream = Kefir.sequentially(100, [1, 2, 3, 4, 5]).slidingWindow(3, 2) let observable27: Stream = Kefir.sequentially(100, [1, 2, 3, 4, 5]).bufferWhile(x => x !== 3); + let observable30: Stream = Kefir.sequentially(100, [1, 2, 3, 4, 5]).bufferWithCount(2); + let observable31: Stream = Kefir.sequentially(100, [1, 2, 3, 4, 5]).bufferWithTimeOrCount(330, 10); { var myTransducer: any; let observable28: Stream = Kefir.sequentially(100, [1, 2, 3, 4, 5, 6]).transduce(myTransducer); diff --git a/kefir/kefir.d.ts b/kefir/kefir.d.ts index 9e3303f01e..a95b12a887 100644 --- a/kefir/kefir.d.ts +++ b/kefir/kefir.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Kefir 2.8.1 +// Type definitions for Kefir 3.2.0 // Project: http://rpominov.github.io/kefir/ // Definitions by: Aya Morisawa // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -6,7 +6,7 @@ /// declare module "kefir" { - + export interface Observable { // Subscribe / add side effects onValue(callback: (value: T) => void): void; @@ -19,12 +19,14 @@ declare module "kefir" { offAny(callback: (event: Event) => void): void; log(name?: string): void; offLog(name?: string): void; + flatten(transformer?: (value: T) => U[]): Stream; toPromise(PromiseConstructor?: any): any; + toESObservable(): any; } - + export interface Stream extends Observable { toProperty(getCurrent?: () => T): Property; - + // Modify an stream map(fn: (value: T) => U): Stream; filter(predicate?: (value: T) => boolean): Stream; @@ -36,24 +38,26 @@ declare module "kefir" { skipDuplicates(comparator?: (a: T, b: T) => boolean): Stream; diff(fn?: (prev: T, next: T) => T, seed?: T): Stream; scan(fn: (prev: T, next: T) => T, seed?: T): Stream; - flatten(transformer?: (value: T) => U[]): Stream; delay(wait: number): Stream; - throttle(wait: number, options?: {leading: boolean, trailing: boolean}): Stream; + throttle(wait: number, options?: {leading?: boolean, trailing?: boolean}): Stream; debounce(wait: number, options?: {immediate: boolean}): Stream; valuesToErrors(handler?: (value: T) => {convert: boolean, error: U}): Stream; errorsToValues(handler?: (error: S) => {convert: boolean, value: U}): Stream; mapErrors(fn: (error: S) => U): Stream; filterErrors(predicate?: (error: S) => boolean): Stream; endOnError(): Stream; - skipValues(): Stream; - skipErrors(): Stream; - skipEnd(): Stream; + takeErrors(n: number): Stream; + ignoreValues(): Stream; + ignoreErrors(): Stream; + ignoreEnd(): Stream; beforeEnd(fn: () => U): Stream; slidingWindow(max: number, mix?: number): Stream; bufferWhile(predicate: (value: T) => boolean): Stream; + bufferWithCount(count: number, options?: {flushOnEnd: boolean}): Stream; + bufferWithTimeOrCount(interval: number, count: number, options?: {flushOnEnd: boolean}): Stream; transduce(transducer: any): Stream; withHandler(handler: (emitter: Emitter, event: Event) => void): Stream; - + // Combine streams combine(otherObs: Stream, combinator?: (value: T, ...values: U[]) => W): Stream; zip(otherObs: Stream, combinator?: (value: T, ...values: U[]) => W): Stream; @@ -65,20 +69,20 @@ declare module "kefir" { flatMapConcat(fn: (value: T) => Stream): Stream; flatMapConcurLimit(fn: (value: T) => Stream, limit: number): Stream; flatMapErrors(transform: (error: S) => Stream): Stream; - + // Combine two streams filterBy(otherObs: Observable): Stream; sampledBy(otherObs: Observable, combinator?: (a: T, b: U) => W): Stream; skipUntilBy(otherObs: Observable): Stream; takeUntilBy(otherObs: Observable): Stream; bufferBy(otherObs: Observable, options?: {flushOnEnd: boolean}): Stream; - bufferWhileBy(otherObs: Observable): Stream; + bufferWhileBy(otherObs: Observable, options?: {flushOnEnd?: boolean, flushOnChange?: boolean}): Stream; awaiting(otherObs: Observable): Stream; } - + export interface Property extends Observable { changes(): Stream; - + // Modify an property map(fn: (value: T) => U): Property; filter(predicate?: (value: T) => boolean): Property; @@ -90,24 +94,26 @@ declare module "kefir" { skipDuplicates(comparator?: (a: T, b: T) => boolean): Property; diff(fn?: (prev: T, next: T) => T, seed?: T): Property; scan(fn: (prev: T, next: T) => T, seed?: T): Property; - flatten(transformer?: (value: T) => U[]): Property; delay(wait: number): Property; - throttle(wait: number, options?: {leading: boolean, trailing: boolean}): Property; + throttle(wait: number, options?: {leading?: boolean, trailing?: boolean}): Property; debounce(wait: number, options?: {immediate: boolean}): Property; valuesToErrors(handler?: (value: T) => {convert: boolean, error: U}): Property; errorsToValues(handler?: (error: S) => {convert: boolean, value: U}): Property; mapErrors(fn: (error: S) => U): Property; filterErrors(predicate?: (error: S) => boolean): Property; endOnError(): Property; - skipValues(): Property; - skipErrors(): Property; - skipEnd(): Property; + takeErrors(n: number): Stream; + ignoreValues(): Property; + ignoreErrors(): Property; + ignoreEnd(): Property; beforeEnd(fn: () => U): Property; slidingWindow(max: number, mix?: number): Property; bufferWhile(predicate: (value: T) => boolean): Property; + bufferWithCount(count: number, options?: {flushOnEnd: boolean}): Property; + bufferWithTimeOrCount(interval: number, count: number, options?: {flushOnEnd: boolean}): Property; transduce(transducer: any): Property; withHandler(handler: (emitter: Emitter, event: Event) => void): Property; - + // Combine properties combine(otherObs: Property, combinator?: (value: T, ...values: U[]) => W): Property; zip(otherObs: Property, combinator?: (value: T, ...values: U[]) => W): Property; @@ -119,35 +125,34 @@ declare module "kefir" { flatMapConcat(fn: (value: T) => Property): Property; flatMapConcurLimit(fn: (value: T) => Property, limit: number): Property; flatMapErrors(transform: (error: S) => Property): Property; - + // Combine two properties filterBy(otherObs: Observable): Property; sampledBy(otherObs: Observable, combinator?: (a: T, b: U) => W): Property; skipUntilBy(otherObs: Observable): Property; takeUntilBy(otherObs: Observable): Property; bufferBy(otherObs: Observable, options?: {flushOnEnd: boolean}): Property; - bufferWhileBy(otherObs: Observable): Property; + bufferWhileBy(otherObs: Observable, options?: {flushOnEnd?: boolean, flushOnChange?: boolean}): Property; awaiting(otherObs: Observable): Property; } - + export interface ObservablePool extends Observable { plug(obs: Observable): void; unPlug(obs: Observable): void; } - + export interface Event { type: string; value: T; - current: boolean; } - + export interface Emitter { emit(value: T): void; error(error: S): void; end(): void; emitEvent(event: {type: string, value: T | S}): void; } - + // Create a stream export function never(): Stream; export function later(wait: number, value: T): Stream; @@ -159,12 +164,13 @@ declare module "kefir" { export function fromNodeCallback(fn: (callback: (error: S, result: T) => void) => void): Stream; export function fromEvents(target: EventTarget | NodeJS.EventEmitter | { on: Function, off: Function }, eventName: string, transform?: (value: T) => S): Stream; export function stream(subscribe: (emitter: Emitter) => Function | void): Stream; - + export function fromESObservable(observable: any): Stream + // Create a property export function constant(value: T): Property; export function constantError(error: T): Property; export function fromPromise(promise: any): Property; - + // Combine observables export function combine(obss: Observable[], passiveObss: Observable[], combinator?: (...values: T[]) => U): Observable; export function combine(obss: Observable[], combinator?: (...values: T[]) => U): Observable; From a41272778c9e8c0f9c930e33df6e50713f87388f Mon Sep 17 00:00:00 2001 From: tkqubo Date: Sat, 2 Jan 2016 15:50:51 +0900 Subject: [PATCH 186/441] feat: add typings --- webpack/webpack.d.ts | 93 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 90 insertions(+), 3 deletions(-) diff --git a/webpack/webpack.d.ts b/webpack/webpack.d.ts index 3889446b28..7846239dcc 100644 --- a/webpack/webpack.d.ts +++ b/webpack/webpack.d.ts @@ -6,10 +6,27 @@ declare module "webpack" { namespace webpack { interface Configuration { + context?: string; entry?: string|string[]|Entry; devtool?: string; output?: Output; module?: Module; + resolve?: Resolve; + resolveLoader?: ResolveLoader; + externals?: ExternalsElement|ExternalsElement[]; + target?: string; + bail?: boolean; + profile?: boolean; + cache?: boolean|any; + watch?: boolean; + watchOptions?: WatchOptions; + debug?: boolean; + devServer?: any; // TODO: Type this + node?: Node; + amd?: { [moduleName: string]: boolean }; + recordsPath?: string; + recordsInputPath?: string; + recordsOutputPath?: string; plugins?: (Plugin|Function)[]; } @@ -21,17 +38,87 @@ declare module "webpack" { path?: string; filename?: string; chunkFilename?: string; + sourceMapFilename?: string; + devtoolModuleFilenameTemplate?: string; + devtoolFallbackModuleFilenameTemplate?: string; + devtoolLineToLine?: boolean; + hotUpdateChunkFilename?: string; + hotUpdateMainFilename?: string; publicPath?: string; + jsonpFunction?: string; + hotUpdateFunction?: string; + pathinfo?: boolean; + library?: boolean; + libraryTarget?: string; + umdNamedDefine?: boolean; + sourcePrefix?: string; + crossOriginLoading?: string|boolean; } interface Module { loaders?: Loader[]; + preLoaders?: Loader[]; + postLoaders?: Loader[]; + noParse?: RegExp|RegExp[]; + unknownContextRequest?: string; + unknownContextRecursive?: boolean; + unknownContextRegExp?: RegExp; + unknownContextCritical?: boolean; + exprContextRequest?: string; + exprContextRegExp?: RegExp; + exprContextRecursive?: boolean; + exprContextCritical?: boolean; + wrappedContextRegExp?: RegExp; + wrappedContextRecursive?: boolean; + wrappedContextCritical?: boolean; } + interface Resolve { + alias: { [key: string]: string; }; + root?: string|string[]; + modulesDirectories?: string[]; + fallback?: string|string[]; + extensions?: string[]; + packageMains?: (string|string[])[]; + packageAlias?: (string|string[])[]; + unsafeCache?: RegExp|RegExp[]|boolean; + } + + interface ResolveLoader extends Resolve { + moduleTemplates?: string[]; + } + + type ExternalsElement = string|RegExp|ExternalsObjectElement|ExternalsFunctionElement; + + interface ExternalsObjectElement { + [key: string]: boolean|string; + } + + interface ExternalsFunctionElement { + (context: any, request: any, callback: (error: any, result: any) => void): any; + } + + interface WatchOptions { + aggregateTimeout?: number; + poll?: boolean|number; + } + + interface Node { + console?: boolean; + global?: boolean; + process?: boolean; + Buffer?: boolean; + __filename?: boolean|string; + __dirname?: boolean|string; + [nodeBuiltin: string]: boolean|string; + } + + type LoaderCondition = string|RegExp|((absPath: string) => boolean); + interface Loader { - exclude?: string[]; - include?: string[]; - test: RegExp; + exclude?: LoaderCondition|LoaderCondition[]; + include?: LoaderCondition|LoaderCondition[]; + test: LoaderCondition|LoaderCondition[]; loader?: string; loaders?: string[]; query?: { From 8a951cf86555290bc23001ce02ae4e9a2eae0428 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Sat, 2 Jan 2016 16:22:37 +0900 Subject: [PATCH 187/441] chore: update webpack version --- webpack/webpack.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack/webpack.d.ts b/webpack/webpack.d.ts index 7846239dcc..9e0ae9e7f8 100644 --- a/webpack/webpack.d.ts +++ b/webpack/webpack.d.ts @@ -1,4 +1,4 @@ -// Type definitions for webpack 1.12.2 +// Type definitions for webpack 1.12.9 // Project: https://github.com/webpack/webpack // Definitions by: Qubo // Definitions: https://github.com/borisyankov/DefinitelyTyped From 25c3427fd8957a334648449b436734490043f05a Mon Sep 17 00:00:00 2001 From: tkqubo Date: Sat, 2 Jan 2016 16:23:10 +0900 Subject: [PATCH 188/441] docs: add comments --- webpack/webpack.d.ts | 101 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/webpack/webpack.d.ts b/webpack/webpack.d.ts index 9e0ae9e7f8..5bf5050b82 100644 --- a/webpack/webpack.d.ts +++ b/webpack/webpack.d.ts @@ -8,25 +8,56 @@ declare module "webpack" { interface Configuration { context?: string; entry?: string|string[]|Entry; + /** Choose a developer tool to enhance debugging. */ devtool?: string; + /** Options affecting the output. */ output?: Output; + /** Options affecting the normal modules (NormalModuleFactory) */ module?: Module; + /** Options affecting the resolving of modules. */ resolve?: Resolve; + /** Like resolve but for loaders. */ resolveLoader?: ResolveLoader; + /** + * Specify dependencies that shouldn’t be resolved by webpack, but should become dependencies of the resulting bundle. + * The kind of the dependency depends on output.libraryTarget. + */ externals?: ExternalsElement|ExternalsElement[]; + /** + *
    + *
  • "web" Compile for usage in a browser-like environment (default)
  • + *
  • "webworker" Compile as WebWorker
  • + *
  • "node" Compile for usage in a node.js-like environment (use require to load chunks)
  • + *
  • "async-node" Compile for usage in a node.js-like environment (use fs and vm to load chunks async)
  • + *
  • "node-webkit" Compile for usage in webkit, uses jsonp chunk loading but also supports builtin node.js modules plus require(“nw.gui”) (experimental)
  • + *
  • "atom" Compile for usage in electron (formerly known as atom-shell), supports require for modules necessary to run Electron.
  • + *
      + */ target?: string; + /** Report the first error as a hard error instead of tolerating it. */ bail?: boolean; + /** Capture timing information for each module. */ profile?: boolean; + /** Cache generated modules and chunks to improve performance for multiple incremental builds. */ cache?: boolean|any; + /** Enter watch mode, which rebuilds on file change. */ watch?: boolean; watchOptions?: WatchOptions; + /** Switch loaders to debug mode. */ debug?: boolean; + /** Can be used to configure the behaviour of webpack-dev-server when the webpack config is passed to webpack-dev-server CLI. */ devServer?: any; // TODO: Type this + /** Include polyfills or mocks for various node stuff */ node?: Node; + /** Set the value of require.amd and define.amd. */ amd?: { [moduleName: string]: boolean }; + /** Used for recordsInputPath and recordsOutputPath */ recordsPath?: string; + /** Load compiler state from a json file. */ recordsInputPath?: string; + /** Store compiler state to a json file. */ recordsOutputPath?: string; + /** Add additional plugins to the compiler. */ plugins?: (Plugin|Function)[]; } @@ -35,30 +66,67 @@ declare module "webpack" { } interface Output { + /** The output directory as absolute path (required). */ path?: string; + /** The filename of the entry chunk as relative path inside the output.path directory. */ filename?: string; + /** The filename of non-entry chunks as relative path inside the output.path directory. */ chunkFilename?: string; + /** The filename of the SourceMaps for the JavaScript files. They are inside the output.path directory. */ sourceMapFilename?: string; + /** Filename template string of function for the sources array in a generated SourceMap. */ devtoolModuleFilenameTemplate?: string; + /** Similar to output.devtoolModuleFilenameTemplate, but used in the case of duplicate module identifiers. */ devtoolFallbackModuleFilenameTemplate?: string; + /** + * Enable line to line mapped mode for all/specified modules. + * Line to line mapped mode uses a simple SourceMap where each line of the generated source is mapped to the same line of the original source. + * It’s a performance optimization. Only use it if your performance need to be better and you are sure that input lines match which generated lines. + * true enables it for all modules (not recommended) + */ devtoolLineToLine?: boolean; + /** The filename of the Hot Update Chunks. They are inside the output.path directory. */ hotUpdateChunkFilename?: string; + /** The filename of the Hot Update Main File. It is inside the output.path directory. */ hotUpdateMainFilename?: string; + /** The output.path from the view of the Javascript / HTML page. */ publicPath?: string; + /** The JSONP function used by webpack for asnyc loading of chunks. */ jsonpFunction?: string; + /** The JSONP function used by webpack for async loading of hot update chunks. */ hotUpdateFunction?: string; + /** Include comments with information about the modules. */ pathinfo?: boolean; + /** If set, export the bundle as library. output.library is the name. */ library?: boolean; + /** + * Which format to export the library: + *
        + *
      • "var" - Export by setting a variable: var Library = xxx (default)
      • + *
      • "this" - Export by setting a property of this: this["Library"] = xxx
      • + *
      • "commonjs" - Export by setting a property of exports: exports["Library"] = xxx
      • + *
      • "commonjs2" - Export by setting module.exports: module.exports = xxx
      • + *
      • "amd" - Export to AMD (optionally named)
      • + *
      • "umd" - Export to AMD, CommonJS2 or as property in root
      • + *
      + */ libraryTarget?: string; + /** If output.libraryTarget is set to umd and output.library is set, setting this to true will name the AMD module. */ umdNamedDefine?: boolean; + /** Prefixes every line of the source in the bundle with this string. */ sourcePrefix?: string; + /** This option enables cross-origin loading of chunks. */ crossOriginLoading?: string|boolean; } interface Module { + /** A array of automatically applied loaders. */ loaders?: Loader[]; + /** A array of applied pre loaders. */ preLoaders?: Loader[]; + /** A array of applied post loaders. */ postLoaders?: Loader[]; + /** A RegExp or an array of RegExps. Don’t parse files matching. */ noParse?: RegExp|RegExp[]; unknownContextRequest?: string; unknownContextRecursive?: boolean; @@ -74,17 +142,43 @@ declare module "webpack" { } interface Resolve { + /** Replace modules by other modules or paths. */ alias: { [key: string]: string; }; + /** + * The directory (absolute path) that contains your modules. + * May also be an array of directories. + * This setting should be used to add individual directories to the search path. */ root?: string|string[]; + /** + * An array of directory names to be resolved to the current directory as well as its ancestors, and searched for modules. + * This functions similarly to how node finds “node_modules” directories. + * For example, if the value is ["mydir"], webpack will look in “./mydir”, “../mydir”, “../../mydir”, etc. + */ modulesDirectories?: string[]; + /** + * A directory (or array of directories absolute paths), + * in which webpack should look for modules that weren’t found in resolve.root or resolve.modulesDirectories. + */ fallback?: string|string[]; + /** + * An array of extensions that should be used to resolve modules. + * For example, in order to discover CoffeeScript files, your array should contain the string ".coffee". + */ extensions?: string[]; + /** Check these fields in the package.json for suitable files. */ packageMains?: (string|string[])[]; + /** Check this field in the package.json for an object. Key-value-pairs are threaded as aliasing according to this spec */ packageAlias?: (string|string[])[]; + /** + * Enable aggressive but unsafe caching for the resolving of a part of your files. + * Changes to cached paths may cause failure (in rare cases). An array of RegExps, only a RegExp or true (all files) is expected. + * If the resolved path matches, it’ll be cached. + */ unsafeCache?: RegExp|RegExp[]|boolean; } interface ResolveLoader extends Resolve { + /** It describes alternatives for the module name that are tried. */ moduleTemplates?: string[]; } @@ -99,7 +193,9 @@ declare module "webpack" { } interface WatchOptions { + /** Delay the rebuilt after the first change. Value is a time in ms. */ aggregateTimeout?: number; + /** true: use polling, number: use polling with specified interval */ poll?: boolean|number; } @@ -116,10 +212,15 @@ declare module "webpack" { type LoaderCondition = string|RegExp|((absPath: string) => boolean); interface Loader { + /** A condition that must not be met */ exclude?: LoaderCondition|LoaderCondition[]; + /** A condition that must be met */ include?: LoaderCondition|LoaderCondition[]; + /** A condition that must be met */ test: LoaderCondition|LoaderCondition[]; + /** A string of “!” separated loaders */ loader?: string; + /** A array of loaders as string */ loaders?: string[]; query?: { [name: string]: any; From a004df7294027795adb7c98dec3fc1073a87c6f2 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 2 Jan 2016 14:33:09 +0500 Subject: [PATCH 189/441] lodash: signatures of _.bind have been changed --- lodash/lodash-tests.ts | 87 ++++++++++++++++++++++++++++++++++++++---- lodash/lodash.d.ts | 60 +++++++++++++++++++++-------- 2 files changed, 124 insertions(+), 23 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2b..e138ce731d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5016,16 +5016,87 @@ module TestBefore { } } -var funcBind = function(greeting: string, punctuation: string) { return greeting + ' ' + this.user + punctuation; }; -var funcBound1: (punctuation: string) => any = _.bind(funcBind, { 'name': 'moe' }, 'hi'); -funcBound1('!'); +// _.bind +module TestBind { + type SampleFunc = (a: number, b: string) => boolean; -var funcBound2: (punctuation: string) => any = _(funcBind).bind({ 'name': 'moe' }, 'hi').value(); -funcBound2('!'); + let func: SampleFunc -var addTwoNumbers = function (x: number, y: number) { return x + y }; -var plusTwo = _.bind(addTwoNumbers, null, 2); -plusTwo(100); + { + type SampleResult = (a: number, b: string) => boolean; + + let result: SampleResult; + + result = _.bind(func, any); + result = _.bind(func, any); + } + + { + type SampleResult = (b: string) => boolean; + + let result: SampleResult; + + result = _.bind(func, any, 42); + result = _.bind(func, any, 42); + } + + { + type SampleResult = () => boolean; + + let result: SampleResult; + + result = _.bind(func, any, 42, ''); + result = _.bind(func, any, 42, ''); + } + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).bind(any); + } + + { + type SampleResult = (b: string) => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).bind(any, 42); + } + + { + type SampleResult = () => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).bind(any, 42, ''); + } + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().bind(any); + } + + { + type SampleResult = (b: string) => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().bind(any, 42); + } + + { + type SampleResult = () => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().bind(any, 42, ''); + } +} // _.bindAll module TestBindAll { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c45ec90eea..5ff18a3dc3 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8561,28 +8561,58 @@ declare module _ { } //_.bind - interface LoDashStatic { - /** - * Creates a function that, when called, invokes func with the this binding of thisArg - * and prepends any additional bind arguments to those provided to the bound function. - * @param func The function to bind. - * @param thisArg The this binding of func. - * @param args Arguments to be partially applied. - * @return The new bound function. - **/ - bind( + interface FunctionBind { + placeholder: any; + + ( + func: T, + thisArg: any, + ...partials: any[] + ): TResult; + + ( func: Function, thisArg: any, - ...args: any[]): (...args: any[]) => any; + ...partials: any[] + ): TResult; + } + + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of thisArg and prepends any additional _.bind + * arguments to those provided to the bound function. + * + * The _.bind.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for + * partially applied arguments. + * + * Note: Unlike native Function#bind this method does not set the "length" property of bound functions. + * + * @param func The function to bind. + * @param thisArg The this binding of func. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + bind: FunctionBind; } interface LoDashImplicitObjectWrapper { /** - * @see _.bind - **/ - bind( + * @see _.bind + */ + bind( thisArg: any, - ...args: any[]): LoDashImplicitObjectWrapper<(...args: any[]) => any>; + ...partials: any[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bind + */ + bind( + thisArg: any, + ...partials: any[] + ): LoDashExplicitObjectWrapper; } //_.bindAll From da884c0c6128ba1b96953d56834ca709f8a94bc2 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sat, 2 Jan 2016 11:03:34 -0600 Subject: [PATCH 190/441] bluebird: Update fromCallback API --- bluebird/bluebird-tests.ts | 7 +++++++ bluebird/bluebird.d.ts | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bluebird/bluebird-tests.ts b/bluebird/bluebird-tests.ts index 278b1d2297..b1829c52ed 100644 --- a/bluebird/bluebird-tests.ts +++ b/bluebird/bluebird-tests.ts @@ -766,6 +766,13 @@ func = Promise.promisify(f, obj); obj = Promise.promisifyAll(obj); anyProm = Promise.fromNode(callback => nodeCallbackFunc(callback)); anyProm = Promise.fromNode(callback => nodeCallbackFuncErrorOnly(callback)); +anyProm = Promise.fromNode(callback => nodeCallbackFunc(callback), {multiArgs : true}); +anyProm = Promise.fromNode(callback => nodeCallbackFuncErrorOnly(callback), {multiArgs : true}); + +anyProm = Promise.fromCallback(callback => nodeCallbackFunc(callback)); +anyProm = Promise.fromCallback(callback => nodeCallbackFuncErrorOnly(callback)); +anyProm = Promise.fromCallback(callback => nodeCallbackFunc(callback), {multiArgs : true}); +anyProm = Promise.fromCallback(callback => nodeCallbackFuncErrorOnly(callback), {multiArgs : true}); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index ea8bebe0c2..023eab7aa2 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -137,7 +137,8 @@ interface PromiseConstructor { /** * Returns a promise that is resolved by a node style callback function. */ - fromNode(resolver: (callback: (err: any, result?: any) => void) => void): Promise; + fromNode(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise; + fromCallback(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise; /** * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. From 54e9dfc280e93e8c80a7207a9ed4b01cba680f18 Mon Sep 17 00:00:00 2001 From: Christiaan Rakowski Date: Sat, 2 Jan 2016 22:05:54 +0100 Subject: [PATCH 191/441] Notify.JS - Notify.isSupported is a method in 1.2.8 Notify.isSupported is typed as a property, but it is actually a method these days. https://github.com/alexgibson/notify.js/commit/6133f4daf64f9e3ff94957b50f9aca04a5a434e1 --- notifyjs/notifyjs.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notifyjs/notifyjs.d.ts b/notifyjs/notifyjs.d.ts index 1c683084db..1214052c70 100644 --- a/notifyjs/notifyjs.d.ts +++ b/notifyjs/notifyjs.d.ts @@ -1,4 +1,4 @@ -// Type definitions for notify.js 1.2.3 +// Type definitions for notify.js 1.2.8 // Project: https://github.com/alexgibson/notify.js // Definitions by: soundTricker // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -23,7 +23,7 @@ declare var Notify: { * return true if the browser supports HTML5 Notification * @param true : the browser supports HTML5 Notification, false ; the browser does not supports HTML5 Notification. */ - isSupported: boolean; + isSupported(): boolean; /** * shows the user's current permission level (granted, denied or default), returns null if notifications are not supported. From 48aa1402fd462017eb046ad52b0632ad9205374b Mon Sep 17 00:00:00 2001 From: Christiaan Rakowski Date: Sat, 2 Jan 2016 22:10:10 +0100 Subject: [PATCH 192/441] Update notifyjs-tests.ts --- notifyjs/notifyjs-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notifyjs/notifyjs-tests.ts b/notifyjs/notifyjs-tests.ts index 3289791dee..7d9ffec678 100644 --- a/notifyjs/notifyjs-tests.ts +++ b/notifyjs/notifyjs-tests.ts @@ -31,6 +31,6 @@ function test_Notify_static_methods() { Notify.requestPermission(); Notify.requestPermission(()=> console.log("onPermissionGrantedCallback")); Notify.requestPermission(()=> console.log("onPermissionGrantedCallback"), ()=> console.log("onPermissionDeniedCallback")); - Notify.isSupported; + Notify.isSupported(); Notify.permissionLevel; } From 14fd30b019df680b7c78b28070f208fa41d05106 Mon Sep 17 00:00:00 2001 From: Alexey Gorshkov Date: Sun, 3 Jan 2016 01:15:27 +0300 Subject: [PATCH 193/441] Updating to version 1.2.7 --- jsurl/jsurl-tests.ts | 16 ++++++++++------ jsurl/jsurl.d.ts | 11 ++++++----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/jsurl/jsurl-tests.ts b/jsurl/jsurl-tests.ts index f573feb49e..177399d346 100644 --- a/jsurl/jsurl-tests.ts +++ b/jsurl/jsurl-tests.ts @@ -1,8 +1,12 @@ /// -var u = new Url; // curent document URL will be used +interface U2Model { + a: any; +} + +var u = new Url (); // curent document URL will be used // or we can instantiate as -var u2 = new Url("http://example.com/some/path?a=b&c=d#someAnchor"); +var u2 = new Url("http://example.com/some/path?a=b&c=d#someAnchor"); // it should support relative URLs also var u3 = new Url("/my/site/doc/path?foo=bar#baz"); @@ -55,13 +59,13 @@ var str = 'My Cool Link'; // or use in DOM context var a = document.createElement('a'); -a.href = u; +a.href = u.toString(); a.innerHTML = 'test'; document.body.appendChild(a); // Stringify -u += ''; -String(u); -u.toString(); +var su1 = u + ''; +var su2 = String(u); +var su3 = u.toString(); // NOTE, that usually it will be done automatically, so only in special // cases direct stringify is required \ No newline at end of file diff --git a/jsurl/jsurl.d.ts b/jsurl/jsurl.d.ts index a5f7902578..2dbac988f7 100644 --- a/jsurl/jsurl.d.ts +++ b/jsurl/jsurl.d.ts @@ -1,11 +1,12 @@ -// Type definitions for jsurl 1.2.2 +// Type definitions for jsurl 1.2.7 // Project: https://github.com/Mikhus/jsurl // Definitions by: Alexey Gorshkov // Definitions: https://github.com/agorshkov23/DefinitelyTyped -declare class Url { - constructor(url?: string); - query: any; +declare class Url { + constructor(); + constructor(url: string); + query: T; protocol: string; user: string; pass: string; @@ -14,5 +15,5 @@ declare class Url { path: string; hash: string; href: string; - toString(): string; + toString: () => string; } \ No newline at end of file From fbc04377c198ed8cd8267642daf30b18038a5190 Mon Sep 17 00:00:00 2001 From: Alexey Gorshkov Date: Sun, 3 Jan 2016 01:20:55 +0300 Subject: [PATCH 194/441] add .travis.yml --- jsurl/.travis.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 jsurl/.travis.yml diff --git a/jsurl/.travis.yml b/jsurl/.travis.yml new file mode 100644 index 0000000000..e69de29bb2 From 6259fa1e5b45fc59859963dd4ac02fee5fdac71a Mon Sep 17 00:00:00 2001 From: Alexey Gorshkov Date: Sun, 3 Jan 2016 01:35:15 +0300 Subject: [PATCH 195/441] remove .travis.yml --- jsurl/.travis.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 jsurl/.travis.yml diff --git a/jsurl/.travis.yml b/jsurl/.travis.yml deleted file mode 100644 index e69de29bb2..0000000000 From 4de193b13625dce7b03abc9db54b69f7e4d44be3 Mon Sep 17 00:00:00 2001 From: Alexey Gorshkov Date: Sun, 3 Jan 2016 02:13:24 +0300 Subject: [PATCH 196/441] fixed jsurl/jsurl-tests.ts(16,7): error TS7017: Index signature of object type implicitly has an 'any' type. --- jsurl/jsurl-tests.ts | 11 ++++++++--- jsurl/jsurl.d.ts | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/jsurl/jsurl-tests.ts b/jsurl/jsurl-tests.ts index 177399d346..b0297bda0e 100644 --- a/jsurl/jsurl-tests.ts +++ b/jsurl/jsurl-tests.ts @@ -1,10 +1,15 @@ /// -interface U2Model { +interface UModel extends UrlQuery { + a: any; + b: string; +} + +interface U2Model extends UrlQuery { a: any; } -var u = new Url (); // curent document URL will be used +var u = new Url(); // curent document URL will be used // or we can instantiate as var u2 = new Url("http://example.com/some/path?a=b&c=d#someAnchor"); // it should support relative URLs also @@ -48,7 +53,7 @@ alert( 'path = ' + u.path + '\n' + 'query = ' + u.query + '\n' + 'hash = ' + u.hash - ); +); // Manipulating URL parts u.path = '/some/new/path'; // the way to change URL path diff --git a/jsurl/jsurl.d.ts b/jsurl/jsurl.d.ts index 2dbac988f7..cbe9858518 100644 --- a/jsurl/jsurl.d.ts +++ b/jsurl/jsurl.d.ts @@ -3,6 +3,10 @@ // Definitions by: Alexey Gorshkov // Definitions: https://github.com/agorshkov23/DefinitelyTyped +interface UrlQuery { + clear: () => void; +} + declare class Url { constructor(); constructor(url: string); From b59734a434cb167e75f59acad6d7d4705df4c15e Mon Sep 17 00:00:00 2001 From: Alexey Gorshkov Date: Sun, 3 Jan 2016 02:16:42 +0300 Subject: [PATCH 197/441] FIXED: jsurl/jsurl-tests.ts(21,7): error TS7017 --- jsurl/jsurl-tests.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jsurl/jsurl-tests.ts b/jsurl/jsurl-tests.ts index b0297bda0e..a10d0a763e 100644 --- a/jsurl/jsurl-tests.ts +++ b/jsurl/jsurl-tests.ts @@ -9,11 +9,15 @@ interface U2Model extends UrlQuery { a: any; } +interface U3Model extends UrlQuery { + foo: string; +} + var u = new Url(); // curent document URL will be used // or we can instantiate as var u2 = new Url("http://example.com/some/path?a=b&c=d#someAnchor"); // it should support relative URLs also -var u3 = new Url("/my/site/doc/path?foo=bar#baz"); +var u3 = new Url("/my/site/doc/path?foo=bar#baz"); // get the value of some query string parameter alert(u2.query.a); From 6d09e1a5aea3240e7290be602ed03c88e38cd07d Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Sat, 2 Jan 2016 23:24:44 +0000 Subject: [PATCH 198/441] Add missing opts argument to Commander JS Added missing opts argument to arguments of the command function of Commander JS --- commander/commander.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commander/commander.d.ts b/commander/commander.d.ts index cf04591bb0..d0efa63051 100644 --- a/commander/commander.d.ts +++ b/commander/commander.d.ts @@ -65,10 +65,11 @@ declare module commander { * * @param {String} name * @param {String} [desc] + * @param {Mixed} [opts] * @return {Command} the new command * @api public */ - command(name:string, desc?:string):ICommand; + command(name:string, desc?:string, opts?: any):ICommand; /** * Add an implicit `help [cmd]` subcommand From 6f503d7925b691c89bbd1907fae2f4c82b8b2f2b Mon Sep 17 00:00:00 2001 From: bradacina Date: Sun, 3 Jan 2016 12:06:08 +1100 Subject: [PATCH 199/441] Fix showSaveDialog method signature showSaveDialog() filters have the same format as showOpenDialog() filters. It also returns a string containing the file name As per: https://github.com/atom/electron/blob/master/docs/api/dialog.md --- github-electron/github-electron.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 37dd602228..d0f092c3be 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1193,8 +1193,12 @@ declare module GitHubElectron { /** * File types that can be displayed, see dialog.showOpenDialog for an example. */ - filters?: string[]; - }, callback?: (fileName: string) => void): void; + + filters?: { + name: string; + extensions: string[]; + }[] + }, callback?: (fileName: string) => void): string; /** * Shows a message box. It will block until the message box is closed. It returns . From 04a08ba8b546d2a0bf978906471a569969b09070 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sun, 3 Jan 2016 14:46:21 +0900 Subject: [PATCH 200/441] interface updates --- winrt/winrt-uwp.d.ts | 1236 +++++++++++++++++++++--------------------- 1 file changed, 618 insertions(+), 618 deletions(-) diff --git a/winrt/winrt-uwp.d.ts b/winrt/winrt-uwp.d.ts index e03cfc87bb..e7216e732a 100644 --- a/winrt/winrt-uwp.d.ts +++ b/winrt/winrt-uwp.d.ts @@ -2007,7 +2007,7 @@ declare namespace Windows { /** Represents a background task that has been registered with the system. */ abstract class BackgroundTaskRegistration { /** Enumerates an application's registered background tasks. */ - static allTasks: Windows.Foundation.Collections.IMapView; + static allTasks: Windows.Foundation.Collections.IMapView; /** Gets the name of a registered background task. */ name: string; /** Attaches a completed event handler to the registered background task. */ @@ -3079,9 +3079,9 @@ declare namespace Windows { * @param mimeType The MIME type of the attachment. * @param dataStreamReference A stream containing the attachment data. */ - constructor(mimeType: string, dataStreamReference: Windows.Storage.Streams.RandomAccessStreamReference); + constructor(mimeType: string, dataStreamReference: Windows.Storage.Streams.IRandomAccessStreamReference); /** Gets or sets a stream reference for a message attachment. */ - dataStreamReference: Windows.Storage.Streams.RandomAccessStreamReference; + dataStreamReference: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets or sets the identifier for the attachment group to which this attachment belongs. */ groupId: number; /** Gets or sets the MIME type of the attachment. */ @@ -3091,7 +3091,7 @@ declare namespace Windows { /** Gets or sets the text encoded representation of the attachment object. */ text: string; /** Gets or sets the thumbnail image for the attachment. */ - thumbnail: Windows.Storage.Streams.RandomAccessStreamReference; + thumbnail: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets or sets the progress of transferring the attachment. */ transferProgress: number; } @@ -3818,7 +3818,7 @@ declare namespace Windows { /** Gets the email addresses for a contact. */ emails: Windows.Foundation.Collections.IVector; /** Sets the fields that contain information about a contact. */ - fields: Windows.Foundation.Collections.IVector; + fields: Windows.Foundation.Collections.IVector; /** Gets and sets the first name for a contact. The maximum string length for the first name is 64 characters. */ firstName: string; /** Gets the full name of the Contact . */ @@ -3840,7 +3840,7 @@ declare namespace Windows { /** Gets the job info items for a contact. */ jobInfo: Windows.Foundation.Collections.IVector; /** Gets a large version of the display picture for the Contact . */ - largeDisplayPicture: Windows.Storage.Streams.RandomAccessStreamReference; + largeDisplayPicture: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets and sets the last name for a contact. The maximum string length for the last name is 64 characters. */ lastName: string; /** Gets and sets the middle name for a contact. The maximum string length for the middle name is 64 characters. */ @@ -3854,7 +3854,7 @@ declare namespace Windows { /** Gets info about the phones for a contact. */ phones: Windows.Foundation.Collections.IVector; /** Gets the property set object for the contact. */ - providerProperties: Windows.Foundation.Collections.PropertySet; + providerProperties: Windows.Foundation.Collections.IPropertySet; /** Gets or sets an ID that can be used by a service provider to access the Contact in their remote system. */ remoteId: string; /** Gets or puts the path to the ringtone file for the Contact . */ @@ -3862,11 +3862,11 @@ declare namespace Windows { /** Gets the significant others for a contact. */ significantOthers: Windows.Foundation.Collections.IVector; /** Gets a small version of the display picture for the Contact . */ - smallDisplayPicture: Windows.Storage.Streams.RandomAccessStreamReference; + smallDisplayPicture: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets the name used to sort the contact. */ sortName: string; /** Gets or sets the display picture for the Contact in its original size. */ - sourceDisplayPicture: Windows.Storage.Streams.RandomAccessStreamReference; + sourceDisplayPicture: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets or puts the path to the audio file to play when an SMS/MMS message is received from the Contact . */ textToneToken: string; thumbnail: any; /* unmapped type */ @@ -4655,7 +4655,7 @@ declare namespace Windows { * @param vCard A stream containing the vCard data. * @return The converted Contact . */ - static convertVCardToContactAsync(vCard: Windows.Storage.Streams.RandomAccessStreamReference): Windows.Foundation.IPromiseWithIAsyncOperation; + static convertVCardToContactAsync(vCard: Windows.Storage.Streams.IRandomAccessStreamReference): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Gets a Boolean value indicating if the ShowContactCard method is supported on the current platform. * @return A Boolean value indicating if the ShowContactCard method is supported on the current platform. @@ -5326,9 +5326,9 @@ declare namespace Windows { /** Gets the number of items that are contained in the property set. */ size: number; /** Gets or sets the source app's logo. */ - square30x30Logo: Windows.Storage.Streams.RandomAccessStreamReference; + square30x30Logo: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets or sets a thumbnail image for the DataPackage . */ - thumbnail: Windows.Storage.Streams.RandomAccessStreamReference; + thumbnail: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets or sets the text that displays as a title for the contents of the DataPackage object. */ title: string; } @@ -5377,7 +5377,7 @@ declare namespace Windows { */ split(): { /** The first half of the object. */ first: Windows.Foundation.Collections.IMapView; /** The second half of the object. */ second: Windows.Foundation.Collections.IMapView; }; /** Gets the source app's logo. */ - square30x30Logo: Windows.Storage.Streams.RandomAccessStreamReference; + square30x30Logo: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets the thumbnail image for the DataPackageView . */ thumbnail: Windows.Storage.Streams.RandomAccessStreamReference; /** Gets the text that displays as a title for the contents of the DataPackagePropertySetView object. */ @@ -5629,7 +5629,7 @@ declare namespace Windows { * @param file The file to share with the target app. * @return The sharing token to provide to the target app as part of a Uri activation. */ - static addFile(file: Windows.Storage.StorageFile): string; + static addFile(file: Windows.Storage.IStorageFile): string; /** * Gets a file shared by another app by providing the sharing token received from the source app. * @param token The sharing token for the shared file. @@ -5685,20 +5685,20 @@ declare namespace Windows { * @param filename The file name to use for the attachment. * @param data A random access stream containing the data for the attachment. */ - constructor(filename: string, data: Windows.Storage.Streams.RandomAccessStreamReference); + constructor(filename: string, data: Windows.Storage.Streams.IRandomAccessStreamReference); /** * Initializes a new instance of the EmailAttachment class. * @param fileName The filename of the attachment. * @param data The stream to use to download the attachment. * @param mimeType The MIME type of the attachment. */ - constructor(fileName: string, data: Windows.Storage.Streams.RandomAccessStreamReference, mimeType: string); + constructor(fileName: string, data: Windows.Storage.Streams.IRandomAccessStreamReference, mimeType: string); /** Gets or sets a value that identifies the content of the attachment on a remote system. */ contentId: string; /** Gets or sets the location of an email attachment as a Uniform Resource Identifier (URI). */ contentLocation: string; /** Gets or sets the email attachment's data. */ - data: Windows.Storage.Streams.RandomAccessStreamReference; + data: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets or sets the download state of the email attachment. */ downloadState: Windows.ApplicationModel.Email.EmailAttachmentDownloadState; /** Gets or sets the estimated download size of the attachment. */ @@ -6645,7 +6645,7 @@ declare namespace Windows { * @param type The kind of message body; plain text or HTML. * @return The selected body stream. */ - getBodyStream(type: Windows.ApplicationModel.Email.EmailMessageBodyKind): Windows.Storage.Streams.RandomAccessStreamReference; + getBodyStream(type: Windows.ApplicationModel.Email.EmailMessageBodyKind): Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets a Boolean value indicating whether this email message contains partial bodies. */ hasPartialBodies: boolean; /** Gets the identifier of an email message. */ @@ -6691,9 +6691,9 @@ declare namespace Windows { * @param type Indicates which body stream, plain text or HTML. * @param stream The message for the specified body stream. */ - setBodyStream(type: Windows.ApplicationModel.Email.EmailMessageBodyKind, stream: Windows.Storage.Streams.RandomAccessStreamReference): void; + setBodyStream(type: Windows.ApplicationModel.Email.EmailMessageBodyKind, stream: Windows.Storage.Streams.IRandomAccessStreamReference): void; /** Gets or sets the S/MIME data associated with an email message. For more information, see the Certificate class. */ - smimeData: Windows.Storage.Streams.RandomAccessStreamReference; + smimeData: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets or sets the type of S/MIME encryption/signature for the email message. */ smimeKind: Windows.ApplicationModel.Email.EmailMessageSmimeKind; /** Gets or sets the subject of the email message. */ @@ -7114,24 +7114,24 @@ declare namespace Windows { /** Gets the name. */ automationName: string; /** Gets the glyph to display. */ - glyph: Windows.Storage.Streams.RandomAccessStream; + glyph: Windows.Storage.Streams.IRandomAccessStream; /** Launches the app corresponding to the badge. */ launchApp(): void; /** Gets the logo to display with the badge. */ - logo: Windows.Storage.Streams.RandomAccessStream; + logo: Windows.Storage.Streams.IRandomAccessStream; /** Gets the number to display with the badge. */ number: number; } /** Provides access to the same data that the default lock screen has access to, such as wallpaper, badges, and so on. */ abstract class LockScreenInfo { /** Gets the alarm icon to display. */ - alarmIcon: Windows.Storage.Streams.RandomAccessStream; + alarmIcon: Windows.Storage.Streams.IRandomAccessStream; /** Gets the badges to display. */ badges: Windows.Foundation.Collections.IVectorView; /** Gets the detail text to display. */ detailText: Windows.Foundation.Collections.IVectorView; /** Gets the image to display on the lock screen. */ - lockScreenImage: Windows.Storage.Streams.RandomAccessStream; + lockScreenImage: Windows.Storage.Streams.IRandomAccessStream; /** Indicates the alarm icon has changed. */ onalarmiconchanged: Windows.Foundation.TypedEventHandler; addEventListener(type: "alarmiconchanged", listener: Windows.Foundation.TypedEventHandler): void; @@ -7313,7 +7313,7 @@ declare namespace Windows { * Asynchronously returns an IRandomAccessStream that accesses the value of this ResourceCandidate . * @return An asynchronous operation to return the requested IRandomAccessStream . */ - getValueAsStreamAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + getValueAsStreamAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; /** Indicates whether this ResourceCandidate can be used as a default fallback value for any context. */ isDefault: boolean; /** Indicates whether this ResourceCandidate matched the ResourceContext against which it was evaluated. */ @@ -7479,14 +7479,14 @@ declare namespace Windows { * Loads one or more PRI files and adds their contents to the default resource manager. * @param files The files you want to add. */ - loadPriFiles(files: Windows.Foundation.Collections.IIterable): void; + loadPriFiles(files: Windows.Foundation.Collections.IIterable): void; /** Gets the ResourceMap that is associated with the main package of the currently running application. */ mainResourceMap: Windows.ApplicationModel.Resources.Core.ResourceMap; /** * Unloads one or more PRI files. * @param files The files you want unloaded. */ - unloadPriFiles(files: Windows.Foundation.Collections.IIterable): void; + unloadPriFiles(files: Windows.Foundation.Collections.IIterable): void; } /** A collection of related resources, typically either for a particular app package, or a resource file for a particular package. */ abstract class ResourceMap { @@ -7809,7 +7809,7 @@ declare namespace Windows { /** Gets the value that was passed to the detailText parameter of the AppendResultSuggestion method. */ detailText: string; /** Gets the value that was passed to the image parameter of the AppendResultSuggestion method. */ - image: Windows.Storage.Streams.RandomAccessStreamReference; + image: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets the value that was passed to the imageAlternateText parameter of the AppendResultSuggestion method. */ imageAlternateText: string; /** Gets the type of suggestion. */ @@ -8075,7 +8075,7 @@ declare namespace Windows { * @param image The image to accompany the results suggestion. * @param imageAlternateText The alternate text for the image. */ - appendResultSuggestion(text: string, detailText: string, tag: string, image: Windows.Storage.Streams.RandomAccessStreamReference, imageAlternateText: string): void; + appendResultSuggestion(text: string, detailText: string, tag: string, image: Windows.Storage.Streams.IRandomAccessStreamReference, imageAlternateText: string): void; /** * Appends a text label that is used to separate groups of suggestions in the search pane. * @param label The text to use as a separator. This text should be descriptive of any suggestions that are appended after it. @@ -8966,7 +8966,7 @@ declare namespace Windows { */ findEmailMailboxesAsync(): Windows.Foundation.IPromiseWithIAsyncOperation>; /** Gets the icon associated with the UserDataAccount . */ - icon: Windows.Storage.Streams.RandomAccessStreamReference; + icon: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets a string that uniquely identifies the UserDataAccount on the local device. */ id: string; /** Gets a Boolean value indicating if the user account data is encrypted when the device becomes locked. */ @@ -9103,7 +9103,7 @@ declare namespace Windows { /** Gets or sets the layout template used to display the content tile on the Cortana canvas. */ contentTileType: Windows.ApplicationModel.VoiceCommands.VoiceCommandContentTileType; /** Gets or sets an image the background app service can associate with the content tile. */ - image: Windows.Storage.StorageFile; + image: Windows.Storage.IStorageFile; /** Gets or sets the first line of text the background app service can associate with the content tile. */ textLine1: string; /** Gets or sets the second line of text the background app service can associate with the content tile. */ @@ -9308,7 +9308,7 @@ declare namespace Windows { * @param stream The ".mswallet" file to import. * @return An asynchronous operation that, on successful completion, returns the wallet item that was imported into the wallet. If you use Asynchronous programming, the result type on successful completion is a single WalletItem . */ - importItemAsync(stream: Windows.Storage.Streams.RandomAccessStreamReference): Windows.Foundation.IPromiseWithIAsyncOperation; + importItemAsync(stream: Windows.Storage.Streams.IRandomAccessStreamReference): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Launches the app that is associated with the given wallet item. * @param item The wallet item to launch an app for. @@ -9350,7 +9350,7 @@ declare namespace Windows { * Initializes a new instance of the WalletBarcode class. * @param streamToBarcodeImage A stream representing the bar code image. */ - constructor(streamToBarcodeImage: Windows.Storage.Streams.RandomAccessStreamReference); + constructor(streamToBarcodeImage: Windows.Storage.Streams.IRandomAccessStreamReference); /** * Initializes a new instance of the WalletBarcode class. * @param symbology The symbology type for this barcode. Use one of the supported symbologies, such as Upca. Don't set to Invalid or Custom. @@ -9361,7 +9361,7 @@ declare namespace Windows { * Creates and returns a bitmap image stream for the barcode (or returns the custom image used during instantiation). * @return An asynchronous operation. If you use Asynchronous programming, the result type on successful completion is an IRandomAccessStreamReference instance. This can be assigned as the source for an image (with some additional code). */ - getImageAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + getImageAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets the symbology used by the bar code. */ symbology: Windows.ApplicationModel.Wallet.WalletBarcodeSymbology; /** Gets a string representation of the barcode (its message). */ @@ -9438,7 +9438,7 @@ declare namespace Windows { /** Gets or sets the barcode that's representative of the wallet item. */ barcode: Windows.ApplicationModel.Wallet.WalletBarcode; /** Gets or sets the background image of the body of the wallet item (uses a stream). */ - bodyBackgroundImage: Windows.Storage.Streams.RandomAccessStreamReference; + bodyBackgroundImage: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets or sets the body color of the wallet item. */ bodyColor: Windows.UI.Color; /** Gets or sets the body font color of the wallet item. */ @@ -9452,7 +9452,7 @@ declare namespace Windows { /** Gets or sets the expiration date of the wallet item. */ expirationDate: Date; /** Gets or sets the header background image of the wallet item. */ - headerBackgroundImage: Windows.Storage.Streams.RandomAccessStreamReference; + headerBackgroundImage: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets or sets the header color of the wallet item. */ headerColor: Windows.UI.Color; /** Gets or sets the header font color of the wallet item. */ @@ -9472,17 +9472,17 @@ declare namespace Windows { /** Gets or sets the date and time the data for this item was last updated. */ lastUpdated: Date; /** Gets or sets the medium (159 x 159) logo image of the wallet item. */ - logo159x159: Windows.Storage.Streams.RandomAccessStreamReference; + logo159x159: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets or sets the large (336 x 336) logo image of the wallet item. */ - logo336x336: Windows.Storage.Streams.RandomAccessStreamReference; + logo336x336: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets or sets the small (99 x 99) logo image of the wallet item. */ - logo99x99: Windows.Storage.Streams.RandomAccessStreamReference; + logo99x99: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets or sets the logo image of the wallet item. */ - logoImage: Windows.Storage.Streams.RandomAccessStreamReference; + logoImage: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets or sets the logo text of the wallet item. */ logoText: string; /** Gets or sets the promotional image of the wallet item. */ - promotionalImage: Windows.Storage.Streams.RandomAccessStreamReference; + promotionalImage: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets or sets the date on which the item is valid. */ relevantDate: Date; /** Gets or sets the description of the relevant date of the wallet item. */ @@ -9572,7 +9572,7 @@ declare namespace Windows { * @param stream The ".mswallet" file to import. * @return An asynchronous operation that, on successful completion, returns the wallet item that was imported into the wallet. If you use Asynchronous programming, the result type on successful completion is a single WalletItem . */ - importItemAsync(stream: Windows.Storage.Streams.RandomAccessStreamReference): Windows.Foundation.IPromiseWithIAsyncOperation; + importItemAsync(stream: Windows.Storage.Streams.IRandomAccessStreamReference): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Displays the item with the given ID in the Wallet UI. * @param id The ID of the item to display. @@ -9677,26 +9677,26 @@ declare namespace Windows { * @param password The password to open the PDF document, if it requires one. * @return The asynchronous operation. */ - static loadFromFileAsync(file: Windows.Storage.StorageFile, password: string): Windows.Foundation.IPromiseWithIAsyncOperation; + static loadFromFileAsync(file: Windows.Storage.IStorageFile, password: string): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Outputs an asynchronous operation. When the operation completes, a PdfDocument object is returned, which represents a Portable Document Format (PDF) document. * @param file The file, which represents a PDF document. * @return The asynchronous operation. */ - static loadFromFileAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static loadFromFileAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a PdfDocument object, representing a Portable Document Format (PDF) document, from a stream of data that represents a PDF document in the file system. Use this method if the PDF document is password-protected. * @param inputStream The stream of data, which represents a PDF document. * @param password The password to open the PDF document, if it requires one. * @return The asynchronous operation. */ - static loadFromStreamAsync(inputStream: Windows.Storage.Streams.RandomAccessStream, password: string): Windows.Foundation.IPromiseWithIAsyncOperation; + static loadFromStreamAsync(inputStream: Windows.Storage.Streams.IRandomAccessStream, password: string): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a PdfDocument object, representing a Portable Document Format (PDF) document, from a stream of data that represents a PDF document in the file system. * @param inputStream The stream of data, which represents a PDF document. * @return The asynchronous operation. */ - static loadFromStreamAsync(inputStream: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; + static loadFromStreamAsync(inputStream: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Gets a page from a Portable Document Format (PDF) document. * @param pageIndex The location of the PDF page relative to its parent document. @@ -9728,14 +9728,14 @@ declare namespace Windows { * @param outputStream The stream of data, which represents a PDF page's content. * @return The asynchronous action. */ - renderToStreamAsync(outputStream: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncAction; + renderToStreamAsync(outputStream: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncAction; /** * Takes a set of display settings, applies them to the output of a Portable Document Format (PDF) page's contents, and creates a stream with the customized, rendered output as an asynchronous action. This asynchronous action can be used to create a customized display image of the PDF page. * @param outputStream The stream of data, which represents a PDF page's contents. * @param options The requested set of display settings to apply to the display image that is output based on the PDF page. * @return The asynchronous action. */ - renderToStreamAsync(outputStream: Windows.Storage.Streams.RandomAccessStream, options: Windows.Data.Pdf.PdfPageRenderOptions): Windows.Foundation.IPromiseWithIAsyncAction; + renderToStreamAsync(outputStream: Windows.Storage.Streams.IRandomAccessStream, options: Windows.Data.Pdf.PdfPageRenderOptions): Windows.Foundation.IPromiseWithIAsyncAction; /** Gets the number of degrees that the Portable Document Format (PDF) page will be rotated when it's displayed or printed. */ rotation: Windows.Data.Pdf.PdfPageRotation; /** Gets the Portable Document Format (PDF) page's size based on its related CropBox , MediaBox , and Rotation property values. */ @@ -10662,7 +10662,7 @@ declare namespace Windows { * @param offset The number of characters at which to split this text node into two nodes, starting from zero. * @return The new text node. */ - splitText(offset: number): Windows.Data.Xml.Dom.XmlText; + splitText(offset: number): Windows.Data.Xml.Dom.IXmlText; /** * Retrieves a substring of the full string from the specified range. * @param offset Specifies the offset, in characters, from the beginning of the string. An offset of zero indicates copying from the start of the data. @@ -10817,13 +10817,13 @@ declare namespace Windows { * @param loadSettings Settings for customizing parser behavior. * @return The object that must be used to start the operation. */ - static loadFromFileAsync(file: Windows.Storage.StorageFile, loadSettings: Windows.Data.Xml.Dom.XmlLoadSettings): Windows.Foundation.IPromiseWithIAsyncOperation; + static loadFromFileAsync(file: Windows.Storage.IStorageFile, loadSettings: Windows.Data.Xml.Dom.XmlLoadSettings): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Asynchronously loads an XML document from the specified file. The document is parsed using the default parser settings. * @param file The file from which to load the document. * @return The object that must be used to start the operation. */ - static loadFromFileAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static loadFromFileAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Asynchronously loads an XML document from the specified location. The document is parsed using the provided settings. * @param uri A URL that specifies the location of the XML file. @@ -10982,13 +10982,13 @@ declare namespace Windows { * Loads an XML document using the buffer. The document is parsed using the default parser settings. * @param buffer The buffer to load into this XML document object. This buffer can contain an entire XML document or a well-formed fragment. */ - loadXmlFromBuffer(buffer: Windows.Storage.Streams.Buffer): void; + loadXmlFromBuffer(buffer: Windows.Storage.Streams.IBuffer): void; /** * Loads an XML document using the buffer. The document is parsed using the settings provided. * @param buffer The buffer to load into this XML document object. This buffer can contain an entire XML document or a well-formed fragment. * @param loadSettings The settings for parsing the document. */ - loadXmlFromBuffer(buffer: Windows.Storage.Streams.Buffer, loadSettings: Windows.Data.Xml.Dom.XmlLoadSettings): void; + loadXmlFromBuffer(buffer: Windows.Storage.Streams.IBuffer, loadSettings: Windows.Data.Xml.Dom.XmlLoadSettings): void; /** Gets the local name, which is the local part of a qualified name. This is called the local part in Namespaces in XML. */ localName: any; /** Returns the Uniform Resource Identifier (URI) for the namespace. */ @@ -11029,7 +11029,7 @@ declare namespace Windows { * @param file The file to save the document to. * @return The object that must be used to start the operation. */ - saveToFileAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncAction; + saveToFileAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncAction; /** * Applies the specified pattern-matching operation to this node's context and returns the list of matching nodes as an XmlNodeList . * @param xpath Specifies an XPath expression. @@ -11932,7 +11932,7 @@ declare namespace Windows { * @param offset The number of characters at which to split this text node into two nodes, starting from zero. * @return The new text node. */ - splitText(offset: number): Windows.Data.Xml.Dom.XmlText; + splitText(offset: number): Windows.Data.Xml.Dom.IXmlText; /** * Retrieves a substring of the full string from the specified range. * @param offset The offset, in characters, from the beginning of the string. An offset of zero indicates copying from the start of the data. @@ -12018,7 +12018,7 @@ declare namespace Windows { * @param offset The number of characters at which to split this text node into two nodes, starting from zero. * @return The new text node. */ - splitText(offset: number): Windows.Data.Xml.Dom.XmlText; + splitText(offset: number): Windows.Data.Xml.Dom.IXmlText; } /** Encapsulates the methods needed to execute XPath queries on an XML DOM tree or subtree. */ interface IXmlNodeSelector { @@ -12701,9 +12701,9 @@ declare namespace Windows { * @param offset The offset of byte pattern from beginning of advertisement data section. * @param data The Bluetooth LE advertisement data byte pattern to match. */ - constructor(dataType: number, offset: number, data: Windows.Storage.Streams.Buffer); + constructor(dataType: number, offset: number, data: Windows.Storage.Streams.IBuffer); /** The Bluetooth LE advertisement data byte pattern to match. */ - data: Windows.Storage.Streams.Buffer; + data: Windows.Storage.Streams.IBuffer; /** The Bluetooth LE advertisement data type defined by the Bluetooth Special Interest Group (SIG) to match. */ dataType: number; /** The offset of byte pattern from beginning of advertisement data section. */ @@ -12718,9 +12718,9 @@ declare namespace Windows { * @param dataType The Bluetooth LE advertisement data type as defined by the Bluetooth Special Interest Group (SIG). * @param data The Bluetooth LE advertisement data payload. */ - constructor(dataType: number, data: Windows.Storage.Streams.Buffer); + constructor(dataType: number, data: Windows.Storage.Streams.IBuffer); /** The Bluetooth LE advertisement data payload. */ - data: Windows.Storage.Streams.Buffer; + data: Windows.Storage.Streams.IBuffer; /** The Bluetooth LE advertisement data type as defined by the Bluetooth Special Interest Group (SIG). */ dataType: number; } @@ -12934,11 +12934,11 @@ declare namespace Windows { * @param companyId The Bluetooth LE company identifier code as defined by the Bluetooth Special Interest Group (SIG). * @param data Bluetooth LE manufacturer-specific section data. */ - constructor(companyId: number, data: Windows.Storage.Streams.Buffer); + constructor(companyId: number, data: Windows.Storage.Streams.IBuffer); /** The Bluetooth LE company identifier code as defined by the Bluetooth Special Interest Group (SIG). */ companyId: number; /** Bluetooth LE manufacturer-specific section data. */ - data: Windows.Storage.Streams.Buffer; + data: Windows.Storage.Streams.IBuffer; } /** Specifies the Bluetooth LE scanning mode. */ enum BluetoothLEScanningMode { @@ -12971,7 +12971,7 @@ declare namespace Windows { /** Gets the GATT characteristic that changed. */ characteristic: Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic; /** Gets a byte stream containing the new value of the characteristic. */ - value: Windows.Storage.Streams.Buffer; + value: Windows.Storage.Streams.IBuffer; } /** Provides information about the Bluetooth device that caused this trigger to fire. */ abstract class RfcommConnectionTriggerDetails { @@ -12987,7 +12987,7 @@ declare namespace Windows { /** Gets or sets the service UUID that will be advertised in the SDP record. */ localServiceId: Windows.Devices.Bluetooth.Rfcomm.RfcommServiceId; /** Gets or sets the Bluetooth SDP record that the system will advertise on behalf of the app. */ - sdpRecord: Windows.Storage.Streams.Buffer; + sdpRecord: Windows.Storage.Streams.IBuffer; /** Gets or sets the service capabilities that will be advertised. */ serviceCapabilities: Windows.Devices.Bluetooth.BluetoothServiceCapabilities; } @@ -13129,7 +13129,7 @@ declare namespace Windows { /** Gets the read-only list of RFCOMM services supported by the device. */ rfcommServices: Windows.Foundation.Collections.IVectorView; /** Gets the read-only list of Service Discovery Protocol (SDP) records for the device. */ - sdpRecords: Windows.Foundation.Collections.IVectorView; + sdpRecords: Windows.Foundation.Collections.IVectorView; addEventListener(type: string, listener: Windows.Foundation.EventHandler): void; removeEventListener(type: string, listener: Windows.Foundation.EventHandler): void; } @@ -13645,14 +13645,14 @@ declare namespace Windows { * @param value A Windows.Storage.Streams.IBuffer object which contains the data to be written to the Bluetooth LE device. * @return The object that manages the asynchronous operation, which, upon completion, returns the status with which the operation completed. */ - writeValueAsync(value: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + writeValueAsync(value: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Performs a Characteristic Value write to a Bluetooth LE device. * @param value A Windows.Storage.Streams.IBuffer object which contains the data to be written to the Bluetooth LE device. * @param writeOption Specifies what type of GATT write should be performed. * @return The object that manages the asynchronous operation, which, upon completion, returns the status with which the operation completed. */ - writeValueAsync(value: Windows.Storage.Streams.Buffer, writeOption: Windows.Devices.Bluetooth.GenericAttributeProfile.GattWriteOption): Windows.Foundation.IPromiseWithIAsyncOperation; + writeValueAsync(value: Windows.Storage.Streams.IBuffer, writeOption: Windows.Devices.Bluetooth.GenericAttributeProfile.GattWriteOption): Windows.Foundation.IPromiseWithIAsyncOperation; addEventListener(type: string, listener: Windows.Foundation.EventHandler): void; removeEventListener(type: string, listener: Windows.Foundation.EventHandler): void; } @@ -13892,7 +13892,7 @@ declare namespace Windows { * @param value A Windows.Storage.Streams.IBuffer object which contains the data to be written to the Bluetooth LE device. * @return The object that manages the asynchronous operation, which, upon completion, returns the status with which the operation completed. */ - writeValueAsync(value: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + writeValueAsync(value: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; } /** Represents an enumeration of the most well known Descriptor UUID values, and provides convenience methods for working with GATT descriptor UUIDs, and static properties providing descriptor UUIDs for common GATT descriptors. */ abstract class GattDescriptorUuids { @@ -14065,7 +14065,7 @@ declare namespace Windows { /** Gets the status of an asynchronous operation. */ status: Windows.Devices.Bluetooth.GenericAttributeProfile.GattCommunicationStatus; /** Gets the value read from the device. */ - value: Windows.Storage.Streams.Buffer; + value: Windows.Storage.Streams.IBuffer; } /** Performs GATT reliable writes on the Bluetooth LE device, in the form of a transaction write operation. */ class GattReliableWriteTransaction { @@ -14081,7 +14081,7 @@ declare namespace Windows { * @param characteristic The GattCharacteristic object on which to perform the write operation. * @param value The Characteristic Value to be written to characteristic. */ - writeValue(characteristic: Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic, value: Windows.Storage.Streams.Buffer): void; + writeValue(characteristic: Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic, value: Windows.Storage.Streams.IBuffer): void; } /** Represents an enumeration of the most well known Service UUID values, and provides convenience methods for working with GATT service UUIDs, and static properties providing service UUIDs for common GATT services. */ abstract class GattServiceUuids { @@ -14133,7 +14133,7 @@ declare namespace Windows { /** Represents the value received when registering to receive notifications or indications from a Bluetooth LE device. */ abstract class GattValueChangedEventArgs { /** Gets the new Characteristic Value. */ - characteristicValue: Windows.Storage.Streams.Buffer; + characteristicValue: Windows.Storage.Streams.IBuffer; /** Gets the time at which the system was notified of the Characteristic Value change. */ timestamp: Date; } @@ -14235,7 +14235,7 @@ declare namespace Windows { */ static createAsync(serviceId: Windows.Devices.Bluetooth.Rfcomm.RfcommServiceId): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets a collection of SDP attributes for advertising. */ - sdpRawAttributes: Windows.Foundation.Collections.IMap; + sdpRawAttributes: Windows.Foundation.Collections.IMap; /** Gets the RfcommServiceId of this local RFCOMM service instance. */ serviceId: Windows.Devices.Bluetooth.Rfcomm.RfcommServiceId; /** @@ -14283,7 +14283,7 @@ declare namespace Windows { * @param outputBuffer The output buffer. * @return The result of the async operation. */ - sendIOControlAsync(ioControlCode: Windows.Devices.Custom.IOControlCode, inputBuffer: Windows.Storage.Streams.Buffer, outputBuffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + sendIOControlAsync(ioControlCode: Windows.Devices.Custom.IIOControlCode, inputBuffer: Windows.Storage.Streams.IBuffer, outputBuffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Sends an IO control code. A return value indicates whether the operation succeeded. * @param ioControlCode The IO control code. @@ -14291,7 +14291,7 @@ declare namespace Windows { * @param outputBuffer The output buffer. * @return true if the operation is successful; otherwise, false. */ - trySendIOControlAsync(ioControlCode: Windows.Devices.Custom.IOControlCode, inputBuffer: Windows.Storage.Streams.Buffer, outputBuffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + trySendIOControlAsync(ioControlCode: Windows.Devices.Custom.IIOControlCode, inputBuffer: Windows.Storage.Streams.IBuffer, outputBuffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; } /** The device access mode. */ enum DeviceAccessMode { @@ -14901,7 +14901,7 @@ declare namespace Windows { * Creates a new instance of a IRandomAccessStream over the same resource as the current stream. * @return The new stream. The initial, internal position of the stream is 0. */ - cloneStream(): Windows.Storage.Streams.RandomAccessStream; + cloneStream(): Windows.Storage.Streams.IRandomAccessStream; /** Closes the current stream and releases system resources. */ close(): void; /** Returns the content type of the thumbnail image. */ @@ -14932,7 +14932,7 @@ declare namespace Windows { * @param options Specifies the type of the asynchronous read operation. * @return The asynchronous operation. */ - readAsync(buffer: Windows.Storage.Streams.Buffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsync(buffer: Windows.Storage.Streams.IBuffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Sets the position of the stream to the specified value. * @param position The new position of the stream. @@ -14945,7 +14945,7 @@ declare namespace Windows { * @param buffer The buffer into which the asynchronous writer operation writes. * @return The byte writer operation. */ - writeAsync(buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + writeAsync(buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } /** Contains information about the result of attempting to unpair a device. */ abstract class DeviceUnpairingResult { @@ -16072,7 +16072,7 @@ declare namespace Windows { /** Represents a feature report. */ abstract class HidFeatureReport { /** Retrieves, or sets, the data associated with a given feature report. */ - data: Windows.Storage.Streams.Buffer; + data: Windows.Storage.Streams.IBuffer; /** * Retrieves the Boolean control associated with the usagePage and usageIdparameter and found in the given feature report. * @param usagePage The usage page of the top-level collection for the given HID device. @@ -16107,7 +16107,7 @@ declare namespace Windows { /** Retrieves the currently activated Boolean controls for the given HID device. */ activatedBooleanControls: Windows.Foundation.Collections.IVectorView; /** Retrieves the data associated with a given input report. */ - data: Windows.Storage.Streams.Buffer; + data: Windows.Storage.Streams.IBuffer; getBooleanControl: any; /* unmapped type */ /** * Retrieves the Boolean control described by the controlDescription parameter and found in the given input report. @@ -16187,7 +16187,7 @@ declare namespace Windows { /** Represents an output report. */ abstract class HidOutputReport { /** Retrieves, or sets, the data associated with a given output report. */ - data: Windows.Storage.Streams.Buffer; + data: Windows.Storage.Streams.IBuffer; getBooleanControl: any; /* unmapped type */ /** * Retrieves the boolean control associated with the given controlDescription. @@ -16546,7 +16546,7 @@ declare namespace Windows { /** Creates a new MidiActiveSensingMessage object. */ constructor(); /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16565,7 +16565,7 @@ declare namespace Windows { /** Gets the pressure from 0-127. */ pressure: number; /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16576,7 +16576,7 @@ declare namespace Windows { /** Creates a new MidiContinueMessage object. */ constructor(); /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16598,7 +16598,7 @@ declare namespace Windows { /** Gets controller from 0-127 to receive this message. */ controller: number; /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16688,7 +16688,7 @@ declare namespace Windows { /** Gets the note to turn off which is specified as a value from 0-127. */ note: number; /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16710,7 +16710,7 @@ declare namespace Windows { /** Gets the note to turn on which is specified as a value from 0-127. */ note: number; /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16725,7 +16725,7 @@ declare namespace Windows { * @param deviceId The device ID, which can be obtained by enumerating the devices on the system Windows.Devices.Enumeration.DeviceInformation.FindAllAsync . * @return The asynchronous operation. Upon completion, IAsyncOperation.GetResults returns a MidiOutPort object. */ - static fromIdAsync(deviceId: string): Windows.Foundation.IPromiseWithIAsyncOperation; + static fromIdAsync(deviceId: string): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Gets a query string that can be used to enumerate all MidiOutPort objects on the system. * @return The query string used to enumerate the MidiOutPort objects on the system. @@ -16739,7 +16739,7 @@ declare namespace Windows { * Send the specified data buffer to the device associated with this MidiOutPort . * @param midiData The data to send to the device. */ - sendBuffer(midiData: Windows.Storage.Streams.Buffer): void; + sendBuffer(midiData: Windows.Storage.Streams.IBuffer): void; /** * Send the data in the specified MIDI message to the device associated with this MidiOutPort . * @param midiMessage The MIDI message to send to the device. @@ -16759,7 +16759,7 @@ declare namespace Windows { /** Gets the channel from 0-15 that this message applies to. */ channel: number; /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16781,7 +16781,7 @@ declare namespace Windows { /** Gets the polyphonic key pressure which is specified as a value from 0-127. */ pressure: number; /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16800,7 +16800,7 @@ declare namespace Windows { /** Gets the program to change from 0-127. */ program: number; /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16816,7 +16816,7 @@ declare namespace Windows { /** Gets the song position pointer encoded in a 14-bit value from 0-16383. */ beats: number; /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16830,7 +16830,7 @@ declare namespace Windows { */ constructor(song: number); /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the song to select from 0-127. */ song: number; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ @@ -16843,7 +16843,7 @@ declare namespace Windows { /** Creates a new MidiStartMessage object. */ constructor(); /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16854,7 +16854,7 @@ declare namespace Windows { /** Creates a new MidiStopMessage object. */ constructor(); /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16889,7 +16889,7 @@ declare namespace Windows { * Sends an array of bytes through the synthesizer's out port . This enables you to send your data as a byte array instead of as a defined MIDI message. * @param midiData The array of bytes to send. */ - sendBuffer(midiData: Windows.Storage.Streams.Buffer): void; + sendBuffer(midiData: Windows.Storage.Streams.IBuffer): void; /** * Sends a MIDI message through the Microsoft MIDI synthesizer's out port . * @param midiMessage The MIDI message to send. @@ -16904,9 +16904,9 @@ declare namespace Windows { * Creates a new MidiSystemExclusiveMessage object. * @param rawData The system exclusive data. */ - constructor(rawData: Windows.Storage.Streams.Buffer); + constructor(rawData: Windows.Storage.Streams.IBuffer); /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16917,7 +16917,7 @@ declare namespace Windows { /** Creates a new MidiSystemResetMessage object. */ constructor(); /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16934,7 +16934,7 @@ declare namespace Windows { /** Gets the value of the frame type from 0-7. */ frameType: number; /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16947,7 +16947,7 @@ declare namespace Windows { /** Creates a new MidiTimingClockMessage object. */ constructor(); /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16958,7 +16958,7 @@ declare namespace Windows { /** Creates a new MidiTuneRequestMessage object. */ constructor(); /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16967,7 +16967,7 @@ declare namespace Windows { /** Represents a MIDI message which is implemented by all MIDI message classes. */ interface IMidiMessage { /** Gets the array of bytes associated with the MIDI message, including status byte. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Gets the duration from when the MidiInPort was created to the time the message was received. For messages being sent to a MidiOutPort , this value has no meaning. */ timestamp: number; /** Gets the type of this MIDI message. */ @@ -16979,7 +16979,7 @@ declare namespace Windows { * Sends the contents of the buffer through the MIDI out port. * @param midiData The data to send to the device. */ - sendBuffer(midiData: Windows.Storage.Streams.Buffer): void; + sendBuffer(midiData: Windows.Storage.Streams.IBuffer): void; /** * Send the data in the specified MIDI message to the device associated with this MidiOutPort . * @param midiMessage The MIDI message to send to the device. @@ -17847,7 +17847,7 @@ declare namespace Windows { /** Represents a frame of data from the device. */ abstract class PerceptionFrame { /** The actual bytes of the frame which can be consumed as described by the Properties of the IPerceptionFrameProvider which produced the frame. */ - frameData: Windows.Foundation.MemoryBuffer; + frameData: Windows.Foundation.IMemoryBuffer; /** Gets the Properties for this frame. */ properties: Windows.Foundation.Collections.ValueSet; /** Gets or sets the Relative Time of this frame relative to other frames from this IPerceptionFrameProvider. */ @@ -17989,7 +17989,7 @@ declare namespace Windows { /** Gets the PerceptionFrameProviderInfo describing this device. */ frameProviderInfo: Windows.Devices.Perception.Provider.PerceptionFrameProviderInfo; /** The properties describing the device and the frames produced by the device. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; } /** The IPerceptionFrameProviderManager is expected to provide any IPerceptionFrameProvider that has been registered via PerceptionFrameProviderManagerService::RegisterFrameProviderInfo(). */ interface IPerceptionFrameProviderManager extends Windows.Foundation.IClosable { @@ -18068,7 +18068,7 @@ declare namespace Windows { * @param statisticsCategories The list of statistics to retrieve. * @return IBuffer representing the requested statistics. */ - retrieveStatisticsAsync(statisticsCategories: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperation; + retrieveStatisticsAsync(statisticsCategories: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperation; addEventListener(type: string, listener: Windows.Foundation.EventHandler): void; removeEventListener(type: string, listener: Windows.Foundation.EventHandler): void; } @@ -18107,9 +18107,9 @@ declare namespace Windows { /** Contains the barcode scanner data. */ abstract class BarcodeScannerReport { /** Gets the full raw data from the DataReceived event. */ - scanData: Windows.Storage.Streams.Buffer; + scanData: Windows.Storage.Streams.IBuffer; /** Gets the decoded barcode label, which does not include the header, checksum, and other miscellaneous information. */ - scanDataLabel: Windows.Storage.Streams.Buffer; + scanDataLabel: Windows.Storage.Streams.IBuffer; /** Gets the decoded barcode label type. Possible values are defined in the BarcodeSymbologies class. */ scanDataType: number; } @@ -18713,7 +18713,7 @@ declare namespace Windows { * Retrieves a challenge token from the device. * @return Buffer used to store the resulting challenge token from the device. */ - retrieveDeviceAuthenticationDataAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + retrieveDeviceAuthenticationDataAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Sets the type of error to report by the ErrorOccurred event. * @param value Error reporting type. @@ -19016,7 +19016,7 @@ declare namespace Windows { * @param statisticsCategories The list of statistics to retrieve. * @return IBuffer representing the requested statistics. */ - retrieveStatisticsAsync(statisticsCategories: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperation; + retrieveStatisticsAsync(statisticsCategories: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets the card types supported by the magnetic stripe reader. */ supportedCardTypes: number; addEventListener(type: string, listener: Windows.Foundation.EventHandler): void; @@ -19170,9 +19170,9 @@ declare namespace Windows { /** Contains data from the recently swiped card. */ abstract class MagneticStripeReaderReport { /** Gets the additional security or encryption information for the recently swiped card. */ - additionalSecurityInformation: Windows.Storage.Streams.Buffer; + additionalSecurityInformation: Windows.Storage.Streams.IBuffer; /** Gets the card authentication information for the recently swiped card. */ - cardAuthenticationData: Windows.Storage.Streams.Buffer; + cardAuthenticationData: Windows.Storage.Streams.IBuffer; /** Gets the length of the raw CardAuthenticationData before it is encrypted. */ cardAuthenticationDataLength: number; /** Gets the card type identifier for the recently swiped card. */ @@ -19207,11 +19207,11 @@ declare namespace Windows { /** Contains the track data obtained following a card swipe. */ abstract class MagneticStripeReaderTrackData { /** Gets the raw or decoded data from the swiped card. */ - data: Windows.Storage.Streams.Buffer; + data: Windows.Storage.Streams.IBuffer; /** Gets the discretionary data from the swiped card. */ - discretionaryData: Windows.Storage.Streams.Buffer; + discretionaryData: Windows.Storage.Streams.IBuffer; /** Gets the encrypted data from the swiped card. */ - encryptedData: Windows.Storage.Streams.Buffer; + encryptedData: Windows.Storage.Streams.IBuffer; } /** Defines the constants that indicates the track error type. */ enum MagneticStripeReaderTrackErrorType { @@ -20379,7 +20379,7 @@ declare namespace Windows { * @param targetStream The scanned image file. * @return The progress of the scan and the scanned file format. */ - scanPreviewToStreamAsync(scanSource: Windows.Devices.Scanners.ImageScannerScanSource, targetStream: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; + scanPreviewToStreamAsync(scanSource: Windows.Devices.Scanners.ImageScannerScanSource, targetStream: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; } /** Represents the auto-configured scan source of the scanner. */ abstract class ImageScannerAutoConfiguration { @@ -21637,7 +21637,7 @@ declare namespace Windows { * Returns the smart card's Answer to Reset (ATR), a standard series of bytes that contains info about the smart card's characteristics, behaviors, and state. * @return The smart card's ATR byte set. */ - getAnswerToResetAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + getAnswerToResetAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Returns the smart card's status. * @return One of the SmartCardStatus enumeration values, representing the smart card's status. @@ -21649,14 +21649,14 @@ declare namespace Windows { /** Represents a smart card authentication challenge/response operation. */ abstract class SmartCardChallengeContext { /** Gets the smart card's challenge value. */ - challenge: Windows.Storage.Streams.Buffer; + challenge: Windows.Storage.Streams.IBuffer; /** * Changes the smart card's admin key (also known as an administrator PIN or unblock PIN). * @param response The response to a smart card authentication challenge/response operation. * @param newAdministrativeKey The new smart card admin key. * @return An asynchronous action that completes after the admin key change attempt is done. */ - changeAdministrativeKeyAsync(response: Windows.Storage.Streams.Buffer, newAdministrativeKey: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncAction; + changeAdministrativeKeyAsync(response: Windows.Storage.Streams.IBuffer, newAdministrativeKey: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncAction; /** Completes the smart card authentication challenge/response operation and frees associated system resources. */ close(): void; /** @@ -21665,7 +21665,7 @@ declare namespace Windows { * @param formatCard True to format the smart card; otherwise false. * @return An asynchronous action that completes after the smart card reconfiguration attempt is done. */ - provisionAsync(response: Windows.Storage.Streams.Buffer, formatCard: boolean): Windows.Foundation.IPromiseWithIAsyncAction; + provisionAsync(response: Windows.Storage.Streams.IBuffer, formatCard: boolean): Windows.Foundation.IPromiseWithIAsyncAction; /** * Reconfigures an existing, configured smart card with a new response and ID. Optionally, formats the smart card. * @param response The new response to a smart card authentication challenge/response operation. @@ -21673,13 +21673,13 @@ declare namespace Windows { * @param newCardId The new smart card ID. * @return An asynchronous action that completes after the smart card reconfiguration attempt is done. */ - provisionAsync(response: Windows.Storage.Streams.Buffer, formatCard: boolean, newCardId: string): Windows.Foundation.IPromiseWithIAsyncAction; + provisionAsync(response: Windows.Storage.Streams.IBuffer, formatCard: boolean, newCardId: string): Windows.Foundation.IPromiseWithIAsyncAction; /** * Verifies the response to the smart card challenge request. * @param response The response to the smart card challenge request. * @return After the verification attempt is done, true if the response was successfully verified; otherwise false. */ - verifyResponseAsync(response: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + verifyResponseAsync(response: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; } /** Represents a connection to a smart card. */ abstract class SmartCardConnection { @@ -21690,7 +21690,7 @@ declare namespace Windows { * @param command The APDU command to transmit to the smart card. * @return An asynchronous operation that, when completed, returns the response to the command that was transmitted. */ - transmitAsync(command: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + transmitAsync(command: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; } /** Specifies the rules for characters in a smart card personal identification number (PIN). */ enum SmartCardPinCharacterPolicyOption { @@ -21726,7 +21726,7 @@ declare namespace Windows { /** Represents a smart card personal identification number (PIN) reset request. */ abstract class SmartCardPinResetRequest { /** Gets the smart card's challenge value. */ - challenge: Windows.Storage.Streams.Buffer; + challenge: Windows.Storage.Streams.IBuffer; /** Gets the length of time to wait before requesting the smart card personal identification number (PIN) reset. */ deadline: Date; /** @@ -21738,7 +21738,7 @@ declare namespace Windows { * Sets the response to a smart card authentication challenge/response operation. * @param response The response to a smart card authentication challenge/response operation. */ - setResponse(response: Windows.Storage.Streams.Buffer): void; + setResponse(response: Windows.Storage.Streams.IBuffer): void; } /** Represents info about, and operations for, configuring smart cards. */ abstract class SmartCardProvisioning { @@ -21757,7 +21757,7 @@ declare namespace Windows { * @param cardId The smart card's ID. * @return After the operation completes, returns an instance of SmartCardProvisioning , representing the configured TPM virtual smart card. */ - static requestVirtualSmartCardCreationAsync(friendlyName: string, administrativeKey: Windows.Storage.Streams.Buffer, pinPolicy: Windows.Devices.SmartCards.SmartCardPinPolicy, cardId: string): Windows.Foundation.IPromiseWithIAsyncOperation; + static requestVirtualSmartCardCreationAsync(friendlyName: string, administrativeKey: Windows.Storage.Streams.IBuffer, pinPolicy: Windows.Devices.SmartCards.SmartCardPinPolicy, cardId: string): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a Trusted Platform Module (TPM) virtual smart card with a given human-readable name, admin key, and personal identification number (PIN) rules set. * @param friendlyName The smart card's human-readable name. @@ -21765,7 +21765,7 @@ declare namespace Windows { * @param pinPolicy The smart card's PIN rules set. * @return After the operation completes, returns an instance of SmartCardProvisioning , representing the configured TPM virtual smart card. */ - static requestVirtualSmartCardCreationAsync(friendlyName: string, administrativeKey: Windows.Storage.Streams.Buffer, pinPolicy: Windows.Devices.SmartCards.SmartCardPinPolicy): Windows.Foundation.IPromiseWithIAsyncOperation; + static requestVirtualSmartCardCreationAsync(friendlyName: string, administrativeKey: Windows.Storage.Streams.IBuffer, pinPolicy: Windows.Devices.SmartCards.SmartCardPinPolicy): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Deletes a Trusted Platform Module (TPM) virtual smart card. * @param card The TPM virtual smart card to delete. @@ -22015,7 +22015,7 @@ declare namespace Windows { /** Constructor. Used to create an SmsAppMessage prior to sending it. */ constructor(); /** Reads or writes the binary part of the Application message. */ - binaryBody: Windows.Storage.Streams.Buffer; + binaryBody: Windows.Storage.Streams.IBuffer; /** The plain text body of the message. */ body: string; /** The number to be dialed in reply to a received SMS message. */ @@ -22619,7 +22619,7 @@ declare namespace Windows { * @param format A value from the SmsDataFormat enumeration. * @return The new binary message that holds the result of this method call. */ - toBinaryMessages(format: Windows.Devices.Sms.SmsDataFormat): Windows.Foundation.Collections.IVectorView; + toBinaryMessages(format: Windows.Devices.Sms.SmsDataFormat): Windows.Foundation.Collections.IVectorView; } /** Encapsulates a decoded SMS text message. Prefer this class to the older SmsTextMessage class. */ class SmsTextMessage2 { @@ -22682,7 +22682,7 @@ declare namespace Windows { /** Gets the value of the X-Wap-Application-Id header of the SmsWapMessage . */ applicationId: string; /** Gets the binary body of the blob in the SmsWapMessage . */ - binaryBody: Windows.Storage.Streams.Buffer; + binaryBody: Windows.Storage.Streams.IBuffer; /** Gets the cellular class of the SMS device that received the message. */ cellularClass: Windows.Devices.Sms.CellularClass; /** Gets the value of the Content-Type header in the SmsWapMessage . Parameters are presents in the Headers property. */ @@ -23035,7 +23035,7 @@ declare namespace Windows { * Reads descriptor data in the caller-supplied buffer. * @param buffer A caller-supplied buffer that receives descriptor data. */ - readDescriptorBuffer(buffer: Windows.Storage.Streams.Buffer): void; + readDescriptorBuffer(buffer: Windows.Storage.Streams.IBuffer): void; } /** Represents a USB device. The object provides methods and properties that an app can use to find the device (in the system) with which the app wants to communicate, and sends IN and OUT control transfers to the device. */ abstract class UsbDevice { @@ -23086,13 +23086,13 @@ declare namespace Windows { * @param buffer A caller-supplied buffer that contains transfer data. * @return Returns an IAsyncOperation(IBuffer) object that returns the results of the operation. */ - sendControlInTransferAsync(setupPacket: Windows.Devices.Usb.UsbSetupPacket, buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + sendControlInTransferAsync(setupPacket: Windows.Devices.Usb.UsbSetupPacket, buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Starts a zero-length USB control transfer that reads from the default control endpoint of the device. * @param setupPacket A UsbSetupPacket object that contains the setup packet for the control transfer. * @return Returns an IAsyncOperation(IBuffer) object that returns the results of the operation. */ - sendControlInTransferAsync(setupPacket: Windows.Devices.Usb.UsbSetupPacket): Windows.Foundation.IPromiseWithIAsyncOperation; + sendControlInTransferAsync(setupPacket: Windows.Devices.Usb.UsbSetupPacket): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Starts a zero-length USB control transfer that writes to the default control endpoint of the device. * @param setupPacket A UsbSetupPacket object that contains the setup packet for the control transfer. @@ -23105,7 +23105,7 @@ declare namespace Windows { * @param buffer A caller-supplied buffer that contains the transfer data. * @return Returns an IAsyncOperation(UInt32) object that returns the results of the operation. */ - sendControlOutTransferAsync(setupPacket: Windows.Devices.Usb.UsbSetupPacket, buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + sendControlOutTransferAsync(setupPacket: Windows.Devices.Usb.UsbSetupPacket, buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; } /** Provides a way for the app to get an Advanced Query Syntax (AQS) string by specifying the class code, subclass code, and the protocol code defined by the device. The properties in this class are passed in the call to GetDeviceClassSelector . */ class UsbDeviceClass { @@ -23272,7 +23272,7 @@ declare namespace Windows { /** Represents the object that is passed as a parameter to the event handler for the DataReceived event. */ abstract class UsbInterruptInEventArgs { /** Gets data from the interrupt IN endpoint. */ - interruptData: Windows.Storage.Streams.Buffer; + interruptData: Windows.Storage.Streams.IBuffer; } /** Represents the pipe that the underlying USB driver opens to communicate with a USB interrupt IN endpoint of the device. The object also enables the app to specify an event handler. That handler that gets invoked when data is read from the endpoint. */ abstract class UsbInterruptInPipe { @@ -23336,7 +23336,7 @@ declare namespace Windows { * Creates a UsbSetupPacket object from a formatted buffer (eight bytes) that contains the setup packet. * @param eightByteBuffer A caller-supplied buffer that contains the setup packet formatted as per the standard USB specification. The length of the buffer must be eight bytes because that is the size of a setup packet on the bus. */ - constructor(eightByteBuffer: Windows.Storage.Streams.Buffer); + constructor(eightByteBuffer: Windows.Storage.Streams.IBuffer); /** Gets or sets the wIndex field in the setup packet of the USB control transfer. */ index: number; /** Gets the length, in bytes, of the setup packet. */ @@ -23560,7 +23560,7 @@ declare namespace Windows { * @param serviceInfoFilter A byte sequence that must be found in the advertiser's service information blob. * @return The AQS string for the requested advertiser query. */ - static getSelector(serviceName: string, serviceInfoFilter: Windows.Storage.Streams.Buffer): string; + static getSelector(serviceName: string, serviceInfoFilter: Windows.Storage.Streams.IBuffer): string; /** * Initiates the establishment of a service session with the Wi-Fi Direct Service represented by this instance. * @return An asynchronous connection operation. When successfully completed, returns an object that represents the session that has been established. @@ -23585,11 +23585,11 @@ declare namespace Windows { /** Gets or sets a value specifying whether the service instance should choose Wi-Fi Direct Point to Point (P2P) Group Owner (GO) mode. */ preferGroupOwnerMode: boolean; /** Gets the service information blob from this service instance. */ - remoteServiceInfo: Windows.Storage.Streams.Buffer; + remoteServiceInfo: Windows.Storage.Streams.IBuffer; /** Error information about the latest attempt to connect to the service. */ serviceError: Windows.Devices.WiFiDirect.Services.WiFiDirectServiceError; /** Gets or sets app-specific session information passed to the server when initiating a session. */ - sessionInfo: Windows.Storage.Streams.Buffer; + sessionInfo: Windows.Storage.Streams.IBuffer; /** Gets a list of supported configuration methods, ordered by preference. Your code uses IVector operations to modify the contents of the list. */ supportedConfigurationMethods: Windows.Foundation.Collections.IVectorView; addEventListener(type: string, listener: Windows.Foundation.EventHandler): void; @@ -23633,7 +23633,7 @@ declare namespace Windows { /** Gets or sets a custom service status code. Only valid if the ServiceStatus property value is Custom. */ customServiceStatusCode: number; /** Gets or sets the service-specific information that is passed to a session requester when establishing a session will not be completed immediately, as when, for example, the service is waiting for user input to complete the request. A requester should implement a 120 second timeout when its request is deferred. */ - deferredSessionInfo: Windows.Storage.Streams.Buffer; + deferredSessionInfo: Windows.Storage.Streams.IBuffer; /** Event raised when the AdvertisementStatus property value changes. */ onadvertisementstatuschanged: Windows.Foundation.TypedEventHandler; addEventListener(type: "advertisementstatuschanged", listener: Windows.Foundation.TypedEventHandler): void; @@ -23653,7 +23653,7 @@ declare namespace Windows { /** Gets a specific error code when AdvertisementStatus is Aborted. */ serviceError: Windows.Devices.WiFiDirect.Services.WiFiDirectServiceError; /** Gets or sets the service information blob. The format and contents of the blob are determined by the individual service, and are intended to be used by Seekers during service discovery. */ - serviceInfo: Windows.Storage.Streams.Buffer; + serviceInfo: Windows.Storage.Streams.IBuffer; /** Gets the service name. */ serviceName: string; /** Gets a list of service name prefixes that should match this service when a seeker is using prefix searching. Your code uses IVector methods to add or remove elements from the list. */ @@ -23672,7 +23672,7 @@ declare namespace Windows { /** Gets the WiFiDirectServiceSession that was created when the connection was automatically accepted. */ session: Windows.Devices.WiFiDirect.Services.WiFiDirectServiceSession; /** Gets the session information buffer that corresponds to this automatically accepted connection. */ - sessionInfo: Windows.Storage.Streams.Buffer; + sessionInfo: Windows.Storage.Streams.IBuffer; } /** Values describing how service configuration is performed when a session is being established. Typically, either no input is required, or one device in the session displays a PIN and the other device requires that the PIN be entered. */ enum WiFiDirectServiceConfigurationMethod { @@ -23766,7 +23766,7 @@ declare namespace Windows { /** Returned when a WiFiDirectService.SessionDeferred event is raised. */ abstract class WiFiDirectServiceSessionDeferredEventArgs { /** Gets the service-defined session information returned by the service when it sends a deferral in response to a connection request. Note that a deferral does not indicate that the connection is refused. Rather, it indicates that the server is performing a time-consuming operation such as requesting user input. A seeker should implement a 120-second timeout after getting a deferral before giving up on the request. */ - deferredSessionInfo: Windows.Storage.Streams.Buffer; + deferredSessionInfo: Windows.Storage.Streams.IBuffer; } /** Values used in the WiFiDirectServiceSession.ErrorStatus property. */ enum WiFiDirectServiceSessionErrorStatus { @@ -23792,7 +23792,7 @@ declare namespace Windows { /** Gets information about how provisioning should be performed if the session is established. */ provisioningInfo: Windows.Devices.WiFiDirect.Services.WiFiDirectServiceProvisioningInfo; /** Gets the session information blob associated with this request. */ - sessionInfo: Windows.Storage.Streams.Buffer; + sessionInfo: Windows.Storage.Streams.IBuffer; } /** Returned when a WiFiDirectServiceAdvertiser.SessionRequested event is raised. */ abstract class WiFiDirectServiceSessionRequestedEventArgs { @@ -24008,7 +24008,7 @@ declare namespace Windows { * @param buffer The data buffer that contains a information element. * @return A array of information elements created from the buffer. */ - static createFromBuffer(buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.Collections.IVector; + static createFromBuffer(buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.Collections.IVector; /** * Create an array of information elements from a DeviceInformation object. * @param deviceInformation The device information object that contains the information elements. @@ -24018,11 +24018,11 @@ declare namespace Windows { /** Creates a new WiFiDirectInformationElement object. */ constructor(); /** A three-byte organization identifier used to indicate the organization which defined a vendor extension information element (IE). */ - oui: Windows.Storage.Streams.Buffer; + oui: Windows.Storage.Streams.IBuffer; /** A one byte type value used in a vendor extension information element (IE) to distinguish between different IE formats defined by the same organization. */ ouiType: number; /** The value of the information element. */ - value: Windows.Storage.Streams.Buffer; + value: Windows.Storage.Streams.IBuffer; } /** Settings governing "legacy" mode (non-Wi-Fi Direct connections to the access point being advertised.) */ abstract class WiFiDirectLegacySettings { @@ -24569,12 +24569,12 @@ declare namespace Windows { * @param loggingChannel The logging channel to add. * @param maxLevel The minimum logging level that an event must have to be accepted by the session. */ - addLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.LoggingChannel, maxLevel: Windows.Foundation.Diagnostics.LoggingLevel): void; + addLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.ILoggingChannel, maxLevel: Windows.Foundation.Diagnostics.LoggingLevel): void; /** * Adds a logging channel to the current logging session. * @param loggingChannel The logging channel to add. */ - addLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.LoggingChannel): void; + addLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.ILoggingChannel): void; /** Ends the current logging session. */ close(): void; /** @@ -24585,14 +24585,14 @@ declare namespace Windows { /** Gets the name of the logging session. */ name: string; /** Raised when a log file is saved. */ - onlogfilegenerated: Windows.Foundation.TypedEventHandler; - addEventListener(type: "logfilegenerated", listener: Windows.Foundation.TypedEventHandler): void; - removeEventListener(type: "logfilegenerated", listener: Windows.Foundation.TypedEventHandler): void; + onlogfilegenerated: Windows.Foundation.TypedEventHandler; + addEventListener(type: "logfilegenerated", listener: Windows.Foundation.TypedEventHandler): void; + removeEventListener(type: "logfilegenerated", listener: Windows.Foundation.TypedEventHandler): void; /** * Removes the specified logging channel from the current logging session. * @param loggingChannel The logging channel to remove. */ - removeLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.LoggingChannel): void; + removeLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.ILoggingChannel): void; addEventListener(type: string, listener: Windows.Foundation.EventHandler): void; removeEventListener(type: string, listener: Windows.Foundation.EventHandler): void; } @@ -24609,13 +24609,13 @@ declare namespace Windows { * @param loggingChannel The logging channel. * @param level The logging level. */ - constructor(activityName: string, loggingChannel: Windows.Foundation.Diagnostics.LoggingChannel, level: Windows.Foundation.Diagnostics.LoggingLevel); + constructor(activityName: string, loggingChannel: Windows.Foundation.Diagnostics.ILoggingChannel, level: Windows.Foundation.Diagnostics.LoggingLevel); /** * Initializes a new instance of the LoggingActivity class for the specified LoggingChannel in Windows 8.1 compatibility mode. * @param activityName The name of the logging activity. * @param loggingChannel The logging channel. */ - constructor(activityName: string, loggingChannel: Windows.Foundation.Diagnostics.LoggingChannel); + constructor(activityName: string, loggingChannel: Windows.Foundation.Diagnostics.ILoggingChannel); /** Returns the channel associated with this activity. */ channel: Windows.Foundation.Diagnostics.LoggingChannel; /** Ends the current logging activity. */ @@ -24816,9 +24816,9 @@ declare namespace Windows { /** Gets the name of the current LoggingChannel . */ name: string; /** Raised when the logging channel is attached to a LoggingSession or other event tracing and debugging tools. */ - onloggingenabled: Windows.Foundation.TypedEventHandler; - addEventListener(type: "loggingenabled", listener: Windows.Foundation.TypedEventHandler): void; - removeEventListener(type: "loggingenabled", listener: Windows.Foundation.TypedEventHandler): void; + onloggingenabled: Windows.Foundation.TypedEventHandler; + addEventListener(type: "loggingenabled", listener: Windows.Foundation.TypedEventHandler): void; + removeEventListener(type: "loggingenabled", listener: Windows.Foundation.TypedEventHandler): void; /** * Writes an activity start event with the specified fields and level, and creates a LoggingActivity object. * @param startEventName The name for this event. @@ -25763,12 +25763,12 @@ declare namespace Windows { * @param loggingChannel The logging channel to add. * @param maxLevel The logging level for loggingChannel. */ - addLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.LoggingChannel, maxLevel: Windows.Foundation.Diagnostics.LoggingLevel): void; + addLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.ILoggingChannel, maxLevel: Windows.Foundation.Diagnostics.LoggingLevel): void; /** * Adds a logging channel to the current logging session. * @param loggingChannel The logging channel to add. */ - addLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.LoggingChannel): void; + addLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.ILoggingChannel): void; /** Ends the current logging session. */ close(): void; /** Gets the name of the logging session. */ @@ -25777,14 +25777,14 @@ declare namespace Windows { * Removes the specified logging channel from the current logging session. * @param loggingChannel The logging channel to remove. */ - removeLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.LoggingChannel): void; + removeLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.ILoggingChannel): void; /** * Saves the current logging session to a file. * @param folder The folder that contains the log file. * @param fileName The name of the log file. * @return When this method completes, it returns the new file as a StorageFile . */ - saveToFileAsync(folder: Windows.Storage.StorageFolder, fileName: string): Windows.Foundation.IPromiseWithIAsyncOperation; + saveToFileAsync(folder: Windows.Storage.IStorageFolder, fileName: string): Windows.Foundation.IPromiseWithIAsyncOperation; } /** Represents diagnostic error reporting settings. */ class RuntimeBrokerErrorSettings { @@ -25848,12 +25848,12 @@ declare namespace Windows { * @param loggingChannel The logging channel to add. * @param maxLevel The logging level for loggingChannel. */ - addLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.LoggingChannel, maxLevel: Windows.Foundation.Diagnostics.LoggingLevel): void; + addLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.ILoggingChannel, maxLevel: Windows.Foundation.Diagnostics.LoggingLevel): void; /** * Adds a logging channel to the current logging session. * @param loggingChannel The logging channel to add. */ - addLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.LoggingChannel): void; + addLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.ILoggingChannel): void; /** * Ends the current logging session and saves it to a file. * @return When this method completes, it returns the new file as a StorageFile . @@ -25863,7 +25863,7 @@ declare namespace Windows { * Removes the specified logging channel from the current logging session. * @param loggingChannel The logging channel to remove. */ - removeLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.LoggingChannel): void; + removeLoggingChannel(loggingChannel: Windows.Foundation.Diagnostics.ILoggingChannel): void; /** Gets the name of the logging session. */ name: string; } @@ -26374,7 +26374,7 @@ declare namespace Windows { userName: string; } /** Parses a URL query string, and exposes the results as a read-only vector (list) of name-value pairs from the query string. */ - class WwwFormUrlDecoder extends Array { + class WwwFormUrlDecoder extends Array { /** * Creates and initializes a new instance of the WwwFormUrlDecoder class. * @param query The URL to parse. @@ -26384,13 +26384,13 @@ declare namespace Windows { * Gets an iterator that represents the first name-value pair in the current URL query string. * @return The first name-value pair. */ - first(): Windows.Foundation.Collections.IIterator; + first(): Windows.Foundation.Collections.IIterator; /** * Gets the name-value pair at the specified index in the current URL query string. * @param index The index of the name-value pair. * @return The name-value pair at the position specified by index. */ - getAt(index: number): Windows.Foundation.WwwFormUrlDecoderEntry; + getAt(index: number): Windows.Foundation.IWwwFormUrlDecoderEntry; /** * Gets the first name-value pair that has the specified name, as obtained from the constructing Uniform Resource Identifier (URI) query string. * @param name The name of the value to get. @@ -26402,17 +26402,17 @@ declare namespace Windows { * @param startIndex The index to start getting name-value pairs at. * @return */ - getMany(startIndex: number): { /** The name-value pairs. */ items: Windows.Foundation.WwwFormUrlDecoderEntry; /** The number of name-value pairs in items. */ returnValue: number; }; + getMany(startIndex: number): { /** The name-value pairs. */ items: Windows.Foundation.IWwwFormUrlDecoderEntry; /** The number of name-value pairs in items. */ returnValue: number; }; /** * Gets a value indicating whether the specified IWwwFormUrlDecoderEntry is at the specified index in the current URL query string. * @param value The name-value pair to get the index of. * @return */ - indexOf(value: Windows.Foundation.WwwFormUrlDecoderEntry): { /** The position in value. */ index: number; /** true if value is at the position specified by index; otherwise, false. */ returnValue: boolean; }; + indexOf(value: Windows.Foundation.IWwwFormUrlDecoderEntry): { /** The position in value. */ index: number; /** true if value is at the position specified by index; otherwise, false. */ returnValue: boolean; }; /** Gets the number of the name-value pairs in the current URL query string. */ size: number; - indexOf(value: Windows.Foundation.WwwFormUrlDecoderEntry, ...extra: any[]): { index: number; returnValue: boolean; } /* hack */ - indexOf(searchElement: Windows.Foundation.WwwFormUrlDecoderEntry, fromIndex?: number): number; /* hack */ + indexOf(value: Windows.Foundation.IWwwFormUrlDecoderEntry, ...extra: any[]): { index: number; returnValue: boolean; } /* hack */ + indexOf(searchElement: Windows.Foundation.IWwwFormUrlDecoderEntry, fromIndex?: number): number; /* hack */ } /** Represents a name-value pair in a URL query string. Use the IWwwFormUrlDecoderEntry interface instead; see Remarks. */ abstract class WwwFormUrlDecoderEntry { @@ -26716,7 +26716,7 @@ declare namespace Windows { /** This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ status: Windows.Gaming.XboxLive.Storage.GameSaveErrorStatus; /** This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ - value: Windows.Foundation.Collections.IMapView; + value: Windows.Foundation.Collections.IMapView; } /** This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ abstract class GameSaveBlobInfo { @@ -26775,7 +26775,7 @@ declare namespace Windows { * @param blobsToRead This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. * @return This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ - readAsync(blobsToRead: Windows.Foundation.Collections.IMapView): Windows.Foundation.IPromiseWithIAsyncOperation; + readAsync(blobsToRead: Windows.Foundation.Collections.IMapView): Windows.Foundation.IPromiseWithIAsyncOperation; /** * This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. * @param blobsToWrite This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. @@ -26783,7 +26783,7 @@ declare namespace Windows { * @param displayName This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. * @return This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ - submitPropertySetUpdatesAsync(blobsToWrite: Windows.Foundation.Collections.PropertySet, blobsToDelete: Windows.Foundation.Collections.IIterable, displayName: string): Windows.Foundation.IPromiseWithIAsyncOperation; + submitPropertySetUpdatesAsync(blobsToWrite: Windows.Foundation.Collections.IPropertySet, blobsToDelete: Windows.Foundation.Collections.IIterable, displayName: string): Windows.Foundation.IPromiseWithIAsyncOperation; /** * This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. * @param blobsToWrite This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. @@ -26791,7 +26791,7 @@ declare namespace Windows { * @param displayName This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. * @return This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ - submitUpdatesAsync(blobsToWrite: Windows.Foundation.Collections.IMapView, blobsToDelete: Windows.Foundation.Collections.IIterable, displayName: string): Windows.Foundation.IPromiseWithIAsyncOperation; + submitUpdatesAsync(blobsToWrite: Windows.Foundation.Collections.IMapView, blobsToDelete: Windows.Foundation.Collections.IIterable, displayName: string): Windows.Foundation.IPromiseWithIAsyncOperation; } /** This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ abstract class GameSaveContainerInfo { @@ -28930,7 +28930,7 @@ declare namespace Windows { * Asynchronously gets the default International Color Consortium (ICC) color profile that is associated with the physical display. * @return Object that manages the asynchronous retrieval of the color profile. */ - getColorProfileAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + getColorProfileAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets the pixels per logical inch of the current environment. */ logicalDpi: number; /** Gets the native orientation of the display monitor, which is typically the orientation where the buttons on the device match the orientation of the monitor. */ @@ -28984,7 +28984,7 @@ declare namespace Windows { * * @return Object that manages the asynchronous retrieval of the color profile. */ - static getColorProfileAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + static getColorProfileAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; static logicalDpi: number; static nativeOrientation: Windows.Graphics.Display.DisplayOrientations; static oncolorprofilechanged: Windows.Graphics.Display.DisplayPropertiesEventHandler; @@ -29174,14 +29174,14 @@ declare namespace Windows { * @param stream The stream containing the image file to be decoded. * @return An object that manages the asynchronous creation of a new BitmapDecoder . */ - static createAsync(stream: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; + static createAsync(stream: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Asynchronously creates a new BitmapDecoder using a specific bitmap codec and initializes it using a stream. * @param decoderId The unique identifier of the specified bitmap codec. * @param stream The stream containing the image file to be decoded. * @return An object that manages the asynchronous creation of a new BitmapDecoder . */ - static createAsync(decoderId: string, stream: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; + static createAsync(decoderId: string, stream: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; /** * The bitmap decoders installed on the system and information about them. * @return A list of BitmapCodecInformation objects containing information about each decoder. @@ -29288,14 +29288,14 @@ declare namespace Windows { * @param encodingOptions A collection of key-value pairs containing one or more codec-specific encoding options and the desired values. * @return An object that manages the asynchronous creation of a new BitmapEncoder . */ - static createAsync(encoderId: string, stream: Windows.Storage.Streams.RandomAccessStream, encodingOptions: Windows.Foundation.Collections.IIterable>): Windows.Foundation.IPromiseWithIAsyncOperation; + static createAsync(encoderId: string, stream: Windows.Storage.Streams.IRandomAccessStream, encodingOptions: Windows.Foundation.Collections.IIterable>): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Asynchronously creates a new BitmapEncoder . * @param encoderId The unique identifier of the specified encoder. * @param stream The output stream. * @return An object that manages the asynchronous creation of a new BitmapEncoder . */ - static createAsync(encoderId: string, stream: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; + static createAsync(encoderId: string, stream: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Asynchronously creates a new BitmapEncoder for in-place property and metadata editing. The new encoder can only edit bitmap properties in-place and will fail for any other uses. * @param bitmapDecoder A BitmapDecoder containing the image data to be edited. This parameter must be created on a stream with an access mode of ReadWrite . @@ -29308,7 +29308,7 @@ declare namespace Windows { * @param bitmapDecoder A BitmapDecoder containing the image data to be copied. * @return An object that manages the asynchronous creation of a new BitmapEncoder using data from an existing BitmapDecoder . */ - static createForTranscodingAsync(stream: Windows.Storage.Streams.RandomAccessStream, bitmapDecoder: Windows.Graphics.Imaging.BitmapDecoder): Windows.Foundation.IPromiseWithIAsyncOperation; + static createForTranscodingAsync(stream: Windows.Storage.Streams.IRandomAccessStream, bitmapDecoder: Windows.Graphics.Imaging.BitmapDecoder): Windows.Foundation.IPromiseWithIAsyncOperation; /** * A list of the bitmap encoders installed on the system and information about them. * @return A list of BitmapCodecInformation objects containing information about each encoder. @@ -29611,7 +29611,7 @@ declare namespace Windows { * Returns the file stream for the ImageStream . * @return The file stream for the image. */ - cloneStream(): Windows.Storage.Streams.RandomAccessStream; + cloneStream(): Windows.Storage.Streams.IRandomAccessStream; /** Closes the ImageStream . */ close(): void; /** Returns the data format of the stream. */ @@ -29642,7 +29642,7 @@ declare namespace Windows { * @param options The options for the stream to be read. * @return The byte reader operation. */ - readAsync(buffer: Windows.Storage.Streams.Buffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsync(buffer: Windows.Storage.Streams.IBuffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Sets the position of the stream to the specified value. * @param position The new position of the stream. @@ -29655,7 +29655,7 @@ declare namespace Windows { * @param buffer The buffer into which the asynchronous writer operation writes. * @return The byte writer operation. */ - writeAsync(buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + writeAsync(buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } /** Specifies which chroma subsampling mode will be used for image compression in JPEG images. */ enum JpegSubsamplingMode { @@ -29724,7 +29724,7 @@ declare namespace Windows { * @param height The height of the software bitmap, in pixels. * @return The new software bitmap. */ - static createCopyFromBuffer(source: Windows.Storage.Streams.Buffer, format: Windows.Graphics.Imaging.BitmapPixelFormat, width: number, height: number): Windows.Graphics.Imaging.SoftwareBitmap; + static createCopyFromBuffer(source: Windows.Storage.Streams.IBuffer, format: Windows.Graphics.Imaging.BitmapPixelFormat, width: number, height: number): Windows.Graphics.Imaging.SoftwareBitmap; /** * Creates a new SoftwareBitmap by performing a deep copy of the provided buffer. Modifications to the data in the new SoftwareBitmap will not effect the buffer from which it was created. * @param source The source buffer from which the copy will be created. @@ -29734,7 +29734,7 @@ declare namespace Windows { * @param alpha The alpha mode of the software bitmap. * @return The new software bitmap. */ - static createCopyFromBuffer(source: Windows.Storage.Streams.Buffer, format: Windows.Graphics.Imaging.BitmapPixelFormat, width: number, height: number, alpha: Windows.Graphics.Imaging.BitmapAlphaMode): Windows.Graphics.Imaging.SoftwareBitmap; + static createCopyFromBuffer(source: Windows.Storage.Streams.IBuffer, format: Windows.Graphics.Imaging.BitmapPixelFormat, width: number, height: number, alpha: Windows.Graphics.Imaging.BitmapAlphaMode): Windows.Graphics.Imaging.SoftwareBitmap; /** * Asynchronously creates a new SoftwareBitmap by performing a deep copy of the provided IDirect3DSurface . Modifications to the data in the new SoftwareBitmap will not effect the surface from which it was created. * @param surface The source surface from which the copy will be created. @@ -29773,7 +29773,7 @@ declare namespace Windows { * Copies the pixel data from an IBuffer into the SoftwareBitmap . * @param buffer The buffer containing the pixel data to be copied. */ - copyFromBuffer(buffer: Windows.Storage.Streams.Buffer): void; + copyFromBuffer(buffer: Windows.Storage.Streams.IBuffer): void; /** * Copies the current SoftwareBitmap into the provided SoftwareBitmap object. * @param bitmap The target software bitmap into which the data will be copied. @@ -29783,7 +29783,7 @@ declare namespace Windows { * Copies the software bitmap pixel data into the specified IBuffer . * @param buffer The target buffer to which the pixel data will be copied. */ - copyToBuffer(buffer: Windows.Storage.Streams.Buffer): void; + copyToBuffer(buffer: Windows.Storage.Streams.IBuffer): void; /** Gets or sets the dots per inch of the software bitmap in the X direction. */ dpiX: number; /** Gets or sets the dots per inch of the software bitmap in the Y direction. */ @@ -31137,7 +31137,7 @@ declare namespace Windows { * @param value A 3MF file stream. * @return A Printing3D3MFPackage created from the specified 3MF package stream. */ - static loadAsync(value: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; + static loadAsync(value: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; /** Creates a Printing3D3MFPackage object. */ constructor(); /** @@ -31145,16 +31145,16 @@ declare namespace Windows { * @param value A 3MF file stream. * @return A Printing3DModel object created from the specified 3MF object stream. */ - loadModelFromPackageAsync(value: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; + loadModelFromPackageAsync(value: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets or sets an XML stream to the 3D model in the 3D Manufacturing Format (3MF) package. */ - modelPart: Windows.Storage.Streams.RandomAccessStream; + modelPart: Windows.Storage.Streams.IRandomAccessStream; /** Gets or sets a stream to the print ticket in the 3D Manufacturing Format (3MF) package. */ - printTicket: Windows.Storage.Streams.RandomAccessStream; + printTicket: Windows.Storage.Streams.IRandomAccessStream; /** * Saves the Printing3D3MFPackage object to a 3D Manufacturing Format (3MF) file stream. * @return A stream to the 3MF file where the package is to be saved. */ - saveAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + saveAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Saves the specified 3D model to the 3D Manufacturing Format (3MF) package. * @param value The 3D model to be saved to the 3MF package. @@ -31296,9 +31296,9 @@ declare namespace Windows { /** Creates an instance of the Printing3DMesh class. */ constructor(); /** Gets a set of mesh buffer descriptions. */ - bufferDescriptionSet: Windows.Foundation.Collections.PropertySet; + bufferDescriptionSet: Windows.Foundation.Collections.IPropertySet; /** Gets a set of mesh buffers. */ - bufferSet: Windows.Foundation.Collections.PropertySet; + bufferSet: Windows.Foundation.Collections.IPropertySet; /** * Creates the buffer for triangle indices. * @param value The capacity of the buffer, the maximum number of bytes that the IBuffer can hold. @@ -31323,22 +31323,22 @@ declare namespace Windows { * Gets the buffer for triangle indices. * @return The buffer for triangle indices. */ - getTriangleIndices(): Windows.Storage.Streams.Buffer; + getTriangleIndices(): Windows.Storage.Streams.IBuffer; /** * Gets the buffer for triangle material indices. * @return The buffer for triangle material indices. */ - getTriangleMaterialIndices(): Windows.Storage.Streams.Buffer; + getTriangleMaterialIndices(): Windows.Storage.Streams.IBuffer; /** * Gets the buffer for vertex normals. * @return The buffer for vertex normals. */ - getVertexNormals(): Windows.Storage.Streams.Buffer; + getVertexNormals(): Windows.Storage.Streams.IBuffer; /** * Gets the buffer for vertex positions. * @return The buffer for vertex positions. */ - getVertexPositions(): Windows.Storage.Streams.Buffer; + getVertexPositions(): Windows.Storage.Streams.IBuffer; /** Gets or sets the number of triangle indices. */ indexCount: number; /** Gets or sets the buffer description for triangle indices. */ @@ -31818,14 +31818,14 @@ declare namespace Windows { * Disables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to disable. */ - disableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + disableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Gets the list of effect definitions for the audio device input node. */ - effectDefinitions: Windows.Foundation.Collections.IVector; + effectDefinitions: Windows.Foundation.Collections.IVector; /** * Enables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to enable. */ - enableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + enableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Gets the encoding properties for the audio device input node. */ encodingProperties: Windows.Media.MediaProperties.AudioEncodingProperties; /** Gets the list of outgoing connections from the audio device input node to other nodes in the audio graph. */ @@ -31869,14 +31869,14 @@ declare namespace Windows { * Disables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to disable. */ - disableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + disableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Gets the list of effect definitions for the audio device output node. */ - effectDefinitions: Windows.Foundation.Collections.IVector; + effectDefinitions: Windows.Foundation.Collections.IVector; /** * Enables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to enable. */ - enableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + enableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Gets the encoding properties for the audio device output node. */ encodingProperties: Windows.Media.MediaProperties.AudioEncodingProperties; /** Gets or sets the outgoing gain for the audio device output node. */ @@ -31909,16 +31909,16 @@ declare namespace Windows { * Disables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to disable. */ - disableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + disableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Gets the duration for the audio input file. */ duration: number; /** Gets the list of effect definitions for the audio file input node. */ - effectDefinitions: Windows.Foundation.Collections.IVector; + effectDefinitions: Windows.Foundation.Collections.IVector; /** * Enables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to enable. */ - enableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + enableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Gets the encoding properties for the audio file input node. */ encodingProperties: Windows.Media.MediaProperties.AudioEncodingProperties; /** Gets or sets the end time for the audio file input node. */ @@ -31983,18 +31983,18 @@ declare namespace Windows { * Disables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to disable. */ - disableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + disableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Gets the list of effect definitions for the audio file output node. */ - effectDefinitions: Windows.Foundation.Collections.IVector; + effectDefinitions: Windows.Foundation.Collections.IVector; /** * Enables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to enable. */ - enableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + enableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Gets the encoding properties for the audio file output node. */ encodingProperties: Windows.Media.MediaProperties.AudioEncodingProperties; /** Gets the file associated with the audio file output node. */ - file: Windows.Storage.StorageFile; + file: Windows.Storage.IStorageFile; /** Gets the file encoding profile supported by the audio file output node. */ fileEncodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile; /** @@ -32042,16 +32042,16 @@ declare namespace Windows { * Disables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to disable. */ - disableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + disableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Removes queued frames from the audio frame input node. */ discardQueuedFrames(): void; /** Gets the list of effect definitions for the audio frame input node. */ - effectDefinitions: Windows.Foundation.Collections.IVector; + effectDefinitions: Windows.Foundation.Collections.IVector; /** * Enables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to enable. */ - enableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + enableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Gets the encoding properties for the audio frame input node. */ encodingProperties: Windows.Media.MediaProperties.AudioEncodingProperties; /** Notifies of a completed audio frame that has been submitted to the graph with a call to AddFrame . */ @@ -32094,14 +32094,14 @@ declare namespace Windows { * Disables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to disable. */ - disableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + disableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Gets the list of effect definitions for the audio frame output node. */ - effectDefinitions: Windows.Foundation.Collections.IVector; + effectDefinitions: Windows.Foundation.Collections.IVector; /** * Enables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to enable. */ - enableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + enableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Gets the encoding properties for the audio frame output node. */ encodingProperties: Windows.Media.MediaProperties.AudioEncodingProperties; /** @@ -32161,20 +32161,20 @@ declare namespace Windows { * @param file A IStorageFile object representing the file associated with the file input node. * @return When this operation completes, a CreateAudioFileInputNodeResult object is returned. */ - createFileInputNodeAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + createFileInputNodeAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a file output node for the indicated file. * @param file A StorageFile object representing the file. * @return When this operation completes, a CreateAudioFileOutputNodeResult object is returned. */ - createFileOutputNodeAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + createFileOutputNodeAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a file output node for the indicated file and media encoding profile. * @param file A StorageFile object representing the file. * @param fileEncodingProfile An objecting representing the media encoding profile. * @return When this operation completes, a CreateAudioFileOutputNodeResult object is returned. */ - createFileOutputNodeAsync(file: Windows.Storage.StorageFile, fileEncodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile): Windows.Foundation.IPromiseWithIAsyncOperation; + createFileOutputNodeAsync(file: Windows.Storage.IStorageFile, fileEncodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates an audio frame input node from encoding properties. * @param encodingProperties An object representing encoding properties. @@ -32314,14 +32314,14 @@ declare namespace Windows { * Disables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to disable. */ - disableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + disableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Gets the list of effect definitions for the audio submix node. */ - effectDefinitions: Windows.Foundation.Collections.IVector; + effectDefinitions: Windows.Foundation.Collections.IVector; /** * Enables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to enable. */ - enableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + enableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Gets the encoding properties for the audio device submix node. */ encodingProperties: Windows.Media.MediaProperties.AudioEncodingProperties; /** Gets outgoing connections from the audio submix node to other nodes in the audio graph. */ @@ -32389,7 +32389,7 @@ declare namespace Windows { /** Gets or sets the feedback included in the echo effect definition. */ feedback: number; /** Gets or sets the properties supported by the echo effect definition. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; /** Gets or sets the wet-dry audio voice mix for the echo effect definition. */ wetDryMix: number; } @@ -32414,7 +32414,7 @@ declare namespace Windows { /** Gets the bands included in the equalizer effect definition. */ bands: Windows.Foundation.Collections.IVectorView; /** Gets the properties supported by the equalizer effect definition. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; } /** Provides data for the AudioFrameInputNode::QuantumStarted event. This event is raised when the audio graph containing the audio frame input node is ready to begin processing a new quantum of data. */ abstract class FrameInputNodeQuantumStartedEventArgs { @@ -32433,7 +32433,7 @@ declare namespace Windows { /** Gets or sets the loudness included in the limiter effect definition. */ loudness: number; /** Gets the properties supported by the limiter effect definition. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; /** Gets or sets the release included in the limiter effect definition. */ release: number; } @@ -32482,7 +32482,7 @@ declare namespace Windows { /** Gets or sets the position right included in the reverberation effect definition. */ positionRight: number; /** Gets the properties supported by the reverberation effect definition. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; /** Gets or sets the rear delay included in the reverberation effect definition. */ rearDelay: number; /** Gets or sets the reflections delay included in the reverberation effect definition. */ @@ -32514,12 +32514,12 @@ declare namespace Windows { * Disables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to disable. */ - disableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + disableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** * Enables all effects in the EffectDefinitions list with the specified effect definition. * @param definition The effect definition of the effects to enable. */ - enableEffectsByDefinition(definition: Windows.Media.Effects.AudioEffectDefinition): void; + enableEffectsByDefinition(definition: Windows.Media.Effects.IAudioEffectDefinition): void; /** Resets the audio node. */ reset(): void; /** Starts the audio node. */ @@ -32529,7 +32529,7 @@ declare namespace Windows { /** Gets or sets a value indicating if the audio node consumes input. */ consumeInput: boolean; /** Gets the list of effect definitions for the audio node. */ - effectDefinitions: Windows.Foundation.Collections.IVector; + effectDefinitions: Windows.Foundation.Collections.IVector; /** Gets the encoding properties for the audio node. */ encodingProperties: Windows.Media.MediaProperties.AudioEncodingProperties; /** Gets or sets the outgoing gain for the audio node. */ @@ -32571,7 +32571,7 @@ declare namespace Windows { /** Gets or sets the duration of the audio frame. */ duration: number; /** Gets the extended property set which enables getting and setting properties on the AudioFrame . */ - extendedProperties: Windows.Foundation.Collections.PropertySet; + extendedProperties: Windows.Foundation.Collections.IPropertySet; /** Gets or sets a value that indicates whether an audio frame is the first frame after a gap in the stream. */ isDiscontinuous: boolean; /** Gets a value indicating whether the audio frame is read-only. */ @@ -32867,7 +32867,7 @@ declare namespace Windows { * Creates a copy of the stream. * @return The clone of the strem. */ - cloneStream(): Windows.Storage.Streams.RandomAccessStream; + cloneStream(): Windows.Storage.Streams.IRandomAccessStream; /** Closes the captured framed object. */ close(): void; /** Gets the content type of the captured frame. */ @@ -32900,7 +32900,7 @@ declare namespace Windows { * @param options Specifies the type of the asynchronous read operation. * @return The asynchronous operation. */ - readAsync(buffer: Windows.Storage.Streams.Buffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsync(buffer: Windows.Storage.Streams.IBuffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Seeks the stream to the specified position. * @param position The position in the stream to seek too. @@ -32917,7 +32917,7 @@ declare namespace Windows { * @param buffer The data to write to the stream. * @return Represents an asynchronous operation that returns a result and reports progress. */ - writeAsync(buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + writeAsync(buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } /** Provides information about the capture device settings that were used for a frame in a variable photo sequence. */ abstract class CapturedFrameControlValues { @@ -33117,7 +33117,7 @@ declare namespace Windows { * @param definition The object containing the definition of the effect to be added. * @return An asynchronous operation that returns an IMediaExtension upon successful completion. */ - addAudioEffectAsync(definition: Windows.Media.Effects.AudioEffectDefinition): Windows.Foundation.IPromiseWithIAsyncOperation; + addAudioEffectAsync(definition: Windows.Media.Effects.IAudioEffectDefinition): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Adds an audio or video effect. * @param mediaStreamType Specifies the streams to which the effect will be applied. @@ -33125,14 +33125,14 @@ declare namespace Windows { * @param effectSettings Configuration parameters for the effect. * @return Returns an IAsyncAction object that is used to control the asynchronous operation. */ - addEffectAsync(mediaStreamType: Windows.Media.Capture.MediaStreamType, effectActivationID: string, effectSettings: Windows.Foundation.Collections.PropertySet): Windows.Foundation.IPromiseWithIAsyncAction; + addEffectAsync(mediaStreamType: Windows.Media.Capture.MediaStreamType, effectActivationID: string, effectSettings: Windows.Foundation.Collections.IPropertySet): Windows.Foundation.IPromiseWithIAsyncAction; /** * Adds a video effect to the capture pipeline. * @param definition The object containing the definition of the effect to be added. * @param mediaStreamType Specifies the streams to which the effect will be applied. * @return An asynchronous operation that returns an IMediaExtension upon successful completion. */ - addVideoEffectAsync(definition: Windows.Media.Effects.VideoEffectDefinition, mediaStreamType: Windows.Media.Capture.MediaStreamType): Windows.Foundation.IPromiseWithIAsyncOperation; + addVideoEffectAsync(definition: Windows.Media.Effects.IVideoEffectDefinition, mediaStreamType: Windows.Media.Capture.MediaStreamType): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets an object that controls settings for the microphone. */ audioDeviceController: Windows.Media.Devices.AudioDeviceController; /** Gets the current stream state of the camera stream. */ @@ -33143,14 +33143,14 @@ declare namespace Windows { * @param file The storage file where the image is saved. * @return Returns an IAsyncAction object that is used to control the asynchronous operation. */ - capturePhotoToStorageFileAsync(type: Windows.Media.MediaProperties.ImageEncodingProperties, file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncAction; + capturePhotoToStorageFileAsync(type: Windows.Media.MediaProperties.ImageEncodingProperties, file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncAction; /** * Captures a photo to a random-access stream. * @param type The encoding properties for the output image. * @param stream The stream where the image data is written. * @return Returns an IAsyncAction object that is used to control the asynchronous operation. */ - capturePhotoToStreamAsync(type: Windows.Media.MediaProperties.ImageEncodingProperties, stream: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncAction; + capturePhotoToStreamAsync(type: Windows.Media.MediaProperties.ImageEncodingProperties, stream: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncAction; /** * Removes all audio and video effects from a stream. * @param mediaStreamType The stream from which to remove the effects. @@ -33267,21 +33267,21 @@ declare namespace Windows { * @param customSinkSettings Contains properties of the media extension. * @return When this method completes, a LowLagMediaRecording object is returned which can be used to start the photo capture. */ - prepareLowLagRecordToCustomSinkAsync(encodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile, customSinkActivationId: string, customSinkSettings: Windows.Foundation.Collections.PropertySet): Windows.Foundation.IPromiseWithIAsyncOperation; + prepareLowLagRecordToCustomSinkAsync(encodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile, customSinkActivationId: string, customSinkSettings: Windows.Foundation.Collections.IPropertySet): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Initializes the low lag recording using the specified file to store the recording. This method provides the LowLagMediaRecording object used to managed the recording. * @param encodingProfile The encoding profile for the recording. * @param file The storage file where the image is saved. * @return When this method completes, a LowLagMediaRecording object is returned which can be used to start the photo capture. */ - prepareLowLagRecordToStorageFileAsync(encodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile, file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + prepareLowLagRecordToStorageFileAsync(encodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile, file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Initializes the low lag recording using the specified random-access stream to store the recording. This method provides the LowLagMediaRecording object used to managed the recording. * @param encodingProfile The encoding profile for the recording. * @param stream The stream where the image data is written. * @return When this method completes, a LowLagMediaRecording object is returned which can be used to start the photo capture. */ - prepareLowLagRecordToStreamAsync(encodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile, stream: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; + prepareLowLagRecordToStreamAsync(encodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile, stream: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Initializes the variable photo sequence capture and provides the VariablePhotoSequenceCapture object used to manage the recording. * @param type The encoding profile used for the image. @@ -33330,7 +33330,7 @@ declare namespace Windows { * @param customSinkSettings Contains properties of the media extension. * @return Anobject that is used to control the asynchronous operation. */ - startRecordToCustomSinkAsync(encodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile, customSinkActivationId: string, customSinkSettings: Windows.Foundation.Collections.PropertySet): Windows.Foundation.IPromiseWithIAsyncAction; + startRecordToCustomSinkAsync(encodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile, customSinkActivationId: string, customSinkSettings: Windows.Foundation.Collections.IPropertySet): Windows.Foundation.IPromiseWithIAsyncAction; /** * Start recording to a custom media sink using the specified encoding profile. * @param encodingProfile The encoding profile to use for the recording. @@ -33344,14 +33344,14 @@ declare namespace Windows { * @param file The storage file where the image is saved. * @return Returns a IAsyncAction object that is used to control the asynchronous operation. */ - startRecordToStorageFileAsync(encodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile, file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncAction; + startRecordToStorageFileAsync(encodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile, file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncAction; /** * Starts recording to a random-access stream. * @param encodingProfile The encoding profile for the recording. * @param stream The stream where the image data is written. * @return Returns a IAsyncAction object that is used to control the asynchronous operation. */ - startRecordToStreamAsync(encodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile, stream: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncAction; + startRecordToStreamAsync(encodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile, stream: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncAction; /** * Stops recording. * @return Returns a IAsyncAction object that is used to control the asynchronous operation. @@ -33385,7 +33385,7 @@ declare namespace Windows { /** Gets or sets a value that specifies the audio processing mode. */ audioProcessing: Windows.Media.AudioProcessing; /** Gets or sets the audio source for the capture operation. */ - audioSource: Windows.Media.Core.MediaSource; + audioSource: Windows.Media.Core.IMediaSource; /** Gets or set the media category. */ mediaCategory: Windows.Media.Capture.MediaCategory; /** Gets or sets the stream that is used for photo capture. */ @@ -33403,7 +33403,7 @@ declare namespace Windows { /** Gets or sets the video profile which provides hints to the driver to allow it to optimize for different capture scenarios. */ videoProfile: Windows.Media.Capture.MediaCaptureVideoProfile; /** Gets or sets the video source for the capture operation. */ - videoSource: Windows.Media.Core.MediaSource; + videoSource: Windows.Media.Core.IMediaSource; } /** Contains read-only configuration settings for the MediaCapture object. */ abstract class MediaCaptureSettings { @@ -33932,7 +33932,7 @@ declare namespace Windows { /** The unique content ID of a piece of content, in the app's content catalog. */ id: string; /** The thumbnail image associated with the content. */ - image: Windows.Storage.Streams.RandomAccessStreamReference; + image: Windows.Storage.Streams.IRandomAccessStreamReference; /** Provides all existing third-party and Windows Store age ratings for a piece of content. */ ratings: Windows.Foundation.Collections.IVector; /** The display title of a piece of content. */ @@ -34006,7 +34006,7 @@ declare namespace Windows { /** Initializes a new instance of the DataCue class. */ constructor(); /** Gets the data associated with the cue. */ - data: Windows.Storage.Streams.Buffer; + data: Windows.Storage.Streams.IBuffer; /** Gets or sets the duration of the cue. */ duration: number; /** Gets the identifier for the timed metadata track. */ @@ -34033,7 +34033,7 @@ declare namespace Windows { * Sets properties on the IMediaExtension . * @param configuration The property set. */ - setProperties(configuration: Windows.Foundation.Collections.PropertySet): void; + setProperties(configuration: Windows.Foundation.Collections.IPropertySet): void; addEventListener(type: string, listener: Windows.Foundation.EventHandler): void; removeEventListener(type: string, listener: Windows.Foundation.EventHandler): void; } @@ -34046,7 +34046,7 @@ declare namespace Windows { /** Gets or sets a value that prioritizes the speed of face detection and the quality of detection results. */ detectionMode: Windows.Media.Core.FaceDetectionMode; /** Gets the set of properties for configuring the FaceDetectionEffectDefinition object. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; /** Gets or sets a value indicating whether synchronous face detection is enabled. */ synchronousDetectionEnabled: boolean; } @@ -34059,7 +34059,7 @@ declare namespace Windows { /** Gets or sets the duration of the face detection effect frame. */ duration: number; /** Gets the extended property set which enables getting and setting properties on the media frame. */ - extendedProperties: Windows.Foundation.Collections.PropertySet; + extendedProperties: Windows.Foundation.Collections.IPropertySet; /** Gets or sets a value that indicates whether a video frame is the first frame after a gap in the stream. */ isDiscontinuous: boolean; /** Gets a value indicating whether the frame is read-only. */ @@ -34123,13 +34123,13 @@ declare namespace Windows { * @param stream A stream containing the media content. * @param contentType A string specifying the content type of the media content. */ - setStream(stream: Windows.Storage.Streams.RandomAccessStream, contentType: string): void; + setStream(stream: Windows.Storage.Streams.IRandomAccessStream, contentType: string): void; /** * Sets the media content to be bound to the MediaSource . * @param stream A stream reference containing the media content to be bound. * @param contentType A string specifying the content type of the media content. */ - setStreamReference(stream: Windows.Storage.Streams.RandomAccessStreamReference, contentType: string): void; + setStreamReference(stream: Windows.Storage.Streams.IRandomAccessStreamReference, contentType: string): void; /** * Sets the URI of the media content to be bound to the MediaSource . * @param uri The URI of the media content to be bound. @@ -34156,7 +34156,7 @@ declare namespace Windows { * @param mediaSource The IMediaSource from which the MediaSource is created. * @return The new media source. */ - static createFromIMediaSource(mediaSource: Windows.Media.Core.MediaSource): Windows.Media.Core.MediaSource; + static createFromIMediaSource(mediaSource: Windows.Media.Core.IMediaSource): Windows.Media.Core.MediaSource; /** * Creates an instance of MediaSource from the provided MediaBinder . * @param binder The MediaBinder with which the MediaSource is associated. @@ -34180,21 +34180,21 @@ declare namespace Windows { * @param file The IStorageFile from which the MediaSource is created. * @return The new media source. */ - static createFromStorageFile(file: Windows.Storage.StorageFile): Windows.Media.Core.MediaSource; + static createFromStorageFile(file: Windows.Storage.IStorageFile): Windows.Media.Core.MediaSource; /** * Creates an instance of MediaSource from the provided IRandomAccessStream . * @param stream The stream from which the MediaSource is created. * @param contentType The MIME type of the contents of the stream. * @return The new media source. */ - static createFromStream(stream: Windows.Storage.Streams.RandomAccessStream, contentType: string): Windows.Media.Core.MediaSource; + static createFromStream(stream: Windows.Storage.Streams.IRandomAccessStream, contentType: string): Windows.Media.Core.MediaSource; /** * Creates an instance of MediaSource from the provided IRandomAccessStreamReference . * @param stream The stream reference from which the MediaSource is created. * @param contentType The MIME type of the contents of the stream. * @return The new media source. */ - static createFromStreamReference(stream: Windows.Storage.Streams.RandomAccessStreamReference, contentType: string): Windows.Media.Core.MediaSource; + static createFromStreamReference(stream: Windows.Storage.Streams.IRandomAccessStreamReference, contentType: string): Windows.Media.Core.MediaSource; /** * Creates an instance of MediaSource from the provided Uri . * @param uri The URI from which the MediaSource is created. @@ -34265,7 +34265,7 @@ declare namespace Windows { * @param timestamp The presentation time of this sample. * @return The sample created from the data in buffer. */ - static createFromBuffer(buffer: Windows.Storage.Streams.Buffer, timestamp: number): Windows.Media.Core.MediaStreamSample; + static createFromBuffer(buffer: Windows.Storage.Streams.IBuffer, timestamp: number): Windows.Media.Core.MediaStreamSample; /** * Asynchronously creates a MediaStreamSample from an IInputStream . * @param stream The stream that contains the media data used to create the MediaStreamSample . @@ -34438,7 +34438,7 @@ declare namespace Windows { */ setBufferedRange(startOffset: number, endOffset: number): void; /** Gets or sets the thumbnail which is a reference to a stream for a video thumbnail image or music album art. */ - thumbnail: Windows.Storage.Streams.RandomAccessStreamReference; + thumbnail: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets the video properties which are used for video related metadata. */ videoProperties: Windows.Storage.FileProperties.VideoProperties; addEventListener(type: string, listener: Windows.Foundation.EventHandler): void; @@ -34587,7 +34587,7 @@ declare namespace Windows { * Sets properties on the IMediaExtension . * @param configuration The property set. */ - setProperties(configuration: Windows.Foundation.Collections.PropertySet): void; + setProperties(configuration: Windows.Foundation.Collections.IPropertySet): void; addEventListener(type: string, listener: Windows.Foundation.EventHandler): void; removeEventListener(type: string, listener: Windows.Foundation.EventHandler): void; } @@ -34598,7 +34598,7 @@ declare namespace Windows { /** Gets a string containing the activatable class ID of the scene analysis effect definition. */ activatableClassId: string; /** Gets the set of properties for configuring the SceneAnalysisEffectDefinition object. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; } /** Represents a video frame that includes the results of the scene analysis operation. */ abstract class SceneAnalysisEffectFrame { @@ -34607,7 +34607,7 @@ declare namespace Windows { /** Gets or sets the duration of the scene analysis effect frame. */ duration: number; /** Gets the extended property set which enables getting and setting properties on the media frame. */ - extendedProperties: Windows.Foundation.Collections.PropertySet; + extendedProperties: Windows.Foundation.Collections.IPropertySet; /** Gets a CapturedFrameControlValues object that indicates the capture settings used for the frame. */ frameControlValues: Windows.Media.Capture.CapturedFrameControlValues; /** Gets a HighDynamicRangeOutput object that provides recommended FrameController objects and a value indicating the certainty of the HDR analysis. */ @@ -34810,14 +34810,14 @@ declare namespace Windows { * @param stream The stream from which the timed text source is created. * @return The new timed text source. */ - static createFromStream(stream: Windows.Storage.Streams.RandomAccessStream): Windows.Media.Core.TimedTextSource; + static createFromStream(stream: Windows.Storage.Streams.IRandomAccessStream): Windows.Media.Core.TimedTextSource; /** * Creates a new instance of TimedTextSource with the specified default language from the provided stream. * @param stream The stream from which the timed text source is created. * @param defaultLanguage A string specifying the default language for the timed text source. * @return The new timed text source. */ - static createFromStream(stream: Windows.Storage.Streams.RandomAccessStream, defaultLanguage: string): Windows.Media.Core.TimedTextSource; + static createFromStream(stream: Windows.Storage.Streams.IRandomAccessStream, defaultLanguage: string): Windows.Media.Core.TimedTextSource; /** * Creates a new instance of TimedTextSource from the provided URI. * @param uri The URI from which the timed text source is created. @@ -34942,7 +34942,7 @@ declare namespace Windows { * Sets properties on the IMediaExtension . * @param configuration The property set. */ - setProperties(configuration: Windows.Foundation.Collections.PropertySet): void; + setProperties(configuration: Windows.Foundation.Collections.IPropertySet): void; addEventListener(type: string, listener: Windows.Foundation.EventHandler): void; removeEventListener(type: string, listener: Windows.Foundation.EventHandler): void; } @@ -34953,7 +34953,7 @@ declare namespace Windows { /** Gets a string containing the activatable class ID of the video stabilization effect definition. */ activatableClassId: string; /** Gets the set of properties for configuring the VideoStabilizationEffectDefinition object. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; } /** Provides data for the VideoStabilizationEffect::EnabledChanged event. */ abstract class VideoStabilizationEffectEnabledChangedEventArgs { @@ -36370,7 +36370,7 @@ declare namespace Windows { /** Gets the remote device's ID. You can use this ID with the Windows.Devices.Enumeration APIs as well. */ id: string; /** Gets a stream containing the thumbnail image for the DIAL device. */ - thumbnail: Windows.Storage.Streams.RandomAccessStreamReference; + thumbnail: Windows.Storage.Streams.IRandomAccessStreamReference; } /** The possible statuses a DIAL device can have in the DIAL device picker. You can use these to adjust the sub-status and other visual attributes for a particular device in the picker. */ enum DialDeviceDisplayStatus { @@ -36473,9 +36473,9 @@ declare namespace Windows { * @param file A StorageFile object representing the source audio file. * @return A new background audio track object containing the contents of the audio file. */ - static createFromFileAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static createFromFileAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets the list of audio effect definitions for processing the background audio track. */ - audioEffectDefinitions: Windows.Foundation.Collections.IVector; + audioEffectDefinitions: Windows.Foundation.Collections.IVector; /** * Creates a BackgroundAudioTrack object that is identical to this instance. * @return A BackgroundAudioTrack object that is a copy of this instance. @@ -36523,14 +36523,14 @@ declare namespace Windows { * @param file A StorageFile object representing the source video file. * @return A new media clip object containing a video clip of the video file. */ - static createFromFileAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static createFromFileAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a video clip that displays a single image for a specified length of time. * @param file A StorageFile object representing the source image file. * @param originalDuration How long to display the image in the video clip. * @return A new media clip object containing the image-based video clip. */ - static createFromImageFileAsync(file: Windows.Storage.StorageFile, originalDuration: number): Windows.Foundation.IPromiseWithIAsyncOperation; + static createFromImageFileAsync(file: Windows.Storage.IStorageFile, originalDuration: number): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a video clip from a Direct3D surface. * @param surface The Direct3D surface. @@ -36539,7 +36539,7 @@ declare namespace Windows { */ static createFromSurface(surface: Windows.Graphics.DirectX.Direct3D11.IDirect3DSurface, originalDuration: number): Windows.Media.Editing.MediaClip; /** Gets the list of audio effect definitions for processing the media clip. */ - audioEffectDefinitions: Windows.Foundation.Collections.IVector; + audioEffectDefinitions: Windows.Foundation.Collections.IVector; /** * Creates a MediaClip object that is identical to this instance. * @return A MediaClip object that is a copy of this instance. @@ -36569,7 +36569,7 @@ declare namespace Windows { /** An associative collection for storing custom properties associated with the media clip. */ userData: Windows.Foundation.Collections.IMap; /** Gets the list of video effect definitions for processing the media clip. */ - videoEffectDefinitions: Windows.Foundation.Collections.IVector; + videoEffectDefinitions: Windows.Foundation.Collections.IVector; /** Gets or sets the volume of the media clip. */ volume: number; } @@ -36642,14 +36642,14 @@ declare namespace Windows { * @param destination The file to which this MediaComposition is rendered. * @return An async operation which can be used to track the success or failure of the operation. */ - renderToFileAsync(destination: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + renderToFileAsync(destination: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Asynchronously renders the MediaComposition to a specified file using the indicated media trimming preference. * @param destination The file to which this MediaComposition is rendered. * @param trimmingPreference Specifies whether to be fast or precise when trimming the media. * @return An async operation which can be used to track the success or failure of the operation. */ - renderToFileAsync(destination: Windows.Storage.StorageFile, trimmingPreference: Windows.Media.Editing.MediaTrimmingPreference): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + renderToFileAsync(destination: Windows.Storage.IStorageFile, trimmingPreference: Windows.Media.Editing.MediaTrimmingPreference): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Asynchronously renders the MediaComposition to a specified file using the indicated media trimming preference and encoding profile. * @param destination The file to which this MediaComposition is rendered. @@ -36657,13 +36657,13 @@ declare namespace Windows { * @param encodingProfile Specifies the encoding profile to use for rendering the media. * @return An async operation which can be used to track the success or failure of the operation. */ - renderToFileAsync(destination: Windows.Storage.StorageFile, trimmingPreference: Windows.Media.Editing.MediaTrimmingPreference, encodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + renderToFileAsync(destination: Windows.Storage.IStorageFile, trimmingPreference: Windows.Media.Editing.MediaTrimmingPreference, encodingProfile: Windows.Media.MediaProperties.MediaEncodingProfile): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Asynchronously serializes the MediaComposition to disk so that it can be loaded and modified in the future. * @param file The file to which the MediaComposition is saved. * @return An async action which can be used to track the success or failure of the operation. */ - saveAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncAction; + saveAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncAction; /** An associative collection for storing custom properties associated with the media composition. */ userData: Windows.Foundation.Collections.IMap; } @@ -36705,14 +36705,14 @@ declare namespace Windows { * Initializes a new instance of the MediaOverlayLayer class. * @param compositorDefinition The definition of the custom compositor associated with the media overlay layer. */ - constructor(compositorDefinition: Windows.Media.Effects.VideoCompositorDefinition); + constructor(compositorDefinition: Windows.Media.Effects.IVideoCompositorDefinition); /** * Creates a MediaOverlayLayer object that is identical to this instance. * @return A MediaOverlayLayer object that is a copy of this instance. */ clone(): Windows.Media.Editing.MediaOverlayLayer; /** Gets the definition of the custom compositor associated with the media overlay layer, if there is one. */ - customCompositorDefinition: Windows.Media.Effects.VideoCompositorDefinition; + customCompositorDefinition: Windows.Media.Effects.IVideoCompositorDefinition; /** Gets the list of overlays for this media overlay layer. */ overlays: Windows.Foundation.Collections.IVector; } @@ -36759,7 +36759,7 @@ declare namespace Windows { * @param activatableClassId The activatable class ID of the audio effect definition. * @param props Configuration properties for the specified audio effect definition. */ - constructor(activatableClassId: string, props: Windows.Foundation.Collections.PropertySet); + constructor(activatableClassId: string, props: Windows.Foundation.Collections.IPropertySet); /** * Creates a new AudioEffectDefinition object with the specified activatable class ID. * @param activatableClassId The activatable class ID of the audio effect definition. @@ -36768,7 +36768,7 @@ declare namespace Windows { /** The activatable class ID of the audio effect definition. */ activatableClassId: string; /** The set of properties for configuring an AudioEffectDefinition object. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; } /** Defines values for audio effect types. */ enum AudioEffectType { @@ -36918,7 +36918,7 @@ declare namespace Windows { * @param activatableClassId The activatable class ID of the video compositor. * @param props The set of properties for configuring the video compositor object. */ - constructor(activatableClassId: string, props: Windows.Foundation.Collections.PropertySet); + constructor(activatableClassId: string, props: Windows.Foundation.Collections.IPropertySet); /** * Initializes a new instance of the VideoCompositorDefinition class. * @param activatableClassId The activatable class ID of the video compositor. @@ -36927,7 +36927,7 @@ declare namespace Windows { /** Gets the activatable class ID of the video compositor. */ activatableClassId: string; /** Gets the set of properties for configuring the video compositor object. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; } /** Represents a video effect definition. */ class VideoEffectDefinition { @@ -36936,7 +36936,7 @@ declare namespace Windows { * @param activatableClassId The activatable class ID of the video effect definition. * @param props Configuration properties for the specified video effect definition. */ - constructor(activatableClassId: string, props: Windows.Foundation.Collections.PropertySet); + constructor(activatableClassId: string, props: Windows.Foundation.Collections.IPropertySet); /** * Creates a new VideoEffectDefinition object with the specified activatable class ID. * @param activatableClassId The activatable class ID of the video effect definition. @@ -36945,7 +36945,7 @@ declare namespace Windows { /** Gets the activatable class ID of the video effect definition. */ activatableClassId: string; /** Gets the set of properties for configuring the VideoEffectDefinition object. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; } /** Represents the definition of a video transform effect. */ class VideoTransformEffectDefinition { @@ -36964,7 +36964,7 @@ declare namespace Windows { /** Gets or sets the media processing algorithm that is used for the video transform. */ processingAlgorithm: Windows.Media.Transcoding.MediaVideoProcessingAlgorithm; /** Gets the set of properties for configuring the VideoTransformEffectDefinition object. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; /** Gets or sets the angle and direction in which the video will be rotated. */ rotation: Windows.Media.MediaProperties.MediaRotation; } @@ -36973,21 +36973,21 @@ declare namespace Windows { /** The activatable class ID of the audio effect definition. */ activatableClassId: string; /** The set of properties for configuring an AudioEffectDefinition object. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; } /** Exposes the methods and properties of a VideoEffectDefinition object. Implement this interface when you create a custom video effect definition. */ interface IVideoEffectDefinition { /** The activatable class ID of the video effect definition. */ activatableClassId: string; /** The set of properties for configuring the VideoEffectDefinition object. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; } /** The interface defining a custom video compositor definition. */ interface IVideoCompositorDefinition { /** Gets the activatable class ID of the video compositor. */ activatableClassId: string; /** Gets the set of properties for configuring the video compositor object. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; } } /** Provides APIs for face detection in bitmaps or video frames. */ @@ -37291,7 +37291,7 @@ declare namespace Windows { /** Gets the size of the item, in bytes. */ sizeInBytes: number; /** Gets a random access stream containing the thumbnail image associated with the item. */ - thumbnail: Windows.Storage.Streams.RandomAccessStreamReference; + thumbnail: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets the list of video segments associated with the item. */ videoSegments: Windows.Foundation.Collections.IVectorView; } @@ -37363,7 +37363,7 @@ declare namespace Windows { /** Gets or sets the prefix for the destination file name. */ destinationFileNamePrefix: string; /** Gets or sets the destination folder for the photo import session. */ - destinationFolder: Windows.Storage.StorageFolder; + destinationFolder: Windows.Storage.IStorageFolder; /** * Asynchronously finds items on the source device that are available for import. * @param contentTypeFilter A value indicating whether the find operation includes images, videos, or both in the results. @@ -37394,7 +37394,7 @@ declare namespace Windows { * @param sourceRootFolder The root folder from which the photo import source is created. * @return An asynchronous operation that returns a PhotoImportSource upon successful completion. */ - static fromFolderAsync(sourceRootFolder: Windows.Storage.StorageFolder): Windows.Foundation.IPromiseWithIAsyncOperation; + static fromFolderAsync(sourceRootFolder: Windows.Storage.IStorageFolder): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a new instance of PhotoImportSource from the specified device ID. * @param sourceId The root folder from which the photo import source is created. @@ -37435,7 +37435,7 @@ declare namespace Windows { /** Gets a list of objects representing the different storage media exposed by the source device. */ storageMedia: Windows.Foundation.Collections.IVectorView; /** Gets a reference to a stream containing the thumbnail image for the source device. */ - thumbnail: Windows.Storage.Streams.RandomAccessStreamReference; + thumbnail: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets a value indicating the type of the source device. */ type: Windows.Media.Import.PhotoImportSourceType; } @@ -37614,7 +37614,7 @@ declare namespace Windows { * @param outputSubtype The guid identifier of the media type that is output by the audio decoder. * @param configuration An optional parameter that contains the configuration properties to be passed to the audio decoder. */ - registerAudioDecoder(activatableClassId: string, inputSubtype: string, outputSubtype: string, configuration: Windows.Foundation.Collections.PropertySet): void; + registerAudioDecoder(activatableClassId: string, inputSubtype: string, outputSubtype: string, configuration: Windows.Foundation.Collections.IPropertySet): void; /** * Registers an audio encoder for the specified input and output media types with an optional configuration parameter. * @param activatableClassId The class identifier of the activatable runtime class of the audio encoder. The runtime class must implement the IMediaExtension interface. @@ -37622,7 +37622,7 @@ declare namespace Windows { * @param outputSubtype The guid identifier of the media type that is output by the audio encoder. * @param configuration An optional parameter that contains the configuration properties to be passed to the audio encoder. */ - registerAudioEncoder(activatableClassId: string, inputSubtype: string, outputSubtype: string, configuration: Windows.Foundation.Collections.PropertySet): void; + registerAudioEncoder(activatableClassId: string, inputSubtype: string, outputSubtype: string, configuration: Windows.Foundation.Collections.IPropertySet): void; /** * Registers an audio encoder for the specified input and output media types. * @param activatableClassId The class identifier of the activatable runtime class of the audio encoder. The runtime class must implement the IMediaExtension interface. @@ -37644,14 +37644,14 @@ declare namespace Windows { * @param mimeType The MIME type that is registered for this byte-stream handler. * @param configuration An optional parameter that contains configuration properties for the byte-stream handler. */ - registerByteStreamHandler(activatableClassId: string, fileExtension: string, mimeType: string, configuration: Windows.Foundation.Collections.PropertySet): void; + registerByteStreamHandler(activatableClassId: string, fileExtension: string, mimeType: string, configuration: Windows.Foundation.Collections.IPropertySet): void; /** * Registers a scheme handler for the specified URL scheme with an optional configuration parameter. * @param activatableClassId The class identifier of the activatable runtime class of the scheme handler. The runtime class must implement the IMediaExtension interface. * @param scheme The URL scheme that will be recognized to invoke the scheme handler. For example, "myscheme://". * @param configuration An optional parameter that contains configuration properties for the scheme handler. */ - registerSchemeHandler(activatableClassId: string, scheme: string, configuration: Windows.Foundation.Collections.PropertySet): void; + registerSchemeHandler(activatableClassId: string, scheme: string, configuration: Windows.Foundation.Collections.IPropertySet): void; /** * Registers a scheme handler for the specified URL scheme. * @param activatableClassId The class identifier of the activatable runtime class of the scheme handler. The runtime class must implement the IMediaExtension interface. @@ -37672,7 +37672,7 @@ declare namespace Windows { * @param outputSubtype The guid identifier of the media type that is output by the video decoder. * @param configuration An optional parameter that contains the configuration properties to be passed to the video decoder. */ - registerVideoDecoder(activatableClassId: string, inputSubtype: string, outputSubtype: string, configuration: Windows.Foundation.Collections.PropertySet): void; + registerVideoDecoder(activatableClassId: string, inputSubtype: string, outputSubtype: string, configuration: Windows.Foundation.Collections.IPropertySet): void; /** * Registers a video encoder for the specified input and output media types. * @param activatableClassId The class identifier of the activatable runtime class of the video encoder. The runtime class must implement the IMediaExtension interface. @@ -37687,7 +37687,7 @@ declare namespace Windows { * @param outputSubtype The guid identifier of the media type that is output by the video encoder. * @param configuration An optional parameter that contains the configuration properties to be passed to the video encoder. */ - registerVideoEncoder(activatableClassId: string, inputSubtype: string, outputSubtype: string, configuration: Windows.Foundation.Collections.PropertySet): void; + registerVideoEncoder(activatableClassId: string, inputSubtype: string, outputSubtype: string, configuration: Windows.Foundation.Collections.IPropertySet): void; } /** Provides a static list of media marker types. */ abstract class MediaMarkerTypes { @@ -37902,13 +37902,13 @@ declare namespace Windows { * @param file The media file from which to create the profile. * @return An object that is used to control the asynchronous operation. */ - static createFromFileAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static createFromFileAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates an encoding profile from a stream that contains media data. * @param stream The media stream from which to create the profile. * @return An object that is used to control the asynchronous operation. */ - static createFromStreamAsync(stream: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; + static createFromStreamAsync(stream: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates an encoding profile for AAC audio. * @param quality Specifies whether to create a profile with a low bit rate, medium bit rate, or high bit rate. @@ -38469,7 +38469,7 @@ declare namespace Windows { addEventListener(type: "volumechangerequested", listener: Windows.Foundation.TypedEventHandler): void; removeEventListener(type: "volumechangerequested", listener: Windows.Foundation.TypedEventHandler): void; /** Gets a set of custom properties for the Play To receiver. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; /** * Start receiving Play To commands. * @return An asynchronous handler that's called when the start operation is complete. @@ -38567,7 +38567,7 @@ declare namespace Windows { /** Gets the media stream for the Play To receiver. */ stream: Windows.Storage.Streams.IRandomAccessStreamWithContentType; /** Gets the thumbnail image for the content in the media stream. */ - thumbnail: Windows.Storage.Streams.RandomAccessStreamReference; + thumbnail: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets the title of the content in the media stream. */ title: string; } @@ -38871,7 +38871,7 @@ declare namespace Windows { * @param effectOptional A value indicating whether the effect is optional. * @param configuration A property set containing configuration settings for the specified audio effect. */ - addAudioEffect(activatableClassId: string, effectOptional: boolean, configuration: Windows.Foundation.Collections.PropertySet): void; + addAudioEffect(activatableClassId: string, effectOptional: boolean, configuration: Windows.Foundation.Collections.IPropertySet): void; /** Gets or sets the type of audio that is currently being played. */ audioCategory: Windows.Media.Playback.MediaPlayerAudioCategory; /** Gets or sets a value that describes the primary usage of the device that is being used to play back audio. */ @@ -38952,17 +38952,17 @@ declare namespace Windows { * Set the media source to a file. * @param file The media source file. */ - setFileSource(file: Windows.Storage.StorageFile): void; + setFileSource(file: Windows.Storage.IStorageFile): void; /** * Sets the media source for playback. * @param source The media source for playback. */ - setMediaSource(source: Windows.Media.Core.MediaSource): void; + setMediaSource(source: Windows.Media.Core.IMediaSource): void; /** * Sets the media source to a stream. * @param stream The media source stream. */ - setStreamSource(stream: Windows.Storage.Streams.RandomAccessStream): void; + setStreamSource(stream: Windows.Storage.Streams.IRandomAccessStream): void; /** * Sets the path to the media. * @param value The path to the media. @@ -39145,7 +39145,7 @@ declare namespace Windows { * @param file Represents the files to load. * @return Represents the asynchronous operation for loading the playlist. The GetResults method of this IAsyncOperation object returns the playlist. */ - static loadAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static loadAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** Creates a new instance of a Playlist object. */ constructor(); /** The set of media files that make up the playlist. */ @@ -39158,7 +39158,7 @@ declare namespace Windows { * @param playlistFormat The playlist format. One of the values of the PlaylistFormat enumeration. * @return Represents the asynchronous operation to save the playlist to a specified file and folder. */ - saveAsAsync(saveLocation: Windows.Storage.StorageFolder, desiredName: string, option: Windows.Storage.NameCollisionOption, playlistFormat: Windows.Media.Playlists.PlaylistFormat): Windows.Foundation.IPromiseWithIAsyncOperation; + saveAsAsync(saveLocation: Windows.Storage.IStorageFolder, desiredName: string, option: Windows.Storage.NameCollisionOption, playlistFormat: Windows.Media.Playlists.PlaylistFormat): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Asynchronously saves the playlist to a specified file and folder. * @param saveLocation The folder in which to save the playlist. @@ -39166,7 +39166,7 @@ declare namespace Windows { * @param option The action to take if the playlist is saved to an existing file. One of the values of the NameCollisionOption enumeration. * @return Represents the asynchronous operation to save the playlist to a specified file and folder. */ - saveAsAsync(saveLocation: Windows.Storage.StorageFolder, desiredName: string, option: Windows.Storage.NameCollisionOption): Windows.Foundation.IPromiseWithIAsyncOperation; + saveAsAsync(saveLocation: Windows.Storage.IStorageFolder, desiredName: string, option: Windows.Storage.NameCollisionOption): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Asynchronously saves the playlist. * @return Represents the asynchronous action to save the playlist. @@ -39218,7 +39218,7 @@ declare namespace Windows { addEventListener(type: "servicerequested", listener: Windows.Media.Protection.ServiceRequestedEventHandler): void; removeEventListener(type: "servicerequested", listener: Windows.Media.Protection.ServiceRequestedEventHandler): void; /** Gets a PropertySet object containing any properties attached to the protection manager. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; addEventListener(type: string, listener: Windows.Foundation.EventHandler): void; removeEventListener(type: string, listener: Windows.Foundation.EventHandler): void; } @@ -39228,9 +39228,9 @@ declare namespace Windows { * Initializes a new instance of the MediaProtectionPMPServer class with the specified properties. * @param pProperties The set of properties used to initialize the server. */ - constructor(pProperties: Windows.Foundation.Collections.PropertySet); + constructor(pProperties: Windows.Foundation.Collections.IPropertySet); /** Gets the property set for the MediaProtectionPMPServer . */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; } /** Contains a method that indicates whether a protection service has completed successfully. */ abstract class MediaProtectionServiceCompletion { @@ -39331,7 +39331,7 @@ declare namespace Windows { * @param licenseFetchDescriptor Descriptor for the license being fetched. * @return The result of the asynchronous license fetch call. */ - licenseFetchAsync(licenseFetchDescriptor: Windows.Media.Protection.PlayReady.NDLicenseFetchDescriptor): Windows.Foundation.IPromiseWithIAsyncOperation; + licenseFetchAsync(licenseFetchDescriptor: Windows.Media.Protection.PlayReady.INDLicenseFetchDescriptor): Windows.Foundation.IPromiseWithIAsyncOperation; /** Notifies listeners that a closed caption acquisition operation has completed. */ onclosedcaptiondatareceived: Windows.Foundation.TypedEventHandler; addEventListener(type: "closedcaptiondatareceived", listener: Windows.Foundation.TypedEventHandler): void; @@ -39357,7 +39357,7 @@ declare namespace Windows { * @param registrationCustomData Custom data for the registration request. * @return The result of the asynchronous reregistration call. */ - reRegistrationAsync(registrationCustomData: Windows.Media.Protection.PlayReady.NDCustomData): Windows.Foundation.IPromiseWithIAsyncAction; + reRegistrationAsync(registrationCustomData: Windows.Media.Protection.PlayReady.INDCustomData): Windows.Foundation.IPromiseWithIAsyncAction; /** * Starts the registration, proximity detection, and license fetch procedures between a client receiver and a transmitter. * @param contentUrl The URL of the streamed content. @@ -39366,7 +39366,7 @@ declare namespace Windows { * @param licenseFetchDescriptor The descriptor used for license fetching. * @return The result of the asynchronous start call. */ - startAsync(contentUrl: Windows.Foundation.Uri, startAsyncOptions: number, registrationCustomData: Windows.Media.Protection.PlayReady.NDCustomData, licenseFetchDescriptor: Windows.Media.Protection.PlayReady.NDLicenseFetchDescriptor): Windows.Foundation.IPromiseWithIAsyncOperation; + startAsync(contentUrl: Windows.Foundation.Uri, startAsyncOptions: number, registrationCustomData: Windows.Media.Protection.PlayReady.INDCustomData, licenseFetchDescriptor: Windows.Media.Protection.PlayReady.INDLicenseFetchDescriptor): Windows.Foundation.IPromiseWithIAsyncOperation; addEventListener(type: string, listener: Windows.Foundation.EventHandler): void; removeEventListener(type: string, listener: Windows.Foundation.EventHandler): void; } @@ -39409,7 +39409,7 @@ declare namespace Windows { * Called by the download engine when a content identifier is received. * @param licenseFetchDescriptor The license from which the download engine receives the content identifier. */ - onContentIDReceived(licenseFetchDescriptor: Windows.Media.Protection.PlayReady.NDLicenseFetchDescriptor): void; + onContentIDReceived(licenseFetchDescriptor: Windows.Media.Protection.PlayReady.INDLicenseFetchDescriptor): void; /** * Called by the download engine when it receives data. * @param dataBytes The byte array that holds the data. @@ -39436,13 +39436,13 @@ declare namespace Windows { * @param contentIDBytes The content identifier. * @param licenseFetchChallengeCustomData The license fetch challenge custom data. */ - constructor(contentIDType: Windows.Media.Protection.PlayReady.NDContentIDType, contentIDBytes: number[], licenseFetchChallengeCustomData: Windows.Media.Protection.PlayReady.NDCustomData); + constructor(contentIDType: Windows.Media.Protection.PlayReady.NDContentIDType, contentIDBytes: number[], licenseFetchChallengeCustomData: Windows.Media.Protection.PlayReady.INDCustomData); /** Gets the content identifer. */ contentID: number; /** Gets the type of the content identifier. */ contentIDType: Windows.Media.Protection.PlayReady.NDContentIDType; /** Gets or sets custom data for a license fetch challenge. */ - licenseFetchChallengeCustomData: Windows.Media.Protection.PlayReady.NDCustomData; + licenseFetchChallengeCustomData: Windows.Media.Protection.PlayReady.INDCustomData; } /** Indicates the type of a protected media stream. */ enum NDMediaStreamType { @@ -39476,7 +39476,7 @@ declare namespace Windows { * @param file A storage file object that a media server has discovered. * @return The transmitter settings found in the storage file. */ - getFileURLs(file: Windows.Storage.StorageFile): Windows.Foundation.Collections.IVector; + getFileURLs(file: Windows.Storage.IStorageFile): Windows.Foundation.Collections.IVector; } /** Contains methods that a stream parser plug-in uses to send notifications to a PlayReady-ND client. */ class NDStreamParserNotifier { @@ -39493,7 +39493,7 @@ declare namespace Windows { * Called by a stream parser when it receives the content identifier. * @param licenseFetchDescriptor The license fetch descriptor containing the content identifier. */ - onContentIDReceived(licenseFetchDescriptor: Windows.Media.Protection.PlayReady.NDLicenseFetchDescriptor): void; + onContentIDReceived(licenseFetchDescriptor: Windows.Media.Protection.PlayReady.INDLicenseFetchDescriptor): void; /** * Called by the stream parser when the media stream descriptor is created. * @param audioStreamDescriptors An array of audio stream descriptors that are part of the media stream descriptor. @@ -39659,17 +39659,17 @@ declare namespace Windows { * Returns an iterator that iterates over the items in the PlayReady domain collection. * @return The PlayReady domain iterator. */ - first(): Windows.Foundation.Collections.IIterator; + first(): Windows.Foundation.Collections.IIterator; } /** Provides for iteration of the PlayReadyDomain class. */ abstract class PlayReadyDomainIterator { /** Gets the current item in the PlayReady domain collection. */ - current: Windows.Media.Protection.PlayReady.PlayReadyDomain; + current: Windows.Media.Protection.PlayReady.IPlayReadyDomain; /** * Retrieves all items in the PlayReady domain collection. * @return */ - getMany(): { /** The items in the collection. */ items: Windows.Media.Protection.PlayReady.PlayReadyDomain; /** The number of items in the collection. */ returnValue: number; }; + getMany(): { /** The items in the collection. */ items: Windows.Media.Protection.PlayReady.IPlayReadyDomain; /** The number of items in the collection. */ returnValue: number; }; /** Gets a value that indicates whether there is a current item or the iterator is at the end of the PlayReady domain collection. */ hasCurrent: boolean; /** @@ -39797,7 +39797,7 @@ declare namespace Windows { * @param format The format for the ITA serialized data. * @return The serialized blob. See Remarks. */ - generateData(guidCPSystemId: string, countOfStreams: number, configuration: Windows.Foundation.Collections.PropertySet, format: Windows.Media.Protection.PlayReady.PlayReadyITADataFormat): number[]; + generateData(guidCPSystemId: string, countOfStreams: number, configuration: Windows.Foundation.Collections.IPropertySet, format: Windows.Media.Protection.PlayReady.PlayReadyITADataFormat): number[]; } /** Provides the service methods for requesting platform individualization. */ class PlayReadyIndividualizationServiceRequest { @@ -39910,17 +39910,17 @@ declare namespace Windows { * Returns an iterator that iterates over the items in the PlayReady license collection. * @return The PlayReady license iterator. */ - first(): Windows.Foundation.Collections.IIterator; + first(): Windows.Foundation.Collections.IIterator; } /** Provides for iteration of the PlayReadyLicense class. */ abstract class PlayReadyLicenseIterator { /** Gets the current item in the PlayReady license collection. */ - current: Windows.Media.Protection.PlayReady.PlayReadyLicense; + current: Windows.Media.Protection.PlayReady.IPlayReadyLicense; /** * Retrieves all items in the PlayReady license collection. * @return */ - getMany(): { /** The items in the collection. */ items: Windows.Media.Protection.PlayReady.PlayReadyLicense; /** The number of items in the collection. */ returnValue: number; }; + getMany(): { /** The items in the collection. */ items: Windows.Media.Protection.PlayReady.IPlayReadyLicense; /** The number of items in the collection. */ returnValue: number; }; /** Gets a value that indicates whether there is a current item or the iterator is at the end of the PlayReady license collection. */ hasCurrent: boolean; /** @@ -39944,7 +39944,7 @@ declare namespace Windows { * Initializes a new instance of the PlayReadyLicenseSession class. * @param configuration The configuration data for the license session. */ - constructor(configuration: Windows.Foundation.Collections.PropertySet); + constructor(configuration: Windows.Foundation.Collections.IPropertySet); /** * Updates the media protection manger with the appropriate settings so the media foundation can be used for playback. * @param mpm The media protection manager to be updated. @@ -39954,7 +39954,7 @@ declare namespace Windows { * Creates a license acquisition service request whose license will be tied to the media session. * @return The license acquisition service request. */ - createLAServiceRequest(): Windows.Media.Protection.PlayReady.PlayReadyLicenseAcquisitionServiceRequest; + createLAServiceRequest(): Windows.Media.Protection.PlayReady.IPlayReadyLicenseAcquisitionServiceRequest; } /** Provides the service methods for content metering operations. */ class PlayReadyMeteringReportServiceRequest { @@ -40041,17 +40041,17 @@ declare namespace Windows { * Returns an iterator that iterates over the items in the PlayReady secure stop collection. * @return The PlayReady secure stop iterator. */ - first(): Windows.Foundation.Collections.IIterator; + first(): Windows.Foundation.Collections.IIterator; } /** Provides for iteration of the IPlayReadySecureStopServiceRequest interface. */ abstract class PlayReadySecureStopIterator { /** Gets the current item in the PlayReady secure stop collection. */ - current: Windows.Media.Protection.PlayReady.PlayReadySecureStopServiceRequest; + current: Windows.Media.Protection.PlayReady.IPlayReadySecureStopServiceRequest; /** * Retrieves all items in the PlayReady secure stop collection. * @return */ - getMany(): { /** The items in the collection. */ items: Windows.Media.Protection.PlayReady.PlayReadySecureStopServiceRequest; /** The number of items in the collection. */ returnValue: number; }; + getMany(): { /** The items in the collection. */ items: Windows.Media.Protection.PlayReady.IPlayReadySecureStopServiceRequest; /** The number of items in the collection. */ returnValue: number; }; /** Gets a value that indicates whether there is a current item or the iterator is at the end of the PlayReady secure stop collection. */ hasCurrent: boolean; /** @@ -40123,7 +40123,7 @@ declare namespace Windows { */ getMessageBody(): number[]; /** Gets a collection of the SOAP headers applied to the current SOAP request or SOAP response. */ - messageHeaders: Windows.Foundation.Collections.PropertySet; + messageHeaders: Windows.Foundation.Collections.IPropertySet; /** Gets the base URL of the XML Web service. */ uri: Windows.Foundation.Uri; } @@ -40163,12 +40163,12 @@ declare namespace Windows { /** Gets the type of the content identifier used for fetching a license. */ contentIDType: Windows.Media.Protection.PlayReady.NDContentIDType; /** Gets or sets custom data for a license fetch challenge. */ - licenseFetchChallengeCustomData: Windows.Media.Protection.PlayReady.NDCustomData; + licenseFetchChallengeCustomData: Windows.Media.Protection.PlayReady.INDCustomData; } /** Provides the result of the PlayReady-ND license fetch. */ interface INDLicenseFetchResult { /** Gets the custom data from a license fetch response. */ - responseCustomData: Windows.Media.Protection.PlayReady.NDCustomData; + responseCustomData: Windows.Media.Protection.PlayReady.INDCustomData; } /** Specifies arguments for a PlayReady-ND ClosedCaptionDataReceived event. */ interface INDClosedCaptionDataReceivedEventArgs { @@ -40182,7 +40182,7 @@ declare namespace Windows { /** Gets custom data from a PlayReady-ND license fetch operation. This custom data is an argument from a PlayReady-ND LicenseFetchCompleted event. */ interface INDLicenseFetchCompletedEventArgs { /** Gets custom data from a license fetch response. */ - responseCustomData: Windows.Media.Protection.PlayReady.NDCustomData; + responseCustomData: Windows.Media.Protection.PlayReady.INDCustomData; } /** Provides arguments for the PlayReady-ND ProximityDetectionCompleted event. Apps fire this event after they complete the proximity detection process. */ interface INDProximityDetectionCompletedEventArgs { @@ -40192,7 +40192,7 @@ declare namespace Windows { /** Provides arguments for the PlayReady-ND RegistrationCompleted event. */ interface INDRegistrationCompletedEventArgs { /** Gets custom data from a registration response. */ - responseCustomData: Windows.Media.Protection.PlayReady.NDCustomData; + responseCustomData: Windows.Media.Protection.PlayReady.INDCustomData; /** Gets or sets whether to accept or reject a transmitter's certificate. */ transmitterCertificateAccepted: boolean; /** Gets transmitter properties from the transmitter's certificate to verify the transmitter. */ @@ -40960,7 +40960,7 @@ declare namespace Windows { * Creates a copy of SpeechSynthesisStream that references the same bytes as the original stream. * @return The new stream. */ - cloneStream(): Windows.Storage.Streams.RandomAccessStream; + cloneStream(): Windows.Storage.Streams.IRandomAccessStream; /** Releases system resources that are exposed by SpeechSynthesisStream . */ close(): void; /** Gets the MIME type of the content of SpeechSynthesisStream . */ @@ -40993,7 +40993,7 @@ declare namespace Windows { * @param options Specifies the type of the asynchronous read operation. * @return An asynchronous operation that includes progress updates. For more information, see ReadAsync method. */ - readAsync(buffer: Windows.Storage.Streams.Buffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsync(buffer: Windows.Storage.Streams.IBuffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Goes to the specified position within SpeechSynthesisStream . * @param position The desired position within the stream. @@ -41006,7 +41006,7 @@ declare namespace Windows { * @param buffer The buffer into which the asynchronous writer operation places the bytes to write. * @return An asynchronous operation that includes progress updates. For more information, see WriteAsync method. */ - writeAsync(buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + writeAsync(buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } /** Provides access to the functionality of an installed speech synthesis engine (voice). */ class SpeechSynthesizer { @@ -41231,7 +41231,7 @@ declare namespace Windows { /** Represents the results of a resource download operation. */ abstract class AdaptiveMediaSourceDownloadResult { /** Gets or sets a buffer containing the downloaded resource. */ - buffer: Windows.Storage.Streams.Buffer; + buffer: Windows.Storage.Streams.IBuffer; /** Gets or sets a string that identifies the MIME content type of the downloaded resource. */ contentType: string; /** Gets or sets an integer value that represents extended status information about the resource download operation. */ @@ -41429,7 +41429,7 @@ declare namespace Windows { * @param effectRequired Indicates whether the audio effect is required. * @param configuration Configuration properties for the audio effect. */ - addAudioEffect(activatableClassId: string, effectRequired: boolean, configuration: Windows.Foundation.Collections.PropertySet): void; + addAudioEffect(activatableClassId: string, effectRequired: boolean, configuration: Windows.Foundation.Collections.IPropertySet): void; /** * Adds the specified audio effect. * @param activatableClassId The identifier of the audio effect. @@ -41446,7 +41446,7 @@ declare namespace Windows { * @param effectRequired Indicates whether the video effect is required. * @param configuration Configuration properties for the video effect. */ - addVideoEffect(activatableClassId: string, effectRequired: boolean, configuration: Windows.Foundation.Collections.PropertySet): void; + addVideoEffect(activatableClassId: string, effectRequired: boolean, configuration: Windows.Foundation.Collections.IPropertySet): void; /** Specifies whether the media transcoder always re-encodes the source. */ alwaysReencode: boolean; /** Removes all audio and video effects from the transcode session. */ @@ -41460,7 +41460,7 @@ declare namespace Windows { * @param profile The profile to use for the operation. * @return When this method completes, a PrepareTranscodeResult object is returned which can be used to start the transcode. */ - prepareFileTranscodeAsync(source: Windows.Storage.StorageFile, destination: Windows.Storage.StorageFile, profile: Windows.Media.MediaProperties.MediaEncodingProfile): Windows.Foundation.IPromiseWithIAsyncOperation; + prepareFileTranscodeAsync(source: Windows.Storage.IStorageFile, destination: Windows.Storage.IStorageFile, profile: Windows.Media.MediaProperties.MediaEncodingProfile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Asynchronously initializes the trancode operation on the specified media source and returns a PrepareTranscodeResult object which can be used to start the transcode operation. * @param source The media source to perform the transcode operation on. @@ -41468,7 +41468,7 @@ declare namespace Windows { * @param profile The profile to use for the operation. * @return When this method completes, a PrepareTranscodeResult object is returned which can be used to start the transcode. */ - prepareMediaStreamSourceTranscodeAsync(source: Windows.Media.Core.MediaSource, destination: Windows.Storage.Streams.RandomAccessStream, profile: Windows.Media.MediaProperties.MediaEncodingProfile): Windows.Foundation.IPromiseWithIAsyncOperation; + prepareMediaStreamSourceTranscodeAsync(source: Windows.Media.Core.IMediaSource, destination: Windows.Storage.Streams.IRandomAccessStream, profile: Windows.Media.MediaProperties.MediaEncodingProfile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Asynchronously initializes the trancode operation on the specified stream and returns a PrepareTranscodeResult object which can be used to start the transcode operation. * @param source The source stream. @@ -41476,7 +41476,7 @@ declare namespace Windows { * @param profile The profile to use for the operation. * @return When this method completes, a PrepareTranscodeResult object is returned which can be used to start the transcode. */ - prepareStreamTranscodeAsync(source: Windows.Storage.Streams.RandomAccessStream, destination: Windows.Storage.Streams.RandomAccessStream, profile: Windows.Media.MediaProperties.MediaEncodingProfile): Windows.Foundation.IPromiseWithIAsyncOperation; + prepareStreamTranscodeAsync(source: Windows.Storage.Streams.IRandomAccessStream, destination: Windows.Storage.Streams.IRandomAccessStream, profile: Windows.Media.MediaProperties.MediaEncodingProfile): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets or sets the time interval to trim from the start of the output. */ trimStartTime: number; /** Gets or sets the time interval to trim from the end of the output. */ @@ -41559,7 +41559,7 @@ declare namespace Windows { /** Gets or sets the duration of the video frame. */ duration: number; /** Gets the extended property set which enables getting and setting properties on the media frame. */ - extendedProperties: Windows.Foundation.Collections.PropertySet; + extendedProperties: Windows.Foundation.Collections.IPropertySet; /** Gets or sets a value that indicates whether an video frame is the first frame after a gap in the stream. */ isDiscontinuous: boolean; /** Gets a value indicating whether the video frame is read-only. */ @@ -41579,7 +41579,7 @@ declare namespace Windows { * Sets the configuration properties that were supplied when the media parser or codec was registered. * @param configuration The configuration properties for the media parser or codec. */ - setProperties(configuration: Windows.Foundation.Collections.PropertySet): void; + setProperties(configuration: Windows.Foundation.Collections.IPropertySet): void; } /** Represents a marker at specific location in a media stream time-line. */ interface IMediaMarker { @@ -41637,7 +41637,7 @@ declare namespace Windows { * @param resultFile The file that the response will be written to. * @return The resultant download operation. */ - createDownload(uri: Windows.Foundation.Uri, resultFile: Windows.Storage.StorageFile): Windows.Networking.BackgroundTransfer.DownloadOperation; + createDownload(uri: Windows.Foundation.Uri, resultFile: Windows.Storage.IStorageFile): Windows.Networking.BackgroundTransfer.DownloadOperation; /** * Initializes a DownloadOperation object with the resource Uri , the file that the response is written to, and the request entity body. * @param uri The location of the resource. @@ -41645,7 +41645,7 @@ declare namespace Windows { * @param requestBodyFile A file that represents the request entity body, which contains additional data the server requires before the download can begin. The file this object points to must be valid for the duration of the download. * @return The resultant download operation. */ - createDownload(uri: Windows.Foundation.Uri, resultFile: Windows.Storage.StorageFile, requestBodyFile: Windows.Storage.StorageFile): Windows.Networking.BackgroundTransfer.DownloadOperation; + createDownload(uri: Windows.Foundation.Uri, resultFile: Windows.Storage.IStorageFile, requestBodyFile: Windows.Storage.IStorageFile): Windows.Networking.BackgroundTransfer.DownloadOperation; /** * Creates an asynchronous download operation that includes a URI, the file that the response will be written to, and the IInputStream object from which the file contents are read. * @param uri The location of the resource. @@ -41653,7 +41653,7 @@ declare namespace Windows { * @param requestBodyStream A stream that represents the request entity body. * @return The resultant asynchronous download operation. */ - createDownloadAsync(uri: Windows.Foundation.Uri, resultFile: Windows.Storage.StorageFile, requestBodyStream: Windows.Storage.Streams.IInputStream): Windows.Foundation.IPromiseWithIAsyncOperation; + createDownloadAsync(uri: Windows.Foundation.Uri, resultFile: Windows.Storage.IStorageFile, requestBodyStream: Windows.Storage.Streams.IInputStream): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets or sets the TileNotification used to define the visuals, identification tag, and expiration time of a tile notification used to update the app tile when indicating failure of a download to the user. */ failureTileNotification: Windows.UI.Notifications.TileNotification; /** Gets or sets the ToastNotification that defines the content, associated metadata, and events used in a toast notification to indicate failure of a download to the user. */ @@ -41723,7 +41723,7 @@ declare namespace Windows { * Sets the source file for a BackgroundTransferContentPart containing the file for upload. * @param value The source file. */ - setFile(value: Windows.Storage.StorageFile): void; + setFile(value: Windows.Storage.IStorageFile): void; /** * Sets content disposition header values that indicate the nature of the information that this BackgroundTransferContentPart represents. * @param headerName The header name. @@ -41837,7 +41837,7 @@ declare namespace Windows { * @param sourceFile The file for upload. * @return The resultant upload operation. */ - createUpload(uri: Windows.Foundation.Uri, sourceFile: Windows.Storage.StorageFile): Windows.Networking.BackgroundTransfer.UploadOperation; + createUpload(uri: Windows.Foundation.Uri, sourceFile: Windows.Storage.IStorageFile): Windows.Networking.BackgroundTransfer.UploadOperation; /** * Returns an asynchronous operation that, on completion, returns an UploadOperation with the specified URI and one or more BackgroundTransferContentPart objects. * @param uri The location for the upload. @@ -41938,7 +41938,7 @@ declare namespace Windows { /** Gets the URI from which to download the file. */ requestedUri: Windows.Foundation.Uri; /** Returns the IStorageFile object provided by the caller when creating the DownloadOperation object using CreateDownload . */ - resultFile: Windows.Storage.StorageFile; + resultFile: Windows.Storage.IStorageFile; /** Resumes a paused download operation. */ resume(): void; /** @@ -41998,7 +41998,7 @@ declare namespace Windows { /** Gets the URI to upload from. */ requestedUri: Windows.Foundation.Uri; /** Specifies the IStorageFile to upload. */ - sourceFile: Windows.Storage.StorageFile; + sourceFile: Windows.Storage.IStorageFile; /** * Starts an asynchronous upload operation. * @return An asynchronous upload operation that includes progress updates. @@ -42047,7 +42047,7 @@ declare namespace Windows { /** Gets the name of the app. */ attributionName: string; /** Gets the thumbnail of the app. */ - attributionThumbnail: Windows.Storage.Streams.RandomAccessStreamReference; + attributionThumbnail: Windows.Storage.Streams.IRandomAccessStreamReference; /** Gets the number of bytes received by the app over the network. */ bytesReceived: number; /** Gets the number of bytes sent by the app over the network. */ @@ -42202,7 +42202,7 @@ declare namespace Windows { /** Defines a specific NetworkCostType value to query for. */ networkCostType: Windows.Networking.Connectivity.NetworkCostType; /** Gets available data as raw data. */ - rawData: Windows.Storage.Streams.Buffer; + rawData: Windows.Storage.Streams.IBuffer; /** Indicates a specific network operator ID to query for. */ serviceProviderGuid: string; } @@ -43002,7 +43002,7 @@ declare namespace Windows { /** Represents the result of a mobile broadband device service command. */ abstract class MobileBroadbandDeviceServiceCommandResult { /** Gets the response data from the command execution on a mobile broadband device service. */ - responseData: Windows.Storage.Streams.Buffer; + responseData: Windows.Storage.Streams.IBuffer; /** Gets the status code of the command execution on a mobile broadband device service. */ statusCode: number; } @@ -43016,19 +43016,19 @@ declare namespace Windows { * @param data The data to be submitted as part of the command. * @return An asynchronous operation that returns the result of the command. */ - sendQueryCommandAsync(commandId: number, data: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + sendQueryCommandAsync(commandId: number, data: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Starts an asynchronous operation on a mobile broadband device service to send a set command to the command session. * @param commandId The command identifier for the set command to be executed. * @param data The data to be submitted as part of the command. * @return An asynchronous operation that returns the result of the command. */ - sendSetCommandAsync(commandId: number, data: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + sendSetCommandAsync(commandId: number, data: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; } /** Provides data for a DataReceived event on a MobileBroadbandDeviceServiceDataSession when data is received . */ abstract class MobileBroadbandDeviceServiceDataReceivedEventArgs { /** Gets the data received on the MobileBroadbandDeviceServiceDataSession . */ - receivedData: Windows.Storage.Streams.Buffer; + receivedData: Windows.Storage.Streams.IBuffer; } /** Represents a device service data session which allows the caller to write data to the modem on a mobile broadband device service. */ abstract class MobileBroadbandDeviceServiceDataSession { @@ -43043,7 +43043,7 @@ declare namespace Windows { * @param value The data to be submitted as part of the write operation. * @return An asynchronous operation that returns the result of the write operation. */ - writeDataAsync(value: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncAction; + writeDataAsync(value: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncAction; addEventListener(type: string, listener: Windows.Foundation.EventHandler): void; removeEventListener(type: string, listener: Windows.Foundation.EventHandler): void; } @@ -43063,7 +43063,7 @@ declare namespace Windows { /** Gets the device service identifier for the device service trigger event. */ deviceServiceId: string; /** Gets the received data associated with the triggered event. */ - receivedData: Windows.Storage.Streams.Buffer; + receivedData: Windows.Storage.Streams.IBuffer; } /** Describes different types of Mobile Broadband devices. */ enum MobileBroadbandDeviceType { @@ -43340,7 +43340,7 @@ declare namespace Windows { */ getRecordDetailsAsync(uiccFilePath: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets the ID of this UICC application. */ - id: Windows.Storage.Streams.Buffer; + id: Windows.Storage.Streams.IBuffer; /** Gets what kind of UICC application this instance represents. */ kind: Windows.Networking.NetworkOperators.UiccAppKind; /** @@ -43365,7 +43365,7 @@ declare namespace Windows { /** Encapsulates the results of a UICC application record read operation. */ abstract class MobileBroadbandUiccAppReadRecordResult { /** Gets the data returned by the application record read operation. Note that if Status is not Success, this value may be invalid or empty. */ - data: Windows.Storage.Streams.Buffer; + data: Windows.Storage.Streams.IBuffer; /** Gets a value which indicates whether the record read completed successfully. */ status: Windows.Networking.NetworkOperators.MobileBroadbandUiccAppOperationStatus; } @@ -43815,7 +43815,7 @@ declare namespace Windows { */ static createWatcher(): Windows.Networking.Proximity.PeerWatcher; /** Gets or sets user or device data to include during device discovery. */ - static discoveryData: Windows.Storage.Streams.Buffer; + static discoveryData: Windows.Storage.Streams.IBuffer; /** Gets or sets the name that identifies your computer to remote peers. */ static displayName: string; /** @@ -43850,7 +43850,7 @@ declare namespace Windows { /** Contains information that identifies a peer. */ abstract class PeerInformation { /** Gets the device data included during device discovery. */ - discoveryData: Windows.Storage.Streams.Buffer; + discoveryData: Windows.Storage.Streams.IBuffer; /** Gets the display name of the peer. */ displayName: string; /** Gets the hostname or IP address of the peer. */ @@ -43953,7 +43953,7 @@ declare namespace Windows { * @param message The binary message data to deliver to subscribers. * @return A unique publication ID for the published message. */ - publishBinaryMessage(messageType: string, message: Windows.Storage.Streams.Buffer): number; + publishBinaryMessage(messageType: string, message: Windows.Storage.Streams.IBuffer): number; /** * Publishes a message that contains binary data to subscribers of the specified message type. The specified handler is called when the message has been transmitted. * @param messageType The type of message to deliver to subscribers. @@ -43961,7 +43961,7 @@ declare namespace Windows { * @param messageTransmittedHandler The handler to call when the message has been transmitted. * @return A unique publication ID for the published message. */ - publishBinaryMessage(messageType: string, message: Windows.Storage.Streams.Buffer, messageTransmittedHandler: Windows.Networking.Proximity.MessageTransmittedHandler): number; + publishBinaryMessage(messageType: string, message: Windows.Storage.Streams.IBuffer, messageTransmittedHandler: Windows.Networking.Proximity.MessageTransmittedHandler): number; /** * Publishes a message to subscribers of the specified message type. * @param messageType The type of message to deliver to subscribers. @@ -44013,7 +44013,7 @@ declare namespace Windows { /** Represents a message that's received from a subscription. */ abstract class ProximityMessage { /** Gets the binary data of the message. */ - data: Windows.Storage.Streams.Buffer; + data: Windows.Storage.Streams.IBuffer; /** Gets the message data as text. */ dataAsString: string; /** Gets the type of the message. */ @@ -44524,9 +44524,9 @@ declare namespace Windows { * Constructs a new SocketActivityContext object with given context data. * @param data Context data to be used when the socket broker notifies the app of socket activity. */ - constructor(data: Windows.Storage.Streams.Buffer); + constructor(data: Windows.Storage.Streams.IBuffer); /** Get the serialized data to associate the app context to a transferred socket. */ - data: Windows.Storage.Streams.Buffer; + data: Windows.Storage.Streams.IBuffer; } /** Provides information on the transferred socket from the Socket Broker. */ abstract class SocketActivityInformation { @@ -44837,7 +44837,7 @@ declare namespace Windows { /** Gets the intermediate certificates sent by the server during SSL negotiation when making an SSL connection with a StreamSocket . */ serverIntermediateCertificates: Windows.Foundation.Collections.IVectorView; /** Get a byte array that represents the private shared secret exchanged by proximity devices. */ - sessionKey: Windows.Storage.Streams.Buffer; + sessionKey: Windows.Storage.Streams.IBuffer; } /** Supports listening for an incoming network connection using a TCP stream socket or Bluetooth RFCOMM. */ class StreamSocketListener { @@ -45183,7 +45183,7 @@ declare namespace Windows { * @param buffer This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. * @return This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ - static createFromSnapshotBuffer(buffer: Windows.Storage.Streams.Buffer): Windows.Networking.XboxLive.XboxLiveDeviceAddress; + static createFromSnapshotBuffer(buffer: Windows.Storage.Streams.IBuffer): Windows.Networking.XboxLive.XboxLiveDeviceAddress; /** * This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. * @param buffer This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. @@ -45212,7 +45212,7 @@ declare namespace Windows { * This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. * @return This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ - getSnapshotAsBuffer(): Windows.Storage.Streams.Buffer; + getSnapshotAsBuffer(): Windows.Storage.Streams.IBuffer; /** * This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. * @return @@ -45441,7 +45441,7 @@ declare namespace Windows { */ static publishPrivatePayloadBytes(payload: number[]): void; /** This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ - static publishedPrivatePayload: Windows.Storage.Streams.Buffer; + static publishedPrivatePayload: Windows.Storage.Streams.IBuffer; /** This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ constructor(); /** This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ @@ -45557,7 +45557,7 @@ declare namespace Windows { /** This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ status: Windows.Networking.XboxLive.XboxLiveQualityOfServiceMeasurementStatus; /** This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ - value: Windows.Storage.Streams.Buffer; + value: Windows.Storage.Streams.IBuffer; } /** This API is not available to all apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. */ enum XboxLiveSocketKind { @@ -46137,7 +46137,7 @@ declare namespace Windows { * @param webAccountPicture The picture to set. * @return This method does not return a value. */ - static setWebAccountPictureAsync(webAccount: Windows.Security.Credentials.WebAccount, webAccountPicture: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncAction; + static setWebAccountPictureAsync(webAccount: Windows.Security.Credentials.WebAccount, webAccountPicture: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncAction; /** * Updates the properties of a web account asynchronously. * @param webAccount The web account to update. @@ -46441,25 +46441,25 @@ declare namespace Windows { * @param data The data to cryptographically sign. * @return When this method completes, it returns a key credential operation result. */ - requestSignAsync(data: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + requestSignAsync(data: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Gets the public portion of the asymmetric KeyCredential . * @return The public portion of the asymmetric key credential. */ - retrievePublicKey(): Windows.Storage.Streams.Buffer; + retrievePublicKey(): Windows.Storage.Streams.IBuffer; /** * Gets the public portion of the asymmetric KeyCredential . * @param blobType The blob type of the public key to retrieve. * @return The public portion of the asymmetric key credential. */ - retrievePublicKey(blobType: Windows.Security.Cryptography.Core.CryptographicPublicKeyBlobType): Windows.Storage.Streams.Buffer; + retrievePublicKey(blobType: Windows.Security.Cryptography.Core.CryptographicPublicKeyBlobType): Windows.Storage.Streams.IBuffer; } /** Represents the results of the KeyCredential.GetAttestationAsync method. */ abstract class KeyCredentialAttestationResult { /** Gets the attestation information for the KeyCredential. */ - attestationBuffer: Windows.Storage.Streams.Buffer; + attestationBuffer: Windows.Storage.Streams.IBuffer; /** Gets the chain of certificates used to verify the attestation. */ - certificateChainBuffer: Windows.Storage.Streams.Buffer; + certificateChainBuffer: Windows.Storage.Streams.IBuffer; /** Gets the status of the key credential attestation. */ status: Windows.Security.Credentials.KeyCredentialAttestationStatus; } @@ -46516,7 +46516,7 @@ declare namespace Windows { /** Represents the result of a key credential operation. */ abstract class KeyCredentialOperationResult { /** Gets the result of the key credential operation. */ - result: Windows.Storage.Streams.Buffer; + result: Windows.Storage.Streams.IBuffer; /** Gets the status of the key credential. */ status: Windows.Security.Credentials.KeyCredentialStatus; } @@ -46558,7 +46558,7 @@ declare namespace Windows { /** Gets or sets the password string of the credential. */ password: string; /** This API is intended for internal use only should not be used in your code. */ - properties: Windows.Foundation.Collections.PropertySet; + properties: Windows.Foundation.Collections.IPropertySet; /** Gets or sets the resource of the credential. */ resource: string; /** Populates the password for the credential. After the operation returns successfully, you can get the password from the Password property. */ @@ -46718,14 +46718,14 @@ declare namespace Windows { /** Gets or sets the body of text that displays to the user. */ message: string; /** Gets or sets whether to fill dialog box fields with previous credentials. */ - previousCredential: Windows.Storage.Streams.Buffer; + previousCredential: Windows.Storage.Streams.IBuffer; /** Gets or sets the name of the target computer. */ targetName: string; } /** Describes the results of the dialog box operation. */ abstract class CredentialPickerResults { /** Gets the opaque credential. */ - credential: Windows.Storage.Streams.Buffer; + credential: Windows.Storage.Streams.IBuffer; /** Gets the domain name portion of the unpacked credential. */ credentialDomainName: string; /** Gets the password portion of the unpacked credential. */ @@ -46807,7 +46807,7 @@ declare namespace Windows { * @param desizedSize The desired size of the web account picture. * @return When this method completes, it returns the web account's picture. */ - getPictureAsync(desizedSize: Windows.Security.Credentials.WebAccountPictureSize): Windows.Foundation.IPromiseWithIAsyncOperation; + getPictureAsync(desizedSize: Windows.Security.Credentials.WebAccountPictureSize): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets the Id of the web account. */ id: string; /** Gets the properties of the web account. */ @@ -46892,7 +46892,7 @@ declare namespace Windows { * Create a new instance of the Certificate class using the specified certificate data. * @param certBlob The certificate data as an ASN.1 DER encoded certificate blob (.cer or .p7b). */ - constructor(certBlob: Windows.Storage.Streams.Buffer); + constructor(certBlob: Windows.Storage.Streams.IBuffer); /** * Build a certificate chain for the specified certificates starting from the end entity certificate to the root using the specified chain building parameters. * @param certificates The intermediate certificates to use when building the certificate chain. @@ -46914,7 +46914,7 @@ declare namespace Windows { * Gets the ASN.1 DER encoded certificate blob. * @return The ASN.1 DER encoded certificate blob. */ - getCertificateBlob(): Windows.Storage.Streams.Buffer; + getCertificateBlob(): Windows.Storage.Streams.IBuffer; /** * Gets the hash value for the certificate for a specified algorithm. * @param hashAlgorithmName The hash algorithm to use for the hash value of the certificate. Only values of "SHA1" or "SHA256" are supported. @@ -47221,12 +47221,12 @@ declare namespace Windows { * @param certificates The list of certificates to build the chain for the signer certificates. * @return An asynchronous operation to retrieve the attached signed CMS message. */ - static generateSignatureAsync(data: Windows.Storage.Streams.Buffer, signers: Windows.Foundation.Collections.IIterable, certificates: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperation; + static generateSignatureAsync(data: Windows.Storage.Streams.IBuffer, signers: Windows.Foundation.Collections.IIterable, certificates: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a new instance of the CmsAttachedSignature class for the specified signed CMS message. * @param inputBlob A signed CMS message blob. */ - constructor(inputBlob: Windows.Storage.Streams.Buffer); + constructor(inputBlob: Windows.Storage.Streams.IBuffer); /** Gets the list of certificates that are used for chain building for the signer certificate. */ certificates: Windows.Foundation.Collections.IVectorView; /** Gets the content of the signed CMS message. */ @@ -47248,12 +47248,12 @@ declare namespace Windows { * @param certificates The list of certificates to build the chain for the signer certificates. * @return An asynchronous operation to retrieve the detached signed CMS message. */ - static generateSignatureAsync(data: Windows.Storage.Streams.IInputStream, signers: Windows.Foundation.Collections.IIterable, certificates: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperation; + static generateSignatureAsync(data: Windows.Storage.Streams.IInputStream, signers: Windows.Foundation.Collections.IIterable, certificates: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a new instance of the CmsDetachedSignature class for the specified signed CMS message. * @param inputBlob A signed CMS message blob. */ - constructor(inputBlob: Windows.Storage.Streams.Buffer); + constructor(inputBlob: Windows.Storage.Streams.IBuffer); /** Gets the list of certificates that are used for chain building for the signer certificate. */ certificates: Windows.Foundation.Collections.IVectorView; /** Gets the list of signers that are used for creating or verifying the signature. */ @@ -47565,27 +47565,27 @@ declare namespace Windows { * @param keyBlob Buffer that contains the key pair to import. * @return Represents the imported key pair. */ - importKeyPair(keyBlob: Windows.Storage.Streams.Buffer): Windows.Security.Cryptography.Core.CryptographicKey; + importKeyPair(keyBlob: Windows.Storage.Streams.IBuffer): Windows.Security.Cryptography.Core.CryptographicKey; /** * Imports a public/private key pair from a buffer in the specified format. * @param keyBlob Buffer that contains the key pair to import. * @param BlobType A CryptographicPrivateKeyBlobType enumeration value that specifies information about the private key contained in the keyBlob buffer. The default value is Pkcs8RawPrivateKeyInfo. * @return Represents the imported key pair. */ - importKeyPair(keyBlob: Windows.Storage.Streams.Buffer, BlobType: Windows.Security.Cryptography.Core.CryptographicPrivateKeyBlobType): Windows.Security.Cryptography.Core.CryptographicKey; + importKeyPair(keyBlob: Windows.Storage.Streams.IBuffer, BlobType: Windows.Security.Cryptography.Core.CryptographicPrivateKeyBlobType): Windows.Security.Cryptography.Core.CryptographicKey; /** * Imports a public key into a buffer. * @param keyBlob Buffer that contains the key to import. * @return Represents the imported key. */ - importPublicKey(keyBlob: Windows.Storage.Streams.Buffer): Windows.Security.Cryptography.Core.CryptographicKey; + importPublicKey(keyBlob: Windows.Storage.Streams.IBuffer): Windows.Security.Cryptography.Core.CryptographicKey; /** * Imports a public key into a buffer for a specified format. * @param keyBlob Buffer that contains the key to import. * @param BlobType A CryptographicPublicKeyBlobType enumeration value that specifies the format of the public key contained in the keyBlob buffer. The default value is X509SubjectPublicKeyInfo. * @return Represents the imported key. */ - importPublicKey(keyBlob: Windows.Storage.Streams.Buffer, BlobType: Windows.Security.Cryptography.Core.CryptographicPublicKeyBlobType): Windows.Security.Cryptography.Core.CryptographicKey; + importPublicKey(keyBlob: Windows.Storage.Streams.IBuffer, BlobType: Windows.Security.Cryptography.Core.CryptographicPublicKeyBlobType): Windows.Security.Cryptography.Core.CryptographicKey; } /** Represents information about a target algorithm. */ enum Capi1KdfTargetAlgorithm { @@ -47603,7 +47603,7 @@ declare namespace Windows { * @param iv Buffer that contains the initialization vector. If an initialization vector (IV) was used to encrypt the data, you must use the same IV to decrypt the data. For more information, see Encrypt . * @return Decrypted data. */ - static decrypt(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.Buffer, iv: Windows.Storage.Streams.Buffer): Windows.Storage.Streams.Buffer; + static decrypt(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.IBuffer, iv: Windows.Storage.Streams.IBuffer): Windows.Storage.Streams.IBuffer; /** * Decrypts and authenticates data. For more information and a complete code sample, see EncryptedAndAuthenticatedData . * @param key Symmetric key to use. @@ -47613,7 +47613,7 @@ declare namespace Windows { * @param authenticatedData Authenticated data. This can be Null. * @return A buffer that contains the decrypted data. */ - static decryptAndAuthenticate(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.Buffer, nonce: Windows.Storage.Streams.Buffer, authenticationTag: Windows.Storage.Streams.Buffer, authenticatedData: Windows.Storage.Streams.Buffer): Windows.Storage.Streams.Buffer; + static decryptAndAuthenticate(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.IBuffer, nonce: Windows.Storage.Streams.IBuffer, authenticationTag: Windows.Storage.Streams.IBuffer, authenticatedData: Windows.Storage.Streams.IBuffer): Windows.Storage.Streams.IBuffer; /** * Decrypts the encrypted input data using the supplied key. * @param key The key to use to decrypt the encrypted input data. @@ -47621,7 +47621,7 @@ declare namespace Windows { * @param iv The initial vector for a symmetric key. For an asymmetric key, set this value to null. * @return The decrypted data. */ - static decryptAsync(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.Buffer, iv: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + static decryptAsync(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.IBuffer, iv: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Derives a key from another key by using a key derivation function. For more information, see the KeyDerivationAlgorithmProvider and KeyDerivationParameters classes. * @param key The symmetric or secret key used for derivation. @@ -47629,7 +47629,7 @@ declare namespace Windows { * @param desiredKeySize Requested size, in bytes, of the derived key. * @return Buffer that contains the derived key. */ - static deriveKeyMaterial(key: Windows.Security.Cryptography.Core.CryptographicKey, parameters: Windows.Security.Cryptography.Core.KeyDerivationParameters, desiredKeySize: number): Windows.Storage.Streams.Buffer; + static deriveKeyMaterial(key: Windows.Security.Cryptography.Core.CryptographicKey, parameters: Windows.Security.Cryptography.Core.KeyDerivationParameters, desiredKeySize: number): Windows.Storage.Streams.IBuffer; /** * Encrypts data by using a symmetric or asymmetric algorithm. * @param key Cryptographic key to use for encryption. This can be an asymmetric or a symmetric key. For more information, see AsymmetricKeyAlgorithmProvider and SymmetricKeyAlgorithmProvider . @@ -47637,7 +47637,7 @@ declare namespace Windows { * @param iv Buffer that contains the initialization vector. This can be null for a symmetric algorithm and should always be null for an asymmetric algorithm. If an initialization vector (IV) was used to encrypt the data, you must use the same IV to decrypt the data. You can use the GenerateRandom method to create an IV that contains random data. Other IVs, such as nonce-generated vectors, require custom implementation. For more information, see Cryptographic keys. * @return Encrypted data. */ - static encrypt(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.Buffer, iv: Windows.Storage.Streams.Buffer): Windows.Storage.Streams.Buffer; + static encrypt(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.IBuffer, iv: Windows.Storage.Streams.IBuffer): Windows.Storage.Streams.IBuffer; /** * Performs authenticated encryption. * @param key Symmetric key to use for encryption. @@ -47646,35 +47646,35 @@ declare namespace Windows { * @param authenticatedData Authenticated data. This can be Null. * @return The encrypted and authenticated data. */ - static encryptAndAuthenticate(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.Buffer, nonce: Windows.Storage.Streams.Buffer, authenticatedData: Windows.Storage.Streams.Buffer): Windows.Security.Cryptography.Core.EncryptedAndAuthenticatedData; + static encryptAndAuthenticate(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.IBuffer, nonce: Windows.Storage.Streams.IBuffer, authenticatedData: Windows.Storage.Streams.IBuffer): Windows.Security.Cryptography.Core.EncryptedAndAuthenticatedData; /** * Signs digital content. For more information, see MACs, hashes, and signatures. * @param key Key used for signing. * @param data Data to be signed. * @return The data's signature. */ - static sign(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.Buffer): Windows.Storage.Streams.Buffer; + static sign(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.IBuffer): Windows.Storage.Streams.IBuffer; /** * Computes a hash for the supplied input data, and then signs the computed hash using the specified key. * @param key The key to use to compute and sign the hash. * @param data The raw input data to sign. The data is not hashed. * @return An asynchronous operation to retrieve the hashed and signed data. */ - static signAsync(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + static signAsync(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Signs the hashed input data using the specified key. * @param key The key to use to sign the hash. This key must be an asymmetric key obtained from a PersistedKeyProvider or AsymmetricKeyAlgorithmProvider . * @param data The input data to sign. The data is a hashed value which can be obtained through incremental hash. * @return The signed data. */ - static signHashedData(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.Buffer): Windows.Storage.Streams.Buffer; + static signHashedData(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.IBuffer): Windows.Storage.Streams.IBuffer; /** * Signs the hashed input data using the specified key. * @param key The key to use to sign the hash. This key must be an asymmetric key obtained from a PersistedKeyProvider or AsymmetricKeyAlgorithmProvider . * @param data The input data to sign. The data is a hashed value which can be obtained through incremental hash. * @return An asynchronous operation to retrieve the signed data. */ - static signHashedDataAsync(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + static signHashedDataAsync(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Verifies a message signature. * @param key Key used for verification. This must be the same key previously used to sign the message. @@ -47682,7 +47682,7 @@ declare namespace Windows { * @param signature Signature previously computed over the message to be verified. * @return true if the message is verified. */ - static verifySignature(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.Buffer, signature: Windows.Storage.Streams.Buffer): boolean; + static verifySignature(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.IBuffer, signature: Windows.Storage.Streams.IBuffer): boolean; /** * Verifies the signature of the specified input data against a known signature. * @param key The key to use to retrieve the signature from the input data. This key must be an asymmetric key obtained from a PersistedKeyProvider or AsymmetricKeyAlgorithmProvider . @@ -47690,7 +47690,7 @@ declare namespace Windows { * @param signature The known signature to use to verify the signature of the input data. * @return True if the signature is verified; otherwise false. */ - static verifySignatureWithHashInput(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.Buffer, signature: Windows.Storage.Streams.Buffer): boolean; + static verifySignatureWithHashInput(key: Windows.Security.Cryptography.Core.CryptographicKey, data: Windows.Storage.Streams.IBuffer, signature: Windows.Storage.Streams.IBuffer): boolean; } /** Represents a reusable hashing object and contains the result of a hashing operation. */ abstract class CryptographicHash { @@ -47698,12 +47698,12 @@ declare namespace Windows { * Appends a binary encoded string to the data stored in the CryptographicHash object. * @param data Data to append. */ - append(data: Windows.Storage.Streams.Buffer): void; + append(data: Windows.Storage.Streams.IBuffer): void; /** * Gets hashed data from the CryptographicHash object and resets the object. * @return Hashed data. */ - getValueAndReset(): Windows.Storage.Streams.Buffer; + getValueAndReset(): Windows.Storage.Streams.IBuffer; } /** Represents a symmetric key or an asymmetric key pair. */ abstract class CryptographicKey { @@ -47711,24 +47711,24 @@ declare namespace Windows { * Exports the key pair to a buffer. * @return Buffer that contains the key pair. */ - export(): Windows.Storage.Streams.Buffer; + export(): Windows.Storage.Streams.IBuffer; /** * Exports the key pair to a buffer given a specified format. * @param BlobType A CryptographicPrivateKeyBlobType enumeration value that specifies the format of the key in the buffer. The default value is Pkcs8RawPrivateKeyInfo. * @return Buffer that contains the key pair. */ - export(BlobType: Windows.Security.Cryptography.Core.CryptographicPrivateKeyBlobType): Windows.Storage.Streams.Buffer; + export(BlobType: Windows.Security.Cryptography.Core.CryptographicPrivateKeyBlobType): Windows.Storage.Streams.IBuffer; /** * Exports a public key to a buffer. * @return Buffer that contains the public key. */ - exportPublicKey(): Windows.Storage.Streams.Buffer; + exportPublicKey(): Windows.Storage.Streams.IBuffer; /** * Exports a public key to a buffer given a specified format. * @param BlobType A CryptographicPublicKeyBlobType enumeration value that specifies the format of the key in the buffer. The default value is X509SubjectPublicKeyInfo. * @return Buffer that contains the public key. */ - exportPublicKey(BlobType: Windows.Security.Cryptography.Core.CryptographicPublicKeyBlobType): Windows.Storage.Streams.Buffer; + exportPublicKey(BlobType: Windows.Security.Cryptography.Core.CryptographicPublicKeyBlobType): Windows.Storage.Streams.IBuffer; /** Gets the size, in bits, of the key. */ keySize: number; } @@ -47865,9 +47865,9 @@ declare namespace Windows { /** Contains data that can be retrieved from encrypted and authenticated data. Authenticated encryption algorithms are opened by using the SymmetricKeyAlgorithmProvider class. */ abstract class EncryptedAndAuthenticatedData { /** Gets the authentication tag. */ - authenticationTag: Windows.Storage.Streams.Buffer; + authenticationTag: Windows.Storage.Streams.IBuffer; /** Gets the encrypted data. */ - encryptedData: Windows.Storage.Streams.Buffer; + encryptedData: Windows.Storage.Streams.IBuffer; } /** Contains static properties that enable you to retrieve algorithm names that can be used in the OpenAlgorithm method of the HashAlgorithmProvider class. */ abstract class HashAlgorithmNames { @@ -47902,7 +47902,7 @@ declare namespace Windows { * @param data Data to be hashed. * @return Hashed data. */ - hashData(data: Windows.Storage.Streams.Buffer): Windows.Storage.Streams.Buffer; + hashData(data: Windows.Storage.Streams.IBuffer): Windows.Storage.Streams.IBuffer; /** Gets the length, in bytes, of the hash. */ hashLength: number; } @@ -47964,7 +47964,7 @@ declare namespace Windows { * @param keyMaterial Data used to create the key. * @return Represents the KDF key. */ - createKey(keyMaterial: Windows.Storage.Streams.Buffer): Windows.Security.Cryptography.Core.CryptographicKey; + createKey(keyMaterial: Windows.Storage.Streams.IBuffer): Windows.Security.Cryptography.Core.CryptographicKey; } /** Represents parameters used when deriving a key. */ abstract class KeyDerivationParameters { @@ -47980,14 +47980,14 @@ declare namespace Windows { * @param iterationCount Number of iterations to be used to derive a key. * @return Refers to the parameters used during key derivation. */ - static buildForPbkdf2(pbkdf2Salt: Windows.Storage.Streams.Buffer, iterationCount: number): Windows.Security.Cryptography.Core.KeyDerivationParameters; + static buildForPbkdf2(pbkdf2Salt: Windows.Storage.Streams.IBuffer, iterationCount: number): Windows.Security.Cryptography.Core.KeyDerivationParameters; /** * Creates a KeyDerivationParameters object for use in a counter mode, hash-based message authentication code (HMAC) key derivation function. * @param label Buffer that specifies the purpose for the derived keying material. * @param context Buffer that specifies information related to the derived keying material. For example, the context can identify the parties who are deriving the keying material and, optionally, a nonce known by the parties. * @return Refers to the parameters used during key derivation. */ - static buildForSP800108(label: Windows.Storage.Streams.Buffer, context: Windows.Storage.Streams.Buffer): Windows.Security.Cryptography.Core.KeyDerivationParameters; + static buildForSP800108(label: Windows.Storage.Streams.IBuffer, context: Windows.Storage.Streams.IBuffer): Windows.Security.Cryptography.Core.KeyDerivationParameters; /** * Creates a KeyDerivationParameters object for use in the SP800-56A key derivation function. * @param algorithmId Specifies the intended purpose of the derived key. @@ -47997,13 +47997,13 @@ declare namespace Windows { * @param suppPrivInfo Contains private information known to both initiator and responder, such as a shared secret. * @return Refers to the parameters used during key derivation. */ - static buildForSP80056a(algorithmId: Windows.Storage.Streams.Buffer, partyUInfo: Windows.Storage.Streams.Buffer, partyVInfo: Windows.Storage.Streams.Buffer, suppPubInfo: Windows.Storage.Streams.Buffer, suppPrivInfo: Windows.Storage.Streams.Buffer): Windows.Security.Cryptography.Core.KeyDerivationParameters; + static buildForSP80056a(algorithmId: Windows.Storage.Streams.IBuffer, partyUInfo: Windows.Storage.Streams.IBuffer, partyVInfo: Windows.Storage.Streams.IBuffer, suppPubInfo: Windows.Storage.Streams.IBuffer, suppPrivInfo: Windows.Storage.Streams.IBuffer): Windows.Security.Cryptography.Core.KeyDerivationParameters; /** Gets or sets the Capi1KdfTargetAlgorithm . */ capi1KdfTargetAlgorithm: Windows.Security.Cryptography.Core.Capi1KdfTargetAlgorithm; /** Retrieves the number of iterations used to derive the key. For more information, see BuildForPbkdf2 . */ iterationCount: number; /** Gets or sets the parameters used by the key derivation algorithm. */ - kdfGenericBinary: Windows.Storage.Streams.Buffer; + kdfGenericBinary: Windows.Storage.Streams.IBuffer; } /** Contains static properties that enable you to retrieve algorithm names that can be used in the OpenAlgorithm method of the MacAlgorithmProvider class. */ abstract class MacAlgorithmNames { @@ -48035,13 +48035,13 @@ declare namespace Windows { * @param keyMaterial Random data used to help generate the hash. You can call the GenerateRandom method to create the random data. * @return A CryptographicHash object that supports incremental hash operations. */ - createHash(keyMaterial: Windows.Storage.Streams.Buffer): Windows.Security.Cryptography.Core.CryptographicHash; + createHash(keyMaterial: Windows.Storage.Streams.IBuffer): Windows.Security.Cryptography.Core.CryptographicHash; /** * Creates a symmetric key that can be used to create the MAC value. * @param keyMaterial Random data used to help generate the key. You can call the GenerateRandom method to create the random data. * @return Symmetric key. */ - createKey(keyMaterial: Windows.Storage.Streams.Buffer): Windows.Security.Cryptography.Core.CryptographicKey; + createKey(keyMaterial: Windows.Storage.Streams.IBuffer): Windows.Security.Cryptography.Core.CryptographicKey; /** Gets the length, in bytes, of the message authentication code. */ macLength: number; } @@ -48122,7 +48122,7 @@ declare namespace Windows { * @param keyMaterial Data used to generate the key. You can call the GenerateRandom method to create random key material. * @return Symmetric key. */ - createSymmetricKey(keyMaterial: Windows.Storage.Streams.Buffer): Windows.Security.Cryptography.Core.CryptographicKey; + createSymmetricKey(keyMaterial: Windows.Storage.Streams.IBuffer): Windows.Security.Cryptography.Core.CryptographicKey; } } /** Contains static methods that implement data management functionality common to cryptographic operations. */ @@ -48133,63 +48133,63 @@ declare namespace Windows { * @param object2 Buffer to be used for comparison. * @return True specifies that the buffers are equal. Two buffers are equal if each code point in one matches the corresponding code point in the other. */ - static compare(object1: Windows.Storage.Streams.Buffer, object2: Windows.Storage.Streams.Buffer): boolean; + static compare(object1: Windows.Storage.Streams.IBuffer, object2: Windows.Storage.Streams.IBuffer): boolean; /** * Converts a buffer to an encoded string. * @param encoding Encoding format. * @param buffer Data to be encoded. * @return A string that contains the encoded data. */ - static convertBinaryToString(encoding: Windows.Security.Cryptography.BinaryStringEncoding, buffer: Windows.Storage.Streams.Buffer): string; + static convertBinaryToString(encoding: Windows.Security.Cryptography.BinaryStringEncoding, buffer: Windows.Storage.Streams.IBuffer): string; /** * Converts a string to an encoded buffer. * @param value String to be encoded. * @param encoding Encoding format. * @return Encoded buffer. */ - static convertStringToBinary(value: string, encoding: Windows.Security.Cryptography.BinaryStringEncoding): Windows.Storage.Streams.Buffer; + static convertStringToBinary(value: string, encoding: Windows.Security.Cryptography.BinaryStringEncoding): Windows.Storage.Streams.IBuffer; /** * Copies a buffer to an array of bytes. * @param buffer Input buffer. * @return An array of bytes that contains the values copied from the input buffer. You must declare the array before calling this method and pass it by using the ref keyword. If the buffer for the input parameter is empty, then the value parameter will be returned as NULL. */ - static copyToByteArray(buffer: Windows.Storage.Streams.Buffer): number[]; + static copyToByteArray(buffer: Windows.Storage.Streams.IBuffer): number[]; /** * Creates a buffer from an input byte array. * @param value An array of bytes used to create the buffer. * @return Output buffer. */ - static createFromByteArray(value: number[]): Windows.Storage.Streams.Buffer; + static createFromByteArray(value: number[]): Windows.Storage.Streams.IBuffer; /** * Decodes a string that has been base64 encoded. * @param value Base64 encoded input string. * @return Output buffer that contains the decoded string. */ - static decodeFromBase64String(value: string): Windows.Storage.Streams.Buffer; + static decodeFromBase64String(value: string): Windows.Storage.Streams.IBuffer; /** * Decodes a string that has been hexadecimal encoded. * @param value Encoded input string. * @return Output buffer that contains the decoded string. */ - static decodeFromHexString(value: string): Windows.Storage.Streams.Buffer; + static decodeFromHexString(value: string): Windows.Storage.Streams.IBuffer; /** * Encodes a buffer to a base64 string. * @param buffer Input buffer. * @return Base64-encoded output string. */ - static encodeToBase64String(buffer: Windows.Storage.Streams.Buffer): string; + static encodeToBase64String(buffer: Windows.Storage.Streams.IBuffer): string; /** * Encodes a buffer to a hexadecimal string. * @param buffer Input buffer. * @return Hexadecimal encoded output string. */ - static encodeToHexString(buffer: Windows.Storage.Streams.Buffer): string; + static encodeToHexString(buffer: Windows.Storage.Streams.IBuffer): string; /** * Creates a buffer that contains random data. * @param length Length, in bytes, of the buffer to create. * @return Output buffer that contains the random data. */ - static generateRandom(length: number): Windows.Storage.Streams.Buffer; + static generateRandom(length: number): Windows.Storage.Streams.IBuffer; /** * Creates a random number. * @return Integer that contains the random data. @@ -48212,7 +48212,7 @@ declare namespace Windows { * @param data Data to protect. * @return Represents an asynchronous operation. */ - protectAsync(data: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + protectAsync(data: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Asynchronously protects a data stream. * @param src Stream to be protected. @@ -48225,7 +48225,7 @@ declare namespace Windows { * @param data Data to decrypt. * @return Represents an asynchronous operation. */ - unprotectAsync(data: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + unprotectAsync(data: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Asynchronously decrypts a data stream. * @param src Stream to decrypt. @@ -48241,7 +48241,7 @@ declare namespace Windows { /** Contains information about the result from protecting or unprotecting an enterprise protected buffer. */ abstract class BufferProtectUnprotectResult { /** Gets the enterprise protected buffer that has been protected or unprotected. */ - buffer: Windows.Storage.Streams.Buffer; + buffer: Windows.Storage.Streams.IBuffer; /** Gets the DataProtectionInfo object concerning the enterprise protected buffer that has been protected or unprotected. */ protectionInfo: Windows.Security.EnterpriseData.DataProtectionInfo; } @@ -48259,7 +48259,7 @@ declare namespace Windows { * @param protectedData The buffer for which protection status is being queried. * @return When the call to this method completes successfully, it returns a DataProtectionInfo object that contains the status of the buffer. */ - static getProtectionInfoAsync(protectedData: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + static getProtectionInfoAsync(protectedData: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Get the status of an enterprise protected stream. * @param protectedStream The stream for which protection status is being queried. @@ -48272,7 +48272,7 @@ declare namespace Windows { * @param identity The enterprise identity. This is an email address or domain that is managed. Your app should use IsIdentityManaged to confirm that an email address or domain is managed. * @return When the call to this method completes successfully, it returns a BufferProtectUnprotectResult object that contains the status of the newly protected buffer. */ - static protectAsync(data: Windows.Storage.Streams.Buffer, identity: string): Windows.Foundation.IPromiseWithIAsyncOperation; + static protectAsync(data: Windows.Storage.Streams.IBuffer, identity: string): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Protect a stream of data to an enterprise identity. * @param unprotectedStream The input, unprotected stream. @@ -48286,7 +48286,7 @@ declare namespace Windows { * @param data The buffer to be unprotected. * @return When the call to this method completes successfully, it returns a BufferProtectUnprotectResult object that contains the status of the unprotected buffer. */ - static unprotectAsync(data: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperation; + static unprotectAsync(data: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Removes the protection to an enterprise identity from a stream of data. * @param protectedStream The input, protected stream. @@ -48347,7 +48347,7 @@ declare namespace Windows { * @param collisionOption A CreationCollisionOption value that specifies what to do if desiredName already exists. * @return When the call to this method completes successfully, it returns a ProtectedFileCreateResult object representing the newly created protected file. */ - static createProtectedAndOpenAsync(parentFolder: Windows.Storage.StorageFolder, desiredName: string, identity: string, collisionOption: Windows.Storage.CreationCollisionOption): Windows.Foundation.IPromiseWithIAsyncOperation; + static createProtectedAndOpenAsync(parentFolder: Windows.Storage.IStorageFolder, desiredName: string, identity: string, collisionOption: Windows.Storage.CreationCollisionOption): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Get the status of an enterprise-protected file. * @param source The file or folder for which protection status is being queried. @@ -48360,14 +48360,14 @@ declare namespace Windows { * @param containerFile The enterprise protected file to be created and loaded. * @return When the call to this method completes successfully, it returns a ProtectedContainerImportResult object representing the newly created protected file. */ - static loadFileFromContainerAsync(containerFile: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static loadFileFromContainerAsync(containerFile: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Create an enterprise-protected file in a specified storage item (such as a folder), and load it from a container file. * @param containerFile The enterprise protected file to be created and loaded. * @param target The storage item into which to create the enterprise protected file. * @return When the call to this method completes successfully, it returns a ProtectedContainerImportResult object representing the newly created protected file. */ - static loadFileFromContainerAsync(containerFile: Windows.Storage.StorageFile, target: Windows.Storage.IStorageItem): Windows.Foundation.IPromiseWithIAsyncOperation; + static loadFileFromContainerAsync(containerFile: Windows.Storage.IStorageFile, target: Windows.Storage.IStorageItem): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Create an enterprise-protected file in a specified storage item (such as a folder), and load it from a container file. * @param containerFile The enterprise protected file to be created and loaded. @@ -48375,7 +48375,7 @@ declare namespace Windows { * @param collisionOption The enum value that determines how Windows responds if the created file has the same name as an existing item in the container's location. * @return When the call to this method completes successfully, it returns a ProtectedContainerImportResult object representing the newly created protected file. */ - static loadFileFromContainerAsync(containerFile: Windows.Storage.StorageFile, target: Windows.Storage.IStorageItem, collisionOption: Windows.Storage.NameCollisionOption): Windows.Foundation.IPromiseWithIAsyncOperation; + static loadFileFromContainerAsync(containerFile: Windows.Storage.IStorageFile, target: Windows.Storage.IStorageItem, collisionOption: Windows.Storage.NameCollisionOption): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Protect the data in a file to an enterprise identity. The app can then use standard APIs to read or write from the file. * @param target The file to be protected. @@ -48388,14 +48388,14 @@ declare namespace Windows { * @param protectedFile The protected source file being copied. * @return When the call to this method completes successfully, it returns a ProtectedContainerExportResult object representing the newly created container file. */ - static saveFileAsContainerAsync(protectedFile: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static saveFileAsContainerAsync(protectedFile: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Save an enterprise-protected file as a containerized version, and share it with a specified list of user identities. * @param protectedFile The protected source file being copied. * @param sharedWithIdentities A collection of strings representing the user identities to share the containerized file with. For example, email recipients. * @return When the call to this method completes successfully, it returns a ProtectedContainerExportResult object representing the newly created container file. */ - static saveFileAsContainerAsync(protectedFile: Windows.Storage.StorageFile, sharedWithIdentities: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperation; + static saveFileAsContainerAsync(protectedFile: Windows.Storage.IStorageFile, sharedWithIdentities: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperation; } /** Describes the enterprise protection state of a file or folder. */ enum FileProtectionStatus { @@ -48493,7 +48493,7 @@ declare namespace Windows { /** Information about the enterprise protected file. */ protectionInfo: Windows.Security.EnterpriseData.FileProtectionInfo; /** The stream random access to the newly created enterprise protected file. */ - stream: Windows.Storage.Streams.RandomAccessStream; + stream: Windows.Storage.Streams.IRandomAccessStream; } /** Possible status values for an enterprise protected file that has been imported from or exported to a container file. */ enum ProtectedImportExportStatus { @@ -49365,7 +49365,7 @@ declare namespace Windows { /** Gets the name of the current settings container. */ name: string; /** Gets an object that represents the settings in this settings container. */ - values: Windows.Foundation.Collections.PropertySet; + values: Windows.Foundation.Collections.IPropertySet; } /** Provides access to the settings in a settings container. The ApplicationDataContainer.Values property returns an object that can be cast to this type. */ abstract class ApplicationDataContainerSettings { @@ -49453,14 +49453,14 @@ declare namespace Windows { * @param fileToReplace The StorageFile to be replaced. * @return No object or value is returned when this method completes. */ - copyAndReplaceAsync(fileToReplace: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncAction; + copyAndReplaceAsync(fileToReplace: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncAction; /** * Creates a copy of the StorageFile , gives it the specified file name, and stores it in the specified StorageFolder . * @param destinationFolder The folder in which to store the copied file. * @param desiredNewName The name of the new copy. * @return When this method completes successfully, it returns the copy as a StorageFile object. */ - copyAsync(destinationFolder: Windows.Storage.StorageFolder, desiredNewName: string): Windows.Foundation.IPromiseWithIAsyncOperation; + copyAsync(destinationFolder: Windows.Storage.IStorageFolder, desiredNewName: string): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a copy of the StorageFile , gives it the specified file name, and stores it in the specified StorageFolder . The method also specifies what to do if a file with the same name already exists in the specified folder. * @param destinationFolder The folder in which to store the copied file. @@ -49468,13 +49468,13 @@ declare namespace Windows { * @param option A value that indicates what to do if the file name already exists in the destination folder. * @return When this method completes successfully, it returns the copy as a StorageFile object. */ - copyAsync(destinationFolder: Windows.Storage.StorageFolder, desiredNewName: string, option: Windows.Storage.NameCollisionOption): Windows.Foundation.IPromiseWithIAsyncOperation; + copyAsync(destinationFolder: Windows.Storage.IStorageFolder, desiredNewName: string, option: Windows.Storage.NameCollisionOption): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a copy of the StorageFile and stores it in the specified StorageFolder . * @param destinationFolder The folder in which to store the copied file. * @return When this method completes successfully, it returns the copy as a StorageFile object. */ - copyAsync(destinationFolder: Windows.Storage.StorageFolder): Windows.Foundation.IPromiseWithIAsyncOperation; + copyAsync(destinationFolder: Windows.Storage.IStorageFolder): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets the date that the file was created. */ dateCreated: Date; /** @@ -49550,13 +49550,13 @@ declare namespace Windows { * @param fileToReplace The StorageFile to be replaced. * @return An object for managing the asynchronous move and replace operation. */ - moveAndReplaceAsync(fileToReplace: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncAction; + moveAndReplaceAsync(fileToReplace: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncAction; /** * Moves the StorageFile to the specified StorageFolder . * @param destinationFolder The destination folder. * @return No object or value is returned when this method completes. */ - moveAsync(destinationFolder: Windows.Storage.StorageFolder): Windows.Foundation.IPromiseWithIAsyncAction; + moveAsync(destinationFolder: Windows.Storage.IStorageFolder): Windows.Foundation.IPromiseWithIAsyncAction; /** * Moves the StorageFile to the specified folder and gives it the specified file name. The method also specifies what to do if a file with the same name already exists in the specified folder. * @param destinationFolder The destination folder. @@ -49564,14 +49564,14 @@ declare namespace Windows { * @param option A value that indicates what to do if the file name already exists in the destination folder. * @return No object or value is returned when this method completes. */ - moveAsync(destinationFolder: Windows.Storage.StorageFolder, desiredNewName: string, option: Windows.Storage.NameCollisionOption): Windows.Foundation.IPromiseWithIAsyncAction; + moveAsync(destinationFolder: Windows.Storage.IStorageFolder, desiredNewName: string, option: Windows.Storage.NameCollisionOption): Windows.Foundation.IPromiseWithIAsyncAction; /** * Moves the StorageFile to the specified folder, and gives the file the specified file name. * @param destinationFolder The destination folder. * @param desiredNewName The new file name. * @return No object or value is returned when this method completes. */ - moveAsync(destinationFolder: Windows.Storage.StorageFolder, desiredNewName: string): Windows.Foundation.IPromiseWithIAsyncAction; + moveAsync(destinationFolder: Windows.Storage.IStorageFolder, desiredNewName: string): Windows.Foundation.IPromiseWithIAsyncAction; /** Gets the music properties associated with the StorageFile , such as the album name, artist name, bit rate, and so on. */ musicProperties: Windows.Storage.FileProperties.MusicProperties; /** Gets the name of the StorageFile . */ @@ -49589,14 +49589,14 @@ declare namespace Windows { * @param accessMode One of the enumeration values that specifies the type of access to allow. * @return When this method completes, it returns an IRandomAccessStream that contains the requested random-access stream. */ - openAsync(accessMode: Windows.Storage.FileAccessMode): Windows.Foundation.IPromiseWithIAsyncOperation; + openAsync(accessMode: Windows.Storage.FileAccessMode): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Opens a random-access stream with the specified options over the specified file. * @param accessMode One of the enumeration values that specifies the type of access to allow. * @param options A bitwise combination of the enumeration values that specify options for opening the stream. * @return When this method completes, it returns an IRandomAccessStream that contains the requested random-access stream. */ - openAsync(accessMode: Windows.Storage.FileAccessMode, options: Windows.Storage.StorageOpenOptions): Windows.Foundation.IPromiseWithIAsyncOperation; + openAsync(accessMode: Windows.Storage.FileAccessMode, options: Windows.Storage.StorageOpenOptions): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Opens a read-only, random-access stream over the StorageFile . * @return When this method completes successfully, it returns a read-only, random-access stream (type IRandomAccessStreamWithContentType ). @@ -50029,12 +50029,12 @@ declare namespace Windows { * @param file The file to update. * @return When this method completes, it returns a FileUpdateStatus enum value that describes the status of the updates to the file. */ - static completeUpdatesAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static completeUpdatesAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Lets apps defer real-time updates for a specified file. * @param file The file to defer updates for. */ - static deferUpdates(file: Windows.Storage.StorageFile): void; + static deferUpdates(file: Windows.Storage.IStorageFile): void; } /** Provides a unified interface to the compression features included in Windows that frees developers from responsibility for managing block sizes, compression parameters, and other details that the native compression API requires. */ namespace Compression { @@ -50089,7 +50089,7 @@ declare namespace Windows { * @param buffer The buffer that contains the information to be written to the stream. * @return The asynchronous operation. */ - writeAsync(buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + writeAsync(buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } /** A decompressor takes a stream compressed by a compressor and decompresses it. */ class Decompressor { @@ -50112,7 +50112,7 @@ declare namespace Windows { * @param options Read options * @return The asynchronous operation. */ - readAsync(buffer: Windows.Storage.Streams.Buffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsync(buffer: Windows.Storage.Streams.IBuffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } } /** Specifies what to do if a file or folder with the specified name already exists in the current folder when you create a new file or folder. */ @@ -50215,7 +50215,7 @@ declare namespace Windows { * @param lines The list of text strings to append as lines. * @return No object or value is returned when this method completes. */ - static appendLinesAsync(file: Windows.Storage.StorageFile, lines: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncAction; + static appendLinesAsync(file: Windows.Storage.IStorageFile, lines: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncAction; /** * Appends lines of text to the specified file using the specified character encoding. * @param file The file that the lines are appended to. @@ -50223,14 +50223,14 @@ declare namespace Windows { * @param encoding The character encoding of the file. * @return No object or value is returned when this method completes. */ - static appendLinesAsync(file: Windows.Storage.StorageFile, lines: Windows.Foundation.Collections.IIterable, encoding: Windows.Storage.Streams.UnicodeEncoding): Windows.Foundation.IPromiseWithIAsyncAction; + static appendLinesAsync(file: Windows.Storage.IStorageFile, lines: Windows.Foundation.Collections.IIterable, encoding: Windows.Storage.Streams.UnicodeEncoding): Windows.Foundation.IPromiseWithIAsyncAction; /** * Appends text to the specified file. * @param file The file that the text is appended to. * @param contents The text to append. * @return No object or value is returned when this method completes. */ - static appendTextAsync(file: Windows.Storage.StorageFile, contents: string): Windows.Foundation.IPromiseWithIAsyncAction; + static appendTextAsync(file: Windows.Storage.IStorageFile, contents: string): Windows.Foundation.IPromiseWithIAsyncAction; /** * Appends text to the specified file using the specified character encoding. * @param file The file that the text is appended to. @@ -50238,60 +50238,60 @@ declare namespace Windows { * @param encoding The character encoding of the file. * @return No object or value is returned when this method completes. */ - static appendTextAsync(file: Windows.Storage.StorageFile, contents: string, encoding: Windows.Storage.Streams.UnicodeEncoding): Windows.Foundation.IPromiseWithIAsyncAction; + static appendTextAsync(file: Windows.Storage.IStorageFile, contents: string, encoding: Windows.Storage.Streams.UnicodeEncoding): Windows.Foundation.IPromiseWithIAsyncAction; /** * Reads the contents of the specified file and returns a buffer. * @param file The file to read. * @return When this method completes, it returns an object (type IBuffer ) that represents the contents of the file. */ - static readBufferAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static readBufferAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Reads the contents of the specified file and returns lines of text. * @param file The file to read. * @return When this method completes successfully, it returns the contents of the file as a list (type IVector ) of lines of text. Each line of text in the list is represented by a String object. */ - static readLinesAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation>; + static readLinesAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation>; /** * Reads the contents of the specified file using the specified character encoding and returns lines of text. * @param file The file to read. * @param encoding The character encoding to use. * @return When this method completes successfully, it returns the contents of the file as a list (type IVector ) of lines of text. Each line of text in the list is represented by a String object. */ - static readLinesAsync(file: Windows.Storage.StorageFile, encoding: Windows.Storage.Streams.UnicodeEncoding): Windows.Foundation.IPromiseWithIAsyncOperation>; + static readLinesAsync(file: Windows.Storage.IStorageFile, encoding: Windows.Storage.Streams.UnicodeEncoding): Windows.Foundation.IPromiseWithIAsyncOperation>; /** * Reads the contents of the specified file and returns text. * @param file The file to read. * @return When this method completes successfully, it returns the contents of the file as a text string. */ - static readTextAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static readTextAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Reads the contents of the specified file using the specified character encoding and returns text. * @param file The file to read. * @param encoding The character encoding to use. * @return When this method completes successfully, it returns the contents of the file as a text string. */ - static readTextAsync(file: Windows.Storage.StorageFile, encoding: Windows.Storage.Streams.UnicodeEncoding): Windows.Foundation.IPromiseWithIAsyncOperation; + static readTextAsync(file: Windows.Storage.IStorageFile, encoding: Windows.Storage.Streams.UnicodeEncoding): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Writes data from a buffer to the specified file. * @param file The file that the buffer of data is written to. * @param buffer The buffer that contains the data to write. * @return No object or value is returned when this method completes. */ - static writeBufferAsync(file: Windows.Storage.StorageFile, buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncAction; + static writeBufferAsync(file: Windows.Storage.IStorageFile, buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncAction; /** * Writes an array of bytes of data to the specified file. * @param file The file that the byte is written to. * @param buffer The array of bytes to write. * @return No object or value is returned when this method completes. */ - static writeBytesAsync(file: Windows.Storage.StorageFile, buffer: number[]): Windows.Foundation.IPromiseWithIAsyncAction; + static writeBytesAsync(file: Windows.Storage.IStorageFile, buffer: number[]): Windows.Foundation.IPromiseWithIAsyncAction; /** * Writes lines of text to the specified file. * @param file The file that the lines are written to. * @param lines The list of text strings to write as lines. * @return No object or value is returned when this method completes. */ - static writeLinesAsync(file: Windows.Storage.StorageFile, lines: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncAction; + static writeLinesAsync(file: Windows.Storage.IStorageFile, lines: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncAction; /** * Writes lines of text to the specified file using the specified character encoding. * @param file The file that the lines are written to. @@ -50299,14 +50299,14 @@ declare namespace Windows { * @param encoding The character encoding of the file. * @return No object or value is returned when this method completes. */ - static writeLinesAsync(file: Windows.Storage.StorageFile, lines: Windows.Foundation.Collections.IIterable, encoding: Windows.Storage.Streams.UnicodeEncoding): Windows.Foundation.IPromiseWithIAsyncAction; + static writeLinesAsync(file: Windows.Storage.IStorageFile, lines: Windows.Foundation.Collections.IIterable, encoding: Windows.Storage.Streams.UnicodeEncoding): Windows.Foundation.IPromiseWithIAsyncAction; /** * Writes text to the specified file. * @param file The file that the text is written to. * @param contents The text to write. * @return No object or value is returned when this method completes. */ - static writeTextAsync(file: Windows.Storage.StorageFile, contents: string): Windows.Foundation.IPromiseWithIAsyncAction; + static writeTextAsync(file: Windows.Storage.IStorageFile, contents: string): Windows.Foundation.IPromiseWithIAsyncAction; /** * Writes text to the specified file using the specified character encoding. * @param file The file that the text is written to. @@ -50314,7 +50314,7 @@ declare namespace Windows { * @param encoding The character encoding of the file. * @return No object or value is returned when this method completes. */ - static writeTextAsync(file: Windows.Storage.StorageFile, contents: string, encoding: Windows.Storage.Streams.UnicodeEncoding): Windows.Foundation.IPromiseWithIAsyncAction; + static writeTextAsync(file: Windows.Storage.IStorageFile, contents: string, encoding: Windows.Storage.Streams.UnicodeEncoding): Windows.Foundation.IPromiseWithIAsyncAction; } /** Provides access to the properties of a file. */ namespace FileProperties { @@ -50379,21 +50379,21 @@ declare namespace Windows { * @param file The file from which the geographic metadata is retrieved. * @return An asynchronous operation that returns a Geopoint on successful completion. */ - static getGeotagAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static getGeotagAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Asynchronously sets the geographic metadata of a file from the provided Geopoint . * @param file The file into which the geographic metadata is set. * @param geopoint The Geopoint representing the geographic metadata to be set. * @return An asynchronous action. */ - static setGeotagAsync(file: Windows.Storage.StorageFile, geopoint: Windows.Devices.Geolocation.Geopoint): Windows.Foundation.IPromiseWithIAsyncAction; + static setGeotagAsync(file: Windows.Storage.IStorageFile, geopoint: Windows.Devices.Geolocation.Geopoint): Windows.Foundation.IPromiseWithIAsyncAction; /** * Asynchronously sets the geographic metadata of a file to the device's current location using the provided Geolocator object. * @param file The file into which the geographic metadata is set. * @param geolocator The Geolocator object that will be used to determine the device's current location. * @return An asychronous action. */ - static setGeotagFromGeolocatorAsync(file: Windows.Storage.StorageFile, geolocator: Windows.Devices.Geolocation.Geolocator): Windows.Foundation.IPromiseWithIAsyncAction; + static setGeotagFromGeolocatorAsync(file: Windows.Storage.IStorageFile, geolocator: Windows.Devices.Geolocation.Geolocator): Windows.Foundation.IPromiseWithIAsyncAction; } /** Provides access to the image-related properties of an item (like a file or folder). */ abstract class ImageProperties { @@ -50577,7 +50577,7 @@ declare namespace Windows { * Creates a new stream over the thumbnail that is represented by the current storageItemThumbnail object. * @return The new thumbnail stream. The initial, internal position of the stream is 0. */ - cloneStream(): Windows.Storage.Streams.RandomAccessStream; + cloneStream(): Windows.Storage.Streams.IRandomAccessStream; /** Releases system resources that are exposed by a Windows Runtime object. */ close(): void; /** Gets the MIME content type of the thumbnail image. */ @@ -50612,7 +50612,7 @@ declare namespace Windows { * @param options Specifies the type of the asynchronous read operation. * @return The asynchronous operation. */ - readAsync(buffer: Windows.Storage.Streams.Buffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsync(buffer: Windows.Storage.Streams.IBuffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** Gets a value that indicates whether the thumbnail image returned was a cached version with a smaller size. */ returnedSmallerCachedSize: boolean; /** @@ -50629,7 +50629,7 @@ declare namespace Windows { * @param buffer The buffer into which the asynchronous writer operation writes. * @return The byte writer operation. */ - writeAsync(buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + writeAsync(buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } /** Describes the purpose of the thumbnail to determine how to adjust the thumbnail image to retrieve. */ enum ThumbnailMode { @@ -50851,7 +50851,7 @@ declare namespace Windows { * @param absolutePath The path of the file to read. * @return When this method completes, it returns an object (type IBuffer ) that represents the contents of the file. */ - static readBufferAsync(absolutePath: string): Windows.Foundation.IPromiseWithIAsyncOperation; + static readBufferAsync(absolutePath: string): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Reads the contents of the file at the specified path or URI and returns lines of text. * @param absolutePath The path of the file to read. @@ -50884,7 +50884,7 @@ declare namespace Windows { * @param buffer The buffer that contains the data to write. * @return No object or value is returned when this method completes. */ - static writeBufferAsync(absolutePath: string, buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncAction; + static writeBufferAsync(absolutePath: string, buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncAction; /** * Writes a single byte of data to the file at the specified path or URI. * @param absolutePath The path of the file that the byte is written to. @@ -51205,7 +51205,7 @@ declare namespace Windows { * @param file The file to add to the list of files that the user has chosen. * @return The enumeration value that indicates the result of this addFile method. */ - addFile(id: string, file: Windows.Storage.StorageFile): Windows.Storage.Pickers.Provider.AddFileResult; + addFile(id: string, file: Windows.Storage.IStorageFile): Windows.Storage.Pickers.Provider.AddFileResult; /** Gets a list of file types (extensions) that the user can choose. */ allowedFileTypes: Windows.Foundation.Collections.IVectorView; /** @@ -51213,7 +51213,7 @@ declare namespace Windows { * @param file The file to test. * @return True if the file can be added to the file picker UI; otherwise false. */ - canAddFile(file: Windows.Storage.StorageFile): boolean; + canAddFile(file: Windows.Storage.IStorageFile): boolean; /** * Determines whether the specified file is in the list of files that the user has chosen. * @param id The identifier of the file. @@ -51320,7 +51320,7 @@ declare namespace Windows { */ getDeferral(): Windows.Storage.Pickers.Provider.TargetFileRequestDeferral; /** Gets or sets the IStorageFile object that is provided to represent the file to save by the app that is providing the save location. */ - targetFile: Windows.Storage.StorageFile; + targetFile: Windows.Storage.IStorageFile; } /** Used by an app that provides a save location to indicate asynchronously that the app is finished responding to a targetfilerequested event. */ abstract class TargetFileRequestDeferral { @@ -51364,7 +51364,7 @@ declare namespace Windows { * @param writeMode A value that specifies whether other apps can write to the local file and, if so, whether Windows will request updates after the local file is written. * @param options A value that specifies additional circumstances and behaviors for when Windows requests updates. */ - static setUpdateInformation(file: Windows.Storage.StorageFile, contentId: string, readMode: Windows.Storage.Provider.ReadActivationMode, writeMode: Windows.Storage.Provider.WriteActivationMode, options: Windows.Storage.Provider.CachedFileOptions): void; + static setUpdateInformation(file: Windows.Storage.IStorageFile, contentId: string, readMode: Windows.Storage.Provider.ReadActivationMode, writeMode: Windows.Storage.Provider.WriteActivationMode, options: Windows.Storage.Provider.CachedFileOptions): void; } /** Used to interact with the file picker if your app provides file updates through the Cached File Updater contract. */ abstract class CachedFileUpdaterUI { @@ -51409,7 +51409,7 @@ declare namespace Windows { * Provide a new version of the local file to represent the remote file. * @param value The new version of the local file that will represent remote file. */ - updateLocalFile(value: Windows.Storage.StorageFile): void; + updateLocalFile(value: Windows.Storage.IStorageFile): void; /** Gets or sets a message to the user indicating that user input is needed to complete the FileUpdateRequest . */ userInputNeededMessage: string; } @@ -51530,7 +51530,7 @@ declare namespace Windows { * @param indexableContent The content properties to index. * @return */ - addAsync(indexableContent: Windows.Storage.Search.IndexableContent): any; /* unmapped return type */ + addAsync(indexableContent: Windows.Storage.Search.IIndexableContent): any; /* unmapped return type */ /** * Builds a query with the specified search filter, sort order, and identifies which properties to retrieve. * @param searchFilter The AQS filter. @@ -51586,7 +51586,7 @@ declare namespace Windows { * @param indexableContent The content properties to update. * @return */ - updateAsync(indexableContent: Windows.Storage.Search.IndexableContent): any; /* unmapped return type */ + updateAsync(indexableContent: Windows.Storage.Search.IIndexableContent): any; /* unmapped return type */ } /** Represents a query for content properties in the ContentIndexer . */ abstract class ContentIndexerQuery { @@ -51647,7 +51647,7 @@ declare namespace Windows { /** Gets the content properties. */ properties: Windows.Foundation.Collections.IMap; /** Gets or sets a Stream that provides full-text content. Changes to the actual representation of the item in the index can be made using the ContentIndexer class. */ - stream: Windows.Storage.Streams.RandomAccessStream; + stream: Windows.Storage.Streams.IRandomAccessStream; /** Specifies the type of content in the Stream . */ streamContentType: string; } @@ -51999,7 +51999,7 @@ declare namespace Windows { /** Gets the content properties. */ properties: Windows.Foundation.Collections.IMap; /** Gets or sets a stream that provides full-text content. Changes to the actual representation of the item in the index can be made using the ContentIndexer class. */ - stream: Windows.Storage.Streams.RandomAccessStream; + stream: Windows.Storage.Streams.IRandomAccessStream; /** Specifies the type of content in the Stream . */ streamContentType: string; } @@ -52044,7 +52044,7 @@ declare namespace Windows { * @param thumbnail The thumbnail image for the StorageFile to create. * @return When this method completes, it returns a StorageFile object that represents the new stream of data. */ - static createStreamedFileAsync(displayNameWithExtension: string, dataRequested: Windows.Storage.StreamedFileDataRequestedHandler, thumbnail: Windows.Storage.Streams.RandomAccessStreamReference): Windows.Foundation.IPromiseWithIAsyncOperation; + static createStreamedFileAsync(displayNameWithExtension: string, dataRequested: Windows.Storage.StreamedFileDataRequestedHandler, thumbnail: Windows.Storage.Streams.IRandomAccessStreamReference): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a StorageFile to represent a stream of data from the specified URI resource. This method lets the app download the data on-demand when the StorageFile that represents the stream is first accessed. * @param displayNameWithExtension The user-friendly name of the StorageFile to create, including a file type extension. @@ -52052,7 +52052,7 @@ declare namespace Windows { * @param thumbnail The thumbnail image for the StorageFile to create. * @return When this method completes, it returns a StorageFile object that represents the URI resource. */ - static createStreamedFileFromUriAsync(displayNameWithExtension: string, uri: Windows.Foundation.Uri, thumbnail: Windows.Storage.Streams.RandomAccessStreamReference): Windows.Foundation.IPromiseWithIAsyncOperation; + static createStreamedFileFromUriAsync(displayNameWithExtension: string, uri: Windows.Foundation.Uri, thumbnail: Windows.Storage.Streams.IRandomAccessStreamReference): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Gets a StorageFile object to represent the specified URI app resource. For examples of sample URIs see How to load file resources. * @param uri The URI of the app resource to get a StorageFile to represent. @@ -52072,7 +52072,7 @@ declare namespace Windows { * @param thumbnail The thumbnail image for the StorageFile to create. * @return When this method completes, it returns a StorageFile object that represents the new data stream. Subsequently, this StorageFile object should be used to access file content instead of the file (type IStorageFile ) that was specified to be replace. */ - static replaceWithStreamedFileAsync(fileToReplace: Windows.Storage.StorageFile, dataRequested: Windows.Storage.StreamedFileDataRequestedHandler, thumbnail: Windows.Storage.Streams.RandomAccessStreamReference): Windows.Foundation.IPromiseWithIAsyncOperation; + static replaceWithStreamedFileAsync(fileToReplace: Windows.Storage.IStorageFile, dataRequested: Windows.Storage.StreamedFileDataRequestedHandler, thumbnail: Windows.Storage.Streams.IRandomAccessStreamReference): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Replaces the contents of the file referred to by the specified IStorageFile object with a new data stream of the specified URI. This method lets the app download the data on-demand when the StorageFile that represents the stream is first accessed. * @param fileToReplace The file that the created StorageFile will provide a stream of. @@ -52080,7 +52080,7 @@ declare namespace Windows { * @param thumbnail The thumbnail image for the StorageFile to create. * @return When this method completes, it returns a StorageFile object that represents the streamed file. Subsequently, this StorageFile object should be used to access file content instead of the file (type IStorageFile ) that was specified to be replace. */ - static replaceWithStreamedFileFromUriAsync(fileToReplace: Windows.Storage.StorageFile, uri: Windows.Foundation.Uri, thumbnail: Windows.Storage.Streams.RandomAccessStreamReference): Windows.Foundation.IPromiseWithIAsyncOperation; + static replaceWithStreamedFileFromUriAsync(fileToReplace: Windows.Storage.IStorageFile, uri: Windows.Foundation.Uri, thumbnail: Windows.Storage.Streams.IRandomAccessStreamReference): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets the attributes of a file. */ attributes: Windows.Storage.FileAttributes; /** Gets the MIME type of the contents of the file. */ @@ -52090,7 +52090,7 @@ declare namespace Windows { * @param fileToReplace The file to replace. * @return No object or value is returned when this method completes. */ - copyAndReplaceAsync(fileToReplace: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncAction; + copyAndReplaceAsync(fileToReplace: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncAction; /** * Creates a copy of the file in the specified folder and renames the copy. This method also specifies what to do if a file with the same name already exists in the destination folder. * @param destinationFolder The destination folder where the copy of the file is created. @@ -52098,20 +52098,20 @@ declare namespace Windows { * @param option One of the enumeration values that determines how to handle the collision if a file with the specified desiredNewName already exists in the destination folder. * @return When this method completes, it returns a StorageFile that represents the copy of the file created in the destinationFolder. */ - copyAsync(destinationFolder: Windows.Storage.StorageFolder, desiredNewName: string, option: Windows.Storage.NameCollisionOption): Windows.Foundation.IPromiseWithIAsyncOperation; + copyAsync(destinationFolder: Windows.Storage.IStorageFolder, desiredNewName: string, option: Windows.Storage.NameCollisionOption): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a copy of the file in the specified folder and renames the copy. * @param destinationFolder The destination folder where the copy of the file is created. * @param desiredNewName The new name for the copy of the file created in the destinationFolder. * @return When this method completes, it returns a StorageFile that represents the copy of the file created in the destinationFolder. */ - copyAsync(destinationFolder: Windows.Storage.StorageFolder, desiredNewName: string): Windows.Foundation.IPromiseWithIAsyncOperation; + copyAsync(destinationFolder: Windows.Storage.IStorageFolder, desiredNewName: string): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Creates a copy of the file in the specified folder. * @param destinationFolder The destination folder where the copy of the file is created. * @return When this method completes, it returns a StorageFile that represents the copy of the file created in the destinationFolder. */ - copyAsync(destinationFolder: Windows.Storage.StorageFolder): Windows.Foundation.IPromiseWithIAsyncOperation; + copyAsync(destinationFolder: Windows.Storage.IStorageFolder): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets the date and time when the current file was created. */ dateCreated: Date; /** @@ -52204,20 +52204,20 @@ declare namespace Windows { * @param fileToReplace The file to replace. * @return No object or value is returned by this method. */ - moveAndReplaceAsync(fileToReplace: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncAction; + moveAndReplaceAsync(fileToReplace: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncAction; /** * Moves the current file to the specified folder. * @param destinationFolder The destination folder where the file is moved. * @return No object or value is returned by this method. */ - moveAsync(destinationFolder: Windows.Storage.StorageFolder): Windows.Foundation.IPromiseWithIAsyncAction; + moveAsync(destinationFolder: Windows.Storage.IStorageFolder): Windows.Foundation.IPromiseWithIAsyncAction; /** * Moves the current file to the specified folder and renames the file according to the desired name. * @param destinationFolder The destination folder where the file is moved. * @param desiredNewName The desired name of the file after it is moved. * @return No object or value is returned by this method. */ - moveAsync(destinationFolder: Windows.Storage.StorageFolder, desiredNewName: string): Windows.Foundation.IPromiseWithIAsyncAction; + moveAsync(destinationFolder: Windows.Storage.IStorageFolder, desiredNewName: string): Windows.Foundation.IPromiseWithIAsyncAction; /** * Moves the current file to the specified folder and renames the file according to the desired name. This method also specifies what to do if a file with the same name already exists in the specified folder. * @param destinationFolder The destination folder where the file is moved. @@ -52225,7 +52225,7 @@ declare namespace Windows { * @param option An enum value that determines how Windows responds if the desiredNewName is the same as the name of an existing file in the destination folder. * @return No object or value is returned by this method. */ - moveAsync(destinationFolder: Windows.Storage.StorageFolder, desiredNewName: string, option: Windows.Storage.NameCollisionOption): Windows.Foundation.IPromiseWithIAsyncAction; + moveAsync(destinationFolder: Windows.Storage.IStorageFolder, desiredNewName: string, option: Windows.Storage.NameCollisionOption): Windows.Foundation.IPromiseWithIAsyncAction; /** Gets the name of the file including the file name extension. */ name: string; /** @@ -52233,14 +52233,14 @@ declare namespace Windows { * @param accessMode One of the enumeration values that specifies the type of access to allow. * @return When this method completes, it returns an IRandomAccessStream that contains the requested random-access stream. */ - openAsync(accessMode: Windows.Storage.FileAccessMode): Windows.Foundation.IPromiseWithIAsyncOperation; + openAsync(accessMode: Windows.Storage.FileAccessMode): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Opens a random-access stream with the specified options over the specified file. * @param accessMode One of the enumeration values that specifies the type of access to allow. * @param options A bitwise combination of the enumeration values that specify options for opening the stream. * @return When this method completes, it returns an IRandomAccessStream that contains the requested random-access stream. */ - openAsync(accessMode: Windows.Storage.FileAccessMode, options: Windows.Storage.StorageOpenOptions): Windows.Foundation.IPromiseWithIAsyncOperation; + openAsync(accessMode: Windows.Storage.FileAccessMode, options: Windows.Storage.StorageOpenOptions): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Opens a random-access stream over the current file for reading file contents. * @return When this method completes, it returns the random-access stream (type IRandomAccessStreamWithContentType ). @@ -52635,7 +52635,7 @@ declare namespace Windows { */ commitAsync(): Windows.Foundation.IPromiseWithIAsyncAction; /** Gets the random-access stream used in the transaction. */ - stream: Windows.Storage.Streams.RandomAccessStream; + stream: Windows.Storage.Streams.IRandomAccessStream; } /** Represents a sequential-access output stream that indicates a request for the data stream of a StorageFile that was created by calling CreateStreamedFileAsync or ReplaceWithStreamedFileAsync . */ abstract class StreamedFileDataRequest { @@ -52656,7 +52656,7 @@ declare namespace Windows { * @param buffer The buffer that contains the data to write. * @return When this method completes, it returns the number of bytes (type UInt32 ) that were written to the stream. If the app specifies a function to monitor progress, that function receives the number of bytes (type UInt32) written so far. */ - writeAsync(buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + writeAsync(buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } /** Indicates the reason that data could not be streamed. */ enum StreamedFileFailureMode { @@ -52676,13 +52676,13 @@ declare namespace Windows { * @param input The buffer to be copied. * @return The newly created copy. */ - static createCopyFromMemoryBuffer(input: Windows.Foundation.MemoryBuffer): Windows.Storage.Streams.Buffer; + static createCopyFromMemoryBuffer(input: Windows.Foundation.IMemoryBuffer): Windows.Storage.Streams.Buffer; /** * Creates a MemoryBuffer from an existing IBuffer . * @param input The input IBuffer . * @return The newly created MemoryBuffer . */ - static createMemoryBufferOverIBuffer(input: Windows.Storage.Streams.Buffer): Windows.Foundation.MemoryBuffer; + static createMemoryBufferOverIBuffer(input: Windows.Storage.Streams.IBuffer): Windows.Foundation.MemoryBuffer; /** * Initializes a new instance of the Buffer class with the specified capacity. * @param capacity The maximum number of bytes that the buffer can hold. @@ -52708,7 +52708,7 @@ declare namespace Windows { * @param buffer The buffer. * @return The data reader. */ - static fromBuffer(buffer: Windows.Storage.Streams.Buffer): Windows.Storage.Streams.DataReader; + static fromBuffer(buffer: Windows.Storage.Streams.IBuffer): Windows.Storage.Streams.DataReader; /** * Creates and initializes a new instance of the data reader. * @param inputStream The input stream. @@ -52722,7 +52722,7 @@ declare namespace Windows { * Detaches the buffer that is associated with the data reader. * @return The detached buffer. */ - detachBuffer(): Windows.Storage.Streams.Buffer; + detachBuffer(): Windows.Storage.Streams.IBuffer; /** * Detaches the stream that is associated with the data reader. * @return The detached stream. @@ -52746,7 +52746,7 @@ declare namespace Windows { * @param length The length of the buffer, in bytes. * @return The buffer. */ - readBuffer(length: number): Windows.Storage.Streams.Buffer; + readBuffer(length: number): Windows.Storage.Streams.IBuffer; /** * Reads a byte value from the input stream. * @return The value. @@ -52860,7 +52860,7 @@ declare namespace Windows { * Detaches the buffer that is associated with the data writer. * @return The detached buffer. */ - detachBuffer(): Windows.Storage.Streams.Buffer; + detachBuffer(): Windows.Storage.Streams.IBuffer; /** * Detaches the stream that is associated with the data writer. * @return The detached stream. @@ -52897,12 +52897,12 @@ declare namespace Windows { * @param start The starting byte. * @param count The number of bytes to write. */ - writeBuffer(buffer: Windows.Storage.Streams.Buffer, start: number, count: number): void; + writeBuffer(buffer: Windows.Storage.Streams.IBuffer, start: number, count: number): void; /** * Writes the contents of the specified buffer to the output stream. * @param buffer The buffer. */ - writeBuffer(buffer: Windows.Storage.Streams.Buffer): void; + writeBuffer(buffer: Windows.Storage.Streams.IBuffer): void; /** * Writes a byte value to the output stream. * @param value The value. @@ -53006,7 +53006,7 @@ declare namespace Windows { * @param options Specifies the type of the asynchronous read operation. * @return The asynchronous operation. */ - readAsync(buffer: Windows.Storage.Streams.Buffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsync(buffer: Windows.Storage.Streams.IBuffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } /** Writes data to a file. */ abstract class FileOutputStream { @@ -53022,7 +53022,7 @@ declare namespace Windows { * @param buffer The buffer into which the asynchronous writer operation writes. * @return The byte writer operation. */ - writeAsync(buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + writeAsync(buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } /** Supports reading and writing to a file at a specified position. */ abstract class FileRandomAccessStream { @@ -53034,7 +53034,7 @@ declare namespace Windows { * Creates a new instance of a IRandomAccessStream over the same resource as the current stream. * @return The new stream. The initial, internal position of the stream is 0. */ - cloneStream(): Windows.Storage.Streams.RandomAccessStream; + cloneStream(): Windows.Storage.Streams.IRandomAccessStream; /** Closes the current stream and releases system resources. */ close(): void; /** @@ -53063,7 +53063,7 @@ declare namespace Windows { * @param options Specifies the type of the asynchronous read operation. * @return The asynchronous operation. */ - readAsync(buffer: Windows.Storage.Streams.Buffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsync(buffer: Windows.Storage.Streams.IBuffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Sets the position of the stream to the specified value. * @param position The new position of the stream. @@ -53076,7 +53076,7 @@ declare namespace Windows { * @param buffer The buffer into which the asynchronous writer operation writes. * @return The byte writer operation. */ - writeAsync(buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + writeAsync(buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } /** Provides random access of data in input and output streams that are stored in memory instead of on disk. */ class InMemoryRandomAccessStream { @@ -53090,7 +53090,7 @@ declare namespace Windows { * Creates a new instance of a IRandomAccessStream over the same resource as the current stream. * @return The new stream. The initial, internal position of the stream is 0. */ - cloneStream(): Windows.Storage.Streams.RandomAccessStream; + cloneStream(): Windows.Storage.Streams.IRandomAccessStream; /** Closes the current stream and releases system resources. */ close(): void; /** @@ -53119,7 +53119,7 @@ declare namespace Windows { * @param options Specifies the type of the asynchronous read operation. * @return The asynchronous operation. */ - readAsync(buffer: Windows.Storage.Streams.Buffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsync(buffer: Windows.Storage.Streams.IBuffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Sets the position of the stream to the specified value. * @param position The new position of the stream. @@ -53132,7 +53132,7 @@ declare namespace Windows { * @param buffer The buffer into which the asynchronous writer operation writes. * @return The byte writer operation. */ - writeAsync(buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + writeAsync(buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } /** Specifies the read options for an input stream. */ enum InputStreamOptions { @@ -53154,7 +53154,7 @@ declare namespace Windows { * @param options Specifies the type of the asynchronous read operation. * @return The asynchronous operation. */ - readAsync(buffer: Windows.Storage.Streams.Buffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsync(buffer: Windows.Storage.Streams.IBuffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } /** Provides a Windows Runtime output stream for an IStream base implementation. */ abstract class OutputStreamOverStream { @@ -53170,7 +53170,7 @@ declare namespace Windows { * @param buffer The buffer into which the asynchronous writer operation writes. * @return The byte writer operation. */ - writeAsync(buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + writeAsync(buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } /** Provides random access of data in input and output streams. */ abstract class RandomAccessStream { @@ -53207,7 +53207,7 @@ declare namespace Windows { * Creates a new instance of a IRandomAccessStream over the same resource as the current stream. * @return The new stream. The initial, internal position of the stream is 0. */ - cloneStream(): Windows.Storage.Streams.RandomAccessStream; + cloneStream(): Windows.Storage.Streams.IRandomAccessStream; /** Closes the current stream and releases system resources. */ close(): void; /** @@ -53236,7 +53236,7 @@ declare namespace Windows { * @param options Specifies the type of the asynchronous read operation. * @return The asynchronous operation. */ - readAsync(buffer: Windows.Storage.Streams.Buffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsync(buffer: Windows.Storage.Streams.IBuffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Sets the position of the stream to the specified value. * @param position The new position of the stream. @@ -53249,7 +53249,7 @@ declare namespace Windows { * @param buffer The buffer into which the asynchronous writer operation writes. * @return The byte writer operation. */ - writeAsync(buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + writeAsync(buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; } /** Provides random access of data in input and output streams for a file. */ abstract class RandomAccessStreamReference { @@ -53258,13 +53258,13 @@ declare namespace Windows { * @param file The file to create a stream around. * @return The stream that encapsulates file. */ - static createFromFile(file: Windows.Storage.StorageFile): Windows.Storage.Streams.RandomAccessStreamReference; + static createFromFile(file: Windows.Storage.IStorageFile): Windows.Storage.Streams.RandomAccessStreamReference; /** * Creates a random access stream around the specified stream. * @param stream The source stream. * @return The random access stream that encapsulates stream. */ - static createFromStream(stream: Windows.Storage.Streams.RandomAccessStream): Windows.Storage.Streams.RandomAccessStreamReference; + static createFromStream(stream: Windows.Storage.Streams.IRandomAccessStream): Windows.Storage.Streams.RandomAccessStreamReference; /** * Creates a random access stream around the specified URI. * @param uri The URI to create the stream around. The valid URI schemes are http, https, ms-appx, and ms-appdata. @@ -53295,14 +53295,14 @@ declare namespace Windows { openReadAsync(): Windows.Foundation.IAsyncOperation; } /** Supports random access of data in input and output streams for a specified data format. */ - interface IRandomAccessStreamWithContentType extends Windows.Storage.Streams.RandomAccessStream, Windows.Foundation.IClosable, Windows.Storage.Streams.IInputStream, Windows.Storage.Streams.IOutputStream, Windows.Storage.Streams.IContentTypeProvider {} + interface IRandomAccessStreamWithContentType extends Windows.Storage.Streams.IRandomAccessStream, Windows.Foundation.IClosable, Windows.Storage.Streams.IInputStream, Windows.Storage.Streams.IOutputStream, Windows.Storage.Streams.IContentTypeProvider {} /** Supports random access of data in input and output streams. */ interface IRandomAccessStream extends Windows.Foundation.IClosable, Windows.Storage.Streams.IInputStream, Windows.Storage.Streams.IOutputStream { /** * Creates a new instance of a IRandomAccessStream over the same resource as the current stream. * @return The new stream. The initial, internal position of the stream is 0. */ - cloneStream(): Windows.Storage.Streams.RandomAccessStream; + cloneStream(): Windows.Storage.Streams.IRandomAccessStream; /** * Returns an input stream at a specified location in a stream. * @param position The location in the stream at which to begin. @@ -53345,7 +53345,7 @@ declare namespace Windows { * @param options Specifies the type of the asynchronous read operation. * @return The asynchronous operation. */ - readAsync(buffer: Windows.Storage.Streams.Buffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IAsyncOperationWithProgress; + readAsync(buffer: Windows.Storage.Streams.IBuffer, count: number, options: Windows.Storage.Streams.InputStreamOptions): Windows.Foundation.IAsyncOperationWithProgress; } /** Represents a sequential stream of bytes to be written. */ interface IOutputStream extends Windows.Foundation.IClosable { @@ -53359,7 +53359,7 @@ declare namespace Windows { * @param buffer A buffer that contains the data to be written. * @return The byte writer operation. */ - writeAsync(buffer: Windows.Storage.Streams.Buffer): Windows.Foundation.IAsyncOperationWithProgress; + writeAsync(buffer: Windows.Storage.Streams.IBuffer): Windows.Foundation.IAsyncOperationWithProgress; } /** Characterizes the format of the data. */ interface IContentTypeProvider { @@ -53530,13 +53530,13 @@ declare namespace Windows { path: string; } /** Represents a file. Provides information about the file and its contents, and ways to manipulate them. */ - interface IStorageFile extends Windows.Storage.IStorageItem, Windows.Storage.Streams.RandomAccessStreamReference, Windows.Storage.Streams.IInputStreamReference { + interface IStorageFile extends Windows.Storage.IStorageItem, Windows.Storage.Streams.IRandomAccessStreamReference, Windows.Storage.Streams.IInputStreamReference { /** * Replaces the specified file with a copy of the current file. * @param fileToReplace The file to replace. * @return No object or value is returned when this method completes. */ - copyAndReplaceAsync(fileToReplace: Windows.Storage.StorageFile): Windows.Foundation.IAsyncAction; + copyAndReplaceAsync(fileToReplace: Windows.Storage.IStorageFile): Windows.Foundation.IAsyncAction; /** * Creates a copy of the file in the specified folder, using the desired name. This method also specifies what to do if an existing file in the specified folder has the same name. * @param destinationFolder The destination folder where the copy is created. @@ -53544,32 +53544,32 @@ declare namespace Windows { * @param option An enum value that determines how Windows responds if the desiredNewName is the same as the name of an existing file in the destination folder. * @return When this method completes, it returns a StorageFile that represents the copy. */ - copyAsync(destinationFolder: Windows.Storage.StorageFolder, desiredNewName: string, option: Windows.Storage.NameCollisionOption): Windows.Foundation.IAsyncOperation; + copyAsync(destinationFolder: Windows.Storage.IStorageFolder, desiredNewName: string, option: Windows.Storage.NameCollisionOption): Windows.Foundation.IAsyncOperation; /** * Creates a copy of the file in the specified folder, using the desired name. * @param destinationFolder The destination folder where the copy is created. * @param desiredNewName The desired name of the copy. * @return When this method completes, it returns a StorageFile that represents the copy. */ - copyAsync(destinationFolder: Windows.Storage.StorageFolder, desiredNewName: string): Windows.Foundation.IAsyncOperation; + copyAsync(destinationFolder: Windows.Storage.IStorageFolder, desiredNewName: string): Windows.Foundation.IAsyncOperation; /** * Creates a copy of the file in the specified folder. * @param destinationFolder The destination folder where the copy is created. * @return When this method completes, it returns a StorageFile that represents the copy. */ - copyAsync(destinationFolder: Windows.Storage.StorageFolder): Windows.Foundation.IAsyncOperation; + copyAsync(destinationFolder: Windows.Storage.IStorageFolder): Windows.Foundation.IAsyncOperation; /** * Moves the current file to the location of the specified file and replaces the specified file in that location. * @param fileToReplace The file to replace. * @return No object or value is returned by this method. */ - moveAndReplaceAsync(fileToReplace: Windows.Storage.StorageFile): Windows.Foundation.IAsyncAction; + moveAndReplaceAsync(fileToReplace: Windows.Storage.IStorageFile): Windows.Foundation.IAsyncAction; /** * Moves the current file to the specified folder. * @param destinationFolder The destination folder where the file is moved. * @return No object or value is returned by this method. */ - moveAsync(destinationFolder: Windows.Storage.StorageFolder): Windows.Foundation.IAsyncAction; + moveAsync(destinationFolder: Windows.Storage.IStorageFolder): Windows.Foundation.IAsyncAction; /** * Moves the current file to the specified folder and renames the file according to the desired name. This method also specifies what to do if a file with the same name already exists in the specified folder. * @param destinationFolder The destination folder where the file is moved. @@ -53577,20 +53577,20 @@ declare namespace Windows { * @param option An enum value that determines how Windows responds if the desiredNewName is the same as the name of an existing file in the destination folder. * @return No object or value is returned by this method. */ - moveAsync(destinationFolder: Windows.Storage.StorageFolder, desiredNewName: string, option: Windows.Storage.NameCollisionOption): Windows.Foundation.IAsyncAction; + moveAsync(destinationFolder: Windows.Storage.IStorageFolder, desiredNewName: string, option: Windows.Storage.NameCollisionOption): Windows.Foundation.IAsyncAction; /** * Moves the current file to the specified folder and renames the file according to the desired name. * @param destinationFolder The destination folder where the file is moved. * @param desiredNewName The desired name of the file after it is moved. * @return No object or value is returned by this method. */ - moveAsync(destinationFolder: Windows.Storage.StorageFolder, desiredNewName: string): Windows.Foundation.IAsyncAction; + moveAsync(destinationFolder: Windows.Storage.IStorageFolder, desiredNewName: string): Windows.Foundation.IAsyncAction; /** * Opens a random-access stream over the file. * @param accessMode The type of access to allow. * @return When this method completes, it returns the random-access stream (type IRandomAccessStream ). */ - openAsync(accessMode: Windows.Storage.FileAccessMode): Windows.Foundation.IAsyncOperation; + openAsync(accessMode: Windows.Storage.FileAccessMode): Windows.Foundation.IAsyncOperation; /** * Opens a transacted, random-access stream for writing to the file. * @return When this method completes, it returns a StorageStreamTransaction that contains the random-access stream and methods that can be used to complete transactions. @@ -53906,27 +53906,27 @@ declare namespace Windows { * @param file The file. * @return The launch operation. */ - static launchFileAsync(file: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static launchFileAsync(file: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Starts the default app associated with the specified file, using the specified options. * @param file The file. * @param options The launch options for the app. * @return The launch operation. */ - static launchFileAsync(file: Windows.Storage.StorageFile, options: Windows.System.LauncherOptions): Windows.Foundation.IPromiseWithIAsyncOperation; + static launchFileAsync(file: Windows.Storage.IStorageFile, options: Windows.System.LauncherOptions): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Launches File Explorer with the specified options and displays the contents of the specified folder. * @param folder The folder to display in File Explorer. * @param options Options that specify the amount of screen space that File Explorer fills, and the list of items to select in the specified folder. * @return The result of the operation. */ - static launchFolderAsync(folder: Windows.Storage.StorageFolder, options: Windows.System.FolderLauncherOptions): Windows.Foundation.IPromiseWithIAsyncOperation; + static launchFolderAsync(folder: Windows.Storage.IStorageFolder, options: Windows.System.FolderLauncherOptions): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Launches File Explorer and displays the contents of the specified folder. * @param folder The folder to display in File Explorer. * @return The result of the operation. */ - static launchFolderAsync(folder: Windows.Storage.StorageFolder): Windows.Foundation.IPromiseWithIAsyncOperation; + static launchFolderAsync(folder: Windows.Storage.IStorageFolder): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Starts the default app associated with the URI scheme name for the specified URI. * @param uri The URI. @@ -54263,16 +54263,16 @@ declare namespace Windows { * @param nonce The cryptographic nonce is optional. The nonce is recommended when ASHWID needs to be verified on the cloud against replay attacks. In the scenarios where nonce is desired, the remote server should generate a random nonce and pass it to the client app, and then verify that the signature has the expected nonce once the ASHWID is received from the client system. * @return The hardware Id information. */ - static getPackageSpecificToken(nonce: Windows.Storage.Streams.Buffer): Windows.System.Profile.HardwareToken; + static getPackageSpecificToken(nonce: Windows.Storage.Streams.IBuffer): Windows.System.Profile.HardwareToken; } /** Represents a token that contains a hardware based identification that is sufficiently unique. */ abstract class HardwareToken { /** Gets the certificate that is used to sign the Id and is used to help verify the authenticity of the Id. */ - certificate: Windows.Storage.Streams.Buffer; + certificate: Windows.Storage.Streams.IBuffer; /** Gets the hardware identifier that identifies the device. */ - id: Windows.Storage.Streams.Buffer; + id: Windows.Storage.Streams.IBuffer; /** Gets the digital signature of hardware Id that helps verify the authenticity of returned Id. */ - signature: Windows.Storage.Streams.Buffer; + signature: Windows.Storage.Streams.IBuffer; } /** Identifies the string keys that might exist within the RetailInfo.Properties map of retail-demo relevant property values. */ abstract class KnownRetailInfoProperties { @@ -54422,13 +54422,13 @@ declare namespace Windows { * @param desiredSize The desired size of the user's picture to return. * @return When this method completes, it returns the user's picture. */ - getPictureAsync(desiredSize: Windows.System.UserPictureSize): Windows.Foundation.IPromiseWithIAsyncOperation; + getPictureAsync(desiredSize: Windows.System.UserPictureSize): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Gets properties for the user. * @param values The properties to get. Use the KnownUserProperties class to obtain property names. * @return When this method completes, it returns the requested properties. If a property is missing or unavailable, it is reported as an empty string. */ - getPropertiesAsync(values: Windows.Foundation.Collections.IVectorView): Windows.Foundation.IPromiseWithIAsyncOperation; + getPropertiesAsync(values: Windows.Foundation.Collections.IVectorView): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Gets a property for the user. Use the KnownUserProperties class to obtain property names. * @param value The property to get. @@ -54553,7 +54553,7 @@ declare namespace Windows { * Gets the current lock screen image as a data stream. * @return The stream that contains the lock screen image data. */ - static getImageStream(): Windows.Storage.Streams.RandomAccessStream; + static getImageStream(): Windows.Storage.Streams.IRandomAccessStream; /** Gets the current lock screen image. */ static originalImageFile: Windows.Foundation.Uri; /** @@ -54567,13 +54567,13 @@ declare namespace Windows { * @param value The StorageFile object that contains the new image for the lock screen. * @return The object used to set the image for the lock screen. */ - static setImageFileAsync(value: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncAction; + static setImageFileAsync(value: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncAction; /** * Sets the lock screen image from a data stream. * @param value The stream that contains the image data. * @return The object used to set the lock screen image. */ - static setImageStreamAsync(value: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncAction; + static setImageStreamAsync(value: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncAction; /** * Unregisters the image feed being used in the lock screen slideshow, stopping the slideshow. (Windows 8.1 only) * @return true if the image feed was disabled; otherwise, false. @@ -54613,7 +54613,7 @@ declare namespace Windows { * @param kind An enumeration that you can use to determine what type of image you want (small, large, and so on). * @return An object that contains the image. */ - static getAccountPicture(kind: Windows.System.UserProfile.AccountPictureKind): Windows.Storage.StorageFile; + static getAccountPicture(kind: Windows.System.UserProfile.AccountPictureKind): Windows.Storage.IStorageFile; /** * Gets the display name for the user account. * @return The display name for the user account. @@ -54655,13 +54655,13 @@ declare namespace Windows { * @param image A file that contains the image. * @return A value that indicates the success or failure of the operation. */ - static setAccountPictureAsync(image: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static setAccountPictureAsync(image: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Sets the picture for the user's account using an IRandomAccessStream object. * @param image The image. * @return A value that indicates the success or failure of the operation. */ - static setAccountPictureFromStreamAsync(image: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; + static setAccountPictureFromStreamAsync(image: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Sets the pictures for the user's account using an IStorageFile object. Supports adding a small image, large image, and video. * @param smallImage A small version of the image. @@ -54669,7 +54669,7 @@ declare namespace Windows { * @param video A video. * @return A value that indicates the success or failure of the operation. */ - static setAccountPicturesAsync(smallImage: Windows.Storage.StorageFile, largeImage: Windows.Storage.StorageFile, video: Windows.Storage.StorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; + static setAccountPicturesAsync(smallImage: Windows.Storage.IStorageFile, largeImage: Windows.Storage.IStorageFile, video: Windows.Storage.IStorageFile): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Sets the pictures for the user's account using an IRandomAccessStream object. Supports adding a small image, large image, and video. * @param smallImage A small version of the image. @@ -54677,7 +54677,7 @@ declare namespace Windows { * @param video A video. * @return A value that indicates the success or failure of the operation. */ - static setAccountPicturesFromStreamsAsync(smallImage: Windows.Storage.Streams.RandomAccessStream, largeImage: Windows.Storage.Streams.RandomAccessStream, video: Windows.Storage.Streams.RandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; + static setAccountPicturesFromStreamsAsync(smallImage: Windows.Storage.Streams.IRandomAccessStream, largeImage: Windows.Storage.Streams.IRandomAccessStream, video: Windows.Storage.Streams.IRandomAccessStream): Windows.Foundation.IPromiseWithIAsyncOperation; static addEventListener(type: string, listener: Windows.Foundation.EventHandler): void; static removeEventListener(type: string, listener: Windows.Foundation.EventHandler): void; } @@ -55626,7 +55626,7 @@ declare namespace Windows { */ constructor(effect: Windows.UI.Core.AnimationMetrics.AnimationEffect, target: Windows.UI.Core.AnimationMetrics.AnimationEffectTarget); /** Gets the collection of animations that are associated with the AnimationDescription object. */ - animations: Windows.Foundation.Collections.IVectorView; + animations: Windows.Foundation.Collections.IVectorView; /** Gets the maximum cumulative delay time for the animation to be applied to the collection of objects in a target. */ delayLimit: number; /** Gets the amount of time between the application of the animation effect to each object in a target that contains multiple objects. The StaggerDelay, together with the StaggerDelayFactor and DelayLimit, is one of the three elements used to control the relative timing of the animation effects. */ @@ -57706,7 +57706,7 @@ declare namespace Windows { /** Gets or sets the index of the command you want to use as the cancel command. This is the command that fires when users press the ESC key. */ cancelCommandIndex: number; /** Gets an array of commands that appear in the command bar of the message dialog. These commands makes the dialog actionable. */ - commands: Windows.Foundation.Collections.IVector; + commands: Windows.Foundation.Collections.IVector; /** Gets or sets the message to be displayed to the user. */ content: string; /** Gets or sets the index of the command you want to use as the default. This is the command that fires by default when users press the ENTER key. */ @@ -57717,7 +57717,7 @@ declare namespace Windows { * Begins an asynchronous operation showing a dialog. * @return An object that represents the asynchronous operation. For more on the async pattern, see Asynchronous programming. */ - showAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + showAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; /** Gets or sets the title to display on the dialog, if any. */ title: string; } @@ -57746,26 +57746,26 @@ declare namespace Windows { /** Creates a new instance of the PopupMenu class. */ constructor(); /** Gets the commands for the context menu. */ - commands: Windows.Foundation.Collections.IVector; + commands: Windows.Foundation.Collections.IVector; /** * Shows the context menu at the specified client coordinates. * @param invocationPoint The coordinates (in DIPs), relative to the window, of the user's finger or mouse pointer when the oncontextmenu event fired. The menu is placed above and centered on this point. * @return A IUICommand object that represents the context menu command that was invoked by the user, after the ShowAsync call completes. */ - showAsync(invocationPoint: Windows.Foundation.Point): Windows.Foundation.IPromiseWithIAsyncOperation; + showAsync(invocationPoint: Windows.Foundation.Point): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Shows the context menu above the specified selection. * @param selection The coordinates (in DIPs) of the selected rectangle, relative to the window. The context menu is placed directly above and centered on this rectangle such that selection is not covered. * @return A IUICommand object that represents the context menu command invoked by the user, after the ShowForSelectionAsync call completes. */ - showForSelectionAsync(selection: Windows.Foundation.Rect): Windows.Foundation.IPromiseWithIAsyncOperation; + showForSelectionAsync(selection: Windows.Foundation.Rect): Windows.Foundation.IPromiseWithIAsyncOperation; /** * Shows the context menu in the preferred placement relative to the specified selection. * @param selection The coordinates (in DIPs) of the selected rectangle, relative to the window. * @param preferredPlacement The preferred placement of the context menu relative to the selection rectangle. * @return A IUICommand object that represents the context menu command invoked by the user, after the ShowForSelectionAsync call completes. */ - showForSelectionAsync(selection: Windows.Foundation.Rect, preferredPlacement: Windows.UI.Popups.Placement): Windows.Foundation.IPromiseWithIAsyncOperation; + showForSelectionAsync(selection: Windows.Foundation.Rect, preferredPlacement: Windows.UI.Popups.Placement): Windows.Foundation.IPromiseWithIAsyncOperation; } /** Represents a command in a context menu. */ class UICommand { @@ -57808,7 +57808,7 @@ declare namespace Windows { label: string; } /** Represents a callback function that handles the event that is fired when the user invokes a context menu command. */ - type UICommandInvokedHandler = (command: Windows.UI.Popups.UICommand) => void; + type UICommandInvokedHandler = (command: Windows.UI.Popups.IUICommand) => void; /** Represents a command in a context menu or message dialog box. */ interface IUICommand { /** Gets or sets the identifier of the command. */ @@ -59857,7 +59857,7 @@ declare namespace Windows { /** Represents an instance of a background task that has been triggered to run. */ abstract class WebUIBackgroundTaskInstance { /** Gets the current background task. */ - static current: Windows.UI.WebUI.WebUIBackgroundTaskInstance; + static current: Windows.UI.WebUI.IWebUIBackgroundTaskInstance; } /** Provides access to an instance of a background task. */ abstract class WebUIBackgroundTaskInstanceRuntimeClass { @@ -60421,11 +60421,11 @@ declare namespace Windows { /** Represents a method that handles the app activation event. */ type ActivatedEventHandler = (ev: Windows.ApplicationModel.Activation.IActivatedEventArgs & WinRTEvent) => void; /** Represents a method that handles the app navigation event. */ - type NavigatedEventHandler = (ev: Windows.UI.WebUI.WebUINavigatedEventArgs & WinRTEvent) => void; + type NavigatedEventHandler = (ev: Windows.UI.WebUI.IWebUINavigatedEventArgs & WinRTEvent) => void; /** Represents a method that handles the app resumption event. */ type ResumingEventHandler = (ev: WinRTEvent) => void; /** Represents a method that handles the app suspension event. */ - type SuspendingEventHandler = (ev: Windows.ApplicationModel.SuspendingEventArgs & WinRTEvent) => void; + type SuspendingEventHandler = (ev: Windows.ApplicationModel.ISuspendingEventArgs & WinRTEvent) => void; /** Provides access to an instance of a background task. */ interface IWebUIBackgroundTaskInstance { /** Gets or sets the success value for the background task. The success value is what is returned to the foreground instance of your app in the completed event. */ @@ -60610,7 +60610,7 @@ declare namespace Windows { /** Gets the collection of atom:category elements within the app:categories element. */ categories: Windows.Foundation.Collections.IVectorView; /** Gets the list of child elements within the element. */ - elementExtensions: Windows.Foundation.Collections.IVector; + elementExtensions: Windows.Foundation.Collections.IVector; /** * Generates the DOM object that represents this element, and all the attributes and child elements including foreign markups. * @param format The format of the element. The only formats accepted by this method are Atom 1.0 and RSS 2.0. @@ -60626,7 +60626,7 @@ declare namespace Windows { /** Gets or sets the text content of the element. If the element contains only child elements, this attribute is NULL. */ nodeValue: string; /** Gets the atom:title element under the app:collection element. */ - title: Windows.Web.Syndication.SyndicationText; + title: Windows.Web.Syndication.ISyndicationText; /** Gets the Uniform Resource Identifier (URI) representing the href attribute of the app:collection element. This is the absolute URI resolved against the xml:base attribute when it is present. If the href attribute is a relative URI string and there is no xml:base attribute, this property will be Null. */ uri: Windows.Foundation.Uri; } @@ -60637,7 +60637,7 @@ declare namespace Windows { /** Gets or sets the Uniform Resource Identifier (URI) for the element. This property represents the xml:base attribute on the element. It may be inherited from an ancestor element. */ baseUri: Windows.Foundation.Uri; /** Gets the list of child elements within the element. */ - elementExtensions: Windows.Foundation.Collections.IVector; + elementExtensions: Windows.Foundation.Collections.IVector; /** * Generates the DOM object that represents this element, and all the attributes and child elements including foreign markups. * @param format The format of the element. The only formats accepted by this method are Atom 1.0 and RSS 2.0. @@ -60664,7 +60664,7 @@ declare namespace Windows { /** Gets the read-only collection of app:collection elements within the app:workspace element. */ collections: Windows.Foundation.Collections.IVectorView; /** Gets the list of child elements within the element. */ - elementExtensions: Windows.Foundation.Collections.IVector; + elementExtensions: Windows.Foundation.Collections.IVector; /** * Generates the DOM object that represents this element, and all the attributes and child elements including foreign markups. * @param format The format for the element. The only formats accepted by this method are Atom 1.0 and RSS 2.0. @@ -60680,7 +60680,7 @@ declare namespace Windows { /** Gets or sets the text content of the element. If the element contains only child elements, this attribute is NULL. */ nodeValue: string; /** Gets the atom:title element under the app:workspace element. */ - title: Windows.Web.Syndication.SyndicationText; + title: Windows.Web.Syndication.ISyndicationText; } } /** Provides a modern HTTP client API for Windows Store apps. */ @@ -61500,7 +61500,7 @@ declare namespace Windows { /** Gets or sets the value of the HTTP Content-Location header on the HTTP content. */ contentLocation: Windows.Foundation.Uri; /** Gets or sets the value of an HTTP Content-MD5 header on the HTTP content. */ - contentMD5: Windows.Storage.Streams.Buffer; + contentMD5: Windows.Storage.Streams.IBuffer; /** Gets or sets the HttpContentRangeHeaderValue object that represent the value of an HTTP Content-Range header on the HTTP content. */ contentRange: Windows.Web.Http.Headers.HttpContentRangeHeaderValue; /** Gets or sets the HttpMediaTypeHeaderValue object that represent the value of an HTTP Content-Type header on the HTTP content. */ @@ -62810,14 +62810,14 @@ declare namespace Windows { * Initializes a new instance of the HttpBufferContent class with the specified buffer. * @param content The content used to initialize the HttpBufferContent . */ - constructor(content: Windows.Storage.Streams.Buffer); + constructor(content: Windows.Storage.Streams.IBuffer); /** * Initializes a new instance of the HttpBufferContent class with an offset and count of bytes from the specified buffer. * @param content The content used to initialize the HttpBufferContent . * @param offset The offset in bytes from the beginning of the content buffer to initialize the HttpBufferContent . * @param count The count of bytes in the content buffer to initialize the HttpBufferContent . */ - constructor(content: Windows.Storage.Streams.Buffer, offset: number, count: number); + constructor(content: Windows.Storage.Streams.IBuffer, offset: number, count: number); /** * Serialize the HttpBufferContent into memory as an asynchronous operation. * @return The object that represents the asynchronous operation. @@ -62831,7 +62831,7 @@ declare namespace Windows { * Serialize the HttpBufferContent to a buffer as an asynchronous operation. * @return The object that represents the asynchronous operation. */ - readAsBufferAsync(): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsBufferAsync(): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Serialize the HttpBufferContent and return an input stream that represents the content as an asynchronous operation. * @return The object that represents the asynchronous operation. @@ -62891,7 +62891,7 @@ declare namespace Windows { * @param uri The Uri the request is sent to. * @return The object representing the asynchronous operation. */ - getBufferAsync(uri: Windows.Foundation.Uri): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + getBufferAsync(uri: Windows.Foundation.Uri): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Send a GET request to the specified Uri and return the response body as a stream in an asynchronous operation. * @param uri The Uri the request is sent to. @@ -63040,7 +63040,7 @@ declare namespace Windows { * Serialize the HttpFormUrlEncodedContent to a buffer as an asynchronous operation. * @return The object representing the asynchronous operation. */ - readAsBufferAsync(): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsBufferAsync(): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Serialize the HttpFormUrlEncodedContent and return an input stream that represents the content as an asynchronous operation. * @return The object representing the asynchronous operation. @@ -63125,7 +63125,7 @@ declare namespace Windows { * Serialize the HttpMultipartContent to a buffer as an asynchronous operation. * @return The object representing the asynchronous operation. */ - readAsBufferAsync(): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsBufferAsync(): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Serialize the HttpMultipartContent and return an input stream that represents the content as an asynchronous operation. * @return The object representing the asynchronous operation. @@ -63193,7 +63193,7 @@ declare namespace Windows { * Serialize the HttpMultipartFormDataContent to a buffer as an asynchronous operation. * @return The object representing the asynchronous operation. */ - readAsBufferAsync(): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsBufferAsync(): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Serialize the HttpMultipartFormDataContent and return an input stream that represents the content as an asynchronous operation. * @return The object representing the asynchronous operation. @@ -63445,7 +63445,7 @@ declare namespace Windows { * Serialize the HttpStreamContent to a buffer as an asynchronous operation. * @return The object representing the asynchronous operation. */ - readAsBufferAsync(): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsBufferAsync(): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Serialize the HttpStreamContent and return an input stream that represents the content as an asynchronous operation. * @return The object representing the asynchronous operation. @@ -63501,7 +63501,7 @@ declare namespace Windows { * Serialize the HttpStringContent to a buffer as an asynchronous operation. * @return The object that represents the asynchronous operation. */ - readAsBufferAsync(): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + readAsBufferAsync(): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; /** * Serialize the HttpStringContent and return an input stream that represents the content as an asynchronous operation. * @return The object that represents the asynchronous operation. @@ -63572,7 +63572,7 @@ declare namespace Windows { * Serialize the HTTP content to a buffer as an asynchronous operation. * @return The object representing the asynchronous operation. */ - readAsBufferAsync(): Windows.Foundation.IAsyncOperationWithProgress; + readAsBufferAsync(): Windows.Foundation.IAsyncOperationWithProgress; /** * Serialize the HTTP content and return an input stream that represents the content as an asynchronous operation. * @return The object representing the asynchronous operation. @@ -63639,7 +63639,7 @@ declare namespace Windows { /** Gets or sets the base URI for the element. This property represents the xml:base attribute on the element. It may be inherited from an ancestor element. */ baseUri: Windows.Foundation.Uri; /** Gets the list of child elements within the element. */ - elementExtensions: Windows.Foundation.Collections.IVector; + elementExtensions: Windows.Foundation.Collections.IVector; /** * Generates the DOM object that represents this element, all the attributes and child elements including foreign markups. The only formats accepted by this method are Atom 1.0 and RSS 2.0. * @param format The format of the data. @@ -63713,7 +63713,7 @@ declare namespace Windows { /** Gets or sets the base URI for the element. This property represents the xml:base attribute on the element. It may be inherited from an ancestor element. */ baseUri: Windows.Foundation.Uri; /** Gets the list of child elements within the element. */ - elementExtensions: Windows.Foundation.Collections.IVector; + elementExtensions: Windows.Foundation.Collections.IVector; /** * Generates the DOM object that represents this element, all the attributes and child elements including foreign markups. The only formats accepted by this method are Atom 1.0 and RSS 2.0. * @param format The format of the data. @@ -63783,7 +63783,7 @@ declare namespace Windows { /** Gets a collection of the contributors of the feed. This property represents the collection of all the atom:contributor elements under atom:feed. */ contributors: Windows.Foundation.Collections.IVector; /** Gets the list of child elements within the element. */ - elementExtensions: Windows.Foundation.Collections.IVector; + elementExtensions: Windows.Foundation.Collections.IVector; /** Gets the first Uniform Resource Identifier (URI) in a sequence. This property represents the atom:link element with attribute rel=”first”. */ firstUri: Windows.Foundation.Uri; /** Gets or sets the generator of the feed. This property represents the atom:generator element or the generator element in RSS 2.0. */ @@ -63831,13 +63831,13 @@ declare namespace Windows { /** Gets the previous Uniform Resource Identifier (URI) in the sequence. This property represents the atom:link element with attribute rel="previous". */ previousUri: Windows.Foundation.Uri; /** Gets or sets information about the rights for the feed. This property represents the atom:rights element or the copyright element in RSS 2.0. */ - rights: Windows.Web.Syndication.SyndicationText; + rights: Windows.Web.Syndication.ISyndicationText; /** Gets the format of the source document. If the object is not loaded from a document, this property will return SyndicationFormat_Atom10. */ sourceFormat: Windows.Web.Syndication.SyndicationFormat; /** Gets or sets the subtitle of the feed. This property represents the atom:subtitle element or the description element in RSS 2.0. */ - subtitle: Windows.Web.Syndication.SyndicationText; + subtitle: Windows.Web.Syndication.ISyndicationText; /** Gets or sets the title of the syndication feed. */ - title: Windows.Web.Syndication.SyndicationText; + title: Windows.Web.Syndication.ISyndicationText; } /** Specifies the syndication formats supported by the API. */ enum SyndicationFormat { @@ -63868,7 +63868,7 @@ declare namespace Windows { /** Gets or sets the base URI for the element. This property represents the xml:base attribute on the element. It may be inherited from an ancestor element. */ baseUri: Windows.Foundation.Uri; /** Gets the list of child elements within the element. */ - elementExtensions: Windows.Foundation.Collections.IVector; + elementExtensions: Windows.Foundation.Collections.IVector; /** * Generates the DOM object that represents this element, all the attributes and child elements including foreign markups. The only formats accepted by this method are Atom 1.0 and RSS 2.0. * @param format The format of the data. @@ -63920,7 +63920,7 @@ declare namespace Windows { /** Gets the Uniform Resource Identifier (URI) of an editable resource. */ editUri: Windows.Foundation.Uri; /** Gets the list of child elements within the element. */ - elementExtensions: Windows.Foundation.Collections.IVector; + elementExtensions: Windows.Foundation.Collections.IVector; /** Gets an ETag HTTP header. */ etag: string; /** @@ -63958,13 +63958,13 @@ declare namespace Windows { /** Gets or sets the date the item was published. */ publishedDate: Date; /** Gets or sets information about the rights of an item. This property represents the atom:rights element. */ - rights: Windows.Web.Syndication.SyndicationText; + rights: Windows.Web.Syndication.ISyndicationText; /** Gets or sets the source feed of the item. This property represents the atom:source element or the source element in RSS 2.0. */ source: Windows.Web.Syndication.SyndicationFeed; /** Gets or sets a summary of the item. */ - summary: Windows.Web.Syndication.SyndicationText; + summary: Windows.Web.Syndication.ISyndicationText; /** Gets or sets the title of the item. */ - title: Windows.Web.Syndication.SyndicationText; + title: Windows.Web.Syndication.ISyndicationText; } /** Represents a link within a syndication feed or item. This class encapsulates information in the /rss/channel/link or / rss/channel/item/link element in RSS 2.0 or the atom:link element in Atom 1.0. */ class SyndicationLink { @@ -63989,7 +63989,7 @@ declare namespace Windows { /** Gets or sets the base URI for the element. This property represents the xml:base attribute on the element. It may be inherited from an ancestor element. */ baseUri: Windows.Foundation.Uri; /** Gets the list of child elements within the element. */ - elementExtensions: Windows.Foundation.Collections.IVector; + elementExtensions: Windows.Foundation.Collections.IVector; /** * Generates the DOM object that represents this element, all the attributes and child elements including foreign markups. The only formats accepted by this method are Atom 1.0 and RSS 2.0. * @param format The format of the data. @@ -64033,7 +64033,7 @@ declare namespace Windows { /** Gets or sets the base URI for the element. This property represents the xml:base attribute on the element. It may be inherited from an ancestor element. */ baseUri: Windows.Foundation.Uri; /** Gets the list of child elements within the element. */ - elementExtensions: Windows.Foundation.Collections.IVector; + elementExtensions: Windows.Foundation.Collections.IVector; /** * Generates the DOM object that represents this element, all the attributes and child elements including foreign markups. The only formats accepted by this method are Atom 1.0 and RSS 2.0. * @param format The format of the data. @@ -64070,7 +64070,7 @@ declare namespace Windows { /** Gets or sets the base URI for the element. This property represents the xml:base attribute on the element. It may be inherited from an ancestor element. */ baseUri: Windows.Foundation.Uri; /** Gets the list of child elements within the element. */ - elementExtensions: Windows.Foundation.Collections.IVector; + elementExtensions: Windows.Foundation.Collections.IVector; /** Gets or sets the email address of the person. */ email: string; /** @@ -64112,7 +64112,7 @@ declare namespace Windows { /** Gets or sets the base URI for the element. This property represents the xml:base attribute on the element. It may be inherited from an ancestor element. */ baseUri: Windows.Foundation.Uri; /** Gets the list of child elements within the element. */ - elementExtensions: Windows.Foundation.Collections.IVector; + elementExtensions: Windows.Foundation.Collections.IVector; /** * Generates the DOM object that represents this element, all the attributes and child elements including foreign markups. The only formats accepted by this method are Atom 1.0 and RSS 2.0. * @param format The format of the data. @@ -64174,7 +64174,7 @@ declare namespace Windows { /** Gets or sets the base URI for the element. This property represents the xml:base attribute on the element. It may be inherited from an ancestor element. */ baseUri: Windows.Foundation.Uri; /** Gets the list of child elements within the element. */ - elementExtensions: Windows.Foundation.Collections.IVector; + elementExtensions: Windows.Foundation.Collections.IVector; /** Gets or sets the language of the element. This property represents the xml:lang attribute on the element. It may be inherited from an ancestor element. It must be valid according to XML 1.0. */ language: string; /** Gets or sets the local name of the element. */ @@ -64185,7 +64185,7 @@ declare namespace Windows { nodeValue: string; } /** Represents text, HTML, or XHTML content. This interface encapsulates elements in RSS 2.0 or Atom 1.0 that can have either text, HTML, or XHTML content. In Atom 1.0 this interface maps to an atomTextConstruct in the schema, which can be element atom:title, atom:subtitle, atom:rights or atom:summary. */ - interface ISyndicationText extends Windows.Web.Syndication.SyndicationNode { + interface ISyndicationText extends Windows.Web.Syndication.ISyndicationNode { /** Gets or sets the content of a text content construct like atom:title. */ text: string; /** Gets or sets the type of the content. */ From 0814eae6f8175d16a33f6035851e5f0f412a25fc Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 3 Jan 2016 20:05:16 +0500 Subject: [PATCH 201/441] lodash: signatures of _.bindKey have been changed --- lodash/lodash-tests.ts | 89 ++++++++++++++++++++++++++++++++++++------ lodash/lodash.d.ts | 65 +++++++++++++++++++++--------- 2 files changed, 123 insertions(+), 31 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2b..df1ea3f07f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5065,24 +5065,87 @@ module TestBindAll { } } -var objectBindKey = { - 'name': 'moe', - 'greet': function (greeting: string) { - return greeting + ' ' + this.name; +// _.bindKey +module TestBindKey { + let object: { + foo: (a: number, b: string) => boolean; } -}; -var funcBindKey: Function = _.bindKey(objectBindKey, 'greet', 'hi'); -funcBindKey(); + { + type SampleResult = (a: number, b: string) => boolean; -objectBindKey.greet = function (greeting) { - return greeting + ', ' + this.name + '!'; -}; + let result: SampleResult; -funcBindKey(); + result = _.bindKey(object, 'foo'); + result = _.bindKey(object, 'foo'); + } -funcBindKey = _(objectBindKey).bindKey('greet', 'hi').value(); -funcBindKey(); + { + type SampleResult = (b: string) => boolean; + + let result: SampleResult; + + result = _.bindKey(object, 'foo', 42); + result = _.bindKey(object, 'foo', 42); + } + + { + type SampleResult = () => boolean; + + let result: SampleResult; + + result = _.bindKey(object, 'foo', 42, ''); + result = _.bindKey(object, 'foo', 42, ''); + } + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).bindKey('foo'); + } + + { + type SampleResult = (b: string) => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).bindKey('foo', 42); + } + + { + type SampleResult = () => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).bindKey('foo', 42, ''); + } + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().bindKey('foo'); + } + + { + type SampleResult = (b: string) => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().bindKey('foo', 42); + } + + { + type SampleResult = () => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().bindKey('foo', 42, ''); + } +} // _.compose module TestCompose { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c45ec90eea..f533e6f1f9 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8620,30 +8620,59 @@ declare module _ { } //_.bindKey + interface FunctionBindKey { + placeholder: any; + + ( + object: T, + key: any, + ...partials: any[] + ): TResult; + + ( + object: Object, + key: any, + ...partials: any[] + ): TResult; + } + interface LoDashStatic { /** - * Creates a function that, when called, invokes the method at object[key] and prepends any - * additional bindKey arguments to those provided to the bound function. This method differs - * from _.bind by allowing bound functions to reference methods that will be redefined or don't - * yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. - * @param object The object the method belongs to. - * @param key The key of the method. - * @param args Arguments to be partially applied. - * @return The new bound function. - **/ - bindKey( - object: T, - key: string, - ...args: any[]): Function; + * Creates a function that invokes the method at object[key] and prepends any additional _.bindKey arguments + * to those provided to the bound function. + * + * This method differs from _.bind by allowing bound functions to reference methods that may be redefined + * or don’t yet exist. See Peter Michaux’s article for more details. + * + * The _.bindKey.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder + * for partially applied arguments. + * + * @param object The object the method belongs to. + * @param key The key of the method. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + bindKey: FunctionBindKey; } interface LoDashImplicitObjectWrapper { /** - * @see _.bindKey - **/ - bindKey( - key: string, - ...args: any[]): LoDashImplicitObjectWrapper; + * @see _.bindKey + */ + bindKey( + key: any, + ...partials: any[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bindKey + */ + bindKey( + key: any, + ...partials: any[] + ): LoDashExplicitObjectWrapper; } //_.compose From c7d3aaed8899816da654bdfcb40339700ee2b6e0 Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Sun, 3 Jan 2016 16:40:10 +0100 Subject: [PATCH 202/441] keyboardjs updated to latest version --- keyboardjs/keyboardjs.d.ts | 173 +++++++++++++++++++++++++++---------- 1 file changed, 129 insertions(+), 44 deletions(-) diff --git a/keyboardjs/keyboardjs.d.ts b/keyboardjs/keyboardjs.d.ts index dfafd30a8a..6a5c10f962 100644 --- a/keyboardjs/keyboardjs.d.ts +++ b/keyboardjs/keyboardjs.d.ts @@ -1,50 +1,135 @@ -// Type definitions for KeyboardJS +// Type definitions for KeyboardJS v2.2.0 // Project: https://github.com/RobertWHurst/KeyboardJS -// Definitions by: Vincent Bortone +// Definitions by: David Asmuth // Definitions: https://github.com/borisyankov/DefinitelyTyped -// A JavaScript library for binding keyboard combos without the pain of key codes and key combo conflicts. +// KeyboardJS is a library for use in the browser (node.js compatible). +// It Allows developers to easily setup key bindings. Use key combos to setup complex bindings. +// KeyboardJS also provides contexts. Contexts are great for single page applications. +// They allow you to scope your bindings to various parts of your application. +// Out of the box keyboardJS uses a US keyboard locale. If you need support for +// a different type of keyboard KeyboardJS provides custom locale support so you can create +// with a locale that better matches your needs. -interface KeyboardJSSubBinding { - clear(): void; +declare module keyboardjs { + + /** + * Information and functions in the current callback. + */ + interface KeyEvent{ + preventRepeat(): void; + } + + /** + * Callback function when a keyCombo is triggered. + * @see KeyEvent + */ + interface Callback { + /** + * Keyevent + */ + (e: KeyEvent): void; + } + + // ---------- Key Binding ---------- // + + /** + * Binds a keyCombo to specific callback functions. + * @param keyCombo String of keys to be pressed to execute callbacks. + * @param pressed Callback that gets execute when the keyCombostate is 'pressed', can be null. + * @param released Callback that gets execute when the keyCombostate is 'released' + */ + export function bind(keyCombo: string, pressed: Callback, released: Callback): void; + /** + * Binds a keyCombo to specific callback functions. + * @param keyCombo String of keys to be pressed to execute callbacks. + * @param pressed Callback that gets executed when the keyCombostate is 'pressed' + */ + export function bind(keyCombo: string, pressed: Callback): void; + + + /** + * Unbinds a keyCombo + * @param keyCombo String of keys to be pressed to execute callbacks. + */ + export function unbind(keyCombo: string): void; + + // ---------- Context ---------- // + + /** + * Sets the context KeyboardJS operates in. Default is global context. + * Bindings in global context will execute in all contexts. + * @param identifier The name of the context. If the context doesn't exists, it will be created. + * Use 'global' to switch to global context. + */ + export function setContext(identifier: string): void; + /** + * Executes a Callback without loosing the current context. + * @param identifier The name of the context the callback should be in. If the context doesn't exists, it will be created. + * @param inContextCallBack The callback function. Will be executed in the given context. + */ + export function withContext(identifier: string, inContextCallBack: () => void): void; + /** + * Returns the context KeyboardJS currently operates in. + */ + export function getContext(): string; + + // ---------- KeyboardJS Control ---------- // + + /** + * The keyboard will no longer trigger bindings. + */ + export function pause(): void; + /** + * The keyboard will once again trigger bindings. + */ + export function resume(): void; + /** + * All active bindings will released and unbound. + */ + export function reset(): void; + + // ---------- Virtual Key Press ---------- // + + /** + * Triggers a key press. Stays in pressed state until released. + * @param keyCombo String of keys to be pressed to execute 'pressed' callbacks. + */ + export function pressKey(keyCombo: string): void + /** + * Triggers a key release. + * @param keyCombo String of keys to be released to execute 'released' callbacks. + */ + export function releaseKey(keyCombo: string): void; + /** + * Releases all keys. + */ + export function releaseAllKeys(): void; + + // ---------- Attachment ---------- // + + /** + * Attaches keyboardJS a specific window and a specific document or form. + * @param myWin The window to attach to. + * @param myDoc The document or form to attach to. + */ + export function watch(myWin: Window, myDoc: Document | HTMLFormElement): void; + /** + * Attaches keyboardJS to the current window and a specific document or form. + * @param myDoc The document or form to attach to. + */ + export function watch(myDoc: Document | HTMLFormElement): void; + /** + * Attaches keyboardJS to the current window an document. + */ + export function watch(): void; + + /** + * Detaches KeyboardJS from the window and documant/element + */ + export function stop(); } -interface KeyboardJSBinding { - clear(): void; - on(eventName: string, callbacks?: any): KeyboardJSSubBinding; -} - -interface KeyboardJSLocale { - map: any; - macros: any[]; -} - -interface KeyboardJSStatic { - enable(): void; - disable(): void; - activeKeys(): string[]; - on(keyCombo:string, onDownCallback?: (keyEvent: Event, keysPressed: string[], keyCombo: string) => void, onUpCallback?: (keyEvent: Event, keysPressed: string[], keyCombo: string) => void): KeyboardJSBinding; - clear: { - (keyCombo: string): void; // Call signature - key(keyName: string): void; // Method - }; - locale: { - (localeName: string): KeyboardJSLocale; // Call signature - register(localeName: string, localeDefinition: KeyboardJSLocale): void; // Method - }; - macro: { - (keyCombo:string , keyNames: string[]): void; // Call signature - remove(keyCombo: string): void; // Method - }; - key: { - name(keyCode: number): string[]; - code(keyName: string): any; - }; - combo: { - active(keyCombo: string): boolean; - parse(keyCombo: any): any[]; - stringify(keyComboArray: any): string; - }; -} - -declare var KeyboardJS: KeyboardJSStatic; +declare module 'keyboardjs' { + export = keyboardjs; +} \ No newline at end of file From 0c17a985c7bbacd3f98ec73a2d48071b3f7722b7 Mon Sep 17 00:00:00 2001 From: Anton Karsten Date: Sun, 3 Jan 2016 20:18:24 +0100 Subject: [PATCH 203/441] added definitions for contentful-resolve-response --- .../contentful-resolve-response-tests.ts | 20 +++++++++++++++++++ .../contentful-resolve-response.d.ts | 9 +++++++++ 2 files changed, 29 insertions(+) create mode 100644 contentful-resolve-response/contentful-resolve-response-tests.ts create mode 100644 contentful-resolve-response/contentful-resolve-response.d.ts diff --git a/contentful-resolve-response/contentful-resolve-response-tests.ts b/contentful-resolve-response/contentful-resolve-response-tests.ts new file mode 100644 index 0000000000..098641e7bb --- /dev/null +++ b/contentful-resolve-response/contentful-resolve-response-tests.ts @@ -0,0 +1,20 @@ +/// +import resolveResponse = require('contentful-resolve-response'); + +var response = { + items: [ + { + someValue: 'wow', + someLink: {sys: {type: 'Link', linkType: 'Entry', id: 'suchId'}} + } + ], + includes: { + Entry: [ + {sys: {type: 'Entry', id: 'suchId'}, very: 'doge'} + ] + } +}; + +var items = resolveResponse(response) + +console.log(items); diff --git a/contentful-resolve-response/contentful-resolve-response.d.ts b/contentful-resolve-response/contentful-resolve-response.d.ts new file mode 100644 index 0000000000..8ef093799c --- /dev/null +++ b/contentful-resolve-response/contentful-resolve-response.d.ts @@ -0,0 +1,9 @@ +// Type definitions for contentful-resolve-response +// Project: https://github.com/contentful/contentful-resolve-response +// Definitions by: Anton Karsten +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'contentful-resolve-response' { + function resolveResponse(response: any): any; + export = resolveResponse; +} From d58d48aec908477d01532fdcd21d87d4bfd00303 Mon Sep 17 00:00:00 2001 From: Anton Karsten Date: Sun, 3 Jan 2016 20:31:56 +0100 Subject: [PATCH 204/441] added a version number to contentful-resolve-response --- contentful-resolve-response/contentful-resolve-response.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contentful-resolve-response/contentful-resolve-response.d.ts b/contentful-resolve-response/contentful-resolve-response.d.ts index 8ef093799c..bd2daef9e6 100644 --- a/contentful-resolve-response/contentful-resolve-response.d.ts +++ b/contentful-resolve-response/contentful-resolve-response.d.ts @@ -1,4 +1,4 @@ -// Type definitions for contentful-resolve-response +// Type definitions for contentful-resolve-response v0.1.2 // Project: https://github.com/contentful/contentful-resolve-response // Definitions by: Anton Karsten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 74a4dfc1bc2dfadec47b8aae953b28546cb9c6b7 Mon Sep 17 00:00:00 2001 From: lucasljj Date: Sun, 3 Jan 2016 19:18:21 -0200 Subject: [PATCH 205/441] Fix a optional parameter on Hammer.js the .off method on a instance of HammerManager must have a handler as optional, see: http://hammerjs.github.io/api/ --- hammerjs/hammerjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hammerjs/hammerjs.d.ts b/hammerjs/hammerjs.d.ts index 0df86dfc67..e2d4a8c528 100644 --- a/hammerjs/hammerjs.d.ts +++ b/hammerjs/hammerjs.d.ts @@ -107,7 +107,7 @@ interface HammerManager emit( event:string, data:any ):void; get( recogniser:Recognizer ):Recognizer; get( recogniser:string ):Recognizer; - off( events:string, handler:( event:HammerInput ) => void ):void; + off( events:string, handler?:( event:HammerInput ) => void ):void; on( events:string, handler:( event:HammerInput ) => void ):void; recognize( inputData:any ):void; remove( recogniser:Recognizer ):HammerManager; From 4566a913a3667dc627851d0f7f38ffcd0e7cf6ea Mon Sep 17 00:00:00 2001 From: Yaojian Date: Mon, 4 Jan 2016 12:13:39 +0800 Subject: [PATCH 206/441] fixes #7469 uncaughtException: stream.write is not a function --- morgan/morgan-tests.ts | 6 ++++-- morgan/morgan.d.ts | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/morgan/morgan-tests.ts b/morgan/morgan-tests.ts index 00e67f875d..4a0df99024 100644 --- a/morgan/morgan-tests.ts +++ b/morgan/morgan-tests.ts @@ -23,7 +23,9 @@ morgan('combined', { buffer: true, immediate: true, skip: function (req, res) { return res.statusCode < 400 }, - stream: (str: string) => { - console.log(str); + stream: { + write: (str: string) => { + console.log(str); + } } }); diff --git a/morgan/morgan.d.ts b/morgan/morgan.d.ts index b889bc7be4..048fce3d4e 100644 --- a/morgan/morgan.d.ts +++ b/morgan/morgan.d.ts @@ -12,6 +12,13 @@ declare module "morgan" { export function token(name: string, callback: (req: express.Request, res: express.Response) => T): express.RequestHandler; + export interface StreamOptions { + /** + * Output stream for writing log lines + */ + write: (str: string) => void; + } + /*** * Morgan accepts these properties in the options object. */ @@ -36,7 +43,7 @@ declare module "morgan" { * Output stream for writing log lines, defaults to process.stdout. * @param str */ - stream?: (str: string) => void; + stream?: StreamOptions; } } From d75d2c96293a249bbb9715fc6b320c711d6cb4cf Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Mon, 4 Jan 2016 15:41:48 +0800 Subject: [PATCH 207/441] Add typing for field --- field/field-test.ts | 28 ++++++++++++++++++++++++++++ field/field.d.ts | 9 +++++++++ 2 files changed, 37 insertions(+) create mode 100644 field/field-test.ts create mode 100644 field/field.d.ts diff --git a/field/field-test.ts b/field/field-test.ts new file mode 100644 index 0000000000..d99dfee8a5 --- /dev/null +++ b/field/field-test.ts @@ -0,0 +1,28 @@ +// From https://github.com/jprichardson/field/blob/e968fd979ba1a06e35571695ddfdad513e516eae/README.md + +/// + +// get + +const config = { + environment: { + production: { + port: 80 + } + } +} + +console.log(field.get(config, 'environment:production:port')) +// => 80 + +// set + +var database: any = {} + +console.log(field.get(database, 'production.port')) +// => undefined + +// will return undefined since it never existed before +field.set(database, 'production.port', 27017) +console.log(database.production.port) +// => 27017 diff --git a/field/field.d.ts b/field/field.d.ts new file mode 100644 index 0000000000..0ffe08a01e --- /dev/null +++ b/field/field.d.ts @@ -0,0 +1,9 @@ +// Type definitions for field 1.0.1 +// Project: https://www.npmjs.com/package/field +// Definitions by: Leo Liang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module field { + export function get(topObj: any, fields: string): any; + export function set(topObj: any, fields: string, value: any): any; +} From c2ab9dc3530cdacb78592e99092c725ffe32a02e Mon Sep 17 00:00:00 2001 From: Meowtec Date: Mon, 4 Jan 2016 16:41:47 +0800 Subject: [PATCH 208/441] update type definitions for minilog. - node module - multi args --- minilog/minilog-tests.ts | 6 +++--- minilog/minilog.d.ts | 22 +++++++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/minilog/minilog-tests.ts b/minilog/minilog-tests.ts index 3a9bb0f4de..477c646fa8 100644 --- a/minilog/minilog-tests.ts +++ b/minilog/minilog-tests.ts @@ -12,10 +12,10 @@ var log = Minilog('app'); Minilog.enable(); log - .debug('debug message') - .info('info message') + .debug('debug message 1', 'debug message 2') + .info('info message', [1, 2, 3]) .warn('warning') - .error('this is an error message'); + .error('this is an error message', new Error()); Minilog.pipe(Minilog.backends.console.formatWithStack) .pipe(Minilog.backends.console); diff --git a/minilog/minilog.d.ts b/minilog/minilog.d.ts index d9d1695bf2..b8301277a0 100644 --- a/minilog/minilog.d.ts +++ b/minilog/minilog.d.ts @@ -5,11 +5,11 @@ //These type definitions are not complete, although basic usage should be typed. interface Minilog { - debug(msg: any): Minilog; - info(msg: any): Minilog; - log(msg: any): Minilog; - warn(msg: any): Minilog; - error(msg: any): Minilog; + debug(...msg: any[]): Minilog; + info(...msg: any[]): Minilog; + log(...msg: any[]): Minilog; + warn(...msg: any[]): Minilog; + error(...msg: any[]): Minilog; } declare function Minilog(namespace: string): Minilog; @@ -47,8 +47,8 @@ declare module Minilog { test(name:any, level:any): boolean; /** - * specifies the behavior when a log line doesn't match either the whitelist or the blacklist. - The default is true (= "allow by default") - lines that do not match the whitelist or the blacklist are not filtered (e.g. ). + * specifies the behavior when a log line doesn't match either the whitelist or the blacklist. + The default is true (= "allow by default") - lines that do not match the whitelist or the blacklist are not filtered (e.g. ). If you want to flip the default so that lines are filtered unless they are on the whitelist, set this to false (= "deny by default"). */ defaultResult: boolean; @@ -58,7 +58,7 @@ declare module Minilog { */ enabled: boolean; } - + export interface MinilogBackends { array: any; @@ -95,4 +95,8 @@ declare module Minilog { mixin(dest: any): void; } -} \ No newline at end of file +} + +declare module 'minilog' { + export = Minilog; +} From 0fa4e9e61385646ea6a4cba2aef357353d2ce77f Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Mon, 4 Jan 2016 10:57:38 +0100 Subject: [PATCH 209/441] Remove trailing spaces --- serve-static/serve-static.d.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/serve-static/serve-static.d.ts b/serve-static/serve-static.d.ts index ef59fa2bcf..29e5276cfb 100644 --- a/serve-static/serve-static.d.ts +++ b/serve-static/serve-static.d.ts @@ -15,22 +15,22 @@ declare module "serve-static" { import * as express from "express"; - + /** - * Create a new middleware function to serve files from within a given root directory. - * The file to serve will be determined by combining req.url with the provided root directory. + * Create a new middleware function to serve files from within a given root directory. + * The file to serve will be determined by combining req.url with the provided root directory. * When a file is not found, instead of sending a 404 response, this module will instead call next() to move on to the next middleware, allowing for stacking and fall-backs. */ function serveStatic(root: string, options?: { /** - * Set how "dotfiles" are treated when encountered. A dotfile is a file or directory that begins with a dot ("."). - * Note this check is done on the path itself without checking if the path actually exists on the disk. - * If root is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny"). - * The default value is 'ignore'. - * 'allow' No special treatment for dotfiles - * 'deny' Send a 403 for any request for a dotfile - * 'ignore' Pretend like the dotfile does not exist and call next() - */ + * Set how "dotfiles" are treated when encountered. A dotfile is a file or directory that begins with a dot ("."). + * Note this check is done on the path itself without checking if the path actually exists on the disk. + * If root is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny"). + * The default value is 'ignore'. + * 'allow' No special treatment for dotfiles + * 'deny' Send a 403 for any request for a dotfile + * 'ignore' Pretend like the dotfile does not exist and call next() + */ dotfiles?: string; /** From db0118ada5f13b984a4b7900af1b0fe4b8f7e175 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Mon, 4 Jan 2016 10:58:14 +0100 Subject: [PATCH 210/441] Definitions for serve-index (https://github.com/expressjs/serve-index) --- serve-index/serve-index-tests.ts | 72 ++++++++++++++++++++++++++++++++ serve-index/serve-index.d.ts | 42 +++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 serve-index/serve-index-tests.ts create mode 100644 serve-index/serve-index.d.ts diff --git a/serve-index/serve-index-tests.ts b/serve-index/serve-index-tests.ts new file mode 100644 index 0000000000..5c4910af9d --- /dev/null +++ b/serve-index/serve-index-tests.ts @@ -0,0 +1,72 @@ +/// +/// + +import * as express from 'express'; +import * as serveIndex from 'serve-index'; +import * as fs from 'fs'; + +const app = express(); + +// Serve URLs like /ftp/thing as public/ftp/thing +app.use('/ftp', serveIndex('public/ftp', {'icons': true})); +app.listen(8080); + + +// Taken from https://github.com/expressjs/serve-index/blob/v1.7.2/test/test.js + +import * as path from 'path'; +var fixtures = path.join(__dirname, '/fixtures'); +const createServer = serveIndex; + +var server = createServer('test/fixtures', {'hidden': false}); + +var server = createServer('test/fixtures', {'hidden': true}); + +var server = createServer(fixtures, {'filter': filter}); +function filter(name: string): boolean { + if (name.indexOf('foo') === -1) return true + return false +} + +var server = createServer(fixtures, {'filter': filter, 'hidden': false}); + +var server = createServer(fixtures, {'icons': true}); + +var server = createServer(fixtures, {'template': __dirname + '/shared/template.html'}); + +var server = createServer(fixtures, {'template': function (locals, callback) { + callback(null, 'This is a template.'); +}}); + +var server = createServer(fixtures, {'template': function (locals, callback) { + callback(new Error('boom!')); +}}); + +var server = createServer(fixtures, {'template': function (locals, callback) { + callback(null, JSON.stringify(locals.directory)); +}}); + +var server = createServer(fixtures, {'template': function (locals, callback) { + callback(null, JSON.stringify(locals.displayIcons)); +}}); + +var server = createServer(fixtures, {'template': function (locals, callback) { + callback(null, JSON.stringify(locals.fileList.map(function (file) { + //file.stat = file.stat instanceof fs.Stats; + return file; + }))); +}}); + +var server = createServer(fixtures, {'template': function (locals, callback) { + callback(null, JSON.stringify(locals.path)); +}}); + +var server = createServer(fixtures, {'template': function (locals, callback) { + callback(null, JSON.stringify(locals.style)); +}}); + +var server = createServer(fixtures, {'template': function (locals, callback) { + callback(null, JSON.stringify(locals.viewName)); +}}); + +var server = createServer(fixtures, {'stylesheet': __dirname + '/shared/styles.css'}); diff --git a/serve-index/serve-index.d.ts b/serve-index/serve-index.d.ts new file mode 100644 index 0000000000..34ba2fbbb9 --- /dev/null +++ b/serve-index/serve-index.d.ts @@ -0,0 +1,42 @@ +// Type definitions for serve-index v1.7.2 +// Project: https://github.com/expressjs/serve-index +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'serve-index' { + import * as express from 'express'; + import * as fs from 'fs'; + + namespace serveIndex { + interface File { + name: string; + stat: fs.Stats; + } + + interface Locals { + directory: string; + displayIcons: boolean; + fileList: Array; + name: string; + stat: fs.Stats; + path: string; + style: string; + viewName: string; + } + + type templateCallback = (error: Error, htmlString?: string) => void; + + interface Options { + filter?: (filename: string, index: number, files: Array, dir: string) => boolean; + hidden?: boolean; + icons?: boolean; + stylesheet?: string; + template?: string | ((locals: Locals, callback: templateCallback) => void); + view?: string; + } + } + + function serveIndex(path: string, options?: serveIndex.Options): express.Handler; + + export = serveIndex; +} From 04a28ef5d55e7f57c755bbba0be1d678cadc02bb Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 4 Jan 2016 18:11:54 +0500 Subject: [PATCH 211/441] lodash: signatures of _.sortByOrder have been changed --- lodash/lodash-tests.ts | 100 ++++++++++++++++-- lodash/lodash.d.ts | 233 +++++++++++++++++++++++++++++++++-------- 2 files changed, 279 insertions(+), 54 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2b..23c3501e3c 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4857,18 +4857,98 @@ result = _.sortByAll(stoogesAges, function(stooge) { return Math. result = _.sortByAll(stoogesAges, ['name', 'age']); result = _.sortByAll(stoogesAges, 'name', function(stooge) { return Math.sin(stooge.age); }); -result = _.sortByOrder(stoogesAges, [function(stooge) { return Math.sin(stooge.age); }, function(stooge) { return stooge.name.slice(1); }]); -result = _.sortByOrder(stoogesAges, ['name', 'age']); -result = _.sortByOrder(stoogesAges, ['name', function(stooge) { return Math.sin(stooge.age); }]); -result = _.sortByOrder(stoogesAges, [function(stooge) { return Math.sin(stooge.age); }, function(stooge) { return stooge.name.slice(1); }], ['asc', 'desc']); -result = _.sortByOrder(stoogesAges, ['name', 'age'], ['asc', 'desc']); -result = _.sortByOrder(stoogesAges, ['name', function(stooge) { return Math.sin(stooge.age); }], ['asc', 'desc']); -result = _.sortByOrder(stoogesAges, [function(stooge) { return Math.sin(stooge.age); }, function(stooge) { return stooge.name.slice(1); }], [true, false]); -result = _.sortByOrder(stoogesAges, ['name', 'age'], [true, false]); -result = _.sortByOrder(stoogesAges, ['name', function(stooge) { return Math.sin(stooge.age); }], [true, false]); - result = _(foodsOrganic).sortByAll('organic', (food) => food.name, { organic: true }).value(); +// _.sortByOrder +module TestSortByOrder { + type SampleObject = {a: number; b: string; c: boolean}; + + let array: SampleObject[]; + let list: _.List; + let numericDictionary: _.NumericDictionary; + let dictionary: _.Dictionary; + let orders: boolean|string|(boolean|string)[]; + + { + let iteratees: (value: string) => any|((value: string) => any)[]; + let result: string[]; + + result = _.sortByOrder('acbd', iteratees); + result = _.sortByOrder('acbd', iteratees, orders); + } + + { + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let result: SampleObject[]; + + result = _.sortByOrder<{a: number}, SampleObject>(array, iteratees); + result = _.sortByOrder<{a: number}, SampleObject>(array, iteratees, orders); + result = _.sortByOrder(array, iteratees); + result = _.sortByOrder(array, iteratees, orders); + + result = _.sortByOrder<{a: number}, SampleObject>(list, iteratees); + result = _.sortByOrder<{a: number}, SampleObject>(list, iteratees, orders); + result = _.sortByOrder(list, iteratees); + result = _.sortByOrder(list, iteratees, orders); + + result = _.sortByOrder<{a: number}, SampleObject>(numericDictionary, iteratees); + result = _.sortByOrder<{a: number}, SampleObject>(numericDictionary, iteratees, orders); + result = _.sortByOrder(numericDictionary, iteratees); + result = _.sortByOrder(numericDictionary, iteratees, orders); + + result = _.sortByOrder<{a: number}, SampleObject>(dictionary, iteratees); + result = _.sortByOrder<{a: number}, SampleObject>(dictionary, iteratees, orders); + result = _.sortByOrder(dictionary, iteratees); + result = _.sortByOrder(dictionary, iteratees, orders); + } + + { + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).sortByOrder<{a: number}>(iteratees); + result = _(array).sortByOrder<{a: number}>(iteratees, orders); + + result = _(list).sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(list).sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(list).sortByOrder(iteratees); + result = _(list).sortByOrder(iteratees, orders); + + result = _(numericDictionary).sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(numericDictionary).sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(numericDictionary).sortByOrder(iteratees); + result = _(numericDictionary).sortByOrder(iteratees, orders); + + result = _(dictionary).sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(dictionary).sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(dictionary).sortByOrder(iteratees); + result = _(dictionary).sortByOrder(iteratees, orders); + } + + { + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().sortByOrder<{a: number}>(iteratees); + result = _(array).chain().sortByOrder<{a: number}>(iteratees, orders); + + result = _(list).chain().sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(list).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(list).chain().sortByOrder(iteratees); + result = _(list).chain().sortByOrder(iteratees, orders); + + result = _(numericDictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(numericDictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(numericDictionary).chain().sortByOrder(iteratees); + result = _(numericDictionary).chain().sortByOrder(iteratees, orders); + + result = _(dictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(dictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(dictionary).chain().sortByOrder(iteratees); + result = _(dictionary).chain().sortByOrder(iteratees, orders); + } +} + result = _.where(stoogesCombined, { 'age': 40 }); result = _.where(stoogesCombined, { 'quotes': ['Poifect!'] }); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c45ec90eea..f3cbf58b71 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8315,66 +8315,211 @@ declare module _ { //_.sortByOrder interface LoDashStatic { /** - * This method is like "_.sortByAll" except that it allows specifying the sort orders of the - * iteratees to sort by. If orders is unspecified, all values are sorted in ascending order. - * Otherwise, a value is sorted in ascending order if its corresponding order is "asc", and - * descending if "desc". - * - * If a property name is provided for an iteratee the created "_.property" style callback - * returns the property value of the given element. - * - * If an object is provided for an iteratee the created "_.matches" style callback returns - * true for elements that have the properties of the given object, else false. - * - * @param collection The collection to iterate over. - * @param callback The function called per iteration. - * @param thisArg The this binding of callback. - * @return A new array of sorted elements. - **/ - sortByOrder( - collection: Array, - iteratees: (ListIterator|string|Object)[], - orders?: boolean[]): T[]; + * This method is like _.sortByAll except that it allows specifying the sort orders of the iteratees to sort + * by. If orders is unspecified, all values are sorted in ascending order. Otherwise, a value is sorted in + * ascending order if its corresponding order is "asc", and descending if "desc". + * + * If a property name is provided for an iteratee the created _.property style callback returns the property + * value of the given element. + * + * If an object is provided for an iteratee the created _.matches style callback returns true for elements + * that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratees The iteratees to sort by. + * @param orders The sort orders of iteratees. + * @return Returns the new sorted array. + */ + sortByOrder( + collection: List, + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; /** - * @see _.sortByOrder - **/ + * @see _.sortByOrder + */ sortByOrder( collection: List, - iteratees: (ListIterator|string|Object)[], - orders?: boolean[]): T[]; + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; /** - * @see _.sortByOrder - **/ - sortByOrder( - collection: Array, - iteratees: (ListIterator|string|Object)[], - orders?: string[]): T[]; + * @see _.sortByOrder + */ + sortByOrder( + collection: NumericDictionary, + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; /** - * @see _.sortByOrder - **/ + * @see _.sortByOrder + */ sortByOrder( - collection: List, - iteratees: (ListIterator|string|Object)[], - orders?: string[]): T[]; + collection: NumericDictionary, + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: Dictionary, + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: Dictionary, + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|(ListIterator|string)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; } interface LoDashImplicitArrayWrapper { /** - * @see _.sortByOrder - **/ - sortByOrder( - iteratees: (ListIterator|string|Object)[], - orders?: boolean[]): LoDashImplicitArrayWrapper; + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; /** - * @see _.sortByOrder - **/ + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortByOrder + */ sortByOrder( - iteratees: (ListIterator|string|Object)[], - orders?: string[]): LoDashImplicitArrayWrapper; + iteratees: ListIterator|string|(ListIterator|string)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; } //_.where From 8783a67ef1d0b0cca96d48855e06969d0f81a505 Mon Sep 17 00:00:00 2001 From: grkuntzmd Date: Mon, 4 Jan 2016 09:33:21 -0500 Subject: [PATCH 212/441] Corrected signature for mongoose.geoNear --- mongoose/mongoose-tests.ts | 4 ++-- mongoose/mongoose.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mongoose/mongoose-tests.ts b/mongoose/mongoose-tests.ts index 4ccc9b72d1..3cb9c3575b 100644 --- a/mongoose/mongoose-tests.ts +++ b/mongoose/mongoose-tests.ts @@ -195,8 +195,8 @@ Model.findOneAndRemove({ type: 'iphone' }, { select: 'name' }, (err: any, res: I Model.findOneAndRemove({ type: 'iphone' }, { select: 'name' }).exec((err: any, res: IActor) => {}); Model.findOneAndUpdate({ type: 'iphone' }, { $set: { name: 'jason borne' }}, { upsert: true }, (err: any, res: IActor) => {}); -Model.geoNear([1, 3], { maxDistance : 5, spherical : true }, (err: any, res: IActor[]) => {}); -Model.geoNear({ type : "Point", coordinates : [9,9] }, { maxDistance : 5, spherical : true }, (err: any, res: IActor[]) => {}); +Model.geoNear([1, 3], { maxDistance : 5, spherical : true }, (err: any, res: IActor[], stats: any) => {}); +Model.geoNear({ type : "Point", coordinates : [9,9] }, { maxDistance : 5, spherical : true }, (err: any, res: IActor[], stats: any) => {}); Model.geoSearch({ type : "house" }, { near: [10, 10], maxDistance: 5 }, (err: any, res: IActor[]) => {}); var o = { diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index e840d8e050..b971622675 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -212,8 +212,8 @@ declare module "mongoose" { findOneAndUpdate(cond: Object, update: Object, callback?: (err: any, res: T) => void): Query; findOneAndUpdate(cond: Object, update: Object, options: FindAndUpdateOption, callback?: (err: any, res: T) => void): Query; - geoNear(point: { type: string; coordinates: number[] }, options: Object, callback?: (err: any, res: T[]) => void): Query; - geoNear(point: number[], options: Object, callback?: (err: any, res: T[]) => void): Query; + geoNear(point: { type: string; coordinates: number[] }, options: Object, callback?: (err: any, res: T[], stats: any) => void): Query; + geoNear(point: number[], options: Object, callback?: (err: any, res: T[], stats: any) => void): Query; geoSearch(cond: Object, options: GeoSearchOption, callback?: (err: any, res: T[]) => void): Query; increment(): T; mapReduce(options: MapReduceOption, callback?: (err: any, res: MapReduceResult[]) => void): Promise[]>; From 5ab2c1040985d6b83738e17cf3419b46019ada2a Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 4 Jan 2016 18:56:35 +0100 Subject: [PATCH 213/441] Added extended-listbox.d.ts --- extended-listbox/extended-listbox-tests.ts | 77 ++++++++++++++++++++ extended-listbox/extended-listbox.d.ts | 85 ++++++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 extended-listbox/extended-listbox-tests.ts create mode 100644 extended-listbox/extended-listbox.d.ts diff --git a/extended-listbox/extended-listbox-tests.ts b/extended-listbox/extended-listbox-tests.ts new file mode 100644 index 0000000000..cc4eba3fea --- /dev/null +++ b/extended-listbox/extended-listbox-tests.ts @@ -0,0 +1,77 @@ +/// + + +var $test = $("#test"); + +// Create Listbox with defaults +var rootElement: any = $test.listbox(); + + +// Create with options +var options = {}; +options.multiple = true; +options.onItemsChanged = (items: ListboxItem[]): void => { + console.log(items); +}; +options.getItems = function (): any[] { + return ["Test1"]; +}; +options.searchBar = false; +options.searchBarWatermark = "Search"; +options.onFilterChanged = (filter): void => { + console.log(filter); +}; +options.onValueChanged = function (value: any): void { + console.log(value); +}; +options.searchBarButton = { icon: "fa fa-search", visible: true, onClick: function () { alert(); } }; + +rootElement = $test.listbox(options); + + +// Add string item +rootElement.listbox("addItem", "Test2"); + + +// Add item +var item: ListboxItem = {}; +item.selected = true; +item.disabled = false; +item.childItems = ["Test4"]; +item.groupHeader = false; +item.id = "ouetioreit"; +item.index = 0; +item.text = "Test3"; +var id: string = rootElement.listbox("addItem", item); + + +// Remove item +rootElement.listbox("removeItem", id); + + +// Get item +var i: ListboxItem = rootElement.listbox("getItem", id); + + +// Get items +var allItems: ListboxItem[] = rootElement.listbox("getItems"); + + +// Move item up +var newIndex: number = rootElement.listbox("moveItemUp", i.id); + + +// Move item down +newIndex = rootElement.listbox("moveItemDown", i.id); + + +// Clear selection +newIndex = rootElement.listbox("clearSelection"); + + +// Enable +newIndex = rootElement.listbox("enable", false); + + +// Destroy +newIndex = rootElement.listbox("destroy"); diff --git a/extended-listbox/extended-listbox.d.ts b/extended-listbox/extended-listbox.d.ts new file mode 100644 index 0000000000..d3f8341f00 --- /dev/null +++ b/extended-listbox/extended-listbox.d.ts @@ -0,0 +1,85 @@ +// Type definitions for extended-listbox 1.0.6 +// Project: https://github.com/code-chris/extended-listbox +// Definitions by: Christian Kotzbauer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +interface ListboxItem { + /** display text */ + text?: string; + + /** unique identifier, if not set it will be generated */ + id?: string; + + /** index position from the item in the list; only used for manual addItem api calls */ + index?: number; + + /** determines if the item should be clickable */ + disabled?: boolean; + + /** determines if the item is selected */ + selected?: boolean; + + /** determines if the item has childItems */ + groupHeader?: boolean; + + /** display text or id of the parent; only used for manual addItem api calls */ + parentGroupId?: string; + + /** list of childItems */ + childItems?: any[]; +} + +interface ListboxSearchBarButtonOptions { + /** determines if the button is visible */ + visible?: boolean; + + /** css class for the i-tag of the button */ + icon?: string; + + /** callback for button click */ + onClick?: () => void; +} + +interface ListBoxOptions { + /** determines if the searchBar is visible */ + searchBar?: boolean; + + /** watermark (placeholder) for the searchBar */ + searchBarWatermark?: string; + + /** settings for the searchBar button */ + searchBarButton?: ListboxSearchBarButtonOptions; + + /** determines if multiple items can be selected */ + multiple?: boolean; + + /** function which returns a array of items */ + getItems?: () => any; + + /** callback for selection changes */ + onValueChanged?: (value: ListboxItem|ListboxItem[]) => void; + + /** callback for searchBar text changes */ + onFilterChanged?: (value: string) => void; + + /** callback for item changes (item added, item removed, item order) */ + onItemsChanged?: (value: ListboxItem[]) => void; +} + +interface JQuery { + listbox(): JQuery; + listbox(methodName: 'addItem'): string; + listbox(methodName: 'removeItem'): void; + listbox(methodName: 'destroy'): void; + listbox(methodName: 'getItem'): ListboxItem; + listbox(methodName: 'getItems'): ListboxItem[]; + listbox(methodName: 'moveItemUp'): number; + listbox(methodName: 'moveItemDown'): number; + listbox(methodName: 'clearSelection'): void; + listbox(methodName: 'enable'): void; + listbox(methodName: string): any; + listbox(methodName: string, methodParameter: any): any; + listbox(options: ListBoxOptions): JQuery; +} From 09bfb9c3731bfa54600614bbe920cd5359093c15 Mon Sep 17 00:00:00 2001 From: Graham Mendick Date: Mon, 4 Jan 2016 18:07:30 +0000 Subject: [PATCH 214/441] Updated typings and tests for Navigation 1.3.0 --- navigation/navigation-tests.ts | 12 ++++- navigation/navigation.d.ts | 96 ++++++++++++++++++++++++++++++++-- 2 files changed, 104 insertions(+), 4 deletions(-) diff --git a/navigation/navigation-tests.ts b/navigation/navigation-tests.ts index d3676e82ec..0d663483a4 100644 --- a/navigation/navigation-tests.ts +++ b/navigation/navigation-tests.ts @@ -78,10 +78,20 @@ module NavigationTests { // State Handler class LogStateHandler extends Navigation.StateHandler { + getNavigationLink(state: Navigation.State, data: any): string { + console.log('get navigation link'); + return super.getNavigationLink(state, data, { ids: [] }); + } getNavigationData(state: Navigation.State, url: string): any { console.log('get navigation data'); - super.getNavigationData(state, url); + super.getNavigationData(state, url, {}); } + urlEncode(state: Navigation.State, key: string, val: string, queryString: boolean): string { + return queryString ? val.replace(/\s/g, '+') : super.urlEncode(state, key, val, queryString); + } + urlDecode(state: Navigation.State, key: string, val: string, queryString: boolean): string { + return queryString ? val.replace(/\+/g, ' ') : super.urlDecode(state, key, val, queryString); + } } homePage.stateHandler = new LogStateHandler(); personList.stateHandler = new LogStateHandler(); diff --git a/navigation/navigation.d.ts b/navigation/navigation.d.ts index 418cec8a4b..a9f2e1e0ea 100644 --- a/navigation/navigation.d.ts +++ b/navigation/navigation.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Navigation 1.2.0 +// Type definitions for Navigation 1.3.0 // Project: http://grahammendick.github.io/navigation/ // Definitions by: Graham Mendick // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -529,6 +529,14 @@ declare module Navigation { * @returns The navigation link */ getNavigationLink(state: State, data: any): string; + /** + * Gets a link that navigates to the state passing the data + * @param state The State to navigate to + * @param data The data to pass when navigating + * @param queryStringData The query string array data + * @returns The navigation link + */ + getNavigationLink(state: State, data: any, queryStringData: { [index: string]: string[]; }): string; /** * Navigates to the url * @param oldState The current State @@ -543,6 +551,30 @@ declare module Navigation { * @returns The navigation data */ getNavigationData(state: State, url: string): any; + /** + * Gets the data parsed from the url + * @param state The State navigated to + * @param url The current url + * @param queryStringData Stores query string keys + * @returns The navigation data + */ + getNavigationData(state: State, url: string, queryStringData: any): any; + /** + * Encodes the Url value + * @param state The State navigated to + * @param key The key of the navigation data item + * @param val The Url value of the navigation data item + * @param queryString A value indicating the Url value's location + */ + urlEncode?(state: State, key: string, val: string, queryString: boolean): string; + /** + * Decodes the Url value + * @param state The State navigated to + * @param key The key of the navigation data item + * @param val The Url value of the navigation data item + * @param queryString A value indicating the Url value's location + */ + urlDecode?(state: State, key: string, val: string, queryString: boolean): string; /** * Truncates the crumb trail * @param The State navigated to @@ -642,6 +674,11 @@ declare module Navigation { * navigating back or refreshing and combineCrumbTrail is false */ trackAllPreviousData: boolean; + /** + * Gets or sets a value indicating whether arrays should be stored in + * a single query string parameter + */ + combineArray: boolean; } /** @@ -919,6 +956,14 @@ declare module Navigation { * @returns The navigation link */ getNavigationLink(state: State, data: any): string; + /** + * Gets a link that navigates to the state passing the data + * @param state The State to navigate to + * @param data The data to pass when navigating + * @param queryStringData The query string array data + * @returns The navigation link + */ + getNavigationLink(state: State, data: any, queryStringData: { [index: string]: string[]; }): string; /** * Navigates to the url * @param oldState The current State @@ -933,6 +978,30 @@ declare module Navigation { * @returns The navigation data */ getNavigationData(state: State, url: string): any; + /** + * Gets the data parsed from the url + * @param state The State navigated to + * @param url The current url + * @param queryStringData Stores query string keys + * @returns The navigation data + */ + getNavigationData(state: State, url: string, queryStringData: any): any; + /** + * Encodes the Url value + * @param state The State navigated to + * @param key The key of the navigation data item + * @param val The Url value of the navigation data item + * @param queryString A value indicating the Url value's location + */ + urlEncode(state: State, key: string, val: string, queryString: boolean): string; + /** + * Decodes the Url value + * @param state The State navigated to + * @param key The key of the navigation data item + * @param val The Url value of the navigation data item + * @param queryString A value indicating the Url value's location + */ + urlDecode(state: State, key: string, val: string, queryString: boolean): string; /** * Truncates the crumb trail whenever a repeated or initial State is * encountered @@ -1043,6 +1112,13 @@ declare module Navigation { * @returns The matched data or null if there's no match */ match(path: string): any; + /** + * Gets the matching data for the path + * @param path The path to match + * @param urlDecode The function that decodes the Url value + * @returns The matched data or null if there's no match + */ + match(path: string, urlDecode: (route: Route, name: string, val: string) => string): any; /** * Gets the route populated with default values * @returns The built route @@ -1050,10 +1126,17 @@ declare module Navigation { build(): string; /** * Gets the route populated with data and default values - * @param The data for the route parameters + * @param data The data for the route parameters * @returns The built route */ build(data: any): string; + /** + * Gets the route populated with data and default values + * @param data The data for the route parameters + * @param urlEncode The function that encodes the Url value + * @returns The built route + */ + build(data: any, urlEncode: (route: Route, name: string, val: string) => string): string; } /** @@ -1075,10 +1158,17 @@ declare module Navigation { addRoute(path: string, defaults: any): Route; /** * Gets the matching route and data for the path - * @param route The path to match + * @param path The path to match * @returns The matched route and data */ match(path: string): { route: Route; data: any; }; + /** + * Gets the matching route and data for the path + * @param path The path to match + * @param urlDecode The function that decodes the Url value + * @returns The matched route and data + */ + match(path: string, urlDecode: (route: Route, name: string, val: string) => string): { route: Route; data: any; }; /** * Sorts the routes by the comparer * @param compare The route comparer function From 8e0d33d380f5a38e3fbe7e0a15ae73e604acd329 Mon Sep 17 00:00:00 2001 From: Jonathan Pevarnek Date: Mon, 4 Jan 2016 14:15:50 -0500 Subject: [PATCH 215/441] Add chrome.system.network interface to chrome-app Original code by @MohamedAbdalkader --- chrome/chrome-app-tests.ts | 9 +++++++++ chrome/chrome-app.d.ts | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/chrome/chrome-app-tests.ts b/chrome/chrome-app-tests.ts index 970e03517b..4665711070 100644 --- a/chrome/chrome-app-tests.ts +++ b/chrome/chrome-app-tests.ts @@ -316,3 +316,12 @@ function testSocketsTcpServerTypes(): void { socketInfo.localAddress = "192.168.0.2"; socketInfo.localPort = 8000; } + +function testSystemNetwork() { + chrome.system.network.getNetworkInterfaces((networkInterfaces) => { + var iface: chrome.system.network.NetworkInterface; + for (var i in networkInterfaces) { + iface = networkInterfaces[i]; + } + }); +} diff --git a/chrome/chrome-app.d.ts b/chrome/chrome-app.d.ts index f75f7dca65..d40fa3b2d7 100644 --- a/chrome/chrome-app.d.ts +++ b/chrome/chrome-app.d.ts @@ -378,3 +378,16 @@ declare module chrome.sockets.tcpServer { var onAccept: Event; var onAcceptError: Event; } + +//////////////////// +// System - Network +//////////////////// +declare module chrome.system.network { + interface NetworkInterface { + name: string; + address: string; + prefixLength: number; + } + + export function getNetworkInterfaces(callback: (networkInterfaces: NetworkInterface[]) => void): void; +} From b7ff5fe5ed30e8c6df42511701652ea8e4929b9b Mon Sep 17 00:00:00 2001 From: Andreas Frische Date: Mon, 4 Jan 2016 20:47:10 +0100 Subject: [PATCH 216/441] underscore.d.ts uniqueId always returns a string _.uniqueId = function(prefix) { var id = ++idCounter + ''; return prefix ? prefix + id : id; }; always returns string --- underscore/underscore.d.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 8cf98071b6..5cbcbb8d21 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -1573,12 +1573,7 @@ interface UnderscoreStatic { * @param prefix A prefix string to start the unique ID with. * @return Unique string ID beginning with `prefix`. **/ - uniqueId(prefix: string): string; - - /** - * @see _.uniqueId - **/ - uniqueId(): number; + uniqueId(prefix?: string): string; /** * Escapes a string for insertion into HTML, replacing &, <, >, ", ', and / characters. From 21a105b39d63644bc8120f2aed8cac29c4ac058e Mon Sep 17 00:00:00 2001 From: satguru srivastava Date: Mon, 4 Jan 2016 14:47:58 -0600 Subject: [PATCH 217/441] new file: babylonjs/babylon.2.2.d.ts new file: babylonjs/babylonjs-tests.ts --- babylonjs/babylon.2.2.d.ts | 6327 ++++++++++++++++++++++++++++++++++ babylonjs/babylonjs-tests.ts | 1 + 2 files changed, 6328 insertions(+) create mode 100644 babylonjs/babylon.2.2.d.ts create mode 100644 babylonjs/babylonjs-tests.ts diff --git a/babylonjs/babylon.2.2.d.ts b/babylonjs/babylon.2.2.d.ts new file mode 100644 index 0000000000..1cc835442c --- /dev/null +++ b/babylonjs/babylon.2.2.d.ts @@ -0,0 +1,6327 @@ +// Type definitions for BabylonJS v2.2 +// Project: http://www.babylonjs.com/ +// Definitions by: David Catuhe +// Definitions: https://github.com/borisyankov/babylonjs + + +declare module BABYLON { + class _DepthCullingState { + private _isDepthTestDirty; + private _isDepthMaskDirty; + private _isDepthFuncDirty; + private _isCullFaceDirty; + private _isCullDirty; + private _isZOffsetDirty; + private _depthTest; + private _depthMask; + private _depthFunc; + private _cull; + private _cullFace; + private _zOffset; + isDirty: boolean; + zOffset: number; + cullFace: number; + cull: boolean; + depthFunc: number; + depthMask: boolean; + depthTest: boolean; + reset(): void; + apply(gl: WebGLRenderingContext): void; + } + class _AlphaState { + private _isAlphaBlendDirty; + private _isBlendFunctionParametersDirty; + private _alphaBlend; + private _blendFunctionParameters; + isDirty: boolean; + alphaBlend: boolean; + setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void; + reset(): void; + apply(gl: WebGLRenderingContext): void; + } + class EngineCapabilities { + maxTexturesImageUnits: number; + maxTextureSize: number; + maxCubemapTextureSize: number; + maxRenderTextureSize: number; + standardDerivatives: boolean; + s3tc: any; + textureFloat: boolean; + textureAnisotropicFilterExtension: any; + maxAnisotropy: number; + instancedArrays: any; + uintIndices: boolean; + highPrecisionShaderSupported: boolean; + } + /** + * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio. + */ + class Engine { + private static _ALPHA_DISABLE; + private static _ALPHA_ADD; + private static _ALPHA_COMBINE; + private static _ALPHA_SUBTRACT; + private static _ALPHA_MULTIPLY; + private static _ALPHA_MAXIMIZED; + private static _ALPHA_ONEONE; + private static _DELAYLOADSTATE_NONE; + private static _DELAYLOADSTATE_LOADED; + private static _DELAYLOADSTATE_LOADING; + private static _DELAYLOADSTATE_NOTLOADED; + private static _TEXTUREFORMAT_ALPHA; + private static _TEXTUREFORMAT_LUMINANCE; + private static _TEXTUREFORMAT_LUMINANCE_ALPHA; + private static _TEXTUREFORMAT_RGB; + private static _TEXTUREFORMAT_RGBA; + private static _TEXTURETYPE_UNSIGNED_INT; + private static _TEXTURETYPE_FLOAT; + static ALPHA_DISABLE: number; + static ALPHA_ONEONE: number; + static ALPHA_ADD: number; + static ALPHA_COMBINE: number; + static ALPHA_SUBTRACT: number; + static ALPHA_MULTIPLY: number; + static ALPHA_MAXIMIZED: number; + static DELAYLOADSTATE_NONE: number; + static DELAYLOADSTATE_LOADED: number; + static DELAYLOADSTATE_LOADING: number; + static DELAYLOADSTATE_NOTLOADED: number; + static TEXTUREFORMAT_ALPHA: number; + static TEXTUREFORMAT_LUMINANCE: number; + static TEXTUREFORMAT_LUMINANCE_ALPHA: number; + static TEXTUREFORMAT_RGB: number; + static TEXTUREFORMAT_RGBA: number; + static TEXTURETYPE_UNSIGNED_INT: number; + static TEXTURETYPE_FLOAT: number; + static Version: string; + static Epsilon: number; + static CollisionsEpsilon: number; + static CodeRepository: string; + static ShadersRepository: string; + isFullscreen: boolean; + isPointerLock: boolean; + cullBackFaces: boolean; + renderEvenInBackground: boolean; + enableOfflineSupport: boolean; + scenes: Scene[]; + _gl: WebGLRenderingContext; + private _renderingCanvas; + private _windowIsBackground; + static audioEngine: AudioEngine; + private _onBlur; + private _onFocus; + private _onFullscreenChange; + private _onPointerLockChange; + private _hardwareScalingLevel; + private _caps; + private _pointerLockRequested; + private _alphaTest; + private _resizeLoadingUI; + private _loadingDiv; + private _loadingTextDiv; + private _loadingDivBackgroundColor; + private _drawCalls; + private _glVersion; + private _glRenderer; + private _glVendor; + private _videoTextureSupported; + private _renderingQueueLaunched; + private _activeRenderLoops; + private fpsRange; + private previousFramesDuration; + private fps; + private deltaTime; + private _depthCullingState; + private _alphaState; + private _alphaMode; + private _loadedTexturesCache; + _activeTexturesCache: BaseTexture[]; + private _currentEffect; + private _compiledEffects; + private _vertexAttribArrays; + private _cachedViewport; + private _cachedVertexBuffers; + private _cachedIndexBuffer; + private _cachedEffectForVertexBuffers; + private _currentRenderTarget; + private _uintIndicesCurrentlySet; + private _workingCanvas; + private _workingContext; + /** + * @constructor + * @param {HTMLCanvasElement} canvas - the canvas to be used for rendering + * @param {boolean} [antialias] - enable antialias + * @param options - further options to be sent to the getContext function + */ + constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: any); + private _prepareWorkingCanvas(); + getGlInfo(): { + vendor: string; + renderer: string; + version: string; + }; + getAspectRatio(camera: Camera): number; + getRenderWidth(): number; + getRenderHeight(): number; + getRenderingCanvas(): HTMLCanvasElement; + getRenderingCanvasClientRect(): ClientRect; + setHardwareScalingLevel(level: number): void; + getHardwareScalingLevel(): number; + getLoadedTexturesCache(): WebGLTexture[]; + getCaps(): EngineCapabilities; + drawCalls: number; + resetDrawCalls(): void; + setDepthFunctionToGreater(): void; + setDepthFunctionToGreaterOrEqual(): void; + setDepthFunctionToLess(): void; + setDepthFunctionToLessOrEqual(): void; + /** + * stop executing a render loop function and remove it from the execution array + * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed. + */ + stopRenderLoop(renderFunction?: () => void): void; + _renderLoop(): void; + /** + * Register and execute a render loop. The engine can have more than one render function. + * @param {Function} renderFunction - the function to continuesly execute starting the next render loop. + * @example + * engine.runRenderLoop(function () { + * scene.render() + * }) + */ + runRenderLoop(renderFunction: () => void): void; + /** + * Toggle full screen mode. + * @param {boolean} requestPointerLock - should a pointer lock be requested from the user + */ + switchFullscreen(requestPointerLock: boolean): void; + clear(color: any, backBuffer: boolean, depthStencil: boolean): void; + /** + * Set the WebGL's viewport + * @param {BABYLON.Viewport} viewport - the viewport element to be used. + * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used. + * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used. + */ + setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void; + setDirectViewport(x: number, y: number, width: number, height: number): void; + beginFrame(): void; + endFrame(): void; + /** + * resize the view according to the canvas' size. + * @example + * window.addEventListener("resize", function () { + * engine.resize(); + * }); + */ + resize(): void; + /** + * force a specific size of the canvas + * @param {number} width - the new canvas' width + * @param {number} height - the new canvas' height + */ + setSize(width: number, height: number): void; + bindFramebuffer(texture: WebGLTexture): void; + unBindFramebuffer(texture: WebGLTexture): void; + flushFramebuffer(): void; + restoreDefaultFramebuffer(): void; + private _resetVertexBufferBinding(); + createVertexBuffer(vertices: number[]): WebGLBuffer; + createDynamicVertexBuffer(capacity: number): WebGLBuffer; + updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: any, offset?: number): void; + private _resetIndexBufferBinding(); + createIndexBuffer(indices: number[]): WebGLBuffer; + bindBuffers(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void; + bindMultiBuffers(vertexBuffers: VertexBuffer[], indexBuffer: WebGLBuffer, effect: Effect): void; + _releaseBuffer(buffer: WebGLBuffer): boolean; + createInstancesBuffer(capacity: number): WebGLBuffer; + deleteInstancesBuffer(buffer: WebGLBuffer): void; + updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[]): void; + unBindInstancesBuffer(instancesBuffer: WebGLBuffer, offsetLocations: number[]): void; + applyStates(): void; + draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void; + drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void; + _releaseEffect(effect: Effect): void; + createEffect(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], defines: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect; + createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect; + createShaderProgram(vertexCode: string, fragmentCode: string, defines: string): WebGLProgram; + getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[]; + getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[]; + enableEffect(effect: Effect): void; + setArray(uniform: WebGLUniformLocation, array: number[]): void; + setArray2(uniform: WebGLUniformLocation, array: number[]): void; + setArray3(uniform: WebGLUniformLocation, array: number[]): void; + setArray4(uniform: WebGLUniformLocation, array: number[]): void; + setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void; + setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void; + setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void; + setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void; + setFloat(uniform: WebGLUniformLocation, value: number): void; + setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void; + setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void; + setBool(uniform: WebGLUniformLocation, bool: number): void; + setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; + setColor3(uniform: WebGLUniformLocation, color3: Color3): void; + setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void; + setState(culling: boolean, zOffset?: number, force?: boolean): void; + setDepthBuffer(enable: boolean): void; + getDepthWrite(): boolean; + setDepthWrite(enable: boolean): void; + setColorWrite(enable: boolean): void; + setAlphaMode(mode: number): void; + getAlphaMode(): number; + setAlphaTesting(enable: boolean): void; + getAlphaTesting(): boolean; + wipeCaches(): void; + setSamplingMode(texture: WebGLTexture, samplingMode: number): void; + createTexture(url: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any): WebGLTexture; + updateRawTexture(texture: WebGLTexture, data: ArrayBufferView, format: number, invertY: boolean, compression?: string): void; + createRawTexture(data: ArrayBufferView, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture; + createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number, forceExponantOfTwo?: boolean): WebGLTexture; + updateTextureSamplingMode(samplingMode: number, texture: WebGLTexture): void; + updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean): void; + updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void; + createRenderTargetTexture(size: any, options: any): WebGLTexture; + createCubeTexture(rootUrl: string, scene: Scene, extensions: string[], noMipmap?: boolean): WebGLTexture; + _releaseTexture(texture: WebGLTexture): void; + bindSamplers(effect: Effect): void; + _bindTexture(channel: number, texture: WebGLTexture): void; + setTextureFromPostProcess(channel: number, postProcess: PostProcess): void; + setTexture(channel: number, texture: BaseTexture): void; + _setAnisotropicLevel(key: number, texture: BaseTexture): void; + readPixels(x: number, y: number, width: number, height: number): Uint8Array; + dispose(): void; + displayLoadingUI(): void; + loadingUIText: string; + loadingUIBackgroundColor: string; + hideLoadingUI(): void; + getFps(): number; + getDeltaTime(): number; + private _measureFps(); + static isSupported(): boolean; + } +} + +interface Window { + mozIndexedDB(func: any): any; + webkitIndexedDB(func: any): any; + IDBTransaction(func: any): any; + webkitIDBTransaction(func: any): any; + msIDBTransaction(func: any): any; + IDBKeyRange(func: any): any; + webkitIDBKeyRange(func: any): any; + msIDBKeyRange(func: any): any; + webkitURL: HTMLURL; + webkitRequestAnimationFrame(func: any): any; + mozRequestAnimationFrame(func: any): any; + oRequestAnimationFrame(func: any): any; + WebGLRenderingContext: WebGLRenderingContext; + MSGesture: MSGesture; + CANNON: any; + SIMD: any; + AudioContext: AudioContext; + webkitAudioContext: AudioContext; +} +interface HTMLURL { + createObjectURL(param1: any, param2?: any): any; +} +interface Document { + exitFullscreen(): void; + webkitCancelFullScreen(): void; + mozCancelFullScreen(): void; + msCancelFullScreen(): void; + mozFullScreen: boolean; + msIsFullScreen: boolean; + fullscreen: boolean; + mozPointerLockElement: HTMLElement; + msPointerLockElement: HTMLElement; + webkitPointerLockElement: HTMLElement; +} +interface HTMLCanvasElement { + requestPointerLock(): void; + msRequestPointerLock(): void; + mozRequestPointerLock(): void; + webkitRequestPointerLock(): void; +} +interface CanvasRenderingContext2D { + imageSmoothingEnabled: boolean; + mozImageSmoothingEnabled: boolean; + oImageSmoothingEnabled: boolean; + webkitImageSmoothingEnabled: boolean; +} +interface WebGLTexture { + isReady: boolean; + isCube: boolean; + url: string; + noMipmap: boolean; + samplingMode: number; + references: number; + generateMipMaps: boolean; + _size: number; + _baseWidth: number; + _baseHeight: number; + _width: number; + _height: number; + _workingCanvas: HTMLCanvasElement; + _workingContext: CanvasRenderingContext2D; + _framebuffer: WebGLFramebuffer; + _depthBuffer: WebGLRenderbuffer; + _cachedCoordinatesMode: number; + _cachedWrapU: number; + _cachedWrapV: number; + _isDisabled: boolean; +} +interface WebGLBuffer { + references: number; + capacity: number; + is32Bits: boolean; +} +interface MouseEvent { + mozMovementX: number; + mozMovementY: number; + webkitMovementX: number; + webkitMovementY: number; + msMovementX: number; + msMovementY: number; +} +interface MSStyleCSSProperties { + webkitTransform: string; + webkitTransition: string; +} +interface Navigator { + getVRDevices: () => any; + mozGetVRDevices: (any: any) => any; + isCocoonJS: boolean; +} +interface Screen { + orientation: string; + mozOrientation: string; +} + +declare module BABYLON { + /** + * Node is the basic class for all scene objects (Mesh, Light Camera). + */ + class Node { + parent: Node; + name: string; + id: string; + uniqueId: number; + state: string; + animations: Animation[]; + onReady: (node: Node) => void; + private _childrenFlag; + private _isEnabled; + private _isReady; + _currentRenderId: number; + private _parentRenderId; + _waitingParentId: string; + private _scene; + _cache: any; + /** + * @constructor + * @param {string} name - the name and id to be given to this node + * @param {BABYLON.Scene} the scene this node will be added to + */ + constructor(name: string, scene: Scene); + getScene(): Scene; + getEngine(): Engine; + getWorldMatrix(): Matrix; + _initCache(): void; + updateCache(force?: boolean): void; + _updateCache(ignoreParentClass?: boolean): void; + _isSynchronized(): boolean; + _markSyncedWithParent(): void; + isSynchronizedWithParent(): boolean; + isSynchronized(updateCache?: boolean): boolean; + hasNewParent(update?: boolean): boolean; + /** + * Is this node ready to be used/rendered + * @return {boolean} is it ready + */ + isReady(): boolean; + /** + * Is this node enabled. + * If the node has a parent and is enabled, the parent will be inspected as well. + * @return {boolean} whether this node (and its parent) is enabled. + * @see setEnabled + */ + isEnabled(): boolean; + /** + * Set the enabled state of this node. + * @param {boolean} value - the new enabled state + * @see isEnabled + */ + setEnabled(value: boolean): void; + /** + * Is this node a descendant of the given node. + * The function will iterate up the hierarchy until the ancestor was found or no more parents defined. + * @param {BABYLON.Node} ancestor - The parent node to inspect + * @see parent + */ + isDescendantOf(ancestor: Node): boolean; + _getDescendants(list: Node[], results: Node[]): void; + /** + * Will return all nodes that have this node as parent. + * @return {BABYLON.Node[]} all children nodes of all types. + */ + getDescendants(): Node[]; + _setReady(state: boolean): void; + } +} + +declare module BABYLON { + interface IDisposable { + dispose(): void; + } + /** + * Represents a scene to be rendered by the engine. + * @see http://doc.babylonjs.com/page.php?p=21911 + */ + class Scene { + private static _FOGMODE_NONE; + private static _FOGMODE_EXP; + private static _FOGMODE_EXP2; + private static _FOGMODE_LINEAR; + static MinDeltaTime: number; + static MaxDeltaTime: number; + static FOGMODE_NONE: number; + static FOGMODE_EXP: number; + static FOGMODE_EXP2: number; + static FOGMODE_LINEAR: number; + autoClear: boolean; + clearColor: any; + ambientColor: Color3; + /** + * A function to be executed before rendering this scene + * @type {Function} + */ + beforeRender: () => void; + /** + * A function to be executed after rendering this scene + * @type {Function} + */ + afterRender: () => void; + /** + * A function to be executed when this scene is disposed. + * @type {Function} + */ + onDispose: () => void; + beforeCameraRender: (camera: Camera) => void; + afterCameraRender: (camera: Camera) => void; + forceWireframe: boolean; + forcePointsCloud: boolean; + forceShowBoundingBoxes: boolean; + clipPlane: Plane; + animationsEnabled: boolean; + private _onPointerMove; + private _onPointerDown; + private _onPointerUp; + onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void; + onPointerUp: (evt: PointerEvent, pickInfo: PickingInfo) => void; + cameraToUseForPointers: Camera; + private _pointerX; + private _pointerY; + private _meshUnderPointer; + private _onKeyDown; + private _onKeyUp; + /** + * is fog enabled on this scene. + * @type {boolean} + */ + fogEnabled: boolean; + fogMode: number; + fogColor: Color3; + fogDensity: number; + fogStart: number; + fogEnd: number; + /** + * is shadow enabled on this scene. + * @type {boolean} + */ + shadowsEnabled: boolean; + /** + * is light enabled on this scene. + * @type {boolean} + */ + lightsEnabled: boolean; + /** + * All of the lights added to this scene. + * @see BABYLON.Light + * @type {BABYLON.Light[]} + */ + lights: Light[]; + onNewLightAdded: (newLight?: Light, positionInArray?: number, scene?: Scene) => void; + onLightRemoved: (removedLight?: Light) => void; + /** + * All of the cameras added to this scene. + * @see BABYLON.Camera + * @type {BABYLON.Camera[]} + */ + cameras: Camera[]; + onNewCameraAdded: (newCamera?: Camera, positionInArray?: number, scene?: Scene) => void; + onCameraRemoved: (removedCamera?: Camera) => void; + activeCameras: Camera[]; + activeCamera: Camera; + /** + * All of the (abstract) meshes added to this scene. + * @see BABYLON.AbstractMesh + * @type {BABYLON.AbstractMesh[]} + */ + meshes: AbstractMesh[]; + onNewMeshAdded: (newMesh?: AbstractMesh, positionInArray?: number, scene?: Scene) => void; + onMeshRemoved: (removedMesh?: AbstractMesh) => void; + private _geometries; + onGeometryAdded: (newGeometry?: Geometry) => void; + onGeometryRemoved: (removedGeometry?: Geometry) => void; + materials: Material[]; + multiMaterials: MultiMaterial[]; + defaultMaterial: StandardMaterial; + texturesEnabled: boolean; + textures: BaseTexture[]; + particlesEnabled: boolean; + particleSystems: ParticleSystem[]; + spritesEnabled: boolean; + spriteManagers: SpriteManager[]; + layers: Layer[]; + skeletonsEnabled: boolean; + skeletons: Skeleton[]; + lensFlaresEnabled: boolean; + lensFlareSystems: LensFlareSystem[]; + collisionsEnabled: boolean; + private _workerCollisions; + collisionCoordinator: ICollisionCoordinator; + gravity: Vector3; + postProcessesEnabled: boolean; + postProcessManager: PostProcessManager; + postProcessRenderPipelineManager: PostProcessRenderPipelineManager; + renderTargetsEnabled: boolean; + dumpNextRenderTargets: boolean; + customRenderTargets: RenderTargetTexture[]; + useDelayedTextureLoading: boolean; + importedMeshesFiles: String[]; + database: any; + /** + * This scene's action manager + * @type {BABYLON.ActionManager} + */ + actionManager: ActionManager; + _actionManagers: ActionManager[]; + private _meshesForIntersections; + proceduralTexturesEnabled: boolean; + _proceduralTextures: ProceduralTexture[]; + mainSoundTrack: SoundTrack; + soundTracks: SoundTrack[]; + private _audioEnabled; + private _headphone; + simplificationQueue: SimplificationQueue; + private _engine; + private _totalVertices; + _activeIndices: number; + _activeParticles: number; + private _lastFrameDuration; + private _evaluateActiveMeshesDuration; + private _renderTargetsDuration; + _particlesDuration: number; + private _renderDuration; + _spritesDuration: number; + private _animationRatio; + private _animationStartDate; + _cachedMaterial: Material; + private _renderId; + private _executeWhenReadyTimeoutId; + _toBeDisposed: SmartArray; + private _onReadyCallbacks; + private _pendingData; + private _onBeforeRenderCallbacks; + private _onAfterRenderCallbacks; + private _activeMeshes; + private _processedMaterials; + private _renderTargets; + _activeParticleSystems: SmartArray; + private _activeSkeletons; + private _softwareSkinnedMeshes; + _activeBones: number; + private _renderingManager; + private _physicsEngine; + _activeAnimatables: Animatable[]; + private _transformMatrix; + private _pickWithRayInverseMatrix; + private _edgesRenderers; + private _boundingBoxRenderer; + private _outlineRenderer; + private _viewMatrix; + private _projectionMatrix; + private _frustumPlanes; + private _selectionOctree; + private _pointerOverMesh; + private _debugLayer; + private _depthRenderer; + private _uniqueIdCounter; + /** + * @constructor + * @param {BABYLON.Engine} engine - the engine to be used to render this scene. + */ + constructor(engine: Engine); + debugLayer: DebugLayer; + workerCollisions: boolean; + SelectionOctree: Octree; + /** + * The mesh that is currently under the pointer. + * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none. + */ + meshUnderPointer: AbstractMesh; + /** + * Current on-screen X position of the pointer + * @return {number} X position of the pointer + */ + pointerX: number; + /** + * Current on-screen Y position of the pointer + * @return {number} Y position of the pointer + */ + pointerY: number; + getCachedMaterial(): Material; + getBoundingBoxRenderer(): BoundingBoxRenderer; + getOutlineRenderer(): OutlineRenderer; + getEngine(): Engine; + getTotalVertices(): number; + getActiveIndices(): number; + getActiveParticles(): number; + getActiveBones(): number; + getLastFrameDuration(): number; + getEvaluateActiveMeshesDuration(): number; + getActiveMeshes(): SmartArray; + getRenderTargetsDuration(): number; + getRenderDuration(): number; + getParticlesDuration(): number; + getSpritesDuration(): number; + getAnimationRatio(): number; + getRenderId(): number; + incrementRenderId(): void; + private _updatePointerPosition(evt); + attachControl(): void; + detachControl(): void; + isReady(): boolean; + resetCachedMaterial(): void; + registerBeforeRender(func: () => void): void; + unregisterBeforeRender(func: () => void): void; + registerAfterRender(func: () => void): void; + unregisterAfterRender(func: () => void): void; + _addPendingData(data: any): void; + _removePendingData(data: any): void; + getWaitingItemsCount(): number; + /** + * Registers a function to be executed when the scene is ready. + * @param {Function} func - the function to be executed. + */ + executeWhenReady(func: () => void): void; + _checkIsReady(): void; + /** + * Will start the animation sequence of a given target + * @param target - the target + * @param {number} from - from which frame should animation start + * @param {number} to - till which frame should animation run. + * @param {boolean} [loop] - should the animation loop + * @param {number} [speedRatio] - the speed in which to run the animation + * @param {Function} [onAnimationEnd] function to be executed when the animation ended. + * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params. + * @return {BABYLON.Animatable} the animatable object created for this animation + * @see BABYLON.Animatable + * @see http://doc.babylonjs.com/page.php?p=22081 + */ + beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable; + beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable; + getAnimatableByTarget(target: any): Animatable; + /** + * Will stop the animation of the given target + * @param target - the target + * @see beginAnimation + */ + stopAnimation(target: any): void; + private _animate(); + getViewMatrix(): Matrix; + getProjectionMatrix(): Matrix; + getTransformMatrix(): Matrix; + setTransformMatrix(view: Matrix, projection: Matrix): void; + addMesh(newMesh: AbstractMesh): void; + removeMesh(toRemove: AbstractMesh): number; + removeLight(toRemove: Light): number; + removeCamera(toRemove: Camera): number; + addLight(newLight: Light): void; + addCamera(newCamera: Camera): void; + /** + * sets the active camera of the scene using its ID + * @param {string} id - the camera's ID + * @return {BABYLON.Camera|null} the new active camera or null if none found. + * @see activeCamera + */ + setActiveCameraByID(id: string): Camera; + /** + * sets the active camera of the scene using its name + * @param {string} name - the camera's name + * @return {BABYLON.Camera|null} the new active camera or null if none found. + * @see activeCamera + */ + setActiveCameraByName(name: string): Camera; + /** + * get a material using its id + * @param {string} the material's ID + * @return {BABYLON.Material|null} the material or null if none found. + */ + getMaterialByID(id: string): Material; + /** + * get a material using its name + * @param {string} the material's name + * @return {BABYLON.Material|null} the material or null if none found. + */ + getMaterialByName(name: string): Material; + getLensFlareSystemByName(name: string): LensFlareSystem; + getCameraByID(id: string): Camera; + getCameraByUniqueID(uniqueId: number): Camera; + /** + * get a camera using its name + * @param {string} the camera's name + * @return {BABYLON.Camera|null} the camera or null if none found. + */ + getCameraByName(name: string): Camera; + /** + * get a light node using its name + * @param {string} the light's name + * @return {BABYLON.Light|null} the light or null if none found. + */ + getLightByName(name: string): Light; + /** + * get a light node using its ID + * @param {string} the light's id + * @return {BABYLON.Light|null} the light or null if none found. + */ + getLightByID(id: string): Light; + /** + * get a light node using its scene-generated unique ID + * @param {number} the light's unique id + * @return {BABYLON.Light|null} the light or null if none found. + */ + getLightByUniqueID(uniqueId: number): Light; + /** + * get a geometry using its ID + * @param {string} the geometry's id + * @return {BABYLON.Geometry|null} the geometry or null if none found. + */ + getGeometryByID(id: string): Geometry; + /** + * add a new geometry to this scene. + * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene. + * @param {boolean} [force] - force addition, even if a geometry with this ID already exists + * @return {boolean} was the geometry added or not + */ + pushGeometry(geometry: Geometry, force?: boolean): boolean; + /** + * Removes an existing geometry + * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene. + * @return {boolean} was the geometry removed or not + */ + removeGeometry(geometry: Geometry): boolean; + getGeometries(): Geometry[]; + /** + * Get the first added mesh found of a given ID + * @param {string} id - the id to search for + * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. + */ + getMeshByID(id: string): AbstractMesh; + /** + * Get a mesh with its auto-generated unique id + * @param {number} uniqueId - the unique id to search for + * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. + */ + getMeshByUniqueID(uniqueId: number): AbstractMesh; + /** + * Get a the last added mesh found of a given ID + * @param {string} id - the id to search for + * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. + */ + getLastMeshByID(id: string): AbstractMesh; + /** + * Get a the last added node (Mesh, Camera, Light) found of a given ID + * @param {string} id - the id to search for + * @return {BABYLON.Node|null} the node found or null if not found at all. + */ + getLastEntryByID(id: string): Node; + getNodeByID(id: string): Node; + getNodeByName(name: string): Node; + getMeshByName(name: string): AbstractMesh; + getSoundByName(name: string): Sound; + getLastSkeletonByID(id: string): Skeleton; + getSkeletonById(id: string): Skeleton; + getSkeletonByName(name: string): Skeleton; + isActiveMesh(mesh: Mesh): boolean; + private _evaluateSubMesh(subMesh, mesh); + private _evaluateActiveMeshes(); + private _activeMesh(mesh); + updateTransformMatrix(force?: boolean): void; + private _renderForCamera(camera); + private _processSubCameras(camera); + private _checkIntersections(); + render(): void; + private _updateAudioParameters(); + audioEnabled: boolean; + private _disableAudio(); + private _enableAudio(); + headphone: boolean; + private _switchAudioModeForHeadphones(); + private _switchAudioModeForNormalSpeakers(); + enableDepthRenderer(): DepthRenderer; + disableDepthRenderer(): void; + dispose(): void; + disposeSounds(): void; + getWorldExtends(): { + min: Vector3; + max: Vector3; + }; + createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree; + createPickingRay(x: number, y: number, world: Matrix, camera: Camera): Ray; + private _internalPick(rayFunction, predicate, fastCheck?); + pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo; + pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo; + setPointerOverMesh(mesh: AbstractMesh): void; + getPointerOverMesh(): AbstractMesh; + getPhysicsEngine(): PhysicsEngine; + enablePhysics(gravity: Vector3, plugin?: IPhysicsEnginePlugin): boolean; + disablePhysicsEngine(): void; + isPhysicsEnabled(): boolean; + setGravity(gravity: Vector3): void; + createCompoundImpostor(parts: any, options: PhysicsBodyCreationOptions): any; + deleteCompoundImpostor(compound: any): void; + createDefaultCameraOrLight(): void; + private _getByTags(list, tagsQuery, forEach?); + getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[]; + getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[]; + getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[]; + getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[]; + } +} + +declare module BABYLON { + class Action { + triggerOptions: any; + trigger: number; + _actionManager: ActionManager; + private _nextActiveAction; + private _child; + private _condition; + private _triggerParameter; + constructor(triggerOptions: any, condition?: Condition); + _prepare(): void; + getTriggerParameter(): any; + _executeCurrent(evt: ActionEvent): void; + execute(evt: ActionEvent): void; + then(action: Action): Action; + _getProperty(propertyPath: string): string; + _getEffectiveTarget(target: any, propertyPath: string): any; + } +} + +declare module BABYLON { + /** + * ActionEvent is the event beint sent when an action is triggered. + */ + class ActionEvent { + source: AbstractMesh; + pointerX: number; + pointerY: number; + meshUnderPointer: AbstractMesh; + sourceEvent: any; + additionalData: any; + /** + * @constructor + * @param source The mesh that triggered the action. + * @param pointerX the X mouse cursor position at the time of the event + * @param pointerY the Y mouse cursor position at the time of the event + * @param meshUnderPointer The mesh that is currently pointed at (can be null) + * @param sourceEvent the original (browser) event that triggered the ActionEvent + */ + constructor(source: AbstractMesh, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any, additionalData?: any); + /** + * Helper function to auto-create an ActionEvent from a source mesh. + * @param source the source mesh that triggered the event + * @param evt {Event} The original (browser) event + */ + static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent; + /** + * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew + * @param scene the scene where the event occurred + * @param evt {Event} The original (browser) event + */ + static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent; + } + /** + * Action Manager manages all events to be triggered on a given mesh or the global scene. + * A single scene can have many Action Managers to handle predefined actions on specific meshes. + */ + class ActionManager { + private static _NothingTrigger; + private static _OnPickTrigger; + private static _OnLeftPickTrigger; + private static _OnRightPickTrigger; + private static _OnCenterPickTrigger; + private static _OnPointerOverTrigger; + private static _OnPointerOutTrigger; + private static _OnEveryFrameTrigger; + private static _OnIntersectionEnterTrigger; + private static _OnIntersectionExitTrigger; + private static _OnKeyDownTrigger; + private static _OnKeyUpTrigger; + private static _OnPickUpTrigger; + static NothingTrigger: number; + static OnPickTrigger: number; + static OnLeftPickTrigger: number; + static OnRightPickTrigger: number; + static OnCenterPickTrigger: number; + static OnPointerOverTrigger: number; + static OnPointerOutTrigger: number; + static OnEveryFrameTrigger: number; + static OnIntersectionEnterTrigger: number; + static OnIntersectionExitTrigger: number; + static OnKeyDownTrigger: number; + static OnKeyUpTrigger: number; + static OnPickUpTrigger: number; + actions: Action[]; + private _scene; + constructor(scene: Scene); + dispose(): void; + getScene(): Scene; + /** + * Does this action manager handles actions of any of the given triggers + * @param {number[]} triggers - the triggers to be tested + * @return {boolean} whether one (or more) of the triggers is handeled + */ + hasSpecificTriggers(triggers: number[]): boolean; + /** + * Does this action manager handles actions of a given trigger + * @param {number} trigger - the trigger to be tested + * @return {boolean} whether the trigger is handeled + */ + hasSpecificTrigger(trigger: number): boolean; + /** + * Does this action manager has pointer triggers + * @return {boolean} whether or not it has pointer triggers + */ + hasPointerTriggers: boolean; + /** + * Does this action manager has pick triggers + * @return {boolean} whether or not it has pick triggers + */ + hasPickTriggers: boolean; + /** + * Registers an action to this action manager + * @param {BABYLON.Action} action - the action to be registered + * @return {BABYLON.Action} the action amended (prepared) after registration + */ + registerAction(action: Action): Action; + /** + * Process a specific trigger + * @param {number} trigger - the trigger to process + * @param evt {BABYLON.ActionEvent} the event details to be processed + */ + processTrigger(trigger: number, evt: ActionEvent): void; + _getEffectiveTarget(target: any, propertyPath: string): any; + _getProperty(propertyPath: string): string; + } +} + +declare module BABYLON { + class Condition { + _actionManager: ActionManager; + _evaluationId: number; + _currentResult: boolean; + constructor(actionManager: ActionManager); + isValid(): boolean; + _getProperty(propertyPath: string): string; + _getEffectiveTarget(target: any, propertyPath: string): any; + } + class ValueCondition extends Condition { + propertyPath: string; + value: any; + operator: number; + private static _IsEqual; + private static _IsDifferent; + private static _IsGreater; + private static _IsLesser; + static IsEqual: number; + static IsDifferent: number; + static IsGreater: number; + static IsLesser: number; + _actionManager: ActionManager; + private _target; + private _property; + constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number); + isValid(): boolean; + } + class PredicateCondition extends Condition { + predicate: () => boolean; + _actionManager: ActionManager; + constructor(actionManager: ActionManager, predicate: () => boolean); + isValid(): boolean; + } + class StateCondition extends Condition { + value: string; + _actionManager: ActionManager; + private _target; + constructor(actionManager: ActionManager, target: any, value: string); + isValid(): boolean; + } +} + +declare module BABYLON { + class SwitchBooleanAction extends Action { + propertyPath: string; + private _target; + private _property; + constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition); + _prepare(): void; + execute(): void; + } + class SetStateAction extends Action { + value: string; + private _target; + constructor(triggerOptions: any, target: any, value: string, condition?: Condition); + execute(): void; + } + class SetValueAction extends Action { + propertyPath: string; + value: any; + private _target; + private _property; + constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition); + _prepare(): void; + execute(): void; + } + class IncrementValueAction extends Action { + propertyPath: string; + value: any; + private _target; + private _property; + constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition); + _prepare(): void; + execute(): void; + } + class PlayAnimationAction extends Action { + from: number; + to: number; + loop: boolean; + private _target; + constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition); + _prepare(): void; + execute(): void; + } + class StopAnimationAction extends Action { + private _target; + constructor(triggerOptions: any, target: any, condition?: Condition); + _prepare(): void; + execute(): void; + } + class DoNothingAction extends Action { + constructor(triggerOptions?: any, condition?: Condition); + execute(): void; + } + class CombineAction extends Action { + children: Action[]; + constructor(triggerOptions: any, children: Action[], condition?: Condition); + _prepare(): void; + execute(evt: ActionEvent): void; + } + class ExecuteCodeAction extends Action { + func: (evt: ActionEvent) => void; + constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition); + execute(evt: ActionEvent): void; + } + class SetParentAction extends Action { + private _parent; + private _target; + constructor(triggerOptions: any, target: any, parent: any, condition?: Condition); + _prepare(): void; + execute(): void; + } + class PlaySoundAction extends Action { + private _sound; + constructor(triggerOptions: any, sound: Sound, condition?: Condition); + _prepare(): void; + execute(): void; + } + class StopSoundAction extends Action { + private _sound; + constructor(triggerOptions: any, sound: Sound, condition?: Condition); + _prepare(): void; + execute(): void; + } +} + +declare module BABYLON { + class InterpolateValueAction extends Action { + propertyPath: string; + value: any; + duration: number; + stopOtherAnimations: boolean; + private _target; + private _property; + constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean); + _prepare(): void; + execute(): void; + } +} + +declare module BABYLON { + class Animatable { + target: any; + fromFrame: number; + toFrame: number; + loopAnimation: boolean; + speedRatio: number; + onAnimationEnd: any; + private _localDelayOffset; + private _pausedDelay; + private _animations; + private _paused; + private _scene; + animationStarted: boolean; + constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: any, animations?: any); + appendAnimations(target: any, animations: Animation[]): void; + getAnimationByTargetProperty(property: string): Animation; + reset(): void; + pause(): void; + restart(): void; + stop(): void; + _animate(delay: number): boolean; + } +} + +declare module BABYLON { + class Animation { + name: string; + targetProperty: string; + framePerSecond: number; + dataType: number; + loopMode: number; + private _keys; + private _offsetsCache; + private _highLimitsCache; + private _stopped; + _target: any; + private _easingFunction; + targetPropertyPath: string[]; + currentFrame: number; + allowMatricesInterpolation: boolean; + static CreateAndStartAnimation(name: string, mesh: AbstractMesh, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction): Animatable; + constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number); + reset(): void; + isStopped(): boolean; + getKeys(): any[]; + getEasingFunction(): IEasingFunction; + setEasingFunction(easingFunction: EasingFunction): void; + floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number; + quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion; + vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3; + vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2; + color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3; + matrixInterpolateFunction(startValue: Matrix, endValue: Matrix, gradient: number): Matrix; + clone(): Animation; + setKeys(values: Array): void; + private _getKeyValue(value); + private _interpolate(currentFrame, repeatCount, loopMode, offsetValue?, highLimitValue?); + animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number): boolean; + private static _ANIMATIONTYPE_FLOAT; + private static _ANIMATIONTYPE_VECTOR3; + private static _ANIMATIONTYPE_QUATERNION; + private static _ANIMATIONTYPE_MATRIX; + private static _ANIMATIONTYPE_COLOR3; + private static _ANIMATIONTYPE_VECTOR2; + private static _ANIMATIONLOOPMODE_RELATIVE; + private static _ANIMATIONLOOPMODE_CYCLE; + private static _ANIMATIONLOOPMODE_CONSTANT; + static ANIMATIONTYPE_FLOAT: number; + static ANIMATIONTYPE_VECTOR3: number; + static ANIMATIONTYPE_VECTOR2: number; + static ANIMATIONTYPE_QUATERNION: number; + static ANIMATIONTYPE_MATRIX: number; + static ANIMATIONTYPE_COLOR3: number; + static ANIMATIONLOOPMODE_RELATIVE: number; + static ANIMATIONLOOPMODE_CYCLE: number; + static ANIMATIONLOOPMODE_CONSTANT: number; + } +} + +declare module BABYLON { + interface IEasingFunction { + ease(gradient: number): number; + } + class EasingFunction implements IEasingFunction { + private static _EASINGMODE_EASEIN; + private static _EASINGMODE_EASEOUT; + private static _EASINGMODE_EASEINOUT; + static EASINGMODE_EASEIN: number; + static EASINGMODE_EASEOUT: number; + static EASINGMODE_EASEINOUT: number; + private _easingMode; + setEasingMode(easingMode: number): void; + getEasingMode(): number; + easeInCore(gradient: number): number; + ease(gradient: number): number; + } + class CircleEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class BackEase extends EasingFunction implements IEasingFunction { + amplitude: number; + constructor(amplitude?: number); + easeInCore(gradient: number): number; + } + class BounceEase extends EasingFunction implements IEasingFunction { + bounces: number; + bounciness: number; + constructor(bounces?: number, bounciness?: number); + easeInCore(gradient: number): number; + } + class CubicEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class ElasticEase extends EasingFunction implements IEasingFunction { + oscillations: number; + springiness: number; + constructor(oscillations?: number, springiness?: number); + easeInCore(gradient: number): number; + } + class ExponentialEase extends EasingFunction implements IEasingFunction { + exponent: number; + constructor(exponent?: number); + easeInCore(gradient: number): number; + } + class PowerEase extends EasingFunction implements IEasingFunction { + power: number; + constructor(power?: number); + easeInCore(gradient: number): number; + } + class QuadraticEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class QuarticEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class QuinticEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class SineEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class BezierCurveEase extends EasingFunction implements IEasingFunction { + x1: number; + y1: number; + x2: number; + y2: number; + constructor(x1?: number, y1?: number, x2?: number, y2?: number); + easeInCore(gradient: number): number; + } +} + +declare module BABYLON { + class Analyser { + SMOOTHING: number; + FFT_SIZE: number; + BARGRAPHAMPLITUDE: number; + DEBUGCANVASPOS: { + x: number; + y: number; + }; + DEBUGCANVASSIZE: { + width: number; + height: number; + }; + private _byteFreqs; + private _byteTime; + private _floatFreqs; + private _webAudioAnalyser; + private _debugCanvas; + private _debugCanvasContext; + private _scene; + private _registerFunc; + private _audioEngine; + constructor(scene: Scene); + getFrequencyBinCount(): number; + getByteFrequencyData(): Uint8Array; + getByteTimeDomainData(): Uint8Array; + getFloatFrequencyData(): Uint8Array; + drawDebugCanvas(): void; + stopDebugCanvas(): void; + connectAudioNodes(inputAudioNode: AudioNode, outputAudioNode: AudioNode): void; + dispose(): void; + } +} + +declare module BABYLON { + class AudioEngine { + private _audioContext; + private _audioContextInitialized; + canUseWebAudio: boolean; + masterGain: GainNode; + private _connectedAnalyser; + WarnedWebAudioUnsupported: boolean; + audioContext: AudioContext; + constructor(); + private _initializeAudioContext(); + dispose(): void; + getGlobalVolume(): number; + setGlobalVolume(newVolume: number): void; + connectToAnalyser(analyser: Analyser): void; + } +} + +declare module BABYLON { + class Sound { + name: string; + autoplay: boolean; + loop: boolean; + useCustomAttenuation: boolean; + soundTrackId: number; + spatialSound: boolean; + refDistance: number; + rolloffFactor: number; + maxDistance: number; + distanceModel: string; + private _panningModel; + onended: () => any; + private _playbackRate; + private _startTime; + private _startOffset; + private _position; + private _localDirection; + private _volume; + private _isLoaded; + private _isReadyToPlay; + isPlaying: boolean; + isPaused: boolean; + private _isDirectional; + private _readyToPlayCallback; + private _audioBuffer; + private _soundSource; + private _soundPanner; + private _soundGain; + private _inputAudioNode; + private _ouputAudioNode; + private _coneInnerAngle; + private _coneOuterAngle; + private _coneOuterGain; + private _scene; + private _connectedMesh; + private _customAttenuationFunction; + private _registerFunc; + private _isOutputConnected; + /** + * Create a sound and attach it to a scene + * @param name Name of your sound + * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer + * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played + * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel + */ + constructor(name: string, urlOrArrayBuffer: any, scene: Scene, readyToPlayCallback?: () => void, options?: any); + dispose(): void; + private _soundLoaded(audioData); + setAudioBuffer(audioBuffer: AudioBuffer): void; + updateOptions(options: any): void; + private _createSpatialParameters(); + private _updateSpatialParameters(); + switchPanningModelToHRTF(): void; + switchPanningModelToEqualPower(): void; + private _switchPanningModel(); + connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void; + /** + * Transform this sound into a directional source + * @param coneInnerAngle Size of the inner cone in degree + * @param coneOuterAngle Size of the outer cone in degree + * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0) + */ + setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void; + setPosition(newPosition: Vector3): void; + setLocalDirectionToMesh(newLocalDirection: Vector3): void; + private _updateDirection(); + updateDistanceFromListener(): void; + setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void; + /** + * Play the sound + * @param time (optional) Start the sound after X seconds. Start immediately (0) by default. + */ + play(time?: number): void; + private _onended(); + /** + * Stop the sound + * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default. + */ + stop(time?: number): void; + pause(): void; + setVolume(newVolume: number, time?: number): void; + setPlaybackRate(newPlaybackRate: number): void; + getVolume(): number; + attachToMesh(meshToConnectTo: AbstractMesh): void; + private _onRegisterAfterWorldMatrixUpdate(connectedMesh); + } +} + +declare module BABYLON { + class SoundTrack { + private _audioEngine; + private _outputAudioNode; + private _inputAudioNode; + private _trackConvolver; + private _scene; + id: number; + soundCollection: Array; + private _isMainTrack; + private _connectedAnalyser; + constructor(scene: Scene, options?: any); + dispose(): void; + AddSound(sound: Sound): void; + RemoveSound(sound: Sound): void; + setVolume(newVolume: number): void; + switchPanningModelToHRTF(): void; + switchPanningModelToEqualPower(): void; + connectToAnalyser(analyser: Analyser): void; + } +} + +declare module BABYLON { + class Bone extends Node { + name: string; + children: Bone[]; + animations: Animation[]; + private _skeleton; + private _matrix; + private _baseMatrix; + private _worldTransform; + private _absoluteTransform; + private _invertedAbsoluteTransform; + private _parent; + constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix); + getParent(): Bone; + getLocalMatrix(): Matrix; + getBaseMatrix(): Matrix; + getWorldMatrix(): Matrix; + getInvertedAbsoluteTransform(): Matrix; + getAbsoluteMatrix(): Matrix; + updateMatrix(matrix: Matrix): void; + private _updateDifferenceMatrix(); + markAsDirty(): void; + } +} + +declare module BABYLON { + class Skeleton { + name: string; + id: string; + bones: Bone[]; + private _scene; + private _isDirty; + private _transformMatrices; + private _animatables; + private _identity; + constructor(name: string, id: string, scene: Scene); + getTransformMatrices(): Float32Array; + getScene(): Scene; + _markAsDirty(): void; + prepare(): void; + getAnimatables(): IAnimatable[]; + clone(name: string, id: string): Skeleton; + } +} + +declare module BABYLON { + class ArcRotateCamera extends TargetCamera { + alpha: number; + beta: number; + radius: number; + target: any; + inertialAlphaOffset: number; + inertialBetaOffset: number; + inertialRadiusOffset: number; + lowerAlphaLimit: any; + upperAlphaLimit: any; + lowerBetaLimit: number; + upperBetaLimit: number; + lowerRadiusLimit: any; + upperRadiusLimit: any; + angularSensibilityX: number; + angularSensibilityY: number; + wheelPrecision: number; + pinchPrecision: number; + panningSensibility: number; + inertialPanningX: number; + inertialPanningY: number; + keysUp: number[]; + keysDown: number[]; + keysLeft: number[]; + keysRight: number[]; + zoomOnFactor: number; + targetScreenOffset: Vector2; + pinchInwards: boolean; + allowUpsideDown: boolean; + private _keys; + _viewMatrix: Matrix; + private _attachedElement; + private _onContextMenu; + private _onPointerDown; + private _onPointerUp; + private _onPointerMove; + private _wheel; + private _onMouseMove; + private _onKeyDown; + private _onKeyUp; + private _onLostFocus; + _reset: () => void; + private _onGestureStart; + private _onGesture; + private _MSGestureHandler; + private _localDirection; + private _transformedDirection; + private _isRightClick; + private _isCtrlPushed; + onCollide: (collidedMesh: AbstractMesh) => void; + checkCollisions: boolean; + collisionRadius: Vector3; + private _collider; + private _previousPosition; + private _collisionVelocity; + private _newPosition; + private _previousAlpha; + private _previousBeta; + private _previousRadius; + private _collisionTriggered; + angularSensibility: number; + constructor(name: string, alpha: number, beta: number, radius: number, target: any, scene: Scene); + _getTargetPosition(): Vector3; + _initCache(): void; + _updateCache(ignoreParentClass?: boolean): void; + _isSynchronizedViewMatrix(): boolean; + attachControl(element: HTMLElement, noPreventDefault?: boolean, useCtrlForPanning?: boolean): void; + detachControl(element: HTMLElement): void; + _checkInputs(): void; + private _checkLimits(); + setPosition(position: Vector3): void; + setTarget(target: Vector3): void; + _getViewMatrix(): Matrix; + private _onCollisionPositionChange; + zoomOn(meshes?: AbstractMesh[], doNotUpdateMaxZ?: boolean): void; + focusOn(meshesOrMinMaxVectorAndDistance: any, doNotUpdateMaxZ?: boolean): void; + /** + * @override + * Override Camera.createRigCamera + */ + createRigCamera(name: string, cameraIndex: number): Camera; + /** + * @override + * Override Camera._updateRigCameras + */ + _updateRigCameras(): void; + } +} + +declare module BABYLON { + class VRCameraMetrics { + hResolution: number; + vResolution: number; + hScreenSize: number; + vScreenSize: number; + vScreenCenter: number; + eyeToScreenDistance: number; + lensSeparationDistance: number; + interpupillaryDistance: number; + distortionK: number[]; + chromaAbCorrection: number[]; + postProcessScaleFactor: number; + lensCenterOffset: number; + compensateDistorsion: boolean; + aspectRatio: number; + aspectRatioFov: number; + leftHMatrix: Matrix; + rightHMatrix: Matrix; + leftPreViewMatrix: Matrix; + rightPreViewMatrix: Matrix; + static GetDefault(): VRCameraMetrics; + } + class Camera extends Node { + position: Vector3; + private static _PERSPECTIVE_CAMERA; + private static _ORTHOGRAPHIC_CAMERA; + private static _FOVMODE_VERTICAL_FIXED; + private static _FOVMODE_HORIZONTAL_FIXED; + private static _RIG_MODE_NONE; + private static _RIG_MODE_STEREOSCOPIC_ANAGLYPH; + private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL; + private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED; + private static _RIG_MODE_STEREOSCOPIC_OVERUNDER; + private static _RIG_MODE_VR; + static PERSPECTIVE_CAMERA: number; + static ORTHOGRAPHIC_CAMERA: number; + static FOVMODE_VERTICAL_FIXED: number; + static FOVMODE_HORIZONTAL_FIXED: number; + static RIG_MODE_NONE: number; + static RIG_MODE_STEREOSCOPIC_ANAGLYPH: number; + static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number; + static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number; + static RIG_MODE_STEREOSCOPIC_OVERUNDER: number; + static RIG_MODE_VR: number; + upVector: Vector3; + orthoLeft: any; + orthoRight: any; + orthoBottom: any; + orthoTop: any; + fov: number; + minZ: number; + maxZ: number; + inertia: number; + mode: number; + isIntermediate: boolean; + viewport: Viewport; + layerMask: number; + fovMode: number; + cameraRigMode: number; + _cameraRigParams: any; + _rigCameras: Camera[]; + private _computedViewMatrix; + _projectionMatrix: Matrix; + private _worldMatrix; + _postProcesses: PostProcess[]; + _postProcessesTakenIndices: any[]; + _activeMeshes: SmartArray; + private _globalPosition; + constructor(name: string, position: Vector3, scene: Scene); + globalPosition: Vector3; + getActiveMeshes(): SmartArray; + isActiveMesh(mesh: Mesh): boolean; + _initCache(): void; + _updateCache(ignoreParentClass?: boolean): void; + _updateFromScene(): void; + _isSynchronized(): boolean; + _isSynchronizedViewMatrix(): boolean; + _isSynchronizedProjectionMatrix(): boolean; + attachControl(element: HTMLElement): void; + detachControl(element: HTMLElement): void; + _update(): void; + _checkInputs(): void; + attachPostProcess(postProcess: PostProcess, insertAt?: number): number; + detachPostProcess(postProcess: PostProcess, atIndices?: any): number[]; + getWorldMatrix(): Matrix; + _getViewMatrix(): Matrix; + getViewMatrix(force?: boolean): Matrix; + _computeViewMatrix(force?: boolean): Matrix; + getProjectionMatrix(force?: boolean): Matrix; + dispose(): void; + setCameraRigMode(mode: number, rigParams: any): void; + private _getVRProjectionMatrix(); + setCameraRigParameter(name: string, value: any): void; + /** + * May needs to be overridden by children so sub has required properties to be copied + */ + createRigCamera(name: string, cameraIndex: number): Camera; + /** + * May needs to be overridden by children + */ + _updateRigCameras(): void; + } +} + +declare module BABYLON { + class DeviceOrientationCamera extends FreeCamera { + private _offsetX; + private _offsetY; + private _orientationGamma; + private _orientationBeta; + private _initialOrientationGamma; + private _initialOrientationBeta; + private _attachedCanvas; + private _orientationChanged; + angularSensibility: number; + moveSensibility: number; + constructor(name: string, position: Vector3, scene: Scene); + attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void; + detachControl(canvas: HTMLCanvasElement): void; + _checkInputs(): void; + } +} + +declare module BABYLON { + class FollowCamera extends TargetCamera { + radius: number; + rotationOffset: number; + heightOffset: number; + cameraAcceleration: number; + maxCameraSpeed: number; + target: AbstractMesh; + constructor(name: string, position: Vector3, scene: Scene); + private getRadians(degrees); + private follow(cameraTarget); + _checkInputs(): void; + } + class ArcFollowCamera extends TargetCamera { + alpha: number; + beta: number; + radius: number; + target: AbstractMesh; + private _cartesianCoordinates; + constructor(name: string, alpha: number, beta: number, radius: number, target: AbstractMesh, scene: Scene); + private follow(); + _checkInputs(): void; + } +} + +declare module BABYLON { + class FreeCamera extends TargetCamera { + ellipsoid: Vector3; + keysUp: number[]; + keysDown: number[]; + keysLeft: number[]; + keysRight: number[]; + checkCollisions: boolean; + applyGravity: boolean; + angularSensibility: number; + onCollide: (collidedMesh: AbstractMesh) => void; + private _keys; + private _collider; + private _needMoveForGravity; + private _oldPosition; + private _diffPosition; + private _newPosition; + private _attachedElement; + private _localDirection; + private _transformedDirection; + private _onMouseDown; + private _onMouseUp; + private _onMouseOut; + private _onMouseMove; + private _onKeyDown; + private _onKeyUp; + _onLostFocus: (e: FocusEvent) => any; + _waitingLockedTargetId: string; + constructor(name: string, position: Vector3, scene: Scene); + attachControl(element: HTMLElement, noPreventDefault?: boolean): void; + detachControl(element: HTMLElement): void; + _collideWithWorld(velocity: Vector3): void; + private _onCollisionPositionChange; + _checkInputs(): void; + _decideIfNeedsToMove(): boolean; + _updatePosition(): void; + } +} + +declare module BABYLON { + class GamepadCamera extends FreeCamera { + private _gamepad; + private _gamepads; + angularSensibility: number; + moveSensibility: number; + constructor(name: string, position: Vector3, scene: Scene); + private _onNewGameConnected(gamepad); + _checkInputs(): void; + dispose(): void; + } +} + +declare module BABYLON { + class AnaglyphFreeCamera extends FreeCamera { + constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene); + } + class AnaglyphArcRotateCamera extends ArcRotateCamera { + constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, scene: Scene); + } + class AnaglyphGamepadCamera extends GamepadCamera { + constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene); + } + class StereoscopicFreeCamera extends FreeCamera { + constructor(name: string, position: Vector3, interaxialDistance: number, isSideBySide: boolean, scene: Scene); + } + class StereoscopicArcRotateCamera extends ArcRotateCamera { + constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, isSideBySide: boolean, scene: Scene); + } + class StereoscopicGamepadCamera extends GamepadCamera { + constructor(name: string, position: Vector3, interaxialDistance: number, isSideBySide: boolean, scene: Scene); + } +} + +declare module BABYLON { + class TargetCamera extends Camera { + cameraDirection: Vector3; + cameraRotation: Vector2; + rotation: Vector3; + speed: number; + noRotationConstraint: boolean; + lockedTarget: any; + _currentTarget: Vector3; + _viewMatrix: Matrix; + _camMatrix: Matrix; + _cameraTransformMatrix: Matrix; + _cameraRotationMatrix: Matrix; + private _rigCamTransformMatrix; + _referencePoint: Vector3; + _transformedReferencePoint: Vector3; + _lookAtTemp: Matrix; + _tempMatrix: Matrix; + _reset: () => void; + _waitingLockedTargetId: string; + constructor(name: string, position: Vector3, scene: Scene); + getFrontPosition(distance: number): Vector3; + _getLockedTargetPosition(): Vector3; + _initCache(): void; + _updateCache(ignoreParentClass?: boolean): void; + _isSynchronizedViewMatrix(): boolean; + _computeLocalCameraSpeed(): number; + setTarget(target: Vector3): void; + getTarget(): Vector3; + _decideIfNeedsToMove(): boolean; + _updatePosition(): void; + _checkInputs(): void; + _getViewMatrix(): Matrix; + _getVRViewMatrix(): Matrix; + /** + * @override + * Override Camera.createRigCamera + */ + createRigCamera(name: string, cameraIndex: number): Camera; + /** + * @override + * Override Camera._updateRigCameras + */ + _updateRigCameras(): void; + private _getRigCamPosition(halfSpace, result); + } +} + +declare module BABYLON { + class TouchCamera extends FreeCamera { + private _offsetX; + private _offsetY; + private _pointerCount; + private _pointerPressed; + private _attachedCanvas; + private _onPointerDown; + private _onPointerUp; + private _onPointerMove; + angularSensibility: number; + moveSensibility: number; + constructor(name: string, position: Vector3, scene: Scene); + attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void; + detachControl(canvas: HTMLCanvasElement): void; + _checkInputs(): void; + } +} + +declare module BABYLON { + class VirtualJoysticksCamera extends FreeCamera { + private _leftjoystick; + private _rightjoystick; + constructor(name: string, position: Vector3, scene: Scene); + getLeftJoystick(): VirtualJoystick; + getRightJoystick(): VirtualJoystick; + _checkInputs(): void; + dispose(): void; + } +} + +declare module BABYLON { + class Collider { + radius: Vector3; + retry: number; + velocity: Vector3; + basePoint: Vector3; + epsilon: number; + collisionFound: boolean; + velocityWorldLength: number; + basePointWorld: Vector3; + velocityWorld: Vector3; + normalizedVelocity: Vector3; + initialVelocity: Vector3; + initialPosition: Vector3; + nearestDistance: number; + intersectionPoint: Vector3; + collidedMesh: AbstractMesh; + private _collisionPoint; + private _planeIntersectionPoint; + private _tempVector; + private _tempVector2; + private _tempVector3; + private _tempVector4; + private _edge; + private _baseToVertex; + private _destinationPoint; + private _slidePlaneNormal; + private _displacementVector; + _initialize(source: Vector3, dir: Vector3, e: number): void; + _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean; + _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean; + _testTriangle(faceIndex: number, trianglePlaneArray: Array, p1: Vector3, p2: Vector3, p3: Vector3, hasMaterial: boolean): void; + _collide(trianglePlaneArray: Array, pts: Vector3[], indices: number[], indexStart: number, indexEnd: number, decal: number, hasMaterial: boolean): void; + _getResponse(pos: Vector3, vel: Vector3): void; + } +} + +declare module BABYLON { + var CollisionWorker: string; + interface ICollisionCoordinator { + getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; + init(scene: Scene): void; + destroy(): void; + onMeshAdded(mesh: AbstractMesh): any; + onMeshUpdated(mesh: AbstractMesh): any; + onMeshRemoved(mesh: AbstractMesh): any; + onGeometryAdded(geometry: Geometry): any; + onGeometryUpdated(geometry: Geometry): any; + onGeometryDeleted(geometry: Geometry): any; + } + interface SerializedMesh { + id: string; + name: string; + uniqueId: number; + geometryId: string; + sphereCenter: Array; + sphereRadius: number; + boxMinimum: Array; + boxMaximum: Array; + worldMatrixFromCache: any; + subMeshes: Array; + checkCollisions: boolean; + } + interface SerializedSubMesh { + position: number; + verticesStart: number; + verticesCount: number; + indexStart: number; + indexCount: number; + hasMaterial: boolean; + sphereCenter: Array; + sphereRadius: number; + boxMinimum: Array; + boxMaximum: Array; + } + interface SerializedGeometry { + id: string; + positions: Float32Array; + indices: Int32Array; + normals: Float32Array; + } + interface BabylonMessage { + taskType: WorkerTaskType; + payload: InitPayload | CollidePayload | UpdatePayload; + } + interface SerializedColliderToWorker { + position: Array; + velocity: Array; + radius: Array; + } + enum WorkerTaskType { + INIT = 0, + UPDATE = 1, + COLLIDE = 2, + } + interface WorkerReply { + error: WorkerReplyType; + taskType: WorkerTaskType; + payload?: any; + } + interface CollisionReplyPayload { + newPosition: Array; + collisionId: number; + collidedMeshUniqueId: number; + } + interface InitPayload { + } + interface CollidePayload { + collisionId: number; + collider: SerializedColliderToWorker; + maximumRetry: number; + excludedMeshUniqueId?: number; + } + interface UpdatePayload { + updatedMeshes: { + [n: number]: SerializedMesh; + }; + updatedGeometries: { + [s: string]: SerializedGeometry; + }; + removedMeshes: Array; + removedGeometries: Array; + } + enum WorkerReplyType { + SUCCESS = 0, + UNKNOWN_ERROR = 1, + } + class CollisionCoordinatorWorker implements ICollisionCoordinator { + private _scene; + private _scaledPosition; + private _scaledVelocity; + private _collisionsCallbackArray; + private _init; + private _runningUpdated; + private _runningCollisionTask; + private _worker; + private _addUpdateMeshesList; + private _addUpdateGeometriesList; + private _toRemoveMeshesArray; + private _toRemoveGeometryArray; + constructor(); + static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh; + static SerializeGeometry: (geometry: Geometry) => SerializedGeometry; + getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; + init(scene: Scene): void; + destroy(): void; + onMeshAdded(mesh: AbstractMesh): void; + onMeshUpdated: (mesh: AbstractMesh) => void; + onMeshRemoved(mesh: AbstractMesh): void; + onGeometryAdded(geometry: Geometry): void; + onGeometryUpdated: (geometry: Geometry) => void; + onGeometryDeleted(geometry: Geometry): void; + private _afterRender; + private _onMessageFromWorker; + } + class CollisionCoordinatorLegacy implements ICollisionCoordinator { + private _scene; + private _scaledPosition; + private _scaledVelocity; + private _finalPosition; + getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; + init(scene: Scene): void; + destroy(): void; + onMeshAdded(mesh: AbstractMesh): void; + onMeshUpdated(mesh: AbstractMesh): void; + onMeshRemoved(mesh: AbstractMesh): void; + onGeometryAdded(geometry: Geometry): void; + onGeometryUpdated(geometry: Geometry): void; + onGeometryDeleted(geometry: Geometry): void; + private _collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh?); + } +} + +declare module BABYLON { + var WorkerIncluded: boolean; + class CollisionCache { + private _meshes; + private _geometries; + getMeshes(): { + [n: number]: SerializedMesh; + }; + getGeometries(): { + [s: number]: SerializedGeometry; + }; + getMesh(id: any): SerializedMesh; + addMesh(mesh: SerializedMesh): void; + getGeometry(id: string): SerializedGeometry; + addGeometry(geometry: SerializedGeometry): void; + } + class CollideWorker { + collider: Collider; + private _collisionCache; + private finalPosition; + private collisionsScalingMatrix; + private collisionTranformationMatrix; + constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3); + collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void; + private checkCollision(mesh); + private processCollisionsForSubMeshes(transformMatrix, mesh); + private collideForSubMesh(subMesh, transformMatrix, meshGeometry); + private checkSubmeshCollision(subMesh); + } + interface ICollisionDetector { + onInit(payload: InitPayload): void; + onUpdate(payload: UpdatePayload): void; + onCollision(payload: CollidePayload): void; + } + class CollisionDetectorTransferable implements ICollisionDetector { + private _collisionCache; + onInit(payload: InitPayload): void; + onUpdate(payload: UpdatePayload): void; + onCollision(payload: CollidePayload): void; + } +} + +declare module BABYLON { + class IntersectionInfo { + bu: number; + bv: number; + distance: number; + faceId: number; + subMeshId: number; + constructor(bu: number, bv: number, distance: number); + } + class PickingInfo { + hit: boolean; + distance: number; + pickedPoint: Vector3; + pickedMesh: AbstractMesh; + bu: number; + bv: number; + faceId: number; + subMeshId: number; + getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3; + getTextureCoordinates(): Vector2; + } +} + +declare module BABYLON { + class BoundingBox { + minimum: Vector3; + maximum: Vector3; + vectors: Vector3[]; + center: Vector3; + extendSize: Vector3; + directions: Vector3[]; + vectorsWorld: Vector3[]; + minimumWorld: Vector3; + maximumWorld: Vector3; + private _worldMatrix; + constructor(minimum: Vector3, maximum: Vector3); + getWorldMatrix(): Matrix; + _update(world: Matrix): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + isCompletelyInFrustum(frustumPlanes: Plane[]): boolean; + intersectsPoint(point: Vector3): boolean; + intersectsSphere(sphere: BoundingSphere): boolean; + intersectsMinMax(min: Vector3, max: Vector3): boolean; + static Intersects(box0: BoundingBox, box1: BoundingBox): boolean; + static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean; + static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean; + static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean; + } +} + +declare module BABYLON { + class BoundingInfo { + minimum: Vector3; + maximum: Vector3; + boundingBox: BoundingBox; + boundingSphere: BoundingSphere; + constructor(minimum: Vector3, maximum: Vector3); + _update(world: Matrix): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + isCompletelyInFrustum(frustumPlanes: Plane[]): boolean; + _checkCollision(collider: Collider): boolean; + intersectsPoint(point: Vector3): boolean; + intersects(boundingInfo: BoundingInfo, precise: boolean): boolean; + } +} + +declare module BABYLON { + class BoundingSphere { + minimum: Vector3; + maximum: Vector3; + center: Vector3; + radius: number; + centerWorld: Vector3; + radiusWorld: number; + private _tempRadiusVector; + constructor(minimum: Vector3, maximum: Vector3); + _update(world: Matrix): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + intersectsPoint(point: Vector3): boolean; + static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean; + } +} + +declare module BABYLON { + class DebugLayer { + private _scene; + private _camera; + private _transformationMatrix; + private _enabled; + private _labelsEnabled; + private _displayStatistics; + private _displayTree; + private _displayLogs; + private _globalDiv; + private _statsDiv; + private _statsSubsetDiv; + private _optionsDiv; + private _optionsSubsetDiv; + private _logDiv; + private _logSubsetDiv; + private _treeDiv; + private _treeSubsetDiv; + private _drawingCanvas; + private _drawingContext; + private _syncPositions; + private _syncData; + private _syncUI; + private _onCanvasClick; + private _clickPosition; + private _ratio; + private _identityMatrix; + private _showUI; + private _needToRefreshMeshesTree; + shouldDisplayLabel: (node: Node) => boolean; + shouldDisplayAxis: (mesh: Mesh) => boolean; + axisRatio: number; + accentColor: string; + customStatsFunction: () => string; + constructor(scene: Scene); + private _refreshMeshesTreeContent(); + private _renderSingleAxis(zero, unit, unitText, label, color); + private _renderAxis(projectedPosition, mesh, globalViewport); + private _renderLabel(text, projectedPosition, labelOffset, onClick, getFillStyle); + private _isClickInsideRect(x, y, width, height); + isVisible(): boolean; + hide(): void; + show(showUI?: boolean, camera?: Camera): void; + private _clearLabels(); + private _generateheader(root, text); + private _generateTexBox(root, title, color); + private _generateAdvancedCheckBox(root, leftTitle, rightTitle, initialState, task, tag?); + private _generateCheckBox(root, title, initialState, task, tag?); + private _generateButton(root, title, task, tag?); + private _generateRadio(root, title, name, initialState, task, tag?); + private _generateDOMelements(); + private _displayStats(); + } +} + +declare module BABYLON { + class Layer { + name: string; + texture: Texture; + isBackground: boolean; + color: Color4; + onDispose: () => void; + private _scene; + private _vertexDeclaration; + private _vertexStrideSize; + private _vertexBuffer; + private _indexBuffer; + private _effect; + constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4); + render(): void; + dispose(): void; + } +} + +declare module BABYLON { + class LensFlare { + size: number; + position: number; + color: Color3; + texture: Texture; + private _system; + constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem); + dispose: () => void; + } +} + +declare module BABYLON { + class LensFlareSystem { + name: string; + lensFlares: LensFlare[]; + borderLimit: number; + meshesSelectionPredicate: (mesh: Mesh) => boolean; + layerMask: number; + private _scene; + private _emitter; + private _vertexDeclaration; + private _vertexStrideSize; + private _vertexBuffer; + private _indexBuffer; + private _effect; + private _positionX; + private _positionY; + private _isEnabled; + constructor(name: string, emitter: any, scene: Scene); + isEnabled: boolean; + getScene(): Scene; + getEmitter(): any; + setEmitter(newEmitter: any): void; + getEmitterPosition(): Vector3; + computeEffectivePosition(globalViewport: Viewport): boolean; + _isVisible(): boolean; + render(): boolean; + dispose(): void; + } +} + +declare module BABYLON { + class DirectionalLight extends Light implements IShadowLight { + direction: Vector3; + position: Vector3; + private _transformedDirection; + transformedPosition: Vector3; + private _worldMatrix; + shadowOrthoScale: number; + constructor(name: string, direction: Vector3, scene: Scene); + getAbsolutePosition(): Vector3; + setDirectionToTarget(target: Vector3): Vector3; + setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; + supportsVSM(): boolean; + needRefreshPerFrame(): boolean; + computeTransformedPosition(): boolean; + transferToEffect(effect: Effect, directionUniformName: string): void; + _getWorldMatrix(): Matrix; + } +} + +declare module BABYLON { + class HemisphericLight extends Light { + direction: Vector3; + groundColor: Color3; + private _worldMatrix; + constructor(name: string, direction: Vector3, scene: Scene); + setDirectionToTarget(target: Vector3): Vector3; + getShadowGenerator(): ShadowGenerator; + transferToEffect(effect: Effect, directionUniformName: string, groundColorUniformName: string): void; + _getWorldMatrix(): Matrix; + } +} + +declare module BABYLON { + interface IShadowLight { + position: Vector3; + direction: Vector3; + transformedPosition: Vector3; + name: string; + computeTransformedPosition(): boolean; + getScene(): Scene; + setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; + supportsVSM(): boolean; + needRefreshPerFrame(): boolean; + _shadowGenerator: ShadowGenerator; + } + class Light extends Node { + diffuse: Color3; + specular: Color3; + intensity: number; + range: number; + includeOnlyWithLayerMask: number; + includedOnlyMeshes: AbstractMesh[]; + excludedMeshes: AbstractMesh[]; + excludeWithLayerMask: number; + _shadowGenerator: ShadowGenerator; + private _parentedWorldMatrix; + _excludedMeshesIds: string[]; + _includedOnlyMeshesIds: string[]; + constructor(name: string, scene: Scene); + getShadowGenerator(): ShadowGenerator; + getAbsolutePosition(): Vector3; + transferToEffect(effect: Effect, uniformName0?: string, uniformName1?: string): void; + _getWorldMatrix(): Matrix; + canAffectMesh(mesh: AbstractMesh): boolean; + getWorldMatrix(): Matrix; + dispose(): void; + } +} + +declare module BABYLON { + class PointLight extends Light { + position: Vector3; + private _worldMatrix; + private _transformedPosition; + constructor(name: string, position: Vector3, scene: Scene); + getAbsolutePosition(): Vector3; + transferToEffect(effect: Effect, positionUniformName: string): void; + getShadowGenerator(): ShadowGenerator; + _getWorldMatrix(): Matrix; + } +} + +declare module BABYLON { + class SpotLight extends Light implements IShadowLight { + position: Vector3; + direction: Vector3; + angle: number; + exponent: number; + transformedPosition: Vector3; + private _transformedDirection; + private _worldMatrix; + constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene); + getAbsolutePosition(): Vector3; + setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; + supportsVSM(): boolean; + needRefreshPerFrame(): boolean; + setDirectionToTarget(target: Vector3): Vector3; + computeTransformedPosition(): boolean; + transferToEffect(effect: Effect, positionUniformName: string, directionUniformName: string): void; + _getWorldMatrix(): Matrix; + } +} + +declare module BABYLON { + interface ISceneLoaderPlugin { + extensions: string; + importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean; + load: (scene: Scene, data: string, rootUrl: string) => boolean; + } + class SceneLoader { + private static _ForceFullSceneLoadingForIncremental; + private static _ShowLoadingScreen; + static ForceFullSceneLoadingForIncremental: boolean; + static ShowLoadingScreen: boolean; + private static _registeredPlugins; + private static _getPluginForFilename(sceneFilename); + static RegisterPlugin(plugin: ISceneLoaderPlugin): void; + static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene, e: any) => void): void; + /** + * Load a scene + * @param rootUrl a string that defines the root url for scene and resources + * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene + * @param engine is the instance of BABYLON.Engine to use to create the scene + */ + static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void; + /** + * Append a scene + * @param rootUrl a string that defines the root url for scene and resources + * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene + * @param scene is the instance of BABYLON.Scene to append to + */ + static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void; + } +} + +declare module BABYLON { + class EffectFallbacks { + private _defines; + private _currentRank; + private _maxRank; + addFallback(rank: number, define: string): void; + isMoreFallbacks: boolean; + reduce(currentDefines: string): string; + } + class Effect { + name: any; + defines: string; + onCompiled: (effect: Effect) => void; + onError: (effect: Effect, errors: string) => void; + onBind: (effect: Effect) => void; + private _engine; + private _uniformsNames; + private _samplers; + private _isReady; + private _compilationError; + private _attributesNames; + private _attributes; + private _uniforms; + _key: string; + private _program; + private _valueCache; + constructor(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], engine: any, defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void); + isReady(): boolean; + getProgram(): WebGLProgram; + getAttributesNames(): string[]; + getAttributeLocation(index: number): number; + getAttributeLocationByName(name: string): number; + getAttributesCount(): number; + getUniformIndex(uniformName: string): number; + getUniform(uniformName: string): WebGLUniformLocation; + getSamplers(): string[]; + getCompilationError(): string; + _loadVertexShader(vertex: any, callback: (data: any) => void): void; + _loadFragmentShader(fragment: any, callback: (data: any) => void): void; + private _prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks?); + _bindTexture(channel: string, texture: WebGLTexture): void; + setTexture(channel: string, texture: BaseTexture): void; + setTextureFromPostProcess(channel: string, postProcess: PostProcess): void; + _cacheFloat2(uniformName: string, x: number, y: number): void; + _cacheFloat3(uniformName: string, x: number, y: number, z: number): void; + _cacheFloat4(uniformName: string, x: number, y: number, z: number, w: number): void; + setArray(uniformName: string, array: number[]): Effect; + setArray2(uniformName: string, array: number[]): Effect; + setArray3(uniformName: string, array: number[]): Effect; + setArray4(uniformName: string, array: number[]): Effect; + setMatrices(uniformName: string, matrices: Float32Array): Effect; + setMatrix(uniformName: string, matrix: Matrix): Effect; + setMatrix3x3(uniformName: string, matrix: Float32Array): Effect; + setMatrix2x2(uniformname: string, matrix: Float32Array): Effect; + setFloat(uniformName: string, value: number): Effect; + setBool(uniformName: string, bool: boolean): Effect; + setVector2(uniformName: string, vector2: Vector2): Effect; + setFloat2(uniformName: string, x: number, y: number): Effect; + setVector3(uniformName: string, vector3: Vector3): Effect; + setFloat3(uniformName: string, x: number, y: number, z: number): Effect; + setVector4(uniformName: string, vector4: Vector4): Effect; + setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect; + setColor3(uniformName: string, color3: Color3): Effect; + setColor4(uniformName: string, color3: Color3, alpha: number): Effect; + static ShadersStore: {}; + } +} + +declare module BABYLON { + class Material { + name: string; + private static _TriangleFillMode; + private static _WireFrameFillMode; + private static _PointFillMode; + static TriangleFillMode: number; + static WireFrameFillMode: number; + static PointFillMode: number; + id: string; + checkReadyOnEveryCall: boolean; + checkReadyOnlyOnce: boolean; + state: string; + alpha: number; + backFaceCulling: boolean; + onCompiled: (effect: Effect) => void; + onError: (effect: Effect, errors: string) => void; + onDispose: () => void; + onBind: (material: Material, mesh: Mesh) => void; + getRenderTargetTextures: () => SmartArray; + alphaMode: number; + disableDepthWrite: boolean; + _effect: Effect; + _wasPreviouslyReady: boolean; + private _scene; + private _fillMode; + private _cachedDepthWriteState; + pointSize: number; + zOffset: number; + wireframe: boolean; + pointsCloud: boolean; + fillMode: number; + constructor(name: string, scene: Scene, doNotAdd?: boolean); + isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; + getEffect(): Effect; + getScene(): Scene; + needAlphaBlending(): boolean; + needAlphaTesting(): boolean; + getAlphaTestTexture(): BaseTexture; + trackCreation(onCompiled: (effect: Effect) => void, onError: (effect: Effect, errors: string) => void): void; + _preBind(): void; + bind(world: Matrix, mesh?: Mesh): void; + bindOnlyWorldMatrix(world: Matrix): void; + unbind(): void; + clone(name: string): Material; + dispose(forceDisposeEffect?: boolean): void; + } +} + +declare module BABYLON { + class MultiMaterial extends Material { + subMaterials: Material[]; + constructor(name: string, scene: Scene); + getSubMaterial(index: any): Material; + isReady(mesh?: AbstractMesh): boolean; + clone(name: string): MultiMaterial; + } +} + +declare module BABYLON { + class ShaderMaterial extends Material { + private _shaderPath; + private _options; + private _textures; + private _floats; + private _floatsArrays; + private _colors3; + private _colors4; + private _vectors2; + private _vectors3; + private _vectors4; + private _matrices; + private _matrices3x3; + private _matrices2x2; + private _cachedWorldViewMatrix; + private _renderId; + constructor(name: string, scene: Scene, shaderPath: any, options: any); + needAlphaBlending(): boolean; + needAlphaTesting(): boolean; + private _checkUniform(uniformName); + setTexture(name: string, texture: Texture): ShaderMaterial; + setFloat(name: string, value: number): ShaderMaterial; + setFloats(name: string, value: number[]): ShaderMaterial; + setColor3(name: string, value: Color3): ShaderMaterial; + setColor4(name: string, value: Color4): ShaderMaterial; + setVector2(name: string, value: Vector2): ShaderMaterial; + setVector3(name: string, value: Vector3): ShaderMaterial; + setVector4(name: string, value: Vector4): ShaderMaterial; + setMatrix(name: string, value: Matrix): ShaderMaterial; + setMatrix3x3(name: string, value: Float32Array): ShaderMaterial; + setMatrix2x2(name: string, value: Float32Array): ShaderMaterial; + isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; + bindOnlyWorldMatrix(world: Matrix): void; + bind(world: Matrix, mesh?: Mesh): void; + clone(name: string): ShaderMaterial; + dispose(forceDisposeEffect?: boolean): void; + } +} + +declare module BABYLON { + class FresnelParameters { + isEnabled: boolean; + leftColor: Color3; + rightColor: Color3; + bias: number; + power: number; + } + class StandardMaterial extends Material { + diffuseTexture: BaseTexture; + ambientTexture: BaseTexture; + opacityTexture: BaseTexture; + reflectionTexture: BaseTexture; + emissiveTexture: BaseTexture; + specularTexture: BaseTexture; + bumpTexture: BaseTexture; + ambientColor: Color3; + diffuseColor: Color3; + specularColor: Color3; + specularPower: number; + emissiveColor: Color3; + useAlphaFromDiffuseTexture: boolean; + useEmissiveAsIllumination: boolean; + useReflectionFresnelFromSpecular: boolean; + useSpecularOverAlpha: boolean; + fogEnabled: boolean; + roughness: number; + diffuseFresnelParameters: FresnelParameters; + opacityFresnelParameters: FresnelParameters; + reflectionFresnelParameters: FresnelParameters; + emissiveFresnelParameters: FresnelParameters; + useGlossinessFromSpecularMapAlpha: boolean; + private _renderTargets; + private _worldViewProjectionMatrix; + private _globalAmbientColor; + private _scaledDiffuse; + private _scaledSpecular; + private _renderId; + private _defines; + private _cachedDefines; + constructor(name: string, scene: Scene); + needAlphaBlending(): boolean; + needAlphaTesting(): boolean; + private _shouldUseAlphaFromDiffuseTexture(); + getAlphaTestTexture(): BaseTexture; + isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; + unbind(): void; + bindOnlyWorldMatrix(world: Matrix): void; + bind(world: Matrix, mesh?: Mesh): void; + getAnimatables(): IAnimatable[]; + dispose(forceDisposeEffect?: boolean): void; + clone(name: string): StandardMaterial; + static DiffuseTextureEnabled: boolean; + static AmbientTextureEnabled: boolean; + static OpacityTextureEnabled: boolean; + static ReflectionTextureEnabled: boolean; + static EmissiveTextureEnabled: boolean; + static SpecularTextureEnabled: boolean; + static BumpTextureEnabled: boolean; + static FresnelEnabled: boolean; + } +} + +declare module BABYLON { + class Color3 { + r: number; + g: number; + b: number; + constructor(r?: number, g?: number, b?: number); + toString(): string; + toArray(array: number[], index?: number): Color3; + toColor4(alpha?: number): Color4; + asArray(): number[]; + toLuminance(): number; + multiply(otherColor: Color3): Color3; + multiplyToRef(otherColor: Color3, result: Color3): Color3; + equals(otherColor: Color3): boolean; + equalsFloats(r: number, g: number, b: number): boolean; + scale(scale: number): Color3; + scaleToRef(scale: number, result: Color3): Color3; + add(otherColor: Color3): Color3; + addToRef(otherColor: Color3, result: Color3): Color3; + subtract(otherColor: Color3): Color3; + subtractToRef(otherColor: Color3, result: Color3): Color3; + clone(): Color3; + copyFrom(source: Color3): Color3; + copyFromFloats(r: number, g: number, b: number): Color3; + toHexString(): string; + static FromHexString(hex: string): Color3; + static FromArray(array: number[], offset?: number): Color3; + static FromInts(r: number, g: number, b: number): Color3; + static Lerp(start: Color3, end: Color3, amount: number): Color3; + static Red(): Color3; + static Green(): Color3; + static Blue(): Color3; + static Black(): Color3; + static White(): Color3; + static Purple(): Color3; + static Magenta(): Color3; + static Yellow(): Color3; + static Gray(): Color3; + } + class Color4 { + r: number; + g: number; + b: number; + a: number; + constructor(r: number, g: number, b: number, a: number); + addInPlace(right: any): Color4; + asArray(): number[]; + toArray(array: number[], index?: number): Color4; + add(right: Color4): Color4; + subtract(right: Color4): Color4; + subtractToRef(right: Color4, result: Color4): Color4; + scale(scale: number): Color4; + scaleToRef(scale: number, result: Color4): Color4; + toString(): string; + clone(): Color4; + copyFrom(source: Color4): Color4; + toHexString(): string; + static FromHexString(hex: string): Color4; + static Lerp(left: Color4, right: Color4, amount: number): Color4; + static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void; + static FromArray(array: number[], offset?: number): Color4; + static FromInts(r: number, g: number, b: number, a: number): Color4; + } + class Vector2 { + x: number; + y: number; + constructor(x: number, y: number); + toString(): string; + toArray(array: number[], index?: number): Vector2; + asArray(): number[]; + copyFrom(source: Vector2): Vector2; + copyFromFloats(x: number, y: number): Vector2; + add(otherVector: Vector2): Vector2; + addVector3(otherVector: Vector3): Vector2; + subtract(otherVector: Vector2): Vector2; + subtractInPlace(otherVector: Vector2): Vector2; + multiplyInPlace(otherVector: Vector2): Vector2; + multiply(otherVector: Vector2): Vector2; + multiplyToRef(otherVector: Vector2, result: Vector2): Vector2; + multiplyByFloats(x: number, y: number): Vector2; + divide(otherVector: Vector2): Vector2; + divideToRef(otherVector: Vector2, result: Vector2): Vector2; + negate(): Vector2; + scaleInPlace(scale: number): Vector2; + scale(scale: number): Vector2; + equals(otherVector: Vector2): boolean; + equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean; + length(): number; + lengthSquared(): number; + normalize(): Vector2; + clone(): Vector2; + static Zero(): Vector2; + static FromArray(array: number[], offset?: number): Vector2; + static FromArrayToRef(array: number[], offset: number, result: Vector2): void; + static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2; + static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2; + static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2; + static Lerp(start: Vector2, end: Vector2, amount: number): Vector2; + static Dot(left: Vector2, right: Vector2): number; + static Normalize(vector: Vector2): Vector2; + static Minimize(left: Vector2, right: Vector2): Vector2; + static Maximize(left: Vector2, right: Vector2): Vector2; + static Transform(vector: Vector2, transformation: Matrix): Vector2; + static Distance(value1: Vector2, value2: Vector2): number; + static DistanceSquared(value1: Vector2, value2: Vector2): number; + } + class Vector3 { + x: number; + y: number; + z: number; + constructor(x: number, y: number, z: number); + toString(): string; + asArray(): number[]; + toArray(array: number[], index?: number): Vector3; + toQuaternion(): Quaternion; + addInPlace(otherVector: Vector3): Vector3; + add(otherVector: Vector3): Vector3; + addToRef(otherVector: Vector3, result: Vector3): Vector3; + subtractInPlace(otherVector: Vector3): Vector3; + subtract(otherVector: Vector3): Vector3; + subtractToRef(otherVector: Vector3, result: Vector3): Vector3; + subtractFromFloats(x: number, y: number, z: number): Vector3; + subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3; + negate(): Vector3; + scaleInPlace(scale: number): Vector3; + scale(scale: number): Vector3; + scaleToRef(scale: number, result: Vector3): void; + equals(otherVector: Vector3): boolean; + equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean; + equalsToFloats(x: number, y: number, z: number): boolean; + multiplyInPlace(otherVector: Vector3): Vector3; + multiply(otherVector: Vector3): Vector3; + multiplyToRef(otherVector: Vector3, result: Vector3): Vector3; + multiplyByFloats(x: number, y: number, z: number): Vector3; + divide(otherVector: Vector3): Vector3; + divideToRef(otherVector: Vector3, result: Vector3): Vector3; + MinimizeInPlace(other: Vector3): Vector3; + MaximizeInPlace(other: Vector3): Vector3; + length(): number; + lengthSquared(): number; + normalize(): Vector3; + clone(): Vector3; + copyFrom(source: Vector3): Vector3; + copyFromFloats(x: number, y: number, z: number): Vector3; + static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: any): number; + static FromArray(array: number[], offset?: number): Vector3; + static FromFloatArray(array: Float32Array, offset?: number): Vector3; + static FromArrayToRef(array: number[], offset: number, result: Vector3): void; + static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void; + static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void; + static Zero(): Vector3; + static Up(): Vector3; + static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3; + static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void; + static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; + static TransformCoordinatesToRefSIMD(vector: Vector3, transformation: Matrix, result: Vector3): void; + static TransformCoordinatesFromFloatsToRefSIMD(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; + static TransformNormal(vector: Vector3, transformation: Matrix): Vector3; + static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void; + static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; + static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3; + static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3; + static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3; + static Lerp(start: Vector3, end: Vector3, amount: number): Vector3; + static Dot(left: Vector3, right: Vector3): number; + static Cross(left: Vector3, right: Vector3): Vector3; + static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void; + static Normalize(vector: Vector3): Vector3; + static NormalizeToRef(vector: Vector3, result: Vector3): void; + static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3; + static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3; + static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3; + static Minimize(left: Vector3, right: Vector3): Vector3; + static Maximize(left: Vector3, right: Vector3): Vector3; + static Distance(value1: Vector3, value2: Vector3): number; + static DistanceSquared(value1: Vector3, value2: Vector3): number; + static Center(value1: Vector3, value2: Vector3): Vector3; + /** + * Given three orthogonal left-handed oriented Vector3 axis in space (target system), + * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply + * to something in order to rotate it from its local system to the given target system. + */ + static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3; + /** + * The same than RotationFromAxis but updates the passed ref Vector3 parameter. + */ + static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void; + } + class Vector4 { + x: number; + y: number; + z: number; + w: number; + constructor(x: number, y: number, z: number, w: number); + toString(): string; + asArray(): number[]; + toArray(array: number[], index?: number): Vector4; + addInPlace(otherVector: Vector4): Vector4; + add(otherVector: Vector4): Vector4; + addToRef(otherVector: Vector4, result: Vector4): Vector4; + subtractInPlace(otherVector: Vector4): Vector4; + subtract(otherVector: Vector4): Vector4; + subtractToRef(otherVector: Vector4, result: Vector4): Vector4; + subtractFromFloats(x: number, y: number, z: number, w: number): Vector4; + subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4; + negate(): Vector4; + scaleInPlace(scale: number): Vector4; + scale(scale: number): Vector4; + scaleToRef(scale: number, result: Vector4): void; + equals(otherVector: Vector4): boolean; + equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean; + equalsToFloats(x: number, y: number, z: number, w: number): boolean; + multiplyInPlace(otherVector: Vector4): Vector4; + multiply(otherVector: Vector4): Vector4; + multiplyToRef(otherVector: Vector4, result: Vector4): Vector4; + multiplyByFloats(x: number, y: number, z: number, w: number): Vector4; + divide(otherVector: Vector4): Vector4; + divideToRef(otherVector: Vector4, result: Vector4): Vector4; + MinimizeInPlace(other: Vector4): Vector4; + MaximizeInPlace(other: Vector4): Vector4; + length(): number; + lengthSquared(): number; + normalize(): Vector4; + clone(): Vector4; + copyFrom(source: Vector4): Vector4; + copyFromFloats(x: number, y: number, z: number, w: number): Vector4; + static FromArray(array: number[], offset?: number): Vector4; + static FromArrayToRef(array: number[], offset: number, result: Vector4): void; + static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void; + static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void; + static Zero(): Vector4; + static Normalize(vector: Vector4): Vector4; + static NormalizeToRef(vector: Vector4, result: Vector4): void; + static Minimize(left: Vector4, right: Vector4): Vector4; + static Maximize(left: Vector4, right: Vector4): Vector4; + static Distance(value1: Vector4, value2: Vector4): number; + static DistanceSquared(value1: Vector4, value2: Vector4): number; + static Center(value1: Vector4, value2: Vector4): Vector4; + } + class Quaternion { + x: number; + y: number; + z: number; + w: number; + constructor(x?: number, y?: number, z?: number, w?: number); + toString(): string; + asArray(): number[]; + equals(otherQuaternion: Quaternion): boolean; + clone(): Quaternion; + copyFrom(other: Quaternion): Quaternion; + copyFromFloats(x: number, y: number, z: number, w: number): Quaternion; + add(other: Quaternion): Quaternion; + subtract(other: Quaternion): Quaternion; + scale(value: number): Quaternion; + multiply(q1: Quaternion): Quaternion; + multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion; + length(): number; + normalize(): Quaternion; + toEulerAngles(): Vector3; + toEulerAnglesToRef(result: Vector3): Quaternion; + toRotationMatrix(result: Matrix): Quaternion; + fromRotationMatrix(matrix: Matrix): Quaternion; + static FromRotationMatrix(matrix: Matrix): Quaternion; + static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void; + static Inverse(q: Quaternion): Quaternion; + static Identity(): Quaternion; + static RotationAxis(axis: Vector3, angle: number): Quaternion; + static FromArray(array: number[], offset?: number): Quaternion; + static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion; + static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void; + static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion; + static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void; + static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion; + } + class Matrix { + private static _tempQuaternion; + private static _xAxis; + private static _yAxis; + private static _zAxis; + m: Float32Array; + isIdentity(): boolean; + determinant(): number; + toArray(): Float32Array; + asArray(): Float32Array; + invert(): Matrix; + reset(): Matrix; + add(other: Matrix): Matrix; + addToRef(other: Matrix, result: Matrix): Matrix; + addToSelf(other: Matrix): Matrix; + invertToRef(other: Matrix): Matrix; + invertToRefSIMD(other: Matrix): Matrix; + setTranslation(vector3: Vector3): Matrix; + multiply(other: Matrix): Matrix; + copyFrom(other: Matrix): Matrix; + copyToArray(array: Float32Array, offset?: number): Matrix; + multiplyToRef(other: Matrix, result: Matrix): Matrix; + multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix; + multiplyToArraySIMD(other: Matrix, result: Matrix, offset?: number): void; + equals(value: Matrix): boolean; + clone(): Matrix; + decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean; + static FromArray(array: number[], offset?: number): Matrix; + static FromArrayToRef(array: number[], offset: number, result: Matrix): void; + static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void; + static FromValuesToRef(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number, result: Matrix): void; + static FromValues(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number): Matrix; + static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix; + static Identity(): Matrix; + static IdentityToRef(result: Matrix): void; + static Zero(): Matrix; + static RotationX(angle: number): Matrix; + static Invert(source: Matrix): Matrix; + static RotationXToRef(angle: number, result: Matrix): void; + static RotationY(angle: number): Matrix; + static RotationYToRef(angle: number, result: Matrix): void; + static RotationZ(angle: number): Matrix; + static RotationZToRef(angle: number, result: Matrix): void; + static RotationAxis(axis: Vector3, angle: number): Matrix; + static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix; + static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void; + static Scaling(x: number, y: number, z: number): Matrix; + static ScalingToRef(x: number, y: number, z: number, result: Matrix): void; + static Translation(x: number, y: number, z: number): Matrix; + static TranslationToRef(x: number, y: number, z: number, result: Matrix): void; + static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix; + static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void; + static LookAtLHToRefSIMD(eyeRef: Vector3, targetRef: Vector3, upRef: Vector3, result: Matrix): void; + static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix; + static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void; + static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix; + static OrthoOffCenterLHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void; + static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix; + static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix; + static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, fovMode?: number): void; + static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix; + static GetAsMatrix2x2(matrix: Matrix): Float32Array; + static GetAsMatrix3x3(matrix: Matrix): Float32Array; + static Transpose(matrix: Matrix): Matrix; + static Reflection(plane: Plane): Matrix; + static ReflectionToRef(plane: Plane, result: Matrix): void; + } + class Plane { + normal: Vector3; + d: number; + constructor(a: number, b: number, c: number, d: number); + asArray(): number[]; + clone(): Plane; + normalize(): Plane; + transform(transformation: Matrix): Plane; + dotCoordinate(point: any): number; + copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane; + isFrontFacingTo(direction: Vector3, epsilon: number): boolean; + signedDistanceTo(point: Vector3): number; + static FromArray(array: number[]): Plane; + static FromPoints(point1: any, point2: any, point3: any): Plane; + static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane; + static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number; + } + class Viewport { + x: number; + y: number; + width: number; + height: number; + constructor(x: number, y: number, width: number, height: number); + toGlobal(engine: any): Viewport; + } + class Frustum { + static GetPlanes(transform: Matrix): Plane[]; + static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void; + } + class Ray { + origin: Vector3; + direction: Vector3; + length: number; + private _edge1; + private _edge2; + private _pvec; + private _tvec; + private _qvec; + constructor(origin: Vector3, direction: Vector3, length?: number); + intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean; + intersectsBox(box: BoundingBox): boolean; + intersectsSphere(sphere: any): boolean; + intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo; + static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray; + /** + * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be + * transformed to the given world matrix. + * @param origin The origin point + * @param end The end point + * @param world a matrix to transform the ray to. Default is the identity matrix. + */ + static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray; + static Transform(ray: Ray, matrix: Matrix): Ray; + } + enum Space { + LOCAL = 0, + WORLD = 1, + } + class Axis { + static X: Vector3; + static Y: Vector3; + static Z: Vector3; + } + class BezierCurve { + static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number; + } + enum Orientation { + CW = 0, + CCW = 1, + } + class Angle { + private _radians; + constructor(radians: number); + degrees: () => number; + radians: () => number; + static BetweenTwoPoints(a: Vector2, b: Vector2): Angle; + static FromRadians(radians: number): Angle; + static FromDegrees(degrees: number): Angle; + } + class Arc2 { + startPoint: Vector2; + midPoint: Vector2; + endPoint: Vector2; + centerPoint: Vector2; + radius: number; + angle: Angle; + startAngle: Angle; + orientation: Orientation; + constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2); + } + class PathCursor { + private path; + private _onchange; + value: number; + animations: Animation[]; + constructor(path: Path2); + getPoint(): Vector3; + moveAhead(step?: number): PathCursor; + moveBack(step?: number): PathCursor; + move(step: number): PathCursor; + private ensureLimits(); + private markAsDirty(propertyName); + private raiseOnChange(); + onchange(f: (cursor: PathCursor) => void): PathCursor; + } + class Path2 { + private _points; + private _length; + closed: boolean; + constructor(x: number, y: number); + addLineTo(x: number, y: number): Path2; + addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2; + close(): Path2; + length(): number; + getPoints(): Vector2[]; + getPointAtLengthPosition(normalizedLengthPosition: number): Vector2; + static StartingAt(x: number, y: number): Path2; + } + class Path3D { + path: Vector3[]; + private _curve; + private _distances; + private _tangents; + private _normals; + private _binormals; + private _raw; + /** + * new Path3D(path, normal, raw) + * path : an array of Vector3, the curve axis of the Path3D + * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal. + * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed. + */ + constructor(path: Vector3[], firstNormal?: Vector3, raw?: boolean); + getCurve(): Vector3[]; + getTangents(): Vector3[]; + getNormals(): Vector3[]; + getBinormals(): Vector3[]; + getDistances(): number[]; + update(path: Vector3[], firstNormal?: Vector3): Path3D; + private _compute(firstNormal); + private _getFirstNonNullVector(index); + private _getLastNonNullVector(index); + private _normalVector(v0, vt, va); + } + class Curve3 { + private _points; + private _length; + static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3; + static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3; + static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3; + constructor(points: Vector3[]); + getPoints(): Vector3[]; + length(): number; + continue(curve: Curve3): Curve3; + private _computeLength(path); + } + class PositionNormalVertex { + position: Vector3; + normal: Vector3; + constructor(position?: Vector3, normal?: Vector3); + clone(): PositionNormalVertex; + } + class PositionNormalTextureVertex { + position: Vector3; + normal: Vector3; + uv: Vector2; + constructor(position?: Vector3, normal?: Vector3, uv?: Vector2); + clone(): PositionNormalTextureVertex; + } + class SIMDHelper { + private static _isEnabled; + static IsEnabled: boolean; + static DisableSIMD(): void; + static EnableSIMD(): void; + } +} + +declare module BABYLON { + class AbstractMesh extends Node implements IDisposable { + private static _BILLBOARDMODE_NONE; + private static _BILLBOARDMODE_X; + private static _BILLBOARDMODE_Y; + private static _BILLBOARDMODE_Z; + private static _BILLBOARDMODE_ALL; + static BILLBOARDMODE_NONE: number; + static BILLBOARDMODE_X: number; + static BILLBOARDMODE_Y: number; + static BILLBOARDMODE_Z: number; + static BILLBOARDMODE_ALL: number; + definedFacingForward: boolean; + position: Vector3; + rotation: Vector3; + rotationQuaternion: Quaternion; + scaling: Vector3; + billboardMode: number; + visibility: number; + alphaIndex: number; + infiniteDistance: boolean; + isVisible: boolean; + isPickable: boolean; + showBoundingBox: boolean; + showSubMeshesBoundingBox: boolean; + onDispose: any; + isBlocker: boolean; + skeleton: Skeleton; + renderingGroupId: number; + material: Material; + receiveShadows: boolean; + actionManager: ActionManager; + renderOutline: boolean; + outlineColor: Color3; + outlineWidth: number; + renderOverlay: boolean; + overlayColor: Color3; + overlayAlpha: number; + hasVertexAlpha: boolean; + useVertexColors: boolean; + applyFog: boolean; + computeBonesUsingShaders: boolean; + useOctreeForRenderingSelection: boolean; + useOctreeForPicking: boolean; + useOctreeForCollisions: boolean; + layerMask: number; + alwaysSelectAsActiveMesh: boolean; + _physicImpostor: number; + _physicsMass: number; + _physicsFriction: number; + _physicRestitution: number; + private _checkCollisions; + ellipsoid: Vector3; + ellipsoidOffset: Vector3; + private _collider; + private _oldPositionForCollisions; + private _diffPositionForCollisions; + private _newPositionForCollisions; + onCollide: (collidedMesh: AbstractMesh) => void; + private _meshToBoneReferal; + edgesWidth: number; + edgesColor: Color4; + _edgesRenderer: EdgesRenderer; + private _localScaling; + private _localRotation; + private _localTranslation; + private _localBillboard; + private _localPivotScaling; + private _localPivotScalingRotation; + private _localMeshReferalTransform; + private _localWorld; + _worldMatrix: Matrix; + private _rotateYByPI; + private _absolutePosition; + private _collisionsTransformMatrix; + private _collisionsScalingMatrix; + _positions: Vector3[]; + private _isDirty; + _masterMesh: AbstractMesh; + _boundingInfo: BoundingInfo; + private _pivotMatrix; + _isDisposed: boolean; + _renderId: number; + subMeshes: SubMesh[]; + _submeshesOctree: Octree; + _intersectionsInProgress: AbstractMesh[]; + private _onAfterWorldMatrixUpdate; + private _isWorldMatrixFrozen; + _waitingActions: any; + _waitingFreezeWorldMatrix: boolean; + constructor(name: string, scene: Scene); + disableEdgesRendering(): void; + enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): void; + isBlocked: boolean; + getLOD(camera: Camera): AbstractMesh; + getTotalVertices(): number; + getIndices(): number[]; + getVerticesData(kind: string): number[]; + isVerticesDataPresent(kind: string): boolean; + getBoundingInfo(): BoundingInfo; + useBones: boolean; + _preActivate(): void; + _activate(renderId: number): void; + getWorldMatrix(): Matrix; + worldMatrixFromCache: Matrix; + absolutePosition: Vector3; + freezeWorldMatrix(): void; + unfreezeWorldMatrix(): void; + isWorldMatrixFrozen: boolean; + rotate(axis: Vector3, amount: number, space: Space): void; + translate(axis: Vector3, distance: number, space: Space): void; + getAbsolutePosition(): Vector3; + setAbsolutePosition(absolutePosition: Vector3): void; + /** + * Perform relative position change from the point of view of behind the front of the mesh. + * This is performed taking into account the meshes current rotation, so you do not have to care. + * Supports definition of mesh facing forward or backward. + * @param {number} amountRight + * @param {number} amountUp + * @param {number} amountForward + */ + movePOV(amountRight: number, amountUp: number, amountForward: number): void; + /** + * Calculate relative position change from the point of view of behind the front of the mesh. + * This is performed taking into account the meshes current rotation, so you do not have to care. + * Supports definition of mesh facing forward or backward. + * @param {number} amountRight + * @param {number} amountUp + * @param {number} amountForward + */ + calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3; + /** + * Perform relative rotation change from the point of view of behind the front of the mesh. + * Supports definition of mesh facing forward or backward. + * @param {number} flipBack + * @param {number} twirlClockwise + * @param {number} tiltRight + */ + rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): void; + /** + * Calculate relative rotation change from the point of view of behind the front of the mesh. + * Supports definition of mesh facing forward or backward. + * @param {number} flipBack + * @param {number} twirlClockwise + * @param {number} tiltRight + */ + calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3; + setPivotMatrix(matrix: Matrix): void; + getPivotMatrix(): Matrix; + _isSynchronized(): boolean; + _initCache(): void; + markAsDirty(property: string): void; + _updateBoundingInfo(): void; + _updateSubMeshesBoundingInfo(matrix: Matrix): void; + computeWorldMatrix(force?: boolean): Matrix; + /** + * If you'd like to be callbacked after the mesh position, rotation or scaling has been updated + * @param func: callback function to add + */ + registerAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void; + unregisterAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void; + setPositionWithLocalVector(vector3: Vector3): void; + getPositionExpressedInLocalSpace(): Vector3; + locallyTranslate(vector3: Vector3): void; + lookAt(targetPoint: Vector3, yawCor: number, pitchCor: number, rollCor: number): void; + attachToBone(bone: Bone, affectedMesh: AbstractMesh): void; + detachFromBone(): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + isCompletelyInFrustum(camera?: Camera): boolean; + intersectsMesh(mesh: AbstractMesh, precise?: boolean): boolean; + intersectsPoint(point: Vector3): boolean; + setPhysicsState(impostor?: any, options?: PhysicsBodyCreationOptions): any; + getPhysicsImpostor(): number; + getPhysicsMass(): number; + getPhysicsFriction(): number; + getPhysicsRestitution(): number; + getPositionInCameraSpace(camera?: Camera): Vector3; + getDistanceToCamera(camera?: Camera): number; + applyImpulse(force: Vector3, contactPoint: Vector3): void; + setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): void; + updatePhysicsBodyPosition(): void; + checkCollisions: boolean; + moveWithCollisions(velocity: Vector3): void; + private _onCollisionPositionChange; + /** + * This function will create an octree to help select the right submeshes for rendering, picking and collisions + * Please note that you must have a decent number of submeshes to get performance improvements when using octree + */ + createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree; + _collideForSubMesh(subMesh: SubMesh, transformMatrix: Matrix, collider: Collider): void; + _processCollisionsForSubMeshes(collider: Collider, transformMatrix: Matrix): void; + _checkCollision(collider: Collider): void; + _generatePointsArray(): boolean; + intersects(ray: Ray, fastCheck?: boolean): PickingInfo; + clone(name: string, newParent: Node, doNotCloneChildren?: boolean): AbstractMesh; + releaseSubMeshes(): void; + dispose(doNotRecurse?: boolean): void; + } +} + +declare module BABYLON { + class CSG { + private polygons; + matrix: Matrix; + position: Vector3; + rotation: Vector3; + rotationQuaternion: Quaternion; + scaling: Vector3; + static FromMesh(mesh: Mesh): CSG; + private static FromPolygons(polygons); + clone(): CSG; + private toPolygons(); + union(csg: CSG): CSG; + unionInPlace(csg: CSG): void; + subtract(csg: CSG): CSG; + subtractInPlace(csg: CSG): void; + intersect(csg: CSG): CSG; + intersectInPlace(csg: CSG): void; + inverse(): CSG; + inverseInPlace(): void; + copyTransformAttributes(csg: CSG): CSG; + buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh; + toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh; + } +} + +declare module BABYLON { + class Geometry implements IGetSetVerticesData { + id: string; + delayLoadState: number; + delayLoadingFile: string; + onGeometryUpdated: (geometry: Geometry, kind?: string) => void; + private _scene; + private _engine; + private _meshes; + private _totalVertices; + private _indices; + private _vertexBuffers; + private _isDisposed; + _delayInfo: any; + private _indexBuffer; + _boundingInfo: BoundingInfo; + _delayLoadingFunction: (any: any, geometry: Geometry) => void; + constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Mesh); + getScene(): Scene; + getEngine(): Engine; + isReady(): boolean; + setAllVerticesData(vertexData: VertexData, updatable?: boolean): void; + setVerticesData(kind: string, data: number[], updatable?: boolean, stride?: number): void; + updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void; + updateVerticesData(kind: string, data: number[], updateExtends?: boolean): void; + getTotalVertices(): number; + getVerticesData(kind: string, copyWhenShared?: boolean): number[]; + getVertexBuffer(kind: string): VertexBuffer; + getVertexBuffers(): VertexBuffer[]; + isVerticesDataPresent(kind: string): boolean; + getVerticesDataKinds(): string[]; + setIndices(indices: number[], totalVertices?: number): void; + getTotalIndices(): number; + getIndices(copyWhenShared?: boolean): number[]; + getIndexBuffer(): any; + releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void; + applyToMesh(mesh: Mesh): void; + private _applyToMesh(mesh); + private notifyUpdate(kind?); + load(scene: Scene, onLoaded?: () => void): void; + isDisposed(): boolean; + dispose(): void; + copy(id: string): Geometry; + static ExtractFromMesh(mesh: Mesh, id: string): Geometry; + static RandomId(): string; + } + module Geometry.Primitives { + class _Primitive extends Geometry { + private _beingRegenerated; + private _canBeRegenerated; + constructor(id: string, scene: Scene, vertexData?: VertexData, canBeRegenerated?: boolean, mesh?: Mesh); + canBeRegenerated(): boolean; + regenerate(): void; + asNewGeometry(id: string): Geometry; + setAllVerticesData(vertexData: VertexData, updatable?: boolean): void; + setVerticesData(kind: string, data: number[], updatable?: boolean): void; + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Ribbon extends _Primitive { + pathArray: Vector3[][]; + closeArray: boolean; + closePath: boolean; + offset: number; + side: number; + constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Box extends _Primitive { + size: number; + side: number; + constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Sphere extends _Primitive { + segments: number; + diameter: number; + side: number; + constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Cylinder extends _Primitive { + height: number; + diameterTop: number; + diameterBottom: number; + tessellation: number; + subdivisions: number; + side: number; + constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Torus extends _Primitive { + diameter: number; + thickness: number; + tessellation: number; + side: number; + constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Ground extends _Primitive { + width: number; + height: number; + subdivisions: number; + constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Mesh); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class TiledGround extends _Primitive { + xmin: number; + zmin: number; + xmax: number; + zmax: number; + subdivisions: { + w: number; + h: number; + }; + precision: { + w: number; + h: number; + }; + constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: { + w: number; + h: number; + }, precision: { + w: number; + h: number; + }, canBeRegenerated?: boolean, mesh?: Mesh); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Plane extends _Primitive { + size: number; + side: number; + constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class TorusKnot extends _Primitive { + radius: number; + tube: number; + radialSegments: number; + tubularSegments: number; + p: number; + q: number; + side: number; + constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + } +} + +declare module BABYLON { + class GroundMesh extends Mesh { + generateOctree: boolean; + private _worldInverse; + _subdivisions: number; + constructor(name: string, scene: Scene); + subdivisions: number; + optimize(chunksCount: number, octreeBlocksSize?: number): void; + getHeightAtCoordinates(x: number, z: number): number; + } +} + +declare module BABYLON { + /** + * Creates an instance based on a source mesh. + */ + class InstancedMesh extends AbstractMesh { + private _sourceMesh; + private _currentLOD; + constructor(name: string, source: Mesh); + receiveShadows: boolean; + material: Material; + visibility: number; + skeleton: Skeleton; + getTotalVertices(): number; + sourceMesh: Mesh; + getVerticesData(kind: string): number[]; + isVerticesDataPresent(kind: string): boolean; + getIndices(): number[]; + _positions: Vector3[]; + refreshBoundingInfo(): void; + _preActivate(): void; + _activate(renderId: number): void; + getLOD(camera: Camera): AbstractMesh; + _syncSubMeshes(): void; + _generatePointsArray(): boolean; + clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh; + dispose(doNotRecurse?: boolean): void; + } +} + +declare module BABYLON { + class LinesMesh extends Mesh { + color: Color3; + alpha: number; + private _colorShader; + constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean); + material: Material; + isPickable: boolean; + checkCollisions: boolean; + _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void; + _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void; + intersects(ray: Ray, fastCheck?: boolean): any; + dispose(doNotRecurse?: boolean): void; + clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): LinesMesh; + } +} + +declare module BABYLON { + class _InstancesBatch { + mustReturn: boolean; + visibleInstances: InstancedMesh[][]; + renderSelf: boolean[]; + } + class Mesh extends AbstractMesh implements IGetSetVerticesData { + static _FRONTSIDE: number; + static _BACKSIDE: number; + static _DOUBLESIDE: number; + static _DEFAULTSIDE: number; + static _NO_CAP: number; + static _CAP_START: number; + static _CAP_END: number; + static _CAP_ALL: number; + static FRONTSIDE: number; + static BACKSIDE: number; + static DOUBLESIDE: number; + static DEFAULTSIDE: number; + static NO_CAP: number; + static CAP_START: number; + static CAP_END: number; + static CAP_ALL: number; + delayLoadState: number; + instances: InstancedMesh[]; + delayLoadingFile: string; + _binaryInfo: any; + private _LODLevels; + onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void; + _geometry: Geometry; + private _onBeforeRenderCallbacks; + private _onAfterRenderCallbacks; + _delayInfo: any; + _delayLoadingFunction: (any: any, mesh: Mesh) => void; + _visibleInstances: any; + private _renderIdForInstances; + private _batchCache; + private _worldMatricesInstancesBuffer; + private _worldMatricesInstancesArray; + private _instancesBufferSize; + _shouldGenerateFlatShading: boolean; + private _preActivateId; + private _sideOrientation; + private _areNormalsFrozen; + private _sourcePositions; + private _sourceNormals; + /** + * @constructor + * @param {string} name - The value used by scene.getMeshByName() to do a lookup. + * @param {Scene} scene - The scene to add this mesh to. + * @param {Node} parent - The parent of this mesh, if it has one + * @param {Mesh} source - An optional Mesh from which geometry is shared, cloned. + * @param {boolean} doNotCloneChildren - When cloning, skip cloning child meshes of source, default False. + * When false, achieved by calling a clone(), also passing False. + * This will make creation of children, recursive. + */ + constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean); + hasLODLevels: boolean; + private _sortLODLevels(); + /** + * Add a mesh as LOD level triggered at the given distance. + * @param {number} distance - the distance from the center of the object to show this level + * @param {BABYLON.Mesh} mesh - the mesh to be added as LOD level + * @return {BABYLON.Mesh} this mesh (for chaining) + */ + addLODLevel(distance: number, mesh: Mesh): Mesh; + getLODLevelAtDistance(distance: number): Mesh; + /** + * Remove a mesh from the LOD array + * @param {BABYLON.Mesh} mesh - the mesh to be removed. + * @return {BABYLON.Mesh} this mesh (for chaining) + */ + removeLODLevel(mesh: Mesh): Mesh; + getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh; + geometry: Geometry; + getTotalVertices(): number; + getVerticesData(kind: string, copyWhenShared?: boolean): number[]; + getVertexBuffer(kind: any): VertexBuffer; + isVerticesDataPresent(kind: string): boolean; + getVerticesDataKinds(): string[]; + getTotalIndices(): number; + getIndices(copyWhenShared?: boolean): number[]; + isBlocked: boolean; + isReady(): boolean; + isDisposed(): boolean; + sideOrientation: number; + areNormalsFrozen: boolean; + /** This function affects parametric shapes on update only : ribbons, tubes, etc. It has no effect at all on other shapes */ + freezeNormals(): void; + /** This function affects parametric shapes on update only : ribbons, tubes, etc. It has no effect at all on other shapes */ + unfreezeNormals(): void; + _preActivate(): void; + _registerInstanceForRenderId(instance: InstancedMesh, renderId: number): void; + refreshBoundingInfo(): void; + _createGlobalSubMesh(): SubMesh; + subdivide(count: number): void; + setVerticesData(kind: any, data: any, updatable?: boolean, stride?: number): void; + updateVerticesData(kind: string, data: number[], updateExtends?: boolean, makeItUnique?: boolean): void; + updateVerticesDataDirectly(kind: string, data: Float32Array, offset?: number, makeItUnique?: boolean): void; + updateMeshPositions(positionFunction: any, computeNormals?: boolean): void; + makeGeometryUnique(): void; + setIndices(indices: number[], totalVertices?: number): void; + _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void; + _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void; + registerBeforeRender(func: (mesh: AbstractMesh) => void): void; + unregisterBeforeRender(func: (mesh: AbstractMesh) => void): void; + registerAfterRender(func: (mesh: AbstractMesh) => void): void; + unregisterAfterRender(func: (mesh: AbstractMesh) => void): void; + _getInstancesRenderList(subMeshId: number): _InstancesBatch; + _renderWithInstances(subMesh: SubMesh, fillMode: number, batch: _InstancesBatch, effect: Effect, engine: Engine): void; + _processRendering(subMesh: SubMesh, effect: Effect, fillMode: number, batch: _InstancesBatch, hardwareInstancedRendering: boolean, onBeforeDraw: (isInstance: boolean, world: Matrix) => void): void; + render(subMesh: SubMesh, enableAlphaMode: boolean): void; + getEmittedParticleSystems(): ParticleSystem[]; + getHierarchyEmittedParticleSystems(): ParticleSystem[]; + getChildren(): Node[]; + _checkDelayState(): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + setMaterialByID(id: string): void; + getAnimatables(): IAnimatable[]; + bakeTransformIntoVertices(transform: Matrix): void; + bakeCurrentTransformIntoVertices(): void; + _resetPointsArrayCache(): void; + _generatePointsArray(): boolean; + clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): Mesh; + dispose(doNotRecurse?: boolean): void; + applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void): void; + applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number): void; + convertToFlatShadedMesh(): void; + flipFaces(flipNormals?: boolean): void; + createInstance(name: string): InstancedMesh; + synchronizeInstances(): void; + /** + * Simplify the mesh according to the given array of settings. + * Function will return immediately and will simplify async. + * @param settings a collection of simplification settings. + * @param parallelProcessing should all levels calculate parallel or one after the other. + * @param type the type of simplification to run. + * @param successCallback optional success callback to be called after the simplification finished processing all settings. + */ + simplify(settings: Array, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): void; + /** + * Optimization of the mesh's indices, in case a mesh has duplicated vertices. + * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes. + * This should be used together with the simplification to avoid disappearing triangles. + * @param successCallback an optional success callback to be called after the optimization finished. + */ + optimizeIndices(successCallback?: (mesh?: Mesh) => void): void; + static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, scene: Scene, updatable?: boolean, sideOrientation?: number, ribbonInstance?: Mesh): Mesh; + static CreateDisc(name: string, radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateBox(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateBox(name: string, options: { + width?: number; + height?: number; + depth?: number; + faceUV?: Vector4[]; + faceColors?: Color4[]; + sideOrientation?: number; + updatable?: boolean; + }, scene: Scene): Mesh; + static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateSphere(name: string, options: { + segments?: number; + diameterX?: number; + diameterY?: number; + diameterZ?: number; + sideOrientation?: number; + updatable?: boolean; + }, scene: any): Mesh; + static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene: Scene, updatable?: any, sideOrientation?: number): Mesh; + static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateLines(name: string, points: Vector3[], scene: Scene, updatable?: boolean, linesInstance?: LinesMesh): LinesMesh; + static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Scene, updatable?: boolean, linesInstance?: LinesMesh): LinesMesh; + static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, extrudedInstance?: Mesh): Mesh; + static ExtrudeShapeCustom(name: string, shape: Vector3[], path: Vector3[], scaleFunction: any, rotationFunction: any, ribbonCloseArray: boolean, ribbonClosePath: boolean, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, extrudedInstance?: Mesh): Mesh; + private static _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance); + static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreatePlane(name: string, options: { + width?: number; + height?: number; + sideOrientation?: number; + updatable?: boolean; + }, scene: Scene): Mesh; + static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh; + static CreateGround(name: string, options: { + width?: number; + height?: number; + subdivisions?: number; + sideOrientation?: number; + updatable?: boolean; + }, scene: any): Mesh; + static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: { + w: number; + h: number; + }, precision: { + w: number; + h: number; + }, scene: Scene, updatable?: boolean): Mesh; + static CreateGroundFromHeightMap(name: string, url: string, width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, scene: Scene, updatable?: boolean, onReady?: (mesh: GroundMesh) => void): GroundMesh; + static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: { + (i: number, distance: number): number; + }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, tubeInstance?: Mesh): Mesh; + static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle?: number): Mesh; + /** + * Update the vertex buffers by applying transformation from the bones + * @param {skeleton} skeleton to apply + */ + applySkeleton(skeleton: Skeleton): Mesh; + static MinMax(meshes: AbstractMesh[]): { + min: Vector3; + max: Vector3; + }; + static Center(meshesOrMinMaxVector: any): Vector3; + /** + * Merge the array of meshes into a single mesh for performance reasons. + * @param {Array} meshes - The vertices source. They should all be of the same material. Entries can empty + * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes + * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true. + * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class. + */ + static MergeMeshes(meshes: Array, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh): Mesh; + } +} + +declare module BABYLON { + interface IGetSetVerticesData { + isVerticesDataPresent(kind: string): boolean; + getVerticesData(kind: string, copyWhenShared?: boolean): number[]; + getIndices(copyWhenShared?: boolean): number[]; + setVerticesData(kind: string, data: number[], updatable?: boolean): void; + updateVerticesData(kind: string, data: number[], updateExtends?: boolean, makeItUnique?: boolean): void; + setIndices(indices: number[]): void; + } + class VertexData { + positions: number[]; + normals: number[]; + uvs: number[]; + uvs2: number[]; + uvs3: number[]; + uvs4: number[]; + uvs5: number[]; + uvs6: number[]; + colors: number[]; + matricesIndices: number[]; + matricesWeights: number[]; + indices: number[]; + set(data: number[], kind: string): void; + applyToMesh(mesh: Mesh, updatable?: boolean): void; + applyToGeometry(geometry: Geometry, updatable?: boolean): void; + updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): void; + updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): void; + private _applyTo(meshOrGeometry, updatable?); + private _update(meshOrGeometry, updateExtends?, makeItUnique?); + transform(matrix: Matrix): void; + merge(other: VertexData): void; + static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean): VertexData; + static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean): VertexData; + private static _ExtractFrom(meshOrGeometry, copyWhenShared?); + static CreateRibbon(pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, sideOrientation?: number): VertexData; + static CreateBox(options: { + width?: number; + height?: number; + depth?: number; + faceUV?: Vector4[]; + faceColors?: Color4[]; + sideOrientation?: number; + }): VertexData; + static CreateBox(size: number, sideOrientation?: number): VertexData; + static CreateSphere(options: { + segments?: number; + diameterX?: number; + diameterY?: number; + diameterZ?: number; + sideOrientation?: number; + }): VertexData; + static CreateSphere(segments: number, diameter?: number, sideOrientation?: number): VertexData; + static CreateCylinder(height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, sideOrientation?: number): VertexData; + static CreateTorus(diameter: any, thickness: any, tessellation: any, sideOrientation?: number): VertexData; + static CreateLines(points: Vector3[]): VertexData; + static CreateDashedLines(points: Vector3[], dashSize: number, gapSize: number, dashNb: number): VertexData; + static CreateGround(options: { + width?: number; + height?: number; + subdivisions?: number; + sideOrientation?: number; + }): VertexData; + static CreateGround(width: number, height: number, subdivisions?: number): VertexData; + static CreateTiledGround(xmin: number, zmin: number, xmax: number, zmax: number, subdivisions?: { + w: number; + h: number; + }, precision?: { + w: number; + h: number; + }): VertexData; + static CreateGroundFromHeightMap(width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, buffer: Uint8Array, bufferWidth: number, bufferHeight: number): VertexData; + static CreatePlane(options: { + width?: number; + height?: number; + sideOrientation?: number; + }): VertexData; + static CreatePlane(size: number, sideOrientation?: number): VertexData; + static CreateDisc(radius: number, tessellation: number, sideOrientation?: number): VertexData; + static CreateTorusKnot(radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, sideOrientation?: number): VertexData; + /** + * @param {any} - positions (number[] or Float32Array) + * @param {any} - indices (number[] or Uint16Array) + * @param {any} - normals (number[] or Float32Array) + */ + static ComputeNormals(positions: any, indices: any, normals: any): void; + private static _ComputeSides(sideOrientation, positions, indices, normals, uvs); + } +} + +declare module BABYLON.Internals { + class MeshLODLevel { + distance: number; + mesh: Mesh; + constructor(distance: number, mesh: Mesh); + } +} + +declare module BABYLON { + /** + * A simplifier interface for future simplification implementations. + */ + interface ISimplifier { + /** + * Simplification of a given mesh according to the given settings. + * Since this requires computation, it is assumed that the function runs async. + * @param settings The settings of the simplification, including quality and distance + * @param successCallback A callback that will be called after the mesh was simplified. + * @param errorCallback in case of an error, this callback will be called. optional. + */ + simplify(settings: ISimplificationSettings, successCallback: (simplifiedMeshes: Mesh) => void, errorCallback?: () => void): void; + } + /** + * Expected simplification settings. + * Quality should be between 0 and 1 (1 being 100%, 0 being 0%); + */ + interface ISimplificationSettings { + quality: number; + distance: number; + optimizeMesh?: boolean; + } + class SimplificationSettings implements ISimplificationSettings { + quality: number; + distance: number; + optimizeMesh: boolean; + constructor(quality: number, distance: number, optimizeMesh?: boolean); + } + interface ISimplificationTask { + settings: Array; + simplificationType: SimplificationType; + mesh: Mesh; + successCallback?: () => void; + parallelProcessing: boolean; + } + class SimplificationQueue { + private _simplificationArray; + running: any; + constructor(); + addTask(task: ISimplificationTask): void; + executeNext(): void; + runSimplification(task: ISimplificationTask): void; + private getSimplifier(task); + } + /** + * The implemented types of simplification. + * At the moment only Quadratic Error Decimation is implemented. + */ + enum SimplificationType { + QUADRATIC = 0, + } + class DecimationTriangle { + vertices: Array; + normal: Vector3; + error: Array; + deleted: boolean; + isDirty: boolean; + borderFactor: number; + deletePending: boolean; + originalOffset: number; + constructor(vertices: Array); + } + class DecimationVertex { + position: Vector3; + id: any; + q: QuadraticMatrix; + isBorder: boolean; + triangleStart: number; + triangleCount: number; + originalOffsets: Array; + constructor(position: Vector3, id: any); + updatePosition(newPosition: Vector3): void; + } + class QuadraticMatrix { + data: Array; + constructor(data?: Array); + det(a11: any, a12: any, a13: any, a21: any, a22: any, a23: any, a31: any, a32: any, a33: any): number; + addInPlace(matrix: QuadraticMatrix): void; + addArrayInPlace(data: Array): void; + add(matrix: QuadraticMatrix): QuadraticMatrix; + static FromData(a: number, b: number, c: number, d: number): QuadraticMatrix; + static DataFromNumbers(a: number, b: number, c: number, d: number): number[]; + } + class Reference { + vertexId: number; + triangleId: number; + constructor(vertexId: number, triangleId: number); + } + /** + * An implementation of the Quadratic Error simplification algorithm. + * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf + * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS + * @author RaananW + */ + class QuadraticErrorSimplification implements ISimplifier { + private _mesh; + private triangles; + private vertices; + private references; + private initialized; + private _reconstructedMesh; + syncIterations: number; + aggressiveness: number; + decimationIterations: number; + boundingBoxEpsilon: number; + constructor(_mesh: Mesh); + simplify(settings: ISimplificationSettings, successCallback: (simplifiedMesh: Mesh) => void): void; + private isTriangleOnBoundingBox(triangle); + private runDecimation(settings, submeshIndex, successCallback); + private initWithMesh(submeshIndex, callback, optimizeMesh?); + private init(callback); + private reconstructMesh(submeshIndex); + private initDecimatedMesh(); + private isFlipped(vertex1, vertex2, point, deletedArray, borderFactor, delTr); + private updateTriangles(origVertex, vertex, deletedArray, deletedTriangles); + private identifyBorder(); + private updateMesh(identifyBorders?); + private vertexError(q, point); + private calculateError(vertex1, vertex2, pointResult?, normalResult?, uvResult?, colorResult?); + } +} + +declare module BABYLON { + class Polygon { + static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[]; + static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[]; + static Parse(input: string): Vector2[]; + static StartingAt(x: number, y: number): Path2; + } + class PolygonMeshBuilder { + private _swctx; + private _points; + private _outlinepoints; + private _holes; + private _name; + private _scene; + constructor(name: string, contours: Path2, scene: Scene); + constructor(name: string, contours: Vector2[], scene: Scene); + addHole(hole: Vector2[]): PolygonMeshBuilder; + build(updatable?: boolean, depth?: number): Mesh; + private addSide(positions, normals, uvs, indices, bounds, points, depth, flip); + } +} + +declare module BABYLON { + class SubMesh { + materialIndex: number; + verticesStart: number; + verticesCount: number; + indexStart: any; + indexCount: number; + linesIndexCount: number; + private _mesh; + private _renderingMesh; + private _boundingInfo; + private _linesIndexBuffer; + _lastColliderWorldVertices: Vector3[]; + _trianglePlanes: Plane[]; + _lastColliderTransformMatrix: Matrix; + _renderId: number; + _alphaIndex: number; + _distanceToCamera: number; + _id: number; + constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: any, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean); + getBoundingInfo(): BoundingInfo; + getMesh(): AbstractMesh; + getRenderingMesh(): Mesh; + getMaterial(): Material; + refreshBoundingInfo(): void; + _checkCollision(collider: Collider): boolean; + updateBoundingInfo(world: Matrix): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + render(enableAlphaMode: boolean): void; + getLinesIndexBuffer(indices: number[], engine: any): WebGLBuffer; + canIntersects(ray: Ray): boolean; + intersects(ray: Ray, positions: Vector3[], indices: number[], fastCheck?: boolean): IntersectionInfo; + clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh; + dispose(): void; + static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh; + } +} + +declare module BABYLON { + class VertexBuffer { + private _mesh; + private _engine; + private _buffer; + private _data; + private _updatable; + private _kind; + private _strideSize; + constructor(engine: any, data: number[], kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number); + isUpdatable(): boolean; + getData(): number[]; + getBuffer(): WebGLBuffer; + getStrideSize(): number; + create(data?: number[]): void; + update(data: number[]): void; + updateDirectly(data: Float32Array, offset: number): void; + dispose(): void; + private static _PositionKind; + private static _NormalKind; + private static _UVKind; + private static _UV2Kind; + private static _UV3Kind; + private static _UV4Kind; + private static _UV5Kind; + private static _UV6Kind; + private static _ColorKind; + private static _MatricesIndicesKind; + private static _MatricesWeightsKind; + static PositionKind: string; + static NormalKind: string; + static UVKind: string; + static UV2Kind: string; + static UV3Kind: string; + static UV4Kind: string; + static UV5Kind: string; + static UV6Kind: string; + static ColorKind: string; + static MatricesIndicesKind: string; + static MatricesWeightsKind: string; + } +} + +declare module BABYLON { + class Particle { + position: Vector3; + direction: Vector3; + color: Color4; + colorStep: Color4; + lifeTime: number; + age: number; + size: number; + angle: number; + angularSpeed: number; + copyTo(other: Particle): void; + } +} + +declare module BABYLON { + class ParticleSystem implements IDisposable { + name: string; + static BLENDMODE_ONEONE: number; + static BLENDMODE_STANDARD: number; + id: string; + renderingGroupId: number; + emitter: any; + emitRate: number; + manualEmitCount: number; + updateSpeed: number; + targetStopDuration: number; + disposeOnStop: boolean; + minEmitPower: number; + maxEmitPower: number; + minLifeTime: number; + maxLifeTime: number; + minSize: number; + maxSize: number; + minAngularSpeed: number; + maxAngularSpeed: number; + particleTexture: Texture; + layerMask: number; + onDispose: () => void; + updateFunction: (particles: Particle[]) => void; + blendMode: number; + forceDepthWrite: boolean; + gravity: Vector3; + direction1: Vector3; + direction2: Vector3; + minEmitBox: Vector3; + maxEmitBox: Vector3; + color1: Color4; + color2: Color4; + colorDead: Color4; + textureMask: Color4; + startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3) => void; + startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3) => void; + private particles; + private _capacity; + private _scene; + private _vertexDeclaration; + private _vertexStrideSize; + private _stockParticles; + private _newPartsExcess; + private _vertexBuffer; + private _indexBuffer; + private _vertices; + private _effect; + private _customEffect; + private _cachedDefines; + private _scaledColorStep; + private _colorDiff; + private _scaledDirection; + private _scaledGravity; + private _currentRenderId; + private _alive; + private _started; + private _stopped; + private _actualFrame; + private _scaledUpdateSpeed; + constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect); + recycleParticle(particle: Particle): void; + getCapacity(): number; + isAlive(): boolean; + isStarted(): boolean; + start(): void; + stop(): void; + _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void; + private _update(newParticles); + private _getEffect(); + animate(): void; + render(): number; + dispose(): void; + clone(name: string, newEmitter: any): ParticleSystem; + } +} + +declare module BABYLON { + interface IPhysicsEnginePlugin { + initialize(iterations?: number): any; + setGravity(gravity: Vector3): void; + runOneStep(delta: number): void; + registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; + registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; + unregisterMesh(mesh: AbstractMesh): any; + applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; + createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; + dispose(): void; + isSupported(): boolean; + updateBodyPosition(mesh: AbstractMesh): void; + } + interface PhysicsBodyCreationOptions { + mass: number; + friction: number; + restitution: number; + } + interface PhysicsCompoundBodyPart { + mesh: Mesh; + impostor: number; + } + class PhysicsEngine { + gravity: Vector3; + private _currentPlugin; + constructor(plugin?: IPhysicsEnginePlugin); + _initialize(gravity?: Vector3): void; + _runOneStep(delta: number): void; + _setGravity(gravity: Vector3): void; + _registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; + _registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; + _unregisterMesh(mesh: AbstractMesh): void; + _applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; + _createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; + _updateBodyPosition(mesh: AbstractMesh): void; + dispose(): void; + isSupported(): boolean; + static NoImpostor: number; + static SphereImpostor: number; + static BoxImpostor: number; + static PlaneImpostor: number; + static MeshImpostor: number; + static CapsuleImpostor: number; + static ConeImpostor: number; + static CylinderImpostor: number; + static ConvexHullImpostor: number; + static Epsilon: number; + } +} + +declare module BABYLON { + class BoundingBoxRenderer { + frontColor: Color3; + backColor: Color3; + showBackLines: boolean; + renderList: SmartArray; + private _scene; + private _colorShader; + private _vb; + private _ib; + constructor(scene: Scene); + private _prepareRessources(); + reset(): void; + render(): void; + dispose(): void; + } +} + +declare module BABYLON { + class DepthRenderer { + private _scene; + private _depthMap; + private _effect; + private _viewMatrix; + private _projectionMatrix; + private _transformMatrix; + private _worldViewProjection; + private _cachedDefines; + constructor(scene: Scene, type?: number); + isReady(subMesh: SubMesh, useInstances: boolean): boolean; + getDepthMap(): RenderTargetTexture; + dispose(): void; + } +} + +declare module BABYLON { + class EdgesRenderer { + private _source; + private _linesPositions; + private _linesNormals; + private _linesIndices; + private _epsilon; + private _indicesCount; + private _lineShader; + private _vb0; + private _vb1; + private _ib; + private _buffers; + private _checkVerticesInsteadOfIndices; + constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean); + private _prepareRessources(); + dispose(): void; + private _processEdgeForAdjacencies(pa, pb, p0, p1, p2); + private _processEdgeForAdjacenciesWithVertices(pa, pb, p0, p1, p2); + private _checkEdge(faceIndex, edge, faceNormals, p0, p1); + _generateEdgesLines(): void; + render(): void; + } +} + +declare module BABYLON { + class OutlineRenderer { + private _scene; + private _effect; + private _cachedDefines; + constructor(scene: Scene); + render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void; + isReady(subMesh: SubMesh, useInstances: boolean): boolean; + } +} + +declare module BABYLON { + class RenderingGroup { + index: number; + private _scene; + private _opaqueSubMeshes; + private _transparentSubMeshes; + private _alphaTestSubMeshes; + private _activeVertices; + constructor(index: number, scene: Scene); + render(customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray) => void): boolean; + prepare(): void; + dispatch(subMesh: SubMesh): void; + } +} + +declare module BABYLON { + class RenderingManager { + static MAX_RENDERINGGROUPS: number; + private _scene; + private _renderingGroups; + private _depthBufferAlreadyCleaned; + constructor(scene: Scene); + private _renderParticles(index, activeMeshes); + private _renderSprites(index); + private _clearDepthBuffer(); + render(customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray) => void, activeMeshes: AbstractMesh[], renderParticles: boolean, renderSprites: boolean): void; + reset(): void; + dispatch(subMesh: SubMesh): void; + } +} + +declare module BABYLON { + class AnaglyphPostProcess extends PostProcess { + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class BlackAndWhitePostProcess extends PostProcess { + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class BlurPostProcess extends PostProcess { + direction: Vector2; + blurWidth: number; + constructor(name: string, direction: Vector2, blurWidth: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class ColorCorrectionPostProcess extends PostProcess { + private _colorTableTexture; + constructor(name: string, colorTableUrl: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class ConvolutionPostProcess extends PostProcess { + kernel: number[]; + constructor(name: string, kernel: number[], ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + static EdgeDetect0Kernel: number[]; + static EdgeDetect1Kernel: number[]; + static EdgeDetect2Kernel: number[]; + static SharpenKernel: number[]; + static EmbossKernel: number[]; + static GaussianKernel: number[]; + } +} + +declare module BABYLON { + class DisplayPassPostProcess extends PostProcess { + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class FilterPostProcess extends PostProcess { + kernelMatrix: Matrix; + constructor(name: string, kernelMatrix: Matrix, ratio: number, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class FxaaPostProcess extends PostProcess { + texelWidth: number; + texelHeight: number; + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class HDRRenderingPipeline extends PostProcessRenderPipeline implements IDisposable { + /** + * Public members + */ + /** + * Gaussian blur coefficient + * @type {number} + */ + gaussCoeff: number; + /** + * Gaussian blur mean + * @type {number} + */ + gaussMean: number; + /** + * Gaussian blur standard deviation + * @type {number} + */ + gaussStandDev: number; + /** + * Exposure, controls the overall intensity of the pipeline + * @type {number} + */ + exposure: number; + /** + * Minimum luminance that the post-process can output. Luminance is >= 0 + * @type {number} + */ + minimumLuminance: number; + /** + * Maximum luminance that the post-process can output. Must be suprerior to minimumLuminance + * @type {number} + */ + maximumLuminance: number; + /** + * Increase rate for luminance: eye adaptation speed to dark + * @type {number} + */ + luminanceIncreaserate: number; + /** + * Decrease rate for luminance: eye adaptation speed to bright + * @type {number} + */ + luminanceDecreaseRate: number; + /** + * Minimum luminance needed to compute HDR + * @type {number} + */ + brightThreshold: number; + /** + * Private members + */ + private _guassianBlurHPostProcess; + private _guassianBlurVPostProcess; + private _brightPassPostProcess; + private _textureAdderPostProcess; + private _downSampleX4PostProcess; + private _originalPostProcess; + private _hdrPostProcess; + private _hdrCurrentLuminance; + private _hdrOutputLuminance; + static LUM_STEPS: number; + private _downSamplePostProcesses; + private _scene; + private _needUpdate; + /** + * @constructor + * @param {string} name - The rendering pipeline name + * @param {BABYLON.Scene} scene - The scene linked to this pipeline + * @param {any} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) + * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null. + * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to + */ + constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]); + /** + * Tells the pipeline to update its post-processes + */ + update(): void; + /** + * Returns the current calculated luminance + */ + getCurrentLuminance(): number; + /** + * Returns the currently drawn luminance + */ + getOutputLuminance(): number; + /** + * Releases the rendering pipeline and its internal effects. Detaches pipeline from cameras + */ + dispose(): void; + /** + * Creates the HDR post-process and computes the luminance adaptation + */ + private _createHDRPostProcess(scene, ratio); + /** + * Texture Adder post-process + */ + private _createTextureAdderPostProcess(scene, ratio); + /** + * Down sample X4 post-process + */ + private _createDownSampleX4PostProcess(scene, ratio); + /** + * Bright pass post-process + */ + private _createBrightPassPostProcess(scene, ratio); + /** + * Luminance generator. Creates the luminance post-process and down sample post-processes + */ + private _createLuminanceGeneratorPostProcess(scene); + /** + * Gaussian blur post-processes. Horizontal and Vertical + */ + private _createGaussianBlurPostProcess(scene, ratio); + } +} + +declare module BABYLON { + class LensRenderingPipeline extends PostProcessRenderPipeline { + /** + * The chromatic aberration PostProcess id in the pipeline + * @type {string} + */ + LensChromaticAberrationEffect: string; + /** + * The highlights enhancing PostProcess id in the pipeline + * @type {string} + */ + HighlightsEnhancingEffect: string; + /** + * The depth-of-field PostProcess id in the pipeline + * @type {string} + */ + LensDepthOfFieldEffect: string; + private _scene; + private _depthTexture; + private _grainTexture; + private _chromaticAberrationPostProcess; + private _highlightsPostProcess; + private _depthOfFieldPostProcess; + private _edgeBlur; + private _grainAmount; + private _chromaticAberration; + private _distortion; + private _highlightsGain; + private _highlightsThreshold; + private _dofDistance; + private _dofAperture; + private _dofDarken; + private _dofPentagon; + private _blurNoise; + /** + * @constructor + * + * Effect parameters are as follow: + * { + * chromatic_aberration: number; // from 0 to x (1 for realism) + * edge_blur: number; // from 0 to x (1 for realism) + * distortion: number; // from 0 to x (1 for realism) + * grain_amount: number; // from 0 to 1 + * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise + * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default) + * dof_aperture: number; // depth-of-field: focus blur bias (default: 1) + * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default) + * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like "bokeh" effect + * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default) + * dof_threshold: number; // depth-of-field: highlights threshold (default: 1) + * blur_noise: boolean; // add a little bit of noise to the blur (default: true) + * } + * Note: if an effect parameter is unset, effect is disabled + * + * @param {string} name - The rendering pipeline name + * @param {object} parameters - An object containing all parameters (see above) + * @param {BABYLON.Scene} scene - The scene linked to this pipeline + * @param {number} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) + * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to + */ + constructor(name: string, parameters: any, scene: Scene, ratio?: number, cameras?: Camera[]); + setEdgeBlur(amount: number): void; + disableEdgeBlur(): void; + setGrainAmount(amount: number): void; + disableGrain(): void; + setChromaticAberration(amount: number): void; + disableChromaticAberration(): void; + setEdgeDistortion(amount: number): void; + disableEdgeDistortion(): void; + setFocusDistance(amount: number): void; + disableDepthOfField(): void; + setAperture(amount: number): void; + setDarkenOutOfFocus(amount: number): void; + enablePentagonBokeh(): void; + disablePentagonBokeh(): void; + enableNoiseBlur(): void; + disableNoiseBlur(): void; + setHighlightsGain(amount: number): void; + setHighlightsThreshold(amount: number): void; + disableHighlights(): void; + /** + * Removes the internal pipeline assets and detaches the pipeline from the scene cameras + */ + dispose(disableDepthRender?: boolean): void; + private _createChromaticAberrationPostProcess(ratio); + private _createHighlightsPostProcess(ratio); + private _createDepthOfFieldPostProcess(ratio); + private _createGrainTexture(); + } +} + +declare module BABYLON { + class PassPostProcess extends PostProcess { + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class PostProcess { + name: string; + onApply: (effect: Effect) => void; + onBeforeRender: (effect: Effect) => void; + onAfterRender: (effect: Effect) => void; + onSizeChanged: () => void; + onActivate: (camera: Camera) => void; + width: number; + height: number; + renderTargetSamplingMode: number; + clearColor: Color4; + private _camera; + private _scene; + private _engine; + private _renderRatio; + private _reusable; + private _textureType; + _textures: SmartArray; + _currentRenderTextureInd: number; + private _effect; + constructor(name: string, fragmentUrl: string, parameters: string[], samplers: string[], ratio: number | any, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, defines?: string, textureType?: number); + isReusable(): boolean; + activate(camera: Camera, sourceTexture?: WebGLTexture): void; + apply(): Effect; + dispose(camera?: Camera): void; + } +} + +declare module BABYLON { + class PostProcessManager { + private _scene; + private _indexBuffer; + private _vertexDeclaration; + private _vertexStrideSize; + private _vertexBuffer; + constructor(scene: Scene); + private _prepareBuffers(); + _prepareFrame(sourceTexture?: WebGLTexture): boolean; + directRender(postProcesses: PostProcess[], targetTexture?: WebGLTexture): void; + _finalizeFrame(doNotPresent?: boolean, targetTexture?: WebGLTexture, postProcesses?: PostProcess[]): void; + dispose(): void; + } +} + +declare module BABYLON { + class RefractionPostProcess extends PostProcess { + color: Color3; + depth: number; + colorLevel: number; + private _refRexture; + constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + dispose(camera: Camera): void; + } +} + +declare module BABYLON { + class SSAORenderingPipeline extends PostProcessRenderPipeline { + /** + * The PassPostProcess id in the pipeline that contains the original scene color + * @type {string} + */ + SSAOOriginalSceneColorEffect: string; + /** + * The SSAO PostProcess id in the pipeline + * @type {string} + */ + SSAORenderEffect: string; + /** + * The horizontal blur PostProcess id in the pipeline + * @type {string} + */ + SSAOBlurHRenderEffect: string; + /** + * The vertical blur PostProcess id in the pipeline + * @type {string} + */ + SSAOBlurVRenderEffect: string; + /** + * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect) + * @type {string} + */ + SSAOCombineRenderEffect: string; + /** + * The output strength of the SSAO post-process. Default value is 1.0. + * @type {number} + */ + totalStrength: number; + /** + * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0002 + * @type {number} + */ + radius: number; + /** + * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel + * Must not be equal to fallOff and superior to fallOff. + * Default value is 0.0075 + * @type {number} + */ + area: number; + /** + * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel + * Must not be equal to area and inferior to area. + * Default value is 0.0002 + * @type {number} + */ + fallOff: number; + private _scene; + private _depthTexture; + private _randomTexture; + private _originalColorPostProcess; + private _ssaoPostProcess; + private _blurHPostProcess; + private _blurVPostProcess; + private _ssaoCombinePostProcess; + private _firstUpdate; + /** + * @constructor + * @param {string} name - The rendering pipeline name + * @param {BABYLON.Scene} scene - The scene linked to this pipeline + * @param {any} ratio - The size of the postprocesses. Can be a number shared between passes or an object for more precision: { ssaoRatio: 0.5, combineRatio: 1.0 } + * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to + */ + constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]); + /** + * Returns the horizontal blur PostProcess + * @return {BABYLON.BlurPostProcess} The horizontal blur post-process + */ + getBlurHPostProcess(): BlurPostProcess; + /** + * Returns the vertical blur PostProcess + * @return {BABYLON.BlurPostProcess} The vertical blur post-process + */ + getBlurVPostProcess(): BlurPostProcess; + /** + * Removes the internal pipeline assets and detatches the pipeline from the scene cameras + */ + dispose(disableDepthRender?: boolean): void; + private _createSSAOPostProcess(ratio); + private _createSSAOCombinePostProcess(ratio); + private _createRandomTexture(); + } +} + +declare module BABYLON { + class StereoscopicInterlacePostProcess extends PostProcess { + private _stepSize; + constructor(name: string, camB: Camera, postProcessA: PostProcess, isStereoscopicHoriz: boolean, samplingMode?: number); + } +} + +declare module BABYLON { + enum TonemappingOperator { + Hable = 0, + Reinhard = 1, + HejiDawson = 2, + Photographic = 3, + } + class TonemapPostProcess extends PostProcess { + private _operator; + private _exposureAdjustment; + constructor(name: string, operator: TonemappingOperator, exposureAdjustment: number, camera: Camera, samplingMode?: number, engine?: Engine, textureFormat?: number); + } +} + +declare module BABYLON { + class VolumetricLightScatteringPostProcess extends PostProcess { + private _volumetricLightScatteringPass; + private _volumetricLightScatteringRTT; + private _viewPort; + private _screenCoordinates; + private _cachedDefines; + private _customMeshPosition; + /** + * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false) + * @type {boolean} + */ + useCustomMeshPosition: boolean; + /** + * If the post-process should inverse the light scattering direction + * @type {boolean} + */ + invert: boolean; + /** + * The internal mesh used by the post-process + * @type {boolean} + */ + mesh: Mesh; + /** + * Set to true to use the diffuseColor instead of the diffuseTexture + * @type {boolean} + */ + useDiffuseColor: boolean; + /** + * Array containing the excluded meshes not rendered in the internal pass + */ + excludedMeshes: AbstractMesh[]; + /** + * Controls the overall intensity of the post-process + * @type {number} + */ + exposure: number; + /** + * Dissipates each sample's contribution in range [0, 1] + * @type {number} + */ + decay: number; + /** + * Controls the overall intensity of each sample + * @type {number} + */ + weight: number; + /** + * Controls the density of each sample + * @type {number} + */ + density: number; + /** + * @constructor + * @param {string} name - The post-process name + * @param {any} ratio - The size of the post-process and/or internal pass (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) + * @param {BABYLON.Camera} camera - The camera that the post-process will be attached to + * @param {BABYLON.Mesh} mesh - The mesh used to create the light scattering + * @param {number} samples - The post-process quality, default 100 + * @param {number} samplingMode - The post-process filtering mode + * @param {BABYLON.Engine} engine - The babylon engine + * @param {boolean} reusable - If the post-process is reusable + * @param {BABYLON.Scene} scene - The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided + */ + constructor(name: string, ratio: any, camera: Camera, mesh?: Mesh, samples?: number, samplingMode?: number, engine?: Engine, reusable?: boolean, scene?: Scene); + isReady(subMesh: SubMesh, useInstances: boolean): boolean; + /** + * Sets the new light position for light scattering effect + * @param {BABYLON.Vector3} The new custom light position + */ + setCustomMeshPosition(position: Vector3): void; + /** + * Returns the light position for light scattering effect + * @return {BABYLON.Vector3} The custom light position + */ + getCustomMeshPosition(): Vector3; + /** + * Disposes the internal assets and detaches the post-process from the camera + */ + dispose(camera: Camera): void; + /** + * Returns the render target texture used by the post-process + * @return {BABYLON.RenderTargetTexture} The render target texture used by the post-process + */ + getPass(): RenderTargetTexture; + private _meshExcluded(mesh); + private _createPass(scene, ratio); + private _updateMeshScreenCoordinates(scene); + /** + * Creates a default mesh for the Volumeric Light Scattering post-process + * @param {string} The mesh name + * @param {BABYLON.Scene} The scene where to create the mesh + * @return {BABYLON.Mesh} the default mesh + */ + static CreateDefaultMesh(name: string, scene: Scene): Mesh; + } +} + +declare module BABYLON { + class VRDistortionCorrectionPostProcess extends PostProcess { + aspectRatio: number; + private _isRightEye; + private _distortionFactors; + private _postProcessScaleFactor; + private _lensCenterOffset; + private _scaleIn; + private _scaleFactor; + private _lensCenter; + constructor(name: string, camera: Camera, isRightEye: boolean, vrMetrics: VRCameraMetrics); + } +} + +declare module BABYLON { + class Sprite { + name: string; + position: Vector3; + color: Color4; + width: number; + height: number; + angle: number; + cellIndex: number; + invertU: number; + invertV: number; + disposeWhenFinishedAnimating: boolean; + animations: Animation[]; + private _animationStarted; + private _loopAnimation; + private _fromIndex; + private _toIndex; + private _delay; + private _direction; + private _frameCount; + private _manager; + private _time; + size: number; + constructor(name: string, manager: SpriteManager); + playAnimation(from: number, to: number, loop: boolean, delay: number): void; + stopAnimation(): void; + _animate(deltaTime: number): void; + dispose(): void; + } +} + +declare module BABYLON { + class SpriteManager { + name: string; + cellSize: number; + sprites: Sprite[]; + renderingGroupId: number; + layerMask: number; + onDispose: () => void; + fogEnabled: boolean; + private _capacity; + private _spriteTexture; + private _epsilon; + private _scene; + private _vertexDeclaration; + private _vertexStrideSize; + private _vertexBuffer; + private _indexBuffer; + private _vertices; + private _effectBase; + private _effectFog; + constructor(name: string, imgUrl: string, capacity: number, cellSize: number, scene: Scene, epsilon?: number, samplingMode?: number); + private _appendSpriteVertex(index, sprite, offsetX, offsetY, rowSize); + render(): void; + dispose(): void; + } +} + +declare module BABYLON.Internals { + class AndOrNotEvaluator { + static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean; + private static _HandleParenthesisContent(parenthesisContent, evaluateCallback); + private static _SimplifyNegation(booleanString); + } +} + +declare module BABYLON { + interface IAssetTask { + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + run(scene: Scene, onSuccess: () => void, onError: () => void): any; + } + class MeshAssetTask implements IAssetTask { + name: string; + meshesNames: any; + rootUrl: string; + sceneFilename: string; + loadedMeshes: Array; + loadedParticleSystems: Array; + loadedSkeletons: Array; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class TextFileAssetTask implements IAssetTask { + name: string; + url: string; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + text: string; + constructor(name: string, url: string); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class BinaryFileAssetTask implements IAssetTask { + name: string; + url: string; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + data: ArrayBuffer; + constructor(name: string, url: string); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class ImageAssetTask implements IAssetTask { + name: string; + url: string; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + image: HTMLImageElement; + constructor(name: string, url: string); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class TextureAssetTask implements IAssetTask { + name: string; + url: string; + noMipmap: boolean; + invertY: boolean; + samplingMode: number; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + texture: Texture; + constructor(name: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class AssetsManager { + private _tasks; + private _scene; + private _waitingTasksCount; + onFinish: (tasks: IAssetTask[]) => void; + onTaskSuccess: (task: IAssetTask) => void; + onTaskError: (task: IAssetTask) => void; + useDefaultLoadingScreen: boolean; + constructor(scene: Scene); + addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): IAssetTask; + addTextFileTask(taskName: string, url: string): IAssetTask; + addBinaryFileTask(taskName: string, url: string): IAssetTask; + addImageTask(taskName: string, url: string): IAssetTask; + addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): IAssetTask; + private _decreaseWaitingTasksCount(); + private _runTask(task); + reset(): AssetsManager; + load(): AssetsManager; + } +} + +declare module BABYLON { + class Database { + private callbackManifestChecked; + private currentSceneUrl; + private db; + private enableSceneOffline; + private enableTexturesOffline; + private manifestVersionFound; + private mustUpdateRessources; + private hasReachedQuota; + private isSupported; + private idbFactory; + static IsUASupportingBlobStorage: boolean; + static IDBStorageEnabled: boolean; + constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any); + static parseURL: (url: string) => string; + static ReturnFullUrlLocation: (url: string) => string; + checkManifestFile(): void; + openAsync(successCallback: any, errorCallback: any): void; + loadImageFromDB(url: string, image: HTMLImageElement): void; + private _loadImageFromDBAsync(url, image, notInDBCallback); + private _saveImageIntoDBAsync(url, image); + private _checkVersionFromDB(url, versionLoaded); + private _loadVersionFromDBAsync(url, callback, updateInDBCallback); + private _saveVersionIntoDBAsync(url, callback); + private loadFileFromDB(url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer?); + private _loadFileFromDBAsync(url, callback, notInDBCallback, useArrayBuffer?); + private _saveFileIntoDBAsync(url, callback, progressCallback, useArrayBuffer?); + } +} + +declare module BABYLON { + class FilesInput { + private _engine; + private _currentScene; + private _canvas; + private _sceneLoadedCallback; + private _progressCallback; + private _additionnalRenderLoopLogicCallback; + private _textureLoadingCallback; + private _startingProcessingFilesCallback; + private _elementToMonitor; + static FilesTextures: any[]; + static FilesToLoad: any[]; + private _sceneFileToLoad; + private _filesToLoad; + constructor(p_engine: Engine, p_scene: Scene, p_canvas: HTMLCanvasElement, p_sceneLoadedCallback: any, p_progressCallback: any, p_additionnalRenderLoopLogicCallback: any, p_textureLoadingCallback: any, p_startingProcessingFilesCallback: any); + monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void; + private renderFunction(); + private drag(e); + private drop(eventDrop); + loadFiles(event: any): void; + reload(): void; + } +} + +declare module BABYLON { + class Gamepads { + private babylonGamepads; + private oneGamepadConnected; + private isMonitoring; + private gamepadEventSupported; + private gamepadSupportAvailable; + private _callbackGamepadConnected; + private buttonADataURL; + private static gamepadDOMInfo; + constructor(ongamedpadconnected: (gamepad: Gamepad) => void); + private _insertGamepadDOMInstructions(); + private _insertGamepadDOMNotSupported(); + dispose(): void; + private _onGamepadConnected(evt); + private _addNewGamepad(gamepad); + private _onGamepadDisconnected(evt); + private _startMonitoringGamepads(); + private _stopMonitoringGamepads(); + private _checkGamepadsStatus(); + private _updateGamepadObjects(); + } + class StickValues { + x: any; + y: any; + constructor(x: any, y: any); + } + class Gamepad { + id: string; + index: number; + browserGamepad: any; + private _leftStick; + private _rightStick; + private _onleftstickchanged; + private _onrightstickchanged; + constructor(id: string, index: number, browserGamepad: any); + onleftstickchanged(callback: (values: StickValues) => void): void; + onrightstickchanged(callback: (values: StickValues) => void): void; + leftStick: StickValues; + rightStick: StickValues; + update(): void; + } + class GenericPad extends Gamepad { + id: string; + index: number; + gamepad: any; + private _buttons; + private _onbuttondown; + private _onbuttonup; + onbuttondown(callback: (buttonPressed: number) => void): void; + onbuttonup(callback: (buttonReleased: number) => void): void; + constructor(id: string, index: number, gamepad: any); + private _setButtonValue(newValue, currentValue, buttonIndex); + update(): void; + } + enum Xbox360Button { + A = 0, + B = 1, + X = 2, + Y = 3, + Start = 4, + Back = 5, + LB = 6, + RB = 7, + LeftStick = 8, + RightStick = 9, + } + enum Xbox360Dpad { + Up = 0, + Down = 1, + Left = 2, + Right = 3, + } + class Xbox360Pad extends Gamepad { + private _leftTrigger; + private _rightTrigger; + private _onlefttriggerchanged; + private _onrighttriggerchanged; + private _onbuttondown; + private _onbuttonup; + private _ondpaddown; + private _ondpadup; + private _buttonA; + private _buttonB; + private _buttonX; + private _buttonY; + private _buttonBack; + private _buttonStart; + private _buttonLB; + private _buttonRB; + private _buttonLeftStick; + private _buttonRightStick; + private _dPadUp; + private _dPadDown; + private _dPadLeft; + private _dPadRight; + onlefttriggerchanged(callback: (value: number) => void): void; + onrighttriggerchanged(callback: (value: number) => void): void; + leftTrigger: number; + rightTrigger: number; + onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void; + onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void; + ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void; + ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void; + private _setButtonValue(newValue, currentValue, buttonType); + private _setDPadValue(newValue, currentValue, buttonType); + buttonA: number; + buttonB: number; + buttonX: number; + buttonY: number; + buttonStart: number; + buttonBack: number; + buttonLB: number; + buttonRB: number; + buttonLeftStick: number; + buttonRightStick: number; + dPadUp: number; + dPadDown: number; + dPadLeft: number; + dPadRight: number; + update(): void; + } +} +interface Navigator { + getGamepads(func?: any): any; + webkitGetGamepads(func?: any): any; + msGetGamepads(func?: any): any; + webkitGamepads(func?: any): any; +} + +declare module BABYLON { + class SceneOptimization { + priority: number; + apply: (scene: Scene) => boolean; + constructor(priority?: number); + } + class TextureOptimization extends SceneOptimization { + priority: number; + maximumSize: number; + constructor(priority?: number, maximumSize?: number); + apply: (scene: Scene) => boolean; + } + class HardwareScalingOptimization extends SceneOptimization { + priority: number; + maximumScale: number; + private _currentScale; + constructor(priority?: number, maximumScale?: number); + apply: (scene: Scene) => boolean; + } + class ShadowsOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class PostProcessesOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class LensFlaresOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class ParticlesOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class RenderTargetsOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class MergeMeshesOptimization extends SceneOptimization { + static _UpdateSelectionTree: boolean; + static UpdateSelectionTree: boolean; + private _canBeMerged; + apply: (scene: Scene, updateSelectionTree?: boolean) => boolean; + } + class SceneOptimizerOptions { + targetFrameRate: number; + trackerDuration: number; + optimizations: SceneOptimization[]; + constructor(targetFrameRate?: number, trackerDuration?: number); + static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; + static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; + static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; + } + class SceneOptimizer { + static _CheckCurrentState(scene: Scene, options: SceneOptimizerOptions, currentPriorityLevel: number, onSuccess?: () => void, onFailure?: () => void): void; + static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): void; + } +} + +declare module BABYLON { + class SceneSerializer { + static Serialize(scene: Scene): any; + static SerializeMesh(toSerialize: any, withParents?: boolean, withChildren?: boolean): any; + } +} + +declare module BABYLON { + class SmartArray { + data: Array; + length: number; + private _id; + private _duplicateId; + constructor(capacity: number); + push(value: any): void; + pushNoDuplicate(value: any): void; + sort(compareFn: any): void; + reset(): void; + concat(array: any): void; + concatWithNoDuplicate(array: any): void; + indexOf(value: any): number; + private static _GlobalId; + } +} + +declare module BABYLON { + class SmartCollection { + count: number; + items: any; + private _keys; + private _initialCapacity; + constructor(capacity?: number); + add(key: any, item: any): number; + remove(key: any): number; + removeItemOfIndex(index: number): number; + indexOf(key: any): number; + item(key: any): any; + getAllKeys(): any[]; + getKeyByIndex(index: number): any; + getItemByIndex(index: number): any; + empty(): void; + forEach(block: (item: any) => void): void; + } +} + +declare module BABYLON { + class Tags { + static EnableFor(obj: any): void; + static DisableFor(obj: any): void; + static HasTags(obj: any): boolean; + static GetTags(obj: any): any; + static AddTagsTo(obj: any, tagsString: string): void; + static _AddTagTo(obj: any, tag: string): void; + static RemoveTagsFrom(obj: any, tagsString: string): void; + static _RemoveTagFrom(obj: any, tag: string): void; + static MatchesQuery(obj: any, tagsQuery: string): boolean; + } +} + +declare module BABYLON.Internals { + interface DDSInfo { + width: number; + height: number; + mipmapCount: number; + isFourCC: boolean; + isRGB: boolean; + isLuminance: boolean; + isCube: boolean; + } + class DDSTools { + static GetDDSInfo(arrayBuffer: any): DDSInfo; + private static GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); + private static GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); + private static GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); + static UploadDDSLevels(gl: WebGLRenderingContext, ext: any, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number): void; + } +} + +declare module BABYLON.Internals { + class TGATools { + private static _TYPE_NO_DATA; + private static _TYPE_INDEXED; + private static _TYPE_RGB; + private static _TYPE_GREY; + private static _TYPE_RLE_INDEXED; + private static _TYPE_RLE_RGB; + private static _TYPE_RLE_GREY; + private static _ORIGIN_MASK; + private static _ORIGIN_SHIFT; + private static _ORIGIN_BL; + private static _ORIGIN_BR; + private static _ORIGIN_UL; + private static _ORIGIN_UR; + static GetTGAHeader(data: Uint8Array): any; + static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void; + static _getImageData8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageData16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageData24bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageData32bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageDataGrey8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageDataGrey16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + } +} + +declare module BABYLON { + interface IAnimatable { + animations: Array; + } + interface ISize { + width: number; + height: number; + } + class Tools { + static BaseUrl: string; + static ToHex(i: number): string; + static SetImmediate(action: () => void): void; + static IsExponantOfTwo(value: number): boolean; + static GetExponantOfTwo(value: number, max: number): number; + static GetFilename(path: string): string; + static GetDOMTextContent(element: HTMLElement): string; + static ToDegrees(angle: number): number; + static ToRadians(angle: number): number; + static ExtractMinAndMaxIndexed(positions: number[], indices: number[], indexStart: number, indexCount: number): { + minimum: Vector3; + maximum: Vector3; + }; + static ExtractMinAndMax(positions: number[], start: number, count: number): { + minimum: Vector3; + maximum: Vector3; + }; + static MakeArray(obj: any, allowsNullUndefined?: boolean): Array; + static GetPointerPrefix(): string; + static QueueNewFrame(func: any): void; + static RequestFullscreen(element: any): void; + static ExitFullscreen(): void; + static CleanUrl(url: string): string; + static LoadImage(url: string, onload: any, onerror: any, database: any): HTMLImageElement; + static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: () => void, database?: any, useArrayBuffer?: boolean, onError?: () => void): void; + static ReadFileAsDataURL(fileToLoad: any, callback: any, progressCallback: any): void; + static ReadFile(fileToLoad: any, callback: any, progressCallBack: any, useArrayBuffer?: boolean): void; + static Clamp(value: number, min?: number, max?: number): number; + static Sign(value: number): number; + static Format(value: number, decimals?: number): string; + static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void; + static WithinEpsilon(a: number, b: number, epsilon?: number): boolean; + static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void; + static IsEmpty(obj: any): boolean; + static RegisterTopRootEvents(events: { + name: string; + handler: EventListener; + }[]): void; + static UnregisterTopRootEvents(events: { + name: string; + handler: EventListener; + }[]): void; + static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: String) => void): void; + static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: String) => void): void; + static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean; + private static _NoneLogLevel; + private static _MessageLogLevel; + private static _WarningLogLevel; + private static _ErrorLogLevel; + private static _LogCache; + static errorsCount: number; + static OnNewCacheEntry: (entry: string) => void; + static NoneLogLevel: number; + static MessageLogLevel: number; + static WarningLogLevel: number; + static ErrorLogLevel: number; + static AllLogLevel: number; + private static _AddLogEntry(entry); + private static _FormatMessage(message); + static Log: (message: string) => void; + private static _LogDisabled(message); + private static _LogEnabled(message); + static Warn: (message: string) => void; + private static _WarnDisabled(message); + private static _WarnEnabled(message); + static Error: (message: string) => void; + private static _ErrorDisabled(message); + private static _ErrorEnabled(message); + static LogCache: string; + static ClearLogCache(): void; + static LogLevels: number; + private static _PerformanceNoneLogLevel; + private static _PerformanceUserMarkLogLevel; + private static _PerformanceConsoleLogLevel; + private static _performance; + static PerformanceNoneLogLevel: number; + static PerformanceUserMarkLogLevel: number; + static PerformanceConsoleLogLevel: number; + static PerformanceLogLevel: number; + static _StartPerformanceCounterDisabled(counterName: string, condition?: boolean): void; + static _EndPerformanceCounterDisabled(counterName: string, condition?: boolean): void; + static _StartUserMark(counterName: string, condition?: boolean): void; + static _EndUserMark(counterName: string, condition?: boolean): void; + static _StartPerformanceConsole(counterName: string, condition?: boolean): void; + static _EndPerformanceConsole(counterName: string, condition?: boolean): void; + static StartPerformanceCounter: (counterName: string, condition?: boolean) => void; + static EndPerformanceCounter: (counterName: string, condition?: boolean) => void; + static Now: number; + static GetFps(): number; + } + /** + * An implementation of a loop for asynchronous functions. + */ + class AsyncLoop { + iterations: number; + private _fn; + private _successCallback; + index: number; + private _done; + /** + * Constroctor. + * @param iterations the number of iterations. + * @param _fn the function to run each iteration + * @param _successCallback the callback that will be called upon succesful execution + * @param offset starting offset. + */ + constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number); + /** + * Execute the next iteration. Must be called after the last iteration was finished. + */ + executeNext(): void; + /** + * Break the loop and run the success callback. + */ + breakLoop(): void; + /** + * Helper function + */ + static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop; + /** + * A for-loop that will run a given number of iterations synchronous and the rest async. + * @param iterations total number of iterations + * @param syncedIterations number of synchronous iterations in each async iteration. + * @param fn the function to call each iteration. + * @param callback a success call back that will be called when iterating stops. + * @param breakFunction a break condition (optional) + * @param timeout timeout settings for the setTimeout function. default - 0. + * @constructor + */ + static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void; + } +} + +declare module BABYLON { + enum JoystickAxis { + X = 0, + Y = 1, + Z = 2, + } + class VirtualJoystick { + reverseLeftRight: boolean; + reverseUpDown: boolean; + deltaPosition: Vector3; + pressed: boolean; + private static _globalJoystickIndex; + private static vjCanvas; + private static vjCanvasContext; + private static vjCanvasWidth; + private static vjCanvasHeight; + private static halfWidth; + private static halfHeight; + private _action; + private _axisTargetedByLeftAndRight; + private _axisTargetedByUpAndDown; + private _joystickSensibility; + private _inversedSensibility; + private _rotationSpeed; + private _inverseRotationSpeed; + private _rotateOnAxisRelativeToMesh; + private _joystickPointerID; + private _joystickColor; + private _joystickPointerPos; + private _joystickPreviousPointerPos; + private _joystickPointerStartPos; + private _deltaJoystickVector; + private _leftJoystick; + private _joystickIndex; + private _touches; + private _onPointerDownHandlerRef; + private _onPointerMoveHandlerRef; + private _onPointerUpHandlerRef; + private _onPointerOutHandlerRef; + private _onResize; + constructor(leftJoystick?: boolean); + setJoystickSensibility(newJoystickSensibility: number): void; + private _onPointerDown(e); + private _onPointerMove(e); + private _onPointerUp(e); + /** + * Change the color of the virtual joystick + * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000") + */ + setJoystickColor(newColor: string): void; + setActionOnTouch(action: () => any): void; + setAxisForLeftRight(axis: JoystickAxis): void; + setAxisForUpDown(axis: JoystickAxis): void; + private _clearCanvas(); + private _drawVirtualJoystick(); + releaseCanvas(): void; + } +} + +declare module BABYLON { + class VRDeviceOrientationFreeCamera extends FreeCamera { + _alpha: number; + _beta: number; + _gamma: number; + private _offsetOrientation; + private _deviceOrientationHandler; + constructor(name: string, position: Vector3, scene: Scene, compensateDistorsion?: boolean); + _onOrientationEvent(evt: DeviceOrientationEvent): void; + attachControl(element: HTMLElement, noPreventDefault?: boolean): void; + detachControl(element: HTMLElement): void; + } +} + +declare var HMDVRDevice: any; +declare var PositionSensorVRDevice: any; +declare module BABYLON { + class WebVRFreeCamera extends FreeCamera { + _hmdDevice: any; + _sensorDevice: any; + _cacheState: any; + _cacheQuaternion: Quaternion; + _cacheRotation: Vector3; + _vrEnabled: boolean; + constructor(name: string, position: Vector3, scene: Scene, compensateDistorsion?: boolean); + private _getWebVRDevices(devices); + _checkInputs(): void; + attachControl(element: HTMLElement, noPreventDefault?: boolean): void; + detachControl(element: HTMLElement): void; + } +} + +declare module BABYLON { + interface IOctreeContainer { + blocks: Array>; + } + class Octree { + maxDepth: number; + blocks: Array>; + dynamicContent: T[]; + private _maxBlockCapacity; + private _selectionContent; + private _creationFunc; + constructor(creationFunc: (entry: T, block: OctreeBlock) => void, maxBlockCapacity?: number, maxDepth?: number); + update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void; + addMesh(entry: T): void; + select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray; + intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray; + intersectsRay(ray: Ray): SmartArray; + static _CreateBlocks(worldMin: Vector3, worldMax: Vector3, entries: T[], maxBlockCapacity: number, currentDepth: number, maxDepth: number, target: IOctreeContainer, creationFunc: (entry: T, block: OctreeBlock) => void): void; + static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock) => void; + static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock) => void; + } +} + +declare module BABYLON { + class OctreeBlock { + entries: T[]; + blocks: Array>; + private _depth; + private _maxDepth; + private _capacity; + private _minPoint; + private _maxPoint; + private _boundingVectors; + private _creationFunc; + constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock) => void); + capacity: number; + minPoint: Vector3; + maxPoint: Vector3; + addEntry(entry: T): void; + addEntries(entries: T[]): void; + select(frustumPlanes: Plane[], selection: SmartArray, allowDuplicate?: boolean): void; + intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray, allowDuplicate?: boolean): void; + intersectsRay(ray: Ray, selection: SmartArray): void; + createInnerBlocks(): void; + } +} + +declare module BABYLON { + class ShadowGenerator { + private static _FILTER_NONE; + private static _FILTER_VARIANCESHADOWMAP; + private static _FILTER_POISSONSAMPLING; + private static _FILTER_BLURVARIANCESHADOWMAP; + static FILTER_NONE: number; + static FILTER_VARIANCESHADOWMAP: number; + static FILTER_POISSONSAMPLING: number; + static FILTER_BLURVARIANCESHADOWMAP: number; + private _filter; + blurScale: number; + private _blurBoxOffset; + private _bias; + private _lightDirection; + bias: number; + blurBoxOffset: number; + filter: number; + useVarianceShadowMap: boolean; + usePoissonSampling: boolean; + useBlurVarianceShadowMap: boolean; + private _light; + private _scene; + private _shadowMap; + private _shadowMap2; + private _darkness; + private _transparencyShadow; + private _effect; + private _viewMatrix; + private _projectionMatrix; + private _transformMatrix; + private _worldViewProjection; + private _cachedPosition; + private _cachedDirection; + private _cachedDefines; + private _currentRenderID; + private _downSamplePostprocess; + private _boxBlurPostprocess; + private _mapSize; + constructor(mapSize: number, light: IShadowLight); + isReady(subMesh: SubMesh, useInstances: boolean): boolean; + getShadowMap(): RenderTargetTexture; + getShadowMapForRendering(): RenderTargetTexture; + getLight(): IShadowLight; + getTransformMatrix(): Matrix; + getDarkness(): number; + setDarkness(darkness: number): void; + setTransparencyShadow(hasShadow: boolean): void; + private _packHalf(depth); + dispose(): void; + } +} + +declare module BABYLON.Internals { +} + +declare module BABYLON { + class BaseTexture { + name: string; + delayLoadState: number; + hasAlpha: boolean; + getAlphaFromRGB: boolean; + level: number; + isCube: boolean; + isRenderTarget: boolean; + animations: Animation[]; + onDispose: () => void; + coordinatesIndex: number; + coordinatesMode: number; + wrapU: number; + wrapV: number; + uScale: number; + vScale: number; + anisotropicFilteringLevel: number; + _cachedAnisotropicFilteringLevel: number; + private _scene; + _texture: WebGLTexture; + constructor(scene: Scene); + getScene(): Scene; + getTextureMatrix(): Matrix; + getReflectionTextureMatrix(): Matrix; + getInternalTexture(): WebGLTexture; + isReady(): boolean; + getSize(): ISize; + getBaseSize(): ISize; + scale(ratio: number): void; + canRescale: boolean; + _removeFromCache(url: string, noMipmap: boolean): void; + _getFromCache(url: string, noMipmap: boolean, sampling?: number): WebGLTexture; + delayLoad(): void; + releaseInternalTexture(): void; + clone(): BaseTexture; + dispose(): void; + } +} + +declare module BABYLON { + class CubeTexture extends BaseTexture { + url: string; + coordinatesMode: number; + private _noMipmap; + private _extensions; + private _textureMatrix; + constructor(rootUrl: string, scene: Scene, extensions?: string[], noMipmap?: boolean); + clone(): CubeTexture; + delayLoad(): void; + getReflectionTextureMatrix(): Matrix; + } +} + +declare module BABYLON { + class DynamicTexture extends Texture { + private _generateMipMaps; + private _canvas; + private _context; + constructor(name: string, options: any, scene: Scene, generateMipMaps: boolean, samplingMode?: number); + canRescale: boolean; + scale(ratio: number): void; + getContext(): CanvasRenderingContext2D; + clear(): void; + update(invertY?: boolean): void; + drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void; + clone(): DynamicTexture; + } +} + +declare module BABYLON { + class MirrorTexture extends RenderTargetTexture { + mirrorPlane: Plane; + private _transformMatrix; + private _mirrorMatrix; + private _savedViewMatrix; + constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean); + clone(): MirrorTexture; + } +} + +declare module BABYLON { + class RawTexture extends Texture { + format: number; + constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number); + update(data: ArrayBufferView): void; + static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + } +} + +declare module BABYLON { + class RenderTargetTexture extends Texture { + renderList: AbstractMesh[]; + renderParticles: boolean; + renderSprites: boolean; + coordinatesMode: number; + onBeforeRender: () => void; + onAfterRender: () => void; + onAfterUnbind: () => void; + onClear: (engine: Engine) => void; + activeCamera: Camera; + customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray, beforeTransparents?: () => void) => void; + private _size; + _generateMipMaps: boolean; + private _renderingManager; + _waitingRenderList: string[]; + private _doNotChangeAspectRatio; + private _currentRefreshId; + private _refreshRate; + constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number); + resetRefreshCounter(): void; + refreshRate: number; + _shouldRender(): boolean; + isReady(): boolean; + getRenderSize(): number; + canRescale: boolean; + scale(ratio: number): void; + resize(size: any, generateMipMaps?: boolean): void; + render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void; + clone(): RenderTargetTexture; + } +} + +declare module BABYLON { + class Texture extends BaseTexture { + static NEAREST_SAMPLINGMODE: number; + static BILINEAR_SAMPLINGMODE: number; + static TRILINEAR_SAMPLINGMODE: number; + static EXPLICIT_MODE: number; + static SPHERICAL_MODE: number; + static PLANAR_MODE: number; + static CUBIC_MODE: number; + static PROJECTION_MODE: number; + static SKYBOX_MODE: number; + static CLAMP_ADDRESSMODE: number; + static WRAP_ADDRESSMODE: number; + static MIRROR_ADDRESSMODE: number; + url: string; + uOffset: number; + vOffset: number; + uScale: number; + vScale: number; + uAng: number; + vAng: number; + wAng: number; + private _noMipmap; + _invertY: boolean; + private _rowGenerationMatrix; + private _cachedTextureMatrix; + private _projectionModeMatrix; + private _t0; + private _t1; + private _t2; + private _cachedUOffset; + private _cachedVOffset; + private _cachedUScale; + private _cachedVScale; + private _cachedUAng; + private _cachedVAng; + private _cachedWAng; + private _cachedCoordinatesMode; + _samplingMode: number; + private _buffer; + private _deleteBuffer; + constructor(url: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any, deleteBuffer?: boolean); + delayLoad(): void; + updateSamplingMode(samplingMode: number): void; + private _prepareRowForTextureGeneration(x, y, z, t); + getTextureMatrix(): Matrix; + getReflectionTextureMatrix(): Matrix; + clone(): Texture; + static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture; + } +} + +declare module BABYLON { + class VideoTexture extends Texture { + video: HTMLVideoElement; + private _autoLaunch; + private _lastUpdate; + constructor(name: string, urls: string[], scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number); + update(): boolean; + } +} + +declare module BABYLON { + class CannonJSPlugin implements IPhysicsEnginePlugin { + checkWithEpsilon: (value: number) => number; + private _world; + private _registeredMeshes; + private _physicsMaterials; + initialize(iterations?: number): void; + private _checkWithEpsilon(value); + runOneStep(delta: number): void; + setGravity(gravity: Vector3): void; + registerMesh(mesh: AbstractMesh, impostor: number, options?: PhysicsBodyCreationOptions): any; + private _createSphere(radius, mesh, options?); + private _createBox(x, y, z, mesh, options?); + private _createPlane(mesh, options?); + private _createConvexPolyhedron(rawVerts, rawFaces, mesh, options?); + private _addMaterial(friction, restitution); + private _createRigidBodyFromShape(shape, mesh, mass, friction, restitution); + registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; + private _unbindBody(body); + unregisterMesh(mesh: AbstractMesh): void; + applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; + updateBodyPosition: (mesh: AbstractMesh) => void; + createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3): boolean; + dispose(): void; + isSupported(): boolean; + } +} + +declare module BABYLON { + class OimoJSPlugin implements IPhysicsEnginePlugin { + private _world; + private _registeredMeshes; + private _checkWithEpsilon(value); + initialize(iterations?: number): void; + setGravity(gravity: Vector3): void; + registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; + registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; + private _createBodyAsCompound(part, options, initialMesh); + unregisterMesh(mesh: AbstractMesh): void; + private _unbindBody(body); + /** + * Update the body position according to the mesh position + * @param mesh + */ + updateBodyPosition: (mesh: AbstractMesh) => void; + applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; + createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; + dispose(): void; + isSupported(): boolean; + private _getLastShape(body); + runOneStep(time: number): void; + } +} + +declare module BABYLON { + class PostProcessRenderEffect { + private _engine; + private _postProcesses; + private _getPostProcess; + private _singleInstance; + private _cameras; + private _indicesForCamera; + private _renderPasses; + private _renderEffectAsPasses; + _name: string; + applyParameters: (postProcess: PostProcess) => void; + constructor(engine: Engine, name: string, getPostProcess: () => PostProcess, singleInstance?: boolean); + _update(): void; + addPass(renderPass: PostProcessRenderPass): void; + removePass(renderPass: PostProcessRenderPass): void; + addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void; + getPass(passName: string): void; + emptyPasses(): void; + _attachCameras(cameras: Camera): any; + _attachCameras(cameras: Camera[]): any; + _detachCameras(cameras: Camera): any; + _detachCameras(cameras: Camera[]): any; + _enable(cameras: Camera): any; + _enable(cameras: Camera[]): any; + _disable(cameras: Camera): any; + _disable(cameras: Camera[]): any; + getPostProcess(camera?: Camera): PostProcess; + private _linkParameters(); + private _linkTextures(effect); + } +} + +declare module BABYLON { + class PostProcessRenderPass { + private _enabled; + private _renderList; + private _renderTexture; + private _scene; + private _refCount; + _name: string; + constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void); + _incRefCount(): number; + _decRefCount(): number; + _update(): void; + setRenderList(renderList: Mesh[]): void; + getRenderTexture(): RenderTargetTexture; + } +} + +declare module BABYLON { + class PostProcessRenderPipeline { + private _engine; + private _renderEffects; + private _renderEffectsForIsolatedPass; + private _cameras; + _name: string; + private static PASS_EFFECT_NAME; + private static PASS_SAMPLER_NAME; + constructor(engine: Engine, name: string); + addEffect(renderEffect: PostProcessRenderEffect): void; + _enableEffect(renderEffectName: string, cameras: Camera): any; + _enableEffect(renderEffectName: string, cameras: Camera[]): any; + _disableEffect(renderEffectName: string, cameras: Camera): any; + _disableEffect(renderEffectName: string, cameras: Camera[]): any; + _attachCameras(cameras: Camera, unique: boolean): any; + _attachCameras(cameras: Camera[], unique: boolean): any; + _detachCameras(cameras: Camera): any; + _detachCameras(cameras: Camera[]): any; + _enableDisplayOnlyPass(passName: any, cameras: Camera): any; + _enableDisplayOnlyPass(passName: any, cameras: Camera[]): any; + _disableDisplayOnlyPass(cameras: Camera): any; + _disableDisplayOnlyPass(cameras: Camera[]): any; + _update(): void; + } +} + +declare module BABYLON { + class PostProcessRenderPipelineManager { + private _renderPipelines; + constructor(); + addPipeline(renderPipeline: PostProcessRenderPipeline): void; + attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): any; + attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): any; + detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): any; + detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): any; + enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any; + enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any; + disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any; + disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any; + enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): any; + enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): any; + disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): any; + disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): any; + update(): void; + } +} + +declare module BABYLON { + class CustomProceduralTexture extends ProceduralTexture { + private _animate; + private _time; + private _config; + private _texturePath; + constructor(name: string, texturePath: any, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + private loadJson(jsonUrl); + isReady(): boolean; + render(useCameraPostProcess?: boolean): void; + updateTextures(): void; + updateShaderUniforms(): void; + animate: boolean; + } +} + +declare module BABYLON { + class ProceduralTexture extends Texture { + private _size; + _generateMipMaps: boolean; + isEnabled: boolean; + private _doNotChangeAspectRatio; + private _currentRefreshId; + private _refreshRate; + private _vertexBuffer; + private _indexBuffer; + private _effect; + private _vertexDeclaration; + private _vertexStrideSize; + private _uniforms; + private _samplers; + private _fragment; + _textures: Texture[]; + private _floats; + private _floatsArrays; + private _colors3; + private _colors4; + private _vectors2; + private _vectors3; + private _matrices; + private _fallbackTexture; + private _fallbackTextureUsed; + constructor(name: string, size: any, fragment: any, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + reset(): void; + isReady(): boolean; + resetRefreshCounter(): void; + setFragment(fragment: any): void; + refreshRate: number; + _shouldRender(): boolean; + getRenderSize(): number; + resize(size: any, generateMipMaps: any): void; + private _checkUniform(uniformName); + setTexture(name: string, texture: Texture): ProceduralTexture; + setFloat(name: string, value: number): ProceduralTexture; + setFloats(name: string, value: number[]): ProceduralTexture; + setColor3(name: string, value: Color3): ProceduralTexture; + setColor4(name: string, value: Color4): ProceduralTexture; + setVector2(name: string, value: Vector2): ProceduralTexture; + setVector3(name: string, value: Vector3): ProceduralTexture; + setMatrix(name: string, value: Matrix): ProceduralTexture; + render(useCameraPostProcess?: boolean): void; + clone(): ProceduralTexture; + dispose(): void; + } +} + +declare module BABYLON { + class WoodProceduralTexture extends ProceduralTexture { + private _ampScale; + private _woodColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + ampScale: number; + woodColor: Color3; + } + class FireProceduralTexture extends ProceduralTexture { + private _time; + private _speed; + private _autoGenerateTime; + private _fireColors; + private _alphaThreshold; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + render(useCameraPostProcess?: boolean): void; + static PurpleFireColors: Color3[]; + static GreenFireColors: Color3[]; + static RedFireColors: Color3[]; + static BlueFireColors: Color3[]; + fireColors: Color3[]; + time: number; + speed: Vector2; + alphaThreshold: number; + } + class CloudProceduralTexture extends ProceduralTexture { + private _skyColor; + private _cloudColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + skyColor: Color4; + cloudColor: Color4; + } + class GrassProceduralTexture extends ProceduralTexture { + private _grassColors; + private _herb1; + private _herb2; + private _herb3; + private _groundColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + grassColors: Color3[]; + groundColor: Color3; + } + class RoadProceduralTexture extends ProceduralTexture { + private _roadColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + roadColor: Color3; + } + class BrickProceduralTexture extends ProceduralTexture { + private _numberOfBricksHeight; + private _numberOfBricksWidth; + private _jointColor; + private _brickColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + numberOfBricksHeight: number; + numberOfBricksWidth: number; + jointColor: Color3; + brickColor: Color3; + } + class MarbleProceduralTexture extends ProceduralTexture { + private _numberOfTilesHeight; + private _numberOfTilesWidth; + private _amplitude; + private _marbleColor; + private _jointColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + numberOfTilesHeight: number; + numberOfTilesWidth: number; + jointColor: Color3; + marbleColor: Color3; + } +} diff --git a/babylonjs/babylonjs-tests.ts b/babylonjs/babylonjs-tests.ts new file mode 100644 index 0000000000..bb9a419cca --- /dev/null +++ b/babylonjs/babylonjs-tests.ts @@ -0,0 +1 @@ +/// \ No newline at end of file From 2145adaf844eac84a15194e1ab4081c918516c1d Mon Sep 17 00:00:00 2001 From: Andrei Sebastian Cimpean Date: Mon, 4 Jan 2016 22:48:29 +0200 Subject: [PATCH 218/441] Add typings for mmmagic 0.4.1. https://github.com/mscdex/mmmagic mmmagic is an async libmagic binding for node.js for detecting content types by data inspection. --- mmmagic/mmmagic-tests.ts | 30 ++++++++++++++++++++++++++++++ mmmagic/mmmagic.d.ts | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 mmmagic/mmmagic-tests.ts create mode 100644 mmmagic/mmmagic.d.ts diff --git a/mmmagic/mmmagic-tests.ts b/mmmagic/mmmagic-tests.ts new file mode 100644 index 0000000000..afe93ff091 --- /dev/null +++ b/mmmagic/mmmagic-tests.ts @@ -0,0 +1,30 @@ +/// + +import Magic = require("mmmagic"); + +// get general description of a file +var magic: Magic.Magic; + +magic = new Magic.Magic(); +magic.detectFile('node_modules/mmmagic/build/Release/magic.node', function(err: Error, result: string) { + if (err) throw err; + console.log(result); + // output on Windows with 32-bit node: +}); + +// get mime type for a file +magic = new Magic.Magic(Magic.MAGIC_MIME_TYPE); +magic.detectFile('node_modules/mmmagic/build/Release/magic.node', function(err: Error, result: string) { + if (err) throw err; + console.log(result); +}); + +// get mime type and mime encoding for a file +magic = new Magic.Magic(); +var buf = new Buffer('import Options\nfrom os import unlink, symlink'); + +magic.detect(buf, function(err: Error, result: string) { + if (err) throw err; + console.log(result); + // output: Python script, ASCII text executable +}); \ No newline at end of file diff --git a/mmmagic/mmmagic.d.ts b/mmmagic/mmmagic.d.ts new file mode 100644 index 0000000000..b286c93319 --- /dev/null +++ b/mmmagic/mmmagic.d.ts @@ -0,0 +1,37 @@ +// Type definitions for mmmagic v0.4.1 +// Project: https://github.com/mscdex/mmmagic +// Definitions by: Andrei Sebastian Cîmpean +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "mmmagic" { + export type bitmask = number; + export class Magic { + constructor(magicPath?: string, mask?: bitmask); + constructor(mask?: bitmask); + detectFile(path: string, callback: (err: Error, result: string) => void): void; + detect(data: Buffer, callback: (err: Error, result: string) => void): void; + } + export var MAGIC_NONE: bitmask; // no flags set + export var MAGIC_DEBUG: bitmask; // turn on debugging + export var MAGIC_SYMLINK: bitmask; // follow symlinks (default for non-Windows) + export var MAGIC_DEVICES: bitmask; // look at the contents of devices + export var MAGIC_MIME_TYPE: bitmask; // return the MIME type + export var MAGIC_CONTINUE: bitmask; // return all matches (returned as an array of strings) + export var MAGIC_CHECK: bitmask; // print warnings to stderr + export var MAGIC_PRESERVE_ATIME: bitmask; // restore access time on exit + export var MAGIC_RAW: bitmask; // don't translate unprintable chars + export var MAGIC_MIME_ENCODING: bitmask; // return the MIME encoding + export var MAGIC_MIME: bitmask; // (export var MAGIC_MIME_TYPE | export var MAGIC_MIME_ENCODING) + export var MAGIC_APPLE: bitmask; // return the Apple creator and type + export var MAGIC_NO_CHECK_TAR: bitmask; // don't check for tar files + export var MAGIC_NO_CHECK_SOFT: bitmask; // don't check magic entries + export var MAGIC_NO_CHECK_APPTYPE: bitmask; // don't check application type + export var MAGIC_NO_CHECK_ELF: bitmask; // don't check for elf details + export var MAGIC_NO_CHECK_TEXT: bitmask; // don't check for text files + export var MAGIC_NO_CHECK_CDF: bitmask; // don't check for cdf files + export var MAGIC_NO_CHECK_TOKENS: bitmask; // don't check tokens + export var MAGIC_NO_CHECK_ENCODING: bitmask // don't check text encodings + +} \ No newline at end of file From 824b0493e717a203c4107f0f1621a251cd3ff1c4 Mon Sep 17 00:00:00 2001 From: Calvin Fernandez Date: Mon, 4 Jan 2016 16:11:09 -0500 Subject: [PATCH 219/441] add dragStart type --- angular-ui-tree/angular-ui-tree-tests.ts | 1 + angular-ui-tree/angular-ui-tree.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/angular-ui-tree/angular-ui-tree-tests.ts b/angular-ui-tree/angular-ui-tree-tests.ts index 4e5ef91b92..718fada2ce 100644 --- a/angular-ui-tree/angular-ui-tree-tests.ts +++ b/angular-ui-tree/angular-ui-tree-tests.ts @@ -78,5 +78,6 @@ var droppedCallback: AngularUITree.IDroppedCallback = (eventInfo: AngularUITree. var callbacks: AngularUITree.ICallbacks = { accept: acceptCallback, + dragStart: droppedCallback, dropped: droppedCallback }; diff --git a/angular-ui-tree/angular-ui-tree.d.ts b/angular-ui-tree/angular-ui-tree.d.ts index 62c8899fa3..cfcb2b1087 100644 --- a/angular-ui-tree/angular-ui-tree.d.ts +++ b/angular-ui-tree/angular-ui-tree.d.ts @@ -54,6 +54,7 @@ declare module AngularUITree { interface ICallbacks { accept: IAcceptCallback; + dragStart: IDroppedCallback; dropped: IDroppedCallback; } From 6dd0b2dc5ca7033ddd3eab2743ec54465fb65cf8 Mon Sep 17 00:00:00 2001 From: Scarrier Date: Mon, 4 Jan 2016 15:43:02 -0600 Subject: [PATCH 220/441] Fix definition for IFieldGroup, add IFieldArray as convenience type for formly-form fields property, update tests --- angular-formly/angular-formly-tests.ts | 17 ++++++++++++- angular-formly/angular-formly.d.ts | 35 +++++++++++++++----------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/angular-formly/angular-formly-tests.ts b/angular-formly/angular-formly-tests.ts index ef6a384637..2374fde4ad 100644 --- a/angular-formly/angular-formly-tests.ts +++ b/angular-formly/angular-formly-tests.ts @@ -24,7 +24,7 @@ class FormConfig { } class AppController { - fields: AngularFormly.IFieldConfigurationObject[]; + fields: AngularFormly.IFieldArray; constructor() { var vm = this; vm.fields = [ @@ -99,6 +99,21 @@ class AppController { templateOptions: { label: 'no wrapper here...' } + }, + { + //From http://angular-formly.com/#/example/other/nested-formly-forms + key: 'address', + wrapper: 'panel', + templateOptions: { label: 'Address' }, + fieldGroup: [{ + key: 'town', + type: 'input', + templateOptions: { + required: true, + type: 'text', + label: 'Town' + } + }] } ] } diff --git a/angular-formly/angular-formly.d.ts b/angular-formly/angular-formly.d.ts index fce793e7e7..7ee3d31945 100644 --- a/angular-formly/angular-formly.d.ts +++ b/angular-formly/angular-formly.d.ts @@ -1,7 +1,7 @@ -// Type definitions for angular-formly 6.18.0 +// Type definitions for angular-formly 7.2.3 // Project: https://github.com/formly-js/angular-formly // Definitions by: Scott Hatcher -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -16,18 +16,23 @@ declare module 'angular-formly' { declare module AngularFormly { + interface IFieldArray extends Array { + + } interface IFieldGroup { data?: Object; className?: string; - elementAttributes?: { [key: string]: string }; - fieldGroup: IFieldConfigurationObject[]; + elementAttributes?: string; + fieldGroup: IFieldArray; form?: Object; hide?: boolean; - hideExpression?: string | IExpresssionFunction; + hideExpression?: string | IExpressionFunction; key?: string | number; model?: string | Object; - options?: IFormOptionsAPI + options?: IFormOptionsAPI; + templateOptions?: ITemplateOptions; + wrapper?: string | string[]; } @@ -46,7 +51,7 @@ declare module AngularFormly { /** * see http://docs.angular-formly.com/docs/formly-expressions#expressionproperties-validators--messages */ - interface IExpresssionFunction { + interface IExpressionFunction { ($viewValue: any, $modelValue: any, scope: ITemplateScope): any; } @@ -122,8 +127,8 @@ declare module AngularFormly { * see http://docs.angular-formly.com/docs/field-configuration-object#validators-object */ interface IValidator { - expression: string | IExpresssionFunction; - message?: string | IExpresssionFunction; + expression: string | IExpressionFunction; + message?: string | IExpressionFunction; } @@ -154,7 +159,7 @@ declare module AngularFormly { * see http://angular-formly.com/#/example/other/unique-value-async-validation */ asyncValidators?: { - [key: string]: string | IExpresssionFunction | IValidator; + [key: string]: string | IExpressionFunction | IValidator; } /** @@ -204,7 +209,7 @@ declare module AngularFormly { * see http://docs.angular-formly.com/docs/field-configuration-object#expressionproperties-object */ expressionProperties?: { - [key: string]: string | IExpresssionFunction | IValidator; + [key: string]: string | IExpressionFunction | IValidator; } @@ -224,7 +229,7 @@ declare module AngularFormly { * * see http://docs.angular-formly.com/docs/field-configuration-object#hideexpression-string--function */ - hideExpression?: string | IExpresssionFunction; + hideExpression?: string | IExpressionFunction; /** @@ -416,7 +421,7 @@ declare module AngularFormly { * like in this example. */ messages?: { - [key: string]: IExpresssionFunction | string; + [key: string]: IExpressionFunction | string; } @@ -440,7 +445,7 @@ declare module AngularFormly { * see http://docs.angular-formly.com/docs/field-configuration-object#validators-object */ validators?: { - [key: string]: string | IExpresssionFunction | IValidator; + [key: string]: string | IExpressionFunction | IValidator; } @@ -573,7 +578,7 @@ declare module AngularFormly { //Shortcut to options.formControl fc: ng.IFormController | ng.IFormController[]; //all the fields for the form - fields: IFieldConfigurationObject[]; + fields: IFieldArray; //the form controller the field is in form: any; //The object passed as options.formState to the formly-form directive. Use this to share state between fields. From 922b2553fed2ba84fc62159cf0d026375d45d5a8 Mon Sep 17 00:00:00 2001 From: ssatguru Date: Mon, 4 Jan 2016 15:49:21 -0600 Subject: [PATCH 221/441] Delete babylon.2.2.d.ts --- babylonjs/babylon.2.2.d.ts | 6327 ------------------------------------ 1 file changed, 6327 deletions(-) delete mode 100644 babylonjs/babylon.2.2.d.ts diff --git a/babylonjs/babylon.2.2.d.ts b/babylonjs/babylon.2.2.d.ts deleted file mode 100644 index 1cc835442c..0000000000 --- a/babylonjs/babylon.2.2.d.ts +++ /dev/null @@ -1,6327 +0,0 @@ -// Type definitions for BabylonJS v2.2 -// Project: http://www.babylonjs.com/ -// Definitions by: David Catuhe -// Definitions: https://github.com/borisyankov/babylonjs - - -declare module BABYLON { - class _DepthCullingState { - private _isDepthTestDirty; - private _isDepthMaskDirty; - private _isDepthFuncDirty; - private _isCullFaceDirty; - private _isCullDirty; - private _isZOffsetDirty; - private _depthTest; - private _depthMask; - private _depthFunc; - private _cull; - private _cullFace; - private _zOffset; - isDirty: boolean; - zOffset: number; - cullFace: number; - cull: boolean; - depthFunc: number; - depthMask: boolean; - depthTest: boolean; - reset(): void; - apply(gl: WebGLRenderingContext): void; - } - class _AlphaState { - private _isAlphaBlendDirty; - private _isBlendFunctionParametersDirty; - private _alphaBlend; - private _blendFunctionParameters; - isDirty: boolean; - alphaBlend: boolean; - setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void; - reset(): void; - apply(gl: WebGLRenderingContext): void; - } - class EngineCapabilities { - maxTexturesImageUnits: number; - maxTextureSize: number; - maxCubemapTextureSize: number; - maxRenderTextureSize: number; - standardDerivatives: boolean; - s3tc: any; - textureFloat: boolean; - textureAnisotropicFilterExtension: any; - maxAnisotropy: number; - instancedArrays: any; - uintIndices: boolean; - highPrecisionShaderSupported: boolean; - } - /** - * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio. - */ - class Engine { - private static _ALPHA_DISABLE; - private static _ALPHA_ADD; - private static _ALPHA_COMBINE; - private static _ALPHA_SUBTRACT; - private static _ALPHA_MULTIPLY; - private static _ALPHA_MAXIMIZED; - private static _ALPHA_ONEONE; - private static _DELAYLOADSTATE_NONE; - private static _DELAYLOADSTATE_LOADED; - private static _DELAYLOADSTATE_LOADING; - private static _DELAYLOADSTATE_NOTLOADED; - private static _TEXTUREFORMAT_ALPHA; - private static _TEXTUREFORMAT_LUMINANCE; - private static _TEXTUREFORMAT_LUMINANCE_ALPHA; - private static _TEXTUREFORMAT_RGB; - private static _TEXTUREFORMAT_RGBA; - private static _TEXTURETYPE_UNSIGNED_INT; - private static _TEXTURETYPE_FLOAT; - static ALPHA_DISABLE: number; - static ALPHA_ONEONE: number; - static ALPHA_ADD: number; - static ALPHA_COMBINE: number; - static ALPHA_SUBTRACT: number; - static ALPHA_MULTIPLY: number; - static ALPHA_MAXIMIZED: number; - static DELAYLOADSTATE_NONE: number; - static DELAYLOADSTATE_LOADED: number; - static DELAYLOADSTATE_LOADING: number; - static DELAYLOADSTATE_NOTLOADED: number; - static TEXTUREFORMAT_ALPHA: number; - static TEXTUREFORMAT_LUMINANCE: number; - static TEXTUREFORMAT_LUMINANCE_ALPHA: number; - static TEXTUREFORMAT_RGB: number; - static TEXTUREFORMAT_RGBA: number; - static TEXTURETYPE_UNSIGNED_INT: number; - static TEXTURETYPE_FLOAT: number; - static Version: string; - static Epsilon: number; - static CollisionsEpsilon: number; - static CodeRepository: string; - static ShadersRepository: string; - isFullscreen: boolean; - isPointerLock: boolean; - cullBackFaces: boolean; - renderEvenInBackground: boolean; - enableOfflineSupport: boolean; - scenes: Scene[]; - _gl: WebGLRenderingContext; - private _renderingCanvas; - private _windowIsBackground; - static audioEngine: AudioEngine; - private _onBlur; - private _onFocus; - private _onFullscreenChange; - private _onPointerLockChange; - private _hardwareScalingLevel; - private _caps; - private _pointerLockRequested; - private _alphaTest; - private _resizeLoadingUI; - private _loadingDiv; - private _loadingTextDiv; - private _loadingDivBackgroundColor; - private _drawCalls; - private _glVersion; - private _glRenderer; - private _glVendor; - private _videoTextureSupported; - private _renderingQueueLaunched; - private _activeRenderLoops; - private fpsRange; - private previousFramesDuration; - private fps; - private deltaTime; - private _depthCullingState; - private _alphaState; - private _alphaMode; - private _loadedTexturesCache; - _activeTexturesCache: BaseTexture[]; - private _currentEffect; - private _compiledEffects; - private _vertexAttribArrays; - private _cachedViewport; - private _cachedVertexBuffers; - private _cachedIndexBuffer; - private _cachedEffectForVertexBuffers; - private _currentRenderTarget; - private _uintIndicesCurrentlySet; - private _workingCanvas; - private _workingContext; - /** - * @constructor - * @param {HTMLCanvasElement} canvas - the canvas to be used for rendering - * @param {boolean} [antialias] - enable antialias - * @param options - further options to be sent to the getContext function - */ - constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: any); - private _prepareWorkingCanvas(); - getGlInfo(): { - vendor: string; - renderer: string; - version: string; - }; - getAspectRatio(camera: Camera): number; - getRenderWidth(): number; - getRenderHeight(): number; - getRenderingCanvas(): HTMLCanvasElement; - getRenderingCanvasClientRect(): ClientRect; - setHardwareScalingLevel(level: number): void; - getHardwareScalingLevel(): number; - getLoadedTexturesCache(): WebGLTexture[]; - getCaps(): EngineCapabilities; - drawCalls: number; - resetDrawCalls(): void; - setDepthFunctionToGreater(): void; - setDepthFunctionToGreaterOrEqual(): void; - setDepthFunctionToLess(): void; - setDepthFunctionToLessOrEqual(): void; - /** - * stop executing a render loop function and remove it from the execution array - * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed. - */ - stopRenderLoop(renderFunction?: () => void): void; - _renderLoop(): void; - /** - * Register and execute a render loop. The engine can have more than one render function. - * @param {Function} renderFunction - the function to continuesly execute starting the next render loop. - * @example - * engine.runRenderLoop(function () { - * scene.render() - * }) - */ - runRenderLoop(renderFunction: () => void): void; - /** - * Toggle full screen mode. - * @param {boolean} requestPointerLock - should a pointer lock be requested from the user - */ - switchFullscreen(requestPointerLock: boolean): void; - clear(color: any, backBuffer: boolean, depthStencil: boolean): void; - /** - * Set the WebGL's viewport - * @param {BABYLON.Viewport} viewport - the viewport element to be used. - * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used. - * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used. - */ - setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void; - setDirectViewport(x: number, y: number, width: number, height: number): void; - beginFrame(): void; - endFrame(): void; - /** - * resize the view according to the canvas' size. - * @example - * window.addEventListener("resize", function () { - * engine.resize(); - * }); - */ - resize(): void; - /** - * force a specific size of the canvas - * @param {number} width - the new canvas' width - * @param {number} height - the new canvas' height - */ - setSize(width: number, height: number): void; - bindFramebuffer(texture: WebGLTexture): void; - unBindFramebuffer(texture: WebGLTexture): void; - flushFramebuffer(): void; - restoreDefaultFramebuffer(): void; - private _resetVertexBufferBinding(); - createVertexBuffer(vertices: number[]): WebGLBuffer; - createDynamicVertexBuffer(capacity: number): WebGLBuffer; - updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: any, offset?: number): void; - private _resetIndexBufferBinding(); - createIndexBuffer(indices: number[]): WebGLBuffer; - bindBuffers(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void; - bindMultiBuffers(vertexBuffers: VertexBuffer[], indexBuffer: WebGLBuffer, effect: Effect): void; - _releaseBuffer(buffer: WebGLBuffer): boolean; - createInstancesBuffer(capacity: number): WebGLBuffer; - deleteInstancesBuffer(buffer: WebGLBuffer): void; - updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[]): void; - unBindInstancesBuffer(instancesBuffer: WebGLBuffer, offsetLocations: number[]): void; - applyStates(): void; - draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void; - drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void; - _releaseEffect(effect: Effect): void; - createEffect(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], defines: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect; - createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect; - createShaderProgram(vertexCode: string, fragmentCode: string, defines: string): WebGLProgram; - getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[]; - getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[]; - enableEffect(effect: Effect): void; - setArray(uniform: WebGLUniformLocation, array: number[]): void; - setArray2(uniform: WebGLUniformLocation, array: number[]): void; - setArray3(uniform: WebGLUniformLocation, array: number[]): void; - setArray4(uniform: WebGLUniformLocation, array: number[]): void; - setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void; - setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void; - setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void; - setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void; - setFloat(uniform: WebGLUniformLocation, value: number): void; - setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void; - setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void; - setBool(uniform: WebGLUniformLocation, bool: number): void; - setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - setColor3(uniform: WebGLUniformLocation, color3: Color3): void; - setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void; - setState(culling: boolean, zOffset?: number, force?: boolean): void; - setDepthBuffer(enable: boolean): void; - getDepthWrite(): boolean; - setDepthWrite(enable: boolean): void; - setColorWrite(enable: boolean): void; - setAlphaMode(mode: number): void; - getAlphaMode(): number; - setAlphaTesting(enable: boolean): void; - getAlphaTesting(): boolean; - wipeCaches(): void; - setSamplingMode(texture: WebGLTexture, samplingMode: number): void; - createTexture(url: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any): WebGLTexture; - updateRawTexture(texture: WebGLTexture, data: ArrayBufferView, format: number, invertY: boolean, compression?: string): void; - createRawTexture(data: ArrayBufferView, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture; - createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number, forceExponantOfTwo?: boolean): WebGLTexture; - updateTextureSamplingMode(samplingMode: number, texture: WebGLTexture): void; - updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean): void; - updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void; - createRenderTargetTexture(size: any, options: any): WebGLTexture; - createCubeTexture(rootUrl: string, scene: Scene, extensions: string[], noMipmap?: boolean): WebGLTexture; - _releaseTexture(texture: WebGLTexture): void; - bindSamplers(effect: Effect): void; - _bindTexture(channel: number, texture: WebGLTexture): void; - setTextureFromPostProcess(channel: number, postProcess: PostProcess): void; - setTexture(channel: number, texture: BaseTexture): void; - _setAnisotropicLevel(key: number, texture: BaseTexture): void; - readPixels(x: number, y: number, width: number, height: number): Uint8Array; - dispose(): void; - displayLoadingUI(): void; - loadingUIText: string; - loadingUIBackgroundColor: string; - hideLoadingUI(): void; - getFps(): number; - getDeltaTime(): number; - private _measureFps(); - static isSupported(): boolean; - } -} - -interface Window { - mozIndexedDB(func: any): any; - webkitIndexedDB(func: any): any; - IDBTransaction(func: any): any; - webkitIDBTransaction(func: any): any; - msIDBTransaction(func: any): any; - IDBKeyRange(func: any): any; - webkitIDBKeyRange(func: any): any; - msIDBKeyRange(func: any): any; - webkitURL: HTMLURL; - webkitRequestAnimationFrame(func: any): any; - mozRequestAnimationFrame(func: any): any; - oRequestAnimationFrame(func: any): any; - WebGLRenderingContext: WebGLRenderingContext; - MSGesture: MSGesture; - CANNON: any; - SIMD: any; - AudioContext: AudioContext; - webkitAudioContext: AudioContext; -} -interface HTMLURL { - createObjectURL(param1: any, param2?: any): any; -} -interface Document { - exitFullscreen(): void; - webkitCancelFullScreen(): void; - mozCancelFullScreen(): void; - msCancelFullScreen(): void; - mozFullScreen: boolean; - msIsFullScreen: boolean; - fullscreen: boolean; - mozPointerLockElement: HTMLElement; - msPointerLockElement: HTMLElement; - webkitPointerLockElement: HTMLElement; -} -interface HTMLCanvasElement { - requestPointerLock(): void; - msRequestPointerLock(): void; - mozRequestPointerLock(): void; - webkitRequestPointerLock(): void; -} -interface CanvasRenderingContext2D { - imageSmoothingEnabled: boolean; - mozImageSmoothingEnabled: boolean; - oImageSmoothingEnabled: boolean; - webkitImageSmoothingEnabled: boolean; -} -interface WebGLTexture { - isReady: boolean; - isCube: boolean; - url: string; - noMipmap: boolean; - samplingMode: number; - references: number; - generateMipMaps: boolean; - _size: number; - _baseWidth: number; - _baseHeight: number; - _width: number; - _height: number; - _workingCanvas: HTMLCanvasElement; - _workingContext: CanvasRenderingContext2D; - _framebuffer: WebGLFramebuffer; - _depthBuffer: WebGLRenderbuffer; - _cachedCoordinatesMode: number; - _cachedWrapU: number; - _cachedWrapV: number; - _isDisabled: boolean; -} -interface WebGLBuffer { - references: number; - capacity: number; - is32Bits: boolean; -} -interface MouseEvent { - mozMovementX: number; - mozMovementY: number; - webkitMovementX: number; - webkitMovementY: number; - msMovementX: number; - msMovementY: number; -} -interface MSStyleCSSProperties { - webkitTransform: string; - webkitTransition: string; -} -interface Navigator { - getVRDevices: () => any; - mozGetVRDevices: (any: any) => any; - isCocoonJS: boolean; -} -interface Screen { - orientation: string; - mozOrientation: string; -} - -declare module BABYLON { - /** - * Node is the basic class for all scene objects (Mesh, Light Camera). - */ - class Node { - parent: Node; - name: string; - id: string; - uniqueId: number; - state: string; - animations: Animation[]; - onReady: (node: Node) => void; - private _childrenFlag; - private _isEnabled; - private _isReady; - _currentRenderId: number; - private _parentRenderId; - _waitingParentId: string; - private _scene; - _cache: any; - /** - * @constructor - * @param {string} name - the name and id to be given to this node - * @param {BABYLON.Scene} the scene this node will be added to - */ - constructor(name: string, scene: Scene); - getScene(): Scene; - getEngine(): Engine; - getWorldMatrix(): Matrix; - _initCache(): void; - updateCache(force?: boolean): void; - _updateCache(ignoreParentClass?: boolean): void; - _isSynchronized(): boolean; - _markSyncedWithParent(): void; - isSynchronizedWithParent(): boolean; - isSynchronized(updateCache?: boolean): boolean; - hasNewParent(update?: boolean): boolean; - /** - * Is this node ready to be used/rendered - * @return {boolean} is it ready - */ - isReady(): boolean; - /** - * Is this node enabled. - * If the node has a parent and is enabled, the parent will be inspected as well. - * @return {boolean} whether this node (and its parent) is enabled. - * @see setEnabled - */ - isEnabled(): boolean; - /** - * Set the enabled state of this node. - * @param {boolean} value - the new enabled state - * @see isEnabled - */ - setEnabled(value: boolean): void; - /** - * Is this node a descendant of the given node. - * The function will iterate up the hierarchy until the ancestor was found or no more parents defined. - * @param {BABYLON.Node} ancestor - The parent node to inspect - * @see parent - */ - isDescendantOf(ancestor: Node): boolean; - _getDescendants(list: Node[], results: Node[]): void; - /** - * Will return all nodes that have this node as parent. - * @return {BABYLON.Node[]} all children nodes of all types. - */ - getDescendants(): Node[]; - _setReady(state: boolean): void; - } -} - -declare module BABYLON { - interface IDisposable { - dispose(): void; - } - /** - * Represents a scene to be rendered by the engine. - * @see http://doc.babylonjs.com/page.php?p=21911 - */ - class Scene { - private static _FOGMODE_NONE; - private static _FOGMODE_EXP; - private static _FOGMODE_EXP2; - private static _FOGMODE_LINEAR; - static MinDeltaTime: number; - static MaxDeltaTime: number; - static FOGMODE_NONE: number; - static FOGMODE_EXP: number; - static FOGMODE_EXP2: number; - static FOGMODE_LINEAR: number; - autoClear: boolean; - clearColor: any; - ambientColor: Color3; - /** - * A function to be executed before rendering this scene - * @type {Function} - */ - beforeRender: () => void; - /** - * A function to be executed after rendering this scene - * @type {Function} - */ - afterRender: () => void; - /** - * A function to be executed when this scene is disposed. - * @type {Function} - */ - onDispose: () => void; - beforeCameraRender: (camera: Camera) => void; - afterCameraRender: (camera: Camera) => void; - forceWireframe: boolean; - forcePointsCloud: boolean; - forceShowBoundingBoxes: boolean; - clipPlane: Plane; - animationsEnabled: boolean; - private _onPointerMove; - private _onPointerDown; - private _onPointerUp; - onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void; - onPointerUp: (evt: PointerEvent, pickInfo: PickingInfo) => void; - cameraToUseForPointers: Camera; - private _pointerX; - private _pointerY; - private _meshUnderPointer; - private _onKeyDown; - private _onKeyUp; - /** - * is fog enabled on this scene. - * @type {boolean} - */ - fogEnabled: boolean; - fogMode: number; - fogColor: Color3; - fogDensity: number; - fogStart: number; - fogEnd: number; - /** - * is shadow enabled on this scene. - * @type {boolean} - */ - shadowsEnabled: boolean; - /** - * is light enabled on this scene. - * @type {boolean} - */ - lightsEnabled: boolean; - /** - * All of the lights added to this scene. - * @see BABYLON.Light - * @type {BABYLON.Light[]} - */ - lights: Light[]; - onNewLightAdded: (newLight?: Light, positionInArray?: number, scene?: Scene) => void; - onLightRemoved: (removedLight?: Light) => void; - /** - * All of the cameras added to this scene. - * @see BABYLON.Camera - * @type {BABYLON.Camera[]} - */ - cameras: Camera[]; - onNewCameraAdded: (newCamera?: Camera, positionInArray?: number, scene?: Scene) => void; - onCameraRemoved: (removedCamera?: Camera) => void; - activeCameras: Camera[]; - activeCamera: Camera; - /** - * All of the (abstract) meshes added to this scene. - * @see BABYLON.AbstractMesh - * @type {BABYLON.AbstractMesh[]} - */ - meshes: AbstractMesh[]; - onNewMeshAdded: (newMesh?: AbstractMesh, positionInArray?: number, scene?: Scene) => void; - onMeshRemoved: (removedMesh?: AbstractMesh) => void; - private _geometries; - onGeometryAdded: (newGeometry?: Geometry) => void; - onGeometryRemoved: (removedGeometry?: Geometry) => void; - materials: Material[]; - multiMaterials: MultiMaterial[]; - defaultMaterial: StandardMaterial; - texturesEnabled: boolean; - textures: BaseTexture[]; - particlesEnabled: boolean; - particleSystems: ParticleSystem[]; - spritesEnabled: boolean; - spriteManagers: SpriteManager[]; - layers: Layer[]; - skeletonsEnabled: boolean; - skeletons: Skeleton[]; - lensFlaresEnabled: boolean; - lensFlareSystems: LensFlareSystem[]; - collisionsEnabled: boolean; - private _workerCollisions; - collisionCoordinator: ICollisionCoordinator; - gravity: Vector3; - postProcessesEnabled: boolean; - postProcessManager: PostProcessManager; - postProcessRenderPipelineManager: PostProcessRenderPipelineManager; - renderTargetsEnabled: boolean; - dumpNextRenderTargets: boolean; - customRenderTargets: RenderTargetTexture[]; - useDelayedTextureLoading: boolean; - importedMeshesFiles: String[]; - database: any; - /** - * This scene's action manager - * @type {BABYLON.ActionManager} - */ - actionManager: ActionManager; - _actionManagers: ActionManager[]; - private _meshesForIntersections; - proceduralTexturesEnabled: boolean; - _proceduralTextures: ProceduralTexture[]; - mainSoundTrack: SoundTrack; - soundTracks: SoundTrack[]; - private _audioEnabled; - private _headphone; - simplificationQueue: SimplificationQueue; - private _engine; - private _totalVertices; - _activeIndices: number; - _activeParticles: number; - private _lastFrameDuration; - private _evaluateActiveMeshesDuration; - private _renderTargetsDuration; - _particlesDuration: number; - private _renderDuration; - _spritesDuration: number; - private _animationRatio; - private _animationStartDate; - _cachedMaterial: Material; - private _renderId; - private _executeWhenReadyTimeoutId; - _toBeDisposed: SmartArray; - private _onReadyCallbacks; - private _pendingData; - private _onBeforeRenderCallbacks; - private _onAfterRenderCallbacks; - private _activeMeshes; - private _processedMaterials; - private _renderTargets; - _activeParticleSystems: SmartArray; - private _activeSkeletons; - private _softwareSkinnedMeshes; - _activeBones: number; - private _renderingManager; - private _physicsEngine; - _activeAnimatables: Animatable[]; - private _transformMatrix; - private _pickWithRayInverseMatrix; - private _edgesRenderers; - private _boundingBoxRenderer; - private _outlineRenderer; - private _viewMatrix; - private _projectionMatrix; - private _frustumPlanes; - private _selectionOctree; - private _pointerOverMesh; - private _debugLayer; - private _depthRenderer; - private _uniqueIdCounter; - /** - * @constructor - * @param {BABYLON.Engine} engine - the engine to be used to render this scene. - */ - constructor(engine: Engine); - debugLayer: DebugLayer; - workerCollisions: boolean; - SelectionOctree: Octree; - /** - * The mesh that is currently under the pointer. - * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none. - */ - meshUnderPointer: AbstractMesh; - /** - * Current on-screen X position of the pointer - * @return {number} X position of the pointer - */ - pointerX: number; - /** - * Current on-screen Y position of the pointer - * @return {number} Y position of the pointer - */ - pointerY: number; - getCachedMaterial(): Material; - getBoundingBoxRenderer(): BoundingBoxRenderer; - getOutlineRenderer(): OutlineRenderer; - getEngine(): Engine; - getTotalVertices(): number; - getActiveIndices(): number; - getActiveParticles(): number; - getActiveBones(): number; - getLastFrameDuration(): number; - getEvaluateActiveMeshesDuration(): number; - getActiveMeshes(): SmartArray; - getRenderTargetsDuration(): number; - getRenderDuration(): number; - getParticlesDuration(): number; - getSpritesDuration(): number; - getAnimationRatio(): number; - getRenderId(): number; - incrementRenderId(): void; - private _updatePointerPosition(evt); - attachControl(): void; - detachControl(): void; - isReady(): boolean; - resetCachedMaterial(): void; - registerBeforeRender(func: () => void): void; - unregisterBeforeRender(func: () => void): void; - registerAfterRender(func: () => void): void; - unregisterAfterRender(func: () => void): void; - _addPendingData(data: any): void; - _removePendingData(data: any): void; - getWaitingItemsCount(): number; - /** - * Registers a function to be executed when the scene is ready. - * @param {Function} func - the function to be executed. - */ - executeWhenReady(func: () => void): void; - _checkIsReady(): void; - /** - * Will start the animation sequence of a given target - * @param target - the target - * @param {number} from - from which frame should animation start - * @param {number} to - till which frame should animation run. - * @param {boolean} [loop] - should the animation loop - * @param {number} [speedRatio] - the speed in which to run the animation - * @param {Function} [onAnimationEnd] function to be executed when the animation ended. - * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params. - * @return {BABYLON.Animatable} the animatable object created for this animation - * @see BABYLON.Animatable - * @see http://doc.babylonjs.com/page.php?p=22081 - */ - beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable; - beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable; - getAnimatableByTarget(target: any): Animatable; - /** - * Will stop the animation of the given target - * @param target - the target - * @see beginAnimation - */ - stopAnimation(target: any): void; - private _animate(); - getViewMatrix(): Matrix; - getProjectionMatrix(): Matrix; - getTransformMatrix(): Matrix; - setTransformMatrix(view: Matrix, projection: Matrix): void; - addMesh(newMesh: AbstractMesh): void; - removeMesh(toRemove: AbstractMesh): number; - removeLight(toRemove: Light): number; - removeCamera(toRemove: Camera): number; - addLight(newLight: Light): void; - addCamera(newCamera: Camera): void; - /** - * sets the active camera of the scene using its ID - * @param {string} id - the camera's ID - * @return {BABYLON.Camera|null} the new active camera or null if none found. - * @see activeCamera - */ - setActiveCameraByID(id: string): Camera; - /** - * sets the active camera of the scene using its name - * @param {string} name - the camera's name - * @return {BABYLON.Camera|null} the new active camera or null if none found. - * @see activeCamera - */ - setActiveCameraByName(name: string): Camera; - /** - * get a material using its id - * @param {string} the material's ID - * @return {BABYLON.Material|null} the material or null if none found. - */ - getMaterialByID(id: string): Material; - /** - * get a material using its name - * @param {string} the material's name - * @return {BABYLON.Material|null} the material or null if none found. - */ - getMaterialByName(name: string): Material; - getLensFlareSystemByName(name: string): LensFlareSystem; - getCameraByID(id: string): Camera; - getCameraByUniqueID(uniqueId: number): Camera; - /** - * get a camera using its name - * @param {string} the camera's name - * @return {BABYLON.Camera|null} the camera or null if none found. - */ - getCameraByName(name: string): Camera; - /** - * get a light node using its name - * @param {string} the light's name - * @return {BABYLON.Light|null} the light or null if none found. - */ - getLightByName(name: string): Light; - /** - * get a light node using its ID - * @param {string} the light's id - * @return {BABYLON.Light|null} the light or null if none found. - */ - getLightByID(id: string): Light; - /** - * get a light node using its scene-generated unique ID - * @param {number} the light's unique id - * @return {BABYLON.Light|null} the light or null if none found. - */ - getLightByUniqueID(uniqueId: number): Light; - /** - * get a geometry using its ID - * @param {string} the geometry's id - * @return {BABYLON.Geometry|null} the geometry or null if none found. - */ - getGeometryByID(id: string): Geometry; - /** - * add a new geometry to this scene. - * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene. - * @param {boolean} [force] - force addition, even if a geometry with this ID already exists - * @return {boolean} was the geometry added or not - */ - pushGeometry(geometry: Geometry, force?: boolean): boolean; - /** - * Removes an existing geometry - * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene. - * @return {boolean} was the geometry removed or not - */ - removeGeometry(geometry: Geometry): boolean; - getGeometries(): Geometry[]; - /** - * Get the first added mesh found of a given ID - * @param {string} id - the id to search for - * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. - */ - getMeshByID(id: string): AbstractMesh; - /** - * Get a mesh with its auto-generated unique id - * @param {number} uniqueId - the unique id to search for - * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. - */ - getMeshByUniqueID(uniqueId: number): AbstractMesh; - /** - * Get a the last added mesh found of a given ID - * @param {string} id - the id to search for - * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. - */ - getLastMeshByID(id: string): AbstractMesh; - /** - * Get a the last added node (Mesh, Camera, Light) found of a given ID - * @param {string} id - the id to search for - * @return {BABYLON.Node|null} the node found or null if not found at all. - */ - getLastEntryByID(id: string): Node; - getNodeByID(id: string): Node; - getNodeByName(name: string): Node; - getMeshByName(name: string): AbstractMesh; - getSoundByName(name: string): Sound; - getLastSkeletonByID(id: string): Skeleton; - getSkeletonById(id: string): Skeleton; - getSkeletonByName(name: string): Skeleton; - isActiveMesh(mesh: Mesh): boolean; - private _evaluateSubMesh(subMesh, mesh); - private _evaluateActiveMeshes(); - private _activeMesh(mesh); - updateTransformMatrix(force?: boolean): void; - private _renderForCamera(camera); - private _processSubCameras(camera); - private _checkIntersections(); - render(): void; - private _updateAudioParameters(); - audioEnabled: boolean; - private _disableAudio(); - private _enableAudio(); - headphone: boolean; - private _switchAudioModeForHeadphones(); - private _switchAudioModeForNormalSpeakers(); - enableDepthRenderer(): DepthRenderer; - disableDepthRenderer(): void; - dispose(): void; - disposeSounds(): void; - getWorldExtends(): { - min: Vector3; - max: Vector3; - }; - createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree; - createPickingRay(x: number, y: number, world: Matrix, camera: Camera): Ray; - private _internalPick(rayFunction, predicate, fastCheck?); - pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo; - pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo; - setPointerOverMesh(mesh: AbstractMesh): void; - getPointerOverMesh(): AbstractMesh; - getPhysicsEngine(): PhysicsEngine; - enablePhysics(gravity: Vector3, plugin?: IPhysicsEnginePlugin): boolean; - disablePhysicsEngine(): void; - isPhysicsEnabled(): boolean; - setGravity(gravity: Vector3): void; - createCompoundImpostor(parts: any, options: PhysicsBodyCreationOptions): any; - deleteCompoundImpostor(compound: any): void; - createDefaultCameraOrLight(): void; - private _getByTags(list, tagsQuery, forEach?); - getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[]; - getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[]; - getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[]; - getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[]; - } -} - -declare module BABYLON { - class Action { - triggerOptions: any; - trigger: number; - _actionManager: ActionManager; - private _nextActiveAction; - private _child; - private _condition; - private _triggerParameter; - constructor(triggerOptions: any, condition?: Condition); - _prepare(): void; - getTriggerParameter(): any; - _executeCurrent(evt: ActionEvent): void; - execute(evt: ActionEvent): void; - then(action: Action): Action; - _getProperty(propertyPath: string): string; - _getEffectiveTarget(target: any, propertyPath: string): any; - } -} - -declare module BABYLON { - /** - * ActionEvent is the event beint sent when an action is triggered. - */ - class ActionEvent { - source: AbstractMesh; - pointerX: number; - pointerY: number; - meshUnderPointer: AbstractMesh; - sourceEvent: any; - additionalData: any; - /** - * @constructor - * @param source The mesh that triggered the action. - * @param pointerX the X mouse cursor position at the time of the event - * @param pointerY the Y mouse cursor position at the time of the event - * @param meshUnderPointer The mesh that is currently pointed at (can be null) - * @param sourceEvent the original (browser) event that triggered the ActionEvent - */ - constructor(source: AbstractMesh, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any, additionalData?: any); - /** - * Helper function to auto-create an ActionEvent from a source mesh. - * @param source the source mesh that triggered the event - * @param evt {Event} The original (browser) event - */ - static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent; - /** - * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew - * @param scene the scene where the event occurred - * @param evt {Event} The original (browser) event - */ - static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent; - } - /** - * Action Manager manages all events to be triggered on a given mesh or the global scene. - * A single scene can have many Action Managers to handle predefined actions on specific meshes. - */ - class ActionManager { - private static _NothingTrigger; - private static _OnPickTrigger; - private static _OnLeftPickTrigger; - private static _OnRightPickTrigger; - private static _OnCenterPickTrigger; - private static _OnPointerOverTrigger; - private static _OnPointerOutTrigger; - private static _OnEveryFrameTrigger; - private static _OnIntersectionEnterTrigger; - private static _OnIntersectionExitTrigger; - private static _OnKeyDownTrigger; - private static _OnKeyUpTrigger; - private static _OnPickUpTrigger; - static NothingTrigger: number; - static OnPickTrigger: number; - static OnLeftPickTrigger: number; - static OnRightPickTrigger: number; - static OnCenterPickTrigger: number; - static OnPointerOverTrigger: number; - static OnPointerOutTrigger: number; - static OnEveryFrameTrigger: number; - static OnIntersectionEnterTrigger: number; - static OnIntersectionExitTrigger: number; - static OnKeyDownTrigger: number; - static OnKeyUpTrigger: number; - static OnPickUpTrigger: number; - actions: Action[]; - private _scene; - constructor(scene: Scene); - dispose(): void; - getScene(): Scene; - /** - * Does this action manager handles actions of any of the given triggers - * @param {number[]} triggers - the triggers to be tested - * @return {boolean} whether one (or more) of the triggers is handeled - */ - hasSpecificTriggers(triggers: number[]): boolean; - /** - * Does this action manager handles actions of a given trigger - * @param {number} trigger - the trigger to be tested - * @return {boolean} whether the trigger is handeled - */ - hasSpecificTrigger(trigger: number): boolean; - /** - * Does this action manager has pointer triggers - * @return {boolean} whether or not it has pointer triggers - */ - hasPointerTriggers: boolean; - /** - * Does this action manager has pick triggers - * @return {boolean} whether or not it has pick triggers - */ - hasPickTriggers: boolean; - /** - * Registers an action to this action manager - * @param {BABYLON.Action} action - the action to be registered - * @return {BABYLON.Action} the action amended (prepared) after registration - */ - registerAction(action: Action): Action; - /** - * Process a specific trigger - * @param {number} trigger - the trigger to process - * @param evt {BABYLON.ActionEvent} the event details to be processed - */ - processTrigger(trigger: number, evt: ActionEvent): void; - _getEffectiveTarget(target: any, propertyPath: string): any; - _getProperty(propertyPath: string): string; - } -} - -declare module BABYLON { - class Condition { - _actionManager: ActionManager; - _evaluationId: number; - _currentResult: boolean; - constructor(actionManager: ActionManager); - isValid(): boolean; - _getProperty(propertyPath: string): string; - _getEffectiveTarget(target: any, propertyPath: string): any; - } - class ValueCondition extends Condition { - propertyPath: string; - value: any; - operator: number; - private static _IsEqual; - private static _IsDifferent; - private static _IsGreater; - private static _IsLesser; - static IsEqual: number; - static IsDifferent: number; - static IsGreater: number; - static IsLesser: number; - _actionManager: ActionManager; - private _target; - private _property; - constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number); - isValid(): boolean; - } - class PredicateCondition extends Condition { - predicate: () => boolean; - _actionManager: ActionManager; - constructor(actionManager: ActionManager, predicate: () => boolean); - isValid(): boolean; - } - class StateCondition extends Condition { - value: string; - _actionManager: ActionManager; - private _target; - constructor(actionManager: ActionManager, target: any, value: string); - isValid(): boolean; - } -} - -declare module BABYLON { - class SwitchBooleanAction extends Action { - propertyPath: string; - private _target; - private _property; - constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition); - _prepare(): void; - execute(): void; - } - class SetStateAction extends Action { - value: string; - private _target; - constructor(triggerOptions: any, target: any, value: string, condition?: Condition); - execute(): void; - } - class SetValueAction extends Action { - propertyPath: string; - value: any; - private _target; - private _property; - constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition); - _prepare(): void; - execute(): void; - } - class IncrementValueAction extends Action { - propertyPath: string; - value: any; - private _target; - private _property; - constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition); - _prepare(): void; - execute(): void; - } - class PlayAnimationAction extends Action { - from: number; - to: number; - loop: boolean; - private _target; - constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition); - _prepare(): void; - execute(): void; - } - class StopAnimationAction extends Action { - private _target; - constructor(triggerOptions: any, target: any, condition?: Condition); - _prepare(): void; - execute(): void; - } - class DoNothingAction extends Action { - constructor(triggerOptions?: any, condition?: Condition); - execute(): void; - } - class CombineAction extends Action { - children: Action[]; - constructor(triggerOptions: any, children: Action[], condition?: Condition); - _prepare(): void; - execute(evt: ActionEvent): void; - } - class ExecuteCodeAction extends Action { - func: (evt: ActionEvent) => void; - constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition); - execute(evt: ActionEvent): void; - } - class SetParentAction extends Action { - private _parent; - private _target; - constructor(triggerOptions: any, target: any, parent: any, condition?: Condition); - _prepare(): void; - execute(): void; - } - class PlaySoundAction extends Action { - private _sound; - constructor(triggerOptions: any, sound: Sound, condition?: Condition); - _prepare(): void; - execute(): void; - } - class StopSoundAction extends Action { - private _sound; - constructor(triggerOptions: any, sound: Sound, condition?: Condition); - _prepare(): void; - execute(): void; - } -} - -declare module BABYLON { - class InterpolateValueAction extends Action { - propertyPath: string; - value: any; - duration: number; - stopOtherAnimations: boolean; - private _target; - private _property; - constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean); - _prepare(): void; - execute(): void; - } -} - -declare module BABYLON { - class Animatable { - target: any; - fromFrame: number; - toFrame: number; - loopAnimation: boolean; - speedRatio: number; - onAnimationEnd: any; - private _localDelayOffset; - private _pausedDelay; - private _animations; - private _paused; - private _scene; - animationStarted: boolean; - constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: any, animations?: any); - appendAnimations(target: any, animations: Animation[]): void; - getAnimationByTargetProperty(property: string): Animation; - reset(): void; - pause(): void; - restart(): void; - stop(): void; - _animate(delay: number): boolean; - } -} - -declare module BABYLON { - class Animation { - name: string; - targetProperty: string; - framePerSecond: number; - dataType: number; - loopMode: number; - private _keys; - private _offsetsCache; - private _highLimitsCache; - private _stopped; - _target: any; - private _easingFunction; - targetPropertyPath: string[]; - currentFrame: number; - allowMatricesInterpolation: boolean; - static CreateAndStartAnimation(name: string, mesh: AbstractMesh, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction): Animatable; - constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number); - reset(): void; - isStopped(): boolean; - getKeys(): any[]; - getEasingFunction(): IEasingFunction; - setEasingFunction(easingFunction: EasingFunction): void; - floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number; - quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion; - vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3; - vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2; - color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3; - matrixInterpolateFunction(startValue: Matrix, endValue: Matrix, gradient: number): Matrix; - clone(): Animation; - setKeys(values: Array): void; - private _getKeyValue(value); - private _interpolate(currentFrame, repeatCount, loopMode, offsetValue?, highLimitValue?); - animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number): boolean; - private static _ANIMATIONTYPE_FLOAT; - private static _ANIMATIONTYPE_VECTOR3; - private static _ANIMATIONTYPE_QUATERNION; - private static _ANIMATIONTYPE_MATRIX; - private static _ANIMATIONTYPE_COLOR3; - private static _ANIMATIONTYPE_VECTOR2; - private static _ANIMATIONLOOPMODE_RELATIVE; - private static _ANIMATIONLOOPMODE_CYCLE; - private static _ANIMATIONLOOPMODE_CONSTANT; - static ANIMATIONTYPE_FLOAT: number; - static ANIMATIONTYPE_VECTOR3: number; - static ANIMATIONTYPE_VECTOR2: number; - static ANIMATIONTYPE_QUATERNION: number; - static ANIMATIONTYPE_MATRIX: number; - static ANIMATIONTYPE_COLOR3: number; - static ANIMATIONLOOPMODE_RELATIVE: number; - static ANIMATIONLOOPMODE_CYCLE: number; - static ANIMATIONLOOPMODE_CONSTANT: number; - } -} - -declare module BABYLON { - interface IEasingFunction { - ease(gradient: number): number; - } - class EasingFunction implements IEasingFunction { - private static _EASINGMODE_EASEIN; - private static _EASINGMODE_EASEOUT; - private static _EASINGMODE_EASEINOUT; - static EASINGMODE_EASEIN: number; - static EASINGMODE_EASEOUT: number; - static EASINGMODE_EASEINOUT: number; - private _easingMode; - setEasingMode(easingMode: number): void; - getEasingMode(): number; - easeInCore(gradient: number): number; - ease(gradient: number): number; - } - class CircleEase extends EasingFunction implements IEasingFunction { - easeInCore(gradient: number): number; - } - class BackEase extends EasingFunction implements IEasingFunction { - amplitude: number; - constructor(amplitude?: number); - easeInCore(gradient: number): number; - } - class BounceEase extends EasingFunction implements IEasingFunction { - bounces: number; - bounciness: number; - constructor(bounces?: number, bounciness?: number); - easeInCore(gradient: number): number; - } - class CubicEase extends EasingFunction implements IEasingFunction { - easeInCore(gradient: number): number; - } - class ElasticEase extends EasingFunction implements IEasingFunction { - oscillations: number; - springiness: number; - constructor(oscillations?: number, springiness?: number); - easeInCore(gradient: number): number; - } - class ExponentialEase extends EasingFunction implements IEasingFunction { - exponent: number; - constructor(exponent?: number); - easeInCore(gradient: number): number; - } - class PowerEase extends EasingFunction implements IEasingFunction { - power: number; - constructor(power?: number); - easeInCore(gradient: number): number; - } - class QuadraticEase extends EasingFunction implements IEasingFunction { - easeInCore(gradient: number): number; - } - class QuarticEase extends EasingFunction implements IEasingFunction { - easeInCore(gradient: number): number; - } - class QuinticEase extends EasingFunction implements IEasingFunction { - easeInCore(gradient: number): number; - } - class SineEase extends EasingFunction implements IEasingFunction { - easeInCore(gradient: number): number; - } - class BezierCurveEase extends EasingFunction implements IEasingFunction { - x1: number; - y1: number; - x2: number; - y2: number; - constructor(x1?: number, y1?: number, x2?: number, y2?: number); - easeInCore(gradient: number): number; - } -} - -declare module BABYLON { - class Analyser { - SMOOTHING: number; - FFT_SIZE: number; - BARGRAPHAMPLITUDE: number; - DEBUGCANVASPOS: { - x: number; - y: number; - }; - DEBUGCANVASSIZE: { - width: number; - height: number; - }; - private _byteFreqs; - private _byteTime; - private _floatFreqs; - private _webAudioAnalyser; - private _debugCanvas; - private _debugCanvasContext; - private _scene; - private _registerFunc; - private _audioEngine; - constructor(scene: Scene); - getFrequencyBinCount(): number; - getByteFrequencyData(): Uint8Array; - getByteTimeDomainData(): Uint8Array; - getFloatFrequencyData(): Uint8Array; - drawDebugCanvas(): void; - stopDebugCanvas(): void; - connectAudioNodes(inputAudioNode: AudioNode, outputAudioNode: AudioNode): void; - dispose(): void; - } -} - -declare module BABYLON { - class AudioEngine { - private _audioContext; - private _audioContextInitialized; - canUseWebAudio: boolean; - masterGain: GainNode; - private _connectedAnalyser; - WarnedWebAudioUnsupported: boolean; - audioContext: AudioContext; - constructor(); - private _initializeAudioContext(); - dispose(): void; - getGlobalVolume(): number; - setGlobalVolume(newVolume: number): void; - connectToAnalyser(analyser: Analyser): void; - } -} - -declare module BABYLON { - class Sound { - name: string; - autoplay: boolean; - loop: boolean; - useCustomAttenuation: boolean; - soundTrackId: number; - spatialSound: boolean; - refDistance: number; - rolloffFactor: number; - maxDistance: number; - distanceModel: string; - private _panningModel; - onended: () => any; - private _playbackRate; - private _startTime; - private _startOffset; - private _position; - private _localDirection; - private _volume; - private _isLoaded; - private _isReadyToPlay; - isPlaying: boolean; - isPaused: boolean; - private _isDirectional; - private _readyToPlayCallback; - private _audioBuffer; - private _soundSource; - private _soundPanner; - private _soundGain; - private _inputAudioNode; - private _ouputAudioNode; - private _coneInnerAngle; - private _coneOuterAngle; - private _coneOuterGain; - private _scene; - private _connectedMesh; - private _customAttenuationFunction; - private _registerFunc; - private _isOutputConnected; - /** - * Create a sound and attach it to a scene - * @param name Name of your sound - * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer - * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played - * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel - */ - constructor(name: string, urlOrArrayBuffer: any, scene: Scene, readyToPlayCallback?: () => void, options?: any); - dispose(): void; - private _soundLoaded(audioData); - setAudioBuffer(audioBuffer: AudioBuffer): void; - updateOptions(options: any): void; - private _createSpatialParameters(); - private _updateSpatialParameters(); - switchPanningModelToHRTF(): void; - switchPanningModelToEqualPower(): void; - private _switchPanningModel(); - connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void; - /** - * Transform this sound into a directional source - * @param coneInnerAngle Size of the inner cone in degree - * @param coneOuterAngle Size of the outer cone in degree - * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0) - */ - setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void; - setPosition(newPosition: Vector3): void; - setLocalDirectionToMesh(newLocalDirection: Vector3): void; - private _updateDirection(); - updateDistanceFromListener(): void; - setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void; - /** - * Play the sound - * @param time (optional) Start the sound after X seconds. Start immediately (0) by default. - */ - play(time?: number): void; - private _onended(); - /** - * Stop the sound - * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default. - */ - stop(time?: number): void; - pause(): void; - setVolume(newVolume: number, time?: number): void; - setPlaybackRate(newPlaybackRate: number): void; - getVolume(): number; - attachToMesh(meshToConnectTo: AbstractMesh): void; - private _onRegisterAfterWorldMatrixUpdate(connectedMesh); - } -} - -declare module BABYLON { - class SoundTrack { - private _audioEngine; - private _outputAudioNode; - private _inputAudioNode; - private _trackConvolver; - private _scene; - id: number; - soundCollection: Array; - private _isMainTrack; - private _connectedAnalyser; - constructor(scene: Scene, options?: any); - dispose(): void; - AddSound(sound: Sound): void; - RemoveSound(sound: Sound): void; - setVolume(newVolume: number): void; - switchPanningModelToHRTF(): void; - switchPanningModelToEqualPower(): void; - connectToAnalyser(analyser: Analyser): void; - } -} - -declare module BABYLON { - class Bone extends Node { - name: string; - children: Bone[]; - animations: Animation[]; - private _skeleton; - private _matrix; - private _baseMatrix; - private _worldTransform; - private _absoluteTransform; - private _invertedAbsoluteTransform; - private _parent; - constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix); - getParent(): Bone; - getLocalMatrix(): Matrix; - getBaseMatrix(): Matrix; - getWorldMatrix(): Matrix; - getInvertedAbsoluteTransform(): Matrix; - getAbsoluteMatrix(): Matrix; - updateMatrix(matrix: Matrix): void; - private _updateDifferenceMatrix(); - markAsDirty(): void; - } -} - -declare module BABYLON { - class Skeleton { - name: string; - id: string; - bones: Bone[]; - private _scene; - private _isDirty; - private _transformMatrices; - private _animatables; - private _identity; - constructor(name: string, id: string, scene: Scene); - getTransformMatrices(): Float32Array; - getScene(): Scene; - _markAsDirty(): void; - prepare(): void; - getAnimatables(): IAnimatable[]; - clone(name: string, id: string): Skeleton; - } -} - -declare module BABYLON { - class ArcRotateCamera extends TargetCamera { - alpha: number; - beta: number; - radius: number; - target: any; - inertialAlphaOffset: number; - inertialBetaOffset: number; - inertialRadiusOffset: number; - lowerAlphaLimit: any; - upperAlphaLimit: any; - lowerBetaLimit: number; - upperBetaLimit: number; - lowerRadiusLimit: any; - upperRadiusLimit: any; - angularSensibilityX: number; - angularSensibilityY: number; - wheelPrecision: number; - pinchPrecision: number; - panningSensibility: number; - inertialPanningX: number; - inertialPanningY: number; - keysUp: number[]; - keysDown: number[]; - keysLeft: number[]; - keysRight: number[]; - zoomOnFactor: number; - targetScreenOffset: Vector2; - pinchInwards: boolean; - allowUpsideDown: boolean; - private _keys; - _viewMatrix: Matrix; - private _attachedElement; - private _onContextMenu; - private _onPointerDown; - private _onPointerUp; - private _onPointerMove; - private _wheel; - private _onMouseMove; - private _onKeyDown; - private _onKeyUp; - private _onLostFocus; - _reset: () => void; - private _onGestureStart; - private _onGesture; - private _MSGestureHandler; - private _localDirection; - private _transformedDirection; - private _isRightClick; - private _isCtrlPushed; - onCollide: (collidedMesh: AbstractMesh) => void; - checkCollisions: boolean; - collisionRadius: Vector3; - private _collider; - private _previousPosition; - private _collisionVelocity; - private _newPosition; - private _previousAlpha; - private _previousBeta; - private _previousRadius; - private _collisionTriggered; - angularSensibility: number; - constructor(name: string, alpha: number, beta: number, radius: number, target: any, scene: Scene); - _getTargetPosition(): Vector3; - _initCache(): void; - _updateCache(ignoreParentClass?: boolean): void; - _isSynchronizedViewMatrix(): boolean; - attachControl(element: HTMLElement, noPreventDefault?: boolean, useCtrlForPanning?: boolean): void; - detachControl(element: HTMLElement): void; - _checkInputs(): void; - private _checkLimits(); - setPosition(position: Vector3): void; - setTarget(target: Vector3): void; - _getViewMatrix(): Matrix; - private _onCollisionPositionChange; - zoomOn(meshes?: AbstractMesh[], doNotUpdateMaxZ?: boolean): void; - focusOn(meshesOrMinMaxVectorAndDistance: any, doNotUpdateMaxZ?: boolean): void; - /** - * @override - * Override Camera.createRigCamera - */ - createRigCamera(name: string, cameraIndex: number): Camera; - /** - * @override - * Override Camera._updateRigCameras - */ - _updateRigCameras(): void; - } -} - -declare module BABYLON { - class VRCameraMetrics { - hResolution: number; - vResolution: number; - hScreenSize: number; - vScreenSize: number; - vScreenCenter: number; - eyeToScreenDistance: number; - lensSeparationDistance: number; - interpupillaryDistance: number; - distortionK: number[]; - chromaAbCorrection: number[]; - postProcessScaleFactor: number; - lensCenterOffset: number; - compensateDistorsion: boolean; - aspectRatio: number; - aspectRatioFov: number; - leftHMatrix: Matrix; - rightHMatrix: Matrix; - leftPreViewMatrix: Matrix; - rightPreViewMatrix: Matrix; - static GetDefault(): VRCameraMetrics; - } - class Camera extends Node { - position: Vector3; - private static _PERSPECTIVE_CAMERA; - private static _ORTHOGRAPHIC_CAMERA; - private static _FOVMODE_VERTICAL_FIXED; - private static _FOVMODE_HORIZONTAL_FIXED; - private static _RIG_MODE_NONE; - private static _RIG_MODE_STEREOSCOPIC_ANAGLYPH; - private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL; - private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED; - private static _RIG_MODE_STEREOSCOPIC_OVERUNDER; - private static _RIG_MODE_VR; - static PERSPECTIVE_CAMERA: number; - static ORTHOGRAPHIC_CAMERA: number; - static FOVMODE_VERTICAL_FIXED: number; - static FOVMODE_HORIZONTAL_FIXED: number; - static RIG_MODE_NONE: number; - static RIG_MODE_STEREOSCOPIC_ANAGLYPH: number; - static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number; - static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number; - static RIG_MODE_STEREOSCOPIC_OVERUNDER: number; - static RIG_MODE_VR: number; - upVector: Vector3; - orthoLeft: any; - orthoRight: any; - orthoBottom: any; - orthoTop: any; - fov: number; - minZ: number; - maxZ: number; - inertia: number; - mode: number; - isIntermediate: boolean; - viewport: Viewport; - layerMask: number; - fovMode: number; - cameraRigMode: number; - _cameraRigParams: any; - _rigCameras: Camera[]; - private _computedViewMatrix; - _projectionMatrix: Matrix; - private _worldMatrix; - _postProcesses: PostProcess[]; - _postProcessesTakenIndices: any[]; - _activeMeshes: SmartArray; - private _globalPosition; - constructor(name: string, position: Vector3, scene: Scene); - globalPosition: Vector3; - getActiveMeshes(): SmartArray; - isActiveMesh(mesh: Mesh): boolean; - _initCache(): void; - _updateCache(ignoreParentClass?: boolean): void; - _updateFromScene(): void; - _isSynchronized(): boolean; - _isSynchronizedViewMatrix(): boolean; - _isSynchronizedProjectionMatrix(): boolean; - attachControl(element: HTMLElement): void; - detachControl(element: HTMLElement): void; - _update(): void; - _checkInputs(): void; - attachPostProcess(postProcess: PostProcess, insertAt?: number): number; - detachPostProcess(postProcess: PostProcess, atIndices?: any): number[]; - getWorldMatrix(): Matrix; - _getViewMatrix(): Matrix; - getViewMatrix(force?: boolean): Matrix; - _computeViewMatrix(force?: boolean): Matrix; - getProjectionMatrix(force?: boolean): Matrix; - dispose(): void; - setCameraRigMode(mode: number, rigParams: any): void; - private _getVRProjectionMatrix(); - setCameraRigParameter(name: string, value: any): void; - /** - * May needs to be overridden by children so sub has required properties to be copied - */ - createRigCamera(name: string, cameraIndex: number): Camera; - /** - * May needs to be overridden by children - */ - _updateRigCameras(): void; - } -} - -declare module BABYLON { - class DeviceOrientationCamera extends FreeCamera { - private _offsetX; - private _offsetY; - private _orientationGamma; - private _orientationBeta; - private _initialOrientationGamma; - private _initialOrientationBeta; - private _attachedCanvas; - private _orientationChanged; - angularSensibility: number; - moveSensibility: number; - constructor(name: string, position: Vector3, scene: Scene); - attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void; - detachControl(canvas: HTMLCanvasElement): void; - _checkInputs(): void; - } -} - -declare module BABYLON { - class FollowCamera extends TargetCamera { - radius: number; - rotationOffset: number; - heightOffset: number; - cameraAcceleration: number; - maxCameraSpeed: number; - target: AbstractMesh; - constructor(name: string, position: Vector3, scene: Scene); - private getRadians(degrees); - private follow(cameraTarget); - _checkInputs(): void; - } - class ArcFollowCamera extends TargetCamera { - alpha: number; - beta: number; - radius: number; - target: AbstractMesh; - private _cartesianCoordinates; - constructor(name: string, alpha: number, beta: number, radius: number, target: AbstractMesh, scene: Scene); - private follow(); - _checkInputs(): void; - } -} - -declare module BABYLON { - class FreeCamera extends TargetCamera { - ellipsoid: Vector3; - keysUp: number[]; - keysDown: number[]; - keysLeft: number[]; - keysRight: number[]; - checkCollisions: boolean; - applyGravity: boolean; - angularSensibility: number; - onCollide: (collidedMesh: AbstractMesh) => void; - private _keys; - private _collider; - private _needMoveForGravity; - private _oldPosition; - private _diffPosition; - private _newPosition; - private _attachedElement; - private _localDirection; - private _transformedDirection; - private _onMouseDown; - private _onMouseUp; - private _onMouseOut; - private _onMouseMove; - private _onKeyDown; - private _onKeyUp; - _onLostFocus: (e: FocusEvent) => any; - _waitingLockedTargetId: string; - constructor(name: string, position: Vector3, scene: Scene); - attachControl(element: HTMLElement, noPreventDefault?: boolean): void; - detachControl(element: HTMLElement): void; - _collideWithWorld(velocity: Vector3): void; - private _onCollisionPositionChange; - _checkInputs(): void; - _decideIfNeedsToMove(): boolean; - _updatePosition(): void; - } -} - -declare module BABYLON { - class GamepadCamera extends FreeCamera { - private _gamepad; - private _gamepads; - angularSensibility: number; - moveSensibility: number; - constructor(name: string, position: Vector3, scene: Scene); - private _onNewGameConnected(gamepad); - _checkInputs(): void; - dispose(): void; - } -} - -declare module BABYLON { - class AnaglyphFreeCamera extends FreeCamera { - constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene); - } - class AnaglyphArcRotateCamera extends ArcRotateCamera { - constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, scene: Scene); - } - class AnaglyphGamepadCamera extends GamepadCamera { - constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene); - } - class StereoscopicFreeCamera extends FreeCamera { - constructor(name: string, position: Vector3, interaxialDistance: number, isSideBySide: boolean, scene: Scene); - } - class StereoscopicArcRotateCamera extends ArcRotateCamera { - constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, isSideBySide: boolean, scene: Scene); - } - class StereoscopicGamepadCamera extends GamepadCamera { - constructor(name: string, position: Vector3, interaxialDistance: number, isSideBySide: boolean, scene: Scene); - } -} - -declare module BABYLON { - class TargetCamera extends Camera { - cameraDirection: Vector3; - cameraRotation: Vector2; - rotation: Vector3; - speed: number; - noRotationConstraint: boolean; - lockedTarget: any; - _currentTarget: Vector3; - _viewMatrix: Matrix; - _camMatrix: Matrix; - _cameraTransformMatrix: Matrix; - _cameraRotationMatrix: Matrix; - private _rigCamTransformMatrix; - _referencePoint: Vector3; - _transformedReferencePoint: Vector3; - _lookAtTemp: Matrix; - _tempMatrix: Matrix; - _reset: () => void; - _waitingLockedTargetId: string; - constructor(name: string, position: Vector3, scene: Scene); - getFrontPosition(distance: number): Vector3; - _getLockedTargetPosition(): Vector3; - _initCache(): void; - _updateCache(ignoreParentClass?: boolean): void; - _isSynchronizedViewMatrix(): boolean; - _computeLocalCameraSpeed(): number; - setTarget(target: Vector3): void; - getTarget(): Vector3; - _decideIfNeedsToMove(): boolean; - _updatePosition(): void; - _checkInputs(): void; - _getViewMatrix(): Matrix; - _getVRViewMatrix(): Matrix; - /** - * @override - * Override Camera.createRigCamera - */ - createRigCamera(name: string, cameraIndex: number): Camera; - /** - * @override - * Override Camera._updateRigCameras - */ - _updateRigCameras(): void; - private _getRigCamPosition(halfSpace, result); - } -} - -declare module BABYLON { - class TouchCamera extends FreeCamera { - private _offsetX; - private _offsetY; - private _pointerCount; - private _pointerPressed; - private _attachedCanvas; - private _onPointerDown; - private _onPointerUp; - private _onPointerMove; - angularSensibility: number; - moveSensibility: number; - constructor(name: string, position: Vector3, scene: Scene); - attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void; - detachControl(canvas: HTMLCanvasElement): void; - _checkInputs(): void; - } -} - -declare module BABYLON { - class VirtualJoysticksCamera extends FreeCamera { - private _leftjoystick; - private _rightjoystick; - constructor(name: string, position: Vector3, scene: Scene); - getLeftJoystick(): VirtualJoystick; - getRightJoystick(): VirtualJoystick; - _checkInputs(): void; - dispose(): void; - } -} - -declare module BABYLON { - class Collider { - radius: Vector3; - retry: number; - velocity: Vector3; - basePoint: Vector3; - epsilon: number; - collisionFound: boolean; - velocityWorldLength: number; - basePointWorld: Vector3; - velocityWorld: Vector3; - normalizedVelocity: Vector3; - initialVelocity: Vector3; - initialPosition: Vector3; - nearestDistance: number; - intersectionPoint: Vector3; - collidedMesh: AbstractMesh; - private _collisionPoint; - private _planeIntersectionPoint; - private _tempVector; - private _tempVector2; - private _tempVector3; - private _tempVector4; - private _edge; - private _baseToVertex; - private _destinationPoint; - private _slidePlaneNormal; - private _displacementVector; - _initialize(source: Vector3, dir: Vector3, e: number): void; - _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean; - _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean; - _testTriangle(faceIndex: number, trianglePlaneArray: Array, p1: Vector3, p2: Vector3, p3: Vector3, hasMaterial: boolean): void; - _collide(trianglePlaneArray: Array, pts: Vector3[], indices: number[], indexStart: number, indexEnd: number, decal: number, hasMaterial: boolean): void; - _getResponse(pos: Vector3, vel: Vector3): void; - } -} - -declare module BABYLON { - var CollisionWorker: string; - interface ICollisionCoordinator { - getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; - init(scene: Scene): void; - destroy(): void; - onMeshAdded(mesh: AbstractMesh): any; - onMeshUpdated(mesh: AbstractMesh): any; - onMeshRemoved(mesh: AbstractMesh): any; - onGeometryAdded(geometry: Geometry): any; - onGeometryUpdated(geometry: Geometry): any; - onGeometryDeleted(geometry: Geometry): any; - } - interface SerializedMesh { - id: string; - name: string; - uniqueId: number; - geometryId: string; - sphereCenter: Array; - sphereRadius: number; - boxMinimum: Array; - boxMaximum: Array; - worldMatrixFromCache: any; - subMeshes: Array; - checkCollisions: boolean; - } - interface SerializedSubMesh { - position: number; - verticesStart: number; - verticesCount: number; - indexStart: number; - indexCount: number; - hasMaterial: boolean; - sphereCenter: Array; - sphereRadius: number; - boxMinimum: Array; - boxMaximum: Array; - } - interface SerializedGeometry { - id: string; - positions: Float32Array; - indices: Int32Array; - normals: Float32Array; - } - interface BabylonMessage { - taskType: WorkerTaskType; - payload: InitPayload | CollidePayload | UpdatePayload; - } - interface SerializedColliderToWorker { - position: Array; - velocity: Array; - radius: Array; - } - enum WorkerTaskType { - INIT = 0, - UPDATE = 1, - COLLIDE = 2, - } - interface WorkerReply { - error: WorkerReplyType; - taskType: WorkerTaskType; - payload?: any; - } - interface CollisionReplyPayload { - newPosition: Array; - collisionId: number; - collidedMeshUniqueId: number; - } - interface InitPayload { - } - interface CollidePayload { - collisionId: number; - collider: SerializedColliderToWorker; - maximumRetry: number; - excludedMeshUniqueId?: number; - } - interface UpdatePayload { - updatedMeshes: { - [n: number]: SerializedMesh; - }; - updatedGeometries: { - [s: string]: SerializedGeometry; - }; - removedMeshes: Array; - removedGeometries: Array; - } - enum WorkerReplyType { - SUCCESS = 0, - UNKNOWN_ERROR = 1, - } - class CollisionCoordinatorWorker implements ICollisionCoordinator { - private _scene; - private _scaledPosition; - private _scaledVelocity; - private _collisionsCallbackArray; - private _init; - private _runningUpdated; - private _runningCollisionTask; - private _worker; - private _addUpdateMeshesList; - private _addUpdateGeometriesList; - private _toRemoveMeshesArray; - private _toRemoveGeometryArray; - constructor(); - static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh; - static SerializeGeometry: (geometry: Geometry) => SerializedGeometry; - getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; - init(scene: Scene): void; - destroy(): void; - onMeshAdded(mesh: AbstractMesh): void; - onMeshUpdated: (mesh: AbstractMesh) => void; - onMeshRemoved(mesh: AbstractMesh): void; - onGeometryAdded(geometry: Geometry): void; - onGeometryUpdated: (geometry: Geometry) => void; - onGeometryDeleted(geometry: Geometry): void; - private _afterRender; - private _onMessageFromWorker; - } - class CollisionCoordinatorLegacy implements ICollisionCoordinator { - private _scene; - private _scaledPosition; - private _scaledVelocity; - private _finalPosition; - getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; - init(scene: Scene): void; - destroy(): void; - onMeshAdded(mesh: AbstractMesh): void; - onMeshUpdated(mesh: AbstractMesh): void; - onMeshRemoved(mesh: AbstractMesh): void; - onGeometryAdded(geometry: Geometry): void; - onGeometryUpdated(geometry: Geometry): void; - onGeometryDeleted(geometry: Geometry): void; - private _collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh?); - } -} - -declare module BABYLON { - var WorkerIncluded: boolean; - class CollisionCache { - private _meshes; - private _geometries; - getMeshes(): { - [n: number]: SerializedMesh; - }; - getGeometries(): { - [s: number]: SerializedGeometry; - }; - getMesh(id: any): SerializedMesh; - addMesh(mesh: SerializedMesh): void; - getGeometry(id: string): SerializedGeometry; - addGeometry(geometry: SerializedGeometry): void; - } - class CollideWorker { - collider: Collider; - private _collisionCache; - private finalPosition; - private collisionsScalingMatrix; - private collisionTranformationMatrix; - constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3); - collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void; - private checkCollision(mesh); - private processCollisionsForSubMeshes(transformMatrix, mesh); - private collideForSubMesh(subMesh, transformMatrix, meshGeometry); - private checkSubmeshCollision(subMesh); - } - interface ICollisionDetector { - onInit(payload: InitPayload): void; - onUpdate(payload: UpdatePayload): void; - onCollision(payload: CollidePayload): void; - } - class CollisionDetectorTransferable implements ICollisionDetector { - private _collisionCache; - onInit(payload: InitPayload): void; - onUpdate(payload: UpdatePayload): void; - onCollision(payload: CollidePayload): void; - } -} - -declare module BABYLON { - class IntersectionInfo { - bu: number; - bv: number; - distance: number; - faceId: number; - subMeshId: number; - constructor(bu: number, bv: number, distance: number); - } - class PickingInfo { - hit: boolean; - distance: number; - pickedPoint: Vector3; - pickedMesh: AbstractMesh; - bu: number; - bv: number; - faceId: number; - subMeshId: number; - getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3; - getTextureCoordinates(): Vector2; - } -} - -declare module BABYLON { - class BoundingBox { - minimum: Vector3; - maximum: Vector3; - vectors: Vector3[]; - center: Vector3; - extendSize: Vector3; - directions: Vector3[]; - vectorsWorld: Vector3[]; - minimumWorld: Vector3; - maximumWorld: Vector3; - private _worldMatrix; - constructor(minimum: Vector3, maximum: Vector3); - getWorldMatrix(): Matrix; - _update(world: Matrix): void; - isInFrustum(frustumPlanes: Plane[]): boolean; - isCompletelyInFrustum(frustumPlanes: Plane[]): boolean; - intersectsPoint(point: Vector3): boolean; - intersectsSphere(sphere: BoundingSphere): boolean; - intersectsMinMax(min: Vector3, max: Vector3): boolean; - static Intersects(box0: BoundingBox, box1: BoundingBox): boolean; - static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean; - static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean; - static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean; - } -} - -declare module BABYLON { - class BoundingInfo { - minimum: Vector3; - maximum: Vector3; - boundingBox: BoundingBox; - boundingSphere: BoundingSphere; - constructor(minimum: Vector3, maximum: Vector3); - _update(world: Matrix): void; - isInFrustum(frustumPlanes: Plane[]): boolean; - isCompletelyInFrustum(frustumPlanes: Plane[]): boolean; - _checkCollision(collider: Collider): boolean; - intersectsPoint(point: Vector3): boolean; - intersects(boundingInfo: BoundingInfo, precise: boolean): boolean; - } -} - -declare module BABYLON { - class BoundingSphere { - minimum: Vector3; - maximum: Vector3; - center: Vector3; - radius: number; - centerWorld: Vector3; - radiusWorld: number; - private _tempRadiusVector; - constructor(minimum: Vector3, maximum: Vector3); - _update(world: Matrix): void; - isInFrustum(frustumPlanes: Plane[]): boolean; - intersectsPoint(point: Vector3): boolean; - static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean; - } -} - -declare module BABYLON { - class DebugLayer { - private _scene; - private _camera; - private _transformationMatrix; - private _enabled; - private _labelsEnabled; - private _displayStatistics; - private _displayTree; - private _displayLogs; - private _globalDiv; - private _statsDiv; - private _statsSubsetDiv; - private _optionsDiv; - private _optionsSubsetDiv; - private _logDiv; - private _logSubsetDiv; - private _treeDiv; - private _treeSubsetDiv; - private _drawingCanvas; - private _drawingContext; - private _syncPositions; - private _syncData; - private _syncUI; - private _onCanvasClick; - private _clickPosition; - private _ratio; - private _identityMatrix; - private _showUI; - private _needToRefreshMeshesTree; - shouldDisplayLabel: (node: Node) => boolean; - shouldDisplayAxis: (mesh: Mesh) => boolean; - axisRatio: number; - accentColor: string; - customStatsFunction: () => string; - constructor(scene: Scene); - private _refreshMeshesTreeContent(); - private _renderSingleAxis(zero, unit, unitText, label, color); - private _renderAxis(projectedPosition, mesh, globalViewport); - private _renderLabel(text, projectedPosition, labelOffset, onClick, getFillStyle); - private _isClickInsideRect(x, y, width, height); - isVisible(): boolean; - hide(): void; - show(showUI?: boolean, camera?: Camera): void; - private _clearLabels(); - private _generateheader(root, text); - private _generateTexBox(root, title, color); - private _generateAdvancedCheckBox(root, leftTitle, rightTitle, initialState, task, tag?); - private _generateCheckBox(root, title, initialState, task, tag?); - private _generateButton(root, title, task, tag?); - private _generateRadio(root, title, name, initialState, task, tag?); - private _generateDOMelements(); - private _displayStats(); - } -} - -declare module BABYLON { - class Layer { - name: string; - texture: Texture; - isBackground: boolean; - color: Color4; - onDispose: () => void; - private _scene; - private _vertexDeclaration; - private _vertexStrideSize; - private _vertexBuffer; - private _indexBuffer; - private _effect; - constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4); - render(): void; - dispose(): void; - } -} - -declare module BABYLON { - class LensFlare { - size: number; - position: number; - color: Color3; - texture: Texture; - private _system; - constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem); - dispose: () => void; - } -} - -declare module BABYLON { - class LensFlareSystem { - name: string; - lensFlares: LensFlare[]; - borderLimit: number; - meshesSelectionPredicate: (mesh: Mesh) => boolean; - layerMask: number; - private _scene; - private _emitter; - private _vertexDeclaration; - private _vertexStrideSize; - private _vertexBuffer; - private _indexBuffer; - private _effect; - private _positionX; - private _positionY; - private _isEnabled; - constructor(name: string, emitter: any, scene: Scene); - isEnabled: boolean; - getScene(): Scene; - getEmitter(): any; - setEmitter(newEmitter: any): void; - getEmitterPosition(): Vector3; - computeEffectivePosition(globalViewport: Viewport): boolean; - _isVisible(): boolean; - render(): boolean; - dispose(): void; - } -} - -declare module BABYLON { - class DirectionalLight extends Light implements IShadowLight { - direction: Vector3; - position: Vector3; - private _transformedDirection; - transformedPosition: Vector3; - private _worldMatrix; - shadowOrthoScale: number; - constructor(name: string, direction: Vector3, scene: Scene); - getAbsolutePosition(): Vector3; - setDirectionToTarget(target: Vector3): Vector3; - setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; - supportsVSM(): boolean; - needRefreshPerFrame(): boolean; - computeTransformedPosition(): boolean; - transferToEffect(effect: Effect, directionUniformName: string): void; - _getWorldMatrix(): Matrix; - } -} - -declare module BABYLON { - class HemisphericLight extends Light { - direction: Vector3; - groundColor: Color3; - private _worldMatrix; - constructor(name: string, direction: Vector3, scene: Scene); - setDirectionToTarget(target: Vector3): Vector3; - getShadowGenerator(): ShadowGenerator; - transferToEffect(effect: Effect, directionUniformName: string, groundColorUniformName: string): void; - _getWorldMatrix(): Matrix; - } -} - -declare module BABYLON { - interface IShadowLight { - position: Vector3; - direction: Vector3; - transformedPosition: Vector3; - name: string; - computeTransformedPosition(): boolean; - getScene(): Scene; - setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; - supportsVSM(): boolean; - needRefreshPerFrame(): boolean; - _shadowGenerator: ShadowGenerator; - } - class Light extends Node { - diffuse: Color3; - specular: Color3; - intensity: number; - range: number; - includeOnlyWithLayerMask: number; - includedOnlyMeshes: AbstractMesh[]; - excludedMeshes: AbstractMesh[]; - excludeWithLayerMask: number; - _shadowGenerator: ShadowGenerator; - private _parentedWorldMatrix; - _excludedMeshesIds: string[]; - _includedOnlyMeshesIds: string[]; - constructor(name: string, scene: Scene); - getShadowGenerator(): ShadowGenerator; - getAbsolutePosition(): Vector3; - transferToEffect(effect: Effect, uniformName0?: string, uniformName1?: string): void; - _getWorldMatrix(): Matrix; - canAffectMesh(mesh: AbstractMesh): boolean; - getWorldMatrix(): Matrix; - dispose(): void; - } -} - -declare module BABYLON { - class PointLight extends Light { - position: Vector3; - private _worldMatrix; - private _transformedPosition; - constructor(name: string, position: Vector3, scene: Scene); - getAbsolutePosition(): Vector3; - transferToEffect(effect: Effect, positionUniformName: string): void; - getShadowGenerator(): ShadowGenerator; - _getWorldMatrix(): Matrix; - } -} - -declare module BABYLON { - class SpotLight extends Light implements IShadowLight { - position: Vector3; - direction: Vector3; - angle: number; - exponent: number; - transformedPosition: Vector3; - private _transformedDirection; - private _worldMatrix; - constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene); - getAbsolutePosition(): Vector3; - setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; - supportsVSM(): boolean; - needRefreshPerFrame(): boolean; - setDirectionToTarget(target: Vector3): Vector3; - computeTransformedPosition(): boolean; - transferToEffect(effect: Effect, positionUniformName: string, directionUniformName: string): void; - _getWorldMatrix(): Matrix; - } -} - -declare module BABYLON { - interface ISceneLoaderPlugin { - extensions: string; - importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean; - load: (scene: Scene, data: string, rootUrl: string) => boolean; - } - class SceneLoader { - private static _ForceFullSceneLoadingForIncremental; - private static _ShowLoadingScreen; - static ForceFullSceneLoadingForIncremental: boolean; - static ShowLoadingScreen: boolean; - private static _registeredPlugins; - private static _getPluginForFilename(sceneFilename); - static RegisterPlugin(plugin: ISceneLoaderPlugin): void; - static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene, e: any) => void): void; - /** - * Load a scene - * @param rootUrl a string that defines the root url for scene and resources - * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene - * @param engine is the instance of BABYLON.Engine to use to create the scene - */ - static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void; - /** - * Append a scene - * @param rootUrl a string that defines the root url for scene and resources - * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene - * @param scene is the instance of BABYLON.Scene to append to - */ - static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void; - } -} - -declare module BABYLON { - class EffectFallbacks { - private _defines; - private _currentRank; - private _maxRank; - addFallback(rank: number, define: string): void; - isMoreFallbacks: boolean; - reduce(currentDefines: string): string; - } - class Effect { - name: any; - defines: string; - onCompiled: (effect: Effect) => void; - onError: (effect: Effect, errors: string) => void; - onBind: (effect: Effect) => void; - private _engine; - private _uniformsNames; - private _samplers; - private _isReady; - private _compilationError; - private _attributesNames; - private _attributes; - private _uniforms; - _key: string; - private _program; - private _valueCache; - constructor(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], engine: any, defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void); - isReady(): boolean; - getProgram(): WebGLProgram; - getAttributesNames(): string[]; - getAttributeLocation(index: number): number; - getAttributeLocationByName(name: string): number; - getAttributesCount(): number; - getUniformIndex(uniformName: string): number; - getUniform(uniformName: string): WebGLUniformLocation; - getSamplers(): string[]; - getCompilationError(): string; - _loadVertexShader(vertex: any, callback: (data: any) => void): void; - _loadFragmentShader(fragment: any, callback: (data: any) => void): void; - private _prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks?); - _bindTexture(channel: string, texture: WebGLTexture): void; - setTexture(channel: string, texture: BaseTexture): void; - setTextureFromPostProcess(channel: string, postProcess: PostProcess): void; - _cacheFloat2(uniformName: string, x: number, y: number): void; - _cacheFloat3(uniformName: string, x: number, y: number, z: number): void; - _cacheFloat4(uniformName: string, x: number, y: number, z: number, w: number): void; - setArray(uniformName: string, array: number[]): Effect; - setArray2(uniformName: string, array: number[]): Effect; - setArray3(uniformName: string, array: number[]): Effect; - setArray4(uniformName: string, array: number[]): Effect; - setMatrices(uniformName: string, matrices: Float32Array): Effect; - setMatrix(uniformName: string, matrix: Matrix): Effect; - setMatrix3x3(uniformName: string, matrix: Float32Array): Effect; - setMatrix2x2(uniformname: string, matrix: Float32Array): Effect; - setFloat(uniformName: string, value: number): Effect; - setBool(uniformName: string, bool: boolean): Effect; - setVector2(uniformName: string, vector2: Vector2): Effect; - setFloat2(uniformName: string, x: number, y: number): Effect; - setVector3(uniformName: string, vector3: Vector3): Effect; - setFloat3(uniformName: string, x: number, y: number, z: number): Effect; - setVector4(uniformName: string, vector4: Vector4): Effect; - setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect; - setColor3(uniformName: string, color3: Color3): Effect; - setColor4(uniformName: string, color3: Color3, alpha: number): Effect; - static ShadersStore: {}; - } -} - -declare module BABYLON { - class Material { - name: string; - private static _TriangleFillMode; - private static _WireFrameFillMode; - private static _PointFillMode; - static TriangleFillMode: number; - static WireFrameFillMode: number; - static PointFillMode: number; - id: string; - checkReadyOnEveryCall: boolean; - checkReadyOnlyOnce: boolean; - state: string; - alpha: number; - backFaceCulling: boolean; - onCompiled: (effect: Effect) => void; - onError: (effect: Effect, errors: string) => void; - onDispose: () => void; - onBind: (material: Material, mesh: Mesh) => void; - getRenderTargetTextures: () => SmartArray; - alphaMode: number; - disableDepthWrite: boolean; - _effect: Effect; - _wasPreviouslyReady: boolean; - private _scene; - private _fillMode; - private _cachedDepthWriteState; - pointSize: number; - zOffset: number; - wireframe: boolean; - pointsCloud: boolean; - fillMode: number; - constructor(name: string, scene: Scene, doNotAdd?: boolean); - isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; - getEffect(): Effect; - getScene(): Scene; - needAlphaBlending(): boolean; - needAlphaTesting(): boolean; - getAlphaTestTexture(): BaseTexture; - trackCreation(onCompiled: (effect: Effect) => void, onError: (effect: Effect, errors: string) => void): void; - _preBind(): void; - bind(world: Matrix, mesh?: Mesh): void; - bindOnlyWorldMatrix(world: Matrix): void; - unbind(): void; - clone(name: string): Material; - dispose(forceDisposeEffect?: boolean): void; - } -} - -declare module BABYLON { - class MultiMaterial extends Material { - subMaterials: Material[]; - constructor(name: string, scene: Scene); - getSubMaterial(index: any): Material; - isReady(mesh?: AbstractMesh): boolean; - clone(name: string): MultiMaterial; - } -} - -declare module BABYLON { - class ShaderMaterial extends Material { - private _shaderPath; - private _options; - private _textures; - private _floats; - private _floatsArrays; - private _colors3; - private _colors4; - private _vectors2; - private _vectors3; - private _vectors4; - private _matrices; - private _matrices3x3; - private _matrices2x2; - private _cachedWorldViewMatrix; - private _renderId; - constructor(name: string, scene: Scene, shaderPath: any, options: any); - needAlphaBlending(): boolean; - needAlphaTesting(): boolean; - private _checkUniform(uniformName); - setTexture(name: string, texture: Texture): ShaderMaterial; - setFloat(name: string, value: number): ShaderMaterial; - setFloats(name: string, value: number[]): ShaderMaterial; - setColor3(name: string, value: Color3): ShaderMaterial; - setColor4(name: string, value: Color4): ShaderMaterial; - setVector2(name: string, value: Vector2): ShaderMaterial; - setVector3(name: string, value: Vector3): ShaderMaterial; - setVector4(name: string, value: Vector4): ShaderMaterial; - setMatrix(name: string, value: Matrix): ShaderMaterial; - setMatrix3x3(name: string, value: Float32Array): ShaderMaterial; - setMatrix2x2(name: string, value: Float32Array): ShaderMaterial; - isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; - bindOnlyWorldMatrix(world: Matrix): void; - bind(world: Matrix, mesh?: Mesh): void; - clone(name: string): ShaderMaterial; - dispose(forceDisposeEffect?: boolean): void; - } -} - -declare module BABYLON { - class FresnelParameters { - isEnabled: boolean; - leftColor: Color3; - rightColor: Color3; - bias: number; - power: number; - } - class StandardMaterial extends Material { - diffuseTexture: BaseTexture; - ambientTexture: BaseTexture; - opacityTexture: BaseTexture; - reflectionTexture: BaseTexture; - emissiveTexture: BaseTexture; - specularTexture: BaseTexture; - bumpTexture: BaseTexture; - ambientColor: Color3; - diffuseColor: Color3; - specularColor: Color3; - specularPower: number; - emissiveColor: Color3; - useAlphaFromDiffuseTexture: boolean; - useEmissiveAsIllumination: boolean; - useReflectionFresnelFromSpecular: boolean; - useSpecularOverAlpha: boolean; - fogEnabled: boolean; - roughness: number; - diffuseFresnelParameters: FresnelParameters; - opacityFresnelParameters: FresnelParameters; - reflectionFresnelParameters: FresnelParameters; - emissiveFresnelParameters: FresnelParameters; - useGlossinessFromSpecularMapAlpha: boolean; - private _renderTargets; - private _worldViewProjectionMatrix; - private _globalAmbientColor; - private _scaledDiffuse; - private _scaledSpecular; - private _renderId; - private _defines; - private _cachedDefines; - constructor(name: string, scene: Scene); - needAlphaBlending(): boolean; - needAlphaTesting(): boolean; - private _shouldUseAlphaFromDiffuseTexture(); - getAlphaTestTexture(): BaseTexture; - isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; - unbind(): void; - bindOnlyWorldMatrix(world: Matrix): void; - bind(world: Matrix, mesh?: Mesh): void; - getAnimatables(): IAnimatable[]; - dispose(forceDisposeEffect?: boolean): void; - clone(name: string): StandardMaterial; - static DiffuseTextureEnabled: boolean; - static AmbientTextureEnabled: boolean; - static OpacityTextureEnabled: boolean; - static ReflectionTextureEnabled: boolean; - static EmissiveTextureEnabled: boolean; - static SpecularTextureEnabled: boolean; - static BumpTextureEnabled: boolean; - static FresnelEnabled: boolean; - } -} - -declare module BABYLON { - class Color3 { - r: number; - g: number; - b: number; - constructor(r?: number, g?: number, b?: number); - toString(): string; - toArray(array: number[], index?: number): Color3; - toColor4(alpha?: number): Color4; - asArray(): number[]; - toLuminance(): number; - multiply(otherColor: Color3): Color3; - multiplyToRef(otherColor: Color3, result: Color3): Color3; - equals(otherColor: Color3): boolean; - equalsFloats(r: number, g: number, b: number): boolean; - scale(scale: number): Color3; - scaleToRef(scale: number, result: Color3): Color3; - add(otherColor: Color3): Color3; - addToRef(otherColor: Color3, result: Color3): Color3; - subtract(otherColor: Color3): Color3; - subtractToRef(otherColor: Color3, result: Color3): Color3; - clone(): Color3; - copyFrom(source: Color3): Color3; - copyFromFloats(r: number, g: number, b: number): Color3; - toHexString(): string; - static FromHexString(hex: string): Color3; - static FromArray(array: number[], offset?: number): Color3; - static FromInts(r: number, g: number, b: number): Color3; - static Lerp(start: Color3, end: Color3, amount: number): Color3; - static Red(): Color3; - static Green(): Color3; - static Blue(): Color3; - static Black(): Color3; - static White(): Color3; - static Purple(): Color3; - static Magenta(): Color3; - static Yellow(): Color3; - static Gray(): Color3; - } - class Color4 { - r: number; - g: number; - b: number; - a: number; - constructor(r: number, g: number, b: number, a: number); - addInPlace(right: any): Color4; - asArray(): number[]; - toArray(array: number[], index?: number): Color4; - add(right: Color4): Color4; - subtract(right: Color4): Color4; - subtractToRef(right: Color4, result: Color4): Color4; - scale(scale: number): Color4; - scaleToRef(scale: number, result: Color4): Color4; - toString(): string; - clone(): Color4; - copyFrom(source: Color4): Color4; - toHexString(): string; - static FromHexString(hex: string): Color4; - static Lerp(left: Color4, right: Color4, amount: number): Color4; - static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void; - static FromArray(array: number[], offset?: number): Color4; - static FromInts(r: number, g: number, b: number, a: number): Color4; - } - class Vector2 { - x: number; - y: number; - constructor(x: number, y: number); - toString(): string; - toArray(array: number[], index?: number): Vector2; - asArray(): number[]; - copyFrom(source: Vector2): Vector2; - copyFromFloats(x: number, y: number): Vector2; - add(otherVector: Vector2): Vector2; - addVector3(otherVector: Vector3): Vector2; - subtract(otherVector: Vector2): Vector2; - subtractInPlace(otherVector: Vector2): Vector2; - multiplyInPlace(otherVector: Vector2): Vector2; - multiply(otherVector: Vector2): Vector2; - multiplyToRef(otherVector: Vector2, result: Vector2): Vector2; - multiplyByFloats(x: number, y: number): Vector2; - divide(otherVector: Vector2): Vector2; - divideToRef(otherVector: Vector2, result: Vector2): Vector2; - negate(): Vector2; - scaleInPlace(scale: number): Vector2; - scale(scale: number): Vector2; - equals(otherVector: Vector2): boolean; - equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean; - length(): number; - lengthSquared(): number; - normalize(): Vector2; - clone(): Vector2; - static Zero(): Vector2; - static FromArray(array: number[], offset?: number): Vector2; - static FromArrayToRef(array: number[], offset: number, result: Vector2): void; - static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2; - static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2; - static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2; - static Lerp(start: Vector2, end: Vector2, amount: number): Vector2; - static Dot(left: Vector2, right: Vector2): number; - static Normalize(vector: Vector2): Vector2; - static Minimize(left: Vector2, right: Vector2): Vector2; - static Maximize(left: Vector2, right: Vector2): Vector2; - static Transform(vector: Vector2, transformation: Matrix): Vector2; - static Distance(value1: Vector2, value2: Vector2): number; - static DistanceSquared(value1: Vector2, value2: Vector2): number; - } - class Vector3 { - x: number; - y: number; - z: number; - constructor(x: number, y: number, z: number); - toString(): string; - asArray(): number[]; - toArray(array: number[], index?: number): Vector3; - toQuaternion(): Quaternion; - addInPlace(otherVector: Vector3): Vector3; - add(otherVector: Vector3): Vector3; - addToRef(otherVector: Vector3, result: Vector3): Vector3; - subtractInPlace(otherVector: Vector3): Vector3; - subtract(otherVector: Vector3): Vector3; - subtractToRef(otherVector: Vector3, result: Vector3): Vector3; - subtractFromFloats(x: number, y: number, z: number): Vector3; - subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3; - negate(): Vector3; - scaleInPlace(scale: number): Vector3; - scale(scale: number): Vector3; - scaleToRef(scale: number, result: Vector3): void; - equals(otherVector: Vector3): boolean; - equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean; - equalsToFloats(x: number, y: number, z: number): boolean; - multiplyInPlace(otherVector: Vector3): Vector3; - multiply(otherVector: Vector3): Vector3; - multiplyToRef(otherVector: Vector3, result: Vector3): Vector3; - multiplyByFloats(x: number, y: number, z: number): Vector3; - divide(otherVector: Vector3): Vector3; - divideToRef(otherVector: Vector3, result: Vector3): Vector3; - MinimizeInPlace(other: Vector3): Vector3; - MaximizeInPlace(other: Vector3): Vector3; - length(): number; - lengthSquared(): number; - normalize(): Vector3; - clone(): Vector3; - copyFrom(source: Vector3): Vector3; - copyFromFloats(x: number, y: number, z: number): Vector3; - static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: any): number; - static FromArray(array: number[], offset?: number): Vector3; - static FromFloatArray(array: Float32Array, offset?: number): Vector3; - static FromArrayToRef(array: number[], offset: number, result: Vector3): void; - static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void; - static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void; - static Zero(): Vector3; - static Up(): Vector3; - static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3; - static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void; - static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; - static TransformCoordinatesToRefSIMD(vector: Vector3, transformation: Matrix, result: Vector3): void; - static TransformCoordinatesFromFloatsToRefSIMD(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; - static TransformNormal(vector: Vector3, transformation: Matrix): Vector3; - static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void; - static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; - static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3; - static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3; - static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3; - static Lerp(start: Vector3, end: Vector3, amount: number): Vector3; - static Dot(left: Vector3, right: Vector3): number; - static Cross(left: Vector3, right: Vector3): Vector3; - static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void; - static Normalize(vector: Vector3): Vector3; - static NormalizeToRef(vector: Vector3, result: Vector3): void; - static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3; - static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3; - static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3; - static Minimize(left: Vector3, right: Vector3): Vector3; - static Maximize(left: Vector3, right: Vector3): Vector3; - static Distance(value1: Vector3, value2: Vector3): number; - static DistanceSquared(value1: Vector3, value2: Vector3): number; - static Center(value1: Vector3, value2: Vector3): Vector3; - /** - * Given three orthogonal left-handed oriented Vector3 axis in space (target system), - * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply - * to something in order to rotate it from its local system to the given target system. - */ - static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3; - /** - * The same than RotationFromAxis but updates the passed ref Vector3 parameter. - */ - static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void; - } - class Vector4 { - x: number; - y: number; - z: number; - w: number; - constructor(x: number, y: number, z: number, w: number); - toString(): string; - asArray(): number[]; - toArray(array: number[], index?: number): Vector4; - addInPlace(otherVector: Vector4): Vector4; - add(otherVector: Vector4): Vector4; - addToRef(otherVector: Vector4, result: Vector4): Vector4; - subtractInPlace(otherVector: Vector4): Vector4; - subtract(otherVector: Vector4): Vector4; - subtractToRef(otherVector: Vector4, result: Vector4): Vector4; - subtractFromFloats(x: number, y: number, z: number, w: number): Vector4; - subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4; - negate(): Vector4; - scaleInPlace(scale: number): Vector4; - scale(scale: number): Vector4; - scaleToRef(scale: number, result: Vector4): void; - equals(otherVector: Vector4): boolean; - equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean; - equalsToFloats(x: number, y: number, z: number, w: number): boolean; - multiplyInPlace(otherVector: Vector4): Vector4; - multiply(otherVector: Vector4): Vector4; - multiplyToRef(otherVector: Vector4, result: Vector4): Vector4; - multiplyByFloats(x: number, y: number, z: number, w: number): Vector4; - divide(otherVector: Vector4): Vector4; - divideToRef(otherVector: Vector4, result: Vector4): Vector4; - MinimizeInPlace(other: Vector4): Vector4; - MaximizeInPlace(other: Vector4): Vector4; - length(): number; - lengthSquared(): number; - normalize(): Vector4; - clone(): Vector4; - copyFrom(source: Vector4): Vector4; - copyFromFloats(x: number, y: number, z: number, w: number): Vector4; - static FromArray(array: number[], offset?: number): Vector4; - static FromArrayToRef(array: number[], offset: number, result: Vector4): void; - static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void; - static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void; - static Zero(): Vector4; - static Normalize(vector: Vector4): Vector4; - static NormalizeToRef(vector: Vector4, result: Vector4): void; - static Minimize(left: Vector4, right: Vector4): Vector4; - static Maximize(left: Vector4, right: Vector4): Vector4; - static Distance(value1: Vector4, value2: Vector4): number; - static DistanceSquared(value1: Vector4, value2: Vector4): number; - static Center(value1: Vector4, value2: Vector4): Vector4; - } - class Quaternion { - x: number; - y: number; - z: number; - w: number; - constructor(x?: number, y?: number, z?: number, w?: number); - toString(): string; - asArray(): number[]; - equals(otherQuaternion: Quaternion): boolean; - clone(): Quaternion; - copyFrom(other: Quaternion): Quaternion; - copyFromFloats(x: number, y: number, z: number, w: number): Quaternion; - add(other: Quaternion): Quaternion; - subtract(other: Quaternion): Quaternion; - scale(value: number): Quaternion; - multiply(q1: Quaternion): Quaternion; - multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion; - length(): number; - normalize(): Quaternion; - toEulerAngles(): Vector3; - toEulerAnglesToRef(result: Vector3): Quaternion; - toRotationMatrix(result: Matrix): Quaternion; - fromRotationMatrix(matrix: Matrix): Quaternion; - static FromRotationMatrix(matrix: Matrix): Quaternion; - static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void; - static Inverse(q: Quaternion): Quaternion; - static Identity(): Quaternion; - static RotationAxis(axis: Vector3, angle: number): Quaternion; - static FromArray(array: number[], offset?: number): Quaternion; - static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion; - static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void; - static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion; - static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void; - static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion; - } - class Matrix { - private static _tempQuaternion; - private static _xAxis; - private static _yAxis; - private static _zAxis; - m: Float32Array; - isIdentity(): boolean; - determinant(): number; - toArray(): Float32Array; - asArray(): Float32Array; - invert(): Matrix; - reset(): Matrix; - add(other: Matrix): Matrix; - addToRef(other: Matrix, result: Matrix): Matrix; - addToSelf(other: Matrix): Matrix; - invertToRef(other: Matrix): Matrix; - invertToRefSIMD(other: Matrix): Matrix; - setTranslation(vector3: Vector3): Matrix; - multiply(other: Matrix): Matrix; - copyFrom(other: Matrix): Matrix; - copyToArray(array: Float32Array, offset?: number): Matrix; - multiplyToRef(other: Matrix, result: Matrix): Matrix; - multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix; - multiplyToArraySIMD(other: Matrix, result: Matrix, offset?: number): void; - equals(value: Matrix): boolean; - clone(): Matrix; - decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean; - static FromArray(array: number[], offset?: number): Matrix; - static FromArrayToRef(array: number[], offset: number, result: Matrix): void; - static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void; - static FromValuesToRef(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number, result: Matrix): void; - static FromValues(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number): Matrix; - static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix; - static Identity(): Matrix; - static IdentityToRef(result: Matrix): void; - static Zero(): Matrix; - static RotationX(angle: number): Matrix; - static Invert(source: Matrix): Matrix; - static RotationXToRef(angle: number, result: Matrix): void; - static RotationY(angle: number): Matrix; - static RotationYToRef(angle: number, result: Matrix): void; - static RotationZ(angle: number): Matrix; - static RotationZToRef(angle: number, result: Matrix): void; - static RotationAxis(axis: Vector3, angle: number): Matrix; - static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix; - static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void; - static Scaling(x: number, y: number, z: number): Matrix; - static ScalingToRef(x: number, y: number, z: number, result: Matrix): void; - static Translation(x: number, y: number, z: number): Matrix; - static TranslationToRef(x: number, y: number, z: number, result: Matrix): void; - static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix; - static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void; - static LookAtLHToRefSIMD(eyeRef: Vector3, targetRef: Vector3, upRef: Vector3, result: Matrix): void; - static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix; - static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void; - static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix; - static OrthoOffCenterLHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void; - static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix; - static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix; - static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, fovMode?: number): void; - static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix; - static GetAsMatrix2x2(matrix: Matrix): Float32Array; - static GetAsMatrix3x3(matrix: Matrix): Float32Array; - static Transpose(matrix: Matrix): Matrix; - static Reflection(plane: Plane): Matrix; - static ReflectionToRef(plane: Plane, result: Matrix): void; - } - class Plane { - normal: Vector3; - d: number; - constructor(a: number, b: number, c: number, d: number); - asArray(): number[]; - clone(): Plane; - normalize(): Plane; - transform(transformation: Matrix): Plane; - dotCoordinate(point: any): number; - copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane; - isFrontFacingTo(direction: Vector3, epsilon: number): boolean; - signedDistanceTo(point: Vector3): number; - static FromArray(array: number[]): Plane; - static FromPoints(point1: any, point2: any, point3: any): Plane; - static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane; - static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number; - } - class Viewport { - x: number; - y: number; - width: number; - height: number; - constructor(x: number, y: number, width: number, height: number); - toGlobal(engine: any): Viewport; - } - class Frustum { - static GetPlanes(transform: Matrix): Plane[]; - static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void; - } - class Ray { - origin: Vector3; - direction: Vector3; - length: number; - private _edge1; - private _edge2; - private _pvec; - private _tvec; - private _qvec; - constructor(origin: Vector3, direction: Vector3, length?: number); - intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean; - intersectsBox(box: BoundingBox): boolean; - intersectsSphere(sphere: any): boolean; - intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo; - static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray; - /** - * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be - * transformed to the given world matrix. - * @param origin The origin point - * @param end The end point - * @param world a matrix to transform the ray to. Default is the identity matrix. - */ - static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray; - static Transform(ray: Ray, matrix: Matrix): Ray; - } - enum Space { - LOCAL = 0, - WORLD = 1, - } - class Axis { - static X: Vector3; - static Y: Vector3; - static Z: Vector3; - } - class BezierCurve { - static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number; - } - enum Orientation { - CW = 0, - CCW = 1, - } - class Angle { - private _radians; - constructor(radians: number); - degrees: () => number; - radians: () => number; - static BetweenTwoPoints(a: Vector2, b: Vector2): Angle; - static FromRadians(radians: number): Angle; - static FromDegrees(degrees: number): Angle; - } - class Arc2 { - startPoint: Vector2; - midPoint: Vector2; - endPoint: Vector2; - centerPoint: Vector2; - radius: number; - angle: Angle; - startAngle: Angle; - orientation: Orientation; - constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2); - } - class PathCursor { - private path; - private _onchange; - value: number; - animations: Animation[]; - constructor(path: Path2); - getPoint(): Vector3; - moveAhead(step?: number): PathCursor; - moveBack(step?: number): PathCursor; - move(step: number): PathCursor; - private ensureLimits(); - private markAsDirty(propertyName); - private raiseOnChange(); - onchange(f: (cursor: PathCursor) => void): PathCursor; - } - class Path2 { - private _points; - private _length; - closed: boolean; - constructor(x: number, y: number); - addLineTo(x: number, y: number): Path2; - addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2; - close(): Path2; - length(): number; - getPoints(): Vector2[]; - getPointAtLengthPosition(normalizedLengthPosition: number): Vector2; - static StartingAt(x: number, y: number): Path2; - } - class Path3D { - path: Vector3[]; - private _curve; - private _distances; - private _tangents; - private _normals; - private _binormals; - private _raw; - /** - * new Path3D(path, normal, raw) - * path : an array of Vector3, the curve axis of the Path3D - * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal. - * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed. - */ - constructor(path: Vector3[], firstNormal?: Vector3, raw?: boolean); - getCurve(): Vector3[]; - getTangents(): Vector3[]; - getNormals(): Vector3[]; - getBinormals(): Vector3[]; - getDistances(): number[]; - update(path: Vector3[], firstNormal?: Vector3): Path3D; - private _compute(firstNormal); - private _getFirstNonNullVector(index); - private _getLastNonNullVector(index); - private _normalVector(v0, vt, va); - } - class Curve3 { - private _points; - private _length; - static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3; - static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3; - static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3; - constructor(points: Vector3[]); - getPoints(): Vector3[]; - length(): number; - continue(curve: Curve3): Curve3; - private _computeLength(path); - } - class PositionNormalVertex { - position: Vector3; - normal: Vector3; - constructor(position?: Vector3, normal?: Vector3); - clone(): PositionNormalVertex; - } - class PositionNormalTextureVertex { - position: Vector3; - normal: Vector3; - uv: Vector2; - constructor(position?: Vector3, normal?: Vector3, uv?: Vector2); - clone(): PositionNormalTextureVertex; - } - class SIMDHelper { - private static _isEnabled; - static IsEnabled: boolean; - static DisableSIMD(): void; - static EnableSIMD(): void; - } -} - -declare module BABYLON { - class AbstractMesh extends Node implements IDisposable { - private static _BILLBOARDMODE_NONE; - private static _BILLBOARDMODE_X; - private static _BILLBOARDMODE_Y; - private static _BILLBOARDMODE_Z; - private static _BILLBOARDMODE_ALL; - static BILLBOARDMODE_NONE: number; - static BILLBOARDMODE_X: number; - static BILLBOARDMODE_Y: number; - static BILLBOARDMODE_Z: number; - static BILLBOARDMODE_ALL: number; - definedFacingForward: boolean; - position: Vector3; - rotation: Vector3; - rotationQuaternion: Quaternion; - scaling: Vector3; - billboardMode: number; - visibility: number; - alphaIndex: number; - infiniteDistance: boolean; - isVisible: boolean; - isPickable: boolean; - showBoundingBox: boolean; - showSubMeshesBoundingBox: boolean; - onDispose: any; - isBlocker: boolean; - skeleton: Skeleton; - renderingGroupId: number; - material: Material; - receiveShadows: boolean; - actionManager: ActionManager; - renderOutline: boolean; - outlineColor: Color3; - outlineWidth: number; - renderOverlay: boolean; - overlayColor: Color3; - overlayAlpha: number; - hasVertexAlpha: boolean; - useVertexColors: boolean; - applyFog: boolean; - computeBonesUsingShaders: boolean; - useOctreeForRenderingSelection: boolean; - useOctreeForPicking: boolean; - useOctreeForCollisions: boolean; - layerMask: number; - alwaysSelectAsActiveMesh: boolean; - _physicImpostor: number; - _physicsMass: number; - _physicsFriction: number; - _physicRestitution: number; - private _checkCollisions; - ellipsoid: Vector3; - ellipsoidOffset: Vector3; - private _collider; - private _oldPositionForCollisions; - private _diffPositionForCollisions; - private _newPositionForCollisions; - onCollide: (collidedMesh: AbstractMesh) => void; - private _meshToBoneReferal; - edgesWidth: number; - edgesColor: Color4; - _edgesRenderer: EdgesRenderer; - private _localScaling; - private _localRotation; - private _localTranslation; - private _localBillboard; - private _localPivotScaling; - private _localPivotScalingRotation; - private _localMeshReferalTransform; - private _localWorld; - _worldMatrix: Matrix; - private _rotateYByPI; - private _absolutePosition; - private _collisionsTransformMatrix; - private _collisionsScalingMatrix; - _positions: Vector3[]; - private _isDirty; - _masterMesh: AbstractMesh; - _boundingInfo: BoundingInfo; - private _pivotMatrix; - _isDisposed: boolean; - _renderId: number; - subMeshes: SubMesh[]; - _submeshesOctree: Octree; - _intersectionsInProgress: AbstractMesh[]; - private _onAfterWorldMatrixUpdate; - private _isWorldMatrixFrozen; - _waitingActions: any; - _waitingFreezeWorldMatrix: boolean; - constructor(name: string, scene: Scene); - disableEdgesRendering(): void; - enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): void; - isBlocked: boolean; - getLOD(camera: Camera): AbstractMesh; - getTotalVertices(): number; - getIndices(): number[]; - getVerticesData(kind: string): number[]; - isVerticesDataPresent(kind: string): boolean; - getBoundingInfo(): BoundingInfo; - useBones: boolean; - _preActivate(): void; - _activate(renderId: number): void; - getWorldMatrix(): Matrix; - worldMatrixFromCache: Matrix; - absolutePosition: Vector3; - freezeWorldMatrix(): void; - unfreezeWorldMatrix(): void; - isWorldMatrixFrozen: boolean; - rotate(axis: Vector3, amount: number, space: Space): void; - translate(axis: Vector3, distance: number, space: Space): void; - getAbsolutePosition(): Vector3; - setAbsolutePosition(absolutePosition: Vector3): void; - /** - * Perform relative position change from the point of view of behind the front of the mesh. - * This is performed taking into account the meshes current rotation, so you do not have to care. - * Supports definition of mesh facing forward or backward. - * @param {number} amountRight - * @param {number} amountUp - * @param {number} amountForward - */ - movePOV(amountRight: number, amountUp: number, amountForward: number): void; - /** - * Calculate relative position change from the point of view of behind the front of the mesh. - * This is performed taking into account the meshes current rotation, so you do not have to care. - * Supports definition of mesh facing forward or backward. - * @param {number} amountRight - * @param {number} amountUp - * @param {number} amountForward - */ - calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3; - /** - * Perform relative rotation change from the point of view of behind the front of the mesh. - * Supports definition of mesh facing forward or backward. - * @param {number} flipBack - * @param {number} twirlClockwise - * @param {number} tiltRight - */ - rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): void; - /** - * Calculate relative rotation change from the point of view of behind the front of the mesh. - * Supports definition of mesh facing forward or backward. - * @param {number} flipBack - * @param {number} twirlClockwise - * @param {number} tiltRight - */ - calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3; - setPivotMatrix(matrix: Matrix): void; - getPivotMatrix(): Matrix; - _isSynchronized(): boolean; - _initCache(): void; - markAsDirty(property: string): void; - _updateBoundingInfo(): void; - _updateSubMeshesBoundingInfo(matrix: Matrix): void; - computeWorldMatrix(force?: boolean): Matrix; - /** - * If you'd like to be callbacked after the mesh position, rotation or scaling has been updated - * @param func: callback function to add - */ - registerAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void; - unregisterAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void; - setPositionWithLocalVector(vector3: Vector3): void; - getPositionExpressedInLocalSpace(): Vector3; - locallyTranslate(vector3: Vector3): void; - lookAt(targetPoint: Vector3, yawCor: number, pitchCor: number, rollCor: number): void; - attachToBone(bone: Bone, affectedMesh: AbstractMesh): void; - detachFromBone(): void; - isInFrustum(frustumPlanes: Plane[]): boolean; - isCompletelyInFrustum(camera?: Camera): boolean; - intersectsMesh(mesh: AbstractMesh, precise?: boolean): boolean; - intersectsPoint(point: Vector3): boolean; - setPhysicsState(impostor?: any, options?: PhysicsBodyCreationOptions): any; - getPhysicsImpostor(): number; - getPhysicsMass(): number; - getPhysicsFriction(): number; - getPhysicsRestitution(): number; - getPositionInCameraSpace(camera?: Camera): Vector3; - getDistanceToCamera(camera?: Camera): number; - applyImpulse(force: Vector3, contactPoint: Vector3): void; - setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): void; - updatePhysicsBodyPosition(): void; - checkCollisions: boolean; - moveWithCollisions(velocity: Vector3): void; - private _onCollisionPositionChange; - /** - * This function will create an octree to help select the right submeshes for rendering, picking and collisions - * Please note that you must have a decent number of submeshes to get performance improvements when using octree - */ - createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree; - _collideForSubMesh(subMesh: SubMesh, transformMatrix: Matrix, collider: Collider): void; - _processCollisionsForSubMeshes(collider: Collider, transformMatrix: Matrix): void; - _checkCollision(collider: Collider): void; - _generatePointsArray(): boolean; - intersects(ray: Ray, fastCheck?: boolean): PickingInfo; - clone(name: string, newParent: Node, doNotCloneChildren?: boolean): AbstractMesh; - releaseSubMeshes(): void; - dispose(doNotRecurse?: boolean): void; - } -} - -declare module BABYLON { - class CSG { - private polygons; - matrix: Matrix; - position: Vector3; - rotation: Vector3; - rotationQuaternion: Quaternion; - scaling: Vector3; - static FromMesh(mesh: Mesh): CSG; - private static FromPolygons(polygons); - clone(): CSG; - private toPolygons(); - union(csg: CSG): CSG; - unionInPlace(csg: CSG): void; - subtract(csg: CSG): CSG; - subtractInPlace(csg: CSG): void; - intersect(csg: CSG): CSG; - intersectInPlace(csg: CSG): void; - inverse(): CSG; - inverseInPlace(): void; - copyTransformAttributes(csg: CSG): CSG; - buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh; - toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh; - } -} - -declare module BABYLON { - class Geometry implements IGetSetVerticesData { - id: string; - delayLoadState: number; - delayLoadingFile: string; - onGeometryUpdated: (geometry: Geometry, kind?: string) => void; - private _scene; - private _engine; - private _meshes; - private _totalVertices; - private _indices; - private _vertexBuffers; - private _isDisposed; - _delayInfo: any; - private _indexBuffer; - _boundingInfo: BoundingInfo; - _delayLoadingFunction: (any: any, geometry: Geometry) => void; - constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Mesh); - getScene(): Scene; - getEngine(): Engine; - isReady(): boolean; - setAllVerticesData(vertexData: VertexData, updatable?: boolean): void; - setVerticesData(kind: string, data: number[], updatable?: boolean, stride?: number): void; - updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void; - updateVerticesData(kind: string, data: number[], updateExtends?: boolean): void; - getTotalVertices(): number; - getVerticesData(kind: string, copyWhenShared?: boolean): number[]; - getVertexBuffer(kind: string): VertexBuffer; - getVertexBuffers(): VertexBuffer[]; - isVerticesDataPresent(kind: string): boolean; - getVerticesDataKinds(): string[]; - setIndices(indices: number[], totalVertices?: number): void; - getTotalIndices(): number; - getIndices(copyWhenShared?: boolean): number[]; - getIndexBuffer(): any; - releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void; - applyToMesh(mesh: Mesh): void; - private _applyToMesh(mesh); - private notifyUpdate(kind?); - load(scene: Scene, onLoaded?: () => void): void; - isDisposed(): boolean; - dispose(): void; - copy(id: string): Geometry; - static ExtractFromMesh(mesh: Mesh, id: string): Geometry; - static RandomId(): string; - } - module Geometry.Primitives { - class _Primitive extends Geometry { - private _beingRegenerated; - private _canBeRegenerated; - constructor(id: string, scene: Scene, vertexData?: VertexData, canBeRegenerated?: boolean, mesh?: Mesh); - canBeRegenerated(): boolean; - regenerate(): void; - asNewGeometry(id: string): Geometry; - setAllVerticesData(vertexData: VertexData, updatable?: boolean): void; - setVerticesData(kind: string, data: number[], updatable?: boolean): void; - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - } - class Ribbon extends _Primitive { - pathArray: Vector3[][]; - closeArray: boolean; - closePath: boolean; - offset: number; - side: number; - constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - } - class Box extends _Primitive { - size: number; - side: number; - constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - } - class Sphere extends _Primitive { - segments: number; - diameter: number; - side: number; - constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - } - class Cylinder extends _Primitive { - height: number; - diameterTop: number; - diameterBottom: number; - tessellation: number; - subdivisions: number; - side: number; - constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - } - class Torus extends _Primitive { - diameter: number; - thickness: number; - tessellation: number; - side: number; - constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - } - class Ground extends _Primitive { - width: number; - height: number; - subdivisions: number; - constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Mesh); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - } - class TiledGround extends _Primitive { - xmin: number; - zmin: number; - xmax: number; - zmax: number; - subdivisions: { - w: number; - h: number; - }; - precision: { - w: number; - h: number; - }; - constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: { - w: number; - h: number; - }, precision: { - w: number; - h: number; - }, canBeRegenerated?: boolean, mesh?: Mesh); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - } - class Plane extends _Primitive { - size: number; - side: number; - constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - } - class TorusKnot extends _Primitive { - radius: number; - tube: number; - radialSegments: number; - tubularSegments: number; - p: number; - q: number; - side: number; - constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); - _regenerateVertexData(): VertexData; - copy(id: string): Geometry; - } - } -} - -declare module BABYLON { - class GroundMesh extends Mesh { - generateOctree: boolean; - private _worldInverse; - _subdivisions: number; - constructor(name: string, scene: Scene); - subdivisions: number; - optimize(chunksCount: number, octreeBlocksSize?: number): void; - getHeightAtCoordinates(x: number, z: number): number; - } -} - -declare module BABYLON { - /** - * Creates an instance based on a source mesh. - */ - class InstancedMesh extends AbstractMesh { - private _sourceMesh; - private _currentLOD; - constructor(name: string, source: Mesh); - receiveShadows: boolean; - material: Material; - visibility: number; - skeleton: Skeleton; - getTotalVertices(): number; - sourceMesh: Mesh; - getVerticesData(kind: string): number[]; - isVerticesDataPresent(kind: string): boolean; - getIndices(): number[]; - _positions: Vector3[]; - refreshBoundingInfo(): void; - _preActivate(): void; - _activate(renderId: number): void; - getLOD(camera: Camera): AbstractMesh; - _syncSubMeshes(): void; - _generatePointsArray(): boolean; - clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh; - dispose(doNotRecurse?: boolean): void; - } -} - -declare module BABYLON { - class LinesMesh extends Mesh { - color: Color3; - alpha: number; - private _colorShader; - constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean); - material: Material; - isPickable: boolean; - checkCollisions: boolean; - _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void; - _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void; - intersects(ray: Ray, fastCheck?: boolean): any; - dispose(doNotRecurse?: boolean): void; - clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): LinesMesh; - } -} - -declare module BABYLON { - class _InstancesBatch { - mustReturn: boolean; - visibleInstances: InstancedMesh[][]; - renderSelf: boolean[]; - } - class Mesh extends AbstractMesh implements IGetSetVerticesData { - static _FRONTSIDE: number; - static _BACKSIDE: number; - static _DOUBLESIDE: number; - static _DEFAULTSIDE: number; - static _NO_CAP: number; - static _CAP_START: number; - static _CAP_END: number; - static _CAP_ALL: number; - static FRONTSIDE: number; - static BACKSIDE: number; - static DOUBLESIDE: number; - static DEFAULTSIDE: number; - static NO_CAP: number; - static CAP_START: number; - static CAP_END: number; - static CAP_ALL: number; - delayLoadState: number; - instances: InstancedMesh[]; - delayLoadingFile: string; - _binaryInfo: any; - private _LODLevels; - onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void; - _geometry: Geometry; - private _onBeforeRenderCallbacks; - private _onAfterRenderCallbacks; - _delayInfo: any; - _delayLoadingFunction: (any: any, mesh: Mesh) => void; - _visibleInstances: any; - private _renderIdForInstances; - private _batchCache; - private _worldMatricesInstancesBuffer; - private _worldMatricesInstancesArray; - private _instancesBufferSize; - _shouldGenerateFlatShading: boolean; - private _preActivateId; - private _sideOrientation; - private _areNormalsFrozen; - private _sourcePositions; - private _sourceNormals; - /** - * @constructor - * @param {string} name - The value used by scene.getMeshByName() to do a lookup. - * @param {Scene} scene - The scene to add this mesh to. - * @param {Node} parent - The parent of this mesh, if it has one - * @param {Mesh} source - An optional Mesh from which geometry is shared, cloned. - * @param {boolean} doNotCloneChildren - When cloning, skip cloning child meshes of source, default False. - * When false, achieved by calling a clone(), also passing False. - * This will make creation of children, recursive. - */ - constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean); - hasLODLevels: boolean; - private _sortLODLevels(); - /** - * Add a mesh as LOD level triggered at the given distance. - * @param {number} distance - the distance from the center of the object to show this level - * @param {BABYLON.Mesh} mesh - the mesh to be added as LOD level - * @return {BABYLON.Mesh} this mesh (for chaining) - */ - addLODLevel(distance: number, mesh: Mesh): Mesh; - getLODLevelAtDistance(distance: number): Mesh; - /** - * Remove a mesh from the LOD array - * @param {BABYLON.Mesh} mesh - the mesh to be removed. - * @return {BABYLON.Mesh} this mesh (for chaining) - */ - removeLODLevel(mesh: Mesh): Mesh; - getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh; - geometry: Geometry; - getTotalVertices(): number; - getVerticesData(kind: string, copyWhenShared?: boolean): number[]; - getVertexBuffer(kind: any): VertexBuffer; - isVerticesDataPresent(kind: string): boolean; - getVerticesDataKinds(): string[]; - getTotalIndices(): number; - getIndices(copyWhenShared?: boolean): number[]; - isBlocked: boolean; - isReady(): boolean; - isDisposed(): boolean; - sideOrientation: number; - areNormalsFrozen: boolean; - /** This function affects parametric shapes on update only : ribbons, tubes, etc. It has no effect at all on other shapes */ - freezeNormals(): void; - /** This function affects parametric shapes on update only : ribbons, tubes, etc. It has no effect at all on other shapes */ - unfreezeNormals(): void; - _preActivate(): void; - _registerInstanceForRenderId(instance: InstancedMesh, renderId: number): void; - refreshBoundingInfo(): void; - _createGlobalSubMesh(): SubMesh; - subdivide(count: number): void; - setVerticesData(kind: any, data: any, updatable?: boolean, stride?: number): void; - updateVerticesData(kind: string, data: number[], updateExtends?: boolean, makeItUnique?: boolean): void; - updateVerticesDataDirectly(kind: string, data: Float32Array, offset?: number, makeItUnique?: boolean): void; - updateMeshPositions(positionFunction: any, computeNormals?: boolean): void; - makeGeometryUnique(): void; - setIndices(indices: number[], totalVertices?: number): void; - _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void; - _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void; - registerBeforeRender(func: (mesh: AbstractMesh) => void): void; - unregisterBeforeRender(func: (mesh: AbstractMesh) => void): void; - registerAfterRender(func: (mesh: AbstractMesh) => void): void; - unregisterAfterRender(func: (mesh: AbstractMesh) => void): void; - _getInstancesRenderList(subMeshId: number): _InstancesBatch; - _renderWithInstances(subMesh: SubMesh, fillMode: number, batch: _InstancesBatch, effect: Effect, engine: Engine): void; - _processRendering(subMesh: SubMesh, effect: Effect, fillMode: number, batch: _InstancesBatch, hardwareInstancedRendering: boolean, onBeforeDraw: (isInstance: boolean, world: Matrix) => void): void; - render(subMesh: SubMesh, enableAlphaMode: boolean): void; - getEmittedParticleSystems(): ParticleSystem[]; - getHierarchyEmittedParticleSystems(): ParticleSystem[]; - getChildren(): Node[]; - _checkDelayState(): void; - isInFrustum(frustumPlanes: Plane[]): boolean; - setMaterialByID(id: string): void; - getAnimatables(): IAnimatable[]; - bakeTransformIntoVertices(transform: Matrix): void; - bakeCurrentTransformIntoVertices(): void; - _resetPointsArrayCache(): void; - _generatePointsArray(): boolean; - clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): Mesh; - dispose(doNotRecurse?: boolean): void; - applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void): void; - applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number): void; - convertToFlatShadedMesh(): void; - flipFaces(flipNormals?: boolean): void; - createInstance(name: string): InstancedMesh; - synchronizeInstances(): void; - /** - * Simplify the mesh according to the given array of settings. - * Function will return immediately and will simplify async. - * @param settings a collection of simplification settings. - * @param parallelProcessing should all levels calculate parallel or one after the other. - * @param type the type of simplification to run. - * @param successCallback optional success callback to be called after the simplification finished processing all settings. - */ - simplify(settings: Array, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): void; - /** - * Optimization of the mesh's indices, in case a mesh has duplicated vertices. - * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes. - * This should be used together with the simplification to avoid disappearing triangles. - * @param successCallback an optional success callback to be called after the optimization finished. - */ - optimizeIndices(successCallback?: (mesh?: Mesh) => void): void; - static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, scene: Scene, updatable?: boolean, sideOrientation?: number, ribbonInstance?: Mesh): Mesh; - static CreateDisc(name: string, radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; - static CreateBox(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; - static CreateBox(name: string, options: { - width?: number; - height?: number; - depth?: number; - faceUV?: Vector4[]; - faceColors?: Color4[]; - sideOrientation?: number; - updatable?: boolean; - }, scene: Scene): Mesh; - static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh; - static CreateSphere(name: string, options: { - segments?: number; - diameterX?: number; - diameterY?: number; - diameterZ?: number; - sideOrientation?: number; - updatable?: boolean; - }, scene: any): Mesh; - static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene: Scene, updatable?: any, sideOrientation?: number): Mesh; - static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; - static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; - static CreateLines(name: string, points: Vector3[], scene: Scene, updatable?: boolean, linesInstance?: LinesMesh): LinesMesh; - static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Scene, updatable?: boolean, linesInstance?: LinesMesh): LinesMesh; - static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, extrudedInstance?: Mesh): Mesh; - static ExtrudeShapeCustom(name: string, shape: Vector3[], path: Vector3[], scaleFunction: any, rotationFunction: any, ribbonCloseArray: boolean, ribbonClosePath: boolean, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, extrudedInstance?: Mesh): Mesh; - private static _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance); - static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; - static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; - static CreatePlane(name: string, options: { - width?: number; - height?: number; - sideOrientation?: number; - updatable?: boolean; - }, scene: Scene): Mesh; - static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh; - static CreateGround(name: string, options: { - width?: number; - height?: number; - subdivisions?: number; - sideOrientation?: number; - updatable?: boolean; - }, scene: any): Mesh; - static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: { - w: number; - h: number; - }, precision: { - w: number; - h: number; - }, scene: Scene, updatable?: boolean): Mesh; - static CreateGroundFromHeightMap(name: string, url: string, width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, scene: Scene, updatable?: boolean, onReady?: (mesh: GroundMesh) => void): GroundMesh; - static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: { - (i: number, distance: number): number; - }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, tubeInstance?: Mesh): Mesh; - static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle?: number): Mesh; - /** - * Update the vertex buffers by applying transformation from the bones - * @param {skeleton} skeleton to apply - */ - applySkeleton(skeleton: Skeleton): Mesh; - static MinMax(meshes: AbstractMesh[]): { - min: Vector3; - max: Vector3; - }; - static Center(meshesOrMinMaxVector: any): Vector3; - /** - * Merge the array of meshes into a single mesh for performance reasons. - * @param {Array} meshes - The vertices source. They should all be of the same material. Entries can empty - * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes - * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true. - * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class. - */ - static MergeMeshes(meshes: Array, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh): Mesh; - } -} - -declare module BABYLON { - interface IGetSetVerticesData { - isVerticesDataPresent(kind: string): boolean; - getVerticesData(kind: string, copyWhenShared?: boolean): number[]; - getIndices(copyWhenShared?: boolean): number[]; - setVerticesData(kind: string, data: number[], updatable?: boolean): void; - updateVerticesData(kind: string, data: number[], updateExtends?: boolean, makeItUnique?: boolean): void; - setIndices(indices: number[]): void; - } - class VertexData { - positions: number[]; - normals: number[]; - uvs: number[]; - uvs2: number[]; - uvs3: number[]; - uvs4: number[]; - uvs5: number[]; - uvs6: number[]; - colors: number[]; - matricesIndices: number[]; - matricesWeights: number[]; - indices: number[]; - set(data: number[], kind: string): void; - applyToMesh(mesh: Mesh, updatable?: boolean): void; - applyToGeometry(geometry: Geometry, updatable?: boolean): void; - updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): void; - updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): void; - private _applyTo(meshOrGeometry, updatable?); - private _update(meshOrGeometry, updateExtends?, makeItUnique?); - transform(matrix: Matrix): void; - merge(other: VertexData): void; - static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean): VertexData; - static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean): VertexData; - private static _ExtractFrom(meshOrGeometry, copyWhenShared?); - static CreateRibbon(pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, sideOrientation?: number): VertexData; - static CreateBox(options: { - width?: number; - height?: number; - depth?: number; - faceUV?: Vector4[]; - faceColors?: Color4[]; - sideOrientation?: number; - }): VertexData; - static CreateBox(size: number, sideOrientation?: number): VertexData; - static CreateSphere(options: { - segments?: number; - diameterX?: number; - diameterY?: number; - diameterZ?: number; - sideOrientation?: number; - }): VertexData; - static CreateSphere(segments: number, diameter?: number, sideOrientation?: number): VertexData; - static CreateCylinder(height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, sideOrientation?: number): VertexData; - static CreateTorus(diameter: any, thickness: any, tessellation: any, sideOrientation?: number): VertexData; - static CreateLines(points: Vector3[]): VertexData; - static CreateDashedLines(points: Vector3[], dashSize: number, gapSize: number, dashNb: number): VertexData; - static CreateGround(options: { - width?: number; - height?: number; - subdivisions?: number; - sideOrientation?: number; - }): VertexData; - static CreateGround(width: number, height: number, subdivisions?: number): VertexData; - static CreateTiledGround(xmin: number, zmin: number, xmax: number, zmax: number, subdivisions?: { - w: number; - h: number; - }, precision?: { - w: number; - h: number; - }): VertexData; - static CreateGroundFromHeightMap(width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, buffer: Uint8Array, bufferWidth: number, bufferHeight: number): VertexData; - static CreatePlane(options: { - width?: number; - height?: number; - sideOrientation?: number; - }): VertexData; - static CreatePlane(size: number, sideOrientation?: number): VertexData; - static CreateDisc(radius: number, tessellation: number, sideOrientation?: number): VertexData; - static CreateTorusKnot(radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, sideOrientation?: number): VertexData; - /** - * @param {any} - positions (number[] or Float32Array) - * @param {any} - indices (number[] or Uint16Array) - * @param {any} - normals (number[] or Float32Array) - */ - static ComputeNormals(positions: any, indices: any, normals: any): void; - private static _ComputeSides(sideOrientation, positions, indices, normals, uvs); - } -} - -declare module BABYLON.Internals { - class MeshLODLevel { - distance: number; - mesh: Mesh; - constructor(distance: number, mesh: Mesh); - } -} - -declare module BABYLON { - /** - * A simplifier interface for future simplification implementations. - */ - interface ISimplifier { - /** - * Simplification of a given mesh according to the given settings. - * Since this requires computation, it is assumed that the function runs async. - * @param settings The settings of the simplification, including quality and distance - * @param successCallback A callback that will be called after the mesh was simplified. - * @param errorCallback in case of an error, this callback will be called. optional. - */ - simplify(settings: ISimplificationSettings, successCallback: (simplifiedMeshes: Mesh) => void, errorCallback?: () => void): void; - } - /** - * Expected simplification settings. - * Quality should be between 0 and 1 (1 being 100%, 0 being 0%); - */ - interface ISimplificationSettings { - quality: number; - distance: number; - optimizeMesh?: boolean; - } - class SimplificationSettings implements ISimplificationSettings { - quality: number; - distance: number; - optimizeMesh: boolean; - constructor(quality: number, distance: number, optimizeMesh?: boolean); - } - interface ISimplificationTask { - settings: Array; - simplificationType: SimplificationType; - mesh: Mesh; - successCallback?: () => void; - parallelProcessing: boolean; - } - class SimplificationQueue { - private _simplificationArray; - running: any; - constructor(); - addTask(task: ISimplificationTask): void; - executeNext(): void; - runSimplification(task: ISimplificationTask): void; - private getSimplifier(task); - } - /** - * The implemented types of simplification. - * At the moment only Quadratic Error Decimation is implemented. - */ - enum SimplificationType { - QUADRATIC = 0, - } - class DecimationTriangle { - vertices: Array; - normal: Vector3; - error: Array; - deleted: boolean; - isDirty: boolean; - borderFactor: number; - deletePending: boolean; - originalOffset: number; - constructor(vertices: Array); - } - class DecimationVertex { - position: Vector3; - id: any; - q: QuadraticMatrix; - isBorder: boolean; - triangleStart: number; - triangleCount: number; - originalOffsets: Array; - constructor(position: Vector3, id: any); - updatePosition(newPosition: Vector3): void; - } - class QuadraticMatrix { - data: Array; - constructor(data?: Array); - det(a11: any, a12: any, a13: any, a21: any, a22: any, a23: any, a31: any, a32: any, a33: any): number; - addInPlace(matrix: QuadraticMatrix): void; - addArrayInPlace(data: Array): void; - add(matrix: QuadraticMatrix): QuadraticMatrix; - static FromData(a: number, b: number, c: number, d: number): QuadraticMatrix; - static DataFromNumbers(a: number, b: number, c: number, d: number): number[]; - } - class Reference { - vertexId: number; - triangleId: number; - constructor(vertexId: number, triangleId: number); - } - /** - * An implementation of the Quadratic Error simplification algorithm. - * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf - * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS - * @author RaananW - */ - class QuadraticErrorSimplification implements ISimplifier { - private _mesh; - private triangles; - private vertices; - private references; - private initialized; - private _reconstructedMesh; - syncIterations: number; - aggressiveness: number; - decimationIterations: number; - boundingBoxEpsilon: number; - constructor(_mesh: Mesh); - simplify(settings: ISimplificationSettings, successCallback: (simplifiedMesh: Mesh) => void): void; - private isTriangleOnBoundingBox(triangle); - private runDecimation(settings, submeshIndex, successCallback); - private initWithMesh(submeshIndex, callback, optimizeMesh?); - private init(callback); - private reconstructMesh(submeshIndex); - private initDecimatedMesh(); - private isFlipped(vertex1, vertex2, point, deletedArray, borderFactor, delTr); - private updateTriangles(origVertex, vertex, deletedArray, deletedTriangles); - private identifyBorder(); - private updateMesh(identifyBorders?); - private vertexError(q, point); - private calculateError(vertex1, vertex2, pointResult?, normalResult?, uvResult?, colorResult?); - } -} - -declare module BABYLON { - class Polygon { - static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[]; - static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[]; - static Parse(input: string): Vector2[]; - static StartingAt(x: number, y: number): Path2; - } - class PolygonMeshBuilder { - private _swctx; - private _points; - private _outlinepoints; - private _holes; - private _name; - private _scene; - constructor(name: string, contours: Path2, scene: Scene); - constructor(name: string, contours: Vector2[], scene: Scene); - addHole(hole: Vector2[]): PolygonMeshBuilder; - build(updatable?: boolean, depth?: number): Mesh; - private addSide(positions, normals, uvs, indices, bounds, points, depth, flip); - } -} - -declare module BABYLON { - class SubMesh { - materialIndex: number; - verticesStart: number; - verticesCount: number; - indexStart: any; - indexCount: number; - linesIndexCount: number; - private _mesh; - private _renderingMesh; - private _boundingInfo; - private _linesIndexBuffer; - _lastColliderWorldVertices: Vector3[]; - _trianglePlanes: Plane[]; - _lastColliderTransformMatrix: Matrix; - _renderId: number; - _alphaIndex: number; - _distanceToCamera: number; - _id: number; - constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: any, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean); - getBoundingInfo(): BoundingInfo; - getMesh(): AbstractMesh; - getRenderingMesh(): Mesh; - getMaterial(): Material; - refreshBoundingInfo(): void; - _checkCollision(collider: Collider): boolean; - updateBoundingInfo(world: Matrix): void; - isInFrustum(frustumPlanes: Plane[]): boolean; - render(enableAlphaMode: boolean): void; - getLinesIndexBuffer(indices: number[], engine: any): WebGLBuffer; - canIntersects(ray: Ray): boolean; - intersects(ray: Ray, positions: Vector3[], indices: number[], fastCheck?: boolean): IntersectionInfo; - clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh; - dispose(): void; - static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh; - } -} - -declare module BABYLON { - class VertexBuffer { - private _mesh; - private _engine; - private _buffer; - private _data; - private _updatable; - private _kind; - private _strideSize; - constructor(engine: any, data: number[], kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number); - isUpdatable(): boolean; - getData(): number[]; - getBuffer(): WebGLBuffer; - getStrideSize(): number; - create(data?: number[]): void; - update(data: number[]): void; - updateDirectly(data: Float32Array, offset: number): void; - dispose(): void; - private static _PositionKind; - private static _NormalKind; - private static _UVKind; - private static _UV2Kind; - private static _UV3Kind; - private static _UV4Kind; - private static _UV5Kind; - private static _UV6Kind; - private static _ColorKind; - private static _MatricesIndicesKind; - private static _MatricesWeightsKind; - static PositionKind: string; - static NormalKind: string; - static UVKind: string; - static UV2Kind: string; - static UV3Kind: string; - static UV4Kind: string; - static UV5Kind: string; - static UV6Kind: string; - static ColorKind: string; - static MatricesIndicesKind: string; - static MatricesWeightsKind: string; - } -} - -declare module BABYLON { - class Particle { - position: Vector3; - direction: Vector3; - color: Color4; - colorStep: Color4; - lifeTime: number; - age: number; - size: number; - angle: number; - angularSpeed: number; - copyTo(other: Particle): void; - } -} - -declare module BABYLON { - class ParticleSystem implements IDisposable { - name: string; - static BLENDMODE_ONEONE: number; - static BLENDMODE_STANDARD: number; - id: string; - renderingGroupId: number; - emitter: any; - emitRate: number; - manualEmitCount: number; - updateSpeed: number; - targetStopDuration: number; - disposeOnStop: boolean; - minEmitPower: number; - maxEmitPower: number; - minLifeTime: number; - maxLifeTime: number; - minSize: number; - maxSize: number; - minAngularSpeed: number; - maxAngularSpeed: number; - particleTexture: Texture; - layerMask: number; - onDispose: () => void; - updateFunction: (particles: Particle[]) => void; - blendMode: number; - forceDepthWrite: boolean; - gravity: Vector3; - direction1: Vector3; - direction2: Vector3; - minEmitBox: Vector3; - maxEmitBox: Vector3; - color1: Color4; - color2: Color4; - colorDead: Color4; - textureMask: Color4; - startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3) => void; - startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3) => void; - private particles; - private _capacity; - private _scene; - private _vertexDeclaration; - private _vertexStrideSize; - private _stockParticles; - private _newPartsExcess; - private _vertexBuffer; - private _indexBuffer; - private _vertices; - private _effect; - private _customEffect; - private _cachedDefines; - private _scaledColorStep; - private _colorDiff; - private _scaledDirection; - private _scaledGravity; - private _currentRenderId; - private _alive; - private _started; - private _stopped; - private _actualFrame; - private _scaledUpdateSpeed; - constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect); - recycleParticle(particle: Particle): void; - getCapacity(): number; - isAlive(): boolean; - isStarted(): boolean; - start(): void; - stop(): void; - _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void; - private _update(newParticles); - private _getEffect(); - animate(): void; - render(): number; - dispose(): void; - clone(name: string, newEmitter: any): ParticleSystem; - } -} - -declare module BABYLON { - interface IPhysicsEnginePlugin { - initialize(iterations?: number): any; - setGravity(gravity: Vector3): void; - runOneStep(delta: number): void; - registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; - registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; - unregisterMesh(mesh: AbstractMesh): any; - applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; - createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; - dispose(): void; - isSupported(): boolean; - updateBodyPosition(mesh: AbstractMesh): void; - } - interface PhysicsBodyCreationOptions { - mass: number; - friction: number; - restitution: number; - } - interface PhysicsCompoundBodyPart { - mesh: Mesh; - impostor: number; - } - class PhysicsEngine { - gravity: Vector3; - private _currentPlugin; - constructor(plugin?: IPhysicsEnginePlugin); - _initialize(gravity?: Vector3): void; - _runOneStep(delta: number): void; - _setGravity(gravity: Vector3): void; - _registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; - _registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; - _unregisterMesh(mesh: AbstractMesh): void; - _applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; - _createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; - _updateBodyPosition(mesh: AbstractMesh): void; - dispose(): void; - isSupported(): boolean; - static NoImpostor: number; - static SphereImpostor: number; - static BoxImpostor: number; - static PlaneImpostor: number; - static MeshImpostor: number; - static CapsuleImpostor: number; - static ConeImpostor: number; - static CylinderImpostor: number; - static ConvexHullImpostor: number; - static Epsilon: number; - } -} - -declare module BABYLON { - class BoundingBoxRenderer { - frontColor: Color3; - backColor: Color3; - showBackLines: boolean; - renderList: SmartArray; - private _scene; - private _colorShader; - private _vb; - private _ib; - constructor(scene: Scene); - private _prepareRessources(); - reset(): void; - render(): void; - dispose(): void; - } -} - -declare module BABYLON { - class DepthRenderer { - private _scene; - private _depthMap; - private _effect; - private _viewMatrix; - private _projectionMatrix; - private _transformMatrix; - private _worldViewProjection; - private _cachedDefines; - constructor(scene: Scene, type?: number); - isReady(subMesh: SubMesh, useInstances: boolean): boolean; - getDepthMap(): RenderTargetTexture; - dispose(): void; - } -} - -declare module BABYLON { - class EdgesRenderer { - private _source; - private _linesPositions; - private _linesNormals; - private _linesIndices; - private _epsilon; - private _indicesCount; - private _lineShader; - private _vb0; - private _vb1; - private _ib; - private _buffers; - private _checkVerticesInsteadOfIndices; - constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean); - private _prepareRessources(); - dispose(): void; - private _processEdgeForAdjacencies(pa, pb, p0, p1, p2); - private _processEdgeForAdjacenciesWithVertices(pa, pb, p0, p1, p2); - private _checkEdge(faceIndex, edge, faceNormals, p0, p1); - _generateEdgesLines(): void; - render(): void; - } -} - -declare module BABYLON { - class OutlineRenderer { - private _scene; - private _effect; - private _cachedDefines; - constructor(scene: Scene); - render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void; - isReady(subMesh: SubMesh, useInstances: boolean): boolean; - } -} - -declare module BABYLON { - class RenderingGroup { - index: number; - private _scene; - private _opaqueSubMeshes; - private _transparentSubMeshes; - private _alphaTestSubMeshes; - private _activeVertices; - constructor(index: number, scene: Scene); - render(customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray) => void): boolean; - prepare(): void; - dispatch(subMesh: SubMesh): void; - } -} - -declare module BABYLON { - class RenderingManager { - static MAX_RENDERINGGROUPS: number; - private _scene; - private _renderingGroups; - private _depthBufferAlreadyCleaned; - constructor(scene: Scene); - private _renderParticles(index, activeMeshes); - private _renderSprites(index); - private _clearDepthBuffer(); - render(customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray) => void, activeMeshes: AbstractMesh[], renderParticles: boolean, renderSprites: boolean): void; - reset(): void; - dispatch(subMesh: SubMesh): void; - } -} - -declare module BABYLON { - class AnaglyphPostProcess extends PostProcess { - constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare module BABYLON { - class BlackAndWhitePostProcess extends PostProcess { - constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare module BABYLON { - class BlurPostProcess extends PostProcess { - direction: Vector2; - blurWidth: number; - constructor(name: string, direction: Vector2, blurWidth: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare module BABYLON { - class ColorCorrectionPostProcess extends PostProcess { - private _colorTableTexture; - constructor(name: string, colorTableUrl: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare module BABYLON { - class ConvolutionPostProcess extends PostProcess { - kernel: number[]; - constructor(name: string, kernel: number[], ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - static EdgeDetect0Kernel: number[]; - static EdgeDetect1Kernel: number[]; - static EdgeDetect2Kernel: number[]; - static SharpenKernel: number[]; - static EmbossKernel: number[]; - static GaussianKernel: number[]; - } -} - -declare module BABYLON { - class DisplayPassPostProcess extends PostProcess { - constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare module BABYLON { - class FilterPostProcess extends PostProcess { - kernelMatrix: Matrix; - constructor(name: string, kernelMatrix: Matrix, ratio: number, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare module BABYLON { - class FxaaPostProcess extends PostProcess { - texelWidth: number; - texelHeight: number; - constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare module BABYLON { - class HDRRenderingPipeline extends PostProcessRenderPipeline implements IDisposable { - /** - * Public members - */ - /** - * Gaussian blur coefficient - * @type {number} - */ - gaussCoeff: number; - /** - * Gaussian blur mean - * @type {number} - */ - gaussMean: number; - /** - * Gaussian blur standard deviation - * @type {number} - */ - gaussStandDev: number; - /** - * Exposure, controls the overall intensity of the pipeline - * @type {number} - */ - exposure: number; - /** - * Minimum luminance that the post-process can output. Luminance is >= 0 - * @type {number} - */ - minimumLuminance: number; - /** - * Maximum luminance that the post-process can output. Must be suprerior to minimumLuminance - * @type {number} - */ - maximumLuminance: number; - /** - * Increase rate for luminance: eye adaptation speed to dark - * @type {number} - */ - luminanceIncreaserate: number; - /** - * Decrease rate for luminance: eye adaptation speed to bright - * @type {number} - */ - luminanceDecreaseRate: number; - /** - * Minimum luminance needed to compute HDR - * @type {number} - */ - brightThreshold: number; - /** - * Private members - */ - private _guassianBlurHPostProcess; - private _guassianBlurVPostProcess; - private _brightPassPostProcess; - private _textureAdderPostProcess; - private _downSampleX4PostProcess; - private _originalPostProcess; - private _hdrPostProcess; - private _hdrCurrentLuminance; - private _hdrOutputLuminance; - static LUM_STEPS: number; - private _downSamplePostProcesses; - private _scene; - private _needUpdate; - /** - * @constructor - * @param {string} name - The rendering pipeline name - * @param {BABYLON.Scene} scene - The scene linked to this pipeline - * @param {any} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) - * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null. - * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to - */ - constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]); - /** - * Tells the pipeline to update its post-processes - */ - update(): void; - /** - * Returns the current calculated luminance - */ - getCurrentLuminance(): number; - /** - * Returns the currently drawn luminance - */ - getOutputLuminance(): number; - /** - * Releases the rendering pipeline and its internal effects. Detaches pipeline from cameras - */ - dispose(): void; - /** - * Creates the HDR post-process and computes the luminance adaptation - */ - private _createHDRPostProcess(scene, ratio); - /** - * Texture Adder post-process - */ - private _createTextureAdderPostProcess(scene, ratio); - /** - * Down sample X4 post-process - */ - private _createDownSampleX4PostProcess(scene, ratio); - /** - * Bright pass post-process - */ - private _createBrightPassPostProcess(scene, ratio); - /** - * Luminance generator. Creates the luminance post-process and down sample post-processes - */ - private _createLuminanceGeneratorPostProcess(scene); - /** - * Gaussian blur post-processes. Horizontal and Vertical - */ - private _createGaussianBlurPostProcess(scene, ratio); - } -} - -declare module BABYLON { - class LensRenderingPipeline extends PostProcessRenderPipeline { - /** - * The chromatic aberration PostProcess id in the pipeline - * @type {string} - */ - LensChromaticAberrationEffect: string; - /** - * The highlights enhancing PostProcess id in the pipeline - * @type {string} - */ - HighlightsEnhancingEffect: string; - /** - * The depth-of-field PostProcess id in the pipeline - * @type {string} - */ - LensDepthOfFieldEffect: string; - private _scene; - private _depthTexture; - private _grainTexture; - private _chromaticAberrationPostProcess; - private _highlightsPostProcess; - private _depthOfFieldPostProcess; - private _edgeBlur; - private _grainAmount; - private _chromaticAberration; - private _distortion; - private _highlightsGain; - private _highlightsThreshold; - private _dofDistance; - private _dofAperture; - private _dofDarken; - private _dofPentagon; - private _blurNoise; - /** - * @constructor - * - * Effect parameters are as follow: - * { - * chromatic_aberration: number; // from 0 to x (1 for realism) - * edge_blur: number; // from 0 to x (1 for realism) - * distortion: number; // from 0 to x (1 for realism) - * grain_amount: number; // from 0 to 1 - * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise - * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default) - * dof_aperture: number; // depth-of-field: focus blur bias (default: 1) - * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default) - * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like "bokeh" effect - * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default) - * dof_threshold: number; // depth-of-field: highlights threshold (default: 1) - * blur_noise: boolean; // add a little bit of noise to the blur (default: true) - * } - * Note: if an effect parameter is unset, effect is disabled - * - * @param {string} name - The rendering pipeline name - * @param {object} parameters - An object containing all parameters (see above) - * @param {BABYLON.Scene} scene - The scene linked to this pipeline - * @param {number} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) - * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to - */ - constructor(name: string, parameters: any, scene: Scene, ratio?: number, cameras?: Camera[]); - setEdgeBlur(amount: number): void; - disableEdgeBlur(): void; - setGrainAmount(amount: number): void; - disableGrain(): void; - setChromaticAberration(amount: number): void; - disableChromaticAberration(): void; - setEdgeDistortion(amount: number): void; - disableEdgeDistortion(): void; - setFocusDistance(amount: number): void; - disableDepthOfField(): void; - setAperture(amount: number): void; - setDarkenOutOfFocus(amount: number): void; - enablePentagonBokeh(): void; - disablePentagonBokeh(): void; - enableNoiseBlur(): void; - disableNoiseBlur(): void; - setHighlightsGain(amount: number): void; - setHighlightsThreshold(amount: number): void; - disableHighlights(): void; - /** - * Removes the internal pipeline assets and detaches the pipeline from the scene cameras - */ - dispose(disableDepthRender?: boolean): void; - private _createChromaticAberrationPostProcess(ratio); - private _createHighlightsPostProcess(ratio); - private _createDepthOfFieldPostProcess(ratio); - private _createGrainTexture(); - } -} - -declare module BABYLON { - class PassPostProcess extends PostProcess { - constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - } -} - -declare module BABYLON { - class PostProcess { - name: string; - onApply: (effect: Effect) => void; - onBeforeRender: (effect: Effect) => void; - onAfterRender: (effect: Effect) => void; - onSizeChanged: () => void; - onActivate: (camera: Camera) => void; - width: number; - height: number; - renderTargetSamplingMode: number; - clearColor: Color4; - private _camera; - private _scene; - private _engine; - private _renderRatio; - private _reusable; - private _textureType; - _textures: SmartArray; - _currentRenderTextureInd: number; - private _effect; - constructor(name: string, fragmentUrl: string, parameters: string[], samplers: string[], ratio: number | any, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, defines?: string, textureType?: number); - isReusable(): boolean; - activate(camera: Camera, sourceTexture?: WebGLTexture): void; - apply(): Effect; - dispose(camera?: Camera): void; - } -} - -declare module BABYLON { - class PostProcessManager { - private _scene; - private _indexBuffer; - private _vertexDeclaration; - private _vertexStrideSize; - private _vertexBuffer; - constructor(scene: Scene); - private _prepareBuffers(); - _prepareFrame(sourceTexture?: WebGLTexture): boolean; - directRender(postProcesses: PostProcess[], targetTexture?: WebGLTexture): void; - _finalizeFrame(doNotPresent?: boolean, targetTexture?: WebGLTexture, postProcesses?: PostProcess[]): void; - dispose(): void; - } -} - -declare module BABYLON { - class RefractionPostProcess extends PostProcess { - color: Color3; - depth: number; - colorLevel: number; - private _refRexture; - constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); - dispose(camera: Camera): void; - } -} - -declare module BABYLON { - class SSAORenderingPipeline extends PostProcessRenderPipeline { - /** - * The PassPostProcess id in the pipeline that contains the original scene color - * @type {string} - */ - SSAOOriginalSceneColorEffect: string; - /** - * The SSAO PostProcess id in the pipeline - * @type {string} - */ - SSAORenderEffect: string; - /** - * The horizontal blur PostProcess id in the pipeline - * @type {string} - */ - SSAOBlurHRenderEffect: string; - /** - * The vertical blur PostProcess id in the pipeline - * @type {string} - */ - SSAOBlurVRenderEffect: string; - /** - * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect) - * @type {string} - */ - SSAOCombineRenderEffect: string; - /** - * The output strength of the SSAO post-process. Default value is 1.0. - * @type {number} - */ - totalStrength: number; - /** - * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0002 - * @type {number} - */ - radius: number; - /** - * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel - * Must not be equal to fallOff and superior to fallOff. - * Default value is 0.0075 - * @type {number} - */ - area: number; - /** - * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel - * Must not be equal to area and inferior to area. - * Default value is 0.0002 - * @type {number} - */ - fallOff: number; - private _scene; - private _depthTexture; - private _randomTexture; - private _originalColorPostProcess; - private _ssaoPostProcess; - private _blurHPostProcess; - private _blurVPostProcess; - private _ssaoCombinePostProcess; - private _firstUpdate; - /** - * @constructor - * @param {string} name - The rendering pipeline name - * @param {BABYLON.Scene} scene - The scene linked to this pipeline - * @param {any} ratio - The size of the postprocesses. Can be a number shared between passes or an object for more precision: { ssaoRatio: 0.5, combineRatio: 1.0 } - * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to - */ - constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]); - /** - * Returns the horizontal blur PostProcess - * @return {BABYLON.BlurPostProcess} The horizontal blur post-process - */ - getBlurHPostProcess(): BlurPostProcess; - /** - * Returns the vertical blur PostProcess - * @return {BABYLON.BlurPostProcess} The vertical blur post-process - */ - getBlurVPostProcess(): BlurPostProcess; - /** - * Removes the internal pipeline assets and detatches the pipeline from the scene cameras - */ - dispose(disableDepthRender?: boolean): void; - private _createSSAOPostProcess(ratio); - private _createSSAOCombinePostProcess(ratio); - private _createRandomTexture(); - } -} - -declare module BABYLON { - class StereoscopicInterlacePostProcess extends PostProcess { - private _stepSize; - constructor(name: string, camB: Camera, postProcessA: PostProcess, isStereoscopicHoriz: boolean, samplingMode?: number); - } -} - -declare module BABYLON { - enum TonemappingOperator { - Hable = 0, - Reinhard = 1, - HejiDawson = 2, - Photographic = 3, - } - class TonemapPostProcess extends PostProcess { - private _operator; - private _exposureAdjustment; - constructor(name: string, operator: TonemappingOperator, exposureAdjustment: number, camera: Camera, samplingMode?: number, engine?: Engine, textureFormat?: number); - } -} - -declare module BABYLON { - class VolumetricLightScatteringPostProcess extends PostProcess { - private _volumetricLightScatteringPass; - private _volumetricLightScatteringRTT; - private _viewPort; - private _screenCoordinates; - private _cachedDefines; - private _customMeshPosition; - /** - * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false) - * @type {boolean} - */ - useCustomMeshPosition: boolean; - /** - * If the post-process should inverse the light scattering direction - * @type {boolean} - */ - invert: boolean; - /** - * The internal mesh used by the post-process - * @type {boolean} - */ - mesh: Mesh; - /** - * Set to true to use the diffuseColor instead of the diffuseTexture - * @type {boolean} - */ - useDiffuseColor: boolean; - /** - * Array containing the excluded meshes not rendered in the internal pass - */ - excludedMeshes: AbstractMesh[]; - /** - * Controls the overall intensity of the post-process - * @type {number} - */ - exposure: number; - /** - * Dissipates each sample's contribution in range [0, 1] - * @type {number} - */ - decay: number; - /** - * Controls the overall intensity of each sample - * @type {number} - */ - weight: number; - /** - * Controls the density of each sample - * @type {number} - */ - density: number; - /** - * @constructor - * @param {string} name - The post-process name - * @param {any} ratio - The size of the post-process and/or internal pass (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) - * @param {BABYLON.Camera} camera - The camera that the post-process will be attached to - * @param {BABYLON.Mesh} mesh - The mesh used to create the light scattering - * @param {number} samples - The post-process quality, default 100 - * @param {number} samplingMode - The post-process filtering mode - * @param {BABYLON.Engine} engine - The babylon engine - * @param {boolean} reusable - If the post-process is reusable - * @param {BABYLON.Scene} scene - The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided - */ - constructor(name: string, ratio: any, camera: Camera, mesh?: Mesh, samples?: number, samplingMode?: number, engine?: Engine, reusable?: boolean, scene?: Scene); - isReady(subMesh: SubMesh, useInstances: boolean): boolean; - /** - * Sets the new light position for light scattering effect - * @param {BABYLON.Vector3} The new custom light position - */ - setCustomMeshPosition(position: Vector3): void; - /** - * Returns the light position for light scattering effect - * @return {BABYLON.Vector3} The custom light position - */ - getCustomMeshPosition(): Vector3; - /** - * Disposes the internal assets and detaches the post-process from the camera - */ - dispose(camera: Camera): void; - /** - * Returns the render target texture used by the post-process - * @return {BABYLON.RenderTargetTexture} The render target texture used by the post-process - */ - getPass(): RenderTargetTexture; - private _meshExcluded(mesh); - private _createPass(scene, ratio); - private _updateMeshScreenCoordinates(scene); - /** - * Creates a default mesh for the Volumeric Light Scattering post-process - * @param {string} The mesh name - * @param {BABYLON.Scene} The scene where to create the mesh - * @return {BABYLON.Mesh} the default mesh - */ - static CreateDefaultMesh(name: string, scene: Scene): Mesh; - } -} - -declare module BABYLON { - class VRDistortionCorrectionPostProcess extends PostProcess { - aspectRatio: number; - private _isRightEye; - private _distortionFactors; - private _postProcessScaleFactor; - private _lensCenterOffset; - private _scaleIn; - private _scaleFactor; - private _lensCenter; - constructor(name: string, camera: Camera, isRightEye: boolean, vrMetrics: VRCameraMetrics); - } -} - -declare module BABYLON { - class Sprite { - name: string; - position: Vector3; - color: Color4; - width: number; - height: number; - angle: number; - cellIndex: number; - invertU: number; - invertV: number; - disposeWhenFinishedAnimating: boolean; - animations: Animation[]; - private _animationStarted; - private _loopAnimation; - private _fromIndex; - private _toIndex; - private _delay; - private _direction; - private _frameCount; - private _manager; - private _time; - size: number; - constructor(name: string, manager: SpriteManager); - playAnimation(from: number, to: number, loop: boolean, delay: number): void; - stopAnimation(): void; - _animate(deltaTime: number): void; - dispose(): void; - } -} - -declare module BABYLON { - class SpriteManager { - name: string; - cellSize: number; - sprites: Sprite[]; - renderingGroupId: number; - layerMask: number; - onDispose: () => void; - fogEnabled: boolean; - private _capacity; - private _spriteTexture; - private _epsilon; - private _scene; - private _vertexDeclaration; - private _vertexStrideSize; - private _vertexBuffer; - private _indexBuffer; - private _vertices; - private _effectBase; - private _effectFog; - constructor(name: string, imgUrl: string, capacity: number, cellSize: number, scene: Scene, epsilon?: number, samplingMode?: number); - private _appendSpriteVertex(index, sprite, offsetX, offsetY, rowSize); - render(): void; - dispose(): void; - } -} - -declare module BABYLON.Internals { - class AndOrNotEvaluator { - static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean; - private static _HandleParenthesisContent(parenthesisContent, evaluateCallback); - private static _SimplifyNegation(booleanString); - } -} - -declare module BABYLON { - interface IAssetTask { - onSuccess: (task: IAssetTask) => void; - onError: (task: IAssetTask) => void; - isCompleted: boolean; - run(scene: Scene, onSuccess: () => void, onError: () => void): any; - } - class MeshAssetTask implements IAssetTask { - name: string; - meshesNames: any; - rootUrl: string; - sceneFilename: string; - loadedMeshes: Array; - loadedParticleSystems: Array; - loadedSkeletons: Array; - onSuccess: (task: IAssetTask) => void; - onError: (task: IAssetTask) => void; - isCompleted: boolean; - constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string); - run(scene: Scene, onSuccess: () => void, onError: () => void): void; - } - class TextFileAssetTask implements IAssetTask { - name: string; - url: string; - onSuccess: (task: IAssetTask) => void; - onError: (task: IAssetTask) => void; - isCompleted: boolean; - text: string; - constructor(name: string, url: string); - run(scene: Scene, onSuccess: () => void, onError: () => void): void; - } - class BinaryFileAssetTask implements IAssetTask { - name: string; - url: string; - onSuccess: (task: IAssetTask) => void; - onError: (task: IAssetTask) => void; - isCompleted: boolean; - data: ArrayBuffer; - constructor(name: string, url: string); - run(scene: Scene, onSuccess: () => void, onError: () => void): void; - } - class ImageAssetTask implements IAssetTask { - name: string; - url: string; - onSuccess: (task: IAssetTask) => void; - onError: (task: IAssetTask) => void; - isCompleted: boolean; - image: HTMLImageElement; - constructor(name: string, url: string); - run(scene: Scene, onSuccess: () => void, onError: () => void): void; - } - class TextureAssetTask implements IAssetTask { - name: string; - url: string; - noMipmap: boolean; - invertY: boolean; - samplingMode: number; - onSuccess: (task: IAssetTask) => void; - onError: (task: IAssetTask) => void; - isCompleted: boolean; - texture: Texture; - constructor(name: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number); - run(scene: Scene, onSuccess: () => void, onError: () => void): void; - } - class AssetsManager { - private _tasks; - private _scene; - private _waitingTasksCount; - onFinish: (tasks: IAssetTask[]) => void; - onTaskSuccess: (task: IAssetTask) => void; - onTaskError: (task: IAssetTask) => void; - useDefaultLoadingScreen: boolean; - constructor(scene: Scene); - addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): IAssetTask; - addTextFileTask(taskName: string, url: string): IAssetTask; - addBinaryFileTask(taskName: string, url: string): IAssetTask; - addImageTask(taskName: string, url: string): IAssetTask; - addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): IAssetTask; - private _decreaseWaitingTasksCount(); - private _runTask(task); - reset(): AssetsManager; - load(): AssetsManager; - } -} - -declare module BABYLON { - class Database { - private callbackManifestChecked; - private currentSceneUrl; - private db; - private enableSceneOffline; - private enableTexturesOffline; - private manifestVersionFound; - private mustUpdateRessources; - private hasReachedQuota; - private isSupported; - private idbFactory; - static IsUASupportingBlobStorage: boolean; - static IDBStorageEnabled: boolean; - constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any); - static parseURL: (url: string) => string; - static ReturnFullUrlLocation: (url: string) => string; - checkManifestFile(): void; - openAsync(successCallback: any, errorCallback: any): void; - loadImageFromDB(url: string, image: HTMLImageElement): void; - private _loadImageFromDBAsync(url, image, notInDBCallback); - private _saveImageIntoDBAsync(url, image); - private _checkVersionFromDB(url, versionLoaded); - private _loadVersionFromDBAsync(url, callback, updateInDBCallback); - private _saveVersionIntoDBAsync(url, callback); - private loadFileFromDB(url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer?); - private _loadFileFromDBAsync(url, callback, notInDBCallback, useArrayBuffer?); - private _saveFileIntoDBAsync(url, callback, progressCallback, useArrayBuffer?); - } -} - -declare module BABYLON { - class FilesInput { - private _engine; - private _currentScene; - private _canvas; - private _sceneLoadedCallback; - private _progressCallback; - private _additionnalRenderLoopLogicCallback; - private _textureLoadingCallback; - private _startingProcessingFilesCallback; - private _elementToMonitor; - static FilesTextures: any[]; - static FilesToLoad: any[]; - private _sceneFileToLoad; - private _filesToLoad; - constructor(p_engine: Engine, p_scene: Scene, p_canvas: HTMLCanvasElement, p_sceneLoadedCallback: any, p_progressCallback: any, p_additionnalRenderLoopLogicCallback: any, p_textureLoadingCallback: any, p_startingProcessingFilesCallback: any); - monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void; - private renderFunction(); - private drag(e); - private drop(eventDrop); - loadFiles(event: any): void; - reload(): void; - } -} - -declare module BABYLON { - class Gamepads { - private babylonGamepads; - private oneGamepadConnected; - private isMonitoring; - private gamepadEventSupported; - private gamepadSupportAvailable; - private _callbackGamepadConnected; - private buttonADataURL; - private static gamepadDOMInfo; - constructor(ongamedpadconnected: (gamepad: Gamepad) => void); - private _insertGamepadDOMInstructions(); - private _insertGamepadDOMNotSupported(); - dispose(): void; - private _onGamepadConnected(evt); - private _addNewGamepad(gamepad); - private _onGamepadDisconnected(evt); - private _startMonitoringGamepads(); - private _stopMonitoringGamepads(); - private _checkGamepadsStatus(); - private _updateGamepadObjects(); - } - class StickValues { - x: any; - y: any; - constructor(x: any, y: any); - } - class Gamepad { - id: string; - index: number; - browserGamepad: any; - private _leftStick; - private _rightStick; - private _onleftstickchanged; - private _onrightstickchanged; - constructor(id: string, index: number, browserGamepad: any); - onleftstickchanged(callback: (values: StickValues) => void): void; - onrightstickchanged(callback: (values: StickValues) => void): void; - leftStick: StickValues; - rightStick: StickValues; - update(): void; - } - class GenericPad extends Gamepad { - id: string; - index: number; - gamepad: any; - private _buttons; - private _onbuttondown; - private _onbuttonup; - onbuttondown(callback: (buttonPressed: number) => void): void; - onbuttonup(callback: (buttonReleased: number) => void): void; - constructor(id: string, index: number, gamepad: any); - private _setButtonValue(newValue, currentValue, buttonIndex); - update(): void; - } - enum Xbox360Button { - A = 0, - B = 1, - X = 2, - Y = 3, - Start = 4, - Back = 5, - LB = 6, - RB = 7, - LeftStick = 8, - RightStick = 9, - } - enum Xbox360Dpad { - Up = 0, - Down = 1, - Left = 2, - Right = 3, - } - class Xbox360Pad extends Gamepad { - private _leftTrigger; - private _rightTrigger; - private _onlefttriggerchanged; - private _onrighttriggerchanged; - private _onbuttondown; - private _onbuttonup; - private _ondpaddown; - private _ondpadup; - private _buttonA; - private _buttonB; - private _buttonX; - private _buttonY; - private _buttonBack; - private _buttonStart; - private _buttonLB; - private _buttonRB; - private _buttonLeftStick; - private _buttonRightStick; - private _dPadUp; - private _dPadDown; - private _dPadLeft; - private _dPadRight; - onlefttriggerchanged(callback: (value: number) => void): void; - onrighttriggerchanged(callback: (value: number) => void): void; - leftTrigger: number; - rightTrigger: number; - onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void; - onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void; - ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void; - ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void; - private _setButtonValue(newValue, currentValue, buttonType); - private _setDPadValue(newValue, currentValue, buttonType); - buttonA: number; - buttonB: number; - buttonX: number; - buttonY: number; - buttonStart: number; - buttonBack: number; - buttonLB: number; - buttonRB: number; - buttonLeftStick: number; - buttonRightStick: number; - dPadUp: number; - dPadDown: number; - dPadLeft: number; - dPadRight: number; - update(): void; - } -} -interface Navigator { - getGamepads(func?: any): any; - webkitGetGamepads(func?: any): any; - msGetGamepads(func?: any): any; - webkitGamepads(func?: any): any; -} - -declare module BABYLON { - class SceneOptimization { - priority: number; - apply: (scene: Scene) => boolean; - constructor(priority?: number); - } - class TextureOptimization extends SceneOptimization { - priority: number; - maximumSize: number; - constructor(priority?: number, maximumSize?: number); - apply: (scene: Scene) => boolean; - } - class HardwareScalingOptimization extends SceneOptimization { - priority: number; - maximumScale: number; - private _currentScale; - constructor(priority?: number, maximumScale?: number); - apply: (scene: Scene) => boolean; - } - class ShadowsOptimization extends SceneOptimization { - apply: (scene: Scene) => boolean; - } - class PostProcessesOptimization extends SceneOptimization { - apply: (scene: Scene) => boolean; - } - class LensFlaresOptimization extends SceneOptimization { - apply: (scene: Scene) => boolean; - } - class ParticlesOptimization extends SceneOptimization { - apply: (scene: Scene) => boolean; - } - class RenderTargetsOptimization extends SceneOptimization { - apply: (scene: Scene) => boolean; - } - class MergeMeshesOptimization extends SceneOptimization { - static _UpdateSelectionTree: boolean; - static UpdateSelectionTree: boolean; - private _canBeMerged; - apply: (scene: Scene, updateSelectionTree?: boolean) => boolean; - } - class SceneOptimizerOptions { - targetFrameRate: number; - trackerDuration: number; - optimizations: SceneOptimization[]; - constructor(targetFrameRate?: number, trackerDuration?: number); - static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; - static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; - static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; - } - class SceneOptimizer { - static _CheckCurrentState(scene: Scene, options: SceneOptimizerOptions, currentPriorityLevel: number, onSuccess?: () => void, onFailure?: () => void): void; - static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): void; - } -} - -declare module BABYLON { - class SceneSerializer { - static Serialize(scene: Scene): any; - static SerializeMesh(toSerialize: any, withParents?: boolean, withChildren?: boolean): any; - } -} - -declare module BABYLON { - class SmartArray { - data: Array; - length: number; - private _id; - private _duplicateId; - constructor(capacity: number); - push(value: any): void; - pushNoDuplicate(value: any): void; - sort(compareFn: any): void; - reset(): void; - concat(array: any): void; - concatWithNoDuplicate(array: any): void; - indexOf(value: any): number; - private static _GlobalId; - } -} - -declare module BABYLON { - class SmartCollection { - count: number; - items: any; - private _keys; - private _initialCapacity; - constructor(capacity?: number); - add(key: any, item: any): number; - remove(key: any): number; - removeItemOfIndex(index: number): number; - indexOf(key: any): number; - item(key: any): any; - getAllKeys(): any[]; - getKeyByIndex(index: number): any; - getItemByIndex(index: number): any; - empty(): void; - forEach(block: (item: any) => void): void; - } -} - -declare module BABYLON { - class Tags { - static EnableFor(obj: any): void; - static DisableFor(obj: any): void; - static HasTags(obj: any): boolean; - static GetTags(obj: any): any; - static AddTagsTo(obj: any, tagsString: string): void; - static _AddTagTo(obj: any, tag: string): void; - static RemoveTagsFrom(obj: any, tagsString: string): void; - static _RemoveTagFrom(obj: any, tag: string): void; - static MatchesQuery(obj: any, tagsQuery: string): boolean; - } -} - -declare module BABYLON.Internals { - interface DDSInfo { - width: number; - height: number; - mipmapCount: number; - isFourCC: boolean; - isRGB: boolean; - isLuminance: boolean; - isCube: boolean; - } - class DDSTools { - static GetDDSInfo(arrayBuffer: any): DDSInfo; - private static GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); - private static GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); - private static GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); - static UploadDDSLevels(gl: WebGLRenderingContext, ext: any, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number): void; - } -} - -declare module BABYLON.Internals { - class TGATools { - private static _TYPE_NO_DATA; - private static _TYPE_INDEXED; - private static _TYPE_RGB; - private static _TYPE_GREY; - private static _TYPE_RLE_INDEXED; - private static _TYPE_RLE_RGB; - private static _TYPE_RLE_GREY; - private static _ORIGIN_MASK; - private static _ORIGIN_SHIFT; - private static _ORIGIN_BL; - private static _ORIGIN_BR; - private static _ORIGIN_UL; - private static _ORIGIN_UR; - static GetTGAHeader(data: Uint8Array): any; - static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void; - static _getImageData8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; - static _getImageData16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; - static _getImageData24bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; - static _getImageData32bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; - static _getImageDataGrey8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; - static _getImageDataGrey16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; - } -} - -declare module BABYLON { - interface IAnimatable { - animations: Array; - } - interface ISize { - width: number; - height: number; - } - class Tools { - static BaseUrl: string; - static ToHex(i: number): string; - static SetImmediate(action: () => void): void; - static IsExponantOfTwo(value: number): boolean; - static GetExponantOfTwo(value: number, max: number): number; - static GetFilename(path: string): string; - static GetDOMTextContent(element: HTMLElement): string; - static ToDegrees(angle: number): number; - static ToRadians(angle: number): number; - static ExtractMinAndMaxIndexed(positions: number[], indices: number[], indexStart: number, indexCount: number): { - minimum: Vector3; - maximum: Vector3; - }; - static ExtractMinAndMax(positions: number[], start: number, count: number): { - minimum: Vector3; - maximum: Vector3; - }; - static MakeArray(obj: any, allowsNullUndefined?: boolean): Array; - static GetPointerPrefix(): string; - static QueueNewFrame(func: any): void; - static RequestFullscreen(element: any): void; - static ExitFullscreen(): void; - static CleanUrl(url: string): string; - static LoadImage(url: string, onload: any, onerror: any, database: any): HTMLImageElement; - static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: () => void, database?: any, useArrayBuffer?: boolean, onError?: () => void): void; - static ReadFileAsDataURL(fileToLoad: any, callback: any, progressCallback: any): void; - static ReadFile(fileToLoad: any, callback: any, progressCallBack: any, useArrayBuffer?: boolean): void; - static Clamp(value: number, min?: number, max?: number): number; - static Sign(value: number): number; - static Format(value: number, decimals?: number): string; - static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void; - static WithinEpsilon(a: number, b: number, epsilon?: number): boolean; - static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void; - static IsEmpty(obj: any): boolean; - static RegisterTopRootEvents(events: { - name: string; - handler: EventListener; - }[]): void; - static UnregisterTopRootEvents(events: { - name: string; - handler: EventListener; - }[]): void; - static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: String) => void): void; - static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: String) => void): void; - static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean; - private static _NoneLogLevel; - private static _MessageLogLevel; - private static _WarningLogLevel; - private static _ErrorLogLevel; - private static _LogCache; - static errorsCount: number; - static OnNewCacheEntry: (entry: string) => void; - static NoneLogLevel: number; - static MessageLogLevel: number; - static WarningLogLevel: number; - static ErrorLogLevel: number; - static AllLogLevel: number; - private static _AddLogEntry(entry); - private static _FormatMessage(message); - static Log: (message: string) => void; - private static _LogDisabled(message); - private static _LogEnabled(message); - static Warn: (message: string) => void; - private static _WarnDisabled(message); - private static _WarnEnabled(message); - static Error: (message: string) => void; - private static _ErrorDisabled(message); - private static _ErrorEnabled(message); - static LogCache: string; - static ClearLogCache(): void; - static LogLevels: number; - private static _PerformanceNoneLogLevel; - private static _PerformanceUserMarkLogLevel; - private static _PerformanceConsoleLogLevel; - private static _performance; - static PerformanceNoneLogLevel: number; - static PerformanceUserMarkLogLevel: number; - static PerformanceConsoleLogLevel: number; - static PerformanceLogLevel: number; - static _StartPerformanceCounterDisabled(counterName: string, condition?: boolean): void; - static _EndPerformanceCounterDisabled(counterName: string, condition?: boolean): void; - static _StartUserMark(counterName: string, condition?: boolean): void; - static _EndUserMark(counterName: string, condition?: boolean): void; - static _StartPerformanceConsole(counterName: string, condition?: boolean): void; - static _EndPerformanceConsole(counterName: string, condition?: boolean): void; - static StartPerformanceCounter: (counterName: string, condition?: boolean) => void; - static EndPerformanceCounter: (counterName: string, condition?: boolean) => void; - static Now: number; - static GetFps(): number; - } - /** - * An implementation of a loop for asynchronous functions. - */ - class AsyncLoop { - iterations: number; - private _fn; - private _successCallback; - index: number; - private _done; - /** - * Constroctor. - * @param iterations the number of iterations. - * @param _fn the function to run each iteration - * @param _successCallback the callback that will be called upon succesful execution - * @param offset starting offset. - */ - constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number); - /** - * Execute the next iteration. Must be called after the last iteration was finished. - */ - executeNext(): void; - /** - * Break the loop and run the success callback. - */ - breakLoop(): void; - /** - * Helper function - */ - static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop; - /** - * A for-loop that will run a given number of iterations synchronous and the rest async. - * @param iterations total number of iterations - * @param syncedIterations number of synchronous iterations in each async iteration. - * @param fn the function to call each iteration. - * @param callback a success call back that will be called when iterating stops. - * @param breakFunction a break condition (optional) - * @param timeout timeout settings for the setTimeout function. default - 0. - * @constructor - */ - static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void; - } -} - -declare module BABYLON { - enum JoystickAxis { - X = 0, - Y = 1, - Z = 2, - } - class VirtualJoystick { - reverseLeftRight: boolean; - reverseUpDown: boolean; - deltaPosition: Vector3; - pressed: boolean; - private static _globalJoystickIndex; - private static vjCanvas; - private static vjCanvasContext; - private static vjCanvasWidth; - private static vjCanvasHeight; - private static halfWidth; - private static halfHeight; - private _action; - private _axisTargetedByLeftAndRight; - private _axisTargetedByUpAndDown; - private _joystickSensibility; - private _inversedSensibility; - private _rotationSpeed; - private _inverseRotationSpeed; - private _rotateOnAxisRelativeToMesh; - private _joystickPointerID; - private _joystickColor; - private _joystickPointerPos; - private _joystickPreviousPointerPos; - private _joystickPointerStartPos; - private _deltaJoystickVector; - private _leftJoystick; - private _joystickIndex; - private _touches; - private _onPointerDownHandlerRef; - private _onPointerMoveHandlerRef; - private _onPointerUpHandlerRef; - private _onPointerOutHandlerRef; - private _onResize; - constructor(leftJoystick?: boolean); - setJoystickSensibility(newJoystickSensibility: number): void; - private _onPointerDown(e); - private _onPointerMove(e); - private _onPointerUp(e); - /** - * Change the color of the virtual joystick - * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000") - */ - setJoystickColor(newColor: string): void; - setActionOnTouch(action: () => any): void; - setAxisForLeftRight(axis: JoystickAxis): void; - setAxisForUpDown(axis: JoystickAxis): void; - private _clearCanvas(); - private _drawVirtualJoystick(); - releaseCanvas(): void; - } -} - -declare module BABYLON { - class VRDeviceOrientationFreeCamera extends FreeCamera { - _alpha: number; - _beta: number; - _gamma: number; - private _offsetOrientation; - private _deviceOrientationHandler; - constructor(name: string, position: Vector3, scene: Scene, compensateDistorsion?: boolean); - _onOrientationEvent(evt: DeviceOrientationEvent): void; - attachControl(element: HTMLElement, noPreventDefault?: boolean): void; - detachControl(element: HTMLElement): void; - } -} - -declare var HMDVRDevice: any; -declare var PositionSensorVRDevice: any; -declare module BABYLON { - class WebVRFreeCamera extends FreeCamera { - _hmdDevice: any; - _sensorDevice: any; - _cacheState: any; - _cacheQuaternion: Quaternion; - _cacheRotation: Vector3; - _vrEnabled: boolean; - constructor(name: string, position: Vector3, scene: Scene, compensateDistorsion?: boolean); - private _getWebVRDevices(devices); - _checkInputs(): void; - attachControl(element: HTMLElement, noPreventDefault?: boolean): void; - detachControl(element: HTMLElement): void; - } -} - -declare module BABYLON { - interface IOctreeContainer { - blocks: Array>; - } - class Octree { - maxDepth: number; - blocks: Array>; - dynamicContent: T[]; - private _maxBlockCapacity; - private _selectionContent; - private _creationFunc; - constructor(creationFunc: (entry: T, block: OctreeBlock) => void, maxBlockCapacity?: number, maxDepth?: number); - update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void; - addMesh(entry: T): void; - select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray; - intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray; - intersectsRay(ray: Ray): SmartArray; - static _CreateBlocks(worldMin: Vector3, worldMax: Vector3, entries: T[], maxBlockCapacity: number, currentDepth: number, maxDepth: number, target: IOctreeContainer, creationFunc: (entry: T, block: OctreeBlock) => void): void; - static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock) => void; - static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock) => void; - } -} - -declare module BABYLON { - class OctreeBlock { - entries: T[]; - blocks: Array>; - private _depth; - private _maxDepth; - private _capacity; - private _minPoint; - private _maxPoint; - private _boundingVectors; - private _creationFunc; - constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock) => void); - capacity: number; - minPoint: Vector3; - maxPoint: Vector3; - addEntry(entry: T): void; - addEntries(entries: T[]): void; - select(frustumPlanes: Plane[], selection: SmartArray, allowDuplicate?: boolean): void; - intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray, allowDuplicate?: boolean): void; - intersectsRay(ray: Ray, selection: SmartArray): void; - createInnerBlocks(): void; - } -} - -declare module BABYLON { - class ShadowGenerator { - private static _FILTER_NONE; - private static _FILTER_VARIANCESHADOWMAP; - private static _FILTER_POISSONSAMPLING; - private static _FILTER_BLURVARIANCESHADOWMAP; - static FILTER_NONE: number; - static FILTER_VARIANCESHADOWMAP: number; - static FILTER_POISSONSAMPLING: number; - static FILTER_BLURVARIANCESHADOWMAP: number; - private _filter; - blurScale: number; - private _blurBoxOffset; - private _bias; - private _lightDirection; - bias: number; - blurBoxOffset: number; - filter: number; - useVarianceShadowMap: boolean; - usePoissonSampling: boolean; - useBlurVarianceShadowMap: boolean; - private _light; - private _scene; - private _shadowMap; - private _shadowMap2; - private _darkness; - private _transparencyShadow; - private _effect; - private _viewMatrix; - private _projectionMatrix; - private _transformMatrix; - private _worldViewProjection; - private _cachedPosition; - private _cachedDirection; - private _cachedDefines; - private _currentRenderID; - private _downSamplePostprocess; - private _boxBlurPostprocess; - private _mapSize; - constructor(mapSize: number, light: IShadowLight); - isReady(subMesh: SubMesh, useInstances: boolean): boolean; - getShadowMap(): RenderTargetTexture; - getShadowMapForRendering(): RenderTargetTexture; - getLight(): IShadowLight; - getTransformMatrix(): Matrix; - getDarkness(): number; - setDarkness(darkness: number): void; - setTransparencyShadow(hasShadow: boolean): void; - private _packHalf(depth); - dispose(): void; - } -} - -declare module BABYLON.Internals { -} - -declare module BABYLON { - class BaseTexture { - name: string; - delayLoadState: number; - hasAlpha: boolean; - getAlphaFromRGB: boolean; - level: number; - isCube: boolean; - isRenderTarget: boolean; - animations: Animation[]; - onDispose: () => void; - coordinatesIndex: number; - coordinatesMode: number; - wrapU: number; - wrapV: number; - uScale: number; - vScale: number; - anisotropicFilteringLevel: number; - _cachedAnisotropicFilteringLevel: number; - private _scene; - _texture: WebGLTexture; - constructor(scene: Scene); - getScene(): Scene; - getTextureMatrix(): Matrix; - getReflectionTextureMatrix(): Matrix; - getInternalTexture(): WebGLTexture; - isReady(): boolean; - getSize(): ISize; - getBaseSize(): ISize; - scale(ratio: number): void; - canRescale: boolean; - _removeFromCache(url: string, noMipmap: boolean): void; - _getFromCache(url: string, noMipmap: boolean, sampling?: number): WebGLTexture; - delayLoad(): void; - releaseInternalTexture(): void; - clone(): BaseTexture; - dispose(): void; - } -} - -declare module BABYLON { - class CubeTexture extends BaseTexture { - url: string; - coordinatesMode: number; - private _noMipmap; - private _extensions; - private _textureMatrix; - constructor(rootUrl: string, scene: Scene, extensions?: string[], noMipmap?: boolean); - clone(): CubeTexture; - delayLoad(): void; - getReflectionTextureMatrix(): Matrix; - } -} - -declare module BABYLON { - class DynamicTexture extends Texture { - private _generateMipMaps; - private _canvas; - private _context; - constructor(name: string, options: any, scene: Scene, generateMipMaps: boolean, samplingMode?: number); - canRescale: boolean; - scale(ratio: number): void; - getContext(): CanvasRenderingContext2D; - clear(): void; - update(invertY?: boolean): void; - drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void; - clone(): DynamicTexture; - } -} - -declare module BABYLON { - class MirrorTexture extends RenderTargetTexture { - mirrorPlane: Plane; - private _transformMatrix; - private _mirrorMatrix; - private _savedViewMatrix; - constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean); - clone(): MirrorTexture; - } -} - -declare module BABYLON { - class RawTexture extends Texture { - format: number; - constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number); - update(data: ArrayBufferView): void; - static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; - static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; - static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; - static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; - static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; - } -} - -declare module BABYLON { - class RenderTargetTexture extends Texture { - renderList: AbstractMesh[]; - renderParticles: boolean; - renderSprites: boolean; - coordinatesMode: number; - onBeforeRender: () => void; - onAfterRender: () => void; - onAfterUnbind: () => void; - onClear: (engine: Engine) => void; - activeCamera: Camera; - customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray, beforeTransparents?: () => void) => void; - private _size; - _generateMipMaps: boolean; - private _renderingManager; - _waitingRenderList: string[]; - private _doNotChangeAspectRatio; - private _currentRefreshId; - private _refreshRate; - constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number); - resetRefreshCounter(): void; - refreshRate: number; - _shouldRender(): boolean; - isReady(): boolean; - getRenderSize(): number; - canRescale: boolean; - scale(ratio: number): void; - resize(size: any, generateMipMaps?: boolean): void; - render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void; - clone(): RenderTargetTexture; - } -} - -declare module BABYLON { - class Texture extends BaseTexture { - static NEAREST_SAMPLINGMODE: number; - static BILINEAR_SAMPLINGMODE: number; - static TRILINEAR_SAMPLINGMODE: number; - static EXPLICIT_MODE: number; - static SPHERICAL_MODE: number; - static PLANAR_MODE: number; - static CUBIC_MODE: number; - static PROJECTION_MODE: number; - static SKYBOX_MODE: number; - static CLAMP_ADDRESSMODE: number; - static WRAP_ADDRESSMODE: number; - static MIRROR_ADDRESSMODE: number; - url: string; - uOffset: number; - vOffset: number; - uScale: number; - vScale: number; - uAng: number; - vAng: number; - wAng: number; - private _noMipmap; - _invertY: boolean; - private _rowGenerationMatrix; - private _cachedTextureMatrix; - private _projectionModeMatrix; - private _t0; - private _t1; - private _t2; - private _cachedUOffset; - private _cachedVOffset; - private _cachedUScale; - private _cachedVScale; - private _cachedUAng; - private _cachedVAng; - private _cachedWAng; - private _cachedCoordinatesMode; - _samplingMode: number; - private _buffer; - private _deleteBuffer; - constructor(url: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any, deleteBuffer?: boolean); - delayLoad(): void; - updateSamplingMode(samplingMode: number): void; - private _prepareRowForTextureGeneration(x, y, z, t); - getTextureMatrix(): Matrix; - getReflectionTextureMatrix(): Matrix; - clone(): Texture; - static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture; - } -} - -declare module BABYLON { - class VideoTexture extends Texture { - video: HTMLVideoElement; - private _autoLaunch; - private _lastUpdate; - constructor(name: string, urls: string[], scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number); - update(): boolean; - } -} - -declare module BABYLON { - class CannonJSPlugin implements IPhysicsEnginePlugin { - checkWithEpsilon: (value: number) => number; - private _world; - private _registeredMeshes; - private _physicsMaterials; - initialize(iterations?: number): void; - private _checkWithEpsilon(value); - runOneStep(delta: number): void; - setGravity(gravity: Vector3): void; - registerMesh(mesh: AbstractMesh, impostor: number, options?: PhysicsBodyCreationOptions): any; - private _createSphere(radius, mesh, options?); - private _createBox(x, y, z, mesh, options?); - private _createPlane(mesh, options?); - private _createConvexPolyhedron(rawVerts, rawFaces, mesh, options?); - private _addMaterial(friction, restitution); - private _createRigidBodyFromShape(shape, mesh, mass, friction, restitution); - registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; - private _unbindBody(body); - unregisterMesh(mesh: AbstractMesh): void; - applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; - updateBodyPosition: (mesh: AbstractMesh) => void; - createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3): boolean; - dispose(): void; - isSupported(): boolean; - } -} - -declare module BABYLON { - class OimoJSPlugin implements IPhysicsEnginePlugin { - private _world; - private _registeredMeshes; - private _checkWithEpsilon(value); - initialize(iterations?: number): void; - setGravity(gravity: Vector3): void; - registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; - registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; - private _createBodyAsCompound(part, options, initialMesh); - unregisterMesh(mesh: AbstractMesh): void; - private _unbindBody(body); - /** - * Update the body position according to the mesh position - * @param mesh - */ - updateBodyPosition: (mesh: AbstractMesh) => void; - applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; - createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; - dispose(): void; - isSupported(): boolean; - private _getLastShape(body); - runOneStep(time: number): void; - } -} - -declare module BABYLON { - class PostProcessRenderEffect { - private _engine; - private _postProcesses; - private _getPostProcess; - private _singleInstance; - private _cameras; - private _indicesForCamera; - private _renderPasses; - private _renderEffectAsPasses; - _name: string; - applyParameters: (postProcess: PostProcess) => void; - constructor(engine: Engine, name: string, getPostProcess: () => PostProcess, singleInstance?: boolean); - _update(): void; - addPass(renderPass: PostProcessRenderPass): void; - removePass(renderPass: PostProcessRenderPass): void; - addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void; - getPass(passName: string): void; - emptyPasses(): void; - _attachCameras(cameras: Camera): any; - _attachCameras(cameras: Camera[]): any; - _detachCameras(cameras: Camera): any; - _detachCameras(cameras: Camera[]): any; - _enable(cameras: Camera): any; - _enable(cameras: Camera[]): any; - _disable(cameras: Camera): any; - _disable(cameras: Camera[]): any; - getPostProcess(camera?: Camera): PostProcess; - private _linkParameters(); - private _linkTextures(effect); - } -} - -declare module BABYLON { - class PostProcessRenderPass { - private _enabled; - private _renderList; - private _renderTexture; - private _scene; - private _refCount; - _name: string; - constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void); - _incRefCount(): number; - _decRefCount(): number; - _update(): void; - setRenderList(renderList: Mesh[]): void; - getRenderTexture(): RenderTargetTexture; - } -} - -declare module BABYLON { - class PostProcessRenderPipeline { - private _engine; - private _renderEffects; - private _renderEffectsForIsolatedPass; - private _cameras; - _name: string; - private static PASS_EFFECT_NAME; - private static PASS_SAMPLER_NAME; - constructor(engine: Engine, name: string); - addEffect(renderEffect: PostProcessRenderEffect): void; - _enableEffect(renderEffectName: string, cameras: Camera): any; - _enableEffect(renderEffectName: string, cameras: Camera[]): any; - _disableEffect(renderEffectName: string, cameras: Camera): any; - _disableEffect(renderEffectName: string, cameras: Camera[]): any; - _attachCameras(cameras: Camera, unique: boolean): any; - _attachCameras(cameras: Camera[], unique: boolean): any; - _detachCameras(cameras: Camera): any; - _detachCameras(cameras: Camera[]): any; - _enableDisplayOnlyPass(passName: any, cameras: Camera): any; - _enableDisplayOnlyPass(passName: any, cameras: Camera[]): any; - _disableDisplayOnlyPass(cameras: Camera): any; - _disableDisplayOnlyPass(cameras: Camera[]): any; - _update(): void; - } -} - -declare module BABYLON { - class PostProcessRenderPipelineManager { - private _renderPipelines; - constructor(); - addPipeline(renderPipeline: PostProcessRenderPipeline): void; - attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): any; - attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): any; - detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): any; - detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): any; - enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any; - enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any; - disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any; - disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any; - enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): any; - enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): any; - disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): any; - disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): any; - update(): void; - } -} - -declare module BABYLON { - class CustomProceduralTexture extends ProceduralTexture { - private _animate; - private _time; - private _config; - private _texturePath; - constructor(name: string, texturePath: any, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); - private loadJson(jsonUrl); - isReady(): boolean; - render(useCameraPostProcess?: boolean): void; - updateTextures(): void; - updateShaderUniforms(): void; - animate: boolean; - } -} - -declare module BABYLON { - class ProceduralTexture extends Texture { - private _size; - _generateMipMaps: boolean; - isEnabled: boolean; - private _doNotChangeAspectRatio; - private _currentRefreshId; - private _refreshRate; - private _vertexBuffer; - private _indexBuffer; - private _effect; - private _vertexDeclaration; - private _vertexStrideSize; - private _uniforms; - private _samplers; - private _fragment; - _textures: Texture[]; - private _floats; - private _floatsArrays; - private _colors3; - private _colors4; - private _vectors2; - private _vectors3; - private _matrices; - private _fallbackTexture; - private _fallbackTextureUsed; - constructor(name: string, size: any, fragment: any, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); - reset(): void; - isReady(): boolean; - resetRefreshCounter(): void; - setFragment(fragment: any): void; - refreshRate: number; - _shouldRender(): boolean; - getRenderSize(): number; - resize(size: any, generateMipMaps: any): void; - private _checkUniform(uniformName); - setTexture(name: string, texture: Texture): ProceduralTexture; - setFloat(name: string, value: number): ProceduralTexture; - setFloats(name: string, value: number[]): ProceduralTexture; - setColor3(name: string, value: Color3): ProceduralTexture; - setColor4(name: string, value: Color4): ProceduralTexture; - setVector2(name: string, value: Vector2): ProceduralTexture; - setVector3(name: string, value: Vector3): ProceduralTexture; - setMatrix(name: string, value: Matrix): ProceduralTexture; - render(useCameraPostProcess?: boolean): void; - clone(): ProceduralTexture; - dispose(): void; - } -} - -declare module BABYLON { - class WoodProceduralTexture extends ProceduralTexture { - private _ampScale; - private _woodColor; - constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); - updateShaderUniforms(): void; - ampScale: number; - woodColor: Color3; - } - class FireProceduralTexture extends ProceduralTexture { - private _time; - private _speed; - private _autoGenerateTime; - private _fireColors; - private _alphaThreshold; - constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); - updateShaderUniforms(): void; - render(useCameraPostProcess?: boolean): void; - static PurpleFireColors: Color3[]; - static GreenFireColors: Color3[]; - static RedFireColors: Color3[]; - static BlueFireColors: Color3[]; - fireColors: Color3[]; - time: number; - speed: Vector2; - alphaThreshold: number; - } - class CloudProceduralTexture extends ProceduralTexture { - private _skyColor; - private _cloudColor; - constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); - updateShaderUniforms(): void; - skyColor: Color4; - cloudColor: Color4; - } - class GrassProceduralTexture extends ProceduralTexture { - private _grassColors; - private _herb1; - private _herb2; - private _herb3; - private _groundColor; - constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); - updateShaderUniforms(): void; - grassColors: Color3[]; - groundColor: Color3; - } - class RoadProceduralTexture extends ProceduralTexture { - private _roadColor; - constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); - updateShaderUniforms(): void; - roadColor: Color3; - } - class BrickProceduralTexture extends ProceduralTexture { - private _numberOfBricksHeight; - private _numberOfBricksWidth; - private _jointColor; - private _brickColor; - constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); - updateShaderUniforms(): void; - numberOfBricksHeight: number; - numberOfBricksWidth: number; - jointColor: Color3; - brickColor: Color3; - } - class MarbleProceduralTexture extends ProceduralTexture { - private _numberOfTilesHeight; - private _numberOfTilesWidth; - private _amplitude; - private _marbleColor; - private _jointColor; - constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); - updateShaderUniforms(): void; - numberOfTilesHeight: number; - numberOfTilesWidth: number; - jointColor: Color3; - marbleColor: Color3; - } -} From 3d7ac318a767b2f15965ff3b3ce3113ab3dcaef8 Mon Sep 17 00:00:00 2001 From: satguru srivastava Date: Mon, 4 Jan 2016 15:58:35 -0600 Subject: [PATCH 222/441] new file: babylonjs/babylon.d.ts --- babylonjs/babylon.d.ts | 6327 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 6327 insertions(+) create mode 100644 babylonjs/babylon.d.ts diff --git a/babylonjs/babylon.d.ts b/babylonjs/babylon.d.ts new file mode 100644 index 0000000000..1cc835442c --- /dev/null +++ b/babylonjs/babylon.d.ts @@ -0,0 +1,6327 @@ +// Type definitions for BabylonJS v2.2 +// Project: http://www.babylonjs.com/ +// Definitions by: David Catuhe +// Definitions: https://github.com/borisyankov/babylonjs + + +declare module BABYLON { + class _DepthCullingState { + private _isDepthTestDirty; + private _isDepthMaskDirty; + private _isDepthFuncDirty; + private _isCullFaceDirty; + private _isCullDirty; + private _isZOffsetDirty; + private _depthTest; + private _depthMask; + private _depthFunc; + private _cull; + private _cullFace; + private _zOffset; + isDirty: boolean; + zOffset: number; + cullFace: number; + cull: boolean; + depthFunc: number; + depthMask: boolean; + depthTest: boolean; + reset(): void; + apply(gl: WebGLRenderingContext): void; + } + class _AlphaState { + private _isAlphaBlendDirty; + private _isBlendFunctionParametersDirty; + private _alphaBlend; + private _blendFunctionParameters; + isDirty: boolean; + alphaBlend: boolean; + setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void; + reset(): void; + apply(gl: WebGLRenderingContext): void; + } + class EngineCapabilities { + maxTexturesImageUnits: number; + maxTextureSize: number; + maxCubemapTextureSize: number; + maxRenderTextureSize: number; + standardDerivatives: boolean; + s3tc: any; + textureFloat: boolean; + textureAnisotropicFilterExtension: any; + maxAnisotropy: number; + instancedArrays: any; + uintIndices: boolean; + highPrecisionShaderSupported: boolean; + } + /** + * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio. + */ + class Engine { + private static _ALPHA_DISABLE; + private static _ALPHA_ADD; + private static _ALPHA_COMBINE; + private static _ALPHA_SUBTRACT; + private static _ALPHA_MULTIPLY; + private static _ALPHA_MAXIMIZED; + private static _ALPHA_ONEONE; + private static _DELAYLOADSTATE_NONE; + private static _DELAYLOADSTATE_LOADED; + private static _DELAYLOADSTATE_LOADING; + private static _DELAYLOADSTATE_NOTLOADED; + private static _TEXTUREFORMAT_ALPHA; + private static _TEXTUREFORMAT_LUMINANCE; + private static _TEXTUREFORMAT_LUMINANCE_ALPHA; + private static _TEXTUREFORMAT_RGB; + private static _TEXTUREFORMAT_RGBA; + private static _TEXTURETYPE_UNSIGNED_INT; + private static _TEXTURETYPE_FLOAT; + static ALPHA_DISABLE: number; + static ALPHA_ONEONE: number; + static ALPHA_ADD: number; + static ALPHA_COMBINE: number; + static ALPHA_SUBTRACT: number; + static ALPHA_MULTIPLY: number; + static ALPHA_MAXIMIZED: number; + static DELAYLOADSTATE_NONE: number; + static DELAYLOADSTATE_LOADED: number; + static DELAYLOADSTATE_LOADING: number; + static DELAYLOADSTATE_NOTLOADED: number; + static TEXTUREFORMAT_ALPHA: number; + static TEXTUREFORMAT_LUMINANCE: number; + static TEXTUREFORMAT_LUMINANCE_ALPHA: number; + static TEXTUREFORMAT_RGB: number; + static TEXTUREFORMAT_RGBA: number; + static TEXTURETYPE_UNSIGNED_INT: number; + static TEXTURETYPE_FLOAT: number; + static Version: string; + static Epsilon: number; + static CollisionsEpsilon: number; + static CodeRepository: string; + static ShadersRepository: string; + isFullscreen: boolean; + isPointerLock: boolean; + cullBackFaces: boolean; + renderEvenInBackground: boolean; + enableOfflineSupport: boolean; + scenes: Scene[]; + _gl: WebGLRenderingContext; + private _renderingCanvas; + private _windowIsBackground; + static audioEngine: AudioEngine; + private _onBlur; + private _onFocus; + private _onFullscreenChange; + private _onPointerLockChange; + private _hardwareScalingLevel; + private _caps; + private _pointerLockRequested; + private _alphaTest; + private _resizeLoadingUI; + private _loadingDiv; + private _loadingTextDiv; + private _loadingDivBackgroundColor; + private _drawCalls; + private _glVersion; + private _glRenderer; + private _glVendor; + private _videoTextureSupported; + private _renderingQueueLaunched; + private _activeRenderLoops; + private fpsRange; + private previousFramesDuration; + private fps; + private deltaTime; + private _depthCullingState; + private _alphaState; + private _alphaMode; + private _loadedTexturesCache; + _activeTexturesCache: BaseTexture[]; + private _currentEffect; + private _compiledEffects; + private _vertexAttribArrays; + private _cachedViewport; + private _cachedVertexBuffers; + private _cachedIndexBuffer; + private _cachedEffectForVertexBuffers; + private _currentRenderTarget; + private _uintIndicesCurrentlySet; + private _workingCanvas; + private _workingContext; + /** + * @constructor + * @param {HTMLCanvasElement} canvas - the canvas to be used for rendering + * @param {boolean} [antialias] - enable antialias + * @param options - further options to be sent to the getContext function + */ + constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: any); + private _prepareWorkingCanvas(); + getGlInfo(): { + vendor: string; + renderer: string; + version: string; + }; + getAspectRatio(camera: Camera): number; + getRenderWidth(): number; + getRenderHeight(): number; + getRenderingCanvas(): HTMLCanvasElement; + getRenderingCanvasClientRect(): ClientRect; + setHardwareScalingLevel(level: number): void; + getHardwareScalingLevel(): number; + getLoadedTexturesCache(): WebGLTexture[]; + getCaps(): EngineCapabilities; + drawCalls: number; + resetDrawCalls(): void; + setDepthFunctionToGreater(): void; + setDepthFunctionToGreaterOrEqual(): void; + setDepthFunctionToLess(): void; + setDepthFunctionToLessOrEqual(): void; + /** + * stop executing a render loop function and remove it from the execution array + * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed. + */ + stopRenderLoop(renderFunction?: () => void): void; + _renderLoop(): void; + /** + * Register and execute a render loop. The engine can have more than one render function. + * @param {Function} renderFunction - the function to continuesly execute starting the next render loop. + * @example + * engine.runRenderLoop(function () { + * scene.render() + * }) + */ + runRenderLoop(renderFunction: () => void): void; + /** + * Toggle full screen mode. + * @param {boolean} requestPointerLock - should a pointer lock be requested from the user + */ + switchFullscreen(requestPointerLock: boolean): void; + clear(color: any, backBuffer: boolean, depthStencil: boolean): void; + /** + * Set the WebGL's viewport + * @param {BABYLON.Viewport} viewport - the viewport element to be used. + * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used. + * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used. + */ + setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void; + setDirectViewport(x: number, y: number, width: number, height: number): void; + beginFrame(): void; + endFrame(): void; + /** + * resize the view according to the canvas' size. + * @example + * window.addEventListener("resize", function () { + * engine.resize(); + * }); + */ + resize(): void; + /** + * force a specific size of the canvas + * @param {number} width - the new canvas' width + * @param {number} height - the new canvas' height + */ + setSize(width: number, height: number): void; + bindFramebuffer(texture: WebGLTexture): void; + unBindFramebuffer(texture: WebGLTexture): void; + flushFramebuffer(): void; + restoreDefaultFramebuffer(): void; + private _resetVertexBufferBinding(); + createVertexBuffer(vertices: number[]): WebGLBuffer; + createDynamicVertexBuffer(capacity: number): WebGLBuffer; + updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: any, offset?: number): void; + private _resetIndexBufferBinding(); + createIndexBuffer(indices: number[]): WebGLBuffer; + bindBuffers(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void; + bindMultiBuffers(vertexBuffers: VertexBuffer[], indexBuffer: WebGLBuffer, effect: Effect): void; + _releaseBuffer(buffer: WebGLBuffer): boolean; + createInstancesBuffer(capacity: number): WebGLBuffer; + deleteInstancesBuffer(buffer: WebGLBuffer): void; + updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[]): void; + unBindInstancesBuffer(instancesBuffer: WebGLBuffer, offsetLocations: number[]): void; + applyStates(): void; + draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void; + drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void; + _releaseEffect(effect: Effect): void; + createEffect(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], defines: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect; + createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect; + createShaderProgram(vertexCode: string, fragmentCode: string, defines: string): WebGLProgram; + getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[]; + getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[]; + enableEffect(effect: Effect): void; + setArray(uniform: WebGLUniformLocation, array: number[]): void; + setArray2(uniform: WebGLUniformLocation, array: number[]): void; + setArray3(uniform: WebGLUniformLocation, array: number[]): void; + setArray4(uniform: WebGLUniformLocation, array: number[]): void; + setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void; + setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void; + setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void; + setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void; + setFloat(uniform: WebGLUniformLocation, value: number): void; + setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void; + setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void; + setBool(uniform: WebGLUniformLocation, bool: number): void; + setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; + setColor3(uniform: WebGLUniformLocation, color3: Color3): void; + setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void; + setState(culling: boolean, zOffset?: number, force?: boolean): void; + setDepthBuffer(enable: boolean): void; + getDepthWrite(): boolean; + setDepthWrite(enable: boolean): void; + setColorWrite(enable: boolean): void; + setAlphaMode(mode: number): void; + getAlphaMode(): number; + setAlphaTesting(enable: boolean): void; + getAlphaTesting(): boolean; + wipeCaches(): void; + setSamplingMode(texture: WebGLTexture, samplingMode: number): void; + createTexture(url: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any): WebGLTexture; + updateRawTexture(texture: WebGLTexture, data: ArrayBufferView, format: number, invertY: boolean, compression?: string): void; + createRawTexture(data: ArrayBufferView, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture; + createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number, forceExponantOfTwo?: boolean): WebGLTexture; + updateTextureSamplingMode(samplingMode: number, texture: WebGLTexture): void; + updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean): void; + updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void; + createRenderTargetTexture(size: any, options: any): WebGLTexture; + createCubeTexture(rootUrl: string, scene: Scene, extensions: string[], noMipmap?: boolean): WebGLTexture; + _releaseTexture(texture: WebGLTexture): void; + bindSamplers(effect: Effect): void; + _bindTexture(channel: number, texture: WebGLTexture): void; + setTextureFromPostProcess(channel: number, postProcess: PostProcess): void; + setTexture(channel: number, texture: BaseTexture): void; + _setAnisotropicLevel(key: number, texture: BaseTexture): void; + readPixels(x: number, y: number, width: number, height: number): Uint8Array; + dispose(): void; + displayLoadingUI(): void; + loadingUIText: string; + loadingUIBackgroundColor: string; + hideLoadingUI(): void; + getFps(): number; + getDeltaTime(): number; + private _measureFps(); + static isSupported(): boolean; + } +} + +interface Window { + mozIndexedDB(func: any): any; + webkitIndexedDB(func: any): any; + IDBTransaction(func: any): any; + webkitIDBTransaction(func: any): any; + msIDBTransaction(func: any): any; + IDBKeyRange(func: any): any; + webkitIDBKeyRange(func: any): any; + msIDBKeyRange(func: any): any; + webkitURL: HTMLURL; + webkitRequestAnimationFrame(func: any): any; + mozRequestAnimationFrame(func: any): any; + oRequestAnimationFrame(func: any): any; + WebGLRenderingContext: WebGLRenderingContext; + MSGesture: MSGesture; + CANNON: any; + SIMD: any; + AudioContext: AudioContext; + webkitAudioContext: AudioContext; +} +interface HTMLURL { + createObjectURL(param1: any, param2?: any): any; +} +interface Document { + exitFullscreen(): void; + webkitCancelFullScreen(): void; + mozCancelFullScreen(): void; + msCancelFullScreen(): void; + mozFullScreen: boolean; + msIsFullScreen: boolean; + fullscreen: boolean; + mozPointerLockElement: HTMLElement; + msPointerLockElement: HTMLElement; + webkitPointerLockElement: HTMLElement; +} +interface HTMLCanvasElement { + requestPointerLock(): void; + msRequestPointerLock(): void; + mozRequestPointerLock(): void; + webkitRequestPointerLock(): void; +} +interface CanvasRenderingContext2D { + imageSmoothingEnabled: boolean; + mozImageSmoothingEnabled: boolean; + oImageSmoothingEnabled: boolean; + webkitImageSmoothingEnabled: boolean; +} +interface WebGLTexture { + isReady: boolean; + isCube: boolean; + url: string; + noMipmap: boolean; + samplingMode: number; + references: number; + generateMipMaps: boolean; + _size: number; + _baseWidth: number; + _baseHeight: number; + _width: number; + _height: number; + _workingCanvas: HTMLCanvasElement; + _workingContext: CanvasRenderingContext2D; + _framebuffer: WebGLFramebuffer; + _depthBuffer: WebGLRenderbuffer; + _cachedCoordinatesMode: number; + _cachedWrapU: number; + _cachedWrapV: number; + _isDisabled: boolean; +} +interface WebGLBuffer { + references: number; + capacity: number; + is32Bits: boolean; +} +interface MouseEvent { + mozMovementX: number; + mozMovementY: number; + webkitMovementX: number; + webkitMovementY: number; + msMovementX: number; + msMovementY: number; +} +interface MSStyleCSSProperties { + webkitTransform: string; + webkitTransition: string; +} +interface Navigator { + getVRDevices: () => any; + mozGetVRDevices: (any: any) => any; + isCocoonJS: boolean; +} +interface Screen { + orientation: string; + mozOrientation: string; +} + +declare module BABYLON { + /** + * Node is the basic class for all scene objects (Mesh, Light Camera). + */ + class Node { + parent: Node; + name: string; + id: string; + uniqueId: number; + state: string; + animations: Animation[]; + onReady: (node: Node) => void; + private _childrenFlag; + private _isEnabled; + private _isReady; + _currentRenderId: number; + private _parentRenderId; + _waitingParentId: string; + private _scene; + _cache: any; + /** + * @constructor + * @param {string} name - the name and id to be given to this node + * @param {BABYLON.Scene} the scene this node will be added to + */ + constructor(name: string, scene: Scene); + getScene(): Scene; + getEngine(): Engine; + getWorldMatrix(): Matrix; + _initCache(): void; + updateCache(force?: boolean): void; + _updateCache(ignoreParentClass?: boolean): void; + _isSynchronized(): boolean; + _markSyncedWithParent(): void; + isSynchronizedWithParent(): boolean; + isSynchronized(updateCache?: boolean): boolean; + hasNewParent(update?: boolean): boolean; + /** + * Is this node ready to be used/rendered + * @return {boolean} is it ready + */ + isReady(): boolean; + /** + * Is this node enabled. + * If the node has a parent and is enabled, the parent will be inspected as well. + * @return {boolean} whether this node (and its parent) is enabled. + * @see setEnabled + */ + isEnabled(): boolean; + /** + * Set the enabled state of this node. + * @param {boolean} value - the new enabled state + * @see isEnabled + */ + setEnabled(value: boolean): void; + /** + * Is this node a descendant of the given node. + * The function will iterate up the hierarchy until the ancestor was found or no more parents defined. + * @param {BABYLON.Node} ancestor - The parent node to inspect + * @see parent + */ + isDescendantOf(ancestor: Node): boolean; + _getDescendants(list: Node[], results: Node[]): void; + /** + * Will return all nodes that have this node as parent. + * @return {BABYLON.Node[]} all children nodes of all types. + */ + getDescendants(): Node[]; + _setReady(state: boolean): void; + } +} + +declare module BABYLON { + interface IDisposable { + dispose(): void; + } + /** + * Represents a scene to be rendered by the engine. + * @see http://doc.babylonjs.com/page.php?p=21911 + */ + class Scene { + private static _FOGMODE_NONE; + private static _FOGMODE_EXP; + private static _FOGMODE_EXP2; + private static _FOGMODE_LINEAR; + static MinDeltaTime: number; + static MaxDeltaTime: number; + static FOGMODE_NONE: number; + static FOGMODE_EXP: number; + static FOGMODE_EXP2: number; + static FOGMODE_LINEAR: number; + autoClear: boolean; + clearColor: any; + ambientColor: Color3; + /** + * A function to be executed before rendering this scene + * @type {Function} + */ + beforeRender: () => void; + /** + * A function to be executed after rendering this scene + * @type {Function} + */ + afterRender: () => void; + /** + * A function to be executed when this scene is disposed. + * @type {Function} + */ + onDispose: () => void; + beforeCameraRender: (camera: Camera) => void; + afterCameraRender: (camera: Camera) => void; + forceWireframe: boolean; + forcePointsCloud: boolean; + forceShowBoundingBoxes: boolean; + clipPlane: Plane; + animationsEnabled: boolean; + private _onPointerMove; + private _onPointerDown; + private _onPointerUp; + onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void; + onPointerUp: (evt: PointerEvent, pickInfo: PickingInfo) => void; + cameraToUseForPointers: Camera; + private _pointerX; + private _pointerY; + private _meshUnderPointer; + private _onKeyDown; + private _onKeyUp; + /** + * is fog enabled on this scene. + * @type {boolean} + */ + fogEnabled: boolean; + fogMode: number; + fogColor: Color3; + fogDensity: number; + fogStart: number; + fogEnd: number; + /** + * is shadow enabled on this scene. + * @type {boolean} + */ + shadowsEnabled: boolean; + /** + * is light enabled on this scene. + * @type {boolean} + */ + lightsEnabled: boolean; + /** + * All of the lights added to this scene. + * @see BABYLON.Light + * @type {BABYLON.Light[]} + */ + lights: Light[]; + onNewLightAdded: (newLight?: Light, positionInArray?: number, scene?: Scene) => void; + onLightRemoved: (removedLight?: Light) => void; + /** + * All of the cameras added to this scene. + * @see BABYLON.Camera + * @type {BABYLON.Camera[]} + */ + cameras: Camera[]; + onNewCameraAdded: (newCamera?: Camera, positionInArray?: number, scene?: Scene) => void; + onCameraRemoved: (removedCamera?: Camera) => void; + activeCameras: Camera[]; + activeCamera: Camera; + /** + * All of the (abstract) meshes added to this scene. + * @see BABYLON.AbstractMesh + * @type {BABYLON.AbstractMesh[]} + */ + meshes: AbstractMesh[]; + onNewMeshAdded: (newMesh?: AbstractMesh, positionInArray?: number, scene?: Scene) => void; + onMeshRemoved: (removedMesh?: AbstractMesh) => void; + private _geometries; + onGeometryAdded: (newGeometry?: Geometry) => void; + onGeometryRemoved: (removedGeometry?: Geometry) => void; + materials: Material[]; + multiMaterials: MultiMaterial[]; + defaultMaterial: StandardMaterial; + texturesEnabled: boolean; + textures: BaseTexture[]; + particlesEnabled: boolean; + particleSystems: ParticleSystem[]; + spritesEnabled: boolean; + spriteManagers: SpriteManager[]; + layers: Layer[]; + skeletonsEnabled: boolean; + skeletons: Skeleton[]; + lensFlaresEnabled: boolean; + lensFlareSystems: LensFlareSystem[]; + collisionsEnabled: boolean; + private _workerCollisions; + collisionCoordinator: ICollisionCoordinator; + gravity: Vector3; + postProcessesEnabled: boolean; + postProcessManager: PostProcessManager; + postProcessRenderPipelineManager: PostProcessRenderPipelineManager; + renderTargetsEnabled: boolean; + dumpNextRenderTargets: boolean; + customRenderTargets: RenderTargetTexture[]; + useDelayedTextureLoading: boolean; + importedMeshesFiles: String[]; + database: any; + /** + * This scene's action manager + * @type {BABYLON.ActionManager} + */ + actionManager: ActionManager; + _actionManagers: ActionManager[]; + private _meshesForIntersections; + proceduralTexturesEnabled: boolean; + _proceduralTextures: ProceduralTexture[]; + mainSoundTrack: SoundTrack; + soundTracks: SoundTrack[]; + private _audioEnabled; + private _headphone; + simplificationQueue: SimplificationQueue; + private _engine; + private _totalVertices; + _activeIndices: number; + _activeParticles: number; + private _lastFrameDuration; + private _evaluateActiveMeshesDuration; + private _renderTargetsDuration; + _particlesDuration: number; + private _renderDuration; + _spritesDuration: number; + private _animationRatio; + private _animationStartDate; + _cachedMaterial: Material; + private _renderId; + private _executeWhenReadyTimeoutId; + _toBeDisposed: SmartArray; + private _onReadyCallbacks; + private _pendingData; + private _onBeforeRenderCallbacks; + private _onAfterRenderCallbacks; + private _activeMeshes; + private _processedMaterials; + private _renderTargets; + _activeParticleSystems: SmartArray; + private _activeSkeletons; + private _softwareSkinnedMeshes; + _activeBones: number; + private _renderingManager; + private _physicsEngine; + _activeAnimatables: Animatable[]; + private _transformMatrix; + private _pickWithRayInverseMatrix; + private _edgesRenderers; + private _boundingBoxRenderer; + private _outlineRenderer; + private _viewMatrix; + private _projectionMatrix; + private _frustumPlanes; + private _selectionOctree; + private _pointerOverMesh; + private _debugLayer; + private _depthRenderer; + private _uniqueIdCounter; + /** + * @constructor + * @param {BABYLON.Engine} engine - the engine to be used to render this scene. + */ + constructor(engine: Engine); + debugLayer: DebugLayer; + workerCollisions: boolean; + SelectionOctree: Octree; + /** + * The mesh that is currently under the pointer. + * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none. + */ + meshUnderPointer: AbstractMesh; + /** + * Current on-screen X position of the pointer + * @return {number} X position of the pointer + */ + pointerX: number; + /** + * Current on-screen Y position of the pointer + * @return {number} Y position of the pointer + */ + pointerY: number; + getCachedMaterial(): Material; + getBoundingBoxRenderer(): BoundingBoxRenderer; + getOutlineRenderer(): OutlineRenderer; + getEngine(): Engine; + getTotalVertices(): number; + getActiveIndices(): number; + getActiveParticles(): number; + getActiveBones(): number; + getLastFrameDuration(): number; + getEvaluateActiveMeshesDuration(): number; + getActiveMeshes(): SmartArray; + getRenderTargetsDuration(): number; + getRenderDuration(): number; + getParticlesDuration(): number; + getSpritesDuration(): number; + getAnimationRatio(): number; + getRenderId(): number; + incrementRenderId(): void; + private _updatePointerPosition(evt); + attachControl(): void; + detachControl(): void; + isReady(): boolean; + resetCachedMaterial(): void; + registerBeforeRender(func: () => void): void; + unregisterBeforeRender(func: () => void): void; + registerAfterRender(func: () => void): void; + unregisterAfterRender(func: () => void): void; + _addPendingData(data: any): void; + _removePendingData(data: any): void; + getWaitingItemsCount(): number; + /** + * Registers a function to be executed when the scene is ready. + * @param {Function} func - the function to be executed. + */ + executeWhenReady(func: () => void): void; + _checkIsReady(): void; + /** + * Will start the animation sequence of a given target + * @param target - the target + * @param {number} from - from which frame should animation start + * @param {number} to - till which frame should animation run. + * @param {boolean} [loop] - should the animation loop + * @param {number} [speedRatio] - the speed in which to run the animation + * @param {Function} [onAnimationEnd] function to be executed when the animation ended. + * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params. + * @return {BABYLON.Animatable} the animatable object created for this animation + * @see BABYLON.Animatable + * @see http://doc.babylonjs.com/page.php?p=22081 + */ + beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable; + beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable; + getAnimatableByTarget(target: any): Animatable; + /** + * Will stop the animation of the given target + * @param target - the target + * @see beginAnimation + */ + stopAnimation(target: any): void; + private _animate(); + getViewMatrix(): Matrix; + getProjectionMatrix(): Matrix; + getTransformMatrix(): Matrix; + setTransformMatrix(view: Matrix, projection: Matrix): void; + addMesh(newMesh: AbstractMesh): void; + removeMesh(toRemove: AbstractMesh): number; + removeLight(toRemove: Light): number; + removeCamera(toRemove: Camera): number; + addLight(newLight: Light): void; + addCamera(newCamera: Camera): void; + /** + * sets the active camera of the scene using its ID + * @param {string} id - the camera's ID + * @return {BABYLON.Camera|null} the new active camera or null if none found. + * @see activeCamera + */ + setActiveCameraByID(id: string): Camera; + /** + * sets the active camera of the scene using its name + * @param {string} name - the camera's name + * @return {BABYLON.Camera|null} the new active camera or null if none found. + * @see activeCamera + */ + setActiveCameraByName(name: string): Camera; + /** + * get a material using its id + * @param {string} the material's ID + * @return {BABYLON.Material|null} the material or null if none found. + */ + getMaterialByID(id: string): Material; + /** + * get a material using its name + * @param {string} the material's name + * @return {BABYLON.Material|null} the material or null if none found. + */ + getMaterialByName(name: string): Material; + getLensFlareSystemByName(name: string): LensFlareSystem; + getCameraByID(id: string): Camera; + getCameraByUniqueID(uniqueId: number): Camera; + /** + * get a camera using its name + * @param {string} the camera's name + * @return {BABYLON.Camera|null} the camera or null if none found. + */ + getCameraByName(name: string): Camera; + /** + * get a light node using its name + * @param {string} the light's name + * @return {BABYLON.Light|null} the light or null if none found. + */ + getLightByName(name: string): Light; + /** + * get a light node using its ID + * @param {string} the light's id + * @return {BABYLON.Light|null} the light or null if none found. + */ + getLightByID(id: string): Light; + /** + * get a light node using its scene-generated unique ID + * @param {number} the light's unique id + * @return {BABYLON.Light|null} the light or null if none found. + */ + getLightByUniqueID(uniqueId: number): Light; + /** + * get a geometry using its ID + * @param {string} the geometry's id + * @return {BABYLON.Geometry|null} the geometry or null if none found. + */ + getGeometryByID(id: string): Geometry; + /** + * add a new geometry to this scene. + * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene. + * @param {boolean} [force] - force addition, even if a geometry with this ID already exists + * @return {boolean} was the geometry added or not + */ + pushGeometry(geometry: Geometry, force?: boolean): boolean; + /** + * Removes an existing geometry + * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene. + * @return {boolean} was the geometry removed or not + */ + removeGeometry(geometry: Geometry): boolean; + getGeometries(): Geometry[]; + /** + * Get the first added mesh found of a given ID + * @param {string} id - the id to search for + * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. + */ + getMeshByID(id: string): AbstractMesh; + /** + * Get a mesh with its auto-generated unique id + * @param {number} uniqueId - the unique id to search for + * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. + */ + getMeshByUniqueID(uniqueId: number): AbstractMesh; + /** + * Get a the last added mesh found of a given ID + * @param {string} id - the id to search for + * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. + */ + getLastMeshByID(id: string): AbstractMesh; + /** + * Get a the last added node (Mesh, Camera, Light) found of a given ID + * @param {string} id - the id to search for + * @return {BABYLON.Node|null} the node found or null if not found at all. + */ + getLastEntryByID(id: string): Node; + getNodeByID(id: string): Node; + getNodeByName(name: string): Node; + getMeshByName(name: string): AbstractMesh; + getSoundByName(name: string): Sound; + getLastSkeletonByID(id: string): Skeleton; + getSkeletonById(id: string): Skeleton; + getSkeletonByName(name: string): Skeleton; + isActiveMesh(mesh: Mesh): boolean; + private _evaluateSubMesh(subMesh, mesh); + private _evaluateActiveMeshes(); + private _activeMesh(mesh); + updateTransformMatrix(force?: boolean): void; + private _renderForCamera(camera); + private _processSubCameras(camera); + private _checkIntersections(); + render(): void; + private _updateAudioParameters(); + audioEnabled: boolean; + private _disableAudio(); + private _enableAudio(); + headphone: boolean; + private _switchAudioModeForHeadphones(); + private _switchAudioModeForNormalSpeakers(); + enableDepthRenderer(): DepthRenderer; + disableDepthRenderer(): void; + dispose(): void; + disposeSounds(): void; + getWorldExtends(): { + min: Vector3; + max: Vector3; + }; + createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree; + createPickingRay(x: number, y: number, world: Matrix, camera: Camera): Ray; + private _internalPick(rayFunction, predicate, fastCheck?); + pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo; + pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo; + setPointerOverMesh(mesh: AbstractMesh): void; + getPointerOverMesh(): AbstractMesh; + getPhysicsEngine(): PhysicsEngine; + enablePhysics(gravity: Vector3, plugin?: IPhysicsEnginePlugin): boolean; + disablePhysicsEngine(): void; + isPhysicsEnabled(): boolean; + setGravity(gravity: Vector3): void; + createCompoundImpostor(parts: any, options: PhysicsBodyCreationOptions): any; + deleteCompoundImpostor(compound: any): void; + createDefaultCameraOrLight(): void; + private _getByTags(list, tagsQuery, forEach?); + getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[]; + getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[]; + getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[]; + getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[]; + } +} + +declare module BABYLON { + class Action { + triggerOptions: any; + trigger: number; + _actionManager: ActionManager; + private _nextActiveAction; + private _child; + private _condition; + private _triggerParameter; + constructor(triggerOptions: any, condition?: Condition); + _prepare(): void; + getTriggerParameter(): any; + _executeCurrent(evt: ActionEvent): void; + execute(evt: ActionEvent): void; + then(action: Action): Action; + _getProperty(propertyPath: string): string; + _getEffectiveTarget(target: any, propertyPath: string): any; + } +} + +declare module BABYLON { + /** + * ActionEvent is the event beint sent when an action is triggered. + */ + class ActionEvent { + source: AbstractMesh; + pointerX: number; + pointerY: number; + meshUnderPointer: AbstractMesh; + sourceEvent: any; + additionalData: any; + /** + * @constructor + * @param source The mesh that triggered the action. + * @param pointerX the X mouse cursor position at the time of the event + * @param pointerY the Y mouse cursor position at the time of the event + * @param meshUnderPointer The mesh that is currently pointed at (can be null) + * @param sourceEvent the original (browser) event that triggered the ActionEvent + */ + constructor(source: AbstractMesh, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any, additionalData?: any); + /** + * Helper function to auto-create an ActionEvent from a source mesh. + * @param source the source mesh that triggered the event + * @param evt {Event} The original (browser) event + */ + static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent; + /** + * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew + * @param scene the scene where the event occurred + * @param evt {Event} The original (browser) event + */ + static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent; + } + /** + * Action Manager manages all events to be triggered on a given mesh or the global scene. + * A single scene can have many Action Managers to handle predefined actions on specific meshes. + */ + class ActionManager { + private static _NothingTrigger; + private static _OnPickTrigger; + private static _OnLeftPickTrigger; + private static _OnRightPickTrigger; + private static _OnCenterPickTrigger; + private static _OnPointerOverTrigger; + private static _OnPointerOutTrigger; + private static _OnEveryFrameTrigger; + private static _OnIntersectionEnterTrigger; + private static _OnIntersectionExitTrigger; + private static _OnKeyDownTrigger; + private static _OnKeyUpTrigger; + private static _OnPickUpTrigger; + static NothingTrigger: number; + static OnPickTrigger: number; + static OnLeftPickTrigger: number; + static OnRightPickTrigger: number; + static OnCenterPickTrigger: number; + static OnPointerOverTrigger: number; + static OnPointerOutTrigger: number; + static OnEveryFrameTrigger: number; + static OnIntersectionEnterTrigger: number; + static OnIntersectionExitTrigger: number; + static OnKeyDownTrigger: number; + static OnKeyUpTrigger: number; + static OnPickUpTrigger: number; + actions: Action[]; + private _scene; + constructor(scene: Scene); + dispose(): void; + getScene(): Scene; + /** + * Does this action manager handles actions of any of the given triggers + * @param {number[]} triggers - the triggers to be tested + * @return {boolean} whether one (or more) of the triggers is handeled + */ + hasSpecificTriggers(triggers: number[]): boolean; + /** + * Does this action manager handles actions of a given trigger + * @param {number} trigger - the trigger to be tested + * @return {boolean} whether the trigger is handeled + */ + hasSpecificTrigger(trigger: number): boolean; + /** + * Does this action manager has pointer triggers + * @return {boolean} whether or not it has pointer triggers + */ + hasPointerTriggers: boolean; + /** + * Does this action manager has pick triggers + * @return {boolean} whether or not it has pick triggers + */ + hasPickTriggers: boolean; + /** + * Registers an action to this action manager + * @param {BABYLON.Action} action - the action to be registered + * @return {BABYLON.Action} the action amended (prepared) after registration + */ + registerAction(action: Action): Action; + /** + * Process a specific trigger + * @param {number} trigger - the trigger to process + * @param evt {BABYLON.ActionEvent} the event details to be processed + */ + processTrigger(trigger: number, evt: ActionEvent): void; + _getEffectiveTarget(target: any, propertyPath: string): any; + _getProperty(propertyPath: string): string; + } +} + +declare module BABYLON { + class Condition { + _actionManager: ActionManager; + _evaluationId: number; + _currentResult: boolean; + constructor(actionManager: ActionManager); + isValid(): boolean; + _getProperty(propertyPath: string): string; + _getEffectiveTarget(target: any, propertyPath: string): any; + } + class ValueCondition extends Condition { + propertyPath: string; + value: any; + operator: number; + private static _IsEqual; + private static _IsDifferent; + private static _IsGreater; + private static _IsLesser; + static IsEqual: number; + static IsDifferent: number; + static IsGreater: number; + static IsLesser: number; + _actionManager: ActionManager; + private _target; + private _property; + constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number); + isValid(): boolean; + } + class PredicateCondition extends Condition { + predicate: () => boolean; + _actionManager: ActionManager; + constructor(actionManager: ActionManager, predicate: () => boolean); + isValid(): boolean; + } + class StateCondition extends Condition { + value: string; + _actionManager: ActionManager; + private _target; + constructor(actionManager: ActionManager, target: any, value: string); + isValid(): boolean; + } +} + +declare module BABYLON { + class SwitchBooleanAction extends Action { + propertyPath: string; + private _target; + private _property; + constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition); + _prepare(): void; + execute(): void; + } + class SetStateAction extends Action { + value: string; + private _target; + constructor(triggerOptions: any, target: any, value: string, condition?: Condition); + execute(): void; + } + class SetValueAction extends Action { + propertyPath: string; + value: any; + private _target; + private _property; + constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition); + _prepare(): void; + execute(): void; + } + class IncrementValueAction extends Action { + propertyPath: string; + value: any; + private _target; + private _property; + constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition); + _prepare(): void; + execute(): void; + } + class PlayAnimationAction extends Action { + from: number; + to: number; + loop: boolean; + private _target; + constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition); + _prepare(): void; + execute(): void; + } + class StopAnimationAction extends Action { + private _target; + constructor(triggerOptions: any, target: any, condition?: Condition); + _prepare(): void; + execute(): void; + } + class DoNothingAction extends Action { + constructor(triggerOptions?: any, condition?: Condition); + execute(): void; + } + class CombineAction extends Action { + children: Action[]; + constructor(triggerOptions: any, children: Action[], condition?: Condition); + _prepare(): void; + execute(evt: ActionEvent): void; + } + class ExecuteCodeAction extends Action { + func: (evt: ActionEvent) => void; + constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition); + execute(evt: ActionEvent): void; + } + class SetParentAction extends Action { + private _parent; + private _target; + constructor(triggerOptions: any, target: any, parent: any, condition?: Condition); + _prepare(): void; + execute(): void; + } + class PlaySoundAction extends Action { + private _sound; + constructor(triggerOptions: any, sound: Sound, condition?: Condition); + _prepare(): void; + execute(): void; + } + class StopSoundAction extends Action { + private _sound; + constructor(triggerOptions: any, sound: Sound, condition?: Condition); + _prepare(): void; + execute(): void; + } +} + +declare module BABYLON { + class InterpolateValueAction extends Action { + propertyPath: string; + value: any; + duration: number; + stopOtherAnimations: boolean; + private _target; + private _property; + constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean); + _prepare(): void; + execute(): void; + } +} + +declare module BABYLON { + class Animatable { + target: any; + fromFrame: number; + toFrame: number; + loopAnimation: boolean; + speedRatio: number; + onAnimationEnd: any; + private _localDelayOffset; + private _pausedDelay; + private _animations; + private _paused; + private _scene; + animationStarted: boolean; + constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: any, animations?: any); + appendAnimations(target: any, animations: Animation[]): void; + getAnimationByTargetProperty(property: string): Animation; + reset(): void; + pause(): void; + restart(): void; + stop(): void; + _animate(delay: number): boolean; + } +} + +declare module BABYLON { + class Animation { + name: string; + targetProperty: string; + framePerSecond: number; + dataType: number; + loopMode: number; + private _keys; + private _offsetsCache; + private _highLimitsCache; + private _stopped; + _target: any; + private _easingFunction; + targetPropertyPath: string[]; + currentFrame: number; + allowMatricesInterpolation: boolean; + static CreateAndStartAnimation(name: string, mesh: AbstractMesh, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction): Animatable; + constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number); + reset(): void; + isStopped(): boolean; + getKeys(): any[]; + getEasingFunction(): IEasingFunction; + setEasingFunction(easingFunction: EasingFunction): void; + floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number; + quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion; + vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3; + vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2; + color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3; + matrixInterpolateFunction(startValue: Matrix, endValue: Matrix, gradient: number): Matrix; + clone(): Animation; + setKeys(values: Array): void; + private _getKeyValue(value); + private _interpolate(currentFrame, repeatCount, loopMode, offsetValue?, highLimitValue?); + animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number): boolean; + private static _ANIMATIONTYPE_FLOAT; + private static _ANIMATIONTYPE_VECTOR3; + private static _ANIMATIONTYPE_QUATERNION; + private static _ANIMATIONTYPE_MATRIX; + private static _ANIMATIONTYPE_COLOR3; + private static _ANIMATIONTYPE_VECTOR2; + private static _ANIMATIONLOOPMODE_RELATIVE; + private static _ANIMATIONLOOPMODE_CYCLE; + private static _ANIMATIONLOOPMODE_CONSTANT; + static ANIMATIONTYPE_FLOAT: number; + static ANIMATIONTYPE_VECTOR3: number; + static ANIMATIONTYPE_VECTOR2: number; + static ANIMATIONTYPE_QUATERNION: number; + static ANIMATIONTYPE_MATRIX: number; + static ANIMATIONTYPE_COLOR3: number; + static ANIMATIONLOOPMODE_RELATIVE: number; + static ANIMATIONLOOPMODE_CYCLE: number; + static ANIMATIONLOOPMODE_CONSTANT: number; + } +} + +declare module BABYLON { + interface IEasingFunction { + ease(gradient: number): number; + } + class EasingFunction implements IEasingFunction { + private static _EASINGMODE_EASEIN; + private static _EASINGMODE_EASEOUT; + private static _EASINGMODE_EASEINOUT; + static EASINGMODE_EASEIN: number; + static EASINGMODE_EASEOUT: number; + static EASINGMODE_EASEINOUT: number; + private _easingMode; + setEasingMode(easingMode: number): void; + getEasingMode(): number; + easeInCore(gradient: number): number; + ease(gradient: number): number; + } + class CircleEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class BackEase extends EasingFunction implements IEasingFunction { + amplitude: number; + constructor(amplitude?: number); + easeInCore(gradient: number): number; + } + class BounceEase extends EasingFunction implements IEasingFunction { + bounces: number; + bounciness: number; + constructor(bounces?: number, bounciness?: number); + easeInCore(gradient: number): number; + } + class CubicEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class ElasticEase extends EasingFunction implements IEasingFunction { + oscillations: number; + springiness: number; + constructor(oscillations?: number, springiness?: number); + easeInCore(gradient: number): number; + } + class ExponentialEase extends EasingFunction implements IEasingFunction { + exponent: number; + constructor(exponent?: number); + easeInCore(gradient: number): number; + } + class PowerEase extends EasingFunction implements IEasingFunction { + power: number; + constructor(power?: number); + easeInCore(gradient: number): number; + } + class QuadraticEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class QuarticEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class QuinticEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class SineEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class BezierCurveEase extends EasingFunction implements IEasingFunction { + x1: number; + y1: number; + x2: number; + y2: number; + constructor(x1?: number, y1?: number, x2?: number, y2?: number); + easeInCore(gradient: number): number; + } +} + +declare module BABYLON { + class Analyser { + SMOOTHING: number; + FFT_SIZE: number; + BARGRAPHAMPLITUDE: number; + DEBUGCANVASPOS: { + x: number; + y: number; + }; + DEBUGCANVASSIZE: { + width: number; + height: number; + }; + private _byteFreqs; + private _byteTime; + private _floatFreqs; + private _webAudioAnalyser; + private _debugCanvas; + private _debugCanvasContext; + private _scene; + private _registerFunc; + private _audioEngine; + constructor(scene: Scene); + getFrequencyBinCount(): number; + getByteFrequencyData(): Uint8Array; + getByteTimeDomainData(): Uint8Array; + getFloatFrequencyData(): Uint8Array; + drawDebugCanvas(): void; + stopDebugCanvas(): void; + connectAudioNodes(inputAudioNode: AudioNode, outputAudioNode: AudioNode): void; + dispose(): void; + } +} + +declare module BABYLON { + class AudioEngine { + private _audioContext; + private _audioContextInitialized; + canUseWebAudio: boolean; + masterGain: GainNode; + private _connectedAnalyser; + WarnedWebAudioUnsupported: boolean; + audioContext: AudioContext; + constructor(); + private _initializeAudioContext(); + dispose(): void; + getGlobalVolume(): number; + setGlobalVolume(newVolume: number): void; + connectToAnalyser(analyser: Analyser): void; + } +} + +declare module BABYLON { + class Sound { + name: string; + autoplay: boolean; + loop: boolean; + useCustomAttenuation: boolean; + soundTrackId: number; + spatialSound: boolean; + refDistance: number; + rolloffFactor: number; + maxDistance: number; + distanceModel: string; + private _panningModel; + onended: () => any; + private _playbackRate; + private _startTime; + private _startOffset; + private _position; + private _localDirection; + private _volume; + private _isLoaded; + private _isReadyToPlay; + isPlaying: boolean; + isPaused: boolean; + private _isDirectional; + private _readyToPlayCallback; + private _audioBuffer; + private _soundSource; + private _soundPanner; + private _soundGain; + private _inputAudioNode; + private _ouputAudioNode; + private _coneInnerAngle; + private _coneOuterAngle; + private _coneOuterGain; + private _scene; + private _connectedMesh; + private _customAttenuationFunction; + private _registerFunc; + private _isOutputConnected; + /** + * Create a sound and attach it to a scene + * @param name Name of your sound + * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer + * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played + * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel + */ + constructor(name: string, urlOrArrayBuffer: any, scene: Scene, readyToPlayCallback?: () => void, options?: any); + dispose(): void; + private _soundLoaded(audioData); + setAudioBuffer(audioBuffer: AudioBuffer): void; + updateOptions(options: any): void; + private _createSpatialParameters(); + private _updateSpatialParameters(); + switchPanningModelToHRTF(): void; + switchPanningModelToEqualPower(): void; + private _switchPanningModel(); + connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void; + /** + * Transform this sound into a directional source + * @param coneInnerAngle Size of the inner cone in degree + * @param coneOuterAngle Size of the outer cone in degree + * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0) + */ + setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void; + setPosition(newPosition: Vector3): void; + setLocalDirectionToMesh(newLocalDirection: Vector3): void; + private _updateDirection(); + updateDistanceFromListener(): void; + setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void; + /** + * Play the sound + * @param time (optional) Start the sound after X seconds. Start immediately (0) by default. + */ + play(time?: number): void; + private _onended(); + /** + * Stop the sound + * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default. + */ + stop(time?: number): void; + pause(): void; + setVolume(newVolume: number, time?: number): void; + setPlaybackRate(newPlaybackRate: number): void; + getVolume(): number; + attachToMesh(meshToConnectTo: AbstractMesh): void; + private _onRegisterAfterWorldMatrixUpdate(connectedMesh); + } +} + +declare module BABYLON { + class SoundTrack { + private _audioEngine; + private _outputAudioNode; + private _inputAudioNode; + private _trackConvolver; + private _scene; + id: number; + soundCollection: Array; + private _isMainTrack; + private _connectedAnalyser; + constructor(scene: Scene, options?: any); + dispose(): void; + AddSound(sound: Sound): void; + RemoveSound(sound: Sound): void; + setVolume(newVolume: number): void; + switchPanningModelToHRTF(): void; + switchPanningModelToEqualPower(): void; + connectToAnalyser(analyser: Analyser): void; + } +} + +declare module BABYLON { + class Bone extends Node { + name: string; + children: Bone[]; + animations: Animation[]; + private _skeleton; + private _matrix; + private _baseMatrix; + private _worldTransform; + private _absoluteTransform; + private _invertedAbsoluteTransform; + private _parent; + constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix); + getParent(): Bone; + getLocalMatrix(): Matrix; + getBaseMatrix(): Matrix; + getWorldMatrix(): Matrix; + getInvertedAbsoluteTransform(): Matrix; + getAbsoluteMatrix(): Matrix; + updateMatrix(matrix: Matrix): void; + private _updateDifferenceMatrix(); + markAsDirty(): void; + } +} + +declare module BABYLON { + class Skeleton { + name: string; + id: string; + bones: Bone[]; + private _scene; + private _isDirty; + private _transformMatrices; + private _animatables; + private _identity; + constructor(name: string, id: string, scene: Scene); + getTransformMatrices(): Float32Array; + getScene(): Scene; + _markAsDirty(): void; + prepare(): void; + getAnimatables(): IAnimatable[]; + clone(name: string, id: string): Skeleton; + } +} + +declare module BABYLON { + class ArcRotateCamera extends TargetCamera { + alpha: number; + beta: number; + radius: number; + target: any; + inertialAlphaOffset: number; + inertialBetaOffset: number; + inertialRadiusOffset: number; + lowerAlphaLimit: any; + upperAlphaLimit: any; + lowerBetaLimit: number; + upperBetaLimit: number; + lowerRadiusLimit: any; + upperRadiusLimit: any; + angularSensibilityX: number; + angularSensibilityY: number; + wheelPrecision: number; + pinchPrecision: number; + panningSensibility: number; + inertialPanningX: number; + inertialPanningY: number; + keysUp: number[]; + keysDown: number[]; + keysLeft: number[]; + keysRight: number[]; + zoomOnFactor: number; + targetScreenOffset: Vector2; + pinchInwards: boolean; + allowUpsideDown: boolean; + private _keys; + _viewMatrix: Matrix; + private _attachedElement; + private _onContextMenu; + private _onPointerDown; + private _onPointerUp; + private _onPointerMove; + private _wheel; + private _onMouseMove; + private _onKeyDown; + private _onKeyUp; + private _onLostFocus; + _reset: () => void; + private _onGestureStart; + private _onGesture; + private _MSGestureHandler; + private _localDirection; + private _transformedDirection; + private _isRightClick; + private _isCtrlPushed; + onCollide: (collidedMesh: AbstractMesh) => void; + checkCollisions: boolean; + collisionRadius: Vector3; + private _collider; + private _previousPosition; + private _collisionVelocity; + private _newPosition; + private _previousAlpha; + private _previousBeta; + private _previousRadius; + private _collisionTriggered; + angularSensibility: number; + constructor(name: string, alpha: number, beta: number, radius: number, target: any, scene: Scene); + _getTargetPosition(): Vector3; + _initCache(): void; + _updateCache(ignoreParentClass?: boolean): void; + _isSynchronizedViewMatrix(): boolean; + attachControl(element: HTMLElement, noPreventDefault?: boolean, useCtrlForPanning?: boolean): void; + detachControl(element: HTMLElement): void; + _checkInputs(): void; + private _checkLimits(); + setPosition(position: Vector3): void; + setTarget(target: Vector3): void; + _getViewMatrix(): Matrix; + private _onCollisionPositionChange; + zoomOn(meshes?: AbstractMesh[], doNotUpdateMaxZ?: boolean): void; + focusOn(meshesOrMinMaxVectorAndDistance: any, doNotUpdateMaxZ?: boolean): void; + /** + * @override + * Override Camera.createRigCamera + */ + createRigCamera(name: string, cameraIndex: number): Camera; + /** + * @override + * Override Camera._updateRigCameras + */ + _updateRigCameras(): void; + } +} + +declare module BABYLON { + class VRCameraMetrics { + hResolution: number; + vResolution: number; + hScreenSize: number; + vScreenSize: number; + vScreenCenter: number; + eyeToScreenDistance: number; + lensSeparationDistance: number; + interpupillaryDistance: number; + distortionK: number[]; + chromaAbCorrection: number[]; + postProcessScaleFactor: number; + lensCenterOffset: number; + compensateDistorsion: boolean; + aspectRatio: number; + aspectRatioFov: number; + leftHMatrix: Matrix; + rightHMatrix: Matrix; + leftPreViewMatrix: Matrix; + rightPreViewMatrix: Matrix; + static GetDefault(): VRCameraMetrics; + } + class Camera extends Node { + position: Vector3; + private static _PERSPECTIVE_CAMERA; + private static _ORTHOGRAPHIC_CAMERA; + private static _FOVMODE_VERTICAL_FIXED; + private static _FOVMODE_HORIZONTAL_FIXED; + private static _RIG_MODE_NONE; + private static _RIG_MODE_STEREOSCOPIC_ANAGLYPH; + private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL; + private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED; + private static _RIG_MODE_STEREOSCOPIC_OVERUNDER; + private static _RIG_MODE_VR; + static PERSPECTIVE_CAMERA: number; + static ORTHOGRAPHIC_CAMERA: number; + static FOVMODE_VERTICAL_FIXED: number; + static FOVMODE_HORIZONTAL_FIXED: number; + static RIG_MODE_NONE: number; + static RIG_MODE_STEREOSCOPIC_ANAGLYPH: number; + static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number; + static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number; + static RIG_MODE_STEREOSCOPIC_OVERUNDER: number; + static RIG_MODE_VR: number; + upVector: Vector3; + orthoLeft: any; + orthoRight: any; + orthoBottom: any; + orthoTop: any; + fov: number; + minZ: number; + maxZ: number; + inertia: number; + mode: number; + isIntermediate: boolean; + viewport: Viewport; + layerMask: number; + fovMode: number; + cameraRigMode: number; + _cameraRigParams: any; + _rigCameras: Camera[]; + private _computedViewMatrix; + _projectionMatrix: Matrix; + private _worldMatrix; + _postProcesses: PostProcess[]; + _postProcessesTakenIndices: any[]; + _activeMeshes: SmartArray; + private _globalPosition; + constructor(name: string, position: Vector3, scene: Scene); + globalPosition: Vector3; + getActiveMeshes(): SmartArray; + isActiveMesh(mesh: Mesh): boolean; + _initCache(): void; + _updateCache(ignoreParentClass?: boolean): void; + _updateFromScene(): void; + _isSynchronized(): boolean; + _isSynchronizedViewMatrix(): boolean; + _isSynchronizedProjectionMatrix(): boolean; + attachControl(element: HTMLElement): void; + detachControl(element: HTMLElement): void; + _update(): void; + _checkInputs(): void; + attachPostProcess(postProcess: PostProcess, insertAt?: number): number; + detachPostProcess(postProcess: PostProcess, atIndices?: any): number[]; + getWorldMatrix(): Matrix; + _getViewMatrix(): Matrix; + getViewMatrix(force?: boolean): Matrix; + _computeViewMatrix(force?: boolean): Matrix; + getProjectionMatrix(force?: boolean): Matrix; + dispose(): void; + setCameraRigMode(mode: number, rigParams: any): void; + private _getVRProjectionMatrix(); + setCameraRigParameter(name: string, value: any): void; + /** + * May needs to be overridden by children so sub has required properties to be copied + */ + createRigCamera(name: string, cameraIndex: number): Camera; + /** + * May needs to be overridden by children + */ + _updateRigCameras(): void; + } +} + +declare module BABYLON { + class DeviceOrientationCamera extends FreeCamera { + private _offsetX; + private _offsetY; + private _orientationGamma; + private _orientationBeta; + private _initialOrientationGamma; + private _initialOrientationBeta; + private _attachedCanvas; + private _orientationChanged; + angularSensibility: number; + moveSensibility: number; + constructor(name: string, position: Vector3, scene: Scene); + attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void; + detachControl(canvas: HTMLCanvasElement): void; + _checkInputs(): void; + } +} + +declare module BABYLON { + class FollowCamera extends TargetCamera { + radius: number; + rotationOffset: number; + heightOffset: number; + cameraAcceleration: number; + maxCameraSpeed: number; + target: AbstractMesh; + constructor(name: string, position: Vector3, scene: Scene); + private getRadians(degrees); + private follow(cameraTarget); + _checkInputs(): void; + } + class ArcFollowCamera extends TargetCamera { + alpha: number; + beta: number; + radius: number; + target: AbstractMesh; + private _cartesianCoordinates; + constructor(name: string, alpha: number, beta: number, radius: number, target: AbstractMesh, scene: Scene); + private follow(); + _checkInputs(): void; + } +} + +declare module BABYLON { + class FreeCamera extends TargetCamera { + ellipsoid: Vector3; + keysUp: number[]; + keysDown: number[]; + keysLeft: number[]; + keysRight: number[]; + checkCollisions: boolean; + applyGravity: boolean; + angularSensibility: number; + onCollide: (collidedMesh: AbstractMesh) => void; + private _keys; + private _collider; + private _needMoveForGravity; + private _oldPosition; + private _diffPosition; + private _newPosition; + private _attachedElement; + private _localDirection; + private _transformedDirection; + private _onMouseDown; + private _onMouseUp; + private _onMouseOut; + private _onMouseMove; + private _onKeyDown; + private _onKeyUp; + _onLostFocus: (e: FocusEvent) => any; + _waitingLockedTargetId: string; + constructor(name: string, position: Vector3, scene: Scene); + attachControl(element: HTMLElement, noPreventDefault?: boolean): void; + detachControl(element: HTMLElement): void; + _collideWithWorld(velocity: Vector3): void; + private _onCollisionPositionChange; + _checkInputs(): void; + _decideIfNeedsToMove(): boolean; + _updatePosition(): void; + } +} + +declare module BABYLON { + class GamepadCamera extends FreeCamera { + private _gamepad; + private _gamepads; + angularSensibility: number; + moveSensibility: number; + constructor(name: string, position: Vector3, scene: Scene); + private _onNewGameConnected(gamepad); + _checkInputs(): void; + dispose(): void; + } +} + +declare module BABYLON { + class AnaglyphFreeCamera extends FreeCamera { + constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene); + } + class AnaglyphArcRotateCamera extends ArcRotateCamera { + constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, scene: Scene); + } + class AnaglyphGamepadCamera extends GamepadCamera { + constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene); + } + class StereoscopicFreeCamera extends FreeCamera { + constructor(name: string, position: Vector3, interaxialDistance: number, isSideBySide: boolean, scene: Scene); + } + class StereoscopicArcRotateCamera extends ArcRotateCamera { + constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, isSideBySide: boolean, scene: Scene); + } + class StereoscopicGamepadCamera extends GamepadCamera { + constructor(name: string, position: Vector3, interaxialDistance: number, isSideBySide: boolean, scene: Scene); + } +} + +declare module BABYLON { + class TargetCamera extends Camera { + cameraDirection: Vector3; + cameraRotation: Vector2; + rotation: Vector3; + speed: number; + noRotationConstraint: boolean; + lockedTarget: any; + _currentTarget: Vector3; + _viewMatrix: Matrix; + _camMatrix: Matrix; + _cameraTransformMatrix: Matrix; + _cameraRotationMatrix: Matrix; + private _rigCamTransformMatrix; + _referencePoint: Vector3; + _transformedReferencePoint: Vector3; + _lookAtTemp: Matrix; + _tempMatrix: Matrix; + _reset: () => void; + _waitingLockedTargetId: string; + constructor(name: string, position: Vector3, scene: Scene); + getFrontPosition(distance: number): Vector3; + _getLockedTargetPosition(): Vector3; + _initCache(): void; + _updateCache(ignoreParentClass?: boolean): void; + _isSynchronizedViewMatrix(): boolean; + _computeLocalCameraSpeed(): number; + setTarget(target: Vector3): void; + getTarget(): Vector3; + _decideIfNeedsToMove(): boolean; + _updatePosition(): void; + _checkInputs(): void; + _getViewMatrix(): Matrix; + _getVRViewMatrix(): Matrix; + /** + * @override + * Override Camera.createRigCamera + */ + createRigCamera(name: string, cameraIndex: number): Camera; + /** + * @override + * Override Camera._updateRigCameras + */ + _updateRigCameras(): void; + private _getRigCamPosition(halfSpace, result); + } +} + +declare module BABYLON { + class TouchCamera extends FreeCamera { + private _offsetX; + private _offsetY; + private _pointerCount; + private _pointerPressed; + private _attachedCanvas; + private _onPointerDown; + private _onPointerUp; + private _onPointerMove; + angularSensibility: number; + moveSensibility: number; + constructor(name: string, position: Vector3, scene: Scene); + attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void; + detachControl(canvas: HTMLCanvasElement): void; + _checkInputs(): void; + } +} + +declare module BABYLON { + class VirtualJoysticksCamera extends FreeCamera { + private _leftjoystick; + private _rightjoystick; + constructor(name: string, position: Vector3, scene: Scene); + getLeftJoystick(): VirtualJoystick; + getRightJoystick(): VirtualJoystick; + _checkInputs(): void; + dispose(): void; + } +} + +declare module BABYLON { + class Collider { + radius: Vector3; + retry: number; + velocity: Vector3; + basePoint: Vector3; + epsilon: number; + collisionFound: boolean; + velocityWorldLength: number; + basePointWorld: Vector3; + velocityWorld: Vector3; + normalizedVelocity: Vector3; + initialVelocity: Vector3; + initialPosition: Vector3; + nearestDistance: number; + intersectionPoint: Vector3; + collidedMesh: AbstractMesh; + private _collisionPoint; + private _planeIntersectionPoint; + private _tempVector; + private _tempVector2; + private _tempVector3; + private _tempVector4; + private _edge; + private _baseToVertex; + private _destinationPoint; + private _slidePlaneNormal; + private _displacementVector; + _initialize(source: Vector3, dir: Vector3, e: number): void; + _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean; + _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean; + _testTriangle(faceIndex: number, trianglePlaneArray: Array, p1: Vector3, p2: Vector3, p3: Vector3, hasMaterial: boolean): void; + _collide(trianglePlaneArray: Array, pts: Vector3[], indices: number[], indexStart: number, indexEnd: number, decal: number, hasMaterial: boolean): void; + _getResponse(pos: Vector3, vel: Vector3): void; + } +} + +declare module BABYLON { + var CollisionWorker: string; + interface ICollisionCoordinator { + getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; + init(scene: Scene): void; + destroy(): void; + onMeshAdded(mesh: AbstractMesh): any; + onMeshUpdated(mesh: AbstractMesh): any; + onMeshRemoved(mesh: AbstractMesh): any; + onGeometryAdded(geometry: Geometry): any; + onGeometryUpdated(geometry: Geometry): any; + onGeometryDeleted(geometry: Geometry): any; + } + interface SerializedMesh { + id: string; + name: string; + uniqueId: number; + geometryId: string; + sphereCenter: Array; + sphereRadius: number; + boxMinimum: Array; + boxMaximum: Array; + worldMatrixFromCache: any; + subMeshes: Array; + checkCollisions: boolean; + } + interface SerializedSubMesh { + position: number; + verticesStart: number; + verticesCount: number; + indexStart: number; + indexCount: number; + hasMaterial: boolean; + sphereCenter: Array; + sphereRadius: number; + boxMinimum: Array; + boxMaximum: Array; + } + interface SerializedGeometry { + id: string; + positions: Float32Array; + indices: Int32Array; + normals: Float32Array; + } + interface BabylonMessage { + taskType: WorkerTaskType; + payload: InitPayload | CollidePayload | UpdatePayload; + } + interface SerializedColliderToWorker { + position: Array; + velocity: Array; + radius: Array; + } + enum WorkerTaskType { + INIT = 0, + UPDATE = 1, + COLLIDE = 2, + } + interface WorkerReply { + error: WorkerReplyType; + taskType: WorkerTaskType; + payload?: any; + } + interface CollisionReplyPayload { + newPosition: Array; + collisionId: number; + collidedMeshUniqueId: number; + } + interface InitPayload { + } + interface CollidePayload { + collisionId: number; + collider: SerializedColliderToWorker; + maximumRetry: number; + excludedMeshUniqueId?: number; + } + interface UpdatePayload { + updatedMeshes: { + [n: number]: SerializedMesh; + }; + updatedGeometries: { + [s: string]: SerializedGeometry; + }; + removedMeshes: Array; + removedGeometries: Array; + } + enum WorkerReplyType { + SUCCESS = 0, + UNKNOWN_ERROR = 1, + } + class CollisionCoordinatorWorker implements ICollisionCoordinator { + private _scene; + private _scaledPosition; + private _scaledVelocity; + private _collisionsCallbackArray; + private _init; + private _runningUpdated; + private _runningCollisionTask; + private _worker; + private _addUpdateMeshesList; + private _addUpdateGeometriesList; + private _toRemoveMeshesArray; + private _toRemoveGeometryArray; + constructor(); + static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh; + static SerializeGeometry: (geometry: Geometry) => SerializedGeometry; + getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; + init(scene: Scene): void; + destroy(): void; + onMeshAdded(mesh: AbstractMesh): void; + onMeshUpdated: (mesh: AbstractMesh) => void; + onMeshRemoved(mesh: AbstractMesh): void; + onGeometryAdded(geometry: Geometry): void; + onGeometryUpdated: (geometry: Geometry) => void; + onGeometryDeleted(geometry: Geometry): void; + private _afterRender; + private _onMessageFromWorker; + } + class CollisionCoordinatorLegacy implements ICollisionCoordinator { + private _scene; + private _scaledPosition; + private _scaledVelocity; + private _finalPosition; + getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; + init(scene: Scene): void; + destroy(): void; + onMeshAdded(mesh: AbstractMesh): void; + onMeshUpdated(mesh: AbstractMesh): void; + onMeshRemoved(mesh: AbstractMesh): void; + onGeometryAdded(geometry: Geometry): void; + onGeometryUpdated(geometry: Geometry): void; + onGeometryDeleted(geometry: Geometry): void; + private _collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh?); + } +} + +declare module BABYLON { + var WorkerIncluded: boolean; + class CollisionCache { + private _meshes; + private _geometries; + getMeshes(): { + [n: number]: SerializedMesh; + }; + getGeometries(): { + [s: number]: SerializedGeometry; + }; + getMesh(id: any): SerializedMesh; + addMesh(mesh: SerializedMesh): void; + getGeometry(id: string): SerializedGeometry; + addGeometry(geometry: SerializedGeometry): void; + } + class CollideWorker { + collider: Collider; + private _collisionCache; + private finalPosition; + private collisionsScalingMatrix; + private collisionTranformationMatrix; + constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3); + collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void; + private checkCollision(mesh); + private processCollisionsForSubMeshes(transformMatrix, mesh); + private collideForSubMesh(subMesh, transformMatrix, meshGeometry); + private checkSubmeshCollision(subMesh); + } + interface ICollisionDetector { + onInit(payload: InitPayload): void; + onUpdate(payload: UpdatePayload): void; + onCollision(payload: CollidePayload): void; + } + class CollisionDetectorTransferable implements ICollisionDetector { + private _collisionCache; + onInit(payload: InitPayload): void; + onUpdate(payload: UpdatePayload): void; + onCollision(payload: CollidePayload): void; + } +} + +declare module BABYLON { + class IntersectionInfo { + bu: number; + bv: number; + distance: number; + faceId: number; + subMeshId: number; + constructor(bu: number, bv: number, distance: number); + } + class PickingInfo { + hit: boolean; + distance: number; + pickedPoint: Vector3; + pickedMesh: AbstractMesh; + bu: number; + bv: number; + faceId: number; + subMeshId: number; + getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3; + getTextureCoordinates(): Vector2; + } +} + +declare module BABYLON { + class BoundingBox { + minimum: Vector3; + maximum: Vector3; + vectors: Vector3[]; + center: Vector3; + extendSize: Vector3; + directions: Vector3[]; + vectorsWorld: Vector3[]; + minimumWorld: Vector3; + maximumWorld: Vector3; + private _worldMatrix; + constructor(minimum: Vector3, maximum: Vector3); + getWorldMatrix(): Matrix; + _update(world: Matrix): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + isCompletelyInFrustum(frustumPlanes: Plane[]): boolean; + intersectsPoint(point: Vector3): boolean; + intersectsSphere(sphere: BoundingSphere): boolean; + intersectsMinMax(min: Vector3, max: Vector3): boolean; + static Intersects(box0: BoundingBox, box1: BoundingBox): boolean; + static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean; + static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean; + static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean; + } +} + +declare module BABYLON { + class BoundingInfo { + minimum: Vector3; + maximum: Vector3; + boundingBox: BoundingBox; + boundingSphere: BoundingSphere; + constructor(minimum: Vector3, maximum: Vector3); + _update(world: Matrix): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + isCompletelyInFrustum(frustumPlanes: Plane[]): boolean; + _checkCollision(collider: Collider): boolean; + intersectsPoint(point: Vector3): boolean; + intersects(boundingInfo: BoundingInfo, precise: boolean): boolean; + } +} + +declare module BABYLON { + class BoundingSphere { + minimum: Vector3; + maximum: Vector3; + center: Vector3; + radius: number; + centerWorld: Vector3; + radiusWorld: number; + private _tempRadiusVector; + constructor(minimum: Vector3, maximum: Vector3); + _update(world: Matrix): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + intersectsPoint(point: Vector3): boolean; + static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean; + } +} + +declare module BABYLON { + class DebugLayer { + private _scene; + private _camera; + private _transformationMatrix; + private _enabled; + private _labelsEnabled; + private _displayStatistics; + private _displayTree; + private _displayLogs; + private _globalDiv; + private _statsDiv; + private _statsSubsetDiv; + private _optionsDiv; + private _optionsSubsetDiv; + private _logDiv; + private _logSubsetDiv; + private _treeDiv; + private _treeSubsetDiv; + private _drawingCanvas; + private _drawingContext; + private _syncPositions; + private _syncData; + private _syncUI; + private _onCanvasClick; + private _clickPosition; + private _ratio; + private _identityMatrix; + private _showUI; + private _needToRefreshMeshesTree; + shouldDisplayLabel: (node: Node) => boolean; + shouldDisplayAxis: (mesh: Mesh) => boolean; + axisRatio: number; + accentColor: string; + customStatsFunction: () => string; + constructor(scene: Scene); + private _refreshMeshesTreeContent(); + private _renderSingleAxis(zero, unit, unitText, label, color); + private _renderAxis(projectedPosition, mesh, globalViewport); + private _renderLabel(text, projectedPosition, labelOffset, onClick, getFillStyle); + private _isClickInsideRect(x, y, width, height); + isVisible(): boolean; + hide(): void; + show(showUI?: boolean, camera?: Camera): void; + private _clearLabels(); + private _generateheader(root, text); + private _generateTexBox(root, title, color); + private _generateAdvancedCheckBox(root, leftTitle, rightTitle, initialState, task, tag?); + private _generateCheckBox(root, title, initialState, task, tag?); + private _generateButton(root, title, task, tag?); + private _generateRadio(root, title, name, initialState, task, tag?); + private _generateDOMelements(); + private _displayStats(); + } +} + +declare module BABYLON { + class Layer { + name: string; + texture: Texture; + isBackground: boolean; + color: Color4; + onDispose: () => void; + private _scene; + private _vertexDeclaration; + private _vertexStrideSize; + private _vertexBuffer; + private _indexBuffer; + private _effect; + constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4); + render(): void; + dispose(): void; + } +} + +declare module BABYLON { + class LensFlare { + size: number; + position: number; + color: Color3; + texture: Texture; + private _system; + constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem); + dispose: () => void; + } +} + +declare module BABYLON { + class LensFlareSystem { + name: string; + lensFlares: LensFlare[]; + borderLimit: number; + meshesSelectionPredicate: (mesh: Mesh) => boolean; + layerMask: number; + private _scene; + private _emitter; + private _vertexDeclaration; + private _vertexStrideSize; + private _vertexBuffer; + private _indexBuffer; + private _effect; + private _positionX; + private _positionY; + private _isEnabled; + constructor(name: string, emitter: any, scene: Scene); + isEnabled: boolean; + getScene(): Scene; + getEmitter(): any; + setEmitter(newEmitter: any): void; + getEmitterPosition(): Vector3; + computeEffectivePosition(globalViewport: Viewport): boolean; + _isVisible(): boolean; + render(): boolean; + dispose(): void; + } +} + +declare module BABYLON { + class DirectionalLight extends Light implements IShadowLight { + direction: Vector3; + position: Vector3; + private _transformedDirection; + transformedPosition: Vector3; + private _worldMatrix; + shadowOrthoScale: number; + constructor(name: string, direction: Vector3, scene: Scene); + getAbsolutePosition(): Vector3; + setDirectionToTarget(target: Vector3): Vector3; + setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; + supportsVSM(): boolean; + needRefreshPerFrame(): boolean; + computeTransformedPosition(): boolean; + transferToEffect(effect: Effect, directionUniformName: string): void; + _getWorldMatrix(): Matrix; + } +} + +declare module BABYLON { + class HemisphericLight extends Light { + direction: Vector3; + groundColor: Color3; + private _worldMatrix; + constructor(name: string, direction: Vector3, scene: Scene); + setDirectionToTarget(target: Vector3): Vector3; + getShadowGenerator(): ShadowGenerator; + transferToEffect(effect: Effect, directionUniformName: string, groundColorUniformName: string): void; + _getWorldMatrix(): Matrix; + } +} + +declare module BABYLON { + interface IShadowLight { + position: Vector3; + direction: Vector3; + transformedPosition: Vector3; + name: string; + computeTransformedPosition(): boolean; + getScene(): Scene; + setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; + supportsVSM(): boolean; + needRefreshPerFrame(): boolean; + _shadowGenerator: ShadowGenerator; + } + class Light extends Node { + diffuse: Color3; + specular: Color3; + intensity: number; + range: number; + includeOnlyWithLayerMask: number; + includedOnlyMeshes: AbstractMesh[]; + excludedMeshes: AbstractMesh[]; + excludeWithLayerMask: number; + _shadowGenerator: ShadowGenerator; + private _parentedWorldMatrix; + _excludedMeshesIds: string[]; + _includedOnlyMeshesIds: string[]; + constructor(name: string, scene: Scene); + getShadowGenerator(): ShadowGenerator; + getAbsolutePosition(): Vector3; + transferToEffect(effect: Effect, uniformName0?: string, uniformName1?: string): void; + _getWorldMatrix(): Matrix; + canAffectMesh(mesh: AbstractMesh): boolean; + getWorldMatrix(): Matrix; + dispose(): void; + } +} + +declare module BABYLON { + class PointLight extends Light { + position: Vector3; + private _worldMatrix; + private _transformedPosition; + constructor(name: string, position: Vector3, scene: Scene); + getAbsolutePosition(): Vector3; + transferToEffect(effect: Effect, positionUniformName: string): void; + getShadowGenerator(): ShadowGenerator; + _getWorldMatrix(): Matrix; + } +} + +declare module BABYLON { + class SpotLight extends Light implements IShadowLight { + position: Vector3; + direction: Vector3; + angle: number; + exponent: number; + transformedPosition: Vector3; + private _transformedDirection; + private _worldMatrix; + constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene); + getAbsolutePosition(): Vector3; + setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; + supportsVSM(): boolean; + needRefreshPerFrame(): boolean; + setDirectionToTarget(target: Vector3): Vector3; + computeTransformedPosition(): boolean; + transferToEffect(effect: Effect, positionUniformName: string, directionUniformName: string): void; + _getWorldMatrix(): Matrix; + } +} + +declare module BABYLON { + interface ISceneLoaderPlugin { + extensions: string; + importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean; + load: (scene: Scene, data: string, rootUrl: string) => boolean; + } + class SceneLoader { + private static _ForceFullSceneLoadingForIncremental; + private static _ShowLoadingScreen; + static ForceFullSceneLoadingForIncremental: boolean; + static ShowLoadingScreen: boolean; + private static _registeredPlugins; + private static _getPluginForFilename(sceneFilename); + static RegisterPlugin(plugin: ISceneLoaderPlugin): void; + static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene, e: any) => void): void; + /** + * Load a scene + * @param rootUrl a string that defines the root url for scene and resources + * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene + * @param engine is the instance of BABYLON.Engine to use to create the scene + */ + static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void; + /** + * Append a scene + * @param rootUrl a string that defines the root url for scene and resources + * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene + * @param scene is the instance of BABYLON.Scene to append to + */ + static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void; + } +} + +declare module BABYLON { + class EffectFallbacks { + private _defines; + private _currentRank; + private _maxRank; + addFallback(rank: number, define: string): void; + isMoreFallbacks: boolean; + reduce(currentDefines: string): string; + } + class Effect { + name: any; + defines: string; + onCompiled: (effect: Effect) => void; + onError: (effect: Effect, errors: string) => void; + onBind: (effect: Effect) => void; + private _engine; + private _uniformsNames; + private _samplers; + private _isReady; + private _compilationError; + private _attributesNames; + private _attributes; + private _uniforms; + _key: string; + private _program; + private _valueCache; + constructor(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], engine: any, defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void); + isReady(): boolean; + getProgram(): WebGLProgram; + getAttributesNames(): string[]; + getAttributeLocation(index: number): number; + getAttributeLocationByName(name: string): number; + getAttributesCount(): number; + getUniformIndex(uniformName: string): number; + getUniform(uniformName: string): WebGLUniformLocation; + getSamplers(): string[]; + getCompilationError(): string; + _loadVertexShader(vertex: any, callback: (data: any) => void): void; + _loadFragmentShader(fragment: any, callback: (data: any) => void): void; + private _prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks?); + _bindTexture(channel: string, texture: WebGLTexture): void; + setTexture(channel: string, texture: BaseTexture): void; + setTextureFromPostProcess(channel: string, postProcess: PostProcess): void; + _cacheFloat2(uniformName: string, x: number, y: number): void; + _cacheFloat3(uniformName: string, x: number, y: number, z: number): void; + _cacheFloat4(uniformName: string, x: number, y: number, z: number, w: number): void; + setArray(uniformName: string, array: number[]): Effect; + setArray2(uniformName: string, array: number[]): Effect; + setArray3(uniformName: string, array: number[]): Effect; + setArray4(uniformName: string, array: number[]): Effect; + setMatrices(uniformName: string, matrices: Float32Array): Effect; + setMatrix(uniformName: string, matrix: Matrix): Effect; + setMatrix3x3(uniformName: string, matrix: Float32Array): Effect; + setMatrix2x2(uniformname: string, matrix: Float32Array): Effect; + setFloat(uniformName: string, value: number): Effect; + setBool(uniformName: string, bool: boolean): Effect; + setVector2(uniformName: string, vector2: Vector2): Effect; + setFloat2(uniformName: string, x: number, y: number): Effect; + setVector3(uniformName: string, vector3: Vector3): Effect; + setFloat3(uniformName: string, x: number, y: number, z: number): Effect; + setVector4(uniformName: string, vector4: Vector4): Effect; + setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect; + setColor3(uniformName: string, color3: Color3): Effect; + setColor4(uniformName: string, color3: Color3, alpha: number): Effect; + static ShadersStore: {}; + } +} + +declare module BABYLON { + class Material { + name: string; + private static _TriangleFillMode; + private static _WireFrameFillMode; + private static _PointFillMode; + static TriangleFillMode: number; + static WireFrameFillMode: number; + static PointFillMode: number; + id: string; + checkReadyOnEveryCall: boolean; + checkReadyOnlyOnce: boolean; + state: string; + alpha: number; + backFaceCulling: boolean; + onCompiled: (effect: Effect) => void; + onError: (effect: Effect, errors: string) => void; + onDispose: () => void; + onBind: (material: Material, mesh: Mesh) => void; + getRenderTargetTextures: () => SmartArray; + alphaMode: number; + disableDepthWrite: boolean; + _effect: Effect; + _wasPreviouslyReady: boolean; + private _scene; + private _fillMode; + private _cachedDepthWriteState; + pointSize: number; + zOffset: number; + wireframe: boolean; + pointsCloud: boolean; + fillMode: number; + constructor(name: string, scene: Scene, doNotAdd?: boolean); + isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; + getEffect(): Effect; + getScene(): Scene; + needAlphaBlending(): boolean; + needAlphaTesting(): boolean; + getAlphaTestTexture(): BaseTexture; + trackCreation(onCompiled: (effect: Effect) => void, onError: (effect: Effect, errors: string) => void): void; + _preBind(): void; + bind(world: Matrix, mesh?: Mesh): void; + bindOnlyWorldMatrix(world: Matrix): void; + unbind(): void; + clone(name: string): Material; + dispose(forceDisposeEffect?: boolean): void; + } +} + +declare module BABYLON { + class MultiMaterial extends Material { + subMaterials: Material[]; + constructor(name: string, scene: Scene); + getSubMaterial(index: any): Material; + isReady(mesh?: AbstractMesh): boolean; + clone(name: string): MultiMaterial; + } +} + +declare module BABYLON { + class ShaderMaterial extends Material { + private _shaderPath; + private _options; + private _textures; + private _floats; + private _floatsArrays; + private _colors3; + private _colors4; + private _vectors2; + private _vectors3; + private _vectors4; + private _matrices; + private _matrices3x3; + private _matrices2x2; + private _cachedWorldViewMatrix; + private _renderId; + constructor(name: string, scene: Scene, shaderPath: any, options: any); + needAlphaBlending(): boolean; + needAlphaTesting(): boolean; + private _checkUniform(uniformName); + setTexture(name: string, texture: Texture): ShaderMaterial; + setFloat(name: string, value: number): ShaderMaterial; + setFloats(name: string, value: number[]): ShaderMaterial; + setColor3(name: string, value: Color3): ShaderMaterial; + setColor4(name: string, value: Color4): ShaderMaterial; + setVector2(name: string, value: Vector2): ShaderMaterial; + setVector3(name: string, value: Vector3): ShaderMaterial; + setVector4(name: string, value: Vector4): ShaderMaterial; + setMatrix(name: string, value: Matrix): ShaderMaterial; + setMatrix3x3(name: string, value: Float32Array): ShaderMaterial; + setMatrix2x2(name: string, value: Float32Array): ShaderMaterial; + isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; + bindOnlyWorldMatrix(world: Matrix): void; + bind(world: Matrix, mesh?: Mesh): void; + clone(name: string): ShaderMaterial; + dispose(forceDisposeEffect?: boolean): void; + } +} + +declare module BABYLON { + class FresnelParameters { + isEnabled: boolean; + leftColor: Color3; + rightColor: Color3; + bias: number; + power: number; + } + class StandardMaterial extends Material { + diffuseTexture: BaseTexture; + ambientTexture: BaseTexture; + opacityTexture: BaseTexture; + reflectionTexture: BaseTexture; + emissiveTexture: BaseTexture; + specularTexture: BaseTexture; + bumpTexture: BaseTexture; + ambientColor: Color3; + diffuseColor: Color3; + specularColor: Color3; + specularPower: number; + emissiveColor: Color3; + useAlphaFromDiffuseTexture: boolean; + useEmissiveAsIllumination: boolean; + useReflectionFresnelFromSpecular: boolean; + useSpecularOverAlpha: boolean; + fogEnabled: boolean; + roughness: number; + diffuseFresnelParameters: FresnelParameters; + opacityFresnelParameters: FresnelParameters; + reflectionFresnelParameters: FresnelParameters; + emissiveFresnelParameters: FresnelParameters; + useGlossinessFromSpecularMapAlpha: boolean; + private _renderTargets; + private _worldViewProjectionMatrix; + private _globalAmbientColor; + private _scaledDiffuse; + private _scaledSpecular; + private _renderId; + private _defines; + private _cachedDefines; + constructor(name: string, scene: Scene); + needAlphaBlending(): boolean; + needAlphaTesting(): boolean; + private _shouldUseAlphaFromDiffuseTexture(); + getAlphaTestTexture(): BaseTexture; + isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; + unbind(): void; + bindOnlyWorldMatrix(world: Matrix): void; + bind(world: Matrix, mesh?: Mesh): void; + getAnimatables(): IAnimatable[]; + dispose(forceDisposeEffect?: boolean): void; + clone(name: string): StandardMaterial; + static DiffuseTextureEnabled: boolean; + static AmbientTextureEnabled: boolean; + static OpacityTextureEnabled: boolean; + static ReflectionTextureEnabled: boolean; + static EmissiveTextureEnabled: boolean; + static SpecularTextureEnabled: boolean; + static BumpTextureEnabled: boolean; + static FresnelEnabled: boolean; + } +} + +declare module BABYLON { + class Color3 { + r: number; + g: number; + b: number; + constructor(r?: number, g?: number, b?: number); + toString(): string; + toArray(array: number[], index?: number): Color3; + toColor4(alpha?: number): Color4; + asArray(): number[]; + toLuminance(): number; + multiply(otherColor: Color3): Color3; + multiplyToRef(otherColor: Color3, result: Color3): Color3; + equals(otherColor: Color3): boolean; + equalsFloats(r: number, g: number, b: number): boolean; + scale(scale: number): Color3; + scaleToRef(scale: number, result: Color3): Color3; + add(otherColor: Color3): Color3; + addToRef(otherColor: Color3, result: Color3): Color3; + subtract(otherColor: Color3): Color3; + subtractToRef(otherColor: Color3, result: Color3): Color3; + clone(): Color3; + copyFrom(source: Color3): Color3; + copyFromFloats(r: number, g: number, b: number): Color3; + toHexString(): string; + static FromHexString(hex: string): Color3; + static FromArray(array: number[], offset?: number): Color3; + static FromInts(r: number, g: number, b: number): Color3; + static Lerp(start: Color3, end: Color3, amount: number): Color3; + static Red(): Color3; + static Green(): Color3; + static Blue(): Color3; + static Black(): Color3; + static White(): Color3; + static Purple(): Color3; + static Magenta(): Color3; + static Yellow(): Color3; + static Gray(): Color3; + } + class Color4 { + r: number; + g: number; + b: number; + a: number; + constructor(r: number, g: number, b: number, a: number); + addInPlace(right: any): Color4; + asArray(): number[]; + toArray(array: number[], index?: number): Color4; + add(right: Color4): Color4; + subtract(right: Color4): Color4; + subtractToRef(right: Color4, result: Color4): Color4; + scale(scale: number): Color4; + scaleToRef(scale: number, result: Color4): Color4; + toString(): string; + clone(): Color4; + copyFrom(source: Color4): Color4; + toHexString(): string; + static FromHexString(hex: string): Color4; + static Lerp(left: Color4, right: Color4, amount: number): Color4; + static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void; + static FromArray(array: number[], offset?: number): Color4; + static FromInts(r: number, g: number, b: number, a: number): Color4; + } + class Vector2 { + x: number; + y: number; + constructor(x: number, y: number); + toString(): string; + toArray(array: number[], index?: number): Vector2; + asArray(): number[]; + copyFrom(source: Vector2): Vector2; + copyFromFloats(x: number, y: number): Vector2; + add(otherVector: Vector2): Vector2; + addVector3(otherVector: Vector3): Vector2; + subtract(otherVector: Vector2): Vector2; + subtractInPlace(otherVector: Vector2): Vector2; + multiplyInPlace(otherVector: Vector2): Vector2; + multiply(otherVector: Vector2): Vector2; + multiplyToRef(otherVector: Vector2, result: Vector2): Vector2; + multiplyByFloats(x: number, y: number): Vector2; + divide(otherVector: Vector2): Vector2; + divideToRef(otherVector: Vector2, result: Vector2): Vector2; + negate(): Vector2; + scaleInPlace(scale: number): Vector2; + scale(scale: number): Vector2; + equals(otherVector: Vector2): boolean; + equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean; + length(): number; + lengthSquared(): number; + normalize(): Vector2; + clone(): Vector2; + static Zero(): Vector2; + static FromArray(array: number[], offset?: number): Vector2; + static FromArrayToRef(array: number[], offset: number, result: Vector2): void; + static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2; + static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2; + static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2; + static Lerp(start: Vector2, end: Vector2, amount: number): Vector2; + static Dot(left: Vector2, right: Vector2): number; + static Normalize(vector: Vector2): Vector2; + static Minimize(left: Vector2, right: Vector2): Vector2; + static Maximize(left: Vector2, right: Vector2): Vector2; + static Transform(vector: Vector2, transformation: Matrix): Vector2; + static Distance(value1: Vector2, value2: Vector2): number; + static DistanceSquared(value1: Vector2, value2: Vector2): number; + } + class Vector3 { + x: number; + y: number; + z: number; + constructor(x: number, y: number, z: number); + toString(): string; + asArray(): number[]; + toArray(array: number[], index?: number): Vector3; + toQuaternion(): Quaternion; + addInPlace(otherVector: Vector3): Vector3; + add(otherVector: Vector3): Vector3; + addToRef(otherVector: Vector3, result: Vector3): Vector3; + subtractInPlace(otherVector: Vector3): Vector3; + subtract(otherVector: Vector3): Vector3; + subtractToRef(otherVector: Vector3, result: Vector3): Vector3; + subtractFromFloats(x: number, y: number, z: number): Vector3; + subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3; + negate(): Vector3; + scaleInPlace(scale: number): Vector3; + scale(scale: number): Vector3; + scaleToRef(scale: number, result: Vector3): void; + equals(otherVector: Vector3): boolean; + equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean; + equalsToFloats(x: number, y: number, z: number): boolean; + multiplyInPlace(otherVector: Vector3): Vector3; + multiply(otherVector: Vector3): Vector3; + multiplyToRef(otherVector: Vector3, result: Vector3): Vector3; + multiplyByFloats(x: number, y: number, z: number): Vector3; + divide(otherVector: Vector3): Vector3; + divideToRef(otherVector: Vector3, result: Vector3): Vector3; + MinimizeInPlace(other: Vector3): Vector3; + MaximizeInPlace(other: Vector3): Vector3; + length(): number; + lengthSquared(): number; + normalize(): Vector3; + clone(): Vector3; + copyFrom(source: Vector3): Vector3; + copyFromFloats(x: number, y: number, z: number): Vector3; + static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: any): number; + static FromArray(array: number[], offset?: number): Vector3; + static FromFloatArray(array: Float32Array, offset?: number): Vector3; + static FromArrayToRef(array: number[], offset: number, result: Vector3): void; + static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void; + static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void; + static Zero(): Vector3; + static Up(): Vector3; + static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3; + static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void; + static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; + static TransformCoordinatesToRefSIMD(vector: Vector3, transformation: Matrix, result: Vector3): void; + static TransformCoordinatesFromFloatsToRefSIMD(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; + static TransformNormal(vector: Vector3, transformation: Matrix): Vector3; + static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void; + static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; + static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3; + static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3; + static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3; + static Lerp(start: Vector3, end: Vector3, amount: number): Vector3; + static Dot(left: Vector3, right: Vector3): number; + static Cross(left: Vector3, right: Vector3): Vector3; + static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void; + static Normalize(vector: Vector3): Vector3; + static NormalizeToRef(vector: Vector3, result: Vector3): void; + static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3; + static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3; + static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3; + static Minimize(left: Vector3, right: Vector3): Vector3; + static Maximize(left: Vector3, right: Vector3): Vector3; + static Distance(value1: Vector3, value2: Vector3): number; + static DistanceSquared(value1: Vector3, value2: Vector3): number; + static Center(value1: Vector3, value2: Vector3): Vector3; + /** + * Given three orthogonal left-handed oriented Vector3 axis in space (target system), + * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply + * to something in order to rotate it from its local system to the given target system. + */ + static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3; + /** + * The same than RotationFromAxis but updates the passed ref Vector3 parameter. + */ + static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void; + } + class Vector4 { + x: number; + y: number; + z: number; + w: number; + constructor(x: number, y: number, z: number, w: number); + toString(): string; + asArray(): number[]; + toArray(array: number[], index?: number): Vector4; + addInPlace(otherVector: Vector4): Vector4; + add(otherVector: Vector4): Vector4; + addToRef(otherVector: Vector4, result: Vector4): Vector4; + subtractInPlace(otherVector: Vector4): Vector4; + subtract(otherVector: Vector4): Vector4; + subtractToRef(otherVector: Vector4, result: Vector4): Vector4; + subtractFromFloats(x: number, y: number, z: number, w: number): Vector4; + subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4; + negate(): Vector4; + scaleInPlace(scale: number): Vector4; + scale(scale: number): Vector4; + scaleToRef(scale: number, result: Vector4): void; + equals(otherVector: Vector4): boolean; + equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean; + equalsToFloats(x: number, y: number, z: number, w: number): boolean; + multiplyInPlace(otherVector: Vector4): Vector4; + multiply(otherVector: Vector4): Vector4; + multiplyToRef(otherVector: Vector4, result: Vector4): Vector4; + multiplyByFloats(x: number, y: number, z: number, w: number): Vector4; + divide(otherVector: Vector4): Vector4; + divideToRef(otherVector: Vector4, result: Vector4): Vector4; + MinimizeInPlace(other: Vector4): Vector4; + MaximizeInPlace(other: Vector4): Vector4; + length(): number; + lengthSquared(): number; + normalize(): Vector4; + clone(): Vector4; + copyFrom(source: Vector4): Vector4; + copyFromFloats(x: number, y: number, z: number, w: number): Vector4; + static FromArray(array: number[], offset?: number): Vector4; + static FromArrayToRef(array: number[], offset: number, result: Vector4): void; + static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void; + static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void; + static Zero(): Vector4; + static Normalize(vector: Vector4): Vector4; + static NormalizeToRef(vector: Vector4, result: Vector4): void; + static Minimize(left: Vector4, right: Vector4): Vector4; + static Maximize(left: Vector4, right: Vector4): Vector4; + static Distance(value1: Vector4, value2: Vector4): number; + static DistanceSquared(value1: Vector4, value2: Vector4): number; + static Center(value1: Vector4, value2: Vector4): Vector4; + } + class Quaternion { + x: number; + y: number; + z: number; + w: number; + constructor(x?: number, y?: number, z?: number, w?: number); + toString(): string; + asArray(): number[]; + equals(otherQuaternion: Quaternion): boolean; + clone(): Quaternion; + copyFrom(other: Quaternion): Quaternion; + copyFromFloats(x: number, y: number, z: number, w: number): Quaternion; + add(other: Quaternion): Quaternion; + subtract(other: Quaternion): Quaternion; + scale(value: number): Quaternion; + multiply(q1: Quaternion): Quaternion; + multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion; + length(): number; + normalize(): Quaternion; + toEulerAngles(): Vector3; + toEulerAnglesToRef(result: Vector3): Quaternion; + toRotationMatrix(result: Matrix): Quaternion; + fromRotationMatrix(matrix: Matrix): Quaternion; + static FromRotationMatrix(matrix: Matrix): Quaternion; + static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void; + static Inverse(q: Quaternion): Quaternion; + static Identity(): Quaternion; + static RotationAxis(axis: Vector3, angle: number): Quaternion; + static FromArray(array: number[], offset?: number): Quaternion; + static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion; + static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void; + static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion; + static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void; + static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion; + } + class Matrix { + private static _tempQuaternion; + private static _xAxis; + private static _yAxis; + private static _zAxis; + m: Float32Array; + isIdentity(): boolean; + determinant(): number; + toArray(): Float32Array; + asArray(): Float32Array; + invert(): Matrix; + reset(): Matrix; + add(other: Matrix): Matrix; + addToRef(other: Matrix, result: Matrix): Matrix; + addToSelf(other: Matrix): Matrix; + invertToRef(other: Matrix): Matrix; + invertToRefSIMD(other: Matrix): Matrix; + setTranslation(vector3: Vector3): Matrix; + multiply(other: Matrix): Matrix; + copyFrom(other: Matrix): Matrix; + copyToArray(array: Float32Array, offset?: number): Matrix; + multiplyToRef(other: Matrix, result: Matrix): Matrix; + multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix; + multiplyToArraySIMD(other: Matrix, result: Matrix, offset?: number): void; + equals(value: Matrix): boolean; + clone(): Matrix; + decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean; + static FromArray(array: number[], offset?: number): Matrix; + static FromArrayToRef(array: number[], offset: number, result: Matrix): void; + static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void; + static FromValuesToRef(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number, result: Matrix): void; + static FromValues(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number): Matrix; + static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix; + static Identity(): Matrix; + static IdentityToRef(result: Matrix): void; + static Zero(): Matrix; + static RotationX(angle: number): Matrix; + static Invert(source: Matrix): Matrix; + static RotationXToRef(angle: number, result: Matrix): void; + static RotationY(angle: number): Matrix; + static RotationYToRef(angle: number, result: Matrix): void; + static RotationZ(angle: number): Matrix; + static RotationZToRef(angle: number, result: Matrix): void; + static RotationAxis(axis: Vector3, angle: number): Matrix; + static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix; + static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void; + static Scaling(x: number, y: number, z: number): Matrix; + static ScalingToRef(x: number, y: number, z: number, result: Matrix): void; + static Translation(x: number, y: number, z: number): Matrix; + static TranslationToRef(x: number, y: number, z: number, result: Matrix): void; + static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix; + static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void; + static LookAtLHToRefSIMD(eyeRef: Vector3, targetRef: Vector3, upRef: Vector3, result: Matrix): void; + static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix; + static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void; + static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix; + static OrthoOffCenterLHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void; + static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix; + static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix; + static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, fovMode?: number): void; + static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix; + static GetAsMatrix2x2(matrix: Matrix): Float32Array; + static GetAsMatrix3x3(matrix: Matrix): Float32Array; + static Transpose(matrix: Matrix): Matrix; + static Reflection(plane: Plane): Matrix; + static ReflectionToRef(plane: Plane, result: Matrix): void; + } + class Plane { + normal: Vector3; + d: number; + constructor(a: number, b: number, c: number, d: number); + asArray(): number[]; + clone(): Plane; + normalize(): Plane; + transform(transformation: Matrix): Plane; + dotCoordinate(point: any): number; + copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane; + isFrontFacingTo(direction: Vector3, epsilon: number): boolean; + signedDistanceTo(point: Vector3): number; + static FromArray(array: number[]): Plane; + static FromPoints(point1: any, point2: any, point3: any): Plane; + static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane; + static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number; + } + class Viewport { + x: number; + y: number; + width: number; + height: number; + constructor(x: number, y: number, width: number, height: number); + toGlobal(engine: any): Viewport; + } + class Frustum { + static GetPlanes(transform: Matrix): Plane[]; + static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void; + } + class Ray { + origin: Vector3; + direction: Vector3; + length: number; + private _edge1; + private _edge2; + private _pvec; + private _tvec; + private _qvec; + constructor(origin: Vector3, direction: Vector3, length?: number); + intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean; + intersectsBox(box: BoundingBox): boolean; + intersectsSphere(sphere: any): boolean; + intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo; + static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray; + /** + * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be + * transformed to the given world matrix. + * @param origin The origin point + * @param end The end point + * @param world a matrix to transform the ray to. Default is the identity matrix. + */ + static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray; + static Transform(ray: Ray, matrix: Matrix): Ray; + } + enum Space { + LOCAL = 0, + WORLD = 1, + } + class Axis { + static X: Vector3; + static Y: Vector3; + static Z: Vector3; + } + class BezierCurve { + static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number; + } + enum Orientation { + CW = 0, + CCW = 1, + } + class Angle { + private _radians; + constructor(radians: number); + degrees: () => number; + radians: () => number; + static BetweenTwoPoints(a: Vector2, b: Vector2): Angle; + static FromRadians(radians: number): Angle; + static FromDegrees(degrees: number): Angle; + } + class Arc2 { + startPoint: Vector2; + midPoint: Vector2; + endPoint: Vector2; + centerPoint: Vector2; + radius: number; + angle: Angle; + startAngle: Angle; + orientation: Orientation; + constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2); + } + class PathCursor { + private path; + private _onchange; + value: number; + animations: Animation[]; + constructor(path: Path2); + getPoint(): Vector3; + moveAhead(step?: number): PathCursor; + moveBack(step?: number): PathCursor; + move(step: number): PathCursor; + private ensureLimits(); + private markAsDirty(propertyName); + private raiseOnChange(); + onchange(f: (cursor: PathCursor) => void): PathCursor; + } + class Path2 { + private _points; + private _length; + closed: boolean; + constructor(x: number, y: number); + addLineTo(x: number, y: number): Path2; + addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2; + close(): Path2; + length(): number; + getPoints(): Vector2[]; + getPointAtLengthPosition(normalizedLengthPosition: number): Vector2; + static StartingAt(x: number, y: number): Path2; + } + class Path3D { + path: Vector3[]; + private _curve; + private _distances; + private _tangents; + private _normals; + private _binormals; + private _raw; + /** + * new Path3D(path, normal, raw) + * path : an array of Vector3, the curve axis of the Path3D + * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal. + * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed. + */ + constructor(path: Vector3[], firstNormal?: Vector3, raw?: boolean); + getCurve(): Vector3[]; + getTangents(): Vector3[]; + getNormals(): Vector3[]; + getBinormals(): Vector3[]; + getDistances(): number[]; + update(path: Vector3[], firstNormal?: Vector3): Path3D; + private _compute(firstNormal); + private _getFirstNonNullVector(index); + private _getLastNonNullVector(index); + private _normalVector(v0, vt, va); + } + class Curve3 { + private _points; + private _length; + static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3; + static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3; + static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3; + constructor(points: Vector3[]); + getPoints(): Vector3[]; + length(): number; + continue(curve: Curve3): Curve3; + private _computeLength(path); + } + class PositionNormalVertex { + position: Vector3; + normal: Vector3; + constructor(position?: Vector3, normal?: Vector3); + clone(): PositionNormalVertex; + } + class PositionNormalTextureVertex { + position: Vector3; + normal: Vector3; + uv: Vector2; + constructor(position?: Vector3, normal?: Vector3, uv?: Vector2); + clone(): PositionNormalTextureVertex; + } + class SIMDHelper { + private static _isEnabled; + static IsEnabled: boolean; + static DisableSIMD(): void; + static EnableSIMD(): void; + } +} + +declare module BABYLON { + class AbstractMesh extends Node implements IDisposable { + private static _BILLBOARDMODE_NONE; + private static _BILLBOARDMODE_X; + private static _BILLBOARDMODE_Y; + private static _BILLBOARDMODE_Z; + private static _BILLBOARDMODE_ALL; + static BILLBOARDMODE_NONE: number; + static BILLBOARDMODE_X: number; + static BILLBOARDMODE_Y: number; + static BILLBOARDMODE_Z: number; + static BILLBOARDMODE_ALL: number; + definedFacingForward: boolean; + position: Vector3; + rotation: Vector3; + rotationQuaternion: Quaternion; + scaling: Vector3; + billboardMode: number; + visibility: number; + alphaIndex: number; + infiniteDistance: boolean; + isVisible: boolean; + isPickable: boolean; + showBoundingBox: boolean; + showSubMeshesBoundingBox: boolean; + onDispose: any; + isBlocker: boolean; + skeleton: Skeleton; + renderingGroupId: number; + material: Material; + receiveShadows: boolean; + actionManager: ActionManager; + renderOutline: boolean; + outlineColor: Color3; + outlineWidth: number; + renderOverlay: boolean; + overlayColor: Color3; + overlayAlpha: number; + hasVertexAlpha: boolean; + useVertexColors: boolean; + applyFog: boolean; + computeBonesUsingShaders: boolean; + useOctreeForRenderingSelection: boolean; + useOctreeForPicking: boolean; + useOctreeForCollisions: boolean; + layerMask: number; + alwaysSelectAsActiveMesh: boolean; + _physicImpostor: number; + _physicsMass: number; + _physicsFriction: number; + _physicRestitution: number; + private _checkCollisions; + ellipsoid: Vector3; + ellipsoidOffset: Vector3; + private _collider; + private _oldPositionForCollisions; + private _diffPositionForCollisions; + private _newPositionForCollisions; + onCollide: (collidedMesh: AbstractMesh) => void; + private _meshToBoneReferal; + edgesWidth: number; + edgesColor: Color4; + _edgesRenderer: EdgesRenderer; + private _localScaling; + private _localRotation; + private _localTranslation; + private _localBillboard; + private _localPivotScaling; + private _localPivotScalingRotation; + private _localMeshReferalTransform; + private _localWorld; + _worldMatrix: Matrix; + private _rotateYByPI; + private _absolutePosition; + private _collisionsTransformMatrix; + private _collisionsScalingMatrix; + _positions: Vector3[]; + private _isDirty; + _masterMesh: AbstractMesh; + _boundingInfo: BoundingInfo; + private _pivotMatrix; + _isDisposed: boolean; + _renderId: number; + subMeshes: SubMesh[]; + _submeshesOctree: Octree; + _intersectionsInProgress: AbstractMesh[]; + private _onAfterWorldMatrixUpdate; + private _isWorldMatrixFrozen; + _waitingActions: any; + _waitingFreezeWorldMatrix: boolean; + constructor(name: string, scene: Scene); + disableEdgesRendering(): void; + enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): void; + isBlocked: boolean; + getLOD(camera: Camera): AbstractMesh; + getTotalVertices(): number; + getIndices(): number[]; + getVerticesData(kind: string): number[]; + isVerticesDataPresent(kind: string): boolean; + getBoundingInfo(): BoundingInfo; + useBones: boolean; + _preActivate(): void; + _activate(renderId: number): void; + getWorldMatrix(): Matrix; + worldMatrixFromCache: Matrix; + absolutePosition: Vector3; + freezeWorldMatrix(): void; + unfreezeWorldMatrix(): void; + isWorldMatrixFrozen: boolean; + rotate(axis: Vector3, amount: number, space: Space): void; + translate(axis: Vector3, distance: number, space: Space): void; + getAbsolutePosition(): Vector3; + setAbsolutePosition(absolutePosition: Vector3): void; + /** + * Perform relative position change from the point of view of behind the front of the mesh. + * This is performed taking into account the meshes current rotation, so you do not have to care. + * Supports definition of mesh facing forward or backward. + * @param {number} amountRight + * @param {number} amountUp + * @param {number} amountForward + */ + movePOV(amountRight: number, amountUp: number, amountForward: number): void; + /** + * Calculate relative position change from the point of view of behind the front of the mesh. + * This is performed taking into account the meshes current rotation, so you do not have to care. + * Supports definition of mesh facing forward or backward. + * @param {number} amountRight + * @param {number} amountUp + * @param {number} amountForward + */ + calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3; + /** + * Perform relative rotation change from the point of view of behind the front of the mesh. + * Supports definition of mesh facing forward or backward. + * @param {number} flipBack + * @param {number} twirlClockwise + * @param {number} tiltRight + */ + rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): void; + /** + * Calculate relative rotation change from the point of view of behind the front of the mesh. + * Supports definition of mesh facing forward or backward. + * @param {number} flipBack + * @param {number} twirlClockwise + * @param {number} tiltRight + */ + calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3; + setPivotMatrix(matrix: Matrix): void; + getPivotMatrix(): Matrix; + _isSynchronized(): boolean; + _initCache(): void; + markAsDirty(property: string): void; + _updateBoundingInfo(): void; + _updateSubMeshesBoundingInfo(matrix: Matrix): void; + computeWorldMatrix(force?: boolean): Matrix; + /** + * If you'd like to be callbacked after the mesh position, rotation or scaling has been updated + * @param func: callback function to add + */ + registerAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void; + unregisterAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void; + setPositionWithLocalVector(vector3: Vector3): void; + getPositionExpressedInLocalSpace(): Vector3; + locallyTranslate(vector3: Vector3): void; + lookAt(targetPoint: Vector3, yawCor: number, pitchCor: number, rollCor: number): void; + attachToBone(bone: Bone, affectedMesh: AbstractMesh): void; + detachFromBone(): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + isCompletelyInFrustum(camera?: Camera): boolean; + intersectsMesh(mesh: AbstractMesh, precise?: boolean): boolean; + intersectsPoint(point: Vector3): boolean; + setPhysicsState(impostor?: any, options?: PhysicsBodyCreationOptions): any; + getPhysicsImpostor(): number; + getPhysicsMass(): number; + getPhysicsFriction(): number; + getPhysicsRestitution(): number; + getPositionInCameraSpace(camera?: Camera): Vector3; + getDistanceToCamera(camera?: Camera): number; + applyImpulse(force: Vector3, contactPoint: Vector3): void; + setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): void; + updatePhysicsBodyPosition(): void; + checkCollisions: boolean; + moveWithCollisions(velocity: Vector3): void; + private _onCollisionPositionChange; + /** + * This function will create an octree to help select the right submeshes for rendering, picking and collisions + * Please note that you must have a decent number of submeshes to get performance improvements when using octree + */ + createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree; + _collideForSubMesh(subMesh: SubMesh, transformMatrix: Matrix, collider: Collider): void; + _processCollisionsForSubMeshes(collider: Collider, transformMatrix: Matrix): void; + _checkCollision(collider: Collider): void; + _generatePointsArray(): boolean; + intersects(ray: Ray, fastCheck?: boolean): PickingInfo; + clone(name: string, newParent: Node, doNotCloneChildren?: boolean): AbstractMesh; + releaseSubMeshes(): void; + dispose(doNotRecurse?: boolean): void; + } +} + +declare module BABYLON { + class CSG { + private polygons; + matrix: Matrix; + position: Vector3; + rotation: Vector3; + rotationQuaternion: Quaternion; + scaling: Vector3; + static FromMesh(mesh: Mesh): CSG; + private static FromPolygons(polygons); + clone(): CSG; + private toPolygons(); + union(csg: CSG): CSG; + unionInPlace(csg: CSG): void; + subtract(csg: CSG): CSG; + subtractInPlace(csg: CSG): void; + intersect(csg: CSG): CSG; + intersectInPlace(csg: CSG): void; + inverse(): CSG; + inverseInPlace(): void; + copyTransformAttributes(csg: CSG): CSG; + buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh; + toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh; + } +} + +declare module BABYLON { + class Geometry implements IGetSetVerticesData { + id: string; + delayLoadState: number; + delayLoadingFile: string; + onGeometryUpdated: (geometry: Geometry, kind?: string) => void; + private _scene; + private _engine; + private _meshes; + private _totalVertices; + private _indices; + private _vertexBuffers; + private _isDisposed; + _delayInfo: any; + private _indexBuffer; + _boundingInfo: BoundingInfo; + _delayLoadingFunction: (any: any, geometry: Geometry) => void; + constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Mesh); + getScene(): Scene; + getEngine(): Engine; + isReady(): boolean; + setAllVerticesData(vertexData: VertexData, updatable?: boolean): void; + setVerticesData(kind: string, data: number[], updatable?: boolean, stride?: number): void; + updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void; + updateVerticesData(kind: string, data: number[], updateExtends?: boolean): void; + getTotalVertices(): number; + getVerticesData(kind: string, copyWhenShared?: boolean): number[]; + getVertexBuffer(kind: string): VertexBuffer; + getVertexBuffers(): VertexBuffer[]; + isVerticesDataPresent(kind: string): boolean; + getVerticesDataKinds(): string[]; + setIndices(indices: number[], totalVertices?: number): void; + getTotalIndices(): number; + getIndices(copyWhenShared?: boolean): number[]; + getIndexBuffer(): any; + releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void; + applyToMesh(mesh: Mesh): void; + private _applyToMesh(mesh); + private notifyUpdate(kind?); + load(scene: Scene, onLoaded?: () => void): void; + isDisposed(): boolean; + dispose(): void; + copy(id: string): Geometry; + static ExtractFromMesh(mesh: Mesh, id: string): Geometry; + static RandomId(): string; + } + module Geometry.Primitives { + class _Primitive extends Geometry { + private _beingRegenerated; + private _canBeRegenerated; + constructor(id: string, scene: Scene, vertexData?: VertexData, canBeRegenerated?: boolean, mesh?: Mesh); + canBeRegenerated(): boolean; + regenerate(): void; + asNewGeometry(id: string): Geometry; + setAllVerticesData(vertexData: VertexData, updatable?: boolean): void; + setVerticesData(kind: string, data: number[], updatable?: boolean): void; + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Ribbon extends _Primitive { + pathArray: Vector3[][]; + closeArray: boolean; + closePath: boolean; + offset: number; + side: number; + constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Box extends _Primitive { + size: number; + side: number; + constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Sphere extends _Primitive { + segments: number; + diameter: number; + side: number; + constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Cylinder extends _Primitive { + height: number; + diameterTop: number; + diameterBottom: number; + tessellation: number; + subdivisions: number; + side: number; + constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Torus extends _Primitive { + diameter: number; + thickness: number; + tessellation: number; + side: number; + constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Ground extends _Primitive { + width: number; + height: number; + subdivisions: number; + constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Mesh); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class TiledGround extends _Primitive { + xmin: number; + zmin: number; + xmax: number; + zmax: number; + subdivisions: { + w: number; + h: number; + }; + precision: { + w: number; + h: number; + }; + constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: { + w: number; + h: number; + }, precision: { + w: number; + h: number; + }, canBeRegenerated?: boolean, mesh?: Mesh); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Plane extends _Primitive { + size: number; + side: number; + constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class TorusKnot extends _Primitive { + radius: number; + tube: number; + radialSegments: number; + tubularSegments: number; + p: number; + q: number; + side: number; + constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + } +} + +declare module BABYLON { + class GroundMesh extends Mesh { + generateOctree: boolean; + private _worldInverse; + _subdivisions: number; + constructor(name: string, scene: Scene); + subdivisions: number; + optimize(chunksCount: number, octreeBlocksSize?: number): void; + getHeightAtCoordinates(x: number, z: number): number; + } +} + +declare module BABYLON { + /** + * Creates an instance based on a source mesh. + */ + class InstancedMesh extends AbstractMesh { + private _sourceMesh; + private _currentLOD; + constructor(name: string, source: Mesh); + receiveShadows: boolean; + material: Material; + visibility: number; + skeleton: Skeleton; + getTotalVertices(): number; + sourceMesh: Mesh; + getVerticesData(kind: string): number[]; + isVerticesDataPresent(kind: string): boolean; + getIndices(): number[]; + _positions: Vector3[]; + refreshBoundingInfo(): void; + _preActivate(): void; + _activate(renderId: number): void; + getLOD(camera: Camera): AbstractMesh; + _syncSubMeshes(): void; + _generatePointsArray(): boolean; + clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh; + dispose(doNotRecurse?: boolean): void; + } +} + +declare module BABYLON { + class LinesMesh extends Mesh { + color: Color3; + alpha: number; + private _colorShader; + constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean); + material: Material; + isPickable: boolean; + checkCollisions: boolean; + _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void; + _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void; + intersects(ray: Ray, fastCheck?: boolean): any; + dispose(doNotRecurse?: boolean): void; + clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): LinesMesh; + } +} + +declare module BABYLON { + class _InstancesBatch { + mustReturn: boolean; + visibleInstances: InstancedMesh[][]; + renderSelf: boolean[]; + } + class Mesh extends AbstractMesh implements IGetSetVerticesData { + static _FRONTSIDE: number; + static _BACKSIDE: number; + static _DOUBLESIDE: number; + static _DEFAULTSIDE: number; + static _NO_CAP: number; + static _CAP_START: number; + static _CAP_END: number; + static _CAP_ALL: number; + static FRONTSIDE: number; + static BACKSIDE: number; + static DOUBLESIDE: number; + static DEFAULTSIDE: number; + static NO_CAP: number; + static CAP_START: number; + static CAP_END: number; + static CAP_ALL: number; + delayLoadState: number; + instances: InstancedMesh[]; + delayLoadingFile: string; + _binaryInfo: any; + private _LODLevels; + onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void; + _geometry: Geometry; + private _onBeforeRenderCallbacks; + private _onAfterRenderCallbacks; + _delayInfo: any; + _delayLoadingFunction: (any: any, mesh: Mesh) => void; + _visibleInstances: any; + private _renderIdForInstances; + private _batchCache; + private _worldMatricesInstancesBuffer; + private _worldMatricesInstancesArray; + private _instancesBufferSize; + _shouldGenerateFlatShading: boolean; + private _preActivateId; + private _sideOrientation; + private _areNormalsFrozen; + private _sourcePositions; + private _sourceNormals; + /** + * @constructor + * @param {string} name - The value used by scene.getMeshByName() to do a lookup. + * @param {Scene} scene - The scene to add this mesh to. + * @param {Node} parent - The parent of this mesh, if it has one + * @param {Mesh} source - An optional Mesh from which geometry is shared, cloned. + * @param {boolean} doNotCloneChildren - When cloning, skip cloning child meshes of source, default False. + * When false, achieved by calling a clone(), also passing False. + * This will make creation of children, recursive. + */ + constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean); + hasLODLevels: boolean; + private _sortLODLevels(); + /** + * Add a mesh as LOD level triggered at the given distance. + * @param {number} distance - the distance from the center of the object to show this level + * @param {BABYLON.Mesh} mesh - the mesh to be added as LOD level + * @return {BABYLON.Mesh} this mesh (for chaining) + */ + addLODLevel(distance: number, mesh: Mesh): Mesh; + getLODLevelAtDistance(distance: number): Mesh; + /** + * Remove a mesh from the LOD array + * @param {BABYLON.Mesh} mesh - the mesh to be removed. + * @return {BABYLON.Mesh} this mesh (for chaining) + */ + removeLODLevel(mesh: Mesh): Mesh; + getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh; + geometry: Geometry; + getTotalVertices(): number; + getVerticesData(kind: string, copyWhenShared?: boolean): number[]; + getVertexBuffer(kind: any): VertexBuffer; + isVerticesDataPresent(kind: string): boolean; + getVerticesDataKinds(): string[]; + getTotalIndices(): number; + getIndices(copyWhenShared?: boolean): number[]; + isBlocked: boolean; + isReady(): boolean; + isDisposed(): boolean; + sideOrientation: number; + areNormalsFrozen: boolean; + /** This function affects parametric shapes on update only : ribbons, tubes, etc. It has no effect at all on other shapes */ + freezeNormals(): void; + /** This function affects parametric shapes on update only : ribbons, tubes, etc. It has no effect at all on other shapes */ + unfreezeNormals(): void; + _preActivate(): void; + _registerInstanceForRenderId(instance: InstancedMesh, renderId: number): void; + refreshBoundingInfo(): void; + _createGlobalSubMesh(): SubMesh; + subdivide(count: number): void; + setVerticesData(kind: any, data: any, updatable?: boolean, stride?: number): void; + updateVerticesData(kind: string, data: number[], updateExtends?: boolean, makeItUnique?: boolean): void; + updateVerticesDataDirectly(kind: string, data: Float32Array, offset?: number, makeItUnique?: boolean): void; + updateMeshPositions(positionFunction: any, computeNormals?: boolean): void; + makeGeometryUnique(): void; + setIndices(indices: number[], totalVertices?: number): void; + _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void; + _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void; + registerBeforeRender(func: (mesh: AbstractMesh) => void): void; + unregisterBeforeRender(func: (mesh: AbstractMesh) => void): void; + registerAfterRender(func: (mesh: AbstractMesh) => void): void; + unregisterAfterRender(func: (mesh: AbstractMesh) => void): void; + _getInstancesRenderList(subMeshId: number): _InstancesBatch; + _renderWithInstances(subMesh: SubMesh, fillMode: number, batch: _InstancesBatch, effect: Effect, engine: Engine): void; + _processRendering(subMesh: SubMesh, effect: Effect, fillMode: number, batch: _InstancesBatch, hardwareInstancedRendering: boolean, onBeforeDraw: (isInstance: boolean, world: Matrix) => void): void; + render(subMesh: SubMesh, enableAlphaMode: boolean): void; + getEmittedParticleSystems(): ParticleSystem[]; + getHierarchyEmittedParticleSystems(): ParticleSystem[]; + getChildren(): Node[]; + _checkDelayState(): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + setMaterialByID(id: string): void; + getAnimatables(): IAnimatable[]; + bakeTransformIntoVertices(transform: Matrix): void; + bakeCurrentTransformIntoVertices(): void; + _resetPointsArrayCache(): void; + _generatePointsArray(): boolean; + clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): Mesh; + dispose(doNotRecurse?: boolean): void; + applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void): void; + applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number): void; + convertToFlatShadedMesh(): void; + flipFaces(flipNormals?: boolean): void; + createInstance(name: string): InstancedMesh; + synchronizeInstances(): void; + /** + * Simplify the mesh according to the given array of settings. + * Function will return immediately and will simplify async. + * @param settings a collection of simplification settings. + * @param parallelProcessing should all levels calculate parallel or one after the other. + * @param type the type of simplification to run. + * @param successCallback optional success callback to be called after the simplification finished processing all settings. + */ + simplify(settings: Array, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): void; + /** + * Optimization of the mesh's indices, in case a mesh has duplicated vertices. + * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes. + * This should be used together with the simplification to avoid disappearing triangles. + * @param successCallback an optional success callback to be called after the optimization finished. + */ + optimizeIndices(successCallback?: (mesh?: Mesh) => void): void; + static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, scene: Scene, updatable?: boolean, sideOrientation?: number, ribbonInstance?: Mesh): Mesh; + static CreateDisc(name: string, radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateBox(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateBox(name: string, options: { + width?: number; + height?: number; + depth?: number; + faceUV?: Vector4[]; + faceColors?: Color4[]; + sideOrientation?: number; + updatable?: boolean; + }, scene: Scene): Mesh; + static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateSphere(name: string, options: { + segments?: number; + diameterX?: number; + diameterY?: number; + diameterZ?: number; + sideOrientation?: number; + updatable?: boolean; + }, scene: any): Mesh; + static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene: Scene, updatable?: any, sideOrientation?: number): Mesh; + static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateLines(name: string, points: Vector3[], scene: Scene, updatable?: boolean, linesInstance?: LinesMesh): LinesMesh; + static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Scene, updatable?: boolean, linesInstance?: LinesMesh): LinesMesh; + static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, extrudedInstance?: Mesh): Mesh; + static ExtrudeShapeCustom(name: string, shape: Vector3[], path: Vector3[], scaleFunction: any, rotationFunction: any, ribbonCloseArray: boolean, ribbonClosePath: boolean, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, extrudedInstance?: Mesh): Mesh; + private static _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance); + static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreatePlane(name: string, options: { + width?: number; + height?: number; + sideOrientation?: number; + updatable?: boolean; + }, scene: Scene): Mesh; + static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh; + static CreateGround(name: string, options: { + width?: number; + height?: number; + subdivisions?: number; + sideOrientation?: number; + updatable?: boolean; + }, scene: any): Mesh; + static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: { + w: number; + h: number; + }, precision: { + w: number; + h: number; + }, scene: Scene, updatable?: boolean): Mesh; + static CreateGroundFromHeightMap(name: string, url: string, width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, scene: Scene, updatable?: boolean, onReady?: (mesh: GroundMesh) => void): GroundMesh; + static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: { + (i: number, distance: number): number; + }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, tubeInstance?: Mesh): Mesh; + static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle?: number): Mesh; + /** + * Update the vertex buffers by applying transformation from the bones + * @param {skeleton} skeleton to apply + */ + applySkeleton(skeleton: Skeleton): Mesh; + static MinMax(meshes: AbstractMesh[]): { + min: Vector3; + max: Vector3; + }; + static Center(meshesOrMinMaxVector: any): Vector3; + /** + * Merge the array of meshes into a single mesh for performance reasons. + * @param {Array} meshes - The vertices source. They should all be of the same material. Entries can empty + * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes + * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true. + * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class. + */ + static MergeMeshes(meshes: Array, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh): Mesh; + } +} + +declare module BABYLON { + interface IGetSetVerticesData { + isVerticesDataPresent(kind: string): boolean; + getVerticesData(kind: string, copyWhenShared?: boolean): number[]; + getIndices(copyWhenShared?: boolean): number[]; + setVerticesData(kind: string, data: number[], updatable?: boolean): void; + updateVerticesData(kind: string, data: number[], updateExtends?: boolean, makeItUnique?: boolean): void; + setIndices(indices: number[]): void; + } + class VertexData { + positions: number[]; + normals: number[]; + uvs: number[]; + uvs2: number[]; + uvs3: number[]; + uvs4: number[]; + uvs5: number[]; + uvs6: number[]; + colors: number[]; + matricesIndices: number[]; + matricesWeights: number[]; + indices: number[]; + set(data: number[], kind: string): void; + applyToMesh(mesh: Mesh, updatable?: boolean): void; + applyToGeometry(geometry: Geometry, updatable?: boolean): void; + updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): void; + updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): void; + private _applyTo(meshOrGeometry, updatable?); + private _update(meshOrGeometry, updateExtends?, makeItUnique?); + transform(matrix: Matrix): void; + merge(other: VertexData): void; + static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean): VertexData; + static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean): VertexData; + private static _ExtractFrom(meshOrGeometry, copyWhenShared?); + static CreateRibbon(pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, sideOrientation?: number): VertexData; + static CreateBox(options: { + width?: number; + height?: number; + depth?: number; + faceUV?: Vector4[]; + faceColors?: Color4[]; + sideOrientation?: number; + }): VertexData; + static CreateBox(size: number, sideOrientation?: number): VertexData; + static CreateSphere(options: { + segments?: number; + diameterX?: number; + diameterY?: number; + diameterZ?: number; + sideOrientation?: number; + }): VertexData; + static CreateSphere(segments: number, diameter?: number, sideOrientation?: number): VertexData; + static CreateCylinder(height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, sideOrientation?: number): VertexData; + static CreateTorus(diameter: any, thickness: any, tessellation: any, sideOrientation?: number): VertexData; + static CreateLines(points: Vector3[]): VertexData; + static CreateDashedLines(points: Vector3[], dashSize: number, gapSize: number, dashNb: number): VertexData; + static CreateGround(options: { + width?: number; + height?: number; + subdivisions?: number; + sideOrientation?: number; + }): VertexData; + static CreateGround(width: number, height: number, subdivisions?: number): VertexData; + static CreateTiledGround(xmin: number, zmin: number, xmax: number, zmax: number, subdivisions?: { + w: number; + h: number; + }, precision?: { + w: number; + h: number; + }): VertexData; + static CreateGroundFromHeightMap(width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, buffer: Uint8Array, bufferWidth: number, bufferHeight: number): VertexData; + static CreatePlane(options: { + width?: number; + height?: number; + sideOrientation?: number; + }): VertexData; + static CreatePlane(size: number, sideOrientation?: number): VertexData; + static CreateDisc(radius: number, tessellation: number, sideOrientation?: number): VertexData; + static CreateTorusKnot(radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, sideOrientation?: number): VertexData; + /** + * @param {any} - positions (number[] or Float32Array) + * @param {any} - indices (number[] or Uint16Array) + * @param {any} - normals (number[] or Float32Array) + */ + static ComputeNormals(positions: any, indices: any, normals: any): void; + private static _ComputeSides(sideOrientation, positions, indices, normals, uvs); + } +} + +declare module BABYLON.Internals { + class MeshLODLevel { + distance: number; + mesh: Mesh; + constructor(distance: number, mesh: Mesh); + } +} + +declare module BABYLON { + /** + * A simplifier interface for future simplification implementations. + */ + interface ISimplifier { + /** + * Simplification of a given mesh according to the given settings. + * Since this requires computation, it is assumed that the function runs async. + * @param settings The settings of the simplification, including quality and distance + * @param successCallback A callback that will be called after the mesh was simplified. + * @param errorCallback in case of an error, this callback will be called. optional. + */ + simplify(settings: ISimplificationSettings, successCallback: (simplifiedMeshes: Mesh) => void, errorCallback?: () => void): void; + } + /** + * Expected simplification settings. + * Quality should be between 0 and 1 (1 being 100%, 0 being 0%); + */ + interface ISimplificationSettings { + quality: number; + distance: number; + optimizeMesh?: boolean; + } + class SimplificationSettings implements ISimplificationSettings { + quality: number; + distance: number; + optimizeMesh: boolean; + constructor(quality: number, distance: number, optimizeMesh?: boolean); + } + interface ISimplificationTask { + settings: Array; + simplificationType: SimplificationType; + mesh: Mesh; + successCallback?: () => void; + parallelProcessing: boolean; + } + class SimplificationQueue { + private _simplificationArray; + running: any; + constructor(); + addTask(task: ISimplificationTask): void; + executeNext(): void; + runSimplification(task: ISimplificationTask): void; + private getSimplifier(task); + } + /** + * The implemented types of simplification. + * At the moment only Quadratic Error Decimation is implemented. + */ + enum SimplificationType { + QUADRATIC = 0, + } + class DecimationTriangle { + vertices: Array; + normal: Vector3; + error: Array; + deleted: boolean; + isDirty: boolean; + borderFactor: number; + deletePending: boolean; + originalOffset: number; + constructor(vertices: Array); + } + class DecimationVertex { + position: Vector3; + id: any; + q: QuadraticMatrix; + isBorder: boolean; + triangleStart: number; + triangleCount: number; + originalOffsets: Array; + constructor(position: Vector3, id: any); + updatePosition(newPosition: Vector3): void; + } + class QuadraticMatrix { + data: Array; + constructor(data?: Array); + det(a11: any, a12: any, a13: any, a21: any, a22: any, a23: any, a31: any, a32: any, a33: any): number; + addInPlace(matrix: QuadraticMatrix): void; + addArrayInPlace(data: Array): void; + add(matrix: QuadraticMatrix): QuadraticMatrix; + static FromData(a: number, b: number, c: number, d: number): QuadraticMatrix; + static DataFromNumbers(a: number, b: number, c: number, d: number): number[]; + } + class Reference { + vertexId: number; + triangleId: number; + constructor(vertexId: number, triangleId: number); + } + /** + * An implementation of the Quadratic Error simplification algorithm. + * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf + * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS + * @author RaananW + */ + class QuadraticErrorSimplification implements ISimplifier { + private _mesh; + private triangles; + private vertices; + private references; + private initialized; + private _reconstructedMesh; + syncIterations: number; + aggressiveness: number; + decimationIterations: number; + boundingBoxEpsilon: number; + constructor(_mesh: Mesh); + simplify(settings: ISimplificationSettings, successCallback: (simplifiedMesh: Mesh) => void): void; + private isTriangleOnBoundingBox(triangle); + private runDecimation(settings, submeshIndex, successCallback); + private initWithMesh(submeshIndex, callback, optimizeMesh?); + private init(callback); + private reconstructMesh(submeshIndex); + private initDecimatedMesh(); + private isFlipped(vertex1, vertex2, point, deletedArray, borderFactor, delTr); + private updateTriangles(origVertex, vertex, deletedArray, deletedTriangles); + private identifyBorder(); + private updateMesh(identifyBorders?); + private vertexError(q, point); + private calculateError(vertex1, vertex2, pointResult?, normalResult?, uvResult?, colorResult?); + } +} + +declare module BABYLON { + class Polygon { + static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[]; + static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[]; + static Parse(input: string): Vector2[]; + static StartingAt(x: number, y: number): Path2; + } + class PolygonMeshBuilder { + private _swctx; + private _points; + private _outlinepoints; + private _holes; + private _name; + private _scene; + constructor(name: string, contours: Path2, scene: Scene); + constructor(name: string, contours: Vector2[], scene: Scene); + addHole(hole: Vector2[]): PolygonMeshBuilder; + build(updatable?: boolean, depth?: number): Mesh; + private addSide(positions, normals, uvs, indices, bounds, points, depth, flip); + } +} + +declare module BABYLON { + class SubMesh { + materialIndex: number; + verticesStart: number; + verticesCount: number; + indexStart: any; + indexCount: number; + linesIndexCount: number; + private _mesh; + private _renderingMesh; + private _boundingInfo; + private _linesIndexBuffer; + _lastColliderWorldVertices: Vector3[]; + _trianglePlanes: Plane[]; + _lastColliderTransformMatrix: Matrix; + _renderId: number; + _alphaIndex: number; + _distanceToCamera: number; + _id: number; + constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: any, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean); + getBoundingInfo(): BoundingInfo; + getMesh(): AbstractMesh; + getRenderingMesh(): Mesh; + getMaterial(): Material; + refreshBoundingInfo(): void; + _checkCollision(collider: Collider): boolean; + updateBoundingInfo(world: Matrix): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + render(enableAlphaMode: boolean): void; + getLinesIndexBuffer(indices: number[], engine: any): WebGLBuffer; + canIntersects(ray: Ray): boolean; + intersects(ray: Ray, positions: Vector3[], indices: number[], fastCheck?: boolean): IntersectionInfo; + clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh; + dispose(): void; + static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh; + } +} + +declare module BABYLON { + class VertexBuffer { + private _mesh; + private _engine; + private _buffer; + private _data; + private _updatable; + private _kind; + private _strideSize; + constructor(engine: any, data: number[], kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number); + isUpdatable(): boolean; + getData(): number[]; + getBuffer(): WebGLBuffer; + getStrideSize(): number; + create(data?: number[]): void; + update(data: number[]): void; + updateDirectly(data: Float32Array, offset: number): void; + dispose(): void; + private static _PositionKind; + private static _NormalKind; + private static _UVKind; + private static _UV2Kind; + private static _UV3Kind; + private static _UV4Kind; + private static _UV5Kind; + private static _UV6Kind; + private static _ColorKind; + private static _MatricesIndicesKind; + private static _MatricesWeightsKind; + static PositionKind: string; + static NormalKind: string; + static UVKind: string; + static UV2Kind: string; + static UV3Kind: string; + static UV4Kind: string; + static UV5Kind: string; + static UV6Kind: string; + static ColorKind: string; + static MatricesIndicesKind: string; + static MatricesWeightsKind: string; + } +} + +declare module BABYLON { + class Particle { + position: Vector3; + direction: Vector3; + color: Color4; + colorStep: Color4; + lifeTime: number; + age: number; + size: number; + angle: number; + angularSpeed: number; + copyTo(other: Particle): void; + } +} + +declare module BABYLON { + class ParticleSystem implements IDisposable { + name: string; + static BLENDMODE_ONEONE: number; + static BLENDMODE_STANDARD: number; + id: string; + renderingGroupId: number; + emitter: any; + emitRate: number; + manualEmitCount: number; + updateSpeed: number; + targetStopDuration: number; + disposeOnStop: boolean; + minEmitPower: number; + maxEmitPower: number; + minLifeTime: number; + maxLifeTime: number; + minSize: number; + maxSize: number; + minAngularSpeed: number; + maxAngularSpeed: number; + particleTexture: Texture; + layerMask: number; + onDispose: () => void; + updateFunction: (particles: Particle[]) => void; + blendMode: number; + forceDepthWrite: boolean; + gravity: Vector3; + direction1: Vector3; + direction2: Vector3; + minEmitBox: Vector3; + maxEmitBox: Vector3; + color1: Color4; + color2: Color4; + colorDead: Color4; + textureMask: Color4; + startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3) => void; + startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3) => void; + private particles; + private _capacity; + private _scene; + private _vertexDeclaration; + private _vertexStrideSize; + private _stockParticles; + private _newPartsExcess; + private _vertexBuffer; + private _indexBuffer; + private _vertices; + private _effect; + private _customEffect; + private _cachedDefines; + private _scaledColorStep; + private _colorDiff; + private _scaledDirection; + private _scaledGravity; + private _currentRenderId; + private _alive; + private _started; + private _stopped; + private _actualFrame; + private _scaledUpdateSpeed; + constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect); + recycleParticle(particle: Particle): void; + getCapacity(): number; + isAlive(): boolean; + isStarted(): boolean; + start(): void; + stop(): void; + _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void; + private _update(newParticles); + private _getEffect(); + animate(): void; + render(): number; + dispose(): void; + clone(name: string, newEmitter: any): ParticleSystem; + } +} + +declare module BABYLON { + interface IPhysicsEnginePlugin { + initialize(iterations?: number): any; + setGravity(gravity: Vector3): void; + runOneStep(delta: number): void; + registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; + registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; + unregisterMesh(mesh: AbstractMesh): any; + applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; + createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; + dispose(): void; + isSupported(): boolean; + updateBodyPosition(mesh: AbstractMesh): void; + } + interface PhysicsBodyCreationOptions { + mass: number; + friction: number; + restitution: number; + } + interface PhysicsCompoundBodyPart { + mesh: Mesh; + impostor: number; + } + class PhysicsEngine { + gravity: Vector3; + private _currentPlugin; + constructor(plugin?: IPhysicsEnginePlugin); + _initialize(gravity?: Vector3): void; + _runOneStep(delta: number): void; + _setGravity(gravity: Vector3): void; + _registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; + _registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; + _unregisterMesh(mesh: AbstractMesh): void; + _applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; + _createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; + _updateBodyPosition(mesh: AbstractMesh): void; + dispose(): void; + isSupported(): boolean; + static NoImpostor: number; + static SphereImpostor: number; + static BoxImpostor: number; + static PlaneImpostor: number; + static MeshImpostor: number; + static CapsuleImpostor: number; + static ConeImpostor: number; + static CylinderImpostor: number; + static ConvexHullImpostor: number; + static Epsilon: number; + } +} + +declare module BABYLON { + class BoundingBoxRenderer { + frontColor: Color3; + backColor: Color3; + showBackLines: boolean; + renderList: SmartArray; + private _scene; + private _colorShader; + private _vb; + private _ib; + constructor(scene: Scene); + private _prepareRessources(); + reset(): void; + render(): void; + dispose(): void; + } +} + +declare module BABYLON { + class DepthRenderer { + private _scene; + private _depthMap; + private _effect; + private _viewMatrix; + private _projectionMatrix; + private _transformMatrix; + private _worldViewProjection; + private _cachedDefines; + constructor(scene: Scene, type?: number); + isReady(subMesh: SubMesh, useInstances: boolean): boolean; + getDepthMap(): RenderTargetTexture; + dispose(): void; + } +} + +declare module BABYLON { + class EdgesRenderer { + private _source; + private _linesPositions; + private _linesNormals; + private _linesIndices; + private _epsilon; + private _indicesCount; + private _lineShader; + private _vb0; + private _vb1; + private _ib; + private _buffers; + private _checkVerticesInsteadOfIndices; + constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean); + private _prepareRessources(); + dispose(): void; + private _processEdgeForAdjacencies(pa, pb, p0, p1, p2); + private _processEdgeForAdjacenciesWithVertices(pa, pb, p0, p1, p2); + private _checkEdge(faceIndex, edge, faceNormals, p0, p1); + _generateEdgesLines(): void; + render(): void; + } +} + +declare module BABYLON { + class OutlineRenderer { + private _scene; + private _effect; + private _cachedDefines; + constructor(scene: Scene); + render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void; + isReady(subMesh: SubMesh, useInstances: boolean): boolean; + } +} + +declare module BABYLON { + class RenderingGroup { + index: number; + private _scene; + private _opaqueSubMeshes; + private _transparentSubMeshes; + private _alphaTestSubMeshes; + private _activeVertices; + constructor(index: number, scene: Scene); + render(customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray) => void): boolean; + prepare(): void; + dispatch(subMesh: SubMesh): void; + } +} + +declare module BABYLON { + class RenderingManager { + static MAX_RENDERINGGROUPS: number; + private _scene; + private _renderingGroups; + private _depthBufferAlreadyCleaned; + constructor(scene: Scene); + private _renderParticles(index, activeMeshes); + private _renderSprites(index); + private _clearDepthBuffer(); + render(customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray) => void, activeMeshes: AbstractMesh[], renderParticles: boolean, renderSprites: boolean): void; + reset(): void; + dispatch(subMesh: SubMesh): void; + } +} + +declare module BABYLON { + class AnaglyphPostProcess extends PostProcess { + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class BlackAndWhitePostProcess extends PostProcess { + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class BlurPostProcess extends PostProcess { + direction: Vector2; + blurWidth: number; + constructor(name: string, direction: Vector2, blurWidth: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class ColorCorrectionPostProcess extends PostProcess { + private _colorTableTexture; + constructor(name: string, colorTableUrl: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class ConvolutionPostProcess extends PostProcess { + kernel: number[]; + constructor(name: string, kernel: number[], ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + static EdgeDetect0Kernel: number[]; + static EdgeDetect1Kernel: number[]; + static EdgeDetect2Kernel: number[]; + static SharpenKernel: number[]; + static EmbossKernel: number[]; + static GaussianKernel: number[]; + } +} + +declare module BABYLON { + class DisplayPassPostProcess extends PostProcess { + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class FilterPostProcess extends PostProcess { + kernelMatrix: Matrix; + constructor(name: string, kernelMatrix: Matrix, ratio: number, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class FxaaPostProcess extends PostProcess { + texelWidth: number; + texelHeight: number; + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class HDRRenderingPipeline extends PostProcessRenderPipeline implements IDisposable { + /** + * Public members + */ + /** + * Gaussian blur coefficient + * @type {number} + */ + gaussCoeff: number; + /** + * Gaussian blur mean + * @type {number} + */ + gaussMean: number; + /** + * Gaussian blur standard deviation + * @type {number} + */ + gaussStandDev: number; + /** + * Exposure, controls the overall intensity of the pipeline + * @type {number} + */ + exposure: number; + /** + * Minimum luminance that the post-process can output. Luminance is >= 0 + * @type {number} + */ + minimumLuminance: number; + /** + * Maximum luminance that the post-process can output. Must be suprerior to minimumLuminance + * @type {number} + */ + maximumLuminance: number; + /** + * Increase rate for luminance: eye adaptation speed to dark + * @type {number} + */ + luminanceIncreaserate: number; + /** + * Decrease rate for luminance: eye adaptation speed to bright + * @type {number} + */ + luminanceDecreaseRate: number; + /** + * Minimum luminance needed to compute HDR + * @type {number} + */ + brightThreshold: number; + /** + * Private members + */ + private _guassianBlurHPostProcess; + private _guassianBlurVPostProcess; + private _brightPassPostProcess; + private _textureAdderPostProcess; + private _downSampleX4PostProcess; + private _originalPostProcess; + private _hdrPostProcess; + private _hdrCurrentLuminance; + private _hdrOutputLuminance; + static LUM_STEPS: number; + private _downSamplePostProcesses; + private _scene; + private _needUpdate; + /** + * @constructor + * @param {string} name - The rendering pipeline name + * @param {BABYLON.Scene} scene - The scene linked to this pipeline + * @param {any} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) + * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null. + * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to + */ + constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]); + /** + * Tells the pipeline to update its post-processes + */ + update(): void; + /** + * Returns the current calculated luminance + */ + getCurrentLuminance(): number; + /** + * Returns the currently drawn luminance + */ + getOutputLuminance(): number; + /** + * Releases the rendering pipeline and its internal effects. Detaches pipeline from cameras + */ + dispose(): void; + /** + * Creates the HDR post-process and computes the luminance adaptation + */ + private _createHDRPostProcess(scene, ratio); + /** + * Texture Adder post-process + */ + private _createTextureAdderPostProcess(scene, ratio); + /** + * Down sample X4 post-process + */ + private _createDownSampleX4PostProcess(scene, ratio); + /** + * Bright pass post-process + */ + private _createBrightPassPostProcess(scene, ratio); + /** + * Luminance generator. Creates the luminance post-process and down sample post-processes + */ + private _createLuminanceGeneratorPostProcess(scene); + /** + * Gaussian blur post-processes. Horizontal and Vertical + */ + private _createGaussianBlurPostProcess(scene, ratio); + } +} + +declare module BABYLON { + class LensRenderingPipeline extends PostProcessRenderPipeline { + /** + * The chromatic aberration PostProcess id in the pipeline + * @type {string} + */ + LensChromaticAberrationEffect: string; + /** + * The highlights enhancing PostProcess id in the pipeline + * @type {string} + */ + HighlightsEnhancingEffect: string; + /** + * The depth-of-field PostProcess id in the pipeline + * @type {string} + */ + LensDepthOfFieldEffect: string; + private _scene; + private _depthTexture; + private _grainTexture; + private _chromaticAberrationPostProcess; + private _highlightsPostProcess; + private _depthOfFieldPostProcess; + private _edgeBlur; + private _grainAmount; + private _chromaticAberration; + private _distortion; + private _highlightsGain; + private _highlightsThreshold; + private _dofDistance; + private _dofAperture; + private _dofDarken; + private _dofPentagon; + private _blurNoise; + /** + * @constructor + * + * Effect parameters are as follow: + * { + * chromatic_aberration: number; // from 0 to x (1 for realism) + * edge_blur: number; // from 0 to x (1 for realism) + * distortion: number; // from 0 to x (1 for realism) + * grain_amount: number; // from 0 to 1 + * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise + * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default) + * dof_aperture: number; // depth-of-field: focus blur bias (default: 1) + * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default) + * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like "bokeh" effect + * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default) + * dof_threshold: number; // depth-of-field: highlights threshold (default: 1) + * blur_noise: boolean; // add a little bit of noise to the blur (default: true) + * } + * Note: if an effect parameter is unset, effect is disabled + * + * @param {string} name - The rendering pipeline name + * @param {object} parameters - An object containing all parameters (see above) + * @param {BABYLON.Scene} scene - The scene linked to this pipeline + * @param {number} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) + * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to + */ + constructor(name: string, parameters: any, scene: Scene, ratio?: number, cameras?: Camera[]); + setEdgeBlur(amount: number): void; + disableEdgeBlur(): void; + setGrainAmount(amount: number): void; + disableGrain(): void; + setChromaticAberration(amount: number): void; + disableChromaticAberration(): void; + setEdgeDistortion(amount: number): void; + disableEdgeDistortion(): void; + setFocusDistance(amount: number): void; + disableDepthOfField(): void; + setAperture(amount: number): void; + setDarkenOutOfFocus(amount: number): void; + enablePentagonBokeh(): void; + disablePentagonBokeh(): void; + enableNoiseBlur(): void; + disableNoiseBlur(): void; + setHighlightsGain(amount: number): void; + setHighlightsThreshold(amount: number): void; + disableHighlights(): void; + /** + * Removes the internal pipeline assets and detaches the pipeline from the scene cameras + */ + dispose(disableDepthRender?: boolean): void; + private _createChromaticAberrationPostProcess(ratio); + private _createHighlightsPostProcess(ratio); + private _createDepthOfFieldPostProcess(ratio); + private _createGrainTexture(); + } +} + +declare module BABYLON { + class PassPostProcess extends PostProcess { + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class PostProcess { + name: string; + onApply: (effect: Effect) => void; + onBeforeRender: (effect: Effect) => void; + onAfterRender: (effect: Effect) => void; + onSizeChanged: () => void; + onActivate: (camera: Camera) => void; + width: number; + height: number; + renderTargetSamplingMode: number; + clearColor: Color4; + private _camera; + private _scene; + private _engine; + private _renderRatio; + private _reusable; + private _textureType; + _textures: SmartArray; + _currentRenderTextureInd: number; + private _effect; + constructor(name: string, fragmentUrl: string, parameters: string[], samplers: string[], ratio: number | any, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, defines?: string, textureType?: number); + isReusable(): boolean; + activate(camera: Camera, sourceTexture?: WebGLTexture): void; + apply(): Effect; + dispose(camera?: Camera): void; + } +} + +declare module BABYLON { + class PostProcessManager { + private _scene; + private _indexBuffer; + private _vertexDeclaration; + private _vertexStrideSize; + private _vertexBuffer; + constructor(scene: Scene); + private _prepareBuffers(); + _prepareFrame(sourceTexture?: WebGLTexture): boolean; + directRender(postProcesses: PostProcess[], targetTexture?: WebGLTexture): void; + _finalizeFrame(doNotPresent?: boolean, targetTexture?: WebGLTexture, postProcesses?: PostProcess[]): void; + dispose(): void; + } +} + +declare module BABYLON { + class RefractionPostProcess extends PostProcess { + color: Color3; + depth: number; + colorLevel: number; + private _refRexture; + constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + dispose(camera: Camera): void; + } +} + +declare module BABYLON { + class SSAORenderingPipeline extends PostProcessRenderPipeline { + /** + * The PassPostProcess id in the pipeline that contains the original scene color + * @type {string} + */ + SSAOOriginalSceneColorEffect: string; + /** + * The SSAO PostProcess id in the pipeline + * @type {string} + */ + SSAORenderEffect: string; + /** + * The horizontal blur PostProcess id in the pipeline + * @type {string} + */ + SSAOBlurHRenderEffect: string; + /** + * The vertical blur PostProcess id in the pipeline + * @type {string} + */ + SSAOBlurVRenderEffect: string; + /** + * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect) + * @type {string} + */ + SSAOCombineRenderEffect: string; + /** + * The output strength of the SSAO post-process. Default value is 1.0. + * @type {number} + */ + totalStrength: number; + /** + * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0002 + * @type {number} + */ + radius: number; + /** + * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel + * Must not be equal to fallOff and superior to fallOff. + * Default value is 0.0075 + * @type {number} + */ + area: number; + /** + * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel + * Must not be equal to area and inferior to area. + * Default value is 0.0002 + * @type {number} + */ + fallOff: number; + private _scene; + private _depthTexture; + private _randomTexture; + private _originalColorPostProcess; + private _ssaoPostProcess; + private _blurHPostProcess; + private _blurVPostProcess; + private _ssaoCombinePostProcess; + private _firstUpdate; + /** + * @constructor + * @param {string} name - The rendering pipeline name + * @param {BABYLON.Scene} scene - The scene linked to this pipeline + * @param {any} ratio - The size of the postprocesses. Can be a number shared between passes or an object for more precision: { ssaoRatio: 0.5, combineRatio: 1.0 } + * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to + */ + constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]); + /** + * Returns the horizontal blur PostProcess + * @return {BABYLON.BlurPostProcess} The horizontal blur post-process + */ + getBlurHPostProcess(): BlurPostProcess; + /** + * Returns the vertical blur PostProcess + * @return {BABYLON.BlurPostProcess} The vertical blur post-process + */ + getBlurVPostProcess(): BlurPostProcess; + /** + * Removes the internal pipeline assets and detatches the pipeline from the scene cameras + */ + dispose(disableDepthRender?: boolean): void; + private _createSSAOPostProcess(ratio); + private _createSSAOCombinePostProcess(ratio); + private _createRandomTexture(); + } +} + +declare module BABYLON { + class StereoscopicInterlacePostProcess extends PostProcess { + private _stepSize; + constructor(name: string, camB: Camera, postProcessA: PostProcess, isStereoscopicHoriz: boolean, samplingMode?: number); + } +} + +declare module BABYLON { + enum TonemappingOperator { + Hable = 0, + Reinhard = 1, + HejiDawson = 2, + Photographic = 3, + } + class TonemapPostProcess extends PostProcess { + private _operator; + private _exposureAdjustment; + constructor(name: string, operator: TonemappingOperator, exposureAdjustment: number, camera: Camera, samplingMode?: number, engine?: Engine, textureFormat?: number); + } +} + +declare module BABYLON { + class VolumetricLightScatteringPostProcess extends PostProcess { + private _volumetricLightScatteringPass; + private _volumetricLightScatteringRTT; + private _viewPort; + private _screenCoordinates; + private _cachedDefines; + private _customMeshPosition; + /** + * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false) + * @type {boolean} + */ + useCustomMeshPosition: boolean; + /** + * If the post-process should inverse the light scattering direction + * @type {boolean} + */ + invert: boolean; + /** + * The internal mesh used by the post-process + * @type {boolean} + */ + mesh: Mesh; + /** + * Set to true to use the diffuseColor instead of the diffuseTexture + * @type {boolean} + */ + useDiffuseColor: boolean; + /** + * Array containing the excluded meshes not rendered in the internal pass + */ + excludedMeshes: AbstractMesh[]; + /** + * Controls the overall intensity of the post-process + * @type {number} + */ + exposure: number; + /** + * Dissipates each sample's contribution in range [0, 1] + * @type {number} + */ + decay: number; + /** + * Controls the overall intensity of each sample + * @type {number} + */ + weight: number; + /** + * Controls the density of each sample + * @type {number} + */ + density: number; + /** + * @constructor + * @param {string} name - The post-process name + * @param {any} ratio - The size of the post-process and/or internal pass (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) + * @param {BABYLON.Camera} camera - The camera that the post-process will be attached to + * @param {BABYLON.Mesh} mesh - The mesh used to create the light scattering + * @param {number} samples - The post-process quality, default 100 + * @param {number} samplingMode - The post-process filtering mode + * @param {BABYLON.Engine} engine - The babylon engine + * @param {boolean} reusable - If the post-process is reusable + * @param {BABYLON.Scene} scene - The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided + */ + constructor(name: string, ratio: any, camera: Camera, mesh?: Mesh, samples?: number, samplingMode?: number, engine?: Engine, reusable?: boolean, scene?: Scene); + isReady(subMesh: SubMesh, useInstances: boolean): boolean; + /** + * Sets the new light position for light scattering effect + * @param {BABYLON.Vector3} The new custom light position + */ + setCustomMeshPosition(position: Vector3): void; + /** + * Returns the light position for light scattering effect + * @return {BABYLON.Vector3} The custom light position + */ + getCustomMeshPosition(): Vector3; + /** + * Disposes the internal assets and detaches the post-process from the camera + */ + dispose(camera: Camera): void; + /** + * Returns the render target texture used by the post-process + * @return {BABYLON.RenderTargetTexture} The render target texture used by the post-process + */ + getPass(): RenderTargetTexture; + private _meshExcluded(mesh); + private _createPass(scene, ratio); + private _updateMeshScreenCoordinates(scene); + /** + * Creates a default mesh for the Volumeric Light Scattering post-process + * @param {string} The mesh name + * @param {BABYLON.Scene} The scene where to create the mesh + * @return {BABYLON.Mesh} the default mesh + */ + static CreateDefaultMesh(name: string, scene: Scene): Mesh; + } +} + +declare module BABYLON { + class VRDistortionCorrectionPostProcess extends PostProcess { + aspectRatio: number; + private _isRightEye; + private _distortionFactors; + private _postProcessScaleFactor; + private _lensCenterOffset; + private _scaleIn; + private _scaleFactor; + private _lensCenter; + constructor(name: string, camera: Camera, isRightEye: boolean, vrMetrics: VRCameraMetrics); + } +} + +declare module BABYLON { + class Sprite { + name: string; + position: Vector3; + color: Color4; + width: number; + height: number; + angle: number; + cellIndex: number; + invertU: number; + invertV: number; + disposeWhenFinishedAnimating: boolean; + animations: Animation[]; + private _animationStarted; + private _loopAnimation; + private _fromIndex; + private _toIndex; + private _delay; + private _direction; + private _frameCount; + private _manager; + private _time; + size: number; + constructor(name: string, manager: SpriteManager); + playAnimation(from: number, to: number, loop: boolean, delay: number): void; + stopAnimation(): void; + _animate(deltaTime: number): void; + dispose(): void; + } +} + +declare module BABYLON { + class SpriteManager { + name: string; + cellSize: number; + sprites: Sprite[]; + renderingGroupId: number; + layerMask: number; + onDispose: () => void; + fogEnabled: boolean; + private _capacity; + private _spriteTexture; + private _epsilon; + private _scene; + private _vertexDeclaration; + private _vertexStrideSize; + private _vertexBuffer; + private _indexBuffer; + private _vertices; + private _effectBase; + private _effectFog; + constructor(name: string, imgUrl: string, capacity: number, cellSize: number, scene: Scene, epsilon?: number, samplingMode?: number); + private _appendSpriteVertex(index, sprite, offsetX, offsetY, rowSize); + render(): void; + dispose(): void; + } +} + +declare module BABYLON.Internals { + class AndOrNotEvaluator { + static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean; + private static _HandleParenthesisContent(parenthesisContent, evaluateCallback); + private static _SimplifyNegation(booleanString); + } +} + +declare module BABYLON { + interface IAssetTask { + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + run(scene: Scene, onSuccess: () => void, onError: () => void): any; + } + class MeshAssetTask implements IAssetTask { + name: string; + meshesNames: any; + rootUrl: string; + sceneFilename: string; + loadedMeshes: Array; + loadedParticleSystems: Array; + loadedSkeletons: Array; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class TextFileAssetTask implements IAssetTask { + name: string; + url: string; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + text: string; + constructor(name: string, url: string); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class BinaryFileAssetTask implements IAssetTask { + name: string; + url: string; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + data: ArrayBuffer; + constructor(name: string, url: string); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class ImageAssetTask implements IAssetTask { + name: string; + url: string; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + image: HTMLImageElement; + constructor(name: string, url: string); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class TextureAssetTask implements IAssetTask { + name: string; + url: string; + noMipmap: boolean; + invertY: boolean; + samplingMode: number; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + texture: Texture; + constructor(name: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class AssetsManager { + private _tasks; + private _scene; + private _waitingTasksCount; + onFinish: (tasks: IAssetTask[]) => void; + onTaskSuccess: (task: IAssetTask) => void; + onTaskError: (task: IAssetTask) => void; + useDefaultLoadingScreen: boolean; + constructor(scene: Scene); + addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): IAssetTask; + addTextFileTask(taskName: string, url: string): IAssetTask; + addBinaryFileTask(taskName: string, url: string): IAssetTask; + addImageTask(taskName: string, url: string): IAssetTask; + addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): IAssetTask; + private _decreaseWaitingTasksCount(); + private _runTask(task); + reset(): AssetsManager; + load(): AssetsManager; + } +} + +declare module BABYLON { + class Database { + private callbackManifestChecked; + private currentSceneUrl; + private db; + private enableSceneOffline; + private enableTexturesOffline; + private manifestVersionFound; + private mustUpdateRessources; + private hasReachedQuota; + private isSupported; + private idbFactory; + static IsUASupportingBlobStorage: boolean; + static IDBStorageEnabled: boolean; + constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any); + static parseURL: (url: string) => string; + static ReturnFullUrlLocation: (url: string) => string; + checkManifestFile(): void; + openAsync(successCallback: any, errorCallback: any): void; + loadImageFromDB(url: string, image: HTMLImageElement): void; + private _loadImageFromDBAsync(url, image, notInDBCallback); + private _saveImageIntoDBAsync(url, image); + private _checkVersionFromDB(url, versionLoaded); + private _loadVersionFromDBAsync(url, callback, updateInDBCallback); + private _saveVersionIntoDBAsync(url, callback); + private loadFileFromDB(url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer?); + private _loadFileFromDBAsync(url, callback, notInDBCallback, useArrayBuffer?); + private _saveFileIntoDBAsync(url, callback, progressCallback, useArrayBuffer?); + } +} + +declare module BABYLON { + class FilesInput { + private _engine; + private _currentScene; + private _canvas; + private _sceneLoadedCallback; + private _progressCallback; + private _additionnalRenderLoopLogicCallback; + private _textureLoadingCallback; + private _startingProcessingFilesCallback; + private _elementToMonitor; + static FilesTextures: any[]; + static FilesToLoad: any[]; + private _sceneFileToLoad; + private _filesToLoad; + constructor(p_engine: Engine, p_scene: Scene, p_canvas: HTMLCanvasElement, p_sceneLoadedCallback: any, p_progressCallback: any, p_additionnalRenderLoopLogicCallback: any, p_textureLoadingCallback: any, p_startingProcessingFilesCallback: any); + monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void; + private renderFunction(); + private drag(e); + private drop(eventDrop); + loadFiles(event: any): void; + reload(): void; + } +} + +declare module BABYLON { + class Gamepads { + private babylonGamepads; + private oneGamepadConnected; + private isMonitoring; + private gamepadEventSupported; + private gamepadSupportAvailable; + private _callbackGamepadConnected; + private buttonADataURL; + private static gamepadDOMInfo; + constructor(ongamedpadconnected: (gamepad: Gamepad) => void); + private _insertGamepadDOMInstructions(); + private _insertGamepadDOMNotSupported(); + dispose(): void; + private _onGamepadConnected(evt); + private _addNewGamepad(gamepad); + private _onGamepadDisconnected(evt); + private _startMonitoringGamepads(); + private _stopMonitoringGamepads(); + private _checkGamepadsStatus(); + private _updateGamepadObjects(); + } + class StickValues { + x: any; + y: any; + constructor(x: any, y: any); + } + class Gamepad { + id: string; + index: number; + browserGamepad: any; + private _leftStick; + private _rightStick; + private _onleftstickchanged; + private _onrightstickchanged; + constructor(id: string, index: number, browserGamepad: any); + onleftstickchanged(callback: (values: StickValues) => void): void; + onrightstickchanged(callback: (values: StickValues) => void): void; + leftStick: StickValues; + rightStick: StickValues; + update(): void; + } + class GenericPad extends Gamepad { + id: string; + index: number; + gamepad: any; + private _buttons; + private _onbuttondown; + private _onbuttonup; + onbuttondown(callback: (buttonPressed: number) => void): void; + onbuttonup(callback: (buttonReleased: number) => void): void; + constructor(id: string, index: number, gamepad: any); + private _setButtonValue(newValue, currentValue, buttonIndex); + update(): void; + } + enum Xbox360Button { + A = 0, + B = 1, + X = 2, + Y = 3, + Start = 4, + Back = 5, + LB = 6, + RB = 7, + LeftStick = 8, + RightStick = 9, + } + enum Xbox360Dpad { + Up = 0, + Down = 1, + Left = 2, + Right = 3, + } + class Xbox360Pad extends Gamepad { + private _leftTrigger; + private _rightTrigger; + private _onlefttriggerchanged; + private _onrighttriggerchanged; + private _onbuttondown; + private _onbuttonup; + private _ondpaddown; + private _ondpadup; + private _buttonA; + private _buttonB; + private _buttonX; + private _buttonY; + private _buttonBack; + private _buttonStart; + private _buttonLB; + private _buttonRB; + private _buttonLeftStick; + private _buttonRightStick; + private _dPadUp; + private _dPadDown; + private _dPadLeft; + private _dPadRight; + onlefttriggerchanged(callback: (value: number) => void): void; + onrighttriggerchanged(callback: (value: number) => void): void; + leftTrigger: number; + rightTrigger: number; + onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void; + onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void; + ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void; + ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void; + private _setButtonValue(newValue, currentValue, buttonType); + private _setDPadValue(newValue, currentValue, buttonType); + buttonA: number; + buttonB: number; + buttonX: number; + buttonY: number; + buttonStart: number; + buttonBack: number; + buttonLB: number; + buttonRB: number; + buttonLeftStick: number; + buttonRightStick: number; + dPadUp: number; + dPadDown: number; + dPadLeft: number; + dPadRight: number; + update(): void; + } +} +interface Navigator { + getGamepads(func?: any): any; + webkitGetGamepads(func?: any): any; + msGetGamepads(func?: any): any; + webkitGamepads(func?: any): any; +} + +declare module BABYLON { + class SceneOptimization { + priority: number; + apply: (scene: Scene) => boolean; + constructor(priority?: number); + } + class TextureOptimization extends SceneOptimization { + priority: number; + maximumSize: number; + constructor(priority?: number, maximumSize?: number); + apply: (scene: Scene) => boolean; + } + class HardwareScalingOptimization extends SceneOptimization { + priority: number; + maximumScale: number; + private _currentScale; + constructor(priority?: number, maximumScale?: number); + apply: (scene: Scene) => boolean; + } + class ShadowsOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class PostProcessesOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class LensFlaresOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class ParticlesOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class RenderTargetsOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class MergeMeshesOptimization extends SceneOptimization { + static _UpdateSelectionTree: boolean; + static UpdateSelectionTree: boolean; + private _canBeMerged; + apply: (scene: Scene, updateSelectionTree?: boolean) => boolean; + } + class SceneOptimizerOptions { + targetFrameRate: number; + trackerDuration: number; + optimizations: SceneOptimization[]; + constructor(targetFrameRate?: number, trackerDuration?: number); + static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; + static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; + static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; + } + class SceneOptimizer { + static _CheckCurrentState(scene: Scene, options: SceneOptimizerOptions, currentPriorityLevel: number, onSuccess?: () => void, onFailure?: () => void): void; + static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): void; + } +} + +declare module BABYLON { + class SceneSerializer { + static Serialize(scene: Scene): any; + static SerializeMesh(toSerialize: any, withParents?: boolean, withChildren?: boolean): any; + } +} + +declare module BABYLON { + class SmartArray { + data: Array; + length: number; + private _id; + private _duplicateId; + constructor(capacity: number); + push(value: any): void; + pushNoDuplicate(value: any): void; + sort(compareFn: any): void; + reset(): void; + concat(array: any): void; + concatWithNoDuplicate(array: any): void; + indexOf(value: any): number; + private static _GlobalId; + } +} + +declare module BABYLON { + class SmartCollection { + count: number; + items: any; + private _keys; + private _initialCapacity; + constructor(capacity?: number); + add(key: any, item: any): number; + remove(key: any): number; + removeItemOfIndex(index: number): number; + indexOf(key: any): number; + item(key: any): any; + getAllKeys(): any[]; + getKeyByIndex(index: number): any; + getItemByIndex(index: number): any; + empty(): void; + forEach(block: (item: any) => void): void; + } +} + +declare module BABYLON { + class Tags { + static EnableFor(obj: any): void; + static DisableFor(obj: any): void; + static HasTags(obj: any): boolean; + static GetTags(obj: any): any; + static AddTagsTo(obj: any, tagsString: string): void; + static _AddTagTo(obj: any, tag: string): void; + static RemoveTagsFrom(obj: any, tagsString: string): void; + static _RemoveTagFrom(obj: any, tag: string): void; + static MatchesQuery(obj: any, tagsQuery: string): boolean; + } +} + +declare module BABYLON.Internals { + interface DDSInfo { + width: number; + height: number; + mipmapCount: number; + isFourCC: boolean; + isRGB: boolean; + isLuminance: boolean; + isCube: boolean; + } + class DDSTools { + static GetDDSInfo(arrayBuffer: any): DDSInfo; + private static GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); + private static GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); + private static GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); + static UploadDDSLevels(gl: WebGLRenderingContext, ext: any, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number): void; + } +} + +declare module BABYLON.Internals { + class TGATools { + private static _TYPE_NO_DATA; + private static _TYPE_INDEXED; + private static _TYPE_RGB; + private static _TYPE_GREY; + private static _TYPE_RLE_INDEXED; + private static _TYPE_RLE_RGB; + private static _TYPE_RLE_GREY; + private static _ORIGIN_MASK; + private static _ORIGIN_SHIFT; + private static _ORIGIN_BL; + private static _ORIGIN_BR; + private static _ORIGIN_UL; + private static _ORIGIN_UR; + static GetTGAHeader(data: Uint8Array): any; + static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void; + static _getImageData8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageData16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageData24bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageData32bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageDataGrey8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageDataGrey16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + } +} + +declare module BABYLON { + interface IAnimatable { + animations: Array; + } + interface ISize { + width: number; + height: number; + } + class Tools { + static BaseUrl: string; + static ToHex(i: number): string; + static SetImmediate(action: () => void): void; + static IsExponantOfTwo(value: number): boolean; + static GetExponantOfTwo(value: number, max: number): number; + static GetFilename(path: string): string; + static GetDOMTextContent(element: HTMLElement): string; + static ToDegrees(angle: number): number; + static ToRadians(angle: number): number; + static ExtractMinAndMaxIndexed(positions: number[], indices: number[], indexStart: number, indexCount: number): { + minimum: Vector3; + maximum: Vector3; + }; + static ExtractMinAndMax(positions: number[], start: number, count: number): { + minimum: Vector3; + maximum: Vector3; + }; + static MakeArray(obj: any, allowsNullUndefined?: boolean): Array; + static GetPointerPrefix(): string; + static QueueNewFrame(func: any): void; + static RequestFullscreen(element: any): void; + static ExitFullscreen(): void; + static CleanUrl(url: string): string; + static LoadImage(url: string, onload: any, onerror: any, database: any): HTMLImageElement; + static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: () => void, database?: any, useArrayBuffer?: boolean, onError?: () => void): void; + static ReadFileAsDataURL(fileToLoad: any, callback: any, progressCallback: any): void; + static ReadFile(fileToLoad: any, callback: any, progressCallBack: any, useArrayBuffer?: boolean): void; + static Clamp(value: number, min?: number, max?: number): number; + static Sign(value: number): number; + static Format(value: number, decimals?: number): string; + static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void; + static WithinEpsilon(a: number, b: number, epsilon?: number): boolean; + static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void; + static IsEmpty(obj: any): boolean; + static RegisterTopRootEvents(events: { + name: string; + handler: EventListener; + }[]): void; + static UnregisterTopRootEvents(events: { + name: string; + handler: EventListener; + }[]): void; + static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: String) => void): void; + static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: String) => void): void; + static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean; + private static _NoneLogLevel; + private static _MessageLogLevel; + private static _WarningLogLevel; + private static _ErrorLogLevel; + private static _LogCache; + static errorsCount: number; + static OnNewCacheEntry: (entry: string) => void; + static NoneLogLevel: number; + static MessageLogLevel: number; + static WarningLogLevel: number; + static ErrorLogLevel: number; + static AllLogLevel: number; + private static _AddLogEntry(entry); + private static _FormatMessage(message); + static Log: (message: string) => void; + private static _LogDisabled(message); + private static _LogEnabled(message); + static Warn: (message: string) => void; + private static _WarnDisabled(message); + private static _WarnEnabled(message); + static Error: (message: string) => void; + private static _ErrorDisabled(message); + private static _ErrorEnabled(message); + static LogCache: string; + static ClearLogCache(): void; + static LogLevels: number; + private static _PerformanceNoneLogLevel; + private static _PerformanceUserMarkLogLevel; + private static _PerformanceConsoleLogLevel; + private static _performance; + static PerformanceNoneLogLevel: number; + static PerformanceUserMarkLogLevel: number; + static PerformanceConsoleLogLevel: number; + static PerformanceLogLevel: number; + static _StartPerformanceCounterDisabled(counterName: string, condition?: boolean): void; + static _EndPerformanceCounterDisabled(counterName: string, condition?: boolean): void; + static _StartUserMark(counterName: string, condition?: boolean): void; + static _EndUserMark(counterName: string, condition?: boolean): void; + static _StartPerformanceConsole(counterName: string, condition?: boolean): void; + static _EndPerformanceConsole(counterName: string, condition?: boolean): void; + static StartPerformanceCounter: (counterName: string, condition?: boolean) => void; + static EndPerformanceCounter: (counterName: string, condition?: boolean) => void; + static Now: number; + static GetFps(): number; + } + /** + * An implementation of a loop for asynchronous functions. + */ + class AsyncLoop { + iterations: number; + private _fn; + private _successCallback; + index: number; + private _done; + /** + * Constroctor. + * @param iterations the number of iterations. + * @param _fn the function to run each iteration + * @param _successCallback the callback that will be called upon succesful execution + * @param offset starting offset. + */ + constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number); + /** + * Execute the next iteration. Must be called after the last iteration was finished. + */ + executeNext(): void; + /** + * Break the loop and run the success callback. + */ + breakLoop(): void; + /** + * Helper function + */ + static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop; + /** + * A for-loop that will run a given number of iterations synchronous and the rest async. + * @param iterations total number of iterations + * @param syncedIterations number of synchronous iterations in each async iteration. + * @param fn the function to call each iteration. + * @param callback a success call back that will be called when iterating stops. + * @param breakFunction a break condition (optional) + * @param timeout timeout settings for the setTimeout function. default - 0. + * @constructor + */ + static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void; + } +} + +declare module BABYLON { + enum JoystickAxis { + X = 0, + Y = 1, + Z = 2, + } + class VirtualJoystick { + reverseLeftRight: boolean; + reverseUpDown: boolean; + deltaPosition: Vector3; + pressed: boolean; + private static _globalJoystickIndex; + private static vjCanvas; + private static vjCanvasContext; + private static vjCanvasWidth; + private static vjCanvasHeight; + private static halfWidth; + private static halfHeight; + private _action; + private _axisTargetedByLeftAndRight; + private _axisTargetedByUpAndDown; + private _joystickSensibility; + private _inversedSensibility; + private _rotationSpeed; + private _inverseRotationSpeed; + private _rotateOnAxisRelativeToMesh; + private _joystickPointerID; + private _joystickColor; + private _joystickPointerPos; + private _joystickPreviousPointerPos; + private _joystickPointerStartPos; + private _deltaJoystickVector; + private _leftJoystick; + private _joystickIndex; + private _touches; + private _onPointerDownHandlerRef; + private _onPointerMoveHandlerRef; + private _onPointerUpHandlerRef; + private _onPointerOutHandlerRef; + private _onResize; + constructor(leftJoystick?: boolean); + setJoystickSensibility(newJoystickSensibility: number): void; + private _onPointerDown(e); + private _onPointerMove(e); + private _onPointerUp(e); + /** + * Change the color of the virtual joystick + * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000") + */ + setJoystickColor(newColor: string): void; + setActionOnTouch(action: () => any): void; + setAxisForLeftRight(axis: JoystickAxis): void; + setAxisForUpDown(axis: JoystickAxis): void; + private _clearCanvas(); + private _drawVirtualJoystick(); + releaseCanvas(): void; + } +} + +declare module BABYLON { + class VRDeviceOrientationFreeCamera extends FreeCamera { + _alpha: number; + _beta: number; + _gamma: number; + private _offsetOrientation; + private _deviceOrientationHandler; + constructor(name: string, position: Vector3, scene: Scene, compensateDistorsion?: boolean); + _onOrientationEvent(evt: DeviceOrientationEvent): void; + attachControl(element: HTMLElement, noPreventDefault?: boolean): void; + detachControl(element: HTMLElement): void; + } +} + +declare var HMDVRDevice: any; +declare var PositionSensorVRDevice: any; +declare module BABYLON { + class WebVRFreeCamera extends FreeCamera { + _hmdDevice: any; + _sensorDevice: any; + _cacheState: any; + _cacheQuaternion: Quaternion; + _cacheRotation: Vector3; + _vrEnabled: boolean; + constructor(name: string, position: Vector3, scene: Scene, compensateDistorsion?: boolean); + private _getWebVRDevices(devices); + _checkInputs(): void; + attachControl(element: HTMLElement, noPreventDefault?: boolean): void; + detachControl(element: HTMLElement): void; + } +} + +declare module BABYLON { + interface IOctreeContainer { + blocks: Array>; + } + class Octree { + maxDepth: number; + blocks: Array>; + dynamicContent: T[]; + private _maxBlockCapacity; + private _selectionContent; + private _creationFunc; + constructor(creationFunc: (entry: T, block: OctreeBlock) => void, maxBlockCapacity?: number, maxDepth?: number); + update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void; + addMesh(entry: T): void; + select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray; + intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray; + intersectsRay(ray: Ray): SmartArray; + static _CreateBlocks(worldMin: Vector3, worldMax: Vector3, entries: T[], maxBlockCapacity: number, currentDepth: number, maxDepth: number, target: IOctreeContainer, creationFunc: (entry: T, block: OctreeBlock) => void): void; + static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock) => void; + static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock) => void; + } +} + +declare module BABYLON { + class OctreeBlock { + entries: T[]; + blocks: Array>; + private _depth; + private _maxDepth; + private _capacity; + private _minPoint; + private _maxPoint; + private _boundingVectors; + private _creationFunc; + constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock) => void); + capacity: number; + minPoint: Vector3; + maxPoint: Vector3; + addEntry(entry: T): void; + addEntries(entries: T[]): void; + select(frustumPlanes: Plane[], selection: SmartArray, allowDuplicate?: boolean): void; + intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray, allowDuplicate?: boolean): void; + intersectsRay(ray: Ray, selection: SmartArray): void; + createInnerBlocks(): void; + } +} + +declare module BABYLON { + class ShadowGenerator { + private static _FILTER_NONE; + private static _FILTER_VARIANCESHADOWMAP; + private static _FILTER_POISSONSAMPLING; + private static _FILTER_BLURVARIANCESHADOWMAP; + static FILTER_NONE: number; + static FILTER_VARIANCESHADOWMAP: number; + static FILTER_POISSONSAMPLING: number; + static FILTER_BLURVARIANCESHADOWMAP: number; + private _filter; + blurScale: number; + private _blurBoxOffset; + private _bias; + private _lightDirection; + bias: number; + blurBoxOffset: number; + filter: number; + useVarianceShadowMap: boolean; + usePoissonSampling: boolean; + useBlurVarianceShadowMap: boolean; + private _light; + private _scene; + private _shadowMap; + private _shadowMap2; + private _darkness; + private _transparencyShadow; + private _effect; + private _viewMatrix; + private _projectionMatrix; + private _transformMatrix; + private _worldViewProjection; + private _cachedPosition; + private _cachedDirection; + private _cachedDefines; + private _currentRenderID; + private _downSamplePostprocess; + private _boxBlurPostprocess; + private _mapSize; + constructor(mapSize: number, light: IShadowLight); + isReady(subMesh: SubMesh, useInstances: boolean): boolean; + getShadowMap(): RenderTargetTexture; + getShadowMapForRendering(): RenderTargetTexture; + getLight(): IShadowLight; + getTransformMatrix(): Matrix; + getDarkness(): number; + setDarkness(darkness: number): void; + setTransparencyShadow(hasShadow: boolean): void; + private _packHalf(depth); + dispose(): void; + } +} + +declare module BABYLON.Internals { +} + +declare module BABYLON { + class BaseTexture { + name: string; + delayLoadState: number; + hasAlpha: boolean; + getAlphaFromRGB: boolean; + level: number; + isCube: boolean; + isRenderTarget: boolean; + animations: Animation[]; + onDispose: () => void; + coordinatesIndex: number; + coordinatesMode: number; + wrapU: number; + wrapV: number; + uScale: number; + vScale: number; + anisotropicFilteringLevel: number; + _cachedAnisotropicFilteringLevel: number; + private _scene; + _texture: WebGLTexture; + constructor(scene: Scene); + getScene(): Scene; + getTextureMatrix(): Matrix; + getReflectionTextureMatrix(): Matrix; + getInternalTexture(): WebGLTexture; + isReady(): boolean; + getSize(): ISize; + getBaseSize(): ISize; + scale(ratio: number): void; + canRescale: boolean; + _removeFromCache(url: string, noMipmap: boolean): void; + _getFromCache(url: string, noMipmap: boolean, sampling?: number): WebGLTexture; + delayLoad(): void; + releaseInternalTexture(): void; + clone(): BaseTexture; + dispose(): void; + } +} + +declare module BABYLON { + class CubeTexture extends BaseTexture { + url: string; + coordinatesMode: number; + private _noMipmap; + private _extensions; + private _textureMatrix; + constructor(rootUrl: string, scene: Scene, extensions?: string[], noMipmap?: boolean); + clone(): CubeTexture; + delayLoad(): void; + getReflectionTextureMatrix(): Matrix; + } +} + +declare module BABYLON { + class DynamicTexture extends Texture { + private _generateMipMaps; + private _canvas; + private _context; + constructor(name: string, options: any, scene: Scene, generateMipMaps: boolean, samplingMode?: number); + canRescale: boolean; + scale(ratio: number): void; + getContext(): CanvasRenderingContext2D; + clear(): void; + update(invertY?: boolean): void; + drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void; + clone(): DynamicTexture; + } +} + +declare module BABYLON { + class MirrorTexture extends RenderTargetTexture { + mirrorPlane: Plane; + private _transformMatrix; + private _mirrorMatrix; + private _savedViewMatrix; + constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean); + clone(): MirrorTexture; + } +} + +declare module BABYLON { + class RawTexture extends Texture { + format: number; + constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number); + update(data: ArrayBufferView): void; + static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + } +} + +declare module BABYLON { + class RenderTargetTexture extends Texture { + renderList: AbstractMesh[]; + renderParticles: boolean; + renderSprites: boolean; + coordinatesMode: number; + onBeforeRender: () => void; + onAfterRender: () => void; + onAfterUnbind: () => void; + onClear: (engine: Engine) => void; + activeCamera: Camera; + customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray, beforeTransparents?: () => void) => void; + private _size; + _generateMipMaps: boolean; + private _renderingManager; + _waitingRenderList: string[]; + private _doNotChangeAspectRatio; + private _currentRefreshId; + private _refreshRate; + constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number); + resetRefreshCounter(): void; + refreshRate: number; + _shouldRender(): boolean; + isReady(): boolean; + getRenderSize(): number; + canRescale: boolean; + scale(ratio: number): void; + resize(size: any, generateMipMaps?: boolean): void; + render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void; + clone(): RenderTargetTexture; + } +} + +declare module BABYLON { + class Texture extends BaseTexture { + static NEAREST_SAMPLINGMODE: number; + static BILINEAR_SAMPLINGMODE: number; + static TRILINEAR_SAMPLINGMODE: number; + static EXPLICIT_MODE: number; + static SPHERICAL_MODE: number; + static PLANAR_MODE: number; + static CUBIC_MODE: number; + static PROJECTION_MODE: number; + static SKYBOX_MODE: number; + static CLAMP_ADDRESSMODE: number; + static WRAP_ADDRESSMODE: number; + static MIRROR_ADDRESSMODE: number; + url: string; + uOffset: number; + vOffset: number; + uScale: number; + vScale: number; + uAng: number; + vAng: number; + wAng: number; + private _noMipmap; + _invertY: boolean; + private _rowGenerationMatrix; + private _cachedTextureMatrix; + private _projectionModeMatrix; + private _t0; + private _t1; + private _t2; + private _cachedUOffset; + private _cachedVOffset; + private _cachedUScale; + private _cachedVScale; + private _cachedUAng; + private _cachedVAng; + private _cachedWAng; + private _cachedCoordinatesMode; + _samplingMode: number; + private _buffer; + private _deleteBuffer; + constructor(url: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any, deleteBuffer?: boolean); + delayLoad(): void; + updateSamplingMode(samplingMode: number): void; + private _prepareRowForTextureGeneration(x, y, z, t); + getTextureMatrix(): Matrix; + getReflectionTextureMatrix(): Matrix; + clone(): Texture; + static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture; + } +} + +declare module BABYLON { + class VideoTexture extends Texture { + video: HTMLVideoElement; + private _autoLaunch; + private _lastUpdate; + constructor(name: string, urls: string[], scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number); + update(): boolean; + } +} + +declare module BABYLON { + class CannonJSPlugin implements IPhysicsEnginePlugin { + checkWithEpsilon: (value: number) => number; + private _world; + private _registeredMeshes; + private _physicsMaterials; + initialize(iterations?: number): void; + private _checkWithEpsilon(value); + runOneStep(delta: number): void; + setGravity(gravity: Vector3): void; + registerMesh(mesh: AbstractMesh, impostor: number, options?: PhysicsBodyCreationOptions): any; + private _createSphere(radius, mesh, options?); + private _createBox(x, y, z, mesh, options?); + private _createPlane(mesh, options?); + private _createConvexPolyhedron(rawVerts, rawFaces, mesh, options?); + private _addMaterial(friction, restitution); + private _createRigidBodyFromShape(shape, mesh, mass, friction, restitution); + registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; + private _unbindBody(body); + unregisterMesh(mesh: AbstractMesh): void; + applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; + updateBodyPosition: (mesh: AbstractMesh) => void; + createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3): boolean; + dispose(): void; + isSupported(): boolean; + } +} + +declare module BABYLON { + class OimoJSPlugin implements IPhysicsEnginePlugin { + private _world; + private _registeredMeshes; + private _checkWithEpsilon(value); + initialize(iterations?: number): void; + setGravity(gravity: Vector3): void; + registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; + registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; + private _createBodyAsCompound(part, options, initialMesh); + unregisterMesh(mesh: AbstractMesh): void; + private _unbindBody(body); + /** + * Update the body position according to the mesh position + * @param mesh + */ + updateBodyPosition: (mesh: AbstractMesh) => void; + applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; + createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; + dispose(): void; + isSupported(): boolean; + private _getLastShape(body); + runOneStep(time: number): void; + } +} + +declare module BABYLON { + class PostProcessRenderEffect { + private _engine; + private _postProcesses; + private _getPostProcess; + private _singleInstance; + private _cameras; + private _indicesForCamera; + private _renderPasses; + private _renderEffectAsPasses; + _name: string; + applyParameters: (postProcess: PostProcess) => void; + constructor(engine: Engine, name: string, getPostProcess: () => PostProcess, singleInstance?: boolean); + _update(): void; + addPass(renderPass: PostProcessRenderPass): void; + removePass(renderPass: PostProcessRenderPass): void; + addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void; + getPass(passName: string): void; + emptyPasses(): void; + _attachCameras(cameras: Camera): any; + _attachCameras(cameras: Camera[]): any; + _detachCameras(cameras: Camera): any; + _detachCameras(cameras: Camera[]): any; + _enable(cameras: Camera): any; + _enable(cameras: Camera[]): any; + _disable(cameras: Camera): any; + _disable(cameras: Camera[]): any; + getPostProcess(camera?: Camera): PostProcess; + private _linkParameters(); + private _linkTextures(effect); + } +} + +declare module BABYLON { + class PostProcessRenderPass { + private _enabled; + private _renderList; + private _renderTexture; + private _scene; + private _refCount; + _name: string; + constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void); + _incRefCount(): number; + _decRefCount(): number; + _update(): void; + setRenderList(renderList: Mesh[]): void; + getRenderTexture(): RenderTargetTexture; + } +} + +declare module BABYLON { + class PostProcessRenderPipeline { + private _engine; + private _renderEffects; + private _renderEffectsForIsolatedPass; + private _cameras; + _name: string; + private static PASS_EFFECT_NAME; + private static PASS_SAMPLER_NAME; + constructor(engine: Engine, name: string); + addEffect(renderEffect: PostProcessRenderEffect): void; + _enableEffect(renderEffectName: string, cameras: Camera): any; + _enableEffect(renderEffectName: string, cameras: Camera[]): any; + _disableEffect(renderEffectName: string, cameras: Camera): any; + _disableEffect(renderEffectName: string, cameras: Camera[]): any; + _attachCameras(cameras: Camera, unique: boolean): any; + _attachCameras(cameras: Camera[], unique: boolean): any; + _detachCameras(cameras: Camera): any; + _detachCameras(cameras: Camera[]): any; + _enableDisplayOnlyPass(passName: any, cameras: Camera): any; + _enableDisplayOnlyPass(passName: any, cameras: Camera[]): any; + _disableDisplayOnlyPass(cameras: Camera): any; + _disableDisplayOnlyPass(cameras: Camera[]): any; + _update(): void; + } +} + +declare module BABYLON { + class PostProcessRenderPipelineManager { + private _renderPipelines; + constructor(); + addPipeline(renderPipeline: PostProcessRenderPipeline): void; + attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): any; + attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): any; + detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): any; + detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): any; + enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any; + enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any; + disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any; + disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any; + enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): any; + enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): any; + disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): any; + disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): any; + update(): void; + } +} + +declare module BABYLON { + class CustomProceduralTexture extends ProceduralTexture { + private _animate; + private _time; + private _config; + private _texturePath; + constructor(name: string, texturePath: any, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + private loadJson(jsonUrl); + isReady(): boolean; + render(useCameraPostProcess?: boolean): void; + updateTextures(): void; + updateShaderUniforms(): void; + animate: boolean; + } +} + +declare module BABYLON { + class ProceduralTexture extends Texture { + private _size; + _generateMipMaps: boolean; + isEnabled: boolean; + private _doNotChangeAspectRatio; + private _currentRefreshId; + private _refreshRate; + private _vertexBuffer; + private _indexBuffer; + private _effect; + private _vertexDeclaration; + private _vertexStrideSize; + private _uniforms; + private _samplers; + private _fragment; + _textures: Texture[]; + private _floats; + private _floatsArrays; + private _colors3; + private _colors4; + private _vectors2; + private _vectors3; + private _matrices; + private _fallbackTexture; + private _fallbackTextureUsed; + constructor(name: string, size: any, fragment: any, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + reset(): void; + isReady(): boolean; + resetRefreshCounter(): void; + setFragment(fragment: any): void; + refreshRate: number; + _shouldRender(): boolean; + getRenderSize(): number; + resize(size: any, generateMipMaps: any): void; + private _checkUniform(uniformName); + setTexture(name: string, texture: Texture): ProceduralTexture; + setFloat(name: string, value: number): ProceduralTexture; + setFloats(name: string, value: number[]): ProceduralTexture; + setColor3(name: string, value: Color3): ProceduralTexture; + setColor4(name: string, value: Color4): ProceduralTexture; + setVector2(name: string, value: Vector2): ProceduralTexture; + setVector3(name: string, value: Vector3): ProceduralTexture; + setMatrix(name: string, value: Matrix): ProceduralTexture; + render(useCameraPostProcess?: boolean): void; + clone(): ProceduralTexture; + dispose(): void; + } +} + +declare module BABYLON { + class WoodProceduralTexture extends ProceduralTexture { + private _ampScale; + private _woodColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + ampScale: number; + woodColor: Color3; + } + class FireProceduralTexture extends ProceduralTexture { + private _time; + private _speed; + private _autoGenerateTime; + private _fireColors; + private _alphaThreshold; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + render(useCameraPostProcess?: boolean): void; + static PurpleFireColors: Color3[]; + static GreenFireColors: Color3[]; + static RedFireColors: Color3[]; + static BlueFireColors: Color3[]; + fireColors: Color3[]; + time: number; + speed: Vector2; + alphaThreshold: number; + } + class CloudProceduralTexture extends ProceduralTexture { + private _skyColor; + private _cloudColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + skyColor: Color4; + cloudColor: Color4; + } + class GrassProceduralTexture extends ProceduralTexture { + private _grassColors; + private _herb1; + private _herb2; + private _herb3; + private _groundColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + grassColors: Color3[]; + groundColor: Color3; + } + class RoadProceduralTexture extends ProceduralTexture { + private _roadColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + roadColor: Color3; + } + class BrickProceduralTexture extends ProceduralTexture { + private _numberOfBricksHeight; + private _numberOfBricksWidth; + private _jointColor; + private _brickColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + numberOfBricksHeight: number; + numberOfBricksWidth: number; + jointColor: Color3; + brickColor: Color3; + } + class MarbleProceduralTexture extends ProceduralTexture { + private _numberOfTilesHeight; + private _numberOfTilesWidth; + private _amplitude; + private _marbleColor; + private _jointColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + numberOfTilesHeight: number; + numberOfTilesWidth: number; + jointColor: Color3; + marbleColor: Color3; + } +} From 48b8cff5986aa7d510ca956c58b49123e2582f4f Mon Sep 17 00:00:00 2001 From: satguru srivastava Date: Mon, 4 Jan 2016 16:07:41 -0600 Subject: [PATCH 223/441] modified: babylonjs/babylonjs-tests.ts --- babylonjs/babylonjs-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/babylonjs/babylonjs-tests.ts b/babylonjs/babylonjs-tests.ts index bb9a419cca..4235a6d1b5 100644 --- a/babylonjs/babylonjs-tests.ts +++ b/babylonjs/babylonjs-tests.ts @@ -1 +1 @@ -/// \ No newline at end of file +/// From ac388955e0807551829516b35d910972c2392216 Mon Sep 17 00:00:00 2001 From: ajtowf Date: Mon, 4 Jan 2016 23:08:53 +0100 Subject: [PATCH 224/441] Updated IBottomSheetOptions and IDialogOptions --- angular-material/angular-material.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index 7d29e7492a..4ce3fe103a 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -16,6 +16,7 @@ declare module angular.material { targetEvent?: MouseEvent; resolve?: {[index: string]: angular.IPromise} controllerAs?: string; + bindToController?: boolean; parent?: string|Element|JQuery; // default: root node disableParentScroll?: boolean; // default: true } @@ -76,6 +77,7 @@ declare module angular.material { resolve?: {[index: string]: angular.IPromise} controllerAs?: string; parent?: string|Element|JQuery; // default: root node + fullscreen?: boolean; onComplete?: Function; } From 61a997a55d79d81862e5e2dd45da782fe24778e2 Mon Sep 17 00:00:00 2001 From: ssatguru Date: Mon, 4 Jan 2016 16:11:13 -0600 Subject: [PATCH 225/441] Update babylonjs-tests.ts --- babylonjs/babylonjs-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/babylonjs/babylonjs-tests.ts b/babylonjs/babylonjs-tests.ts index 4235a6d1b5..142d3840f5 100644 --- a/babylonjs/babylonjs-tests.ts +++ b/babylonjs/babylonjs-tests.ts @@ -1 +1 @@ -/// +/// From 1f40d82294b6c5ed32cf37056389ee05e584d7c8 Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Mon, 4 Jan 2016 17:07:43 -0500 Subject: [PATCH 226/441] auth0: add user_metadata and app_metadata to profile --- auth0/auth0.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/auth0/auth0.d.ts b/auth0/auth0.d.ts index b2e1149fb6..1548bd06f0 100644 --- a/auth0/auth0.d.ts +++ b/auth0/auth0.d.ts @@ -51,6 +51,8 @@ interface Auth0UserProfile { user_id: string; /** Represents one or more Identities that may be associated with the User. */ identities: Auth0Identity[]; + user_metadata?: any; + app_metadata?: any; } /** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */ From a8bd9cf1317d353b3285f552c08d455a375dd04d Mon Sep 17 00:00:00 2001 From: ssatguru Date: Mon, 4 Jan 2016 17:08:02 -0600 Subject: [PATCH 227/441] Rename babylonjs-tests.ts to babylon-tests.ts --- babylonjs/{babylonjs-tests.ts => babylon-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename babylonjs/{babylonjs-tests.ts => babylon-tests.ts} (100%) diff --git a/babylonjs/babylonjs-tests.ts b/babylonjs/babylon-tests.ts similarity index 100% rename from babylonjs/babylonjs-tests.ts rename to babylonjs/babylon-tests.ts From 8ab63af57c8abbb8299267fcd2797ade09629720 Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Mon, 4 Jan 2016 16:54:58 -0700 Subject: [PATCH 228/441] Icepick: initial definitions. --- icepick/icepick-tests.ts | 177 +++++++++++++++++++++++++++++++++++++++ icepick/icepick.d.ts | 72 ++++++++++++++++ 2 files changed, 249 insertions(+) create mode 100644 icepick/icepick-tests.ts create mode 100644 icepick/icepick.d.ts diff --git a/icepick/icepick-tests.ts b/icepick/icepick-tests.ts new file mode 100644 index 0000000000..350e5f2dc8 --- /dev/null +++ b/icepick/icepick-tests.ts @@ -0,0 +1,177 @@ +/// +/// + + +import i = require("icepick"); + +"use strict"; // so attempted modifications of frozen objects will throw errors + +// freeze(collection) +{ + let coll = { + a: "foo", + b: [1, 2, 3], + c: { + d: "bar" + } + }; + + i.freeze(coll); +} + +// thaw(collection) +class Foo {} + +{ + let coll = i.freeze({ a: "foo", b: [1, 2, 3], c: { d: "bar" }, e: new Foo() }); + let thawed = i.thaw(coll); +} + +// assoc(collection, key, value) +{ + let coll = { a: 1, b: 2 }; + let newColl = i.assoc(coll, "b", 3); // {a: 1, b: 3} + + let arr = ["a", "b", "c"]; + let newArr = i.assoc(arr, 2, "d"); // ["a", "b", "d"] +} + +// alias: set(collection, key, value) +{ + let coll = { a: 1, b: 2 }; + let newColl = i.set(coll, "b", 3); // {a: 1, b: 3} + + let arr = ["a", "b", "c"]; + let newArr = i.set(arr, 2, "d"); // ["a", "b", "d"] +} + +// dissoc(collection, key) +{ + let coll = { a: 1, b: 2, c: 3 }; + let newColl = i.dissoc(coll, "b"); // {a: 1, c: 3} + + let arr = ["a", "b", "c"]; + let newArr = i.dissoc(arr, 2); // ["a", , "c"] +} + +// alias: unset(collection, key) +{ + let coll = { a: 1, b: 2, c: 3 }; + let newColl = i.unset(coll, "b"); // {a: 1, c: 3} + + let arr = ["a", "b", "c"]; + let newArr = i.unset(arr, 2); // ["a", , "c"] +} + +// assocIn(collection, path, value) +{ + let coll = { + a: "foo", + b: [1, 2, 3], + c: { + d: "bar" + } + }; + + let newColl = i.assocIn(coll, ["c", "d"], "baz"); + + let coll2 = {}; + let newColl2 = i.assocIn(coll2, ["a", "b", "c"], 1); +} + +// alias: setIn(collection, path, value) +{ + let coll = { + a: "foo", + b: [1, 2, 3], + c: { + d: "bar" + } + }; + + let newColl = i.setIn(coll, ["c", "d"], "baz"); + + let coll2 = {}; + let newColl2 = i.setIn(coll2, ["a", "b", "c"], 1); +} + +// getIn(collection, path) +{ + let coll = i.freeze([ + { a: 1 }, + { b: 2 } + ]); + + let result = i.getIn(coll, [1, "b"]); // 2 +} + +// updateIn(collection, path, callback) +{ + let coll = i.freeze([ + { a: 1 }, + { b: 2 } + ]); + + let newColl = i.updateIn(coll, [1, "b"], function(val: number) { + return val * 2; + }); // [ {a: 1}, {b: 4} ] +} + +// assign(coll1, coll2, ...) +{ + let obj1 = { a: 1, b: 2, c: 3 }; + let obj2 = { c: 4, d: 5 }; + + let result = i.assign(obj1, obj2); // {a: 1, b: 2, c: 4, d: 5} +} + +// merge(target, source) +{ + let defaults = { a: 1, c: { d: 1, e: [1, 2, 3], f: { g: 1 } } }; + let obj = { c: { d: 2, e: [2], f: null as any } }; + + let result1 = i.merge(defaults, obj); // {a: 1, c: {d: 2, e: [2]}, f: null} + + let obj2 = { c: { d: 2 } }; + let result2 = i.merge(result1, obj2); + + (result1 === result2); // true +} + +// arrays +{ + var a = [1]; + a = i.push(a, 2); // [1, 2]; + a = i.unshift(a, 0); // [0, 1, 2]; + a = i.pop(a); // [0, 1]; + a = i.shift(a); // [1]; +} +{ + i.map(function(v) { return v * 2 }, [1, 2, 3]); // [2, 4, 6] + + var removeEvens = _.partial(i.filter, function(v: number) { return v % 2; }); + + removeEvens([1, 2, 3]); // [1, 3] +} +{ + var arr = i.freeze([{ a: 1 }, { b: 2 }]); + + //ECMAScript 2015 + //arr.find(function(item) { return item.b != null; }); // {b: 2} +} + +// chain(coll) - not defined +{ + let o = { + a: [1, 2, 3], + b: { c: 1 }, + d: 4 + }; + + let result = i.chain(o) + .assocIn(["a", 2], 4) + .merge({ b: { c: 2, c2: 3 } }) + .assoc("e", 2) + .dissoc("d") + .value(); +} diff --git a/icepick/icepick.d.ts b/icepick/icepick.d.ts new file mode 100644 index 0000000000..85bbf0ae3d --- /dev/null +++ b/icepick/icepick.d.ts @@ -0,0 +1,72 @@ +// Type definitions for icepick v1.1.0 +// Project: https://github.com/aearly/icepick +// Definitions by: Nathan Brown +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "icepick" { + export function freeze(collection: T): T; + export function thaw(collection: T): T; + export function assoc(collection: T, key: number | string, value: any): T; + export function dissoc(collection: T, key: number | string): T; + export function assocIn(collection: T, path: Array, value: any): T; + export function getIn(collection: any, path: Array): Result; + export function updateIn(collection: T, path: Array, callback: (value: V) => V): T; + + export {assoc as set}; + export {dissoc as unset}; + export {assocIn as setIn}; + + export function assign(target: T): T; + export function assign(target: T, source1: S1): (T & S1); + export function assign(target: T, s1: S1, s2: S2): (T & S1 & S2); + export function assign(target: T, s1: S1, s2: S2, s3: S3): (T & S1 & S2 & S3); + export function assign(target: T, s1: S1, s2: S2, s3: S3, s4: S4): (T & S1 & S2 & S3 & S4); + + export {assign as extend}; + + export function merge(target: T, source: S1): (T & S1); + + export function push(array: T[], element: T): T[]; + export function pop(array: T[]): T[]; + export function shift(array: T[]): T[]; + export function unshift(array: T[], element: T): T[]; + export function reverse(array: T[]): T[]; + export function sort(array: T[], compareFunction?: (a:T, b:T) => number): T[]; + export function splice(array: T[], start: number, deleteCount: number, ...items: T[]): T[]; + export function slice(array: T[], begin?: number, end?: number): T[]; + + export function map(fn: (value: T) => U, array: T[]): U[]; + export function filter(fn: (value: T) => boolean, array: T[]): T[]; + + interface IcepickWrapper { + value(): T; + + freeze(): IcepickWrapper; + thaw(): IcepickWrapper; + + assoc(key: number | string, value: any): IcepickWrapper; + set(key: number | string, value: any): IcepickWrapper; + + dissoc(key: number | string): IcepickWrapper; + unset(key: number | string): IcepickWrapper; + + assocIn(path: Array, value: any): IcepickWrapper; + setIn(path: Array, value: any): IcepickWrapper; + + getIn(collection: any, path: Array): IcepickWrapper; + updateIn(collection: T, path: Array, callback: (value: V) => V): IcepickWrapper; + + assign(source1: S1): IcepickWrapper; + assign(s1: S1, s2: S2): IcepickWrapper; + assign(s1: S1, s2: S2, s3: S3): IcepickWrapper; + assign(s1: S1, s2: S2, s3: S3, s4: S4): IcepickWrapper; + extend(source1: S1): IcepickWrapper; + extend(s1: S1, s2: S2): IcepickWrapper; + extend(s1: S1, s2: S2, s3: S3): IcepickWrapper; + extend(s1: S1, s2: S2, s3: S3, s4: S4): IcepickWrapper; + + merge(source: S1): IcepickWrapper; + } + + export function chain(target: T): IcepickWrapper; +} From 07f40fab1952d9bd8bb1461b81832fe6d95baa74 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Tue, 5 Jan 2016 10:22:44 +0900 Subject: [PATCH 229/441] add xmldom --- xmldom/xmldom-tests.ts | 36 ++++++++++++++++++++++++++++++++++++ xmldom/xmldom.d.ts | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 xmldom/xmldom-tests.ts create mode 100644 xmldom/xmldom.d.ts diff --git a/xmldom/xmldom-tests.ts b/xmldom/xmldom-tests.ts new file mode 100644 index 0000000000..2cb3ae544e --- /dev/null +++ b/xmldom/xmldom-tests.ts @@ -0,0 +1,36 @@ +/// + +import * as xmldom from 'xmldom'; + +var doc = new xmldom.DOMParser().parseFromString( + '\n'+ + '\ttest\n'+ + '\t\n'+ + '\t\n'+ + '' + ,'text/xml'); +doc.documentElement.setAttribute('x','y'); +doc.documentElement.setAttributeNS('./lite','c:x','y2'); +var nsAttr = doc.documentElement.getAttributeNS('./lite','x'); +console.info(nsAttr); +console.info(doc); + +function callback(w: any) { + +} + +//errorHandler is supported +new xmldom.DOMParser({ + /** + * locator is always need for error position info + */ + locator:{}, + /** + * you can override the errorHandler for xml parser + * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html + */ + errorHandler:{warning:function(w: any){console.warn(w)},error:callback,fatalError:callback} + //only callback model + //errorHandler:function(level,msg){console.log(level,msg)} +}); + diff --git a/xmldom/xmldom.d.ts b/xmldom/xmldom.d.ts new file mode 100644 index 0000000000..2a51cec1d4 --- /dev/null +++ b/xmldom/xmldom.d.ts @@ -0,0 +1,38 @@ +// Type definitions for xmldom 0.1.16 +// Project: https://github.com/jindw/xmldom.git +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "xmldom" { + namespace xmldom { + var DOMParser: DOMParserStatic; + + interface DOMParserStatic { + new(): DOMParser; + new(options: Options): DOMParser; + } + + interface DOMParser { + parseFromString(xmlsource: string, mimeType?: string): Document; + serializeToString(node: Node): string; + } + + interface Options { + locator?: any; + errorHandler?: ErrorHandlerFunction|ErrorHandlerObject; + } + + interface ErrorHandlerFunction { + (level: string, msg: any): any; + } + + interface ErrorHandlerObject { + warning?: (msg: any) => any; + error?: (msg: any) => any; + fatalError?: (msg: any) => any; + } + } + + export = xmldom; +} + From a6cd92e3b7f9478617fa84bbe4ba91158c4baea3 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Tue, 5 Jan 2016 03:30:18 +0100 Subject: [PATCH 230/441] Fix "Cannot find module 'express'" error --- serve-index/serve-index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/serve-index/serve-index.d.ts b/serve-index/serve-index.d.ts index 34ba2fbbb9..6b2ae64478 100644 --- a/serve-index/serve-index.d.ts +++ b/serve-index/serve-index.d.ts @@ -3,6 +3,8 @@ // Definitions by: Tanguy Krotoff // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module 'serve-index' { import * as express from 'express'; import * as fs from 'fs'; From 0e0cc0c53887d2c1f81765d35d568ad3146849bd Mon Sep 17 00:00:00 2001 From: Yonezawa-T2 Date: Tue, 5 Jan 2016 17:05:43 +0900 Subject: [PATCH 231/441] Updates kii-cloud-sdk v2.3.0 -> v2.4.0 --- kii-cloud-sdk/kii-cloud-sdk-tests.ts | 11 ++ kii-cloud-sdk/kii-cloud-sdk.d.ts | 207 +++++++++++++++++++++++++-- 2 files changed, 206 insertions(+), 12 deletions(-) diff --git a/kii-cloud-sdk/kii-cloud-sdk-tests.ts b/kii-cloud-sdk/kii-cloud-sdk-tests.ts index f926425383..ed5bb29666 100644 --- a/kii-cloud-sdk/kii-cloud-sdk-tests.ts +++ b/kii-cloud-sdk/kii-cloud-sdk-tests.ts @@ -46,4 +46,15 @@ function main() { object.set("foo", 1); object.save(); + + KiiGroup.registerGroupWithID("Group ID", "Group Name", [user], { + success: function(theSavedGroup: KiiGroup) { + theSavedGroup.saveWithOwner("user ID"); + }, + failure: function(theGroup: KiiGroup, + anErrorString: String, + addMembersArray: KiiUser[], + removeMembersArray: KiiUser[]) { + } + }); } diff --git a/kii-cloud-sdk/kii-cloud-sdk.d.ts b/kii-cloud-sdk/kii-cloud-sdk.d.ts index 57c8f50b1f..6f14d47bb9 100644 --- a/kii-cloud-sdk/kii-cloud-sdk.d.ts +++ b/kii-cloud-sdk/kii-cloud-sdk.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Kii Cloud SDK v2.3.0 +// Type definitions for Kii Cloud SDK v2.4.0 // Project: http://en.kii.com/ // Definitions by: Kii Consortium // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -83,6 +83,11 @@ declare module KiiCloud { */ _lot?: string; + /** + * product name given by thing vendor. + */ + _productName?: string; + /** * arbitrary string field. */ @@ -1028,6 +1033,65 @@ declare module KiiCloud { */ groupWithID(group: string): KiiGroup; + /** + * Register new group own by specified user on Kii Cloud with specified ID. + * This method can be used only by app admin. + * + *

      If the group that has specified id already exists, registration will be failed. + * + * @param groupID ID of the KiiGroup + * @param groupName Name of the KiiGroup + * @param user id of owner + * @param members An array of KiiUser objects to add to the group + * @param callbacks + * + * @return return promise object. + *
        + *
      • fulfill callback function: function(theSavedGroup). theSavedGroup is KiiGroup instance.
      • + *
      • reject callback function: function(error). error is an Error instance. + *
          + *
        • error.target is the KiiGroup instance which this method was called on.
        • + *
        • error.message
        • + *
        • error.addMembersArray is array of KiiUser to be added as memebers of this group.
        • + *
        • error.removeMembersArray is array of KiiUser to be removed from the memebers list of this group.
        • + *
        + *
      • + *
      + * + * @example + * // example to use callbacks directly + * Kii.authenticateAsAppAdmin("client-id", "client-secret", { + * success: function(adminContext) { + * var members = []; + * members.push(KiiUser.userWithID("Member User Id")); + * adminContext.registerGroupWithOwnerAndID("Group ID", "Group Name", "Owner User ID", members, { + * success: function(theSavedGroup) { + * // do something with the saved group + * }, + * failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) { + * // do something with the error response + * } + * }); + * }, + * failure: function(errorString, errorCode) { + * // auth failed. + * } + * }); + * // example to use Promise + * Kii.authenticateAsAppAdmin("client-id", "client-secret").then( + * function(adminContext) { + * var members = []; + * members.push(KiiUser.userWithID("Member User Id")); + * return adminContext.registerGroupWithOwnerAndID("Group ID", "Group Name", "Owner User ID", members); + * } + * ).then( + * function(group) { + * // do something with the saved group + * } + * ); + */ + registerGroupWithOwnerAndID(groupID: string, groupName: string, user: string, members: KiiUser[], callbacks?: { success(adminContext: KiiAppAdminContext): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise; + /** * Creates a reference to a group operated by app admin using group's URI. *

      @@ -1362,7 +1426,7 @@ declare module KiiCloud { * Register user/group as owner of specified thing by app admin. * * @param thingID The ID of thing - * @param owner to be registered as owner. + * @param owner instnce of KiiUser/KiiGroup to be registered as owner. * @param callbacks object holds callback functions. * * @return return promise object. @@ -1415,7 +1479,7 @@ declare module KiiCloud { * Register user/group as owner of specified thing by app admin. * * @param vendorThingID The vendor thing ID of thing - * @param owner to be registered as owner. + * @param owner instance of KiiUser/KiiGroupd to be registered as owner. * @param callbacks object holds callback functions. * * @return return promise object. @@ -2205,6 +2269,58 @@ declare module KiiCloud { */ objectURI(): string; + /** + * Register new group own by current user on Kii Cloud with specified ID. + * + *

      If the group that has specified id already exists, registration will be failed. + * + * @param groupID ID of the KiiGroup + * @param groupName Name of the KiiGroup + * @param members An array of KiiUser objects to add to the group + * @param callbacks An object with callback methods defined + * + * @return return promise object. + *
        + *
      • fulfill callback function: function(theSavedGroup). theSavedGroup is KiiGroup instance.
      • + *
      • reject callback function: function(error). error is an Error instance. + *
          + *
        • error.target is the KiiGroup instance which this method was called on.
        • + *
        • error.message
        • + *
        • error.addMembersArray is array of KiiUser to be added as memebers of this group.
        • + *
        • error.removeMembersArray is array of KiiUser to be removed from the memebers list of this group.
        • + *
        + *
      • + *
      + * + * @example + * // example to use callbacks directly + * var members = []; + * members.push(KiiUser.userWithID("Member User Id")); + * KiiGroup.registerGroupWithID("Group ID", "Group Name", members, { + * success: function(theSavedGroup) { + * // do something with the saved group + * }, + * failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) { + * // do something with the error response + * } + * }); + * + * // example to use Promise + * var members = []; + * members.push(KiiUser.userWithID("Member User Id")); + * KiiGroup.registerGroupWithID("Group ID", "Group Name", members).then( + * function(theSavedGroup) { + * // do something with the saved group + * }, + * function(error) { + * var theGroup = error.target; + * var anErrorString = error.message; + * var addMembersArray = error.addMembersArray; + * // do something with the error response + * }); + */ + static registerGroupWithID(groupID: string, groupName: string, members: KiiUser[], callbacks?: { success(theSavedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise; + /** * Creates a reference to a bucket for this group * @@ -2420,6 +2536,65 @@ declare module KiiCloud { */ save(callbacks?: { success(theSavedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise; + /** + * Saves the latest group values to the server with specified owner. + * This method can be used only by the group owner or app admin. + * + *

      If the group does not yet exist, it will be created. If the group already exists, the members and owner that have changed will be updated accordingly. If the group already exists and there is no updates of members and owner, it will allways succeed but does not execute update. To change the name of group, use {@link #changeGroupName}. + * + * @param user id of owner + * @param callbacks An object with callback methods defined + * + * @return return promise object. + *
        + *
      • fulfill callback function: function(theSavedGroup). theSavedGroup is KiiGroup instance.
      • + *
      • reject callback function: function(error). error is an Error instance. + *
          + *
        • error.target is the KiiGroup instance which this method was called on.
        • + *
        • error.message
        • + *
        • error.addMembersArray is array of KiiUser to be added as memebers of this group.
        • + *
        • error.removeMembersArray is array of KiiUser to be removed from the memebers list of this group.
        • + *
        + *
      • + *
      + * + * @example + * // example to use callbacks directly + * var group = . . .; // a KiiGroup + * group.saveWithOwner("UserID of owner", { + * success: function(theSavedGroup) { + * // do something with the saved group + * }, + * + * failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) { + * // do something with the error response + * } + * }); + * + * // example to use Promise + * var group = . . .; // a KiiGroup + * group.saveWithOwner("UserID of owner", { + * success: function(theSavedGroup) { + * // do something with the saved group + * }, + * + * failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) { + * // do something with the error response + * } + * }).then( + * function(theSavedGroup) { + * // do something with the saved group + * }, + * function(error) { + * var theGroup = error.target; + * var anErrorString = error.message; + * var addMembersArray = error.addMembersArray; + * var removeMembersArray = error.removeMembersArray; + * // do something with the error response + * }); + */ + saveWithOwner(user: string, callbacks?: { success(theSavedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise; + /** * Updates the local group's data with the group data on the server * @@ -2735,14 +2910,14 @@ declare module KiiCloud { /** * Get the application-defined type name of the object * - * @return + * @return type of this object. null or undefined if none exists */ getObjectType(): string; /** * Get the body content-type. * It will be updated after the success of {@link KiiObject#uploadBody} and {@link KiiObject#downloadBody} - * returns null when this object doesn't have body content-type information. + * returns null or undefined when this object doesn't have body content-type information. * * @return content-type of object body */ @@ -2751,15 +2926,18 @@ declare module KiiCloud { /** * Sets a key/value pair to a KiiObject * - *

      If the key already exists, its value will be written over. If the object is of invalid type, it will return false and a KiiError will be thrown (quietly). Accepted types are any JSON-encodable objects. + *

      If the key already exists, its value will be written over. *
      NOTE: Before involving floating point value, please consider using integer instead. For example, use percentage, permil, ppm, etc.
      * The reason is: *
    • Will dramatically improve the performance of bucket query.
    • *
    • Bucket query does not support the mixed result of integer and floating point. * ex.) If you use same key for integer and floating point and inquire object with the integer value, objects which has floating point value with the key would not be evaluated in the query. (and vice versa)
    • * - * @param key The key to set. The key must not be a system key (created, metadata, modified, type, uuid) or begin with an underscore (_) - * @param value The value to be set. Object must be of a JSON-encodable type (Ex: dictionary, array, string, number, etc) + * @param key The key to set. + * if null, empty string or string prefixed with '_' is specified, silently ignored and have no effect. + * We don't check if actual type is String or not. If non-string type is specified, it will be encoded as key by JSON.stringify() + * @param value The value to be set. Object must be JSON-encodable type (dictionary, array, string, number, boolean) + * We don't check actual type of the value. It will be encoded as value by JSON.stringify() * * @example * var obj = . . .; // a KiiObject @@ -2772,7 +2950,7 @@ declare module KiiCloud { * * @param key The key to retrieve * - * @return The object associated with the key. null if none exists + * @return The object associated with the key. null or undefined if none exists * * @example * var obj = . . .; // a KiiObject @@ -4665,6 +4843,11 @@ declare module KiiCloud { * '_thingID', '_created', '_accessToken'
      * Following properties are readonly after creation and will be ignored on {@link #update} of thing.
      * '_vendorThingID', '_password'
      + * As Property prefixed with '_' is reserved by Kii Cloud, + * properties other than ones described in the parameter secion + * and '_layoutPosition' are ignored on creation/{@link #update} of thing.
      + * Those ignored properties won't be removed from fields object passed as argument. + * However it won't be reflected to fields object property of created/updated Thing. * * @param fields of the thing to be registered. * @param callbacks object holds callback functions. @@ -5007,7 +5190,7 @@ declare module KiiCloud { * API is authorized by app admin.
      * * @param thingID The ID of thing - * @param owner to be registered as owner. + * @param owner instance of KiiUser/KiiGroup to be registered as owner. * @param callbacks object holds callback functions. * * @return return promise object. @@ -5059,7 +5242,7 @@ declare module KiiCloud { * API is authorized by app admin.
      * * @param vendorThingID The vendor thing ID of thing - * @param owner to be registered as owner. + * @param owner instance of KiiUser/KiiGroup to be registered as owner. * @param callbacks object holds callback functions. * * @return return promise object. @@ -5850,7 +6033,7 @@ declare module KiiCloud { * * @param key The key to retrieve * - * @return The object associated with the key. null if none exists + * @return The object associated with the key. null or undefined if none exists * * @example * var user = . . .; // a KiiUser From 701199e30787a129d3d9b7fb39aa0379e3ee357c Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 5 Jan 2016 13:52:06 +0500 Subject: [PATCH 232/441] lodash: signatures of _.indexBy have been changed --- lodash/lodash-tests.ts | 147 +++++++++++++++++++++++- lodash/lodash.d.ts | 248 ++++++++++++++++++++++++++++++++--------- 2 files changed, 339 insertions(+), 56 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2b..41bb409ac3 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4154,9 +4154,150 @@ module TestIncludes { } } -result = <_.Dictionary>_.indexBy(keys, 'dir'); -result = <_.Dictionary>_.indexBy(keys, function (key) { return String.fromCharCode(key.code); }); -result = <_.Dictionary>_.indexBy(keys, function (key) { this.fromCharCode(key.code); }, String); +// _.indexBy +module TestIndexBy { + type SampleObject = {a: number; b: string; c: boolean;}; + + let array: SampleObject[]; + let list: _.List; + let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; + + let stringIterator: (value: string, index: number, collection: string) => any; + let listIterator: (value: SampleObject, index: number, collection: _.List) => any; + let dictionaryIterator: (value: SampleObject, key: string, collection: _.Dictionary) => any; + let numericDictionaryIterator: (value: SampleObject, key: number, collection: _.NumericDictionary) => any; + + { + let result: _.Dictionary; + + result = _.indexBy('abcd'); + result = _.indexBy('abcd', stringIterator); + result = _.indexBy('abcd', stringIterator, any); + } + + { + let result: _.Dictionary; + + result = _.indexBy(array); + result = _.indexBy(array, listIterator); + result = _.indexBy(array, listIterator, any); + result = _.indexBy(array, 'a'); + result = _.indexBy(array, 'a', any); + result = _.indexBy<{a: number}, SampleObject>(array, {a: 42}); + result = _.indexBy(array, {a: 42}); + + result = _.indexBy(list); + result = _.indexBy(list, listIterator); + result = _.indexBy(list, listIterator, any); + result = _.indexBy(list, 'a'); + result = _.indexBy(list, 'a', any); + result = _.indexBy<{a: number}, SampleObject>(list, {a: 42}); + result = _.indexBy(list, {a: 42}); + + result = _.indexBy(numericDictionary); + result = _.indexBy(numericDictionary, numericDictionaryIterator); + result = _.indexBy(numericDictionary, numericDictionaryIterator, any); + result = _.indexBy(numericDictionary, 'a'); + result = _.indexBy(numericDictionary, 'a', any); + result = _.indexBy<{a: number}, SampleObject>(numericDictionary, {a: 42}); + result = _.indexBy(numericDictionary, {a: 42}); + + result = _.indexBy(dictionary); + result = _.indexBy(dictionary, dictionaryIterator); + result = _.indexBy(dictionary, dictionaryIterator, any); + result = _.indexBy(dictionary, 'a'); + result = _.indexBy(dictionary, 'a', any); + result = _.indexBy<{a: number}, SampleObject>(dictionary, {a: 42}); + result = _.indexBy(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _('abcd').indexBy(); + result = _('abcd').indexBy(stringIterator); + result = _('abcd').indexBy(stringIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(array).indexBy(); + result = _(array).indexBy(listIterator); + result = _(array).indexBy(listIterator, any); + result = _(array).indexBy('a'); + result = _(array).indexBy('a', any); + result = _(array).indexBy<{a: number}>({a: 42}); + + result = _(list).indexBy(); + result = _(list).indexBy(listIterator); + result = _(list).indexBy(listIterator, any); + result = _(list).indexBy('a'); + result = _(list).indexBy('a', any); + result = _(list).indexBy<{a: number}, SampleObject>({a: 42}); + result = _(list).indexBy({a: 42}); + + result = _(numericDictionary).indexBy(); + result = _(numericDictionary).indexBy(numericDictionaryIterator); + result = _(numericDictionary).indexBy(numericDictionaryIterator, any); + result = _(numericDictionary).indexBy('a'); + result = _(numericDictionary).indexBy('a', any); + result = _(numericDictionary).indexBy<{a: number}, SampleObject>({a: 42}); + result = _(numericDictionary).indexBy({a: 42}); + + result = _(dictionary).indexBy(); + result = _(dictionary).indexBy(dictionaryIterator); + result = _(dictionary).indexBy(dictionaryIterator, any); + result = _(dictionary).indexBy('a'); + result = _(dictionary).indexBy('a', any); + result = _(dictionary).indexBy<{a: number}, SampleObject>({a: 42}); + result = _(dictionary).indexBy({a: 42}); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _('abcd').chain().indexBy(); + result = _('abcd').chain().indexBy(stringIterator); + result = _('abcd').chain().indexBy(stringIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(array).chain().indexBy(); + result = _(array).chain().indexBy(listIterator); + result = _(array).chain().indexBy(listIterator, any); + result = _(array).chain().indexBy('a'); + result = _(array).chain().indexBy('a', any); + result = _(array).chain().indexBy<{a: number}>({a: 42}); + + result = _(list).chain().indexBy(); + result = _(list).chain().indexBy(listIterator); + result = _(list).chain().indexBy(listIterator, any); + result = _(list).chain().indexBy('a'); + result = _(list).chain().indexBy('a', any); + result = _(list).chain().indexBy<{a: number}, SampleObject>({a: 42}); + result = _(list).chain().indexBy({a: 42}); + + result = _(numericDictionary).chain().indexBy(); + result = _(numericDictionary).chain().indexBy(numericDictionaryIterator); + result = _(numericDictionary).chain().indexBy(numericDictionaryIterator, any); + result = _(numericDictionary).chain().indexBy('a'); + result = _(numericDictionary).chain().indexBy('a', any); + result = _(numericDictionary).chain().indexBy<{a: number}, SampleObject>({a: 42}); + result = _(numericDictionary).chain().indexBy({a: 42}); + + result = _(dictionary).chain().indexBy(); + result = _(dictionary).chain().indexBy(dictionaryIterator); + result = _(dictionary).chain().indexBy(dictionaryIterator, any); + result = _(dictionary).chain().indexBy('a'); + result = _(dictionary).chain().indexBy('a', any); + result = _(dictionary).chain().indexBy<{a: number}, SampleObject>({a: 42}); + result = _(dictionary).chain().indexBy({a: 42}); + } +} result = _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); result = _.invoke([123, 456], String.prototype.split, ''); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c45ec90eea..308008b4eb 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -6575,65 +6575,207 @@ declare module _ { //_.indexBy interface LoDashStatic { /** - * Creates an object composed of keys generated from the results of running each element - * of the collection through the given callback. The corresponding value of each key is - * the last element responsible for generating the key. The callback is bound to thisArg - * and invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for callback the created "_.pluck" style callback will - * return the property value of the given element. - * - * If an object is provided for callback the created "_.where" style callback will return - * true for elements that have the properties of the given object, else false. - * @param collection The collection to iterate over. - * @param callback The function called per iteration. - * @param thisArg The this binding of callback. - * @return Returns the composed aggregate object. - **/ - indexBy( - list: Array, - iterator: ListIterator, - context?: any): Dictionary; - - /** - * @see _.indexBy - **/ - indexBy( - list: List, - iterator: ListIterator, - context?: any): Dictionary; - - /** - * @see _.indexBy - * @param pluckValue _.pluck style callback - **/ - indexBy( - collection: Array, - pluckValue: string): Dictionary; - - /** - * @see _.indexBy - * @param pluckValue _.pluck style callback - **/ + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ indexBy( collection: List, - pluckValue: string): Dictionary; + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; /** - * @see _.indexBy - * @param whereValue _.where style callback - **/ - indexBy( - collection: Array, - whereValue: W): Dictionary; + * @see _.indexBy + */ + indexBy( + collection: NumericDictionary, + iteratee?: NumericDictionaryIterator, + thisArg?: any + ): Dictionary; /** - * @see _.indexBy - * @param whereValue _.where style callback - **/ - indexBy( - collection: List, - whereValue: W): Dictionary; + * @see _.indexBy + */ + indexBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: W + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: Object + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: Object + ): LoDashExplicitObjectWrapper>; } //_.invoke From b36cbcfd6bacd75b017b2acbb788c4b323d4ed87 Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Tue, 5 Jan 2016 11:42:14 +0100 Subject: [PATCH 233/441] updated foundation-sites v6.1.x --- CONTRIBUTORS.md | 2 +- ...ion-tests.ts => foundation-sites-tests.ts} | 2 +- ...{foundation.d.ts => foundation-sites.d.ts} | 77 +++++++++++++------ 3 files changed, 55 insertions(+), 26 deletions(-) rename foundation-sites/{foundation-tests.ts => foundation-sites-tests.ts} (97%) rename foundation-sites/{foundation.d.ts => foundation-sites.d.ts} (85%) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index e9d91ae109..97109dad87 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -399,7 +399,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](forge-di/forge-di.d.ts) [forge-di](https://github.com/nkohari/forge) by [Adam Carr](https://github.com/adamcarr) * [:link:](form-data/form-data.d.ts) [form-data](https://github.com/felixge/node-form-data) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](formidable/formidable.d.ts) [Formidable](https://github.com/felixge/node-formidable) by [Wim Looman](https://github.com/Nemo157) -* [:link:](foundation/foundation.d.ts) [Foundation](http://foundation.zurb.com) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](foundation/foundation-sites.d.ts) [Foundation](http://foundation.zurb.com) by [Boris Yankov](https://github.com/borisyankov) * [:link:](fpsmeter/FPSMeter.d.ts) [FPSmeter](http://darsa.in/fpsmeter) by [Aaron Lampros](http://github.com/alampros) * [:link:](freedom/freedom-core-env.d.ts) [freedom](https://github.com/freedomjs/freedom) by [Jonathan Pevarnek](https://github.com/jpevarnek) * [:link:](freedom/freedom-module-env.d.ts) [freedom](https://github.com/freedomjs/freedom) by [Jonathan Pevarnek](https://github.com/jpevarnek) diff --git a/foundation-sites/foundation-tests.ts b/foundation-sites/foundation-sites-tests.ts similarity index 97% rename from foundation-sites/foundation-tests.ts rename to foundation-sites/foundation-sites-tests.ts index 225f3c0fa8..6789452654 100644 --- a/foundation-sites/foundation-tests.ts +++ b/foundation-sites/foundation-sites-tests.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// -/// +/// $(document).foundation(); $(document).foundation('method5'); diff --git a/foundation-sites/foundation.d.ts b/foundation-sites/foundation-sites.d.ts similarity index 85% rename from foundation-sites/foundation.d.ts rename to foundation-sites/foundation-sites.d.ts index a6dd7682d1..3f845bd88a 100644 --- a/foundation-sites/foundation.d.ts +++ b/foundation-sites/foundation-sites.d.ts @@ -1,15 +1,20 @@ -// Type definitions for Foundation Sites v6.0.4 +// Type definitions for Foundation Sites v6.1.x // Project: http://foundation.zurb.com/ // Definitions by: Sam Vloeberghs // Definitions: https://github.com/borisyankov/DefinitelyTyped +// please also see the typings project and prefer to use it! +// typings project: https://github.com/typings/typings +// typings: https://github.com/samvloeberghs/foundation-sites-typings + /// declare module FoundationSites { // http://foundation.zurb.com/sites/docs/abide.html#javascript-reference interface Abide { - requiredChedck(element:Object): boolean; + requiredChecked(element:Object): boolean; + findFormError($el:Object): Object; findLabel(element:Object): boolean; addErrorClasses(element:Object): void; removeErrorClasses(element:Object): void; @@ -17,7 +22,9 @@ declare module FoundationSites { validateForm(element:Object): void; validateText(element:Object): boolean; validateRadio(group:string): boolean; + matchValidation($el:Object, validators:string, required:boolean): boolean; resetForm($form:Object): void; + destroy(): void; } interface IAbidePatterns { @@ -40,9 +47,13 @@ declare module FoundationSites { } interface IAbideOptions { - slideSpeed?: number; - multiOpen?: boolean; - patters?: IAbidePatterns; + validateOn?: string; + labelErrorClass?: string; + inputErrorClass?: string; + formErrorSelector?: string; + formErrorClass?: string; + liveValidate?: boolean; + validators?:any; } // http://foundation.zurb.com/sites/docs/accordion.html#javascript-reference @@ -56,10 +67,12 @@ declare module FoundationSites { interface IAccordionOptions { slideSpeed?: number multiOpen?: boolean; + allowAllClosed?: boolean; } // http://foundation.zurb.com/sites/docs/accordion-menu.html#javascript-reference interface AccordionMenu { + hideAll(): void; toggle($target:JQuery): void; down($target:JQuery, firstTime:boolean): void; up($target:JQuery): void; @@ -73,7 +86,8 @@ declare module FoundationSites { // http://foundation.zurb.com/sites/docs/drilldown-menu.html#javascript-reference interface Drilldown { - _hideAll($elem:JQuery): void; + _hideAll(): void; + _back($elem:JQuery): void; _show($elem:JQuery): void; _hide($elem:JQuery): void; destroy(): void; @@ -97,11 +111,13 @@ declare module FoundationSites { interface IDropdownOptions { hoverDelay?: number; hover?: boolean; + hoverPane?: boolean; vOffset?: number; hOffset?: number; positionClass?: string; trapFocus?: boolean; autoFocus?: boolean; + closeOnClick?: boolean; } // http://foundation.zurb.com/sites/docs/dropdown-menu.html#javascript-reference @@ -115,21 +131,26 @@ declare module FoundationSites { hoverDelay?: number; clickOpen?: boolean; closingTime?: number; - alignments?: string; - verticalClasss?: string; - rightClasss?: string; + alignment?: string; + closeOnClick?:boolean; + verticalClass?: string; + rightClass?: string; + forceFollow?: boolean; } // http://foundation.zurb.com/sites/docs/equalizer.html#javascript-reference interface Equalizer { getHeights(element:Object): Array; - applyHeight($eqParent:Object, heights:Array): void; + getHeightsByRow(cb:Function): void; + applyHeight(heights:Array): void; + applyHeightByRow(groups:Array):void; destroy(): void; } interface IEqualizerOptions { equalizeOnStack?: boolean; - throttleInterval?: number; + equalizeByRow?: boolean; + equalizeOn?:string; } // http://foundation.zurb.com/sites/docs/interchange.html#javascript-reference @@ -155,13 +176,15 @@ declare module FoundationSites { threshold?: number; activeClass?: string; deepLinking?: boolean; + barOffset: number; } // http://foundation.zurb.com/sites/docs/offcanvas.html#javascript-reference interface OffCanvas { + reveal(isRevealed:boolean): void; open(event:Object, trigger:JQuery): void; - toggle(event:Object, trigger:JQuery): void; close(): void; + toggle(event:Object, trigger:JQuery): void; destroy(): void; } @@ -171,6 +194,7 @@ declare module FoundationSites { position?: string; forceTop?: boolean; isRevealed?: boolean; + isRevealed?: boolean; revealOn?: string; autoFocus?: boolean; revealClass?: string; @@ -178,8 +202,8 @@ declare module FoundationSites { // http://foundation.zurb.com/sites/docs/orbit.html#javascript-reference interface Orbit { - changeSlide(isLTR:boolean, chosenSlide?:Object, idx?:number): void; geoSync(): void; + changeSlide(isLTR:boolean, chosenSlide?:Object, idx?:number): void; destroy(): void; } @@ -201,6 +225,7 @@ declare module FoundationSites { boxOfBullets?: string; nextClass?: string; prevClass?: string; + useMUI?: boolean; } // http://foundation.zurb.com/sites/docs/reveal.html#javascript-reference @@ -254,7 +279,7 @@ declare module FoundationSites { _pauseListeners(scrollListener:string): void; _calc(checkSizes:boolean, scroll:number): void; destroy(): void; - emCalc(number:any): void; + emCalc(Number:number): void; } interface IStickyOptions { @@ -279,7 +304,11 @@ declare module FoundationSites { } interface ITabsOptions { - animate?: boolean; + autoFocus?: boolean; + wrapOnKeys?: boolean; + matchHeight?: boolean; + linkClass?: string; + panelClass?: string; } // http://foundation.zurb.com/sites/docs/toggler.html#javascript-reference @@ -328,14 +357,15 @@ declare module FoundationSites { interface KeyBoard { parseKey(event:any): string; + handleKey(event:any, component:any, functions:any):void; findFocusable($element:Object): Object; } interface MediaQuery { get(size:string): string; atLeast(size:string): boolean; - queries:Array; - current:any; + queries:Array; + current:string; } interface Motion { @@ -348,9 +378,8 @@ declare module FoundationSites { } interface Nest { - // TODO - //Feather: function(menu, type) - // Burn: function(menu, type){ + Feather(menu:any, type:any); + Burn(menu:any, type:any); } interface Timer { @@ -374,6 +403,7 @@ declare module FoundationSites { plugin(plugin:Object, name:string): void; registerPlugin(plugin:Object): void; unregisterPlugin(plugin:Object): void; + reInit(plugins:Array):void; GetYoDigits(length:number, namespace?:string): string; reflow(elem:Object, plugins?:Array|string): void; getFnName(fn:string): string; @@ -382,7 +412,6 @@ declare module FoundationSites { util : { throttle(func:(...args:any[]) => any, delay:number): (...args:any[]) => any; }; - onImagesLoaded(images:Object, cb:Function): void; Abide(element:Object, options?:IAbideOptions): Abide; Accordion(element:Object, options?:IAccordionOptions): Accordion; @@ -421,8 +450,8 @@ interface JQuery { foundation(method?:string|Array) : JQuery; } -declare var Foundation:FoundationSites.FoundationSitesStatic; +declare var FoundationSites:FoundationSites.FoundationSitesStatic; -declare module "Foundation" { - export = Foundation; +declare module "FoundationSites" { + export = FoundationSites; } From 6d23a0171b6ea20c26934572aa914cac5b41f42e Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Tue, 5 Jan 2016 11:55:16 +0100 Subject: [PATCH 234/441] updated foundation-sites --- foundation-sites/foundation-sites.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/foundation-sites/foundation-sites.d.ts b/foundation-sites/foundation-sites.d.ts index 3f845bd88a..6cf091da4d 100644 --- a/foundation-sites/foundation-sites.d.ts +++ b/foundation-sites/foundation-sites.d.ts @@ -176,7 +176,7 @@ declare module FoundationSites { threshold?: number; activeClass?: string; deepLinking?: boolean; - barOffset: number; + barOffset?: number; } // http://foundation.zurb.com/sites/docs/offcanvas.html#javascript-reference @@ -450,8 +450,8 @@ interface JQuery { foundation(method?:string|Array) : JQuery; } -declare var FoundationSites:FoundationSites.FoundationSitesStatic; +declare var Foundation:FoundationSites.FoundationSitesStatic; -declare module "FoundationSites" { - export = FoundationSites; +declare module "Foundation" { + export = Foundation; } From 91f0e294e4d1da1f6bc21d89bf87372dcc176450 Mon Sep 17 00:00:00 2001 From: Karl-Aksel Puulmann Date: Tue, 5 Jan 2016 16:23:37 +0200 Subject: [PATCH 235/441] Make the second argument to node-temp.path optional. --- temp/temp-tests.ts | 2 ++ temp/temp.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/temp/temp-tests.ts b/temp/temp-tests.ts index be25d357bb..4fb0cc6f86 100644 --- a/temp/temp-tests.ts +++ b/temp/temp-tests.ts @@ -67,6 +67,8 @@ function testMkdirSync() { function testPath() { const p = temp.path({ suffix: "justSuffix" }, "defaultPrefix"); p.length; + const p2: string = temp.path("prefix"); + const p3: string = temp.path({ prefix: "prefix" }); } function testTrack() { diff --git a/temp/temp.d.ts b/temp/temp.d.ts index 7cd51d2be5..c8caab7467 100644 --- a/temp/temp.d.ts +++ b/temp/temp.d.ts @@ -31,8 +31,8 @@ declare module "temp" { export function openSync(affixes: string): { path: string, fd: number }; export function openSync(affixes: AffixOptions): { path: string, fd: number }; - export function path(affixes: string, defaultPrefix: string): string; - export function path(affixes: AffixOptions, defaultPrefix: string): string; + export function path(affixes: string, defaultPrefix?: string): string; + export function path(affixes: AffixOptions, defaultPrefix?: string): string; export function cleanup(callback?: (result: boolean | {files: number, dirs?: number}) => void): void; From 0d6fa711d919d4d51ff98ac547f061ee8c2bbbef Mon Sep 17 00:00:00 2001 From: pragmat1c Date: Tue, 5 Jan 2016 11:23:20 -0600 Subject: [PATCH 236/441] Added tests for success signature update --- dropzone/dropzone-tests.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dropzone/dropzone-tests.ts b/dropzone/dropzone-tests.ts index e15d6e0380..3893f7c1a1 100644 --- a/dropzone/dropzone-tests.ts +++ b/dropzone/dropzone-tests.ts @@ -131,6 +131,13 @@ dropzoneWithOptionsVariations = new Dropzone(".test", { clickable: ["test", document.getElementById("test")] }); +dropzoneWithOptionsVariations = new Dropzone(".test", { + success: (file:DropzoneFile, response:Object) => console.log(file, response) +}); +dropzoneWithOptionsVariations = new Dropzone(".test", { + success: (file:DropzoneFile, response:string) => console.log(file, response) +}); + const dropzone = new Dropzone(".test"); dropzone.enable(); From ed81eab2015492a415411a3910db9375b5fcbaaf Mon Sep 17 00:00:00 2001 From: William Comartin Date: Tue, 5 Jan 2016 16:55:22 -0500 Subject: [PATCH 237/441] add leaflet-fullscreen definitions --- .../leaflet-fullscreen-tests.ts | 12 +++++++ leaflet-fullscreen/leaflet-fullscreen.d.ts | 31 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 leaflet-fullscreen/leaflet-fullscreen-tests.ts create mode 100644 leaflet-fullscreen/leaflet-fullscreen.d.ts diff --git a/leaflet-fullscreen/leaflet-fullscreen-tests.ts b/leaflet-fullscreen/leaflet-fullscreen-tests.ts new file mode 100644 index 0000000000..a631986a51 --- /dev/null +++ b/leaflet-fullscreen/leaflet-fullscreen-tests.ts @@ -0,0 +1,12 @@ +/// + +var map: L.Map; +var icon: L.Control.Fullcircle = new L.control.fullcircle({ + position: 'topleft', + title: 'Full Screen', + titleCancel: 'Exit Full Screen', + forceSeparateButton: false, + forcePseudoFullscreen: false +}); + +icon.addTo(map); diff --git a/leaflet-fullscreen/leaflet-fullscreen.d.ts b/leaflet-fullscreen/leaflet-fullscreen.d.ts new file mode 100644 index 0000000000..8941a76e5b --- /dev/null +++ b/leaflet-fullscreen/leaflet-fullscreen.d.ts @@ -0,0 +1,31 @@ +// Type definitions for Leaflet.fullscreen v1.3.0 +// Project: https://github.com/brunob/leaflet.fullscreen +// Definitions by: William Comartin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module L { + + namespace Control { + + export interface Fullscreen extends L.Control {} + + export interface FullscreenOptions { + position: string, + title: string, + titleCancel: string, + forceSeparateButton: boolean, + forcePseudoFullscreen: boolean + } + } + + namespace control { + + /** + * Creates a fullscreen control. + */ + export function fullscreen(options?: Control.FullscreenOptions): L.Control.Fullscreen; + + } +} From a1feab7b714460e3681dc57d12063ef5fb3feb92 Mon Sep 17 00:00:00 2001 From: William Comartin Date: Tue, 5 Jan 2016 16:59:37 -0500 Subject: [PATCH 238/441] fix test --- leaflet-fullscreen/leaflet-fullscreen-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leaflet-fullscreen/leaflet-fullscreen-tests.ts b/leaflet-fullscreen/leaflet-fullscreen-tests.ts index a631986a51..50a427a79d 100644 --- a/leaflet-fullscreen/leaflet-fullscreen-tests.ts +++ b/leaflet-fullscreen/leaflet-fullscreen-tests.ts @@ -1,7 +1,7 @@ /// var map: L.Map; -var icon: L.Control.Fullcircle = new L.control.fullcircle({ +var icon: L.Control.Fullscreen = L.control.fullscreen({ position: 'topleft', title: 'Full Screen', titleCancel: 'Exit Full Screen', From d9978a3c3c91377b94c59a06d82eee292902b123 Mon Sep 17 00:00:00 2001 From: Roger Chen Date: Sat, 2 Jan 2016 10:56:26 -0800 Subject: [PATCH 239/441] Update react-router typings for 2.0.0 --- react-router/react-router-1.0.0.d.ts | 452 +++++++++++++++++++++++++++ react-router/react-router-tests.tsx | 7 +- react-router/react-router.d.ts | 16 +- 3 files changed, 469 insertions(+), 6 deletions(-) create mode 100644 react-router/react-router-1.0.0.d.ts diff --git a/react-router/react-router-1.0.0.d.ts b/react-router/react-router-1.0.0.d.ts new file mode 100644 index 0000000000..2010a1f496 --- /dev/null +++ b/react-router/react-router-1.0.0.d.ts @@ -0,0 +1,452 @@ +// Type definitions for react-router v1.0.0 +// Project: https://github.com/rackt/react-router +// Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// +/// + + +declare namespace ReactRouter { + + import React = __React + + import H = HistoryModule + + // types based on https://github.com/rackt/react-router/blob/master/docs/Glossary.md + + type Component = React.ReactType + + type EnterHook = (nextState: RouterState, replaceState: RedirectFunction, callback?: Function) => any + + type LeaveHook = () => any + + type Params = Object + + type ParseQueryString = (queryString: H.QueryString) => H.Query + + type RedirectFunction = (state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query) => void + + type RouteComponent = Component + + // use the following interface in an app code to get access to route param values, history, location... + // interface MyComponentProps extends ReactRouter.RouteComponentProps<{}, { id: number }> {} + // somewhere in MyComponent + // ... + // let id = this.props.routeParams.id + // ... + // this.props.history. ... + // ... + interface RouteComponentProps { + history?: History + location?: H.Location + params?: P + route?: PlainRoute + routeParams?: R + routes?: PlainRoute[] + } + + type RouteComponents = { [key: string]: RouteComponent } + + type RouteConfig = React.ReactNode | PlainRoute | PlainRoute[] + + type RouteHook = (nextLocation?: H.Location) => any + + type RoutePattern = string + + type StringifyQuery = (queryObject: H.Query) => H.QueryString + + type RouterListener = (error: Error, nextState: RouterState) => void + + interface RouterState { + location: H.Location + routes: PlainRoute[] + params: Params + components: RouteComponent[] + } + + + interface HistoryBase extends H.History { + routes: PlainRoute[] + parseQueryString?: ParseQueryString + stringifyQuery?: StringifyQuery + } + + type History = HistoryBase & H.HistoryQueries & HistoryRoutes + + + /* components */ + + interface RouterProps extends React.Props { + history?: H.History + routes?: RouteConfig // alias for children + createElement?: (component: RouteComponent, props: Object) => any + onError?: (error: any) => any + onUpdate?: () => any + parseQueryString?: ParseQueryString + stringifyQuery?: StringifyQuery + } + interface Router extends React.ComponentClass {} + interface RouterElement extends React.ReactElement {} + const Router: Router + + + interface LinkProps extends React.HTMLAttributes, React.Props { + activeStyle?: React.CSSProperties + activeClassName?: string + onlyActiveOnIndex?: boolean + to: RoutePattern + query?: H.Query + state?: H.LocationState + } + interface Link extends React.ComponentClass {} + interface LinkElement extends React.ReactElement {} + const Link: Link + + + const IndexLink: Link + + + interface RoutingContextProps extends React.Props { + history: H.History + createElement: (component: RouteComponent, props: Object) => any + location: H.Location + routes: RouteConfig + params: Params + components?: RouteComponent[] + } + interface RoutingContext extends React.ComponentClass {} + interface RoutingContextElement extends React.ReactElement {} + const RoutingContext: RoutingContext + + + /* components (configuration) */ + + interface RouteProps extends React.Props { + path?: RoutePattern + component?: RouteComponent + components?: RouteComponents + getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void + getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void + onEnter?: EnterHook + onLeave?: LeaveHook + } + interface Route extends React.ComponentClass {} + interface RouteElement extends React.ReactElement {} + const Route: Route + + + interface PlainRoute { + path?: RoutePattern + component?: RouteComponent + components?: RouteComponents + getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void + getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void + onEnter?: EnterHook + onLeave?: LeaveHook + indexRoute?: PlainRoute + getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void + childRoutes?: PlainRoute[] + getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void + } + + + interface RedirectProps extends React.Props { + path?: RoutePattern + from?: RoutePattern // alias for path + to: RoutePattern + query?: H.Query + state?: H.LocationState + } + interface Redirect extends React.ComponentClass {} + interface RedirectElement extends React.ReactElement {} + const Redirect: Redirect + + + interface IndexRouteProps extends React.Props { + component?: RouteComponent + components?: RouteComponents + getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void + getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void + onEnter?: EnterHook + onLeave?: LeaveHook + } + interface IndexRoute extends React.ComponentClass {} + interface IndexRouteElement extends React.ReactElement {} + const IndexRoute: IndexRoute + + + interface IndexRedirectProps extends React.Props { + to: RoutePattern + query?: H.Query + state?: H.LocationState + } + interface IndexRedirect extends React.ComponentClass {} + interface IndexRedirectElement extends React.ReactElement {} + const IndexRedirect: IndexRedirect + + + /* mixins */ + + interface HistoryMixin { + history: History + } + const History: React.Mixin + + + interface LifecycleMixin { + routerWillLeave(nextLocation: H.Location): string | boolean + } + const Lifecycle: React.Mixin + + + const RouteContext: React.Mixin + + + /* utils */ + + interface HistoryRoutes { + listen(listener: RouterListener): Function + listenBeforeLeavingRoute(route: PlainRoute, hook: RouteHook): void + match(location: H.Location, callback: (error: any, nextState: RouterState, nextLocation: H.Location) => void): void + isActive(pathname: H.Pathname, query?: H.Query, indexOnly?: boolean): boolean + } + + function useRoutes(createHistory: HistoryModule.CreateHistory): HistoryModule.CreateHistory + + + function createRoutes(routes: RouteConfig): PlainRoute[] + + + interface MatchArgs { + routes?: RouteConfig + history?: H.History + location?: H.Location + parseQueryString?: ParseQueryString + stringifyQuery?: StringifyQuery + } + interface MatchState extends RouterState { + history: History + } + function match(args: MatchArgs, cb: (error: any, nextLocation: H.Location, nextState: MatchState) => void): void + +} + + +declare module "react-router/lib/Router" { + + export default ReactRouter.Router + +} + + +declare module "react-router/lib/Link" { + + export default ReactRouter.Link + +} + + +declare module "react-router/lib/IndexLink" { + + export default ReactRouter.IndexLink + +} + + +declare module "react-router/lib/IndexRedirect" { + + export default ReactRouter.IndexRedirect + +} + + +declare module "react-router/lib/IndexRoute" { + + export default ReactRouter.IndexRoute + +} + + +declare module "react-router/lib/Redirect" { + + export default ReactRouter.Redirect + +} + + +declare module "react-router/lib/Route" { + + export default ReactRouter.Route + +} + + +declare module "react-router/lib/History" { + + export default ReactRouter.History + +} + + +declare module "react-router/lib/Lifecycle" { + + export default ReactRouter.Lifecycle + +} + + +declare module "react-router/lib/RouteContext" { + + export default ReactRouter.RouteContext + +} + + +declare module "react-router/lib/useRoutes" { + + export default ReactRouter.useRoutes + +} + +declare module "react-router/lib/PatternUtils" { + + export function formatPattern(pattern: string, params: {}): string; + +} + +declare module "react-router/lib/RouteUtils" { + + type E = __React.ReactElement + + export function isReactChildren(object: E | E[]): boolean + + export function createRouteFromReactElement(element: E): ReactRouter.PlainRoute + + export function createRoutesFromReactChildren(children: E | E[], parentRoute: ReactRouter.PlainRoute): ReactRouter.PlainRoute[] + + export import createRoutes = ReactRouter.createRoutes + +} + + +declare module "react-router/lib/RoutingContext" { + + export default ReactRouter.RoutingContext + +} + + +declare module "react-router/lib/PropTypes" { + + import React = __React + + export function falsy(props: any, propName: string, componentName: string): Error; + + export const history: React.Requireable + + export const location: React.Requireable + + export const component: React.Requireable + + export const components: React.Requireable + + export const route: React.Requireable + + export const routes: React.Requireable + + export default { + falsy, + history, + location, + component, + components, + route + } + +} + + +declare module "react-router/lib/match" { + + export default ReactRouter.match + +} + + +declare module "react-router" { + + import Router from "react-router/lib/Router" + + import Link from "react-router/lib/Link" + + import IndexLink from "react-router/lib/IndexLink" + + import IndexRedirect from "react-router/lib/IndexRedirect" + + import IndexRoute from "react-router/lib/IndexRoute" + + import Redirect from "react-router/lib/Redirect" + + import Route from "react-router/lib/Route" + + import History from "react-router/lib/History" + + import Lifecycle from "react-router/lib/Lifecycle" + + import RouteContext from "react-router/lib/RouteContext" + + import useRoutes from "react-router/lib/useRoutes" + + import { createRoutes } from "react-router/lib/RouteUtils" + + import { formatPattern } from "react-router/lib/PatternUtils" + + import RoutingContext from "react-router/lib/RoutingContext" + + import PropTypes from "react-router/lib/PropTypes" + + import match from "react-router/lib/match" + + // PlainRoute is defined in the API documented at: + // https://github.com/rackt/react-router/blob/master/docs/API.md + // but not included in any of the .../lib modules above. + export type PlainRoute = ReactRouter.PlainRoute + + // The following definitions are also very useful to export + // because by using these types lots of potential type errors + // can be exposed: + export type EnterHook = ReactRouter.EnterHook + export type LeaveHook = ReactRouter.LeaveHook + export type ParseQueryString = ReactRouter.ParseQueryString + export type RedirectFunction = ReactRouter.RedirectFunction + export type RouteComponentProps = ReactRouter.RouteComponentProps; + export type RouteHook = ReactRouter.RouteHook + export type StringifyQuery = ReactRouter.StringifyQuery + export type RouterListener = ReactRouter.RouterListener + export type RouterState = ReactRouter.RouterState + export type HistoryBase = ReactRouter.HistoryBase + + export { + Router, + Link, + IndexLink, + IndexRedirect, + IndexRoute, + Redirect, + Route, + History, + Lifecycle, + RouteContext, + useRoutes, + createRoutes, + formatPattern, + RoutingContext, + PropTypes, + match + } + + export default Router + +} diff --git a/react-router/react-router-tests.tsx b/react-router/react-router-tests.tsx index 42ee3236f6..ab32451a03 100644 --- a/react-router/react-router-tests.tsx +++ b/react-router/react-router-tests.tsx @@ -8,10 +8,7 @@ import * as React from "react" import * as ReactDOM from "react-dom" -import { Router, Route, IndexRoute, Link } from "react-router" - -import createHistory from "history/lib/createBrowserHistory" - +import { browserHistory, hashHistory, Router, Route, IndexRoute, Link } from "react-router" class Master extends React.Component, {}> { @@ -59,7 +56,7 @@ class Users extends React.Component<{}, {}> { ReactDOM.render(( - + diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 2010a1f496..01411fcd51 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -74,7 +74,8 @@ declare namespace ReactRouter { } type History = HistoryBase & H.HistoryQueries & HistoryRoutes - + const browserHistory: History; + const hashHistory: History; /* components */ @@ -367,6 +368,13 @@ declare module "react-router/lib/PropTypes" { } +declare module "react-router/lib/browserHistory" { + export default ReactRouter.browserHistory; +} + +declare module "react-router/lib/hashHistory" { + export default ReactRouter.hashHistory; +} declare module "react-router/lib/match" { @@ -397,6 +405,10 @@ declare module "react-router" { import RouteContext from "react-router/lib/RouteContext" + import browserHistory from "react-router/lib/browserHistory" + + import hashHistory from "react-router/lib/hashHistory" + import useRoutes from "react-router/lib/useRoutes" import { createRoutes } from "react-router/lib/RouteUtils" @@ -437,6 +449,8 @@ declare module "react-router" { Redirect, Route, History, + browserHistory, + hashHistory, Lifecycle, RouteContext, useRoutes, From 41745c212ae7ad4133213b5b08e39817a6ab5ffd Mon Sep 17 00:00:00 2001 From: Sean Lee Date: Tue, 5 Jan 2016 15:50:39 -0800 Subject: [PATCH 240/441] Add callback parameter to sendPendingData method def'n --- applicationinsights/applicationinsights-tests.ts | 5 +++++ applicationinsights/applicationinsights.d.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/applicationinsights/applicationinsights-tests.ts b/applicationinsights/applicationinsights-tests.ts index 8d4d83e9dc..2a4613b019 100644 --- a/applicationinsights/applicationinsights-tests.ts +++ b/applicationinsights/applicationinsights-tests.ts @@ -24,3 +24,8 @@ appInsights.client.trackDependency("dependency name", "commandName", 500, true); appInsights.client.commonProperties = { environment: "dev" }; + +// send any pending data and log the response +appInsights.client.sendPendingData(function (response) { + console.log(response); +}); diff --git a/applicationinsights/applicationinsights.d.ts b/applicationinsights/applicationinsights.d.ts index 9fc6f494d5..f5ea9d4134 100644 --- a/applicationinsights/applicationinsights.d.ts +++ b/applicationinsights/applicationinsights.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Application Insights v0.15.7 +// Type definitions for Application Insights v0.15.8 // Project: https://github.com/Microsoft/ApplicationInsights-node.js // Definitions by: Scott Southwood // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -358,7 +358,7 @@ interface Client { /** * Immediately send all queued telemetry. */ - sendPendingData(): void; + sendPendingData(callback?: (response: string) => void): void; getEnvelope(data: ContractsModule.Data, tagOverrides?: { [key: string]: string; }): ContractsModule.Envelope; From da661942bf171296ba17d3e6a673db8af25782cf Mon Sep 17 00:00:00 2001 From: Ken Fukuyama Date: Wed, 6 Jan 2016 11:42:47 +0900 Subject: [PATCH 241/441] added 'static' to methods according to the docs --- backbone-relational/backbone-relational.d.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/backbone-relational/backbone-relational.d.ts b/backbone-relational/backbone-relational.d.ts index 4f4aa45cc6..af8e4e31f7 100644 --- a/backbone-relational/backbone-relational.d.ts +++ b/backbone-relational/backbone-relational.d.ts @@ -35,15 +35,15 @@ declare module Backbone { toJSON():any; - setup(); + static setup(); - build(attributes:any, options?:any); + static build(attributes:any, options?:any); - findOrCreate(attributes:string, options?:any); + static findOrCreate(attributes:string, options?:any); - findOrCreate(attributes:number, options?:any); + static findOrCreate(attributes:number, options?:any); - findOrCreate(attributes:any, options?:any); + static findOrCreate(attributes:any, options?:any); } export class Relation extends Model { @@ -147,13 +147,13 @@ declare module Backbone { resolveIdForItem(type:any, item:any):any; - find(type:any, item:string):RelationalModel; + static find(type:any, item:string):RelationalModel; - find(type:any, item:number):RelationalModel; + static find(type:any, item:number):RelationalModel; - find(type:any, item:RelationalModel):RelationalModel; + static find(type:any, item:RelationalModel):RelationalModel; - find(type:any, item:any):RelationalModel; + static find(type:any, item:any):RelationalModel; register(model:RelationalModel):void; @@ -169,3 +169,4 @@ declare module Backbone { } } + From de2a074c56f41c19d4669fdd0e0c0a61454adee1 Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Wed, 6 Jan 2016 15:23:15 +0800 Subject: [PATCH 242/441] Move to ES6 module definition style. --- field/field-test.ts | 1 + field/field.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/field/field-test.ts b/field/field-test.ts index d99dfee8a5..4a3daf8dd7 100644 --- a/field/field-test.ts +++ b/field/field-test.ts @@ -1,6 +1,7 @@ // From https://github.com/jprichardson/field/blob/e968fd979ba1a06e35571695ddfdad513e516eae/README.md /// +import * as field from 'field'; // get diff --git a/field/field.d.ts b/field/field.d.ts index 0ffe08a01e..75b1c8d396 100644 --- a/field/field.d.ts +++ b/field/field.d.ts @@ -3,7 +3,7 @@ // Definitions by: Leo Liang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module field { +declare module 'field' { export function get(topObj: any, fields: string): any; export function set(topObj: any, fields: string, value: any): any; } From 4a9a8a49ea59703baea9fe7aff3810d55663793a Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Wed, 6 Jan 2016 08:45:05 +0100 Subject: [PATCH 243/441] updated implicit any + duplicate id + patch version to 6.1.1 --- fingerprintjs2/fingerprint2-tests.ts | 15 ++++++++ fingerprintjs2/fingerprint2.d.ts | 50 ++++++++++++++++++++++++++ foundation-sites/foundation-sites.d.ts | 7 ++-- 3 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 fingerprintjs2/fingerprint2-tests.ts create mode 100644 fingerprintjs2/fingerprint2.d.ts diff --git a/fingerprintjs2/fingerprint2-tests.ts b/fingerprintjs2/fingerprint2-tests.ts new file mode 100644 index 0000000000..7f4baf756d --- /dev/null +++ b/fingerprintjs2/fingerprint2-tests.ts @@ -0,0 +1,15 @@ +// Type definitions for fingerprintjs2 1.0.0-rc3 +// Project: https://github.com/Valve/fingerprintjs2 +// Definitions by: Sam Vloeberghs +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +let f2 = new Fingerprint2.Fingerprint2(); +f2.get((result:string, components:Array) => { + +}); + +let options = {}; +let f2withOptions = new Fingerprint2.Fingerprint2(options); +f2withOptions.get((result:string, components:Array) => { + +}); diff --git a/fingerprintjs2/fingerprint2.d.ts b/fingerprintjs2/fingerprint2.d.ts new file mode 100644 index 0000000000..87150da3dd --- /dev/null +++ b/fingerprintjs2/fingerprint2.d.ts @@ -0,0 +1,50 @@ +// Type definitions for fingerprintjs2 1.0.0-rc3 +// Project: https://github.com/Valve/fingerprintjs2 +// Definitions by: Sam Vloeberghs +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Fingerprint2Js { + + interface Fingerprint2Static { + new(option?:Fingerprint2Option): Fingerprint2; + } + + interface Fingerprint2 { + get(func:(result:string, components:Array) => void): void; + } + + interface Fingerprint2Option { + swfContainerId?: string; + swfPath?: string; + excludeUserAgent?: boolean; + excludeLanguage?: boolean; + excludeColorDepth?: boolean; + excludeScreenResolution?: boolean; + excludeTimezoneOffset?: boolean; + excludeSessionStorage?: boolean; + excludeIndexedDB?: boolean; + excludeAddBehavior?: boolean; + excludeOpenDatabase?: boolean; + excludeCpuClass?: boolean; + excludePlatform?: boolean; + excludeDoNotTrack?: boolean; + excludeCanvas?: boolean; + excludeWebGL?: boolean; + excludeAdBlock?: boolean; + excludeHasLiedLanguages?: boolean; + excludeHasLiedResolution?: boolean; + excludeHasLiedOs?: boolean; + excludeHasLiedBrowser?: boolean; + excludeJsFonts?: boolean; + excludeFlashFonts?: boolean; + excludePlugins?: boolean; + excludeTouchSupport?: boolean; + } + +} + +declare var Fingerprint2:Fingerprint2Js.Fingerprint2Static; + +declare module "Fingerprint2" { + export = Fingerprint2; +} diff --git a/foundation-sites/foundation-sites.d.ts b/foundation-sites/foundation-sites.d.ts index 6cf091da4d..55070df144 100644 --- a/foundation-sites/foundation-sites.d.ts +++ b/foundation-sites/foundation-sites.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Foundation Sites v6.1.x +// Type definitions for Foundation Sites v6.1.1 // Project: http://foundation.zurb.com/ // Definitions by: Sam Vloeberghs // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -194,7 +194,6 @@ declare module FoundationSites { position?: string; forceTop?: boolean; isRevealed?: boolean; - isRevealed?: boolean; revealOn?: string; autoFocus?: boolean; revealClass?: string; @@ -378,8 +377,8 @@ declare module FoundationSites { } interface Nest { - Feather(menu:any, type:any); - Burn(menu:any, type:any); + Feather(menu:any, type:any):void; + Burn(menu:any, type:any):void; } interface Timer { From 3c44b9c4d89cf065a39595eb0f73fc7f6001418b Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Wed, 6 Jan 2016 08:45:41 +0100 Subject: [PATCH 244/441] updated implicit any + duplicate id + patch version to 6.1.1 --- fingerprintjs2/fingerprint2-tests.ts | 15 --------- fingerprintjs2/fingerprint2.d.ts | 50 ---------------------------- 2 files changed, 65 deletions(-) delete mode 100644 fingerprintjs2/fingerprint2-tests.ts delete mode 100644 fingerprintjs2/fingerprint2.d.ts diff --git a/fingerprintjs2/fingerprint2-tests.ts b/fingerprintjs2/fingerprint2-tests.ts deleted file mode 100644 index 7f4baf756d..0000000000 --- a/fingerprintjs2/fingerprint2-tests.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Type definitions for fingerprintjs2 1.0.0-rc3 -// Project: https://github.com/Valve/fingerprintjs2 -// Definitions by: Sam Vloeberghs -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -let f2 = new Fingerprint2.Fingerprint2(); -f2.get((result:string, components:Array) => { - -}); - -let options = {}; -let f2withOptions = new Fingerprint2.Fingerprint2(options); -f2withOptions.get((result:string, components:Array) => { - -}); diff --git a/fingerprintjs2/fingerprint2.d.ts b/fingerprintjs2/fingerprint2.d.ts deleted file mode 100644 index 87150da3dd..0000000000 --- a/fingerprintjs2/fingerprint2.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -// Type definitions for fingerprintjs2 1.0.0-rc3 -// Project: https://github.com/Valve/fingerprintjs2 -// Definitions by: Sam Vloeberghs -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module Fingerprint2Js { - - interface Fingerprint2Static { - new(option?:Fingerprint2Option): Fingerprint2; - } - - interface Fingerprint2 { - get(func:(result:string, components:Array) => void): void; - } - - interface Fingerprint2Option { - swfContainerId?: string; - swfPath?: string; - excludeUserAgent?: boolean; - excludeLanguage?: boolean; - excludeColorDepth?: boolean; - excludeScreenResolution?: boolean; - excludeTimezoneOffset?: boolean; - excludeSessionStorage?: boolean; - excludeIndexedDB?: boolean; - excludeAddBehavior?: boolean; - excludeOpenDatabase?: boolean; - excludeCpuClass?: boolean; - excludePlatform?: boolean; - excludeDoNotTrack?: boolean; - excludeCanvas?: boolean; - excludeWebGL?: boolean; - excludeAdBlock?: boolean; - excludeHasLiedLanguages?: boolean; - excludeHasLiedResolution?: boolean; - excludeHasLiedOs?: boolean; - excludeHasLiedBrowser?: boolean; - excludeJsFonts?: boolean; - excludeFlashFonts?: boolean; - excludePlugins?: boolean; - excludeTouchSupport?: boolean; - } - -} - -declare var Fingerprint2:Fingerprint2Js.Fingerprint2Static; - -declare module "Fingerprint2" { - export = Fingerprint2; -} From 98b769b9e1703fd794bf885c4061b2b4115be205 Mon Sep 17 00:00:00 2001 From: sean Date: Tue, 5 Jan 2016 23:46:04 -0800 Subject: [PATCH 245/441] Fix issue with es6 style import --- .../applicationinsights-tests.ts | 2 +- applicationinsights/applicationinsights.d.ts | 32 +++++++------------ 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/applicationinsights/applicationinsights-tests.ts b/applicationinsights/applicationinsights-tests.ts index 2a4613b019..eb9d5e7019 100644 --- a/applicationinsights/applicationinsights-tests.ts +++ b/applicationinsights/applicationinsights-tests.ts @@ -1,5 +1,5 @@ /// -import appInsights = require("applicationinsights"); +import * as appInsights from "applicationinsights"; // basic use appInsights.setup("").start(); diff --git a/applicationinsights/applicationinsights.d.ts b/applicationinsights/applicationinsights.d.ts index f5ea9d4134..d5c895466d 100644 --- a/applicationinsights/applicationinsights.d.ts +++ b/applicationinsights/applicationinsights.d.ts @@ -409,66 +409,58 @@ interface Sender { * The singleton meta interface for the default client of the client. This interface is used to setup/start and configure * the auto-collection behavior of the application insights module. */ -declare class ApplicationInsights { - static client: Client; - private static _isConsole; - private static _isExceptions; - private static _isPerformance; - private static _isRequests; - private static _console; - private static _exceptions; - private static _performance; - private static _requests; - private static _isStarted; +interface ApplicationInsights { + client: Client; /** * Initializes a client with the given instrumentation key, if this is not specified, the value will be * read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY * @returns {ApplicationInsights/Client} a new client */ - static getClient(instrumentationKey?: string): Client; + getClient(instrumentationKey?: string): Client; /** * Initializes the default client of the client and sets the default configuration * @param instrumentationKey the instrumentation key to use. Optional, if this is not specified, the value will be * read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY * @returns {ApplicationInsights} this interface */ - static setup(instrumentationKey?: string): typeof ApplicationInsights; + setup(instrumentationKey?: string): ApplicationInsights; /** * Starts automatic collection of telemetry. Prior to calling start no telemetry will be collected * @returns {ApplicationInsights} this interface */ - static start(): typeof ApplicationInsights; + start(): ApplicationInsights; /** * Sets the state of console tracking (enabled by default) * @param value if true console activity will be sent to Application Insights * @returns {ApplicationInsights} this interface */ - static setAutoCollectConsole(value: boolean): typeof ApplicationInsights; + setAutoCollectConsole(value: boolean): ApplicationInsights; /** * Sets the state of exception tracking (enabled by default) * @param value if true uncaught exceptions will be sent to Application Insights * @returns {ApplicationInsights} this interface */ - static setAutoCollectExceptions(value: boolean): typeof ApplicationInsights; + setAutoCollectExceptions(value: boolean): ApplicationInsights; /** * Sets the state of performance tracking (enabled by default) * @param value if true performance counters will be collected every second and sent to Application Insights * @returns {ApplicationInsights} this interface */ - static setAutoCollectPerformance(value: boolean): typeof ApplicationInsights; + setAutoCollectPerformance(value: boolean): ApplicationInsights; /** * Sets the state of request tracking (enabled by default) * @param value if true requests will be sent to Application Insights * @returns {ApplicationInsights} this interface */ - static setAutoCollectRequests(value: boolean): typeof ApplicationInsights; + setAutoCollectRequests(value: boolean): ApplicationInsights; /** * Enables verbose debug logging * @returns {ApplicationInsights} this interface */ - static enableVerboseLogging(): typeof ApplicationInsights; + enableVerboseLogging(): ApplicationInsights; } declare module "applicationinsights" { - export = ApplicationInsights; + const applicationinsights: ApplicationInsights; + export = applicationinsights; } \ No newline at end of file From 86ce8c127d901e6053c43c329b23364537d9ad84 Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Wed, 6 Jan 2016 09:30:21 +0100 Subject: [PATCH 246/441] restored contributors --- CONTRIBUTORS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 97109dad87..e9d91ae109 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -399,7 +399,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](forge-di/forge-di.d.ts) [forge-di](https://github.com/nkohari/forge) by [Adam Carr](https://github.com/adamcarr) * [:link:](form-data/form-data.d.ts) [form-data](https://github.com/felixge/node-form-data) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](formidable/formidable.d.ts) [Formidable](https://github.com/felixge/node-formidable) by [Wim Looman](https://github.com/Nemo157) -* [:link:](foundation/foundation-sites.d.ts) [Foundation](http://foundation.zurb.com) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](foundation/foundation.d.ts) [Foundation](http://foundation.zurb.com) by [Boris Yankov](https://github.com/borisyankov) * [:link:](fpsmeter/FPSMeter.d.ts) [FPSmeter](http://darsa.in/fpsmeter) by [Aaron Lampros](http://github.com/alampros) * [:link:](freedom/freedom-core-env.d.ts) [freedom](https://github.com/freedomjs/freedom) by [Jonathan Pevarnek](https://github.com/jpevarnek) * [:link:](freedom/freedom-module-env.d.ts) [freedom](https://github.com/freedomjs/freedom) by [Jonathan Pevarnek](https://github.com/jpevarnek) From 8b4d6c1a6faf46fe92abefed8ee92956e26a7587 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 6 Jan 2016 19:46:08 +0500 Subject: [PATCH 247/441] lodash: signatures of _.isError have been changed --- lodash/lodash-tests.ts | 52 +++++++++++++++++++++++++++++++++--------- lodash/lodash.d.ts | 8 +++++++ 2 files changed, 49 insertions(+), 11 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2b..cf7c65a0a8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5906,17 +5906,47 @@ module TestIsEqual { } // _.isError -result = _.isError(any); -result = _(1).isError(); -result = _([]).isError(); -result = _({}).isError(); -{ - let value: Error|string = "error"; - if (_.isError(value)) { - let message: string = value.message; - } else { - let message: string = value; - } +module TestIsError { + { + let value: number|Error; + + if (_.isError(value)) { + let result: Error = value; + } + else { + let result: number = value; + } + } + + { + class CustomError extends Error {} + + let value: number|CustomError; + + if (_.isError(value)) { + let result: CustomError = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isError(any); + result = _(1).isError(); + result = _([]).isError(); + result = _({}).isError(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isError(); + result = _([]).chain().isError(); + result = _({}).chain().isError(); + } } // _.isFinite diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c45ec90eea..aec233285d 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9911,6 +9911,7 @@ declare module _ { /** * Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError * object. + * * @param value The value to check. * @return Returns true if value is an error object, else false. */ @@ -9924,6 +9925,13 @@ declare module _ { isError(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.isError + */ + isError(): LoDashExplicitWrapper; + } + //_.isFinite interface LoDashStatic { /** From 68186adc6dd28d6eec93bfb10cb693c69d33948c Mon Sep 17 00:00:00 2001 From: William Comartin Date: Wed, 6 Jan 2016 09:54:28 -0500 Subject: [PATCH 248/441] Leaflet-Fullscreen make Options optional --- leaflet-fullscreen/leaflet-fullscreen.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/leaflet-fullscreen/leaflet-fullscreen.d.ts b/leaflet-fullscreen/leaflet-fullscreen.d.ts index 8941a76e5b..ea955bf41e 100644 --- a/leaflet-fullscreen/leaflet-fullscreen.d.ts +++ b/leaflet-fullscreen/leaflet-fullscreen.d.ts @@ -12,11 +12,11 @@ declare module L { export interface Fullscreen extends L.Control {} export interface FullscreenOptions { - position: string, - title: string, - titleCancel: string, - forceSeparateButton: boolean, - forcePseudoFullscreen: boolean + position?: string, + title?: string, + titleCancel?: string, + forceSeparateButton?: boolean, + forcePseudoFullscreen?: boolean } } From 2961bf02f1ac6eb8b0341664a01f484f25a4fef1 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 16:22:15 +0100 Subject: [PATCH 249/441] Add Options interface to the namespace --- gulp-minify-html/gulp-minify-html-tests.ts | 2 +- gulp-minify-html/gulp-minify-html.d.ts | 36 +++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/gulp-minify-html/gulp-minify-html-tests.ts b/gulp-minify-html/gulp-minify-html-tests.ts index 2ec41e556a..556ee203bb 100644 --- a/gulp-minify-html/gulp-minify-html-tests.ts +++ b/gulp-minify-html/gulp-minify-html-tests.ts @@ -8,7 +8,7 @@ minifyHtml(); minifyHtml({conditionals: true, loose: true}); gulp.task('minify-html', () => { - var opts = { + var opts: minifyHtml.Options = { conditionals: true, spare: true }; diff --git a/gulp-minify-html/gulp-minify-html.d.ts b/gulp-minify-html/gulp-minify-html.d.ts index 11ce298a49..321a569256 100644 --- a/gulp-minify-html/gulp-minify-html.d.ts +++ b/gulp-minify-html/gulp-minify-html.d.ts @@ -6,32 +6,32 @@ /// declare module 'gulp-minify-html' { - interface IOptions { - // Do not remove empty attributes - empty?: boolean; + namespace minifyHtml { + interface Options { + // Do not remove empty attributes + empty?: boolean; - // Do not strip CDATA from scripts - cdata?: boolean; + // Do not strip CDATA from scripts + cdata?: boolean; - // Do not remove comments - comments?: boolean; + // Do not remove comments + comments?: boolean; - // Do not remove conditional internet explorer comments - conditionals?: boolean; + // Do not remove conditional internet explorer comments + conditionals?: boolean; - // Do not remove redundant attributes - spare?: boolean; + // Do not remove redundant attributes + spare?: boolean; - // Do not remove arbitrary quotes - quotes?: boolean; + // Do not remove arbitrary quotes + quotes?: boolean; - // Preserve one whitespace - loose?: boolean; + // Preserve one whitespace + loose?: boolean; + } } - function minifyHtml(options?: IOptions): NodeJS.ReadWriteStream; - - namespace minifyHtml {} + function minifyHtml(options?: minifyHtml.Options): NodeJS.ReadWriteStream; export = minifyHtml; } From d8851289004ecdc1137f2efc8e437c9c867cb705 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 6 Jan 2016 16:32:56 +0100 Subject: [PATCH 250/441] updates from adopting for vscode --- github-electron/github-electron.d.ts | 151 +++++++++++++++++---------- 1 file changed, 93 insertions(+), 58 deletions(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index b1df3bccce..df04e62711 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -5,7 +5,7 @@ /// -declare module GitHubElectron { +declare module Electron { /** * This class is used to represent an image. */ @@ -64,6 +64,34 @@ declare module GitHubElectron { function writeImage(image: NativeImage, type?: string): void; } + interface Display { + id:number; + bounds:Bounds; + workArea:Bounds; + size:Dimension; + workAreaSize:Dimension; + scaleFactor:number; + rotation:number; + touchSupport:string; + } + + interface Bounds { + x:number; + y:number; + width:number; + height:number; + } + + interface Dimension { + width:number; + height:number; + } + + interface Point { + x:number; + y:number; + } + class Screen implements NodeJS.EventEmitter { addListener(event: string, listener: Function): Screen; on(event: string, listener: Function): Screen; @@ -78,26 +106,23 @@ declare module GitHubElectron { /** * @returns The current absolute position of the mouse pointer. */ - getCursorScreenPoint(): any; + getCursorScreenPoint(): Point; /** * @returns The primary display. */ - getPrimaryDisplay(): any; + getPrimaryDisplay(): Display; /** * @returns An array of displays that are currently available. */ - getAllDisplays(): any[]; + getAllDisplays(): Display[]; /** * @returns The display nearest the specified point. */ - getDisplayNearestPoint(point: { - x: number; - y: number; - }): any; + getDisplayNearestPoint(point: Point): Display; /** * @returns The display that most closely intersects the provided bounds. */ - getDisplayMatching(rect: Rectangle): any; + getDisplayMatching(rect: Rectangle): Display; } /** @@ -508,6 +533,7 @@ declare module GitHubElectron { subpixelFontScaling?: boolean; overlayFullscreenVideo?: boolean; titleBarStyle?: string; + backgroundColor?: string; } interface Rectangle { @@ -750,6 +776,10 @@ declare module GitHubElectron { * Returns whether the developer tools are opened. */ isDevToolsOpened(): boolean; + /** + * Returns whether the developer tools are focussed. + */ + isDevToolsFocused(): boolean; /** * Toggle the developer tools. */ @@ -884,7 +914,7 @@ declare module GitHubElectron { * Should be specified for submenu type menu item, when it's specified the * type: 'submenu' can be omitted for the menu item */ - submenu?: MenuItemOptions[]; + submenu?: Menu; /** * Unique within a single menu. If defined then it can be used as a reference * to this item by the position attribute. @@ -1022,6 +1052,7 @@ declare module GitHubElectron { * of your app is running, and other instances signal this instance and exit. */ makeSingleInstance(callback: (args: string[], workingDirectory: string) => boolean): boolean; + setAppUserModelId(id: string): void; } interface CommandLine { @@ -1057,7 +1088,7 @@ declare module GitHubElectron { /** * Description of this task. */ - description: string; + description?: string; /** * The absolute path to an icon to be displayed in a JumpList, it can be * arbitrary resource file that contains an icon, usually you can specify @@ -1069,9 +1100,9 @@ declare module GitHubElectron { * icons, set this value to identify the icon. If an icon file consists of * one icon, this value is 0. */ - iconIndex: number; - commandLine: CommandLine; - dock: { + iconIndex?: number; + commandLine?: CommandLine; + dock?: { /** * When critical is passed, the dock icon will bounce until either the * application becomes active or the request is canceled. @@ -1180,6 +1211,19 @@ declare module GitHubElectron { properties?: string|string[]; } + interface SaveDialogOptions { + title?: string; + defaultPath?: string; + /** + * File types that can be displayed, see dialog.showOpenDialog for an example. + */ + + filters?: { + name: string; + extensions: string[]; + }[] + } + /** * @param browserWindow * @param options @@ -1187,18 +1231,7 @@ declare module GitHubElectron { * @returns On success, returns the path of file chosen by the user, otherwise * returns undefined. */ - export function showSaveDialog(browserWindow?: BrowserWindow, options?: { - title?: string; - defaultPath?: string; - /** - * File types that can be displayed, see dialog.showOpenDialog for an example. - */ - - filters?: { - name: string; - extensions: string[]; - }[] - }, callback?: (fileName: string) => void): string; + export function showSaveDialog(browserWindow?: BrowserWindow, options?: SaveDialogOptions, callback?: (fileName: string) => void): string; /** * Shows a message box. It will block until the message box is closed. It returns . @@ -1237,6 +1270,8 @@ declare module GitHubElectron { */ detail?: string; icon?: NativeImage; + noLink?: boolean; + cancelId?: number; } } @@ -1308,11 +1343,11 @@ declare module GitHubElectron { /** * @returns The contents of the clipboard as a NativeImage. */ - readImage: typeof GitHubElectron.Clipboard.readImage; + readImage: typeof Electron.Clipboard.readImage; /** * Writes the image into the clipboard. */ - writeImage: typeof GitHubElectron.Clipboard.writeImage; + writeImage: typeof Electron.Clipboard.writeImage; /** * Clears everything in clipboard. */ @@ -1631,19 +1666,19 @@ declare module GitHubElectron { * @returns On success, returns an array of file paths chosen by the user, * otherwise returns undefined. */ - showOpenDialog: typeof GitHubElectron.Dialog.showOpenDialog; + showOpenDialog: typeof Electron.Dialog.showOpenDialog; /** * @param callback If supplied, the API call will be asynchronous. * @returns On success, returns the path of file chosen by the user, otherwise * returns undefined. */ - showSaveDialog: typeof GitHubElectron.Dialog.showSaveDialog; + showSaveDialog: typeof Electron.Dialog.showSaveDialog; /** * Shows a message box. It will block until the message box is closed. It returns . * @param callback If supplied, the API call will be asynchronous. * @returns The index of the clicked button. */ - showMessageBox: typeof GitHubElectron.Dialog.showMessageBox; + showMessageBox: typeof Electron.Dialog.showMessageBox; /** * Runs a modal dialog that shows an error message. This API can be called safely @@ -1773,26 +1808,26 @@ declare module GitHubElectron { } interface CommonElectron { - clipboard: GitHubElectron.Clipboard; - crashReporter: GitHubElectron.CrashReporter; - nativeImage: typeof GitHubElectron.NativeImage; - shell: GitHubElectron.Shell; + clipboard: Electron.Clipboard; + crashReporter: Electron.CrashReporter; + nativeImage: typeof Electron.NativeImage; + shell: Electron.Shell; - app: GitHubElectron.App; - autoUpdater: GitHubElectron.AutoUpdater; - BrowserWindow: typeof GitHubElectron.BrowserWindow; - contentTracing: GitHubElectron.ContentTracing; - dialog: GitHubElectron.Dialog; - ipcMain: GitHubElectron.IPCMain; - globalShortcut: GitHubElectron.GlobalShortcut; - Menu: typeof GitHubElectron.Menu; - MenuItem: typeof GitHubElectron.MenuItem; + app: Electron.App; + autoUpdater: Electron.AutoUpdater; + BrowserWindow: typeof Electron.BrowserWindow; + contentTracing: Electron.ContentTracing; + dialog: Electron.Dialog; + ipcMain: Electron.IPCMain; + globalShortcut: Electron.GlobalShortcut; + Menu: typeof Electron.Menu; + MenuItem: typeof Electron.MenuItem; powerMonitor: NodeJS.EventEmitter; - powerSaveBlocker: GitHubElectron.PowerSaveBlocker; - protocol: GitHubElectron.Protocol; - screen: GitHubElectron.Screen; - session: GitHubElectron.Session; - Tray: typeof GitHubElectron.Tray; + powerSaveBlocker: Electron.PowerSaveBlocker; + protocol: Electron.Protocol; + screen: Electron.Screen; + session: Electron.Session; + Tray: typeof Electron.Tray; hideInternalModules(): void; } @@ -1814,11 +1849,11 @@ declare module GitHubElectron { getSources(options: any, callback: (error: Error, sources: DesktopCapturerSource[]) => any): void; } - interface Electron extends CommonElectron { - desktopCapturer: GitHubElectron.DesktopCapturer; - ipcRenderer: GitHubElectron.IpcRenderer; - remote: GitHubElectron.Remote; - webFrame: GitHubElectron.WebFrame; + interface ElectronMainAndRenderer extends CommonElectron { + desktopCapturer: Electron.DesktopCapturer; + ipcRenderer: Electron.IpcRenderer; + remote: Electron.Remote; + webFrame: Electron.WebFrame; } } @@ -1827,7 +1862,7 @@ interface Window { * Creates a new window. * @returns An instance of BrowserWindowProxy class. */ - open(url: string, frameName?: string, features?: string): GitHubElectron.BrowserWindowProxy; + open(url: string, frameName?: string, features?: string): Electron.BrowserWindowProxy; } interface File { @@ -1838,10 +1873,10 @@ interface File { } declare module 'electron' { - var electron: GitHubElectron.Electron; + var electron: Electron.ElectronMainAndRenderer; export = electron; } interface NodeRequireFunction { - (id: 'electron'): GitHubElectron.Electron; -} + (moduleName: 'electron'): Electron.ElectronMainAndRenderer; +} \ No newline at end of file From 51b587292f2ba85d68939d9c59cf7fa745a6173e Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 16:35:43 +0100 Subject: [PATCH 251/441] Add definitions for UglifyJS 2 (https://github.com/mishoo/UglifyJS2) --- uglify-js/uglify-js-tests.ts | 73 ++++++ uglify-js/uglify-js.d.ts | 430 +++++++++++++++++++++++++++++++++++ 2 files changed, 503 insertions(+) create mode 100644 uglify-js/uglify-js-tests.ts create mode 100644 uglify-js/uglify-js.d.ts diff --git a/uglify-js/uglify-js-tests.ts b/uglify-js/uglify-js-tests.ts new file mode 100644 index 0000000000..23b935dec2 --- /dev/null +++ b/uglify-js/uglify-js-tests.ts @@ -0,0 +1,73 @@ +/// +/// + +import * as UglifyJS from 'uglify-js'; +import * as fs from 'fs'; + +var result = UglifyJS.minify("/path/to/file.js"); +console.log(result.code); // minified output +// if you need to pass code instead of file name +var result = UglifyJS.minify("var b = function () {};", {fromString: true}); + +var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ]); +console.log(result.code); + +var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], { + outSourceMap: "out.js.map" +}); +console.log(result.code); // minified output +console.log(result.map); + +var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], { + outSourceMap: "out.js.map", + sourceRoot: "http://example.com/src" +}); + +var result = UglifyJS.minify("compiled.js", { + inSourceMap: "compiled.js.map", + outSourceMap: "minified.js.map" +}); +// same as before, it returns `code` and `map` + +const my_source_map_string = 'sourceMap'; +var result = UglifyJS.minify("compiled.js", { + inSourceMap: JSON.parse(my_source_map_string), + outSourceMap: "minified.js.map" +}); + +var toplevel_ast = UglifyJS.parse(code, {}); + +var toplevel: UglifyJS.AST_Toplevel = null; +const files = ['file1', 'file2']; +files.forEach(function(file){ + var code = fs.readFileSync(file, "utf8"); + toplevel = UglifyJS.parse(code, { + filename: file, + toplevel: toplevel + }); +}); + +toplevel.figure_out_scope() + +var compressor = UglifyJS.Compressor({}); +var compressed_ast = toplevel.transform(compressor); + +compressed_ast.figure_out_scope(); +compressed_ast.compute_char_frequency(); +compressed_ast.mangle_names(); + +var stream = UglifyJS.OutputStream({}); +compressed_ast.print(stream); +var code = stream.toString(); // this is your minified code + +var code = compressed_ast.print_to_string({}); + +var source_map = UglifyJS.SourceMap({}); +var stream = UglifyJS.OutputStream({ + //... + source_map: source_map +}); +compressed_ast.print(stream); + +var code = stream.toString(); +var map = source_map.toString(); // json output for your source map diff --git a/uglify-js/uglify-js.d.ts b/uglify-js/uglify-js.d.ts new file mode 100644 index 0000000000..b9c22bc6ed --- /dev/null +++ b/uglify-js/uglify-js.d.ts @@ -0,0 +1,430 @@ +// Type definitions for UglifyJS 2 v2.6.1 +// Project: https://github.com/mishoo/UglifyJS2 +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'uglify-js' { + import * as MOZ_SourceMap from 'source-map'; + + namespace UglifyJS { + interface Tokenizer { + /** + * The type of this token. + * Can be "num", "string", "regexp", "operator", "punc", "atom", "name", "keyword", "comment1" or "comment2". + * "comment1" and "comment2" are for single-line, respectively multi-line comments. + */ + type: string; + + /** + * The name of the file where this token originated from. Useful when compressing multiple files at once to generate the proper source map. + */ + file: string; + + /** + * The "value" of the token. + * That's additional information and depends on the token type: "num", "string" and "regexp" tokens you get their literal value. + * - For "operator" you get the operator. + * - For "punc" it's the punctuation sign (parens, comma, semicolon etc). + * - For "atom", "name" and "keyword" it's the name of the identifier + * - For comments it's the body of the comment (excluding the initial "//" and "/*". + */ + value: string; + + /** + * The line number of this token in the original code. + * 1-based index. + */ + line: number; + + /** + * The column number of this token in the original code. + * 0-based index. + */ + col: number; + + /** + * Short for "newline before", it's a boolean that tells us whether there was a newline before this node in the original source. It helps for automatic semicolon insertion. + * For multi-line comments in particular this will be set to true if there either was a newline before this comment, or * * if this comment contains a newline. + */ + nlb: boolean; + + /** + * This doesn't apply for comment tokens, but for all other token types it will be an array of comment tokens that were found before. + */ + comments_before: string[]; + } + + interface AST_Node { + // The first token of this node + start: AST_Node; + + // The last token of this node + end: AST_Node; + + transform(tt: TreeTransformer): AST_Toplevel; + } + + interface AST_Toplevel extends AST_Node { + // UglifyJS contains a scope analyzer which figures out variable/function definitions, references etc. + // You need to call it manually before compression or mangling. + // The figure_out_scope method is defined only on the AST_Toplevel node. + figure_out_scope(): void; + + // Get names that are optimized for GZip compression (names will be generated using the most frequent characters first) + compute_char_frequency(): void; + + mangle_names(): void; + + print(stream: OutputStream): void; + + print_to_string(options?: BeautifierOptions): string; + } + + interface MinifyOptions { + spidermonkey?: boolean; + outSourceMap?: string; + sourceRoot?: string; + inSourceMap?: string; + fromString?: boolean; + warnings?: boolean; + mangle?: Object; + output?: MinifyOutput, + compress?: Object; + } + + interface MinifyOutput { + code: string; + map: string; + } + + function minify(files: string | Array, options?: MinifyOptions): MinifyOutput; + + + interface ParseOptions { + // Default is false + strict?: boolean; + + // Input file name, default is null + filename?: string; + + // Default is null + toplevel?: AST_Toplevel; + } + + /** + * The parser creates a custom abstract syntax tree given a piece of JavaScript code. + * Perhaps you should read about the AST first. + */ + function parse(code: string, options?: ParseOptions): AST_Toplevel; + + + interface BeautifierOptions { + /** + * Start indentation on every line (only when `beautify`) + */ + indent_start?: number; + + /** + * Indentation level (only when `beautify`) + */ + indent_level?: number; + + /** + * Quote all keys in object literals? + */ + quote_keys?: boolean; + + /** + * Add a space after colon signs? + */ + space_colon?: boolean; + + /** + * Output ASCII-safe? (encodes Unicode characters as ASCII) + */ + ascii_only?: boolean; + + /** + * Escape " boolean; + + /** + * UglifyJS provides a TreeWalker object and every node has a walk method that given a walker will apply your visitor to each node in the tree. + * Your visitor can return a non-falsy value in order to prevent descending the current node. + */ + function TreeWalker(visitor: visitor): TreeWalker; + + + // TODO + interface TreeTransformer extends TreeWalker { + } + + /** + * The tree transformer is a special case of a tree walker. + * In fact it even inherits from TreeWalker and you can use the same methods, but initialization and visitor protocol are a bit different. + */ + function TreeTransformer(before: visitor, after: visitor): TreeTransformer; + } + + export = UglifyJS; +} From ba956a3e6e8ebb82d33548209f793234efac44a2 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 16:36:37 +0100 Subject: [PATCH 252/441] gulp-uglify now uses uglify-js --- gulp-uglify/gulp-uglify-tests.ts | 8 +- gulp-uglify/gulp-uglify.d.ts | 183 +++++-------------------------- 2 files changed, 29 insertions(+), 162 deletions(-) diff --git a/gulp-uglify/gulp-uglify-tests.ts b/gulp-uglify/gulp-uglify-tests.ts index e4f1f0d8a0..01cfb06f9e 100644 --- a/gulp-uglify/gulp-uglify-tests.ts +++ b/gulp-uglify/gulp-uglify-tests.ts @@ -1,8 +1,8 @@ -/// +/// /// -import gulp = require("gulp"); -import uglify = require("gulp-uglify"); +import * as gulp from 'gulp'; +import * as uglify from 'gulp-uglify'; gulp.task('compress', function() { var tsResult = gulp.src('lib/*.ts') @@ -21,4 +21,4 @@ gulp.task('compress2', function() { } })) .pipe(gulp.dest('dist')); -}); \ No newline at end of file +}); diff --git a/gulp-uglify/gulp-uglify.d.ts b/gulp-uglify/gulp-uglify.d.ts index 05eb937ed3..b070f3f356 100644 --- a/gulp-uglify/gulp-uglify.d.ts +++ b/gulp-uglify/gulp-uglify.d.ts @@ -4,172 +4,39 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// declare module "gulp-uglify" { - function GulpUglify(options?: IGulpUglifyOptions): NodeJS.ReadWriteStream; + import * as UglifyJS from 'uglify-js'; - interface IGulpUglifyOptions { - /** - * Pass false to skip mangling names. - */ - mangle?: boolean; + namespace GulpUglify { + interface Options { + /** + * Pass false to skip mangling names. + */ + mangle?: boolean; - /** - * Pass if you wish to specify additional output options. The defaults are optimized for best compression. - */ - output?: IOutputOptions; + /** + * Pass if you wish to specify additional output options. The defaults are optimized for best compression. + */ + output?: UglifyJS.BeautifierOptions; - /** - * Pass an object to specify custom compressor options. Pass false to skip compression completely. - */ - compress?: boolean; + /** + * Pass an object to specify custom compressor options. Pass false to skip compression completely. + */ + compress?: UglifyJS.CompressorOptions | boolean; - /** - * A convenience option for options.output.comments. Defaults to preserving no comments. - * all - Preserve all comments in code blocks - * some - Preserve comments that start with a bang (!) or include a Closure Compiler directive (@preserve, @license, @cc_on) - * function - Specify your own comment preservation function. You will be passed the current node and the current comment and are expected to return either true or false. - */ - preserverComments?: string|((node: any, comment: ITokenizer) => boolean); + /** + * A convenience option for options.output.comments. Defaults to preserving no comments. + * all - Preserve all comments in code blocks + * some - Preserve comments that start with a bang (!) or include a Closure Compiler directive (@preserve, @license, @cc_on) + * function - Specify your own comment preservation function. You will be passed the current node and the current comment and are expected to return either true or false. + */ + preserverComments?: string|((node: any, comment: UglifyJS.Tokenizer) => boolean); + } } - interface IOutputOptions { - /** - * Start indentation on every line (only when `beautify`) - */ - indent_start?: number; + function GulpUglify(options?: GulpUglify.Options): NodeJS.ReadWriteStream; - /** - * Indentation level (only when `beautify`) - */ - indent_level?: number; - - /** - * Quote all keys in object literals? - */ - quote_keys?: boolean; - - /** - * Add a space after colon signs? - */ - space_colon?: boolean; - - /** - * Output ASCII-safe? (encodes Unicode characters as ASCII) - */ - ascii_only?: boolean; - - /** - * Escape " Date: Wed, 6 Jan 2016 16:37:25 +0100 Subject: [PATCH 253/441] webpack now uses uglify-js --- webpack/webpack.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webpack/webpack.d.ts b/webpack/webpack.d.ts index 5bf5050b82..be4c22328e 100644 --- a/webpack/webpack.d.ts +++ b/webpack/webpack.d.ts @@ -3,7 +3,11 @@ // Definitions by: Qubo // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module "webpack" { + import * as UglifyJS from 'uglify-js'; + namespace webpack { interface Configuration { context?: string; @@ -426,7 +430,7 @@ declare module "webpack" { new(preferEntry: boolean): Plugin; } interface UglifyJsPluginStatic { - new(options?: any): Plugin; + new(options?: UglifyJS.MinifyOptions): Plugin; } interface CommonsChunkPluginStatic { new(chunkName: string, filenames?: string|string[]): Plugin; From 0009f34a8c5b6c545a0f9fce0c79c4bd18ddcbf7 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 17:13:52 +0100 Subject: [PATCH 254/441] Add definitions for clean-css (https://github.com/jakubpawlowicz/clean-css) --- clean-css/clean-css-tests.ts | 55 ++++++++++++++++++ clean-css/clean-css.d.ts | 109 +++++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 clean-css/clean-css-tests.ts create mode 100644 clean-css/clean-css.d.ts diff --git a/clean-css/clean-css-tests.ts b/clean-css/clean-css-tests.ts new file mode 100644 index 0000000000..ffbb3d1278 --- /dev/null +++ b/clean-css/clean-css-tests.ts @@ -0,0 +1,55 @@ +/// + +import * as CleanCSS from 'clean-css'; + +var source = 'a{font-weight:bold;}'; +var minified = new CleanCSS().minify(source).styles; + +var source = '@import url(http://path/to/remote/styles);'; +new CleanCSS().minify(source, function (error, minified) { + console.log(minified.styles); +}); + +const pathToOutputDirectory = 'path'; + +new CleanCSS({ sourceMap: true, target: pathToOutputDirectory }) + .minify(source, function (error, minified) { + // access minified.sourceMap for SourceMapGenerator object + // see https://github.com/mozilla/source-map/#sourcemapgenerator for more details + // see https://github.com/jakubpawlowicz/clean-css/blob/master/bin/cleancss#L114 on how it's used in clean-css' CLI + console.log(minified.sourceMap); +}); + +const inputSourceMapAsString = 'input'; +new CleanCSS({ sourceMap: inputSourceMapAsString, target: pathToOutputDirectory }) + .minify(source, function (error, minified) { + // access minified.sourceMap to access SourceMapGenerator object + // see https://github.com/mozilla/source-map/#sourcemapgenerator for more details + // see https://github.com/jakubpawlowicz/clean-css/blob/master/bin/cleancss#L114 on how it's used in clean-css' CLI + console.log(minified.sourceMap); +}); + +new CleanCSS({ sourceMap: true, target: pathToOutputDirectory }).minify({ + 'path/to/source/1': { + styles: '...styles...', + sourceMap: '...source-map...' + }, + 'path/to/source/2': { + styles: '...styles...', + sourceMap: '...source-map...' + } +}, function (error, minified) { + // access minified.sourceMap as above + console.log(minified.sourceMap); +}); + +new CleanCSS().minify(['path/to/file/one', 'path/to/file/two']); + +new CleanCSS().minify({ + 'path/to/file/one': { + styles: 'contents of file one' + }, + 'path/to/file/two': { + styles: 'contents of file two' + } +}); diff --git a/clean-css/clean-css.d.ts b/clean-css/clean-css.d.ts new file mode 100644 index 0000000000..25bb2471a5 --- /dev/null +++ b/clean-css/clean-css.d.ts @@ -0,0 +1,109 @@ +// Type definitions for clean-css v3.4.9 +// Project: https://github.com/jakubpawlowicz/clean-css +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'clean-css' { + namespace CleanCSS { + interface Options { + // Set to false to disable advanced optimizations - selector & property merging, reduction, etc. + advanced?: boolean; + + // Set to false to disable aggressive merging of properties. + aggressiveMerging?: boolean; + + // Turns on benchmarking mode measuring time spent on cleaning up (run npm run bench to see example) + benchmark?: boolean; + + // Enables compatibility mode + compatibility?: Object; + + // Set to true to get minification statistics under stats property (see test/custom-test.js for examples) + debug?: boolean; + + // A hash of options for @import inliner, see test/protocol-imports-test.js for examples, or this comment for a proxy use case. + inliner?: Object; + + // Whether to keep line breaks (default is false) + keepBreaks?: boolean; + + // * for keeping all (default), 1 for keeping first one only, 0 for removing all + keepSpecialComments?: string | number; + + // Whether to merge @media at-rules (default is true) + mediaMerging?: boolean; + + // Whether to process @import rules + processImport?: boolean; + + // A list of @import rules, can be ['all'] (default), ['local'], ['remote'], or a blacklisted path e.g. ['!fonts.googleapis.com'] + processImportFrom?: Array; + + // Set to false to skip URL rebasing + rebase?: boolean; + + // Path to resolve relative @import rules and URLs + relativeTo?: string; + + // Set to false to disable restructuring in advanced optimizations + restructuring?: boolean; + + // Path to resolve absolute @import rules and rebase relative URLs + root?: string; + + // Rounding precision; defaults to 2; -1 disables rounding + roundingPrecision?: number; + + // Set to true to enable semantic merging mode which assumes BEM-like content (default is false as it's highly likely this will break your stylesheets - use with caution!) + semanticMerging?: boolean; + + // Set to false to skip shorthand compacting (default is true unless sourceMap is set when it's false) + shorthandCompacting?: boolean; + + // Exposes source map under sourceMap property, e.g. new CleanCSS().minify(source).sourceMap (default is false) If input styles are a product of CSS preprocessor (Less, Sass) an input source map can be passed as a string. + sourceMap?: boolean | string; + + // Set to true to inline sources inside a source map's sourcesContent field (defaults to false) It is also required to process inlined sources from input source maps. + sourceMapInlineSources?: boolean; + + // Path to a folder or an output file to which rebase all URLs + target?: string; + } + + interface Output { + // Optimized output CSS as a string + styles: string; + + // Output source map (if requested with sourceMap option) + sourceMap: string; + + // A list of errors raised + errors: Array; + + // A list of warnings raised + warnings: Array; + + // A hash of statistic information (if requested with debug option) + stats: { + // Original content size (after import inlining) + originalSize: number; + + // Optimized content size + minifiedSize: number; + + // Time spent on optimizations + timeSpent: number; + + // A ratio of output size to input size (e.g. 25% if content was reduced from 100 bytes to 75 bytes) + efficiency: number; + }; + } + } + + class CleanCSS { + constructor(options?: CleanCSS.Options); + minify(sources: string | Array | Object, callback?: (error: any, minified: CleanCSS.Output) => void): CleanCSS.Output; + } + + export = CleanCSS; +} From 0315ce5497991639c891cb3cb6a93abfefa93913 Mon Sep 17 00:00:00 2001 From: Roger Chen Date: Wed, 6 Jan 2016 08:16:37 -0800 Subject: [PATCH 255/441] Remove extra whitespace from react-addons-transition-group --- react/react-addons-transition-group.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/react/react-addons-transition-group.d.ts b/react/react-addons-transition-group.d.ts index 728c52aa8f..9178eb5163 100644 --- a/react/react-addons-transition-group.d.ts +++ b/react/react-addons-transition-group.d.ts @@ -6,14 +6,14 @@ /// declare namespace __React { - + interface TransitionGroupProps { component?: ReactType; childFactory?: (child: ReactElement) => ReactElement; } - + type TransitionGroup = ComponentClass; - + namespace __Addons { export var TransitionGroup: __React.TransitionGroup; } @@ -23,4 +23,4 @@ declare module "react-addons-transition-group" { var TransitionGroup: __React.TransitionGroup; type TransitionGroup = __React.TransitionGroup; export = TransitionGroup; -} \ No newline at end of file +} From 44f1cdb876f56b34b05cb3b1bdea828c0f3e3a4b Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 17:20:26 +0100 Subject: [PATCH 256/441] gulp-minify-css now uses clean-css --- gulp-minify-css/gulp-minify-css-tests.ts | 2 +- gulp-minify-css/gulp-minify-css.d.ts | 22 +++------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/gulp-minify-css/gulp-minify-css-tests.ts b/gulp-minify-css/gulp-minify-css-tests.ts index d8ac4d9dfc..9bfe9697a0 100644 --- a/gulp-minify-css/gulp-minify-css-tests.ts +++ b/gulp-minify-css/gulp-minify-css-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// import * as gulp from "gulp"; diff --git a/gulp-minify-css/gulp-minify-css.d.ts b/gulp-minify-css/gulp-minify-css.d.ts index bc990a6e0e..cb0eea502b 100644 --- a/gulp-minify-css/gulp-minify-css.d.ts +++ b/gulp-minify-css/gulp-minify-css.d.ts @@ -4,28 +4,12 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// declare module "gulp-minify-css" { + import * as CleanCSS from 'clean-css'; - interface IOptions { - cache?: boolean; - advanced?: boolean; - aggressiveMerging?: boolean; - benchmark?: boolean; - compatibility?: string; - debug?: boolean; - inliner?: Object; - keepBreaks?: boolean; - keepSpecialComments?: string | number; - processImport?: boolean; - rebase?: boolean; - relativeTo?: string; - root?: string; - roundingPrecision?: number; - shorthandCompacting?: boolean; - } - - function minifyCSS(options?: IOptions): NodeJS.ReadWriteStream; + function minifyCSS(options?: CleanCSS.Options): NodeJS.ReadWriteStream; namespace minifyCSS {} From 4e802a7747735ba5c5dc855ac366691ae329e9ab Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 17:21:20 +0100 Subject: [PATCH 257/441] Add definitions for relateurl (https://github.com/stevenvachon/relateurl) --- relateurl/relateurl-tests.ts | 20 ++++++ relateurl/relateurl.d.ts | 125 +++++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 relateurl/relateurl-tests.ts create mode 100644 relateurl/relateurl.d.ts diff --git a/relateurl/relateurl-tests.ts b/relateurl/relateurl-tests.ts new file mode 100644 index 0000000000..89a647d06e --- /dev/null +++ b/relateurl/relateurl-tests.ts @@ -0,0 +1,20 @@ +/// + +import * as RelateUrl from 'relateurl'; + +var from = "http://www.domain.com/asdf/"; +var to = "http://www.domain.com/asdf/asdf"; +var to1 = "http://www.domain.com/asdf/asdf1"; +var to2 = "http://www.domain.com/asdf/asdf1"; +var to3 = "http://www.domain.com/asdf/asdf1"; +var options = {site: "http://www.domain.com/asdf2/"}; +var customOptions = {output: RelateUrl.ABSOLUTE}; + +// Single Instance +var result = RelateUrl.relate(from, to, options); + +// Reusable Instances +var instance = new RelateUrl(from, options); +var result1 = instance.relate(to1); +var result2 = instance.relate(to2, customOptions); +var result3 = instance.relate(to3); diff --git a/relateurl/relateurl.d.ts b/relateurl/relateurl.d.ts new file mode 100644 index 0000000000..9f24e59b9e --- /dev/null +++ b/relateurl/relateurl.d.ts @@ -0,0 +1,125 @@ +// Type definitions for relateurl v0.2.6 +// Project: https://github.com/stevenvachon/relateurl +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'relateurl' { + namespace RelateUrl { + interface Options { + /** + * Type: Object + * Default value: {ftp:21, http:80, https:443} + * + * Extend the list with any ports you need. Any URLs containing these default ports will have them removed. Example: http://example.com:80/ will become http://example.com/. + */ + defaultPorts?: Object; + + /** + * Type: Array + * Default value: ["index.html"] + * + * Extend the list with any resources you need. Works with options.removeDirectoryIndexes. + */ + directoryIndexes?: Array; + + /** + * Type: Boolean + * Default value: false + * + * This will, for example, consider any domains containing http://www.example.com/ to be related to any that contain http://example.com/. + */ + ignore_www?: boolean; + + /** + * Type: constant or String + * Choices: RelateUrl.ABSOLUTE,RelateUrl.PATH_RELATIVE,RelateUrl.ROOT_RELATIVE,RelateUrl.SHORTEST + * Choices: "absolute","pathRelative","rootRelative","shortest" + * Default value: RelateUrl.SHORTEST + * + * RelateUrl.ABSOLUTE will produce an absolute URL. Overrides options.schemeRelative with a value of false. + * RelateUrl.PATH_RELATIVE will produce something like ../child-of-parent/etc/. + * RelateUrl.ROOT_RELATIVE will produce something like /child-of-root/etc/. + * RelateUrl.SHORTEST will choose whichever is shortest between root- and path-relative. + */ + output?: string; + + /** + * Type: Array + * Default value: ["data","javascript","mailto"] + * + * Extend the list with any additional schemes. Example: javascript:something will not be modified. + */ + rejectedSchemes?: Array; + + /** + * Type: Boolean + * Default value: false + * + * Remove user authentication information from the output URL. + */ + removeAuth?: boolean; + + /** + * Type: Boolean + * Default value: true + * + * Remove any resources that match any found in options.directoryIndexes. + */ + removeDirectoryIndexes?: boolean; + + /** + * Type: Boolean + * Default value: false + * + * Remove empty query variables. Example: http://domain.com/?var1&var2=&var3=asdf will become http://domain.com/?var3=adsf. This does not apply to unrelated URLs (with other protocols, auths, hosts and/or ports). + */ + removeEmptyQueries?: boolean; + + /** + * Type: Boolean + * Default value: true + * + * Remove trailing slashes from root paths. Example: http://domain.com/?var will become http://domain.com?var while http://domain.com/dir/?var will not be modified. + */ + removeRootTrailingSlash?: boolean; + + /** + * Type: Boolean + * Default value: true + * + * Output URLs relative to the scheme. Example: http://example.com/ will become //example.com/. + */ + schemeRelative?: boolean; + + /** + * Type: String + * Default value: undefined + * + * An options-based version of the from argument. If both are specified, from takes priority. + */ + site?: string; + + /** + * Type: Boolean + * Default value: true + * + * Passed to Node's url.parse. + */ + slashesDenoteHost?: boolean; + } + } + + class RelateUrl { + static ABSOLUTE: string; + static PATH_RELATIVE: string; + static ROOT_RELATIVE: string; + static SHORTEST: string; + + static relate(from: string, to: string, options?: RelateUrl.Options): string; + + constructor(from: string, options?: RelateUrl.Options); + relate(to: string, options?: RelateUrl.Options): string; + } + + export = RelateUrl; +} From 3051b93e44c76235a5df0902371cdbf748e4f284 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 17:22:22 +0100 Subject: [PATCH 258/441] Add definitions for HTMLMinifier (https://github.com/kangax/html-minifier) --- html-minifier/html-minifier-tests.ts | 9 +++ html-minifier/html-minifier.d.ts | 115 +++++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 html-minifier/html-minifier-tests.ts create mode 100644 html-minifier/html-minifier.d.ts diff --git a/html-minifier/html-minifier-tests.ts b/html-minifier/html-minifier-tests.ts new file mode 100644 index 0000000000..b02ecea199 --- /dev/null +++ b/html-minifier/html-minifier-tests.ts @@ -0,0 +1,9 @@ +/// + +import * as HTMLMinifier from 'html-minifier'; +const minify = HTMLMinifier.minify; + +var result = minify('

      foo

      ', { + removeAttributeQuotes: true +}); +result; // '

      foo

      ' diff --git a/html-minifier/html-minifier.d.ts b/html-minifier/html-minifier.d.ts new file mode 100644 index 0000000000..9557de8902 --- /dev/null +++ b/html-minifier/html-minifier.d.ts @@ -0,0 +1,115 @@ +// Type definitions for HTMLMinifier v1.1.1 +// Project: https://github.com/kangax/html-minifier +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// +/// + +declare module 'html-minifier' { + import * as UglifyJS from 'uglify-js'; + import * as CleanCSS from 'clean-css'; + import * as RelateUrl from 'relateurl'; + + namespace HTMLMinifier { + function minify(text: string, options?: Options): string; + + interface Options { + // Strip HTML comments + removeComments?: boolean; + + // Strip HTML comments from scripts and styles + removeCommentsFromCDATA?: boolean; + + // Remove CDATA sections from script and style elements + removeCDATASectionsFromCDATA?: boolean; + + // Collapse white space that contributes to text nodes in a document tree + collapseWhitespace?: boolean; + + // Always collapse to 1 space (never remove it entirely). Must be used in conjunction with collapseWhitespace=true + conservativeCollapse?: boolean; + + // Don't leave any spaces between display:inline; elements when collapsing. Must be used in conjunction with collapseWhitespace=true + collapseInlineTagWhitespace?: boolean; + + // Always collapse to 1 line break (never remove it entirely) when whitespace between tags include a line break. Must be used in conjunction with collapseWhitespace=true + preserveLineBreaks?: boolean; + + // Omit attribute values from boolean attributes + collapseBooleanAttributes?: boolean; + + // Remove quotes around attributes when possible + removeAttributeQuotes?: boolean; + + // Remove attributes when value matches default + removeRedundantAttributes?: boolean; + + // Prevents the escaping of the values of attributes. + preventAttributesEscaping?: boolean; + + // Replaces the doctype with the short (HTML5) doctype + useShortDoctype?: boolean; + + // Remove all attributes with whitespace-only values + removeEmptyAttributes?: boolean; + + // Remove type="text/javascript" from script tags. Other type attribute values are left intact. + removeScriptTypeAttributes?: boolean; + + // Remove type="text/css" from style and link tags. Other type attribute values are left intact. + removeStyleLinkTypeAttributes?: boolean; + + // Remove unrequired tags + removeOptionalTags?: boolean; + + // Remove all elements with empty contents + removeEmptyElements?: boolean; + + // Toggle linting + lint?: boolean; + + // Keep the trailing slash on singleton elements + keepClosingSlash?: boolean; + + // Treat attributes in case sensitive manner (useful for custom HTML tags.) + caseSensitive?: boolean; + + // Minify Javascript in script elements and on* attributes (uses UglifyJS) + minifyJS?: boolean | UglifyJS.MinifyOptions; + + // Minify CSS in style elements and style attributes (uses clean-css) + minifyCSS?: boolean | CleanCSS.Options; + + // Minify URLs in various attributes (uses relateurl) + minifyURLs?: boolean | RelateUrl.Options; + + // Array of regex'es that allow to ignore certain comments, when matched + ignoreCustomComments?: Array; + + // Array of regex'es that allow to ignore certain fragments, when matched (e.g. , {{ ... }}, etc.) + ignoreCustomFragments?: Array; + + // Array of strings corresponding to types of script elements to process through minifier (e.g. text/ng-template, text/x-handlebars-template, etc.) + processScripts?: Array; + + // Specify a maximum line length. Compressed output will be split by newlines at valid HTML split-points + maxLineLength?: number; + + // Arrays of regex'es that allow to support custom attribute assign expressions (e.g. '
      ') + customAttrAssign?: Array; + + // Arrays of regex'es that allow to support custom attribute surround expressions (e.g. ) + customAttrSurround?: Array; + + // Regex that specifies custom attribute to strip newlines from (e.g. /ng\-class/) + customAttrCollapse?: RegExp; + + // Type of quote to use for attribute values (' or ") + quoteCharacter?: string; + } + } + + export = HTMLMinifier; +} From b29d9f63400cf32f0977fff8811d23a1ee59871f Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 17:23:12 +0100 Subject: [PATCH 259/441] Add definitions for gulp-htmlmin (https://github.com/jonschlinkert/gulp-htmlmin) --- gulp-htmlmin/gulp-htmlmin-tests.ts | 11 +++++++++++ gulp-htmlmin/gulp-htmlmin.d.ts | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 gulp-htmlmin/gulp-htmlmin-tests.ts create mode 100644 gulp-htmlmin/gulp-htmlmin.d.ts diff --git a/gulp-htmlmin/gulp-htmlmin-tests.ts b/gulp-htmlmin/gulp-htmlmin-tests.ts new file mode 100644 index 0000000000..78149e787e --- /dev/null +++ b/gulp-htmlmin/gulp-htmlmin-tests.ts @@ -0,0 +1,11 @@ +/// +/// + +import * as gulp from 'gulp'; +import * as htmlmin from 'gulp-htmlmin'; + +gulp.task('minify', function() { + return gulp.src('src/*.html') + .pipe(htmlmin({collapseWhitespace: true})) + .pipe(gulp.dest('dist')) +}); diff --git a/gulp-htmlmin/gulp-htmlmin.d.ts b/gulp-htmlmin/gulp-htmlmin.d.ts new file mode 100644 index 0000000000..2cf947d23d --- /dev/null +++ b/gulp-htmlmin/gulp-htmlmin.d.ts @@ -0,0 +1,18 @@ +// Type definitions for gulp-htmlmin v1.3.0 +// Project: https://github.com/jonschlinkert/gulp-htmlmin +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module 'gulp-htmlmin' { + import * as HTMLMinifier from 'html-minifier'; + + namespace htmlmin { + } + + function htmlmin(options?: HTMLMinifier.Options): NodeJS.ReadWriteStream; + + export = htmlmin; +} From 84fecab4c3294938ef35700e80e5684f94b1cda4 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 17:25:55 +0100 Subject: [PATCH 260/441] "Deprecate" gulp-minify-html in favor of gulp-htmlmin --- gulp-minify-html/gulp-minify-html-tests.ts | 2 ++ gulp-minify-html/gulp-minify-html.d.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/gulp-minify-html/gulp-minify-html-tests.ts b/gulp-minify-html/gulp-minify-html-tests.ts index 556ee203bb..1b3c7639da 100644 --- a/gulp-minify-html/gulp-minify-html-tests.ts +++ b/gulp-minify-html/gulp-minify-html-tests.ts @@ -4,6 +4,8 @@ import * as gulp from 'gulp'; import * as minifyHtml from 'gulp-minify-html'; +// This package has been deprecated in favor of gulp-htmlmin, which should be faster and more comprehensive. + minifyHtml(); minifyHtml({conditionals: true, loose: true}); diff --git a/gulp-minify-html/gulp-minify-html.d.ts b/gulp-minify-html/gulp-minify-html.d.ts index 321a569256..770789bbb0 100644 --- a/gulp-minify-html/gulp-minify-html.d.ts +++ b/gulp-minify-html/gulp-minify-html.d.ts @@ -5,8 +5,11 @@ /// +// This package has been deprecated in favor of gulp-htmlmin, which should be faster and more comprehensive. + declare module 'gulp-minify-html' { namespace minifyHtml { + // Options from https://github.com/Swaagie/minimize#options interface Options { // Do not remove empty attributes empty?: boolean; From 26c98c8a9530c44f8c801ccc3b2057e2101187ee Mon Sep 17 00:00:00 2001 From: Felipe Andrade Date: Wed, 6 Jan 2016 11:28:40 -0500 Subject: [PATCH 261/441] added toHaveBeenCalledTimes --- jasmine/jasmine.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index 46a1937f43..b17c68d8b5 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -290,6 +290,7 @@ declare module jasmine { toBeFalsy(expectationFailOutput?: any): boolean; toHaveBeenCalled(): boolean; toHaveBeenCalledWith(...params: any[]): boolean; + toHaveBeenCalledTimes(expected: number): boolean; toContain(expected: any, expectationFailOutput?: any): boolean; toBeLessThan(expected: number, expectationFailOutput?: any): boolean; toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean; From 61f56612d8cd504f4bb6c31aecfa2354ae94757b Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Wed, 6 Jan 2016 17:31:51 +0100 Subject: [PATCH 262/441] Add vec3 typings --- vec3/vec3.d.ts | 29 +++++++++++++++++++++++++++++ vec3/vec3.ts | 3 +++ 2 files changed, 32 insertions(+) create mode 100644 vec3/vec3.d.ts create mode 100644 vec3/vec3.ts diff --git a/vec3/vec3.d.ts b/vec3/vec3.d.ts new file mode 100644 index 0000000000..39e573d9b6 --- /dev/null +++ b/vec3/vec3.d.ts @@ -0,0 +1,29 @@ +declare module "vec3"{ + export class Vec3{ + constructor(x: number, y: number, z: number); + constructor(location: number[]); + constructor(location: {x: number; y: number; z: number}); + constructor(locationStr: string); + + set(x, y, z): Vec3; + update(other: Vec3): Vec3; + floored(): Vec3; + floor(): Vec3; + offset(dx: number, dy: number, dz: number): Vec3; + translate(dx: number, dy: number, dz: number): Vec3; + add(other: Vec3): Vec3; + substract(other: Vec3): Vec3; + plus(other: Vec3): Vec3; + minus(other: Vec3): Vec3; + scaled(scalar: number): Vec3; + abs(): Vec3 + volume(): number; + modulus(): Vec3; + distanceTo(other: Vec3): number; + equals(other: Vec3): boolean; + toString(): string; + clone(): Vec3; + min(other: Vec3): Vec3; + max(other: Vec3): Vec3; + } +} \ No newline at end of file diff --git a/vec3/vec3.ts b/vec3/vec3.ts new file mode 100644 index 0000000000..2bc3836073 --- /dev/null +++ b/vec3/vec3.ts @@ -0,0 +1,3 @@ +/// +import * as vec3 from "vec3" +let myVector = new vec3.Vec3(10, 10, 10); \ No newline at end of file From 0d5bd9bd25c4fa0a81883e3bab4703420f8969de Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Wed, 6 Jan 2016 17:36:04 +0100 Subject: [PATCH 263/441] Fix name --- vec3/{vec3.ts => vec3-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename vec3/{vec3.ts => vec3-tests.ts} (100%) diff --git a/vec3/vec3.ts b/vec3/vec3-tests.ts similarity index 100% rename from vec3/vec3.ts rename to vec3/vec3-tests.ts From c165b20f4f29b3f389a40d7e9423b80c826bac09 Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Wed, 6 Jan 2016 17:43:26 +0100 Subject: [PATCH 264/441] try fix --- vec3/vec3-tests.ts | 3 +-- vec3/vec3.d.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/vec3/vec3-tests.ts b/vec3/vec3-tests.ts index 2bc3836073..4395f47be9 100644 --- a/vec3/vec3-tests.ts +++ b/vec3/vec3-tests.ts @@ -1,3 +1,2 @@ -/// import * as vec3 from "vec3" -let myVector = new vec3.Vec3(10, 10, 10); \ No newline at end of file +let myVector: vec3.Vec3 = new vec3.Vec3(10, 10, 10); \ No newline at end of file diff --git a/vec3/vec3.d.ts b/vec3/vec3.d.ts index 39e573d9b6..fff42c4b20 100644 --- a/vec3/vec3.d.ts +++ b/vec3/vec3.d.ts @@ -1,5 +1,5 @@ declare module "vec3"{ - export class Vec3{ + class Vec3{ constructor(x: number, y: number, z: number); constructor(location: number[]); constructor(location: {x: number; y: number; z: number}); From 6dbdbbe4aa4ddf5608745ad61a87e51ad7383183 Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Wed, 6 Jan 2016 17:44:52 +0100 Subject: [PATCH 265/441] add header --- vec3/vec3.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vec3/vec3.d.ts b/vec3/vec3.d.ts index fff42c4b20..30e8a04586 100644 --- a/vec3/vec3.d.ts +++ b/vec3/vec3.d.ts @@ -1,3 +1,8 @@ +// Type definitions for Vec3 Librairy +// Project: https://www.npmjs.com/package/vec3 +// Definitions by: Xavier Stouder +// Definitions: https://github.com/borisyankov/DefinitelyTyped + declare module "vec3"{ class Vec3{ constructor(x: number, y: number, z: number); From 1e3835e65e25802c16eb82796ca11f34e4d1fa9e Mon Sep 17 00:00:00 2001 From: Andrei Alecu Date: Wed, 6 Jan 2016 19:25:44 +0200 Subject: [PATCH 266/441] underscore: fix chain with Dictionary I added a test for this, it would previously fail to compile. Also, using `_.values()` on a Dictionary would lose strong typing on the result, returning `any[]`. This now properly returns `T[]` in that case. --- underscore/underscore-tests.ts | 17 +++++++++++++++++ underscore/underscore.d.ts | 8 ++++++++ 2 files changed, 25 insertions(+) diff --git a/underscore/underscore-tests.ts b/underscore/underscore-tests.ts index 051e000d03..24815e1cee 100644 --- a/underscore/underscore-tests.ts +++ b/underscore/underscore-tests.ts @@ -479,3 +479,20 @@ _.chain(obj).map(function (value, key) { empty[key] = value; console.log("vk", value, key); }); + +function strong_typed_values_tests() { + var dictionaryLike: { [k: string] : {title: string, value: number} } = { + 'test' : { title: 'item1', value: 5 }, + 'another' : { title: 'item2', value: 8 }, + 'third' : { title: 'item3', value: 10 } + }, + empty = {}; + + _.chain(dictionaryLike).values().filter((r) => { + return r.value >= 8; + }).map((r) => { + return [r.title, true]; + }).object().value(); + + _.values<{title: string, value: number}>(dictionaryLike); +} diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 8cf98071b6..5b7e6a2f3d 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -1192,6 +1192,13 @@ interface UnderscoreStatic { **/ keys(object: any): string[]; + /** + * Return all of the values of the object's properties. + * @param object Retrieve the values of all the properties on this object. + * @return List of all the values on `object`. + **/ + values(object: _.Dictionary): T[]; + /** * Return all of the values of the object's properties. * @param object Retrieve the values of all the properties on this object. @@ -1641,6 +1648,7 @@ interface UnderscoreStatic { * @return Wrapped `obj`. **/ chain(obj: T[]): _Chain; + chain(obj: _.Dictionary): _Chain; chain(obj: T): _Chain; } From b7e9564fdd78981f5acf927cfef4cec9a0a21d68 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Wed, 6 Jan 2016 13:34:10 -0500 Subject: [PATCH 267/441] Add router /routes support to Restify --- restify/restify.d.ts | 60 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 6fb2e6718c..1cb61fd23f 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -72,6 +72,61 @@ declare module "restify" { headers: Object; id: string; } + + interface Route { + name: string; + method: string; + path: RoutePathRegex; + spec: Object; + types: string[]; + versions: string[]; + } + + interface RouteOptions { + name: string; + method: string; + path?: string | RegExp; + url?: string | RegExp; + urlParamPattern?: RegExp; + contentType?: string | string[]; + versions?: string | string[]; + } + + interface RoutePathRegex extends RegExp { + restifyParams: string[]; + } + + interface Router { + name: string; + mounts: { [routeName: string]: Route }; + versions: string[]; + contentType: string[]; + routes: { + DELETE: Route[]; + GET: Route[]; + HEAD: Route[]; + OPTIONS: Route[]; + PATCH: Route[]; + POST: Route[]; + PUT: Route[]; + }; + log?: any; + toString: () => string; + + /** + * adds a route. + * @param {Object} options an options object + * @returns {String} returns the route name if creation is successful. + */ + mount: (options: Object) => string; + + /** + * unmounts a route. + * @param {String} name the route name + * @returns {String} the name of the deleted route (or false if it was not matched) + */ + unmount: (name: string) => string | boolean; + } interface Server extends http.Server { use(handler: RequestHandler, ...handlers: RequestHandler[]): any; @@ -124,7 +179,9 @@ declare module "restify" { close(... args: any[]): any; pre(routeCallBack: RequestHandler): any; server: http.Server; - + router: Router; + routes: Route[]; + toString: () => string; } interface ServerOptions { @@ -138,6 +195,7 @@ declare module "restify" { responseTimeHeader ?: string; responseTimeFormatter ?: (durationInMilliseconds: number) => any; handleUpgrades ?: boolean; + router ?: Router; } interface ClientOptions { From 1140e9393fc943fcfae10dd67d97f8abbdd8dea6 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Wed, 6 Jan 2016 13:50:02 -0500 Subject: [PATCH 268/441] Added Restify Router render function --- restify/restify.d.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 1cb61fd23f..44c379fb36 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -113,17 +113,26 @@ declare module "restify" { log?: any; toString: () => string; + /** + * Takes an object of route params and query params, and 'renders' a URL + * @param {String} routeName the route name + * @param {Object} params an object of route params + * @param {Object} query an object of query params + * @returns {String} + */ + render: (routeName: string, params: Object, query?: Object) => string; + /** * adds a route. * @param {Object} options an options object - * @returns {String} returns the route name if creation is successful. + * @returns {String} returns the route name if creation is successful. */ mount: (options: Object) => string; /** * unmounts a route. * @param {String} name the route name - * @returns {String} the name of the deleted route (or false if it was not matched) + * @returns {String} the name of the deleted route (or false if it was not matched) */ unmount: (name: string) => string | boolean; } From d2443f6855ad706cd898e96bd40554b521985aa2 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Wed, 6 Jan 2016 14:21:47 -0500 Subject: [PATCH 269/441] Proper returns on server use/route --- restify/restify.d.ts | 66 ++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 44c379fb36..826b2ca430 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -138,45 +138,45 @@ declare module "restify" { } interface Server extends http.Server { - use(handler: RequestHandler, ...handlers: RequestHandler[]): any; - use(handler: RequestHandler[], ...handlers: RequestHandler[]): any; - use(handler: RequestHandler, ...handlers: RequestHandler[][]): any; - use(handler: RequestHandler[], ...handlers: RequestHandler[][]): any; + use(handler: RequestHandler, ...handlers: RequestHandler[]): Server; + use(handler: RequestHandler[], ...handlers: RequestHandler[]): Server; + use(handler: RequestHandler, ...handlers: RequestHandler[][]): Server; + use(handler: RequestHandler[], ...handlers: RequestHandler[][]): Server; - post(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): any; - post(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): any; - post(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): any; - post(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): any; + post(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): Route; + post(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): Route; + post(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): Route; + post(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): Route; - patch(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): any; - patch(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): any; - patch(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): any; - patch(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): any; + patch(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): Route; + patch(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): Route; + patch(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): Route; + patch(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): Route; - put(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): any; - put(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): any; - put(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): any; - put(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): any; + put(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): Route; + put(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): Route; + put(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): Route; + put(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): Route; - del(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): any; - del(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): any; - del(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): any; - del(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): any; + del(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): Route; + del(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): Route; + del(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): Route; + del(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): Route; - get(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): any; - get(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): any; - get(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): any; - get(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): any; + get(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): Route; + get(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): Route; + get(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): Route; + get(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): Route; - head(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): any; - head(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): any; - head(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): any; - head(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): any; + head(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): Route; + head(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): Route; + head(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): Route; + head(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): Route; - opts(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): any; - opts(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): any; - opts(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): any; - opts(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): any; + opts(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): Route; + opts(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): Route; + opts(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): Route; + opts(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): Route; name: string; version: string; @@ -186,7 +186,7 @@ declare module "restify" { address: () => addressInterface; listen(... args: any[]): any; close(... args: any[]): any; - pre(routeCallBack: RequestHandler): any; + pre(routeCallBack: RequestHandler): Server; server: http.Server; router: Router; routes: Route[]; From 6ca23c0d6999b8ede923167b02aad5dbdc30298d Mon Sep 17 00:00:00 2001 From: Jean-Philipe Pellerin Date: Wed, 6 Jan 2016 16:49:09 -0500 Subject: [PATCH 270/441] Adding availability for the DynamoDB Document Client --- aws-sdk/aws-sdk.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts index 128341729d..f890594635 100644 --- a/aws-sdk/aws-sdk.d.ts +++ b/aws-sdk/aws-sdk.d.ts @@ -154,6 +154,12 @@ declare module "aws-sdk" { constructor(options?: any); } + export module DynamoDB { + export class DocumentClient { + constructor(options?: any); + } + } + export module SQS { export interface SqsOptions { From d0aa1d004b43186b120c4079f2af2f0b35d954e9 Mon Sep 17 00:00:00 2001 From: RX14 Date: Wed, 6 Jan 2016 21:59:46 +0000 Subject: [PATCH 271/441] Add winreg typings. --- winreg/winreg-tests.ts | 95 ++++++++++++++++ winreg/winreg.d.ts | 248 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 343 insertions(+) create mode 100644 winreg/winreg-tests.ts create mode 100644 winreg/winreg.d.ts diff --git a/winreg/winreg-tests.ts b/winreg/winreg-tests.ts new file mode 100644 index 0000000000..376006aed6 --- /dev/null +++ b/winreg/winreg-tests.ts @@ -0,0 +1,95 @@ +/// + +var regKey = new Winreg({ + hive: Winreg.HKCU, + key: "\\Foo\\Bar", + host: "\\FooBar" +}) + +var regKey2 = new Winreg({ + hive: Winreg.HKCU, + key: "\\Foo\\Bar" +}) + +var regKey3 = new Winreg({ + key: "\\Foo\\Bar" +}) + +var str: string = regKey.parent.key +var par: Winreg = regKey.parent + +regKey.values((err, items) => { + var itemsC: Array = items; + var errorC: Error = err; + + items.forEach((item) => { + var str: string = item.host; + }); +}); + +regKey.keys((err, items) => { + var itemsC: Array = items; + var errorC: Error = err; + + items.forEach((item) => { + var regKey4: Winreg = item; + }); +}); + +//--- TEST CASE --- + +// create a registry client +var r1 = new Winreg({ + hive: Winreg.HKCU, + key: '\\Software\\Microsoft\\Windows\\CurrentVersion\\Run' +}) +var r2 = new Winreg({ + hive: Winreg.HKCU, + key: '\\Control Panel\\Desktop' +}) + +// get parent key +console.log('parent of "'+r2.path+'" -> "'+r2.parent.path+'"'); + +// list subkeys +r2.keys(function (err, items) { + + if (!err) { + for (var i = 0, l = items.length; i < l; i++) { + console.log('subkey of "'+r2.path+'": '+items[i].path); + } + } + + // list values + r1.values(function (err, items) { + + if (!err) { + console.log(JSON.stringify(items, null, '\t')); + } + + // query named value + r1.get(items[0].name, function (err, item) { + + if (!err) { + console.log(JSON.stringify(item, null, '\t')); + } + + // add value + r1.set('bla', Winreg.REG_SZ, 'hello world!', function (err) { + + if (!err) { + console.log('value written'); + } + + // delete value + r1.remove('bla', function (err) { + + if (!err) { + console.log('value deleted'); + } + + }); + }); + }); + }); +}); diff --git a/winreg/winreg.d.ts b/winreg/winreg.d.ts new file mode 100644 index 0000000000..459a6e780a --- /dev/null +++ b/winreg/winreg.d.ts @@ -0,0 +1,248 @@ +// Type definitions for Winreg v0.0.15 +// Project: https://github.com/fresc81/node-winreg/ +// Definitions by: RX14 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare var Winreg: WinregStatic; + +interface WinregStatic { + /** + * Create a new Winreg instance with the given options. + * @param options options object + */ + new (options: Winreg.Options): Winreg; + + /** + * HKEY_LOCAL_MACHINE registry hive. + */ + HKLM: string; + + /** + * HKEY_CURRENT_USER registry hive. + */ + HKCU: string; + + /** + * HKEY_CLASSES_ROOT registry hive. + */ + HKCR: string; + + /** + * HKEY_USERS registry hive. + */ + HKU: string; + + /** + * HKEY_CURRENT_CONFIG registry hive. + */ + HKCC: string; + + /** + * Array of available registry hives. + */ + HIVES: Array; + + /** + * Registry value type STRING. + * + * Values of this type contain a string. + */ + REG_SZ: string; + + /** + * Registry value type MULTILINE_STRING. + * + * Values of this type contain a multiline string. + */ + REG_MULTI_SZ: string; + + /** + * Registry value type EXPANDABLE_STRING. + * + * Values of this type contain an expandable string. + */ + REG_EXPAND_SZ: string; + + /** + * Registry value type DOUBLE_WORD. + * + * Values of this type contain a double word (32 bit integer). + */ + REG_DWORD: string; + + /** + * Registry value type QUAD_WORD. + * + * Values of this type contain a quad word (64 bit integer). + */ + REG_QWORD: string; + + /** + * Registry value type BINARY. + * + * Values of this type contain a binary value. + */ + REG_BINARY: string; + + /** + * Registry value type UNKNOWN. + * + * Values of this type contain a value of an unknown type. + */ + REG_NONE: string; + + /** + * Array of available registry value types. + */ + REG_TYPES: Array; +} + +interface Winreg { + /** + * Hostname, if set in options. + * @readonly + */ + host: string; + + /** + * Hive ID. + * @readonly + */ + hive: string; + + /** + * The registry key. + * @readonly + */ + key: string; + + /** + * The path of the registry key, including hostname (if set) and hive. + * @readonly + */ + path: string; + + /** + * A new Winreg instance of the parent key. + * @readonly + */ + parent: Winreg; + + /** + * Retrieves all values from this registry key. + * + * @param cb Callback with an array of RegistryItem objects, one for each value. + */ + values(cb: (err: Error, result: Array) => void): void; + + /** + * Retrieves all subkeys of this registry key. + * + * @param cb Callback with an array of Winreg objects, one for each subkey. + */ + keys(cb: (err: Error, result: Array) => void): void; + + /** + * Retrieves a named value from this registry key. + * + * @param name Name of the value to retrieve. + * @param cb Callback with a RegistryItem object for the value. + */ + get(name: string, cb: (err: Error, result: Winreg.RegistryItem) => void): void; + + /** + * Sets a named value in this registry key. Overwrites existing value. + * + * @param name Name of the value to set. + * @param type Type of the value to set. + * @param value Value of value to set. + * @param cb Callback with any errors. + */ + set(name: string, type: string, value: string, cb: (err: Error) => void): void; + + /** + * Remove a named value from this registry key. + * + * @param name Name of the value to remove. + * @param cb Callback with any errors. + */ + remove(name: string, cb: (err: Error) => void): void; + + /** + * Create this registry key. + * + * @param cb Callback with any errors. + */ + create(cb: (err: Error) => void): void; + + /** + * Erase this registry key and its contents. + * + * @param cb Callback with any errors. + */ + erase(cb: (err: Error) => void): void; +} + +declare namespace Winreg { + export interface Options { + /** + * Optional hostname, must start with '\\' sequence. + */ + host?: string; + + /** + * Optional hive ID, default is HKLM. + */ + hive?: string; + + /** + * Optional key, default is the root key. + */ + key?: String; + } + + /** + * A single registry value record + */ + interface RegistryItem { + /** + * Hostname, if set in options. + * @readonly + */ + host: string; + + /** + * Hive ID. + * @readonly + */ + hive: string; + + /** + * Key that the registry value belongs to. + * @readonly + */ + key: string; + + /** + * Name of the registry value. + * @readonly + */ + name: string; + + /** + * Type of the registry value. + * @readonly + */ + type: string; + + /** + * Value of the registry value, as a string. + * @readonly + */ + value: string; + } +} + +declare module "winreg" { + export = Winreg; +} From 7320acef39ff9907c61dc7983a7113114f8a6c29 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Thu, 7 Jan 2016 12:52:55 +0900 Subject: [PATCH 272/441] update CONTRIBUTORS --- CONTRIBUTORS.md | 241 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 174 insertions(+), 67 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index e9d91ae109..2c07fac204 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -2,6 +2,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakame/dt-contributors-generator). (but run scripts are manual operation. please wait :P) +* [:link:](abs/abs.d.ts) [abs](https://github.com/IonicaBizau/node-abs) by [Aya Morisawa](https://github.com/AyaMorisawa) +* [:link:](absolute/absolute.d.ts) [absolute](https://github.com/bahamas10/node-absolute) by [Aya Morisawa](https://github.com/AyaMorisawa) * [:link:](acc-wizard/acc-wizard.d.ts) [acc-wizard](https://github.com/sathomas/acc-wizard) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](accounting/accounting.d.ts) [accounting.js](http://josscrowcroft.github.io/accounting.js) by [Sergey Gerasimov](https://github.com/gerich-home) * [:link:](ace/ace.d.ts) [Ace Ajax.org Cloud9 Editor](http://ace.ajax.org) by [Diullei Gomes](https://github.com/Diullei) @@ -58,6 +60,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](angular-signalr-hub/angular-signalr-hub.d.ts) [angular-signalr-hub](https://github.com/JustMaier/angular-signalr-hub) by [Adam Santaniello](https://github.com/AdamSantaniello) * [:link:](angular-spinner/angular-spinner.d.ts) [angular-spinner.js](https://github.com/urish/angular-spinner) by [Marcin Biegała](https://github.com/Biegal) * [:link:](angular-storage/angular-storage.d.ts) [angular-storage](https://github.com/auth0/angular-storage) by [Matthew DeKrey](https://github.com/mdekrey) +* [:link:](angular-strap/angular-strap.d.ts) [angular-strap v2.2.x](http://mgcrea.github.io/angular-strap) by [Sam Herrmann](https://github.com/samherrmann) * [:link:](angular-ui-tree/angular-ui-tree.d.ts) [angular-ui-tree](https://github.com/angular-ui-tree/angular-ui-tree) by [Calvin Fernandez](https://github.com/CalvinFernandez) * [:link:](angular.throttle/angular.throttle.d.ts) [angular.throttle](https://github.com/BaggersIO/angular.throttle) by [Stefan Steinhart](https://github.com/reppners) * [:link:](angular-ui-sortable/angular-ui-sortable.d.ts) [angular.ui.sortable module](https://github.com/angular-ui/ui-sortable) by [Thodoris Greasidis](https://github.com/thgreasi) @@ -91,6 +94,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](assertion-error/assertion-error.d.ts) [assertion-error](https://github.com/chaijs/assertion-error) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](assertsharp/assertsharp.d.ts) [assertsharp](https://www.npmjs.com/package/assertsharp) by [Bruno Leonardo Michels](https://github.com/brunolm) * [:link:](async/async.d.ts) [Async](https://github.com/caolan/async) by [Boris Yankov](https://github.com/borisyankov), [Arseniy Maximov](https://github.com/kern0), [Joe Herman](https://github.com/Penryn) +* [:link:](async-writer/async-writer.d.ts) [async-writer](https://github.com/marko-js/async-writer) by [Yuce Tekol](http://yuce.me) * [:link:](asyncblock/asyncblock.d.ts) [asyncblock](https://github.com/scriby/asyncblock) by [Hiroki Horiuchi](https://github.com/horiuchi) * [:link:](atmosphere/atmosphere.d.ts) [Atmosphere](https://github.com/Atmosphere/atmosphere-javascript) by [Kai Toedter](https://github.com/toedter) * [:link:](atom/atom.d.ts) [Atom](https://atom.io) by [vvakame](https://github.com/vvakame) @@ -98,19 +102,21 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](atom-keymap/atom-keymap.d.ts) [atom-keymap](https://github.com/atom/atom-keymap) by [Vadim Macagon](https://github.com/enlight) * [:link:](atpl/atpl.d.ts) [atpl](https://github.com/soywiz/atpl.js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](auth0/auth0.d.ts) [Auth0.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) -* [:link:](auth0.widget/auth0.widget.d.ts) [Auth0Widget.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) * [:link:](auth0.lock/auth0.lock.d.ts) [Auth0Widget.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) +* [:link:](auth0.widget/auth0.widget.d.ts) [Auth0Widget.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) * [:link:](auto-launch/auto-launch.d.ts) [auto-launch](https://github.com/Teamwork/node-auto-launch) by [rhysd](https://github.com/rhysd) * [:link:](autobahn/autobahn.d.ts) [AutobahnJS](http://autobahn.ws/js) by [Elad Zelingher](https://github.com/darkl), [Andy Hawkins](https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com) * [:link:](autoprefixer-core/autoprefixer-core.d.ts) [Autoprefixer Core](https://github.com/postcss/autoprefixer-core) by [Asana](https://asana.com) * [:link:](aws-sdk/aws-sdk.d.ts) [aws-sdk](https://github.com/aws/aws-sdk-js) by [midknight41](https://github.com/midknight41) * [:link:](axios/axios.d.ts) [axios](https://github.com/mzabriskie/axios) by [Marcel Buesing](https://github.com/marcelbuesing) * [:link:](node-azure/azure.d.ts) [Azure SDK for Node](https://github.com/WindowsAzure/azure-sdk-for-node) by [Andrew Gaspar](https://github.com/AndrewGaspar), [Anti Veeranna](https://github.com/antiveeranna), [Maxime LUCE](https://github.com/SomaticIT) +* [:link:](babylonjs/babylon.d.ts) [BabylonJS](http://www.babylonjs.com) by [David Catuhe](https://github.com/deltakosh) * [:link:](backbone/backbone-global.d.ts) [Backbone](http://backbonejs.org) by [Boris Yankov](https://github.com/borisyankov), [Natan Vivo](https://github.com/nvivo) * [:link:](backbone/backbone.d.ts) [Backbone](http://backbonejs.org) by [Boris Yankov](https://github.com/borisyankov), [Natan Vivo](https://github.com/nvivo) * [:link:](backbone-associations/backbone-associations.d.ts) [Backbone-associations](https://github.com/dhruvaray/backbone-associations) by [Craig Brett](https://github.com/craigbrett17) * [:link:](backbone-relational/backbone-relational.d.ts) [Backbone-relational](http://backbonerelational.org) by [Eirik Hoem](https://github.com/eirikhm) * [:link:](backbone.layoutmanager/backbone.layoutmanager.d.ts) [Backbone.LayoutManager](http://layoutmanager.org) by [He Jiang](https://github.com/hejiang2000) +* [:link:](backbone.localstorage/backbone.localstorage.d.ts) [backbone.localStorage](https://github.com/jeromegn/Backbone.localStorage) by [Louis Grignon](https://github.com/lgrignon) * [:link:](backbone.paginator/backbone.paginator.d.ts) [backbone.paginator](https://github.com/backbone-paginator/backbone.paginator) by [Nyamazing](https://github.com/Nyamazing) * [:link:](backbone.radio/backbone.radio.d.ts) [Backbone.Radio](https://github.com/marionettejs/backbone.radio) by [Peter Palotas](https://github.com/alphaleonis) * [:link:](backgrid/backgrid.d.ts) [Backgrid](http://backgridjs.com) by [Jeremy Lujan](https://github.com/jlujan) @@ -120,8 +126,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](basic-auth/basic-auth.d.ts) [basic-auth](https://github.com/jshttp/basic-auth) by [Clément Bourgeois](https://github.com/moonpyk) * [:link:](batch-stream/batch-stream.d.ts) [batch-stream](https://github.com/segmentio/batch-stream) by [Nicholas Penree](http://github.com/drudge) * [:link:](bcrypt/bcrypt.d.ts) [bcrypt](https://www.npmjs.org/package/bcrypt) by [Peter Harris](https://github.com/codeanimal) +* [:link:](bcrypt-nodejs/bcrypt-nodejs.d.ts) [bcrypt-nodejs](https://github.com/shaneGirish/bcrypt-nodejs) by [David Broder-Rodgers](https://github.com/DavidBR-SW) +* [:link:](bcryptjs/bcryptjs.d.ts) [bcryptjs](https://github.com/dcodeIO/bcrypt.js) by [Joshua Filby](https://github.com/Joshua-F) * [:link:](benchmark/benchmark.d.ts) [Benchmark](http://benchmarkjs.com) by [Asana](https://asana.com) * [:link:](better-curry/better-curry.d.ts) [better-curry](https://github.com/pocesar/js-bettercurry) by [Paulo Cesar](https://github.com/pocesar) +* [:link:](bezier-easing/bezier-easing.d.ts) [bezier-easing](https://github.com/gre/bezier-easing) by [brian ridley](https://github.com/ptlis) * [:link:](bgiframe/typescript.bgiframe.d.ts) [bgiframe](https://github.com/sumegizoltan/BgiFrame) by [Zoltan Sumegi](https://github.com/sumegizoltan) * [:link:](big.js/big.js.d.ts) [big.js](https://github.com/MikeMcl/big.js) by [Steve Ognibene](https://github.com/nycdotnet) * [:link:](bigint/bigint.d.ts) [BigInt](https://github.com/Evgenus/BigInt) by [Eugene Chernyshov](https://github.com/Evgenus) @@ -130,7 +139,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](bigscreen/bigscreen.d.ts) [BigScreen](http://brad.is/coding/BigScreen) by [Douglas Eichelberger](https://github.com/dduugg) * [:link:](bitwise-xor/bitwise-xor.d.ts) [bitwise-xor](https://github.com/czzarr/node-bitwise-xor) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](blob-stream/blob-stream.d.ts) [blob-stream](https://github.com/devongovett/blob-stream) by [Eric Hillah](https://github.com/erichillah) -* [:link:](bluebird/bluebird.d.ts) [bluebird](https://github.com/petkaantonov/bluebird) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](blue-tape/blue-tape.d.ts) [blue-tape](https://github.com/spion/blue-tape) by [Haoqun Jiang](https://github.com/sodatea) +* [:link:](bluebird/bluebird.d.ts) [bluebird](https://github.com/petkaantonov/bluebird) by [Bart van der Schoor](https://github.com/Bartvds), [falsandtru](https://github.com/falsandtru) * [:link:](bluebird-retry/bluebird-retry.d.ts) [bluebird-retry](https://github.com/jut-io/bluebird-retry) by [Pascal Vomhoff](https://github.com/pvomhoff) * [:link:](blueimp-md5/blueimp-md5.d.ts) [blueimp-md5](https://github.com/blueimp/JavaScript-MD5) by [Ray Martone](https://github.com/rmartone) * [:link:](body-parser/body-parser.d.ts) [body-parser](http://expressjs.com) by [Santi Albo](https://github.com/santialbo), [VILIC VANE](https://vilic.info), [Jonathan Häberle](https://github.com/dreampulse) @@ -154,30 +164,36 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](breeze/breeze.d.ts) [Breeze 1.5.x](http://www.breezejs.com) by [Boris Yankov](https://github.com/borisyankov), [IdeaBlade](https://github.com/IdeaBlade/Breeze) * [:link:](browser-harness/browser-harness.d.ts) [Browser Harness](https://github.com/scriby/browser-harness) by [Chris Scribner](https://github.com/scriby) * [:link:](browser-sync/browser-sync.d.ts) [browser-sync](http://www.browsersync.io) by [Asana](https://asana.com), [Joe Skeen](http://github.com/joeskeen) -* [:link:](browserify/browserify.d.ts) [Browserify](http://browserify.org) by [Andrew Gaspar](https://github.com/AndrewGaspar) +* [:link:](browserify/browserify.d.ts) [Browserify](http://browserify.org) by [Andrew Gaspar](https://github.com/AndrewGaspar), [John Vilk](https://github.com/jvilk) * [:link:](bucks/bucks.d.ts) [bucks.js](https://github.com/CyberAgent/bucks.js) by [Shunsuke Ohtani](https://github.com/zaneli) +* [:link:](buffer-compare/buffer-compare.d.ts) [buffer-compare](https://github.com/soldair/node-buffer-compare) by [Ilya Mochalov](https://github.com/chrootsu) * [:link:](buffer-equal/buffer-equal.d.ts) [buffer-equal](https://github.com/substack/node-buffer-equal) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](bl/bl.d.ts) [BufferList](https://github.com/rvagg/bl) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](buffers/buffers.d.ts) [buffers](https://github.com/substack/node-buffers) by [Robert Hencke](https://github.com/rhencke) * [:link:](bufferstream/bufferstream.d.ts) [bufferstream](https://github.com/dodo/node-bufferstream) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](bull/bull.d.ts) [bull](https://github.com/OptimalBits/bull) by [Bruno Grieder](https://github.com/bgrieder) * [:link:](bunyan-prettystream/bunyan-prettystream.d.ts) [bunyan-prettystream](https://www.npmjs.com/package/bunyan-prettystream) by [Jason Swearingen](https://github.com/jasonswearingen), [Vadim Macagon](https://github.com/enlight) * [:link:](business-rules-engine/business-rules-engine.d.ts) [business-rules-engine](https://github.com/rsamec/form) by [Roman Samec](https://github.com/rsamec) * [:link:](dw-bxslider-4/dw-bxslider-4.d.ts) [bxSlider](https://github.com/stevenwanderski/bxslider-4) by [Piotr Sałkowski](https://github.com/namerci) * [:link:](byline/byline.d.ts) [byline](https://github.com/jahewson/node-byline) by [Stefan Steinhart](https://github.com/reppners) +* [:link:](bytebuffer/bytebuffer.d.ts) [bytebuffer.js](https://github.com/dcodeIO/bytebuffer.js) by [Denis Cappellin](http://github.com/cappellin) * [:link:](bytes/bytes.d.ts) [bytes](https://github.com/visionmedia/bytes.js) by [Zhiyuan Wang](https://github.com/danny8002) * [:link:](c3/c3.d.ts) [C3js](http://c3js.org) by [Marc Climent](https://github.com/mcliment) +* [:link:](cal-heatmap/cal-heatmap.d.ts) [cal-heatmap](https://github.com/wa0x6e/cal-heatmap) by [Chris Baker](https://github.com/RetroChrisB) * [:link:](calq/calq.d.ts) [calq](https://calq.io/docs/client/javascript/reference) by [Eirik Hoem](https://github.com/eirikhm) * [:link:](camel-case/camel-case.d.ts) [camel-case](https://github.com/blakeembrey/camel-case) by [Sam Saint-Pettersen](https://github.com/stpettersens) * [:link:](camljs/camljs.d.ts) [camljs](http://camljs.codeplex.com) by [Andrey Markeev](http://markeev.com) * [:link:](canvasjs/canvasjs.d.ts) [CanvasJS](http://canvasjs.com) by [Mark Overholt](https://github.com/mover5) * [:link:](casperjs/casperjs.d.ts) [CasperJS](http://casperjs.org) by [Jed Mao](https://github.com/jedmao) -* [:link:](chai/chai.d.ts) [chai](http://chaijs.com) by [Jed Mao](https://github.com/jedmao), [Bart van der Schoor](https://github.com/Bartvds), [Andrew Brown](https://github.com/AGBrown), [Olivier Chevet](https://github.com/olivr70) +* [:link:](chai/chai.d.ts) [chai](http://chaijs.com) by [Jed Mao](https://github.com/jedmao), [Bart van der Schoor](https://github.com/Bartvds), [Andrew Brown](https://github.com/AGBrown), [Olivier Chevet](https://github.com/olivr70), [Matt Wistrand](https://github.com/mwistrand) * [:link:](chai-as-promised/chai-as-promised.d.ts) [chai-as-promised](https://github.com/domenic/chai-as-promised) by [jt000](https://github.com/jt000), [Yuki Kokubun](https://github.com/Kuniwak) * [:link:](chai-datetime/chai-datetime.d.ts) [chai-datetime](https://github.com/gaslight/chai-datetime.git) by [Cliff Burger](https://github.com/cliffburger) * [:link:](chai-fuzzy/chai-fuzzy.d.ts) [chai-fuzzy](http://chaijs.com/plugins/chai-fuzzy) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](chai-http/chai-http.d.ts) [chai-http](https://github.com/chaijs/chai-http) by [Wim Looman](https://github.com/Nemo157) * [:link:](chai-jquery/chai-jquery.d.ts) [chai-jquery](https://github.com/chaijs/chai-jquery) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid) +* [:link:](chai-string/chai-string.d.ts) [chai-string](https://github.com/onechiporenko/chai-string) by [Nick Malaguti](https://github.com/nmalaguti) * [:link:](chai-subset/chai-subset.d.ts) [chai-subset](https://github.com/e-conomic/chai-subset) by [Sam Noedel](https://github.com/delta62), [Andrew Brown](https://github.com/AGBrown) +* [:link:](chai-things/chai-things.d.ts) [chai-things](https://github.com/chaijs/chai-things) by [David Broder-Rodgers](https://github.com/DavidBR-SW) * [:link:](chalk/chalk.d.ts) [chalk](https://github.com/sindresorhus/chalk) by [Diullei Gomes](https://github.com/Diullei), [Bart van der Schoor](https://github.com/Bartvds) * [:link:](chance/chance.d.ts) [Chance](http://chancejs.com) by [Chris Bowdon](https://github.com/cbowdon) * [:link:](change-case/change-case.d.ts) [change-case](https://github.com/blakeembrey/change-case) by [Asana](https://asana.com) @@ -190,7 +206,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](chosen/chosen.jquery.d.ts) [Chosen.JQuery](http://harvesthq.github.com/chosen) by [Boris Yankov](https://github.com/borisyankov) * [:link:](chroma-js/chroma-js.d.ts) [Chroma.js](https://github.com/gka/chroma.js) by [Sebastian Brückner](https://github.com/invliD) * [:link:](chrome/chrome-cast.d.ts) [Chrome Cast application development](https://developers.google.com/cast) by [Thomas Stig Jacobsen](https://github.com/eXeDK) -* [:link:](chrome/chrome.d.ts) [Chrome extension development](http://developer.chrome.com/extensions) by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10), [couven92](https://gitbus.com/couven92) +* [:link:](chrome/chrome.d.ts) [Chrome extension development](http://developer.chrome.com/extensions) by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10), [couven92](https://github.com/couven92) * [:link:](chrome/chrome-app.d.ts) [Chrome packaged application development](http://developer.chrome.com/apps) by [Adam Lay](https://github.com/AdamLay), [MIZUNE Pine](https://github.com/pine613), [MIZUSHIMA Junki](https://github.com/mzsm) * [:link:](chui/chui.d.ts) [chui](https://github.com/chocolatechipui/chocolatechip-ui) by [Robert Biggs](http://chocolatechip-ui.com) * [:link:](circular-json/circular-json.d.ts) [circular-json](https://github.com/WebReflection/circular-json) by [Jonathan Pevarnek](https://github.com/jpevarnek) @@ -199,16 +215,20 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](cli-color/cli-color.d.ts) [cli-color](https://github.com/medikoo/cli-color) by [Joel Spadin](https://github.com/ChaosinaCan) * [:link:](clone/clone.d.ts) [clone](https://github.com/pvorb/node-clone) by [Kieran Simpson](https://github.com/kierans/DefinitelyTyped) * [:link:](closure-compiler/closure-compiler.d.ts) [closure-compiler](https://github.com/tim-smart/node-closure) by [Martin Probst](https://github.com/mprobst) -* [:link:](codemirror/codemirror-showhint.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [jacqt](https://github.com/jacqt), [basarat](https://github.com/basarat) -* [:link:](codemirror/codemirror-matchbrackets.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [Sixin Li](https://github.com/sixinli) * [:link:](codemirror/codemirror.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [mihailik](https://github.com/mihailik) * [:link:](codemirror/searchcursor.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [jacqt](https://github.com/jacqt) +* [:link:](codemirror/codemirror-showhint.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [jacqt](https://github.com/jacqt), [basarat](https://github.com/basarat) +* [:link:](codemirror/codemirror-matchbrackets.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [Sixin Li](https://github.com/sixinli) * [:link:](coffeeify/coffeeify.d.ts) [coffeeify](https://github.com/jnordberg/coffeeify) by [Qubo](https://github.com/tkQubo) * [:link:](colorbrewer/colorbrewer.d.ts) [colorbrewer](https://github.com/jeanlauliac/colorbrewer) by [Matt Traynham](https://github.com/mtraynham) * [:link:](colors/colors.d.ts) [Colors.js 0.6.0-1](https://github.com/Marak/colors.js) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](cometd/cometd.d.ts) [CometD](http://cometd.org) by [Derek Cicerone](https://github.com/derekcicerone) * [:link:](commander/commander.d.ts) [commanderjs](https://github.com/visionmedia/commander.js) by [Marcelo Dezem](http://github.com/mdezem), [vvakame](http://github.com/vvakame) +* [:link:](commonmark/commonmark.d.ts) [commonmark.js](https://github.com/jgm/commonmark.js) by [Nico Jansen](https://github.com/nicojs) * [:link:](compare-version/compare-version.d.ts) [compare-version](https://www.npmjs.com/package/compare-version) by [Jonathan Pevarnek](https://github.com/jpevarnek) +* [:link:](complex/complex.d.ts) [Complex](https://github.com/arian/Complex) by [Aya Morisawa](https://github.com/AyaMorisawa) +* [:link:](debounce/debounce.d.ts) [compose-function](https://github.com/component/debounce) by [Denis Sokolov](https://github.com/denis-sokolov) +* [:link:](compose-function/compose-function.d.ts) [compose-function](https://github.com/stoeffel/compose-function) by [Denis Sokolov](https://github.com/denis-sokolov) * [:link:](compression/compression.d.ts) [compression](https://github.com/expressjs/compression) by [Santi Albo](https://github.com/santialbo) * [:link:](configstore/configstore.d.ts) [configstore](https://github.com/yeoman/configstore) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](connect/connect.d.ts) [connect](https://github.com/senchalabs/connect) by [Maxime LUCE](https://github.com/SomaticIT) @@ -217,23 +237,31 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](connect-modrewrite/connect-modrewrite.d.ts) [connect-modrewrite](https://github.com/tinganho/connect-modrewrite) by [Tingan Ho](https://github.com/tinganho) * [:link:](connect-mongo/connect-mongo.d.ts) [connect-mongo](https://github.com/kcbanner/connect-mongo) by [Mizuki Yamamoto](https://github.com/Syati) * [:link:](connect-slashes/connect-slashes.d.ts) [connect-slashes](https://github.com/avinoamr/connect-slashes) by [Sam Herrmann](https://github.com/samherrmann) +* [:link:](connect-timeout/connect-timeout.d.ts) [connect-timeout](https://github.com/expressjs/timeout) by [Cyril Schumacher](https://github.com/cyrilschumacher) +* [:link:](console-stamp/console-stamp.d.ts) [console-stamp](https://github.com/starak/node-console-stamp) by [Eric Byers](https://github.com/ericbyers) * [:link:](consolidate/consolidate.d.ts) [consolidate](https://github.com/visionmedia/consolidate.js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](constant-case/constant-case.d.ts) [constant-case](https://github.com/blakeembrey/constant-case) by [Sam Saint-Pettersen](https://github.com/stpettersens) * [:link:](content-type/content-type.d.ts) [content-type](https://github.com/deoxxa/content-type) by [Pine Mizune](https://github.com/pine613) +* [:link:](contentful-resolve-response/contentful-resolve-response.d.ts) [contentful-resolve-response](https://github.com/contentful/contentful-resolve-response) by [Anton Karsten](https://github.com/antonkarsten) * [:link:](contextjs/contextjs.d.ts) [contextjs](https://github.com/jakiestfu/Context.js) by [Kern Handa](https://github.com/kernhanda) * [:link:](convert-source-map/convert-source-map.d.ts) [convert-source-map](https://github.com/thlorenz/convert-source-map) by [Andrew Gaspar](https://github.com/AndrewGaspar) * [:link:](cookie/cookie.d.ts) [cookie](https://github.com/jshttp/cookie) by [Pine Mizune](https://github.com/pine613) * [:link:](cookie-parser/cookie-parser.d.ts) [cookie-parser](https://github.com/expressjs/cookie-parser) by [Santi Albo](https://github.com/santialbo) +* [:link:](cookies/cookies.d.ts) [cookie-parser](https://github.com/pillarjs/cookies) by [Wang Zishi](https://github.com/WangZishi) * [:link:](cookiejs/cookiejs.d.ts) [cookie.js](https://github.com/js-coder/cookie.js) by [Boltmade](https://github.com/Boltmade) * [:link:](cordova-ionic/plugins/keyboard.d.ts) [Cordova Keyboard plugin](https://github.com/driftyco/ionic-plugins-keyboard) by [Hendrik Maus](https://github.com/hendrikmaus) * [:link:](cordova-plugin-app-version/cordova-plugin-app-version.d.ts) [cordova-plugin-app-version](https://github.com/whiteoctober/cordova-plugin-app-version) by [Markus Wagner](https://github.com/Ritzlgrmft) * [:link:](cordova-plugin-ibeacon/cordova-plugin-ibeacon.d.ts) [cordova-plugin-ibeacon](https://github.com/petermetz/cordova-plugin-ibeacon) by [Markus Wagner](https://github.com/Ritzlgrmft) +* [:link:](cordova-plugin-mapsforge/cordova-plugin-mapsforge.d.ts) [cordova-plugin-mapsforge](https://github.com/afsuarez/mapsforge-cordova-plugin) by [rafw87](https://github.com/rafw87) * [:link:](cordova-plugin-ouralabs/cordova-plugin-ouralabs.d.ts) [cordova-plugin-ouralabs](https://github.com/Justin-Credible/cordova-plugin-ouralabs) by [Justin Unterreiner](https://github.com/Justin-Credible) +* [:link:](cordova-plugin-spinner/cordova-plugin-spinner.d.ts) [cordova-plugin-spinner](https://github.com/Justin-Credible/cordova-plugin-spinner) by [Justin Unterreiner](https://github.com/Justin-Credible) * [:link:](cordovarduino/cordovarduino.d.ts) [Cordovarduino plugin](https://github.com/stereolux/cordovarduino) by [Hendrik Maus](https://github.com/hendrikmaus) * [:link:](core-decorators/core-decorators.d.ts) [core-decorators.js](https://github.com/jayphelps/core-decorators.js) by [Qubo](https://github.com/tkqubo) * [:link:](core-js/core-js.d.ts) [core-js](https://github.com/zloirock/core-js) by [Ron Buckton](http://github.com/rbuckton) * [:link:](cors/cors.d.ts) [cors](https://github.com/troygoode/node-cors) by [Mihhail Lapushkin](https://github.com/mihhail-lapushkin) -* [:link:](couchbase/couchbase.d.ts) [Couchbase Couchnode](https://github.com/couchbase/couchnode) by [Basarat Ali Syed](https://github.com/basarat) +* [:link:](couchbase/couchbase.d.ts) [Couchbase Node.js SDK](https://github.com/couchbase/couchnode) by [Marwan Aouida](https://github.com/maouida) +* [:link:](cradle/cradle.d.ts) [cradle](https://github.com/flatiron/cradle) by [Panu Horsmalahti](https://github.com/panuhorsmalahti) +* [:link:](create-error/create-error.d.ts) [create-error.js](https://github.com/tgriesser/create-error) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](createjs/createjs.d.ts) [CreateJS](http://www.createjs.com) by [Pedro Ferreira](https://bitbucket.org/drk4), [Chris Smith](https://github.com/evilangelist), [Satoru Kimura](https://github.com/gyohk) * [:link:](credential/credential.d.ts) [credential](https://github.com/ericelliott/credential) by [Phú](https://github.com/phuvo) * [:link:](cron/cron.d.ts) [cron](https://www.npmjs.com/package/cron) by [Hiroki Horiuchi](https://github.com/horiuchi) @@ -246,6 +274,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](googlemaps.infobubble/google.maps.infobubble.d.ts) [CSS3 InfoBubble with tabs for Google Maps API V3](http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src) by [Johan Nilsson](https://github.com/Dashue) * [:link:](csurf/csurf.d.ts) [csurf](https://www.npmjs.org/package/csurf) by [Hiroki Horiuchi](https://github.com/horiuchi) * [:link:](csv-stringify/csv-stringify.d.ts) [csv-stringify](https://github.com/wdavidw/node-csv-stringify) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](cucumber/cucumber.d.ts) [cucumber-js](https://github.com/cucumber/cucumber-js) by [Abraão Alves](https://github.com/abraaoalves) * [:link:](cuid/cuid.d.ts) [cuid](https://github.com/ericelliott/cuid) by [Dave Keen](http://www.keendevelopment.ch) * [:link:](custom-error-generator/custom-error-generator.d.ts) [custom-error-generator](https://github.com/jproulx/node-custom-error) by [Thierry Miceli](https://github.com/thmiceli) * [:link:](md5/md5.d.ts) [CybozuLabs.MD5](http://labs.cybozu.co.jp/blog/mitsunari/2007/07/md5js_1.html) by [MIZUNE Pine](https://github.com/pine613) @@ -259,7 +288,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](date.format.js/date.format.d.ts) [Date Format](http://blog.stevenlevithan.com/archives/date-time-format) by [Rob Stutton](https://github.com/balrob) * [:link:](datejs/datejs.d.ts) [DateJS](http://www.datejs.com) by [David Khristepher Santos](http://github.com/rupertavery) * [:link:](dcjs/dc.d.ts) [DCJS](https://github.com/dc-js/dc.js) by [hans windhoff](https://github.com/hansrwindhoff), [matt traynham](https://github.com/mtraynham) -* [:link:](debug/debug.d.ts) [debug](https://github.com/visionmedia/debug) by [Seon-Wook Park](https://github.com/swook) +* [:link:](debug/debug.d.ts) [debug](https://github.com/visionmedia/debug) by [Seon-Wook Park](https://github.com/swook), [Gal Talmor](https://github.com/galtalmor) * [:link:](decimal.js/decimal.js.d.ts) [decimal.js](http://mikemcl.github.io/decimal.js) by [Joseph Rossi](http://github.com/musicist288) * [:link:](decorum/decorum.d.ts) [Decorum JS](https://github.com/dflor003/decorum) by [Danil Flores](https://github.com/dflor003) * [:link:](deep-diff/deep-diff.d.ts) [deep-diff](https://github.com/flitbit/diff) by [ZauberNerd](https://github.com/ZauberNerd) @@ -284,8 +313,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](dojo/dojo.d.ts) [Dojo](http://dojotoolkit.org) by [Michael Van Sickle](https://github.com/vansimke) * [:link:](dompurify/dompurify.d.ts) [DOM Purify](https://github.com/cure53/DOMPurify) by [Dave Taylor](http://davetayls.me), [Samira Bazuzi](https://github.com/bazuzi) * [:link:](domo/domo.d.ts) [Domo](http://domo-js.com) by [Steve Fenton](https://github.com/Steve-Fenton) -* [:link:](requirejs-domready/domready.d.ts) [domReady](https://github.com/requirejs/domReady) by [Nobuhiro Nakamura](https://github.com/lefb766) * [:link:](domready/domready.d.ts) [domready](https://github.com/ded/domready) by [Christian Holm Nielsen](https://github.com/dotnetnerd) +* [:link:](requirejs-domready/domready.d.ts) [domReady](https://github.com/requirejs/domReady) by [Nobuhiro Nakamura](https://github.com/lefb766) * [:link:](donna/donna.d.ts) [donna](https://github.com/atom/donna) by [vvakame](https://github.com/vvakame) * [:link:](dot/dot.d.ts) [doT](https://github.com/olado/doT) by [ZombieHunter](https://github.com/ZombieHunter) * [:link:](dot-case/dot-case.d.ts) [dot-case](https://github.com/blakeembrey/dot-case) by [Sam Saint-Pettersen](https://github.com/stpettersens) @@ -305,8 +334,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](easy-jsend/easy-jsend.d.ts) [easy-jsend](https://github.com/DeadAlready/easy-jsend) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easy-session/easy-session.d.ts) [easy-session](https://github.com/DeadAlready/node-easy-session) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easy-table/easy-table.d.ts) [easy-table](https://github.com/eldargab/easy-table) by [Niklas Mollenhauer](https://github.com/nikeee) -* [:link:](easy-xapi-supertest/easy-xapi-supertest.d.ts) [easy-x-headers](https://github.com/DeadAlready/easy-x-headers) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easy-x-headers/easy-x-headers.d.ts) [easy-x-headers](https://github.com/DeadAlready/easy-x-headers) by [Karl Düüna](https://github.com/DeadAlready) +* [:link:](easy-xapi-supertest/easy-xapi-supertest.d.ts) [easy-x-headers](https://github.com/DeadAlready/easy-x-headers) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easy-xapi/easy-xapi.d.ts) [easy-xapi](https://github.com/DeadAlready/easy-xapi) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easy-xapi-utils/easy-xapi-utils.d.ts) [easy-xapi-utils](https://github.com/DeadAlready/easy-xapi-utils) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easystarjs/easystarjs.d.ts) [EasyStar.js](http://easystarjs.com) by [Magnus Gustafsson](https://github.com/borundin) @@ -314,17 +343,20 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000) * [:link:](ejs/ejs.d.ts) [ejs.js](http://ejs.co) by [Ben Liddicott](https://github.com/benliddicott/DefinitelyTyped) * [:link:](jquery.elang/jquery.elang.d.ts) [eLang](https://github.com/sumegizoltan/ELang) by [Zoltan Sumegi](https://github.com/sumegizoltan) -* [:link:](github-electron/github-electron.d.ts) [Electron (shared between main and rederer processes)](http://electron.atom.io) by [jedmao](https://github.com/jedmao) +* [:link:](github-electron/github-electron.d.ts) [Electron](http://electron.atom.io) by [jedmao](https://github.com/jedmao), [rhysd](https://rhysd.github.io) * [:link:](electron-builder/electron-builder.d.ts) [electron-builder](https://github.com/loopline-systems/electron-builder) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](electron-packager/electron-packager.d.ts) [electron-packager](https://github.com/maxogden/electron-packager) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](github-electron/electron-prebuilt.d.ts) [electron-prebuilt](https://github.com/mafintosh/electron-prebuilt) by [rhysd](https://github.com/rhysd) * [:link:](element-resize-event/element-resize-event.d.ts) [element-resize-event](https://github.com/KyleAMathews/element-resize-event) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](elm/elm.d.ts) [Elm](http://elm-lang.org) by [Dénes Harmath](https://github.com/thSoft) +* [:link:](email-addresses/email-addresses.d.ts) [email-addresses](https://github.com/jackbowman/email-addresses) by [John Grimsey](https://github.com/johngrimsey) +* [:link:](email-validator/email-validator.d.ts) [email-validator](https://github.com/Sembiance/email-validator) by [Paul Lessing](https://github.com/paullessing) * [:link:](ember/ember.d.ts) [Ember.js](http://emberjs.com) by [Jed Mao](https://github.com/jedmao) * [:link:](emissary/emissary.d.ts) [emissary](https://github.com/atom/emissary) by [vvakame](https://github.com/vvakame) * [:link:](empower/empower.d.ts) [empower](https://github.com/twada/empower) by [vvakame](https://github.com/vvakame) * [:link:](emscripten/emscripten.d.ts) [Emscripten](http://kripken.github.io/emscripten-site/index.html) by [Kensuke Matsuzaki](https://github.com/zakki) * [:link:](envify/envify.d.ts) [envify](https://github.com/hughsk/envify) by [Qubo](https://github.com/tkQubo) +* [:link:](enzyme/enzyme.d.ts) [Enzyme](https://github.com/airbnb/enzyme) by [Marian Palkus](https://github.com/MarianPalkus), [Cap3](http://www.cap3.de) * [:link:](epiceditor/epiceditor.d.ts) [EpicEditor](http://epiceditor.com) by [Boris Yankov](https://github.com/borisyankov) * [:link:](eq.js/eq.js.d.ts) [eq.js](https://github.com/Snugug/eq.js) by [Stephen Lautier](https://github.com/stephenlautier) * [:link:](errorhandler/errorhandler.d.ts) [errorhandler](https://github.com/expressjs/errorhandler) by [Santi Albo](https://github.com/santialbo) @@ -338,12 +370,14 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](event-kit/event-kit.d.ts) [event-kit](https://github.com/atom/event-kit) by [Vadim Macagon](https://github.com/enlight) * [:link:](event-loop-lag/event-loop-lag.d.ts) [event-loop-lag](https://github.com/pebble/event-loop-lag) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](eventemitter2/eventemitter2.d.ts) [EventEmitter2](https://github.com/asyncly/EventEmitter2) by [ryiwamoto](https://github.com/ryiwamoto) -* [:link:](eventemitter3/eventemitter3.d.ts) [EventEmitter3](https://github.com/primus/eventemitter3) by [Yuichi Murata](https://github.com/mrk21) +* [:link:](eventemitter3/eventemitter3.d.ts) [EventEmitter3](https://github.com/primus/eventemitter3) by [Yuichi Murata](https://github.com/mrk21), [Leon Yu](https://github.com/leonyu) * [:link:](evernote/evernote.d.ts) [evernote v](https://www.npmjs.com/package/evernote) by [Zachary Collins](https://github.com/corps) * [:link:](exit/exit.d.ts) [exit](https://github.com/cowboy/node-exit) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](expect.js/expect.js.d.ts) [expect.js](https://github.com/Automattic/expect.js) by [Teppei Sato](https://github.com/teppeis) * [:link:](expectations/expectations.d.ts) [expectations.js](https://github.com/spmason/expectations) by [vvakame](https://github.com/vvakame) * [:link:](express/express.d.ts) [Express 4.x](http://expressjs.com) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](express-brute/express-brute.d.ts) [express-brute](https://github.com/AdamPflug/express-brute) by [Cyril Schumacher](https://github.com/cyrilschumacher) +* [:link:](express-brute-mongo/express-brute-mongo.d.ts) [express-brute-mongo](https://github.com/auth0/express-brute-mongo) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](express-debug/express-debug.d.ts) [express-debug](https://github.com/devoidfury/express-debug) by [Federico Bond](https://github.com/federicobond) * [:link:](express-handlebars/express-handlebars.d.ts) [express-handlebars](https://github.com/ericf/express-handlebars) by [Sam Saint-Pettersen](https://github.com/stpettersens) * [:link:](express-jwt/express-jwt.d.ts) [express-jwt](https://www.npmjs.org/package/express-jwt) by [Wonshik Kim](https://github.com/wokim) @@ -359,6 +393,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](eyes/eyes.d.ts) [eyes](https://github.com/cloudhead/eyes.js) by [bryn austin bellomy](https://github.com/brynbellomy) * [:link:](fabricjs/fabricjs.d.ts) [FabricJS](http://fabricjs.com) by [Oliver Klemencic](https://github.com/oklemencic), [Joseph Livecchi](https://github.com/joewashear007), [Michael Randolph](https://github.com/mrand01) * [:link:](fbsdk/fbsdk.d.ts) [Facebook Javascript SDK](https://developers.facebook.com/docs/javascript) by [Joshua Strobl](https://github.com/JoshStrobl) +* [:link:](fbemitter/fbemitter.d.ts) [Facebook's EventEmitter](https://github.com/facebook/emitter) by [kmxz](https://github.com/kmxz) * [:link:](faker/faker.d.ts) [faker](http://marak.com/faker.js) by [Bas Pennings](https://github.com/basp), [Yuki Kokubun](https://github.com/Kuniwak) * [:link:](famous/famous.d.ts) [Famous Engine](http://famous.org) by [Boris Vasilenko](https://github.com/borisvasilenko) * [:link:](fancybox/fancybox.d.ts) [fancyBox](https://github.com/fancyapps/fancyBox) by [Boris Yankov](https://github.com/borisyankov) @@ -370,6 +405,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](whatwg-fetch/whatwg-fetch.d.ts) [fetch API](https://github.com/github/fetch) by [Ryan Graham](https://github.com/ryan-codingintrigue) * [:link:](fhir/fhir.d.ts) [FHIR DSTU2](http://www.hl7.org/fhir/2015Sep/index.html) by [Artifact Health](http://www.artifacthealth.com) * [:link:](fibers/fibers.d.ts) [fibers](https://github.com/laverdet/node-fibers) by [Carlos Ballesteros Velasco](https://github.com/soywiz) +* [:link:](field/field.d.ts) [field](https://www.npmjs.com/package/field) by [Leo Liang](https://github.com/aleung/DefinitelyTyped) * [:link:](filewriter/filewriter.d.ts) [File API: Writer](http://www.w3.org/TR/file-writer-api) by [Kon](http://phyzkit.net) * [:link:](filesystem/filesystem.d.ts) [File System API](http://www.w3.org/TR/file-system-api) by [Kon](http://phyzkit.net) * [:link:](file-url/file-url.d.ts) [file-url](https://github.com/sindresorhus/file-url) by [MEDIA CHECK s.r.o.](http://www.mediacheck.cz) @@ -383,7 +419,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](firebase-client/firebase-client.d.ts) [Firebase Client](https://www.github.com/jpstevens/firebase-client) by [Andrew Breen](https://github.com/fpsscarecrow) * [:link:](firebase/firebase-simplelogin.d.ts) [Firebase Simple Login](https://www.firebase.com/docs/security/simple-login-overview.html) by [Wilker Lucio](http://github.com/wilkerlucio) * [:link:](first-mate/first-mate.d.ts) [first-mate](https://github.com/atom/first-mate) by [Vadim Macagon](https://github.com/enlight) -* [:link:](fixed-data-table/fixed-data-table.d.ts) [fixed-data-table](https://github.com/facebook/fixed-data-table) by [Petar Paar](https://github.com/pepaar) +* [:link:](fixed-data-table/fixed-data-table.d.ts) [fixed-data-table](https://github.com/facebook/fixed-data-table) by [Petar Paar](https://github.com/pepaar), [Stephen Jelfs](https://github.com/stephenjelfs) * [:link:](flake-idgen/flake-idgen.d.ts) [flakge-idgen](https://github.com/T-PWK/flake-idgen) by [Yuce Tekol](http://yuce.me) * [:link:](flat/flat.d.ts) [flat](https://github.com/hughsk/flat) by [Ilya Mochalov](https://github.com/chrootsu) * [:link:](flexSlider/flexSlider.d.ts) [FlexSlider 2 jquery plugin](https://github.com/woothemes/FlexSlider) by [Diullei Gomes](https://github.com/diullei) @@ -391,19 +427,20 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](flipsnap/flipsnap.d.ts) [flipsnap.js](http://pxgrid.github.io/js-flipsnap) by [kubosho](https://github.com/kubosho), [gsino](https://github.com/gsino), [Mayuki Sawatari](https://github.com/mayuki) * [:link:](flot/jquery.flot.d.ts) [Flot](http://www.flotcharts.org) by [Matt Burland](https://github.com/burlandm) * [:link:](flowjs/flowjs.d.ts) [flowjs](https://github.com/flowjs/flow.js) by [Ryan McNamara](https://github.com/ryan10132) -* [:link:](flux/flux.d.ts) [Flux](http://facebook.github.io/flux) by [Steve Baker](https://github.com/stkb) +* [:link:](flux/flux.d.ts) [Flux](http://facebook.github.io/flux) by [Steve Baker](https://github.com/stkb), [Giedrius Grabauskas](https://github.com/QuatroDevOfficial) * [:link:](flux-standard-action/flux-standard-action.d.ts) [flux-standard-action](https://github.com/acdlite/flux-standard-action) by [Qubo](https://github.com/tkqubo) * [:link:](fluxxor/fluxxor.d.ts) [Fluxxor](https://github.com/BinaryMuse/fluxxor) by [Yuichi Murata](https://github.com/mrk21) * [:link:](fontoxml/fontoxml.d.ts) [FontoXML](http://www.fontoxml.com) by [Roland Zwaga](https://github.com/rolandzwaga) * [:link:](ion.rangeSlider/ion.rangeSlider.d.ts) [for Ion.RangeSlider](https://github.com/IonDen/ion.rangeSlider) by [Sixin Li](https://github.com/sixinli) +* [:link:](jee-jsf/jsf.d.ts) [for the JSF 2.0 Ajax request API](https://docs.oracle.com/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/js-api/symbols/jsf.ajax.html) by [Lars Michaelis and Stephan Zerhusen](https://github.com/ButterFaces/ButterFaces) * [:link:](forge-di/forge-di.d.ts) [forge-di](https://github.com/nkohari/forge) by [Adam Carr](https://github.com/adamcarr) -* [:link:](form-data/form-data.d.ts) [form-data](https://github.com/felixge/node-form-data) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](formidable/formidable.d.ts) [Formidable](https://github.com/felixge/node-formidable) by [Wim Looman](https://github.com/Nemo157) * [:link:](foundation/foundation.d.ts) [Foundation](http://foundation.zurb.com) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](foundation-sites/foundation-sites.d.ts) [Foundation Sites](http://foundation.zurb.com) by [Sam Vloeberghs](https://github.com/samvloeberghs) * [:link:](fpsmeter/FPSMeter.d.ts) [FPSmeter](http://darsa.in/fpsmeter) by [Aaron Lampros](http://github.com/alampros) -* [:link:](freedom/freedom-core-env.d.ts) [freedom](https://github.com/freedomjs/freedom) by [Jonathan Pevarnek](https://github.com/jpevarnek) * [:link:](freedom/freedom-module-env.d.ts) [freedom](https://github.com/freedomjs/freedom) by [Jonathan Pevarnek](https://github.com/jpevarnek) * [:link:](freedom/freedom.d.ts) [freedom](https://github.com/freedomjs/freedom) by [Jonathan Pevarnek](https://github.com/jpevarnek) +* [:link:](freedom/freedom-core-env.d.ts) [freedom](https://github.com/freedomjs/freedom) by [Jonathan Pevarnek](https://github.com/jpevarnek) * [:link:](from/from.d.ts) [from](https://github.com/dominictarr/from) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](fs-ext/fs-ext.d.ts) [fs-ext](https://github.com/baudehlo/node-fs-ext) by [Oguzhan Ergin](https://github.com/OguzhanE) * [:link:](fs-extra/fs-extra.d.ts) [fs-extra](https://github.com/jprichardson/node-fs-extra) by [midknight41](https://github.com/midknight41) @@ -413,6 +450,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](ftp/ftp.d.ts) [ftp](https://github.com/mscdex/node-ftp) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](ftpd/ftpd.d.ts) [ftpd](https://github.com/sstur/nodeftpd) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](fullCalendar/fullCalendar.d.ts) [FullCalendar](http://arshaw.com/fullcalendar) by [Neil Stalker](https://github.com/nestalk), [Marcelo Camargo](https://github.com/hasellcamargo) +* [:link:](fullname/fullname.d.ts) [fullname](https://www.npmjs.com/package/fullname) by [Klaus Reimer](https://github.com/kayahr) * [:link:](fuse/fuse.d.ts) [Fuse.js](https://github.com/krisk/Fuse) by [Greg Smith](https://github.com/smrq) * [:link:](jquery-galleria/jquery-galleria.d.ts) [galleria.js](https://github.com/aino/galleria) by [Robert Imig](https://github.com/rimig) * [:link:](gamepad/gamepad.d.ts) [Gamepad API](http://www.w3.org/TR/gamepad) by [Kon](http://phyzkit.net) @@ -434,33 +472,33 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](goJS/goJS.d.ts) [GoJS](http://gojs.net) by [Northwoods Software](https://github.com/NorthwoodsSoftware) * [:link:](google.analytics/ga.d.ts) [Google Analytics (Classic and Universal)](https://developers.google.com/analytics/devguides/collection/gajs) by [Ronnie Haakon Hegelund](http://ronniehegelund.blogspot.dk), [Pat Kujawa](http://patkujawa.com) * [:link:](gapi/gapi.d.ts) [Google API Client](https://code.google.com/p/google-api-javascript-client) by [Frank M](https://github.com/sgtfrankieboy) -* [:link:](google-apps-script/google-apps-script.html.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.groups.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.gmail.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.calendar.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.script.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.properties.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.maps.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.url-fetch.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.optimization.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.ui.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.forms.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.document.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.content.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.mail.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.drive.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.types.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.spreadsheet.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.lock.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.sites.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.groups.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.xml-service.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.sites.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.utilities.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.language.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.jdbc.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.html.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.optimization.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.url-fetch.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.properties.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.ui.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.maps.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.mail.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.lock.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.language.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.types.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.base.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.cache.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.calendar.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.spreadsheet.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.charts.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.contacts.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.content.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.document.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.drive.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.forms.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.gmail.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google.feeds/google.feed.api.d.ts) [Google Feed Apis](https://developers.google.com/feed) by [RodneyJT](https://github.com/RodneyJT) * [:link:](google.geolocation/google.geolocation.d.ts) [Google Geolocation](https://code.google.com/p/geo-location-javascript) by [Vincent Bortone](https://github.com/vbortone) * [:link:](googlemaps/google.maps.d.ts) [Google Maps JavaScript API](https://developers.google.com/maps) by [Folia A/S](http://www.folia.dk), [Chris Wrench](https://github.com/cgwrench) @@ -472,6 +510,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](gapi.translate/gapi.translate.d.ts) [Google Translate API](https://developers.google.com/translate) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](gapi.urlshortener/gapi.urlshortener.d.ts) [Google Url Shortener API](https://developers.google.com/url-shortener) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](google.visualization/google.visualization.d.ts) [Google Visualisation Apis](https://developers.google.com/chart) by [Dan Ludwig](https://github.com/danludwig) +* [:link:](google-maps/google-maps.d.ts) [google-maps](https://www.npmjs.com/package/google-maps) by [Deividas Bakanas](https://github.com/DeividasBakanas), [Giedrius Grabauskas](https://github.com/GiedriusGrabauskas) * [:link:](gae.channel.api/gae.channel.api.d.ts) [GoogleAppEngine's Channel API](https://developers.google.com/appengine/docs/java/channel/javascript) by [vvakame](https://github.com/vvakame) * [:link:](graceful-fs/graceful-fs.d.ts) [graceful-fs](https://github.com/cowboy/graceful-fs) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](graham_scan/graham_scan.d.ts) [graham_scan](https://github.com/brian3kb/graham_scan_js) by [Harm Berntsen](https://github.com/hberntsen) @@ -486,6 +525,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](gsap/TweenLite.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gulp/gulp.d.ts) [Gulp v3.8.x](http://gulpjs.com) by [Drew Noakes](https://drewnoakes.com) * [:link:](gulp-autoprefixer/gulp-autoprefixer.d.ts) [gulp-autoprefixer](https://github.com/sindresorhus/gulp-autoprefixer) by [Asana](https://asana.com) +* [:link:](gulp-babel/gulp-babel.d.ts) [gulp-babel](https://github.com/babel/gulp-babel) by [Aya Morisawa](https://github.com/AyaMorisawa) * [:link:](gulp-cached/gulp-cached.d.ts) [gulp-cached](https://github.com/wearefractal/gulp-cached) by [Thomas Corbière](https://github.com/tomc974) * [:link:](gulp-changed/gulp-changed.d.ts) [gulp-changed](https://github.com/sindresorhus/gulp-changed) by [Thomas Corbière](https://github.com/tomc974) * [:link:](gulp-cheerio/gulp-cheerio.d.ts) [gulp-cheerio](https://github.com/KenPowers/gulp-cheerio) by [Qubo](https://github.com/tkQubo) @@ -552,7 +592,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](highland/highland.d.ts) [Highland](http://highlandjs.org) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](highlightjs/highlightjs.d.ts) [highlight.js](https://github.com/isagalaev/highlight.js) by [Niklas Mollenhauer](https://github.com/nikeee), [Jeremy Hull](https://github.com/sourrust) * [:link:](highcharts/highstock.d.ts) [Highstock](http://www.highcharts.com) by [David Deutsch](http://github.com/DavidKDeutsch) +* [:link:](react-router/history.d.ts) [history](https://github.com/rackt/history) by [Sergey Buturlakin](http://github.com/sergey-buturlakin) * [:link:](history/history.d.ts) [History.js](https://github.com/browserstate/history.js) by [Boris Yankov](https://github.com/borisyankov), [Gidon Junge](https://github.com/gjunge) +* [:link:](hopscotch/hopscotch.d.ts) [Hopscotch](http://linkedin.github.io/hopscotch) by [Tim Perry](https://github.com/pimterry) * [:link:](howlerjs/howler.d.ts) [howler.js](https://github.com/goldfire/howler.js) by [Pedro Casaubon](https://github.com/xperiments) * [:link:](touch-events/touch-events.d.ts) [HTML Touch Events](http://www.w3.org/TR/touch-events) by [Kevin Barabash](https://github.com/kevinb7) * [:link:](html-to-text/html-to-text.d.ts) [html-to-text](https://github.com/werk85/node-html-to-text) by [Eryk Warren](https://github.com/erykwarren) @@ -566,9 +608,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](humane/humane.d.ts) [Humane](http://wavded.github.com/humane-js) by [jmvrbanac](https://github.com/jmvrbanac) * [:link:](hypertext-application-language/hypertext-application-language.d.ts) [Hypertext Application Language Draft 6](https://tools.ietf.org/html/draft-kelly-json-hal-06) by [Maks3w](https://github.com/maks3w) * [:link:](i18n-node/i18n-node.d.ts) [i18n-node](https://github.com/mashpie/i18n-node) by [Maxime LUCE](https://github.com/SomaticIT) -* [:link:](ng-i18next/ng-i18next.d.ts) [i18next](https://github.com/i18next/ng-i18next) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](i18next/i18next.d.ts) [i18next](http://i18next.com) by [Maarten Docter](https://github.com/mdocter) +* [:link:](ng-i18next/ng-i18next.d.ts) [i18next](https://github.com/i18next/ng-i18next) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](iban/iban.d.ts) [iban.js](https://github.com/arhs/iban.js) by [Cyril Schumacher](https://github.com/cyrilschumacher) +* [:link:](icepick/icepick.d.ts) [icepick](https://github.com/aearly/icepick) by [Nathan Brown](https://github.com/ngbrown) * [:link:](icheck/icheck.d.ts) [iCheck](http://damirfoy.com/iCheck) by [Dániel Tar](https://github.com/qcz) * [:link:](imagemagick/imagemagick.d.ts) [imagemagick](http://github.com/rsms/node-imagemagick) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](imagemagick-native/imagemagick-native.d.ts) [imagemagick-native](https://www.npmjs.org/package/imagemagick-native) by [Hiroki Horiuchi](https://github.com/horiuchi) @@ -578,6 +621,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](impress/impress.d.ts) [Impress.js](https://github.com/bartaz/impress.js) by [Boris Yankov](https://github.com/borisyankov) * [:link:](incremental-dom/incremental-dom.d.ts) [Incremetal DOM](https://github.com/google/incremental-dom) by [Basarat Ali Syed](https://github.com/basarat) * [:link:](inflection/inflection.d.ts) [inflection](https://github.com/dreamerslab/node.inflection) by [Shogo Iwano](https://github.com/shiwano) +* [:link:](inherits/inherits.d.ts) [inherits](https://github.com/isaacs/inherits) by [Ilya Mochalov](https://github.com/chrootsu) * [:link:](ini/ini.d.ts) [ini](https://github.com/isaacs/ini) by [Marcin Porębski](https://github.com/marcinporebski) * [:link:](iniparser/iniparser.d.ts) [iniparser](https://github.com/shockie/node-iniparser) by [Ilya Mochalov](https://github.com/chrootsu) * [:link:](inline-css/inline-css.d.ts) [inline-css](https://github.com/jonkemp/inline-css) by [Philip Spain](https://github.com/philipisapain) @@ -598,6 +642,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](iscroll/iscroll-lite.d.ts) [iScroll Lite](http://cubiq.org/iscroll-4) by [Boris Yankov](https://github.com/borisyankov), [Christiaan Rakowski](https://github.com/csrakowski) * [:link:](iscroll/iscroll-5-lite.d.ts) [iScroll Lite 5](http://cubiq.org/iscroll-5-ready-for-beta-test) by [Christiaan Rakowski](https://github.com/csrakowski) * [:link:](iso8601-localizer/iso8601-localizer.d.ts) [ISO8601-Localizer](https://github.com/avielfedida/ISO8601-Localizer) by [Aviel Fedida](https://github.com/avielfedida) +* [:link:](istanbul/istanbul.d.ts) [Istanbul](https://github.com/gotwarlost/istanbul) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](ix.js/ix.d.ts) [IxJS 1.0.6 / ix.js](https://github.com/Reactive-Extensions/IxJS) by [Igor Oleinikov](https://github.com/Igorbek) * [:link:](ix.js/l2o.d.ts) [IxJS 1.0.6 / l2o.js](https://github.com/Reactive-Extensions/IxJS) by [Igor Oleinikov](https://github.com/Igorbek) * [:link:](jade/jade.d.ts) [jade](https://github.com/jadejs/jade) by [Panu Horsmalahti](https://github.com/panuhorsmalahti) @@ -606,6 +651,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jasmine-data_driven_tests/jasmine-data_driven_tests.d.ts) [Jasmine Data Driven Tests](https://github.com/gburghardt/jasmine-data_driven_tests) by [Anthony MacKinnon](https://github.com/AnthonyMacKinnon) * [:link:](jasmine-ajax/jasmine-ajax.d.ts) [jasmine-ajax](https://github.com/jasmine/jasmine-ajax) by [Louis Grignon](https://github.com/lgrignon) * [:link:](jasmine-es6-promise-matchers/jasmine-es6-promise-matchers.d.ts) [jasmine-es6-promise-matchers](https://github.com/bvaughn/jasmine-es6-promise-matchers) by [Stephen Lautier](https://github.com/stephenlautier) +* [:link:](jasmine-expect/jasmine-expect.d.ts) [jasmine-expect](https://github.com/JamieMason/Jasmine-Matchers) by [UserPixel](https://github.com/UserPixel) * [:link:](jasmine-fixture/jasmine-fixture.d.ts) [Jasmine-fixture](https://github.com/searls/jasmine-fixture) by [Craig Brett](https://github.com/craigbrett17) * [:link:](jasmine-jquery/jasmine-jquery.d.ts) [Jasmine-JQuery](https://github.com/velesin/jasmine-jquery) by [Gregor Stamac](https://github.com/gstamac) * [:link:](jasmine-matchers/jasmine-matchers.d.ts) [jasmine-matchers](https://github.com/uxebu/jasmine-matchers) by [Bart van der Schoor](https://github.com/Bartvds) @@ -614,6 +660,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](java-applet/java-applet.d.ts) [Java Applet](https://www.java.com) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](hooker/hooker.d.ts) [JavaScript Hooker](https://github.com/cowboy/javascript-hooker) by [Michael Zabka](https://github.com/misak113) * [:link:](oauth.js/oauth.js.d.ts) [JavaScript software for implementing an OAuth consumer](https://code.google.com/p/oauth) by [NOBUOKA Yu](https://github.com/nobuoka) +* [:link:](javascript-bignum/javascript-bignum.d.ts) [javascript-bignum](https://github.com/jtobey/javascript-bignum) by [Nathan Shively-Sanders](https://github.com/sandersn) * [:link:](jbinary/jbinary.d.ts) [jBinary](https://github.com/jDataView/jBinary) by [Tim Bureck](https://github.com/tbureck) * [:link:](jdataview/jdataview.d.ts) [jDataView](https://github.com/jDataView/jDataView) by [Ingvar Stepanyan](https://github.com/RReverser) * [:link:](jest/jest.d.ts) [Jest](http://facebook.github.io/jest) by [Asana](https://asana.com) @@ -621,7 +668,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jjve/jjve.d.ts) [JJVE](https://github.com/silas/jjve) by [Wim Looman](https://github.com/Nemo157) * [:link:](joData/joData.d.ts) [joData](https://github.com/mccow002/joData) by [Chris Wrench](https://github.com/cgwrench) * [:link:](johnny-five/johnny-five.d.ts) [johnny-five](https://github.com/rwaldron/johnny-five) by [Toshiya Nakakura](https://github.com/nakakura) -* [:link:](joi/joi.d.ts) [joi](https://github.com/spumko/joi) by [Bart van der Schoor](https://github.com/Bartvds), [Laurence Dougal Myers](https://github.com/laurence-myers), [Christopher Glantschnig](https://github.com/cglantschnig) +* [:link:](joi/joi.d.ts) [joi](https://github.com/spumko/joi) by [Bart van der Schoor](https://github.com/Bartvds), [Laurence Dougal Myers](https://github.com/laurence-myers), [Christopher Glantschnig](https://github.com/cglantschnig), [David Broder-Rodgers](https://github.com/DavidBR-SW) * [:link:](jointjs/jointjs.d.ts) [Joint JS](http://www.jointjs.com) by [Aidan Reel](http://github.com/areel), [David Durman](http://github.com/DavidDurman), [Ewout Van Gossum](https://github.com/DenEwout) * [:link:](jqrangeslider/jqrangeslider.d.ts) [jQRangeSlider](http://ghusse.github.com/jQRangeSlider) by [Dániel Tar](https://github.com/qcz) * [:link:](jquery/jquery.d.ts) [jQuery 1.10.x / 2.0.x](http://jquery.com) by [Boris Yankov](https://github.com/borisyankov), [Christian Hoffmeister](https://github.com/choffmeister), [Steve Fenton](https://github.com/Steve-Fenton), [Diullei Gomes](https://github.com/Diullei), [Tass Iliopoulos](https://github.com/tasoili), [Jason Swearingen](https://github.com/jasons-novaleaf), [Sean Hill](https://github.com/seanski), [Guus Goossens](https://github.com/Guuz), [Kelly Summerlin](https://github.com/ksummerlin), [Basarat Ali Syed](https://github.com/basarat), [Nicholas Wolverson](https://github.com/nwolverson), [Derek Cicerone](https://github.com/derekcicerone), [Andrew Gaspar](https://github.com/AndrewGaspar), [James Harrison Fisher](https://github.com/jameshfisher), [Seikichi Kondo](https://github.com/seikichi), [Benjamin Jackman](https://github.com/benjaminjackman), [Poul Sorensen](https://github.com/s093294), [Josh Strobl](https://github.com/JoshStrobl), [John Reilly](https://github.com/johnnyreilly), [Dick van den Brink](https://github.com/DickvdBrink) @@ -637,6 +684,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.joyride/jquery.joyride.d.ts) [jQuery JoyRide Plugin](https://github.com/zurb/joyride) by [Vincent Bortone](https://github.com/vbortone) * [:link:](jqgrid/jqgrid.d.ts) [jQuery jqgrid Plugin](https://github.com/tonytomov/jqGrid) by [Lokesh Peta](https://github.com/lokeshpeta) * [:link:](jquery-knob/jquery-knob.d.ts) [jQuery Knob](http://anthonyterrien.com/knob) by [Iain Buchanan](https://github.com/iain8) +* [:link:](jquery.mmenu/jquery.mmenu.d.ts) [jQuery mmenu](http://mmenu.frebsite.nl) by [John Gouigouix](https://github.com/orchestra-ts/DefinitelyTyped) * [:link:](jquerymobile/jquerymobile.d.ts) [jQuery Mobile](http://jquerymobile.com) by [Boris Yankov](https://github.com/borisyankov) * [:link:](jquery.notifyBar/jquery.notifyBar.d.ts) [jQuery Notify Bar](http://www.whoop.ee/posts/2013-04-05-the-resurrection-of-jquery-notify-bar) by [Shunsuke Ohtani](https://github.com/zaneli) * [:link:](jquery.base64/jquery.base64.d.ts) [jQuery Plugin - base64 codec](https://github.com/yatt/jquery.base64) by [Shinya Mochizuki](https://github.com/enrapt-mochizuki) @@ -688,6 +736,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.placeholder/jquery.placeholder.d.ts) [jquery.placeholder.js](https://github.com/mathiasbynens/jquery-placeholder) by [Peter Gill](https://github.com/majorsilence), [Neil Culver](https://github.com/EnableSoftware) * [:link:](jquery.pnotify/jquery.pnotify.d.ts) [jquery.pnotify 2.x](https://github.com/sciactive/pnotify) by [David Sichau](https://github.com/DavidSichau) * [:link:](jquery.qrcode/jquery.qrcode.d.ts) [jQuery.qrcode](https://github.com/lrsjng/jquery-qrcode) by [Dan Manastireanu](https://github.com/danmana) +* [:link:](raty/raty.d.ts) [jQuery.raty](https://github.com/wbotelhos/raty) by [Matt Wheatley](http://github.com/terrawheat) * [:link:](jquery.scrollTo/jquery.scrollTo.d.ts) [jQuery.scrollTo.js](https://github.com/flesler/jquery.scrollTo) by [Neil Stalker](https://github.com/nestalk) * [:link:](form-serializer/form-serializer.d.ts) [jquery.serialize-object](https://github.com/macek/jquery-serialize-object) by [Florian Wagner](https://github.com/flqw) * [:link:](jquery.simulate/jquery.simulate.d.ts) [jquery.simulate.js](https://github.com/jquery/jquery-simulate) by [Derek Cicerone](https://github.com/derekcicerone) @@ -704,8 +753,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.total-storage/jquery.total-storage.d.ts) [jQueryTotalStorage](https://github.com/Upstatement/jquery-total-storage) by [Jeremy Brooks](https://github.com/JeremyCBrooks) * [:link:](jqueryui/jqueryui.d.ts) [jQueryUI](http://jqueryui.com) by [Boris Yankov](https://github.com/borisyankov), [John Reilly](https://github.com/johnnyreilly) * [:link:](js-beautify/js-beautify.d.ts) [js_beautify](https://github.com/beautify-web/js-beautify) by [Josh Goldberg](https://github.com/JoshuaKGoldberg) -* [:link:](js-cookie/js-cookie.d.ts) [js-cookie](https://github.com/js-cookie/js-cookie) by [Theodore Brown](https://github.com/theodorejb) +* [:link:](js-combinatorics/js-combinatorics.d.ts) [js-combinatorics](https://github.com/dankogai/js-combinatorics) by [Vasya Aksyonov](https://github.com/outring) +* [:link:](js-combinatorics/js-combinatorics-global.d.ts) [js-combinatorics (global)](https://github.com/dankogai/js-combinatorics) by [Vasya Aksyonov](https://github.com/outring) * [:link:](ua-parser-js/ua-parser-js.d.ts) [js-cookie](https://github.com/faisalman/ua-parser-js) by [Viktor Miroshnikov](https://github.com/superduper) +* [:link:](js-cookie/js-cookie.d.ts) [js-cookie](https://github.com/js-cookie/js-cookie) by [Theodore Brown](https://github.com/theodorejb) * [:link:](js-fixtures/fixtures.d.ts) [js-fixtures](https://github.com/badunk/js-fixtures) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid) * [:link:](js-git/js-git.d.ts) [js-git](https://github.com/creationix/js-git) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](js-md5/md5.d.ts) [js-md5](https://github.com/emn178/js-md5) by [Roland Greim](https://github.com/tigerxy) @@ -736,17 +787,20 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jsonwebtoken/jsonwebtoken.d.ts) [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](jsplumb/jquery.jsPlumb.d.ts) [jsPlumb 1.3.16 jQuery adapter](http://jsplumb.org) by [Steve Shearn](https://github.com/shearnie) * [:link:](jsrender/jsrender.d.ts) [JsRender](http://www.jsviews.com/#jsrender) by [Kensuke Matsuzaki](https://github.com/zakki) -* [:link:](jssha/jssha.d.ts) [jsSHA](https://github.com/Caligatio/jsSHA) by [David Li](https://github.com/randombk) +* [:link:](jssha/jssha.d.ts) [jsSHA](https://github.com/Caligatio/jsSHA) by [David Li](https://github.com/randombk), [Tobias Kahlert](https://github.com/SrTobi) * [:link:](jstorage/jstorage.d.ts) [jStorage](http://www.jstorage.info) by [Danil Flores](https://github.com/dflor003) * [:link:](jstree/jstree.d.ts) [jsTree](http://www.jstree.com) by [Adam Pluciński](https://github.com/adaskothebeast) * [:link:](jsts/jsts.d.ts) [jsts](https://github.com/bjornharrtell/jsts) by [Stephane Alie](https://github.com/StephaneAlie) * [:link:](jsuri/jsuri.d.ts) [jsUri](https://github.com/derek-watson/jsUri) by [Chris Charabaruk](http://github.com/coldacid), [Florian Wagner](http://github.com/flqw) +* [:link:](jsurl/jsurl.d.ts) [jsurl](https://github.com/Mikhus/jsurl) by [Alexey Gorshkov](https://github.com/agorshkov23) * [:link:](jszip/jszip.d.ts) [JSZip](http://stuk.github.com/jszip) by [mzeiher](https://github.com/mzeiher) * [:link:](jug/jug.d.ts) [jug](https://github.com/kaiquewdev/Graph) by [yevt](https://github.com/yevt) * [:link:](jwplayer/jwplayer.d.ts) [JW Player](http://developer.longtailvideo.com/trac) by [Martin Duparc](https://github.com/martinduparc) +* [:link:](jwt-decode/jwt-decode.d.ts) [jwt-decode](https://github.com/auth0/jwt-decode) by [Giedrius Grabauskas](https://github.com/QuatroDevOfficial) * [:link:](jwt-simple/jwt-simple.d.ts) [jwt-simple](https://github.com/hokaccha/node-jwt-simple) by [Ken Fukuyama](https://github.com/kenfdev) * [:link:](kafka-node/kafka-node.d.ts) [kafka-node](https://github.com/SOHU-Co/kafka-node) by [Daniel Imrie-Situnayake](https://github.com/dansitu) * [:link:](karma/karma.d.ts) [karma](https://github.com/karma-runner/karma) by [Tanguy Krotoff](https://github.com/tkrotoff) +* [:link:](karma-coverage/karma-coverage.d.ts) [karma-coverage](https://github.com/karma-runner/karma-coverage) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](karma-jasmine/karma-jasmine.d.ts) [karma-jasmine plugin](https://github.com/karma-runner/karma-jasmine) by [Michel Salib](https://github.com/michelsalib) * [:link:](katex/katex.d.ts) [KaTeX v.0.5.0](http://khan.github.io/KaTeX) by [Michael Randolph](https://github.com/mrand01) * [:link:](kefir/kefir.d.ts) [Kefir](http://rpominov.github.io/kefir) by [Aya Morisawa](https://github.com/AyaMorisawa) @@ -754,6 +808,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](keyboardjs/keyboardjs.d.ts) [KeyboardJS](https://github.com/RobertWHurst/KeyboardJS) by [Vincent Bortone](https://github.com/vbortone) * [:link:](keymaster/keymaster.d.ts) [keymaster](https://github.com/madrobby/keymaster) by [Martin W. Kirst](https://github.com/nitram509) * [:link:](keypress/keypress.d.ts) [Keypress](https://github.com/dmauro/Keypress) by [Roger Chen](https://github.com/rcchen) +* [:link:](keytar/keytar.d.ts) [keytar](http://atom.github.io/node-keytar) by [Milan Burda](https://github.com/miniak) * [:link:](kii-cloud-sdk/kii-cloud-sdk.d.ts) [Kii Cloud SDK](http://en.kii.com) by [Kii Consortium](http://jp.kii.com/consortium) * [:link:](kineticjs/kineticjs.d.ts) [KineticJS](http://kineticjs.com) by [Basarat Ali Syed](http://www.github.com/basarat), [Ralph de Ruijter](http://www.superdopey.nl/techblog) * [:link:](knex/knex.d.ts) [Knex.js](https://github.com/tgriesser/knex) by [Qubo](https://github.com/tkQubo) @@ -792,9 +847,12 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](leapmotionTS/LeapMotionTS.d.ts) [Leap Motion TS](https://github.com/logotype/LeapMotionTS) by [Victor Norgren](https://github.com/logotype) * [:link:](less/less.d.ts) [LESS](http://lesscss.org) by [Tom Hasner](https://github.com/thasner) * [:link:](less-middleware/less-middleware.d.ts) [less-middleware](https://github.com/emberfeather/less.js-middleware) by [Federico Bond](https://github.com/federicobond) +* [:link:](lestate/lestate.d.ts) [LeState](https://github.com/LeTools/LeState) by [Hadrian Oliveira](https://github.com/thelambdaparty) * [:link:](level-sublevel/level-sublevel.d.ts) [level-sublevel](https://github.com/dominictarr/level-sublevel) by [Bas Pennings](https://github.com/basp) * [:link:](levelup/levelup.d.ts) [LevelUp](https://github.com/rvagg/node-levelup) by [Bret Little](https://github.com/blittle) * [:link:](libxmljs/libxmljs.d.ts) [Libxmljs](https://github.com/polotek/libxmljs) by [François de Campredon](https://github.com/fdecampredon) +* [:link:](lwip/lwip.d.ts) [Light-weight image processor](https://github.com/EyalAr/lwip) by [Aya Morisawa](https://github.com/AyaMorisawa) +* [:link:](lime-js/lime-js.d.ts) [lime-js](https://github.com/takenet/lime-js) by [Arthur Xavier](https://github.com/arthur-xavier) * [:link:](line-reader/line-reader.d.ts) [line-reader](https://github.com/nickewing/line-reader) by [Sam Saint-Pettersen](https://github.com/stpettersens) * [:link:](dustjs-linkedin/dustjs-linkedin.d.ts) [linkedin dustjs](https://github.com/linkedin/dustjs) by [Marcelo Dezem](http://github.com/mdezem) * [:link:](linq/linq.jquery.d.ts) [linq.jquery (from linq.js)](http://linqjs.codeplex.com) by [neuecc](http://www.codeplex.com/site/users/view/neuecc) @@ -802,6 +860,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](linqsharp/linqsharp.d.ts) [linqsharp](https://www.npmjs.com/package/linqsharp) by [Bruno Leonardo Michels](https://github.com/brunolm) * [:link:](jquery.livestampjs/jquery.livestampjs.d.ts) [Livestamp.js](http://mattbradley.github.com/livestampjs) by [Vincent Bortone](https://github.com/vbortone) * [:link:](lodash/lodash.d.ts) [Lo-Dash](http://lodash.com) by [Brian Zengel](https://github.com/bczengel), [Ilya Mochalov](https://github.com/chrootsu) +* [:link:](lobibox/lobibox.d.ts) [lobibox](https://github.com/arboshiki/lobibox) by [Sabeeh Ul Hussnain](https://github.com/itboy87) * [:link:](lockfile/lockfile.d.ts) [lockfile](https://github.com/isaacs/lockfile) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](lodash-decorators/lodash-decorators.d.ts) [lodash-decorators](https://github.com/steelsojka/lodash-decorators) by [Qubo](https://github.com/tkqubo) * [:link:](log4javascript/log4javascript.d.ts) [log4javascript](http://log4javascript.org) by [Markus Wagner](https://github.com/Ritzlgrmft) @@ -812,7 +871,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](logrotate-stream/logrotate-stream.d.ts) [logrotate-stream](https://github.com/dstokes/logrotate-stream) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](lokijs/lokijs.d.ts) [lokijs](https://github.com/techfort/LokiJS) by [TeamworkGuy2](https://github.com/TeamworkGuy2) * [:link:](lolex/lolex.d.ts) [lolex](https://github.com/sinonjs/lolex) by [Wim Looman](https://github.com/Nemo157) -* [:link:](long/long.d.ts) [Long.js](https://github.com/dcodeIO/Long.js) by [Peter Kooijmans](https://github.com/peterkooijmans) +* [:link:](long/long.d.ts) [long.js](https://github.com/dcodeIO/long.js) by [Peter Kooijmans](https://github.com/peterkooijmans) * [:link:](lory.js/lory.js.d.ts) [lory](https://github.com/meandmax/lory) by [kubosho](https://github.com/kubosho) * [:link:](lovefield/lovefield.d.ts) [Lovefield](http://google.github.io/lovefield) by [freshp86](https://github.com/freshp86) * [:link:](lower-case/lower-case.d.ts) [lower-case](https://github.com/blakeembrey/lower-case) by [Sam Saint-Pettersen](https://github.com/stpettersens) @@ -836,6 +895,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](mariasql/mariasql.d.ts) [mariasql](https://github.com/mscdex/node-mariasql) by [MichaelBennett](https://github.com/bennett000) * [:link:](marionette/marionette.d.ts) [Marionette](https://github.com/marionettejs) by [Zeeshan Hamid](https://github.com/zhamid), [Natan Vivo](https://github.com/nvivo), [Sven Tschui](https://github.com/sventschui) * [:link:](marked/marked.d.ts) [Marked](https://github.com/chjj/marked) by [William Orr](https://github.com/worr) +* [:link:](ngwysiwyg/ngwysiwyg.d.ts) [Marked](https://github.com/psergus/ngWYSIWYG) by [Patrick Mac Kay](https://github.com/patrick-mackay) * [:link:](markerclustererplus/markerclustererplus.d.ts) [MarkerClustererPlus for Google Maps V3](http://github.com/mahnunchik/markerclustererplus) by [Mathias Rodriguez](http://github.com/enanox) * [:link:](markitup/markitup.d.ts) [markitup 1.x](https://github.com/markitup/1.x) by [drillbits](https://github.com/drillbits) * [:link:](maskedinput/maskedinput.d.ts) [Masked Input plugin for jQuery](http://digitalbush.com/projects/masked-input-plugin) by [Lokesh Peta](https://github.com/lokeshpeta) @@ -881,21 +941,24 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](mixto/mixto.d.ts) [mixto](https://github.com/atom/mixto) by [vvakame](https://github.com/vvakame) * [:link:](mkdirp/mkdirp.d.ts) [mkdirp](http://github.com/substack/node-mkdirp) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](mkpath/mkpath.d.ts) [mkpath](https://www.npmjs.com/package/mkpath) by [Jared Klopper](https://github.com/optical) +* [:link:](mmmagic/mmmagic.d.ts) [mmmagic](https://github.com/mscdex/mmmagic) by [Andrei Sebastian Cîmpean](http://andreime.com) * [:link:](mobile-detect/mobile-detect.d.ts) [mobile-detect](http://hgoebl.github.io/mobile-detect.js) by [Martin McWhorter](https://github.com/martinmcwhorter) -* [:link:](mobservable-react/mobservable-react.d.ts) [mobservable](https://github.com/mweststrate/mobservable-react) by [Michel Weststrate](https://github.com/mweststrate) * [:link:](mobservable/mobservable.d.ts) [mobservable](https://mweststrate.github.io/mobservable) by [Michel Weststrate](https://github.com/mweststrate) +* [:link:](mobservable-react/mobservable-react.d.ts) [mobservable](https://github.com/mweststrate/mobservable-react) by [Michel Weststrate](https://github.com/mweststrate) * [:link:](mocha/mocha.d.ts) [mocha](http://mochajs.org) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid), [otiai10](https://github.com/otiai10), [jt000](https://github.com/jt000), [Vadim Macagon](https://github.com/enlight) * [:link:](mocha/mocha-node.d.ts) [mocha](http://mochajs.org) by [Vadim Macagon](https://github.com/enlight), [vvakame](https://github.com/vvakame) * [:link:](mocha-phantomjs/mocha-phantomjs.d.ts) [mocha-phantomjs](http://metaskills.net/mocha-phantomjs) by [Erik Schierboom](https://github.com/ErikSchierboom) * [:link:](mock-fs/mock-fs.d.ts) [mock-fs](https://github.com/tschaub/mock-fs) by [Wim Looman](https://github.com/Nemo157) * [:link:](mockery/mockery.d.ts) [mockery](https://github.com/mfncooper/mockery) by [jt000](https://github.com/jt000) -* [:link:](modernizr/modernizr.d.ts) [Modernizr](http://modernizr.com) by [Boris Yankov](https://github.com/borisyankov), [Theodore Brown](https://github.com/theodorejb) +* [:link:](modernizr/modernizr.d.ts) [Modernizr](http://modernizr.com) by [Boris Yankov](https://github.com/borisyankov), [Theodore Brown](https://github.com/theodorejb), [Leon Yu](https://github.com/leonyu) * [:link:](moment-timezone/moment-timezone.d.ts) [moment-timezone.js](http://momentjs.com/timezone) by [Michel Salib](https://github.com/michelsalib) -* [:link:](moment/moment.d.ts) [Moment.js](https://github.com/timrwood/moment) by [Michael Lakerveld](https://github.com/Lakerfield), [Aaron King](https://github.com/kingdango), [Hiroki Horiuchi](https://github.com/horiuchi), [Dick van den Brink](https://github.com/DickvdBrink), [Adi Dahiya](https://github.com/adidahiya), [Matt Brooks](https://github.com/EnableSoftware) -* [:link:](moment/moment-node.d.ts) [Moment.js](https://github.com/timrwood/moment) by [Michael Lakerveld](https://github.com/Lakerfield), [Aaron King](https://github.com/kingdango), [Hiroki Horiuchi](https://github.com/horiuchi), [Dick van den Brink](https://github.com/DickvdBrink), [Adi Dahiya](https://github.com/adidahiya), [Matt Brooks](https://github.com/EnableSoftware) * [:link:](moment-range/moment-range.d.ts) [Moment.js](https://github.com/gf3/moment-range) by [Bart van den Burg](https://github.com/Burgov), [Wilgert Velinga](https://github.com/wilgert) +* [:link:](moment/moment-node.d.ts) [Moment.js](https://github.com/timrwood/moment) by [Michael Lakerveld](https://github.com/Lakerfield), [Aaron King](https://github.com/kingdango), [Hiroki Horiuchi](https://github.com/horiuchi), [Dick van den Brink](https://github.com/DickvdBrink), [Adi Dahiya](https://github.com/adidahiya), [Matt Brooks](https://github.com/EnableSoftware) +* [:link:](moment/moment.d.ts) [Moment.js](https://github.com/timrwood/moment) by [Michael Lakerveld](https://github.com/Lakerfield), [Aaron King](https://github.com/kingdango), [Hiroki Horiuchi](https://github.com/horiuchi), [Dick van den Brink](https://github.com/DickvdBrink), [Adi Dahiya](https://github.com/adidahiya), [Matt Brooks](https://github.com/EnableSoftware) * [:link:](mongodb/mongodb.d.ts) [MongoDB](https://github.com/mongodb/node-mongodb-native) by [Boris Yankov](https://github.com/borisyankov) * [:link:](mongoose/mongoose.d.ts) [Mongoose](http://mongoosejs.com) by [horiuchi](https://github.com/horiuchi) +* [:link:](mongoose-auto-increment/mongoose-auto-increment.d.ts) [mongoose-auto-increment](https://github.com/codetunnel/mongoose-auto-increment) by [Aya Morisawa](https://github.com/AyaMorisawa) +* [:link:](mongoose-deep-populate/mongoose-deep-populate.d.ts) [mongoose-deep-populate](https://github.com/buunguyen/mongoose-deep-populate) by [Aya Morisawa](https://github.com/AyaMorisawa) * [:link:](mongoose-mock/mongoose-mock.d.ts) [mongoose-mock](https://github.com/JohanObrink/mongoose-mock) by [jt000](https://github.com/jt000) * [:link:](morgan/morgan.d.ts) [morgan](https://github.com/expressjs/morgan) by [James Roland Cabresos](https://github.com/staticfunction) * [:link:](mousetrap/mousetrap-global-bind.d.ts) [Mousetrap 1.4.6's global-bind extension](http://craig.is/killing/mice#extensions.global) by [Andrew Bradley](https://github.com/cspotcode) @@ -910,7 +973,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](msportalfx-test/msportalfx-test.d.ts) [msportalfx-test](https://msazure.visualstudio.com/DefaultCollection/AzureUX/_git/portalfx-msportalfx-test) by [Julio Casal](https://github.com/julioct) * [:link:](mssql/mssql.d.ts) [mssql](https://www.npmjs.com/package/mssql) by [COLSA Corporation](http://www.colsa.com), [Ben Farr](https://github.com/jaminfarr) * [:link:](mu2/mu2.d.ts) [mu2](http://github.com/raycmorgan/mu) by [Jeff Goddard](https://github.com/jedigo) -* [:link:](multer/multer.d.ts) [multer](https://github.com/expressjs/multer) by [jt000](https://github.com/jt000), [vilicvane](https://vilic.github.io) +* [:link:](multer/multer.d.ts) [multer](https://github.com/expressjs/multer) by [jt000](https://github.com/jt000), [vilicvane](https://vilic.github.io), [David Broder-Rodgers](https://github.com/DavidBR-SW) * [:link:](multiplexjs/multiplexjs.d.ts) [Multiplex.js](http://github.com/multiplex/multiplex.js) by [Kamyar Nazeri](http://github.com/KamyarNazeri) * [:link:](mustache/mustache.d.ts) [Mustache](https://github.com/janl/mustache.js) by [Mark Ashley Bell](https://github.com/markashleybell) * [:link:](natural/natural.d.ts) [Natural](https://github.com/NaturalNode/natural) by [Dylan R. E. Moonfire](https://github.com/dmoonfire) @@ -925,23 +988,30 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](ng-flow/ng-flow.d.ts) [ng-flow](https://github.com/flowjs/ng-flow) by [Ryan McNamara](https://github.com/ryan10132) * [:link:](ng-grid/ng-grid.d.ts) [ng-grid](http://angular-ui.github.io/ng-grid) by [Ken Smith](https://github.com/smithkl42), [Roland Zwaga](https://github.com/rolandzwaga), [Kent Cooper](https://github.com/kentcooper) * [:link:](angular-idle/angular-idle.d.ts) [ng-idle](http://hackedbychinese.github.io/ng-idle) by [mthamil](https://github.com/mthamil) +* [:link:](ng-notify/ng-notify.d.ts) [ng-notify](https://github.com/matowens/ng-notify) by [Nick Zamosenchuk](https://github.com/nzamosenchuk) * [:link:](ngbootbox/ngbootbox.d.ts) [ngbootbox](https://github.com/eriktufvesson/ngBootbox) by [Sam Saint-Pettersen](https://github.com/stpettersens) +* [:link:](ng-cordova/actionSheet.d.ts) [ngCordova Action Sheet plugin](https://github.com/driftyco/ng-cordova) by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing) * [:link:](ng-cordova/appAvailability.d.ts) [ngCordova AppAvailability plugin](https://github.com/driftyco/ng-cordova) by [Kapil Sachdeva](https://github.com/ksachdeva) -* [:link:](ng-cordova/datepicker.d.ts) [ngCordova datepicker plugin](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker) by [Jacques Kang](https://www.linkedin.com/in/jacqueskang) +* [:link:](ng-cordova/badge.d.ts) [ngCordova badge plugin](https://github.com/driftyco/ng-cordova) by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing) * [:link:](ng-cordova/app-version.d.ts) [ngCordova datepicker plugin](https://github.com/driftyco/ng-cordova) by [Jacques Kang](https://www.linkedin.com/in/jacqueskang) +* [:link:](ng-cordova/datepicker.d.ts) [ngCordova datepicker plugin](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker) by [Jacques Kang](https://www.linkedin.com/in/jacqueskang) * [:link:](ng-cordova/deviceMotion.d.ts) [ngCordova device motion plugin](https://github.com/driftyco/ng-cordova) by [Michel Vidailhet](https://github.com/mvidailhet), [Kapil Sachdeva](https://github.com/ksachdeva) * [:link:](ng-cordova/deviceOrientation.d.ts) [ngCordova device orientation plugin](https://github.com/driftyco/ng-cordova) by [Michel Vidailhet](https://github.com/mvidailhet), [Kapil Sachdeva](https://github.com/ksachdeva) * [:link:](ng-cordova/device.d.ts) [ngCordova device plugin](https://github.com/driftyco/ng-cordova) by [Kapil Sachdeva](https://github.com/ksachdeva) * [:link:](ng-cordova/dialogs.d.ts) [ngCordova dialogs plugin](https://github.com/driftyco/ng-cordova) by [Michel Vidailhet](https://github.com/mvidailhet), [Kapil Sachdeva](https://github.com/ksachdeva) * [:link:](ng-cordova/emailComposer.d.ts) [ngCordova emailComposer plugin](https://github.com/driftyco/ng-cordova) by [Kapil Sachdeva](https://github.com/ksachdeva) +* [:link:](ng-cordova/file.d.ts) [ngCordova file plugin](https://github.com/driftyco/ng-cordova) by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing) +* [:link:](ng-cordova/fileTransfer.d.ts) [ngCordova file-transfer plugin](https://github.com/driftyco/ng-cordova) by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing) * [:link:](ng-cordova/geolocation.d.ts) [ngCordova geolocation plugin](https://github.com/driftyco/ng-cordova) by [Kapil Sachdeva](https://github.com/ksachdeva) * [:link:](ng-cordova/network.d.ts) [ngCordova network plugin](https://github.com/driftyco/ng-cordova) by [Kapil Sachdeva](https://github.com/ksachdeva) * [:link:](ng-cordova/tsd.d.ts) [ngCordova plugins](https://github.com/driftyco/ng-cordova) by [Kapil Sachdeva](https://github.com/ksachdeva) * [:link:](ng-cordova/toast.d.ts) [ngCordova toast plugin](https://github.com/driftyco/ng-cordova) by [Kapil Sachdeva](https://github.com/ksachdeva) +* [:link:](ng-cordova/camera.d.ts) [ngCordova.plugins.camera](https://github.com/driftyco/ng-cordova) by [Jacques Kang](https://www.linkedin.com/in/jacqueskang) * [:link:](ng-dialog/ng-dialog.d.ts) [ngDialog](https://github.com/likeastore/ngDialog) by [Stephen Lautier](https://github.com/stephenlautier) * [:link:](ngkookies/ngkookies.d.ts) [ngKookes](https://github.com/voronianski/ngKookies) by [Martin McWhorter](https://github.com/martinmcwhorter) * [:link:](ngprogress/ngprogress.d.ts) [ngProgress](http://victorbjelkholm.github.io/ngProgress) by [Martin McWhorter](https://github.com/martinmcwhorter) * [:link:](ngprogress-lite/ngprogress-lite.d.ts) [ngprogress-lite](https://github.com/voronianski/ngprogress-lite) by [Luke Forder](https://github.com/LukeForder) +* [:link:](ng-stomp/ng-stomp.d.ts) [ngStomp](https://github.com/beevelop/ng-stomp) by [Lukasz Potapczuk](https://github.com/lpotapczuk) * [:link:](nightmare/nightmare.d.ts) [Nightmare](https://github.com/segmentio/nightmare) by [horiuchi](https://github.com/horiuchi) * [:link:](noble/noble.d.ts) [noble](https://github.com/sandeepmistry/noble) by [Seon-Wook Park](https://github.com/swook) * [:link:](nock/nock.d.ts) [nock](https://github.com/pgte/nock) by [bonnici](https://github.com/bonnici) @@ -959,6 +1029,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](config/config.d.ts) [node-config](https://github.com/lorenwest/node-config) by [Roman Korneev](https://github.com/RWander) * [:link:](node-config-manager/node-config-manager.d.ts) [node-config-manager](https://www.npmjs.com/package/node-config-manager) by [TANAKA Koichi](https://gitnub.com/mugeso) * [:link:](convict/convict.d.ts) [node-convict](https://github.com/mozilla/node-convict) by [Wim Looman](https://github.com/Nemo157) +* [:link:](node-dir/node-dir.d.ts) [node-dir](https://github.com/fshost/node-dir) by [Panu Horsmalahti](https://github.com/panuhorsmalahti) +* [:link:](email-templates/email-templates.d.ts) [node-email-templates](https://github.com/niftylettuce/node-email-templates) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](node-ffi/node-ffi.d.ts) [node-ffi](https://github.com/rbranson/node-ffi) by [Paul Loyd](https://github.com/loyd) * [:link:](node-fibers/node-fibers.d.ts) [node-fibers](https://github.com/laverdet/node-fibers) by [Cary Haynie](https://github.com/caryhaynie) * [:link:](node-form/node-form.d.ts) [node-form](https://github.com/rsamec/form) by [Roman Samec](https://github.com/rsamec) @@ -980,10 +1052,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](node-slack/node-slack.d.ts) [node-slack](https://github.com/xoxco/node-slack) by [Qubo](https://github.com/tkQubo) * [:link:](srp/srp.d.ts) [node-srp](https://github.com/mozilla/node-srp) by [Pat Smuk](https://github.com/Patman64) * [:link:](stack-trace/stack-trace.d.ts) [node-stack-trace](https://github.com/felixge/node-stack-trace) by [Exceptionless](https://github.com/exceptionless) -* [:link:](node-uuid/node-uuid-base.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay) * [:link:](node-uuid/node-uuid-cjs.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay) -* [:link:](node-uuid/node-uuid-global.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay) +* [:link:](node-uuid/node-uuid-base.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay) * [:link:](node-uuid/node-uuid.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay) +* [:link:](node-uuid/node-uuid-global.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay) * [:link:](node-validator/node-validator.d.ts) [node-validator](https://www.npmjs.com/package/node-validator) by [Ken Gorab](https://github.com/kengorab) * [:link:](node-webkit/node-webkit.d.ts) [node-webkit](https://github.com/rogerwang/node-webkit) by [Pedro Casaubon](https://github.com/xperiments) * [:link:](xml2js/xml2js.d.ts) [node-xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) by [Michel Salib](https://github.com/michelsalib), [Jason McNeil](https://github.com/jasonrm) @@ -991,6 +1063,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](restify/restify.d.ts) [node.js REST framework](https://github.com/mcavage/node-restify) by [Bret Little](https://github.com/blittle) * [:link:](node/node.d.ts) [Node.js v4.x](http://nodejs.org) by [Microsoft TypeScript](http://typescriptlang.org), [DefinitelyTyped](https://github.com/borisyankov/DefinitelyTyped) * [:link:](each/each.d.ts) [NodeEach](http://www.adaltas.com/projects/node-each) by [Michael Zabka](https://github.com/misak113) +* [:link:](yandex-money-sdk/yandex-money-sdk.d.ts) [NodeJS Yandex.Money API SDK](https://github.com/yandex-money/yandex-money-sdk-nodejs) by [Ilya Mochalov](https://github.com/chrootsu) * [:link:](nodemailer/nodemailer.d.ts) [Nodemailer](https://github.com/andris9/Nodemailer) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](nodemailer/nodemailer-types.d.ts) [Nodemailer](https://github.com/andris9/Nodemailer) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](nodemailer-direct-transport/nodemailer-direct-transport.d.ts) [nodemailer-direct-transport](https://github.com/andris9/nodemailer-direct-transport) by [Rogier Schouten](https://github.com/rogierschouten) @@ -1000,8 +1073,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](nodeunit/nodeunit.d.ts) [nodeunit](https://github.com/caolan/nodeunit) by [Jeff Goddard](https://github.com/jedigo) * [:link:](nomnom/nomnom.d.ts) [nomnom](https://github.com/harthur/nomnom) by [Paul Vick](https://github.com/panopticoncentral) * [:link:](nopt/nopt.d.ts) [nopt](https://github.com/npm/nopt) by [jbondc](https://github.com/jbondc) -* [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker) * [:link:](notify/notify.d.ts) [Notify.js](https://github.com/jpillora/notifyjs) by [Xiaohan Zhang](https://github.com/hellochar) +* [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker) * [:link:](wnumb/wnumb.d.ts) [nouislider](https://github.com/leongersen/wnumb) by [Corey Jepperson](https://github.com/acoreyj) * [:link:](nouislider/nouislider.d.ts) [nouislider](https://github.com/leongersen/noUiSlider) by [Patrick Davies](https://github.com/bleuarg) * [:link:](noVNC/noVNC.d.ts) [noVNC](https://github.com/kanaka/noVNC) by [Ken Smith](https://github.com/smithkl42) @@ -1026,23 +1099,25 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](OpenJsCad/openjscad.d.ts) [OpenJsCad.js](https://github.com/joostn/OpenJsCad) by [Dan Marshall](https://github.com/danmarshall) * [:link:](openlayers/openlayers.d.ts) [OpenLayers](http://openlayers.org) by [Wouter Goedhart](https://github.com/woutergd) * [:link:](openpgp/openpgp.d.ts) [openpgpjs](http://openpgpjs.org) by [Guillaume Lacasa](https://blog.lacasa.fr) -* [:link:](opn/opn.d.ts) [opn](https://github.com/sindresorhus/opn) by [Shinnosuke Watanabe](https://github.com/shinnn) +* [:link:](opn/opn.d.ts) [opn](https://github.com/sindresorhus/opn) by [Shinnosuke Watanabe](https://github.com/shinnn), [Maxime LUCE](https://github.com/SomaticIT) * [:link:](optimist/optimist.d.ts) [optimist](https://github.com/substack/node-optimist) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](orchestrator/orchestrator.d.ts) [Orchestrator](https://github.com/orchestrator/orchestrator) by [Qubo](https://github.com/tkQubo) * [:link:](os-locale/os-locale.d.ts) [os-locale](https://github.com/sindresorhus/os-locale) by [Aya Morisawa](https://github.com/AyaMorisawa) * [:link:](owlcarousel/owlcarousel.d.ts) [OwlCarousel v.1.3.3](https://github.com/OwlFonk/OwlCarousel) by [Damian Piątkowski](https://github.com/dpiatkowski) +* [:link:](p2/p2.d.ts) [p2.js](https://github.com/schteppe/p2.js) by [Clark Stevenson](https://github.com/clark-stevenson) * [:link:](packery/packery.d.ts) [Packery](http://packery.metafizzy.co) by [Piraveen Kamalathas from Kilix](https://github.com/piraveen) * [:link:](page/page.d.ts) [page](http://visionmedia.github.io/page.js) by [Alan Norbauer](http://alan.norbauer.com) +* [:link:](pako/pako.d.ts) [pako](https://github.com/nodeca/pako) by [Denis Cappellin](http://github.com/cappellin) * [:link:](papaparse/papaparse.d.ts) [PapaParse](https://github.com/mholt/PapaParse) by [Pedro Flemming](https://github.com/torpedro) * [:link:](parallel/parallel.d.ts) [parallel.js](http://adambom.github.io/parallel.js) by [Josh Baldwin](https://github.com/jbaldwin) * [:link:](param-case/param-case.d.ts) [param-case](https://github.com/blakeembrey/param-case) by [Sam Saint-Pettersen](https://github.com/stpettersens) * [:link:](parse/parse.d.ts) [Parse](https://parse.com) by [Ullisen Media Group](http://ullisenmedia.com) -* [:link:](parsimmon/parsimmon.d.ts) [Parsimmon](https://github.com/jneen/parsimmon) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](parsimmon/parsimmon.d.ts) [Parsimmon](https://github.com/jneen/parsimmon) by [Bart van der Schoor](https://github.com/Bartvds), [Mizunashi Mana](https://github.com/mizunashi-mana) * [:link:](pascal-case/pascal-case.d.ts) [pascal-case](https://github.com/blakeembrey/pascal-case) by [Sam Saint-Pettersen](https://github.com/stpettersens) * [:link:](passport/passport.d.ts) [Passport](http://passportjs.org) by [Horiuchi_H](https://github.com/horiuchi) * [:link:](passport-strategy/passport-strategy.d.ts) [Passport Strategy module](https://github.com/jaredhanson/passport-strategy) by [Lior Mualem](https://github.com/liorm) -* [:link:](passport-facebook/passport-facebook.d.ts) [passport-facebook](https://github.com/jaredhanson/passport-facebook) by [James Roland Cabresos](https://github.com/staticfunction) * [:link:](passport-google-oauth/passport-google-oauth.d.ts) [passport-facebook](https://github.com/jaredhanson/passport-facebook) by [James Roland Cabresos](https://github.com/staticfunction) +* [:link:](passport-facebook/passport-facebook.d.ts) [passport-facebook](https://github.com/jaredhanson/passport-facebook) by [James Roland Cabresos](https://github.com/staticfunction) * [:link:](passport-twitter/passport-twitter.d.ts) [passport-facebook](https://github.com/jaredhanson/passport-facebook) by [James Roland Cabresos](https://github.com/staticfunction) * [:link:](passport-facebook-token/passport-facebook-token.d.ts) [passport-facebook-token](https://github.com/drudge/passport-facebook-token) by [Ray Martone](https://github.com/rmartone) * [:link:](passport-local/passport-local.d.ts) [passport-local](https://github.com/jaredhanson/passport-local) by [Maxime LUCE](https://github.com/SomaticIT) @@ -1085,6 +1160,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](poly2tri/poly2tri.d.ts) [poly2tri](http://github.com/r3mi/poly2tri.js) by [Elemar Junior](https://github.com/elemarjr) * [:link:](polyline/polyline.d.ts) [Polyline](https://github.com/mapbox/polyline) by [Arseniy Maximov](https://github.com/Kern0) * [:link:](polymer/polymer.d.ts) [polymer](https://github.com/Polymer/polymer) by [Louis Grignon](https://github.com/lgrignon), [Suguru Inatomi](https://github.com/laco0416) +* [:link:](polymer-ts/polymer-ts.d.ts) [PolymerTS](https://github.com/nippur72/PolymerTS) by [Louis Grignon](https://github.com/lgrignon) * [:link:](popcorn/popcorn.d.ts) [Popcorn](https://github.com/mozilla/popcorn-js) by [grapswiz](https://github.com/grapswiz) * [:link:](postal/postal.d.ts) [Postal](https://github.com/postaljs/postal.js) by [Lokesh Peta](https://github.com/lokeshpeta), [Paul Jolly](https://github.com/myitcv) * [:link:](pouchDB/pouch.d.ts) [Pouch](http://pouchdb.com) by [Bill Sears](https://github.com/MrBigDog2U) @@ -1099,6 +1175,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](promise-pool/promise-pool.d.ts) [promise-pool](https://github.com/vilic/promise-pool) by [VILIC VANE](https://github.com/vilic) * [:link:](promises-a-plus/promises-a-plus.d.ts) [promises-a-plus](http://promisesaplus.com) by [Igor Oleinikov](https://github.com/Igorbek) * [:link:](protobufjs/protobufjs.d.ts) [ProtoBuf.js](https://github.com/dcodeIO/ProtoBuf.js) by [Panu Horsmalahti](https://github.com/panuhorsmalahti) +* [:link:](protractor-http-mock/protractor-http-mock.d.ts) [protractor-http-mock](https://github.com/atecarlos/protractor-http-mock) by [Crevil](https://github.com/Crevil) * [:link:](proxyquire/proxyquire.d.ts) [Proxyquire](https://github.com/thlorenz/proxyquire) by [jt000](https://github.com/jt000) * [:link:](pty.js/pty.js.d.ts) [pty.js 0.2.7-1](https://github.com/chjj/pty.js) by [Vadim Macagon](https://github.com/enlight) * [:link:](pubsubjs/pubsub.d.ts) [PubSubJS](https://github.com/mroderick/PubSubJS) by [Boris Yankov](https://github.com/borisyankov) @@ -1110,6 +1187,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](qajax/qajax.d.ts) [Qajax](https://github.com/gre/qajax) by [Boltmade](https://github.com/Boltmade) * [:link:](qs/qs.d.ts) [qs](https://github.com/hapijs/qs) by [Roman Korneev](https://github.com/RWander) * [:link:](qtip2/qtip2.d.ts) [qtip2](http://qtip2.com) by [Nathan Pitman](https://github.com/Seltzer) +* [:link:](query-string/query-string.d.ts) [query-string](https://github.com/sindresorhus/query-string) by [Sam Verschueren](https://github.com/SamVerschueren) * [:link:](quixote/quixote.d.ts) [quixote](http://quixote-css.com) by [Aleksandr Filatov](https://github.com/greybax) * [:link:](qunit/qunit.d.ts) [QUnit](http://qunitjs.com) by [Diullei Gomes](https://github.com/diullei) * [:link:](qwest/qwest.d.ts) [qwest](https://github.com/pyrsmk/qwest) by [Lindsay Evans](https://github.com/lindsayevans) @@ -1119,13 +1197,15 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](rangy/rangy.d.ts) [Rangy](https://github.com/timdown/rangy) by [Rudolph Gottesheim](http://www.midnight-design.at) * [:link:](raphael/raphael.d.ts) [Raphael](http://raphaeljs.com) by [CheCoxshall](https://github.com/CheCoxshall) * [:link:](rappid/rappid.d.ts) [Rappid](http://jointjs.com/about-rappid) by [Ewout Van Gossum](https://github.com/DenEwout) +* [:link:](ratelimiter/ratelimiter.d.ts) [ratelimiter](https://github.com/tj/node-ratelimiter) by [Aya Morisawa](https://github.com/AyaMorisawa) * [:link:](ravenjs/ravenjs.d.ts) [Raven.js](https://github.com/getsentry/raven-js) by [Santi Albo](https://github.com/santialbo) * [:link:](raygun4js/raygun4js.d.ts) [raygun4js](https://github.com/MindscapeHQ/raygun4js) by [Brian Surowiec](https://github.com/xt0rted) +* [:link:](rcloader/rcloader.d.ts) [rcloader](https://github.com/spalger/rcloader) by [Panu Horsmalahti](https://github.com/panuhorsmalahti) * [:link:](react/react.d.ts) [React](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react/react-global.d.ts) [React (namespace)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react/react-addons-create-fragment.d.ts) [React (react-addons-create-fragment)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) -* [:link:](react/react-addons-shallow-compare.d.ts) [React (react-addons-css-transition-group)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react/react-addons-css-transition-group.d.ts) [React (react-addons-css-transition-group)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) +* [:link:](react/react-addons-shallow-compare.d.ts) [React (react-addons-css-transition-group)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react/react-addons-linked-state-mixin.d.ts) [React (react-addons-linked-state-mixin)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react/react-addons-perf.d.ts) [React (react-addons-perf)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react/react-addons-pure-render-mixin.d.ts) [React (react-addons-pure-render-mixin)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) @@ -1134,16 +1214,19 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](react/react-addons-update.d.ts) [React (react-addons-update)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react/react-dom.d.ts) [React (react-dom)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react-dnd/react-dnd.d.ts) [React DnD](https://github.com/gaearon/react-dnd) by [Asana](https://asana.com) -* [:link:](react-router/react-router.d.ts) [React Router](https://github.com/rackt/react-router) by [Yuichi Murata](https://github.com/mrk21), [Václav Ostrožlík](https://github.com/vasek17) * [:link:](react-bootstrap/react-bootstrap.d.ts) [react-bootstrap](https://github.com/react-bootstrap/react-bootstrap) by [Walker Burgin](https://github.com/walkerburgin) +* [:link:](react-datagrid/react-datagrid.d.ts) [react-datagrid](https://github.com/zippyui/react-datagrid.git) by [Stephen Jelfs](https://github.com/stephenjelfs) * [:link:](react-day-picker/react-day-picker.d.ts) [react-day-picker](https://github.com/gpbl/react-day-picker) by [Giampaolo Bellavite](https://github.com/gpbl), [Jason Killian](https://github.com/jkillian) * [:link:](react-dropzone/react-dropzone.d.ts) [react-dropzone](https://github.com/paramaggarwal/react-dropzone) by [Mathieu Larouche Dube](https://github.com/matdube) +* [:link:](react-infinite/react-infinite.d.ts) [react-infinite](https://github.com/seatgeek/react-infinite) by [rhysd](https://github.com/rhysd) * [:link:](react-input-calendar/react-input-calendar.d.ts) [react-input-calendar](https://github.com/Rudeg/react-input-calendar) by [Stepan Mikhaylyuk](https://github.com/stepancar) * [:link:](react-intl/react-intl.d.ts) [react-intl](http://formatjs.io/react) by [Bruno Grieder](https://github.com/bgrieder), [Christian Droulers](https://github.com/cdroulers) * [:link:](react-mixin/react-mixin.d.ts) [react-mixin](https://github.com/brigand/react-mixin) by [Qubo](https://github.com/tkqubo) * [:link:](react-native/react-native.d.ts) [react-native](https://github.com/facebook/react-native) by [Bruno Grieder](https://github.com/bgrieder) * [:link:](react-props-decorators/react-props-decorators.d.ts) [react-props-decorators](https://github.com/popkirby/react-props-decorators) by [Qubo](https://github.com/tkqubo) * [:link:](react-redux/react-redux.d.ts) [react-redux](https://github.com/rackt/react-redux) by [Qubo](https://github.com/tkqubo) +* [:link:](react-router/react-router.d.ts) [react-router](https://github.com/rackt/react-router) by [Sergey Buturlakin](http://github.com/sergey-buturlakin), [Yuichi Murata](https://github.com/mrk21), [Václav Ostrožlík](https://github.com/vasek17) +* [:link:](react-select/react-select.d.ts) [react-select](https://github.com/JedWatson/react-select) by [ESQUIBET Hugo](https://github.com/Hesquibet) * [:link:](react-spinkit/react-spinkit.d.ts) [react-spinkit](https://github.com/KyleAMathews/react-spinkit) by [Qubo](https://github.com/tkqubo) * [:link:](react-swf/react-swf.d.ts) [react-swf](https://github.com/syranide/react-swf) by [Stepan Mikhaylyuk](https://github.com/stepancar) * [:link:](read/read.d.ts) [read](https://github.com/isaacs/read) by [Tim JK](https://github.com/timjk) @@ -1155,11 +1238,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](redux-action-utils/redux-action-utils.d.ts) [redux-action-utils](https://github.com/insin/redux-action-utils) by [Qubo](https://github.com/tkqubo) * [:link:](redux-actions/redux-actions.d.ts) [redux-actions](https://github.com/acdlite/redux-actions) by [Jack Hsu](https://github.com/jaysoo) * [:link:](redux-devtools/redux-devtools.d.ts) [redux-devtools](https://github.com/gaearon/redux-devtools) by [Qubo](https://github.com/tkqubo) +* [:link:](redux-form/redux-form.d.ts) [redux-form](https://github.com/erikras/redux-form) by [Daniel Lytkin](https://github.com/aikoven) * [:link:](redux-logger/redux-logger.d.ts) [redux-logger](https://github.com/fcomb/redux-logger) by [Alexander Rusakov](https://github.com/arusakov) * [:link:](redux-thunk/redux-thunk.d.ts) [redux-thunk](https://github.com/gaearon/redux-thunk) by [Qubo](https://github.com/tkqubo) -* [:link:](ref/ref.d.ts) [ref](https://github.com/TooTallNate/ref) by [Paul Loyd](https://github.com/loyd) * [:link:](ref-array/ref-array.d.ts) [ref-array](https://github.com/TooTallNate/ref-array) by [Paul Loyd](https://github.com/loyd) -* [:link:](ref-struct/ref-struct.d.ts) [ref-struct](https://github.com/TooTallNate/ref-struct) by [Paul Loyd](https://github.com/loyd) * [:link:](ref-union/ref-union.d.ts) [ref-union](https://github.com/TooTallNate/ref-union) by [Paul Loyd](https://github.com/loyd) * [:link:](reflux/reflux.d.ts) [RefluxJS](https://github.com/reflux/refluxjs) by [Maurice de Beijer](https://github.com/mauricedb) * [:link:](request/request.d.ts) [request](https://github.com/mikeal/request) by [Carlos Ballesteros Velasco](https://github.com/soywiz), [bonnici](https://github.com/bonnici), [Bart van der Schoor](https://github.com/Bartvds), [Joe Skeen](http://github.com/joeskeen) @@ -1186,6 +1268,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](routie/routie.d.ts) [routie](https://github.com/jgallen23/routie) by [Adilson](https://github.com/Adilson) * [:link:](rsmq/rsmq.d.ts) [rsmq](http://smrchy.github.io/rsmq) by [Qubo](https://github.com/MugeSo) * [:link:](rsmq-worker/rsmq-worker.d.ts) [rsmq-worker](http://smrchy.github.io/rsmq/rsmq-worker) by [TANAKA Koichi](https://github.com/MugeSo) +* [:link:](rss/rss.d.ts) [rss](https://github.com/dylang/node-rss) by [Second Datke](https://github.com/secondwtq) * [:link:](rtree/rtree.d.ts) [rtree](https://github.com/leaflet-extras/RTree) by [Omede Firouz](https://github.com/oefirouz) * [:link:](run-sequence/run-sequence.d.ts) [run-sequence](https://github.com/OverZealous/run-sequence) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](rx/rx.d.ts) [RxJS](http://rx.codeplex.com) by [gsino](http://www.codeplex.com/site/users/view/gsino), [Igor Oleinikov](https://github.com/Igorbek) @@ -1203,7 +1286,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](rx/rx.time.d.ts) [RxJS-Time](http://rx.codeplex.com) by [Carl de Billy](http://carl.debilly.net), [Igor Oleinikov](https://github.com/Igorbek) * [:link:](rx/rx.virtualtime.d.ts) [RxJS-VirtualTime](http://rx.codeplex.com) by [gsino](http://www.codeplex.com/site/users/view/gsino), [Igor Oleinikov](https://github.com/Igorbek) * [:link:](s3-uploader/s3-uploader.d.ts) [s3-uploader](https://www.npmjs.com/package/s3-uploader) by [COLSA Corporation](http://www.colsa.com) +* [:link:](s3rver/s3rver.d.ts) [S3rver](https://github.com/jamhall/s3rver) by [David Broder-Rodgers](https://github.com/DavidBR-SW) * [:link:](sammyjs/sammyjs.d.ts) [Sammy.js](http://sammyjs.org) by [Boris Yankov](https://github.com/borisyankov), [Oisin Grehan](https://github.com/oising) +* [:link:](sandboxed-module/sandboxed-module.d.ts) [sandboxed-module](https://github.com/felixge/node-sandboxed-module) by [Sven Reglitzki](https://github.com/svi3c) * [:link:](sanitize-filename/sanitize-filename.d.ts) [sanitize-filename](https://github.com/parshap/node-sanitize-filename) by [Wim Looman](https://github.com/Nemo157) * [:link:](sanitize-html/sanitize-html.d.ts) [sanitize-html](https://github.com/punkave/sanitize-html) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](sanitizer/sanitizer.d.ts) [Sanitizer](https://github.com/theSmaw/Caja-HTML-Sanitizer) by [Dave Taylor](http://davetayls.me) @@ -1212,6 +1297,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](scalike/scalike.d.ts) [scalike API](https://github.com/ryoppy/scalike-typescript) by [ryoppy](https://github.com/ryoppy) * [:link:](screenfull/screenfull.d.ts) [screenfull.js](https://github.com/sindresorhus/screenfull.js) by [Ilia Choly](http://github.com/icholy) * [:link:](scrolltofixed/scrolltofixed.d.ts) [ScrollToFixed](https://github.com/bigspotteddog/ScrollToFixed) by [Ben Dixon](https://github.com/bmdixon) +* [:link:](scrypt-async/scrypt-async.d.ts) [scrypt-async](https://github.com/dchest/scrypt-async-js) by [Kaur Kuut](https://github.com/xStrom) * [:link:](seedrandom/seedrandom.d.ts) [seedrandom](https://github.com/davidbau/seedrandom) by [Kern Handa](https://github.com/kernhanda) * [:link:](segment-analytics/segment-analytics.d.ts) [Segment's analytics.js](https://segment.com/docs/libraries/analytics.js) by [Andrew Fong](https://github.com/fongandrew) * [:link:](analytics-node/analytics-node.d.ts) [Segment's analytics.js for Node.js](https://segment.com/docs/libraries/node) by [Andrew Fong](https://github.com/fongandrew) @@ -1226,6 +1312,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](sequelize-fixtures/sequelize-fixtures.d.ts) [Sequelize-Fixtures](https://github.com/domasx2/sequelize-fixtures) by [Christian Schwarz](https://github.com/cschwarz) * [:link:](serve-favicon/serve-favicon.d.ts) [serve-favicon](https://github.com/expressjs/serve-favicon) by [Uros Smolnik](https://github.com/urossmolnik) * [:link:](on-headers/on-headers.d.ts) [serve-favicon](https://github.com/jshttp/on-headers) by [John Jeffery](https://github.com/jjeffery) +* [:link:](serve-index/serve-index.d.ts) [serve-index](https://github.com/expressjs/serve-index) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](serve-static/serve-static.d.ts) [serve-static](https://github.com/expressjs/serve-static) by [Uros Smolnik](https://github.com/urossmolnik) * [:link:](sharedworker/SharedWorker.d.ts) [SharedWorker](http://www.w3.org/TR/workers) by [Toshiya Nakakura](https://github.com/nakakura) * [:link:](sharepoint/SharePoint.d.ts) [SharePoint 2010 and 2013](https://github.com/gandjustas/sptypescript) by [Stanislav Vyshchepan](http://blog.gandjustas.ru), [Andrey Markeev](http://markeev.com) @@ -1234,11 +1321,13 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](should-promised/should-promised.d.ts) [should-promised](https://github.com/shouldjs/promised) by [Yaroslav Admin](https://github.com/devoto13) * [:link:](should/should.d.ts) [should.js](https://github.com/visionmedia/should.js) by [Alex Varju](https://github.com/varju), [Maxime LUCE](https://github.com/SomaticIT) * [:link:](showdown/showdown.d.ts) [Showdown](https://github.com/coreyti/showdown) by [cbowdon](https://github.com/cbowdon) +* [:link:](shuffle-array/shuffle-array.d.ts) [shuffle-array](https://github.com/pazguille/shuffle-array) by [rhysd](https://rhysd.github.io) * [:link:](siesta/siesta.d.ts) [Siesta](http://www.bryntum.com/products/siesta) by [bquarmby](https://github.com/bquarmby) * [:link:](sigmajs/sigmajs.d.ts) [sigma.js](https://github.com/jacomyal/sigma.js) by [Qinfeng Chen](https://github.com/qinfchen) * [:link:](signalr/signalr.d.ts) [SignalR](http://www.asp.net/signalr) by [Boris Yankov](https://github.com/borisyankov), [T. Michael Keesey](https://github.com/keesey) * [:link:](signature_pad/signature_pad.d.ts) [signature_pad](https://github.com/szimek/signature_pad) by [Abubaker Bashir](https://github.com/AbubakerB) * [:link:](simple-cw-node/simple-cw-node.d.ts) [simple-cw-node](https://github.com/astronaughts/simple-cw-node) by [vvakame](https://github.com/vvakame) +* [:link:](simple-mock/simple-mock.d.ts) [simple-mock](https://github.com/jupiter/simple-mock) by [Leon Yu](https://github.com/leonyu) * [:link:](simplebar/simplebar.d.ts) [simplebar.js](https://github.com/Grsmto/simplebar) by [Gregor Woiwode](https://github.com/gregonnet) * [:link:](jquery.simplemodal/jquery.simplemodal.d.ts) [SimpleModal](http://www.ericmmartin.com/projects/simplemodal) by [Friedrich von Never](https://github.com/ForNeVeR) * [:link:](simplestorage.js/simplestorage.js.d.ts) [simpleStorage](https://github.com/andris9/simpleStorage) by [Áxel Costas Pena](https://github.com/axelcostaspena) @@ -1259,6 +1348,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](socket.io/socket.io.d.ts) [socket.io](http://socket.io) by [PROGRE](https://github.com/progre), [Damian Connolly](https://github.com/divillysausages) * [:link:](socket.io-client/socket.io-client.d.ts) [socket.io-client](http://socket.io) by [PROGRE](https://github.com/progre), [Damian Connolly](https://github.com/divillysausages) * [:link:](socket.io.users/socket.io.users.d.ts) [socket.io.users](https://github.com/nodets/socket.io.users) by [Makis Maropoulos](https://github.com/kataras) +* [:link:](socketty/socketty.d.ts) [Socketty](https://www.npmjs.com/package/socketty) by [Nax](https://github.com/Nax) * [:link:](sockjs/sockjs.d.ts) [SockJS 0.3.x](https://github.com/sockjs/sockjs-client) by [Emil Ivanov](https://github.com/vladev) * [:link:](sockjs-client/sockjs-client.d.ts) [sockjs-client](https://github.com/sockjs/sockjs-client) by [Emil Ivanov](https://github.com/vladev), [Alexander Rusakov](https://github.com/arusakov) * [:link:](sockjs-node/sockjs-node.d.ts) [sockjs-node 0.3.x](https://github.com/sockjs/sockjs-node) by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing) @@ -1272,6 +1362,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](split/split.d.ts) [split](https://github.com/dominictarr/split) by [Marcin Porębski](https://github.com/marcinporebski) * [:link:](sprintf-js/sprintf-js.d.ts) [sprintf-js](https://www.npmjs.com/package/sprintf-js) by [Jason Swearingen](https://jasonswearingen.github.io) * [:link:](sprintf/sprintf.d.ts) [sprintff](https://github.com/maritz/node-sprintff) by [Carlos Ballesteros Velasco](https://github.com/soywiz) +* [:link:](sql.js/sql.js.d.ts) [sql.js](https://github.com/kripken/sql.js) by [George Wu](https://github.com/Hozuki) * [:link:](sqlite3/sqlite3.d.ts) [sqlite3](https://github.com/mapbox/node-sqlite3) by [Nick Malaguti](https://github.com/nmalaguti) * [:link:](squirejs/squirejs.d.ts) [Squire](https://github.com/iammerrick/Squire.js) by [Bradley Ayers](https://github.com/bradleyayers) * [:link:](ssh2/ssh2.d.ts) [ssh2](https://github.com/mscdex/ssh2) by [Qubo](https://github.com/tkQubo) @@ -1285,13 +1376,15 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](status-bar/status-bar.d.ts) [status-bar](https://github.com/atom/status-bar) by [vvakame](https://github.com/vvakame) * [:link:](statuses/statuses.d.ts) [statuses](https://github.com/jshttp/statuses) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](steam/steam.d.ts) [steam](https://github.com/seishun/node-steam) by [Andrey Kurdyumov](https://github.com/kant2002) +* [:link:](slick-carousel/slick-carousel.d.ts) [stick](http://kenwheeler.github.io/slick) by [John Gouigouix](https://github.com/orchestra-ts/DefinitelyTyped) * [:link:](storejs/storejs.d.ts) [store.js](https://github.com/marcuswestin/store.js) by [Vincent Bortone](https://github.com/vbortone) * [:link:](stream-series/stream-series.d.ts) [stream-series](https://github.com/rschmukler/stream-series) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](stream-to-array/stream-to-array.d.ts) [stream-to-array](https://github.com/stream-utils/stream-to-array) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](streamjs/streamjs.d.ts) [streamjs](http://winterbe.github.io/streamjs) by [Bence Eros](https://github.com/erosb) * [:link:](string_score/string_score.d.ts) [string_score](https://github.com/joshaven/string_score) by [Marcin Porębski](https://github.com/marcinporebski) * [:link:](string/string.d.ts) [string.js](http://stringjs.com) by [Bas Pennings](https://github.com/basp) -* [:link:](stripe/stripe.d.ts) [stripe](https://stripe.com) by [Andy Hawkins](https://github.com/a904guy/,http://a904guy.com), [Eric J. Smith](https://github.com/ejsmith) +* [:link:](strip-json-comments/strip-json-comments.d.ts) [strip-json-comments](https://github.com/sindresorhus/strip-json-comments) by [Dylan R. E. Moonfire](https://github.com/dmoonfire) +* [:link:](stripe/stripe.d.ts) [stripe](https://stripe.com) by [Andy Hawkins](https://github.com/a904guy/,http://a904guy.com), [Eric J. Smith](https://github.com/ejsmith), [Amrit Kahlon](https://github.com/amritk) * [:link:](stripe-checkout/stripe-checkout.d.ts) [Stripe Checkout](https://stripe.com/checkout) by [Chris Wrench](https://github.com/cgwrench) * [:link:](stripe/stripe-node.d.ts) [stripe-node](https://github.com/stripe/stripe-node) by [William Johnston](https://github.com/wjohnsto) * [:link:](strophe/strophe.d.ts) [Strophe.js](http://strophe.im/strophejs) by [David Deutsch](https://github.com/DavidKDeutsch) @@ -1299,6 +1392,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](sugar/sugar.d.ts) [Sugar](http://sugarjs.com) by [Josh Baldwin](https://github.com/jbaldwin) * [:link:](superagent/superagent.d.ts) [SuperAgent](https://github.com/visionmedia/superagent) by [Alex Varju](https://github.com/varju) * [:link:](supertest/supertest.d.ts) [SuperTest](https://github.com/visionmedia/supertest) by [Alex Varju](https://github.com/varju) +* [:link:](supertest-as-promised/supertest-as-promised.d.ts) [SuperTest as Promised](https://github.com/WhoopInc/supertest-as-promised) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](svg-injector/svg-injector.d.ts) [SVG Injector](https://github.com/iconic/SVGInjector) by [Patrick Westerhoff](https://github.com/poke) * [:link:](svg-pan-zoom/svg-pan-zoom.d.ts) [svg-pan-zoom](https://github.com/ariutta/svg-pan-zoom) by [Chintan Shah](https://github.com/Promact) * [:link:](svg-sprite/svg-sprite.d.ts) [svg-sprite](https://github.com/jkphl/svg-sprite) by [Qubo](https://github.com/tkqubo) @@ -1310,6 +1404,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](swap-case/swap-case.d.ts) [swap-case](https://github.com/blakeembrey/swap-case) by [Sam Saint-Pettersen](https://github.com/stpettersens) * [:link:](sweetalert/sweetalert.d.ts) [SweetAlert](https://github.com/t4t5/sweetalert) by [Markus Peloso](https://github.com/ToastHawaii) * [:link:](swfobject/swfobject.d.ts) [swfobject](https://code.google.com/p/swfobject) by [rou](https://github.com/rou) +* [:link:](swiftclick/swiftclick.d.ts) [SwiftClick](https://github.com/munkychop/swiftclick) by [Laurence C](https://github.com/Laurence-C) * [:link:](swig/swig.d.ts) [swig](http://github.com/paularmstrong/swig) by [Peter Harris](https://github.com/CodeAnimal), [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](swig-email-templates/swig-email-templates.d.ts) [swig-email-templates](https://github.com/andrewrk/swig-email-templates) by [Adam Babcock](https://github.com/mrhen) * [:link:](swipe/swipe.d.ts) [Swipe](https://github.com/thebird/Swipe) by [Andrey Kurdyumov](https://github.com/kant2002) @@ -1320,20 +1415,20 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](systemjs/systemjs.d.ts) [System.js](https://github.com/systemjs/systemjs) by [Ludovic HENIN](https://github.com/ludohenin), [Nathan Walker](https://github.com/NathanWalker) * [:link:](tabris/tabris.d.ts) [Tabris.js](http://tabrisjs.com) by [Tabris.js team](http://github.com/eclipsesource/tabris) * [:link:](tabtab/tabtab.d.ts) [tabtab](https://github.com/mklabs/node-tabtab) by [Vojtěch Habarta](https://github.com/vojtechhabarta) -* [:link:](tape/tape.d.ts) [tape](https://github.com/substack/tape) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](tape/tape.d.ts) [tape](https://github.com/substack/tape) by [Bart van der Schoor](https://github.com/Bartvds), [Haoqun Jiang](https://github.com/sodatea) * [:link:](tar/tar.d.ts) [tar](https://github.com/npm/node-tar) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](tcomb/tcomb.d.ts) [tcomb](http://gcanti.github.io/tcomb/guide/index.html) by [Hans Windhoff](https://github.com/hansrwindhoff) * [:link:](tea-merge/tea-merge.d.ts) [tea-merge](https://github.com/qualiancy/tea-merge) by [Mihhail Lapushkin](https://github.com/mihhail-lapushkin) * [:link:](tedious/tedious.d.ts) [tedious](https://pekim.github.io/tedious) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](tedious-connection-pool/tedious-connection-pool.d.ts) [tedious-connection-pool](https://github.com/pekim/tedious-connection-pool) by [Cyprien Autexier](https://github.com/sandorfr) * [:link:](teechart/teechart.d.ts) [TeeChart](http://www.steema.com) by [Steema Software](https://steema.com) +* [:link:](temp/temp.d.ts) [temp](https://www.npmjs.com/package/temp) by [Daniel Rosenwasser](https://github.com/DanielRosenwasser) * [:link:](temp-fs/temp-fs.d.ts) [temp-fs](https://github.com/jakwings/node-temp-fs) by [MEDIA CHECK s.r.o.](http://www.mediacheck.cz) * [:link:](tether/tether.d.ts) [Tether](http://github.hubspot.com/tether) by [Adi Dahiya](https://github.com/adidahiya) * [:link:](tether-shepherd/tether-shepherd.d.ts) [Tether-Shepherd](http://github.hubspot.com/shepherd) by [Matt Gibbs](https://github.com/mtgibbs) * [:link:](text-buffer/text-buffer.d.ts) [text-buffer](https://github.com/atom/text-buffer) by [vvakame](https://github.com/vvakame) * [:link:](text-encoding/text-encoding.d.ts) [text-encoding](https://github.com/inexorabletash/text-encoding) by [MIZUNE Pine](https://github.com/pine613) -* [:link:](github-electron/github-electron-main.d.ts) [the Electron 0.25.2 main process](http://electron.atom.io) by [jedmao](https://github.com/jedmao) -* [:link:](github-electron/github-electron-renderer.d.ts) [the Electron 0.25.2 renderer process (web page)](http://electron.atom.io) by [jedmao](https://github.com/jedmao) +* [:link:](spotify-api/spotify-api.d.ts) [The Spotify Web API](https://developer.spotify.com/web-api) by [Niels Kristian Hansen Skovmand](https://github.com/skovmand) * [:link:](threejs/three-FirstPersonControls.d.ts) [three.js](http://mrdoob.github.com/three.js) by [Poul Kjeldager Sørensen](https://github.com/s093294) * [:link:](threejs/three-canvasrenderer.d.ts) [three.js (CanvasRenderer.js)](https://github.com/mrdoob/three.js/blob/master/examples/js/renderers/CanvasRenderer.js) by [Satoru Kimura](https://github.com/gyohk) * [:link:](threejs/three-copyshader.d.ts) [three.js (CopyShader.js)](https://github.com/mrdoob/three.js/blob/r68/examples/js/shaders/CopyShader.js) by [Satoru Kimura](https://github.com/gyohk) @@ -1353,7 +1448,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](threejs/three.d.ts) [three.js r73](http://mrdoob.github.com/three.js) by [Kon](http://phyzkit.net), [Satoru Kimura](https://github.com/gyohk) * [:link:](thrift/thrift.d.ts) [thrift](https://www.npmjs.com/package/thrift) by [Zachary Collins](https://github.com/corps) * [:link:](through/through.d.ts) [through](https://github.com/dominictarr/through) by [Andrew Gaspar](https://github.com/AndrewGaspar) -* [:link:](through2/through2.d.ts) [through2 v](https://github.com/rvagg/through2) by [Bart van der Schoor](https://github.com/Bartvds), [jedmao](https://github.com/jedmao) +* [:link:](through2/through2.d.ts) [through2 v](https://github.com/rvagg/through2) by [Bart van der Schoor](https://github.com/Bartvds), [jedmao](https://github.com/jedmao), [Georgios Valotasios](https://github.com/valotas) * [:link:](timelinejs/timelinejs.d.ts) [timelinejs](https://github.com/NUKnightLab/TimelineJS) by [Roland Zwaga](https://github.com/rolandzwaga) * [:link:](timezone-js/timezone-js.d.ts) [timezone-js](https://github.com/mde/timezone-js) by [bonnici](https://github.com/bonnici) * [:link:](timezonecomplete/timezonecomplete.d.ts) [timezonecomplete](https://github.com/SpiritIT/timezonecomplete) by [Rogier Schouten](https://github.com/rogierschouten) @@ -1367,10 +1462,12 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](tooltipster/tooltipster.d.ts) [tooltipster](https://github.com/iamceege/tooltipster) by [Stephen Lautier](https://github.com/stephenlautier) * [:link:](sencha_touch/SenchaTouch.d.ts) [Touch](http://www.sencha.com/products/touch) by [Brian Kotek](https://github.com/brian428) * [:link:](traceback/traceback.d.ts) [Traceback](http://github.com/iriscouch/traceback) by [Michael Zabka](https://github.com/misak113) +* [:link:](tracking/tracking.d.ts) [Tracking.js](https://github.com/eduardolundgren/tracking.js) by [Tim Perry](https://github.com/pimterry) * [:link:](traverson/traverson.d.ts) [Traverson](https://github.com/basti1302/traverson) by [Marcin Porębski](https://github.com/marcinporebski) * [:link:](trunk8/trunk8.d.ts) [trunk8](https://github.com/rviscomi/trunk8) by [Blake Niemyjski](https://github.com/niemyjski) * [:link:](tsmonad/tsmonad.d.ts) [TsMonad](https://github.com/cbowdon/TsMonad) by [Chris Bowdon](https://github.com/cbowdon) * [:link:](tspromise/tspromise.d.ts) [tspromise](https://github.com/soywiz/tspromise) by [Carlos Ballesteros Velasco](https://github.com/soywiz) +* [:link:](turf/turf.d.ts) [Turf](http://turfjs.org) by [Guillaume Croteau](https://github.com/gcroteau) * [:link:](tween.js/tween.js.d.ts) [tween.js r12](https://github.com/sole/tween.js) by [sunetos](https://github.com/sunetos), [jzarnikov](https://github.com/jzarnikov) * [:link:](tweenjs/tweenjs.d.ts) [TweenJS](http://www.createjs.com/#!/TweenJS) by [Pedro Ferreira](https://bitbucket.org/drk4), [Chris Smith](https://github.com/evilangelist) * [:link:](twig/twig.d.ts) [twig](https://github.com/justjohn/twig.js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) @@ -1389,9 +1486,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](ui-grid/ui-grid.d.ts) [ui-grid](http://www.ui-grid.info) by [Ben Tesser](https://github.com/btesser), [Joe Skeen](http://github.com/joeskeen) * [:link:](ui-router-extras/ui-router-extras.d.ts) [UI-Router Extras (ct.ui.router.extras module)](https://github.com/christopherthielen/ui-router-extras) by [Michael Putters](https://github.com/mputters), [Marcel van de Kamp](https://github.com/marcel-k) * [:link:](uikit/uikit.d.ts) [uikit](http://getuikit.org) by [Giovanni Silva](https://github.com/giovannicandido) -* [:link:](umbraco/umbraco.d.ts) [Umbraco](https://github.com/umbraco) by [DeCareSystemsIreland](https://github.com/DeCareSystemsIreland) -* [:link:](umbraco/umbraco-resources.d.ts) [Umbraco](https://github.com/umbraco) by [DeCareSystemsIreland](https://github.com/DeCareSystemsIreland) * [:link:](umbraco/umbraco-services.d.ts) [Umbraco](https://github.com/umbraco) by [DeCareSystemsIreland](https://github.com/DeCareSystemsIreland) +* [:link:](umbraco/umbraco-resources.d.ts) [Umbraco](https://github.com/umbraco) by [DeCareSystemsIreland](https://github.com/DeCareSystemsIreland) +* [:link:](umbraco/umbraco.d.ts) [Umbraco](https://github.com/umbraco) by [DeCareSystemsIreland](https://github.com/DeCareSystemsIreland) +* [:link:](umzug/umzug.d.ts) [Umzug](https://github.com/sequelize/umzug) by [Ivan Drinchev](https://github.com/drinchev) * [:link:](underscore/underscore.d.ts) [Underscore](http://underscorejs.org) by [Boris Yankov](https://github.com/borisyankov), [Josh Baldwin](https://github.com/jbaldwin) * [:link:](underscore-ko/underscore-ko.d.ts) [Underscore-ko 1.2.2 with underscore](https://github.com/kamranayub/UnderscoreKO) by [Maurits Elbers](https://github.com/MagicMau) * [:link:](underscore.string/underscore.string.d.ts) [underscore.string](https://github.com/epeli/underscore.string) by [Ry Racherbaumer](http://github.com/rygine) @@ -1399,6 +1497,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.uniform/jquery.uniform.d.ts) [Uniform.js](https://github.com/pixelmatrix/uniform) by [flyfishMT](https://github.com/flyfishMT) * [:link:](uniq/uniq.d.ts) [uniq](https://www.npmjs.com/package/uniq) by [Hans Windhoff](https://github.com/hansrwindhoff) * [:link:](unique-random/unique-random.d.ts) [unique-random](https://github.com/sindresorhus/unique-random) by [Yuki Kokubun](https://github.com/Kuniwak) +* [:link:](winrt/winrt-uwp.d.ts) [Universal Windows Platform](http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx) by [Kagami Sascha Rosylight](https://github.com/saschanaz), [Taylor Starfield](https://github.com/taylor224) * [:link:](universal-analytics/universal-analytics.d.ts) [universal-analytics](https://github.com/peaksandpies/universal-analytics) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](unorm/unorm.d.ts) [unorm](https://github.com/walling/unorm) by [Christopher Brown](https://github.com/chbrown) * [:link:](update-notifier/update-notifier.d.ts) [update-notifier](https://github.com/yeoman/update-notifier) by [vvakame](https://github.com/vvakame) @@ -1411,12 +1510,14 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](urlrouter/urlrouter.d.ts) [urlrouter](https://github.com/fengmk2/urlrouter) by [soywiz](https://github.com/soywiz) * [:link:](urlsafe-base64/urlsafe-base64.d.ts) [urlsafe-base64](https://github.com/RGBboy/urlsafe-base64) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](usage/usage.d.ts) [usage](https://github.com/arunoda/node-usage) by [Pascal Vomhoff](https://github.com/pvomhoff) +* [:link:](username/username.d.ts) [username](https://www.npmjs.com/package/username) by [Klaus Reimer](https://github.com/kayahr) * [:link:](utils-merge/utils-merge.d.ts) [utils-merge](https://github.com/jaredhanson/utils-merge) by [Ilya Mochalov](https://github.com/chrootsu) -* [:link:](UUID/UUID.d.ts) [UUID.js core](https://github.com/LiosK/UUID.js) by [Jason Jarrett](https://github.com/staxmanade) +* [:link:](uuid/UUID.d.ts) [UUID.js core](https://github.com/LiosK/UUID.js) by [Jason Jarrett](https://github.com/staxmanade) * [:link:](valerie/valerie.d.ts) [valerie](https://github.com/davewatts/valerie) by [Howard Richards](https://github.com/conficient) * [:link:](validator/validator.d.ts) [validator.js](https://github.com/chriso/validator.js) by [tgfjt](https://github.com/tgfjt) * [:link:](vega/vega.d.ts) [Vega](http://trifacta.github.io/vega) by [Tom Crockett](http://github.com/pelotom) * [:link:](velocity-animate/velocity-animate.d.ts) [Velocity](http://velocityjs.org) by [Greg Smith](https://github.com/smrq) +* [:link:](verror/verror.d.ts) [verror](https://github.com/davepacheco/node-verror) by [Sven Reglitzki](https://github.com/svi3c) * [:link:](vex-js/vex-js.d.ts) [Vex](https://github.com/HubSpot/vex) by [Greg Cohan](https://github.com/gdcohan) * [:link:](vexflow/vexflow.d.ts) [VexFlow](http://vexflow.com) by [Roman Quiring](https://github.com/rquiring) * [:link:](victor/victor.d.ts) [Victor.js](http://victorjs.org) by [Ivane Gegia](https://twitter.com/ivanegegia) @@ -1431,7 +1532,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](vortex-web-client/vortex-web-client.d.ts) [Vortex Web 1.2.0p1](http://www.prismtech.com/vortex/vortex-web) by [Stefan Profanter](https://github.com/Pro) * [:link:](voximplant-websdk/voximplant-websdk.d.ts) [VoxImplant Web SDK 3.0.x](http://voximplant.com) by [Alexey Aylarov](https://github.com/aylarov) * [:link:](vso-node-api/vso-node-api.d.ts) [vso-node-api](https://github.com/Microsoft/vso-node-api) by [Teddy Ward](https://github.com/teddyward) -* [:link:](vue/vue.d.ts) [vuejs](https://github.com/yyx990803/vue) by [odangosan](https://github.com/odangosan) +* [:link:](vue-router/vue-router.d.ts) [vue-router](https://github.com/vuejs/vue-router) by [kaorun343](https://github.com/kaorun343) +* [:link:](vue/vue.d.ts) [vuejs](https://github.com/vuejs/vue) by [odangosan](https://github.com/odangosan), [kaorun343](https://github.com/kaorun343) +* [:link:](wake_on_lan/wake_on_lan.d.ts) [wake_on_lan](https://github.com/agnat/node_wake_on_lan) by [Tobias Kahlert](https://github.com/SrTobi) * [:link:](watch/watch.d.ts) [watch](https://github.com/mikeal/watch) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](jquery.watermark/jquery.watermark.d.ts) [Watermark plugin for jQuery](http://jquery-watermark.googlecode.com) by [Anwar Javed](https://github.com/anwarjaved) * [:link:](webaudioapi/waa.d.ts) [Web Audio API](http://www.w3.org/TR/webaudio) by [Baruch Berger](https://github.com/bbss), [Kon](http://phyzkit.net), [kubosho](https://github.com/kubosho) @@ -1441,6 +1544,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](webcola/webcola.d.ts) [webcola](https://github.com/tgdwyer/WebCola) by [Qinfeng Chen](https://github.com/qinfchen), [Tim Dwyer](https://github.com/tgdwyer), [Noah Chen](https://github.com/nchen63) * [:link:](webcomponents.js/webcomponents.js.d.ts) [webcomponents.js](https://github.com/webcomponents/webcomponentsjs) by [Adi Dahiya](https://github.com/adidahiya) * [:link:](webcrypto/WebCrypto.d.ts) [WebCrypto](http://www.w3.org/TR/WebCryptoAPI) by [Lucas Dixon](https://github.com/iislucas) +* [:link:](webdriverio/webdriverio.d.ts) [webdriverio](http://www.webdriver.io) by [Nick Malaguti](https://github.com/nmalaguti) * [:link:](webgl-ext/webgl-ext.d.ts) [WebGL Extensions](http://webgl.org) by [Arthur Langereis](https://github.com/zenmumbler) * [:link:](webix/webix.d.ts) [Webix UI](http://webix.com) by [Maksim Kozhukh](http://github.com/mkozhukh) * [:link:](webpack/webpack.d.ts) [webpack](https://github.com/webpack/webpack) by [Qubo](https://github.com/tkqubo) @@ -1457,8 +1561,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](winrt/winrt.d.ts) [WinRT](http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx) by [TypeScript samples](https://www.typescriptlang.org) * [:link:](winston/winston.d.ts) [winston](https://github.com/flatiron/winston) by [bonnici](https://github.com/bonnici), [Peter Harris](https://github.com/codeanimal) * [:link:](wolfy87-eventemitter/wolfy87-eventemitter.d.ts) [wolfy87-eventemitter](https://github.com/Wolfy87/EventEmitter) by [ryiwamoto](https://github.com/ryiwamoto) +* [:link:](wordcloud/wordcloud.d.ts) [wordcloud](https://github.com/timdream/wordcloud2.js) by [Joe Skeen](http://github.com/joeskeen) +* [:link:](wreck/wreck.d.ts) [wreck](https://github.com/hapijs/wreck) by [Marcin Porębski](http://github.com/marcinporebski) * [:link:](wrench/wrench.d.ts) [wrench](https://github.com/ryanmcgrath/wrench-js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](ws/ws.d.ts) [ws](https://github.com/einaros/ws) by [Paul Loyd](https://github.com/loyd) +* [:link:](wu/wu.d.ts) [wu.js](https://fitzgen.github.io/wu.js) by [phiresky](https://github.com/phiresky) * [:link:](x-editable/x-editable.d.ts) [X-Editable](http://vitalets.github.io/x-editable/index.html) by [Chris Kirby](https://github.com/sirkirby) * [:link:](x2js/xml2json.d.ts) [x2js](https://code.google.com/p/x2js) by [Horiuchi_H](https://github.com/horiuchi) * [:link:](xdate/xdate.d.ts) [XDate](http://arshaw.com/xdate) by [yamada28go](https://github.com/yamada28go) @@ -1481,7 +1588,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](yui/yui.d.ts) [yui](https://github.com/yui/yui3) by [Gia Bảo @ Sân Đình](https://github.com/giabao) * [:link:](z-schema/z-schema.d.ts) [z-schema](https://github.com/zaggino/z-schema) by [Adam Meadows](https://github.com/job13er) * [:link:](zepto/zepto.d.ts) [Zepto](http://zeptojs.com) by [Josh Baldwin](https://github.com/jbaldwin) -* [:link:](zeroclipboard/zeroclipboard.d.ts) [ZeroClipboard](https://github.com/jonrohan/ZeroClipboard) by [Eric J. Smith](https://github.com/ejsmith), [Blake Niemyjski](https://github.com/niemyjski), [György Balássy](https://github.com/balassy) +* [:link:](zeroclipboard/zeroclipboard.d.ts) [ZeroClipboard v2.x.x](https://github.com/zeroclipboard/zeroclipboard) by [Eric J. Smith](https://github.com/ejsmith), [Blake Niemyjski](https://github.com/niemyjski), [György Balássy](https://github.com/balassy), [Leon Yu](https://github.com/leonyu) * [:link:](node_zeromq/zmq.d.ts) [ZeroMQ Node](https://github.com/JustinTulloss/zeromq.node) by [Dave McKeown](http://github.com/davemckeown) * [:link:](zip.js/zip.js.d.ts) [zip.js 2.x](https://github.com/gildas-lormeau/zip.js) by [Louis Grignon](https://github.com/lgrignon) * [:link:](zone.js/zone.js.d.ts) [Zone.js](https://github.com/angular/zone.js) by [angular team](https://github.com/angular) From 38fddea3d4d60235565aa750bcb0c8a8d2c20bb2 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 7 Jan 2016 08:45:52 +0100 Subject: [PATCH 273/441] updates as discussed --- github-electron/github-electron-main-tests.ts | 25 ++++++++++--------- .../github-electron-renderer-tests.ts | 8 +++--- github-electron/github-electron.d.ts | 4 +-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 55588681fa..00f9b3ae19 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -31,7 +31,7 @@ require('crash-reporter').start(); // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the javascript object is GCed. -var mainWindow: GitHubElectron.BrowserWindow = null; +var mainWindow: Electron.BrowserWindow = null; // Quit when all windows are closed. app.on('window-all-closed', () => { @@ -72,6 +72,7 @@ app.on('ready', () => { mainWindow.webContents.addWorkSpace('/path/to/workspace'); mainWindow.webContents.removeWorkSpace('/path/to/workspace'); var opened: boolean = mainWindow.webContents.isDevToolsOpened() + var focused = mainWindow.webContents.isDevToolsFocused(); // Emitted when the window is closed. mainWindow.on('closed', () => { // Dereference the window object, usually you would store windows @@ -116,21 +117,21 @@ app.on('ready', () => { app.addRecentDocument('/Users/USERNAME/Desktop/work.type'); app.clearRecentDocuments(); var dockMenu = Menu.buildFromTemplate([ - { + { label: 'New Window', click: () => { console.log('New Window'); } }, - { + { label: 'New Window with Settings', submenu: [ - { label: 'Basic' }, - { label: 'Pro' } + { label: 'Basic' }, + { label: 'Pro' } ] }, - { label: 'New Command...' }, - { + { label: 'New Command...' }, + { label: 'Edit', submenu: [ { @@ -167,7 +168,7 @@ var dockMenu = Menu.buildFromTemplate([ app.dock.setMenu(dockMenu); app.setUserTasks([ - { + { program: process.execPath, arguments: '--new-window', iconPath: process.execPath, @@ -186,7 +187,7 @@ window.setDocumentEdited(true); // Online/Offline Event Detection // https://github.com/atom/electron/blob/master/docs/tutorial/online-offline-events.md -var onlineStatusWindow: GitHubElectron.BrowserWindow; +var onlineStatusWindow: Electron.BrowserWindow; app.on('ready', () => { onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false }); @@ -275,12 +276,12 @@ globalShortcut.unregisterAll(); // ipcMain // https://github.com/atom/electron/blob/master/docs/api/ipc-main-process.md -ipcMain.on('asynchronous-message', (event: GitHubElectron.IPCMainEvent, arg: any) => { +ipcMain.on('asynchronous-message', (event: Electron.IPCMainEvent, arg: any) => { console.log(arg); // prints "ping" event.sender.send('asynchronous-reply', 'pong'); }); -ipcMain.on('synchronous-message', (event: GitHubElectron.IPCMainEvent, arg: any) => { +ipcMain.on('synchronous-message', (event: Electron.IPCMainEvent, arg: any) => { console.log(arg); // prints "ping" event.returnValue = 'pong'; }); @@ -460,7 +461,7 @@ app.on('ready', () => { // tray // https://github.com/atom/electron/blob/master/docs/api/tray.md -var appIcon: GitHubElectron.Tray = null; +var appIcon: Electron.Tray = null; app.on('ready', () => { appIcon = new Tray('/path/to/my/icon'); var contextMenu = Menu.buildFromTemplate([ diff --git a/github-electron/github-electron-renderer-tests.ts b/github-electron/github-electron-renderer-tests.ts index cf610718ce..7ddd585a72 100644 --- a/github-electron/github-electron-renderer-tests.ts +++ b/github-electron/github-electron-renderer-tests.ts @@ -24,7 +24,7 @@ ipcRenderer.send('asynchronous-message', 'ping'); // remote // https://github.com/atom/electron/blob/master/docs/api/remote.md -var BrowserWindow: typeof GitHubElectron.BrowserWindow = remote.require('browser-window'); +var BrowserWindow: typeof Electron.BrowserWindow = remote.require('browser-window'); var win = new BrowserWindow({ width: 800, height: 600 }); win.loadURL('https://github.com'); @@ -75,7 +75,7 @@ crashReporter.start({ // nativeImage // https://github.com/atom/electron/blob/master/docs/api/native-image.md -var Tray: typeof GitHubElectron.Tray = remote.require('Tray'); +var Tray: typeof Electron.Tray = remote.require('Tray'); var appIcon2 = new Tray('/Users/somebody/images/icon.png'); var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' }); var image = clipboard.readImage(); @@ -85,9 +85,9 @@ var appIcon4 = new Tray('/Users/somebody/images/icon.png'); // screen // https://github.com/atom/electron/blob/master/docs/api/screen.md -var app: GitHubElectron.App = remote.require('app'); +var app: Electron.App = remote.require('app'); -var mainWindow: GitHubElectron.BrowserWindow = null; +var mainWindow: Electron.BrowserWindow = null; app.on('ready', () => { var size = screen.getPrimaryDisplay().workAreaSize; diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index df04e62711..29244bf93b 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -914,7 +914,7 @@ declare module Electron { * Should be specified for submenu type menu item, when it's specified the * type: 'submenu' can be omitted for the menu item */ - submenu?: Menu; + submenu?: Menu|MenuItemOptions[]; /** * Unique within a single menu. If defined then it can be used as a reference * to this item by the position attribute. @@ -1879,4 +1879,4 @@ declare module 'electron' { interface NodeRequireFunction { (moduleName: 'electron'): Electron.ElectronMainAndRenderer; -} \ No newline at end of file +} From 0eb88e69d7d77466eff7fda49340fac94ec2551a Mon Sep 17 00:00:00 2001 From: Bogdan Radacina Date: Thu, 7 Jan 2016 20:19:49 +1100 Subject: [PATCH 274/441] showOpenDialog returns string[] The showOpenDialog() function returns string[] as per https://github.com/atom/electron/blob/master/docs/api/dialog.md --- github-electron/github-electron.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index b1df3bccce..290bf06aa2 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1157,11 +1157,11 @@ declare module GitHubElectron { browserWindow?: BrowserWindow, options?: OpenDialogOptions, callback?: (fileNames: string[]) => void - ): void; + ): string[]; export function showOpenDialog( options?: OpenDialogOptions, callback?: (fileNames: string[]) => void - ): void; + ): string[]; interface OpenDialogOptions { title?: string; From c4df2bf9f07a04b4ae46a919fae7d2d694442df4 Mon Sep 17 00:00:00 2001 From: William Comartin Date: Thu, 7 Jan 2016 08:59:33 -0500 Subject: [PATCH 275/441] change file names to match that of npm and bower --- .../leaflet.fullscreen-tests.ts | 13 ++++++++++++- .../leaflet.fullscreen.d.ts | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) rename leaflet-fullscreen/leaflet-fullscreen-tests.ts => leaflet.fullscreen/leaflet.fullscreen-tests.ts (52%) rename leaflet-fullscreen/leaflet-fullscreen.d.ts => leaflet.fullscreen/leaflet.fullscreen.d.ts (96%) diff --git a/leaflet-fullscreen/leaflet-fullscreen-tests.ts b/leaflet.fullscreen/leaflet.fullscreen-tests.ts similarity index 52% rename from leaflet-fullscreen/leaflet-fullscreen-tests.ts rename to leaflet.fullscreen/leaflet.fullscreen-tests.ts index 50a427a79d..d74a19dcbd 100644 --- a/leaflet-fullscreen/leaflet-fullscreen-tests.ts +++ b/leaflet.fullscreen/leaflet.fullscreen-tests.ts @@ -1,6 +1,8 @@ -/// +/// var map: L.Map; + +// Defaults var icon: L.Control.Fullscreen = L.control.fullscreen({ position: 'topleft', title: 'Full Screen', @@ -10,3 +12,12 @@ var icon: L.Control.Fullscreen = L.control.fullscreen({ }); icon.addTo(map); + + +// My Usage + +L.control.fullscreen({ + position: 'topleft', + content: '', + forceSeparateButton: true, +}).addTo(map); diff --git a/leaflet-fullscreen/leaflet-fullscreen.d.ts b/leaflet.fullscreen/leaflet.fullscreen.d.ts similarity index 96% rename from leaflet-fullscreen/leaflet-fullscreen.d.ts rename to leaflet.fullscreen/leaflet.fullscreen.d.ts index ea955bf41e..864817f22b 100644 --- a/leaflet-fullscreen/leaflet-fullscreen.d.ts +++ b/leaflet.fullscreen/leaflet.fullscreen.d.ts @@ -12,6 +12,7 @@ declare module L { export interface Fullscreen extends L.Control {} export interface FullscreenOptions { + content?: string, position?: string, title?: string, titleCancel?: string, From dfe3e8d966bc27bc896728b3b0b773d868277142 Mon Sep 17 00:00:00 2001 From: Andrei Alecu Date: Thu, 7 Jan 2016 16:31:07 +0200 Subject: [PATCH 276/441] Also fix `_(dictionary)` --- underscore/underscore-tests.ts | 4 ++++ underscore/underscore.d.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/underscore/underscore-tests.ts b/underscore/underscore-tests.ts index 24815e1cee..b57e6e37e3 100644 --- a/underscore/underscore-tests.ts +++ b/underscore/underscore-tests.ts @@ -494,5 +494,9 @@ function strong_typed_values_tests() { return [r.title, true]; }).object().value(); + _(dictionaryLike).each((x) => { + console.log(x.title); + console.log(x.value.toFixed()); + }) _.values<{title: string, value: number}>(dictionaryLike); } diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 5b7e6a2f3d..468c321023 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -76,6 +76,7 @@ interface UnderscoreStatic { * as the first parameter can be invoked through this function. * @param key First argument to Underscore object functions. **/ + (value: _.Dictionary): Underscore; (value: Array): Underscore; (value: T): Underscore; From 07b956ceeacbe3c6cb5c5787813ea161697329a8 Mon Sep 17 00:00:00 2001 From: Andrei Alecu Date: Thu, 7 Jan 2016 16:36:06 +0200 Subject: [PATCH 277/441] Formatting. --- underscore/underscore-tests.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/underscore/underscore-tests.ts b/underscore/underscore-tests.ts index b57e6e37e3..661daf8c6d 100644 --- a/underscore/underscore-tests.ts +++ b/underscore/underscore-tests.ts @@ -481,22 +481,22 @@ _.chain(obj).map(function (value, key) { }); function strong_typed_values_tests() { - var dictionaryLike: { [k: string] : {title: string, value: number} } = { - 'test' : { title: 'item1', value: 5 }, - 'another' : { title: 'item2', value: 8 }, - 'third' : { title: 'item3', value: 10 } - }, - empty = {}; + var dictionaryLike: { [k: string] : {title: string, value: number} } = { + 'test' : { title: 'item1', value: 5 }, + 'another' : { title: 'item2', value: 8 }, + 'third' : { title: 'item3', value: 10 } + }; - _.chain(dictionaryLike).values().filter((r) => { - return r.value >= 8; - }).map((r) => { - return [r.title, true]; - }).object().value(); + _.chain(dictionaryLike).values().filter((r) => { + return r.value >= 8; + }).map((r) => { + return [r.title, true]; + }).object().value(); - _(dictionaryLike).each((x) => { - console.log(x.title); - console.log(x.value.toFixed()); - }) - _.values<{title: string, value: number}>(dictionaryLike); + _(dictionaryLike).each((x) => { + console.log(x.title); + console.log(x.value.toFixed()); + }); + + _.values<{title: string, value: number}>(dictionaryLike); } From 9028ed35ea3b66444911c567ebeaaed2a5e62c73 Mon Sep 17 00:00:00 2001 From: tiso Date: Thu, 7 Jan 2016 16:21:51 +0100 Subject: [PATCH 278/441] Add sortDirectionCycle in interface IColumnDefOf --- ui-grid/ui-grid.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 1c7eb13707..89778d5733 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -3766,6 +3766,14 @@ declare module uiGrid { * You may specify one of the sortingAlgorithms found in the rowSorter service. */ sortCellFiltered?: boolean; + /** + * (optional) An array of sort directions, specifying the order that they should cycle through as + * the user repeatedly clicks on the column heading. The default is [null, uiGridConstants.ASC, uiGridConstants.DESC]. + * Null refers to the unsorted state. This does not affect the initial sort direction; use the sort property for that. + * If suppressRemoveSort is also set, the unsorted state will be skipped even if it is listed here. Each direction may + * not appear in the list more than once (e.g. [ASC, DESC, DESC] is not allowed), and the list may not be empty.* + */ + sortDirectionCycle?: Array; /** Algorithm to use for sorting this column */ sortingAlgorithm?: (a: any, b: any) => number; /** From fe1d50cbd34382ef45d354aa26d900d8f5d7374b Mon Sep 17 00:00:00 2001 From: rdogmartin Date: Thu, 7 Jan 2016 08:55:23 -0700 Subject: [PATCH 279/441] Make MenuOptions extend MenuEvents The menu widget definition does not allow a MenuEvents object to be passed to it during initialization. For example, this gives an error from TypeScript: $el.menu({select: (e, ui) => { }}); I modified the MenuOptions definition to extend MenuEvents and removed MenuEvents from the Menu interface definition. This makes it consistent with how the other widgets are defined and allows both options and events to be defined when creating a menu widget. --- jqueryui/jqueryui.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index ade8eb735d..7f117cc079 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -498,7 +498,7 @@ declare module JQueryUI { // Menu ////////////////////////////////////////////////// - interface MenuOptions { + interface MenuOptions extends MenuEvents { disabled?: boolean; icons?: any; menus?: string; @@ -520,7 +520,7 @@ declare module JQueryUI { select?: MenuEvent; } - interface Menu extends Widget, MenuOptions, MenuEvents { + interface Menu extends Widget, MenuOptions { } From d12cb4f80a6ae6b9c14e0116cad340aa59e83577 Mon Sep 17 00:00:00 2001 From: rdogmartin Date: Thu, 7 Jan 2016 09:43:34 -0700 Subject: [PATCH 280/441] Add item property to MenuUIParams in JQueryUI The ui parameter that is returned to the caller in jQueryUI menu events (e.g. select) has an optional property named item, but it was not included in this type file. --- jqueryui/jqueryui.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index 7f117cc079..e93ca9301c 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -507,6 +507,7 @@ declare module JQueryUI { } interface MenuUIParams { + item?: JQuery; } interface MenuEvent { From c5d7c7a293ded80cb28b55a3e13249a9b8b52f49 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 7 Jan 2016 21:40:26 +0500 Subject: [PATCH 281/441] lodash: signatures of _.create have been changed --- lodash/lodash-tests.ts | 43 ++++++++++++++++++++++++++---------------- lodash/lodash.d.ts | 15 +++++++++++++-- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2b..c60d303a70 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6774,23 +6774,34 @@ module TestAssign { } // _.create -interface TestCreateProto { - a: number; +module TestCreate { + type SampleProto = {a: number}; + type SampleProps = {b: string}; + + let prototype: SampleProto; + let properties: SampleProps; + + { + let result: {a: number; b: string}; + + result = _.create(prototype, properties); + result = _.create(prototype, properties); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number; b: string}>; + + result = _(prototype).create(properties); + result = _(prototype).create(properties); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number; b: string}>; + + result = _(prototype).chain().create(properties); + result = _(prototype).chain().create(properties); + } } -interface TestCreateProps { - b: string; -} -interface TestCreateTResult extends TestCreateProto, TestCreateProps {} -var testCreateProto: TestCreateProto; -var testCreateProps: TestCreateProps; -result = <{}>_.create(testCreateProto); -result = <{}>_.create(testCreateProto, testCreateProps); -result = _.create(testCreateProto); -result = _.create(testCreateProto, testCreateProps); -result = <{}>_(testCreateProto).create().value(); -result = <{}>_(testCreateProto).create(testCreateProps).value(); -result = _(testCreateProto).create().value(); -result = _(testCreateProto).create(testCreateProps).value(); // _.defaults module TestDefaults { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c45ec90eea..421e5e1341 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11155,18 +11155,29 @@ declare module _ { /** * Creates an object that inherits from the given prototype object. If a properties object is provided its own * enumerable properties are assigned to the created object. + * * @param prototype The object to inherit from. * @param properties The properties to assign to the object. * @return Returns the new object. */ - create(prototype: Object, properties?: Object): TResult; + create( + prototype: T, + properties?: U + ): T & U; } interface LoDashImplicitObjectWrapper { /** * @see _.create */ - create(properties?: Object): LoDashImplicitObjectWrapper; + create(properties?: U): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.create + */ + create(properties?: U): LoDashExplicitObjectWrapper; } //_.defaults From ccf1db94c840f6615b14dd9edf2e26b33e9da421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3bert=20Darida?= Date: Thu, 7 Jan 2016 17:46:50 +0100 Subject: [PATCH 282/441] Update webfontloader.d.ts The 'text' property of the Google interface is optional. https://github.com/typekit/webfontloader#google --- webfontloader/webfontloader.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webfontloader/webfontloader.d.ts b/webfontloader/webfontloader.d.ts index 0afadfd3bf..bea108ec17 100644 --- a/webfontloader/webfontloader.d.ts +++ b/webfontloader/webfontloader.d.ts @@ -35,8 +35,8 @@ declare module WebFont { monotype?:Monotype; } export interface Google { - families?:Array; - text: string; + families:Array; + text?: string; } export interface Typekit { id?:Array; @@ -57,4 +57,4 @@ declare module WebFont { } declare module "webfontloader" { export = WebFont; -} \ No newline at end of file +} From c339d634e8e4016cdfa265b6ac9b6a6d5b218967 Mon Sep 17 00:00:00 2001 From: Theo Sherry Date: Thu, 7 Jan 2016 12:49:39 -0500 Subject: [PATCH 283/441] ready for PR --- consolidate/consolidate-tests.ts | 187 +++++++++++++++++++++++++++---- consolidate/consolidate.d.ts | 89 +++++++++++---- 2 files changed, 234 insertions(+), 42 deletions(-) diff --git a/consolidate/consolidate-tests.ts b/consolidate/consolidate-tests.ts index bf4fea4496..77fddb631d 100644 --- a/consolidate/consolidate-tests.ts +++ b/consolidate/consolidate-tests.ts @@ -1,27 +1,168 @@ /// +import cons = require('consolidate'); -import consolidate = require('consolidate'); +var path: string = 'test/path'; +var options = {user: 'tobi'}; +var fn = function(err: Error, html: string) {}; + +cons.atpl(path); +cons.atpl(path, options); +cons.atpl(path, options, fn); + +cons.dot(path); +cons.dot(path, options); +cons.dot(path, options, fn); + +cons.dust(path); +cons.dust(path, options); +cons.dust(path, options, fn); + +cons.eco(path); +cons.eco(path, options); +cons.eco(path, options, fn); + +cons.ect(path); +cons.ect(path, options); +cons.ect(path, options, fn); + +cons.ejs(path); +cons.ejs(path, options); +cons.ejs(path, options, fn); + +cons.haml(path); +cons.haml(path, options); +cons.haml(path, options, fn); + +// TODO figure out how to type haml-coffee +// cons['haml-coffee'](path, options, fn); + +cons.hamlet(path); +cons.hamlet(path, options); +cons.hamlet(path, options, fn); + +cons.handlebars(path); +cons.handlebars(path, options); +cons.handlebars(path, options, fn); + +cons.hogan(path); +cons.hogan(path, options); +cons.hogan(path, options, fn); + +cons.htmling(path); +cons.htmling(path, options); +cons.htmling(path, options, fn); + +cons.jade(path); +cons.jade(path, options); +cons.jade(path, options, fn); + +cons.jazz(path); +cons.jazz(path, options); +cons.jazz(path, options, fn); + +cons.jqtpl(path); +cons.jqtpl(path, options); +cons.jqtpl(path, options, fn); + +cons.just(path); +cons.just(path, options); +cons.just(path, options, fn); + +cons.liquid(path); +cons.liquid(path, options); +cons.liquid(path, options, fn); + +cons.liquor(path); +cons.liquor(path, options); +cons.liquor(path, options, fn); + +cons.lodash(path); +cons.lodash(path, options); +cons.lodash(path, options, fn); + +cons.mote(path); +cons.mote(path, options); +cons.mote(path, options, fn); + +cons.mustache(path); +cons.mustache(path, options); +cons.mustache(path, options, fn); + +cons.nunjucks(path); +cons.nunjucks(path, options); +cons.nunjucks(path, options, fn); + +cons.qejs(path); +cons.qejs(path, options); +cons.qejs(path, options, fn); + +cons.ractive(path); +cons.ractive(path, options); +cons.ractive(path, options, fn); + +cons.react(path); +cons.react(path, options); +cons.react(path, options, fn); + +cons.swig(path); +cons.swig(path, options); +cons.swig(path, options, fn); + +cons.templayed(path); +cons.templayed(path, options); +cons.templayed(path, options, fn); + +cons.toffee(path); +cons.toffee(path, options); +cons.toffee(path, options, fn); + +cons.underscore(path); +cons.underscore(path, options); +cons.underscore(path, options, fn); + +cons.walrus(path); +cons.walrus(path, options); +cons.walrus(path, options, fn); + +cons.whiskers(path); +cons.whiskers(path, options); +cons.whiskers(path, options, fn); + +/** + * Examples from documentation + * https://github.com/tj/consolidate.js/ + */ +// Common use +cons.swig('views/page.html', { user: 'tobi' }, function(err, html) { + if (err) throw err; + console.log(html); +}); + +// Options object is optional +cons.swig('views/page.html', function(err, html) { + if (err) throw err; + console.log(html); +}); + +// To dynamically pass the engine, simply use the subscript operator and a variable: +cons['swig']('views/page.html', { user: 'tobi' }, function(err, html) { + if (err) throw err; + console.log(html); +}); + +// Returns a promise if no is callback passed in: +cons.swig('views/page.html', { user: 'tobi' }) + .then(function(html) { + console.log(html); + }) + .catch(function(err) { + throw err; + }); + +// Caching +cons.swig('views/page.html', { cache: false, user: 'tobi' }, function(err, html) { + if (err) throw err; + console.log(html); +}); -var path: string = null; -var options: any = null; -var fn: any = null; -consolidate.clearCache(); -consolidate.jade(path, options, fn); -consolidate.dust(path, options, fn); -consolidate.swig(path, options, fn); -consolidate.liquor(path, options, fn); -consolidate.ejs(path, options, fn); -consolidate.eco(path, options, fn); -consolidate.jazz(path, options, fn); -consolidate.jqtpl(path, options, fn); -consolidate.haml(path, options, fn); -consolidate.whiskers(path, options, fn); -//consolidate.'haml-coffee':Function; -consolidate.hogan(path, options, fn); -consolidate.handlebars(path, options, fn); -consolidate.underscore(path, options, fn); -consolidate.qejs(path, options, fn); -consolidate.walrus(path, options, fn); -consolidate.mustache(path, options, fn); -consolidate.dot(path, options, fn); diff --git a/consolidate/consolidate.d.ts b/consolidate/consolidate.d.ts index 3bfe35bf04..a465bd7f4c 100644 --- a/consolidate/consolidate.d.ts +++ b/consolidate/consolidate.d.ts @@ -6,25 +6,76 @@ // Imported from: https://github.com/soywiz/typescript-node-definitions/consolidate.d.ts /// +/// + declare module "consolidate" { - export function clearCache(): void; - export var jade: (path: String, options: any, fn: any) => void; - export var dust: (path: String, options: any, fn: any) => void; - export var swig: (path: String, options: any, fn: any) => void; - export var liquor: (path: String, options: any, fn: any) => void; - export var ejs: (path: String, options: any, fn: any) => void; - export var eco: (path: String, options: any, fn: any) => void; - export var jazz: (path: String, options: any, fn: any) => void; - export var jqtpl: (path: String, options: any, fn: any) => void; - export var haml: (path: String, options: any, fn: any) => void; - export var whiskers: (path: String, options: any, fn: any) => void; - //export var 'haml-coffee':Function; - export var hogan: (path: String, options: any, fn: any) => void; - export var handlebars: (path: String, options: any, fn: any) => void; - export var underscore: (path: String, options: any, fn: any) => void; - export var qejs: (path: String, options: any, fn: any) => void; - export var walrus: (path: String, options: any, fn: any) => void; - export var mustache: (path: String, options: any, fn: any) => void; - export var dot: (path: String, options: any, fn: any) => void; + var cons: Consolidate; + + export = cons; + + interface Consolidate { + /** + * expose the instance of the engine + */ + requires: Object; + + /** + * Clear the cache. + * + * @api public + */ + clearCache(): void; + // template engines + atpl: RendererInterface; + // atpl(path: String, fn: (err: Error, html: String) => any ): any; + // atpl(path: String, options: Options, fn: (err: Error, html: String) => any): any; + // atpl(path: String, options?: Options): Promise; + + // atpl: TemplateProperty; + dot: RendererInterface; + dust: RendererInterface; + eco: RendererInterface; + ejs: RendererInterface; + ect: RendererInterface; + haml: RendererInterface; + // TODO figure out how to do haml-coffee + hamlet: RendererInterface; + handlebars: RendererInterface; + hogan: RendererInterface; + htmling: RendererInterface; + jade: RendererInterface; + jazz: RendererInterface; + jqtpl: RendererInterface; + just: RendererInterface; + liquid: RendererInterface; + liquor: RendererInterface; + lodash: RendererInterface; + mote: RendererInterface; + mustache: RendererInterface; + nunjucks: RendererInterface; + qejs: RendererInterface; + ractive: RendererInterface; + react: RendererInterface; + swig: RendererInterface; + templayed: RendererInterface; + toffee: RendererInterface; + underscore: RendererInterface; + walrus: RendererInterface; + whiskers: RendererInterface; + } + + interface RendererInterface { + render(path: String, fn: (err: Error, html: String) => any): any; + + render(path: String, options: {cache?: boolean, [otherOptions: string]: any}, fn: (err: Error, html: String) => any): any; + + render(path: String, options?: { cache?: boolean, [otherOptions: string]: any }): Promise; + + (path: String, fn: (err: Error, html: String) => any): any; + + (path: String, options: { cache?: boolean, [otherOptions: string]: any }, fn: (err: Error, html: String) => any): any; + + (path: String, options?: { cache?: boolean, [otherOptions: string]: any }): Promise; + } } From a3e6a6101300a2936c6187c79b827d7b95748af2 Mon Sep 17 00:00:00 2001 From: Theo Sherry Date: Thu, 7 Jan 2016 12:52:19 -0500 Subject: [PATCH 284/441] ready for PR --- consolidate/consolidate.d.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/consolidate/consolidate.d.ts b/consolidate/consolidate.d.ts index a465bd7f4c..db23a31524 100644 --- a/consolidate/consolidate.d.ts +++ b/consolidate/consolidate.d.ts @@ -1,6 +1,6 @@ // Type definitions for consolidate // Project: https://github.com/visionmedia/consolidate.js -// Definitions by: Carlos Ballesteros Velasco +// Definitions by: Carlos Ballesteros Velasco , Theo Sherry // Definitions: https://github.com/borisyankov/DefinitelyTyped // Imported from: https://github.com/soywiz/typescript-node-definitions/consolidate.d.ts @@ -8,7 +8,6 @@ /// /// - declare module "consolidate" { var cons: Consolidate; @@ -28,11 +27,6 @@ declare module "consolidate" { clearCache(): void; // template engines atpl: RendererInterface; - // atpl(path: String, fn: (err: Error, html: String) => any ): any; - // atpl(path: String, options: Options, fn: (err: Error, html: String) => any): any; - // atpl(path: String, options?: Options): Promise; - - // atpl: TemplateProperty; dot: RendererInterface; dust: RendererInterface; eco: RendererInterface; From d5e1c4b1f5283ed68e3407f9cefb1266af0fbfbe Mon Sep 17 00:00:00 2001 From: Ben Loveridge Date: Thu, 7 Jan 2016 14:07:07 -0700 Subject: [PATCH 285/441] Support more variations of IStateService.get --- angular-ui-router/angular-ui-router-tests.ts | 7 ++++++- angular-ui-router/angular-ui-router.d.ts | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/angular-ui-router/angular-ui-router-tests.ts b/angular-ui-router/angular-ui-router-tests.ts index 41661d60d5..07711b9b87 100644 --- a/angular-ui-router/angular-ui-router-tests.ts +++ b/angular-ui-router/angular-ui-router-tests.ts @@ -177,8 +177,13 @@ class UrlLocatorTestService implements IUrlLocatorTestService { if (this.$state.href("myState") === "/myState") { // } - this.$state.get("myState"); this.$state.get(); + this.$state.get("myState"); + this.$state.get("myState", "yourState"); + this.$state.get("myState", this.$state.current); + this.$state.get(this.$state.current); + this.$state.get(this.$state.current, "yourState"); + this.$state.get(this.$state.current, this.$state.current); this.$state.reload(); // http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state#properties diff --git a/angular-ui-router/angular-ui-router.d.ts b/angular-ui-router/angular-ui-router.d.ts index a22b7d0da3..324ec676c8 100644 --- a/angular-ui-router/angular-ui-router.d.ts +++ b/angular-ui-router/angular-ui-router.d.ts @@ -261,7 +261,10 @@ declare module angular.ui { is(state: IState, params?: {}): boolean; href(state: IState, params?: {}, options?: IHrefOptions): string; href(state: string, params?: {}, options?: IHrefOptions): string; - get(state: string): IState; + get(state: string, context?: string): IState; + get(state: IState, context?: string): IState; + get(state: string, context?: IState): IState; + get(state: IState, context?: IState): IState; get(): IState[]; /** A reference to the state's config object. However you passed it in. Useful for accessing custom data. */ current: IState; From 77669f31509f704cf2e9ddc0d1df8081e6596ca6 Mon Sep 17 00:00:00 2001 From: Bogdan Radacina Date: Fri, 8 Jan 2016 08:56:45 +1100 Subject: [PATCH 286/441] Add showOpenDialog tests for both call variants --- github-electron/github-electron-main-tests.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 55588681fa..fd7437a890 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -249,9 +249,21 @@ contentTracing.startRecording('*', contentTracing.DEFAULT_OPTIONS, () => { // dialog // https://github.com/atom/electron/blob/master/docs/api/dialog.md -console.log(dialog.showOpenDialog({ +// variant without browserWindow +var openDialogResult: string[] = dialog.showOpenDialog({ + title: 'Testing showOpenDialog', + defaultPath: '/var/log/syslog', + filters: [{name: '', extensions: ['']}], properties: ['openFile', 'openDirectory', 'multiSelections'] -})); +}); + +// variant with browserWindow +openDialogResult = dialog.showOpenDialog(win, { + title: 'Testing showOpenDialog', + defaultPath: '/var/log/syslog', + filters: [{name: '', extensions: ['']}], + properties: ['openFile', 'openDirectory', 'multiSelections'] +}); // global-shortcut // https://github.com/atom/electron/blob/master/docs/api/global-shortcut.md From 939bf16689c3d3ebf18adf3310aa2ce89efb289d Mon Sep 17 00:00:00 2001 From: tkqubo Date: Mon, 4 Jan 2016 22:31:29 +0900 Subject: [PATCH 287/441] feat: osmtogeojson --- osmtogeojson/osmtogeojson-tests.ts | 94 +++++++++++++++++++++++++++++ osmtogeojson/osmtogeojson.d.ts | 96 ++++++++++++++++++++++++++++++ 2 files changed, 190 insertions(+) create mode 100644 osmtogeojson/osmtogeojson-tests.ts create mode 100644 osmtogeojson/osmtogeojson.d.ts diff --git a/osmtogeojson/osmtogeojson-tests.ts b/osmtogeojson/osmtogeojson-tests.ts new file mode 100644 index 0000000000..3bb83c1002 --- /dev/null +++ b/osmtogeojson/osmtogeojson-tests.ts @@ -0,0 +1,94 @@ +/// + +import osmtogeojson from 'osmtogeojson'; +import {OsmJSON, GeoJSON} from 'osmtogeojson'; + +let xml: Document = (new DOMParser()).parseFromString("", 'text/xml'); +let geojson: GeoJSON.FeatureCollection = { + type: "FeatureCollection", + features: [ + { + type: "Feature", + id: "node/1", + properties: { + type: "node", + id: 1, + tags: {}, + relations: [], + meta: {} + }, + geometry: { + type: "Point", + coordinates: [4.321, 1.234] + } + } + ] +}; + +osmtogeojson.toGeojson(xml); +osmtogeojson(xml, { + flatProperties: true, + uninterestingTags: {foo:true} +}); + +let json: OsmJSON.Root = { + elements: [ + { + type: "node", + id: 1, + lat: 1.234, + lon: 4.321, + timestamp: "2013-01-13T22:56:07Z", + version: 7, + changeset: 1234, + user: "johndoe", + uid: 666 + }, + { + type: "relation", + tags: {"type": "multipolygon"}, + id: 1, + members: [ + { + type: "way", + ref: 2, + role: "outer" + }, + { + type: "way", + ref: 3, + role: "outer" + } + ] + }, + { + type: "way", + id: 2, + nodes: [4,5,6,4] + }, + { + type: "node", + id: 4, + lat: 0.0, + lon: 0.0 + }, + { + type: "node", + id: 5, + lat: 0.0, + lon: 1.0 + }, + { + type: "node", + id: 6, + lat: 1.0, + lon: 0.0 + } + ] +}; + +osmtogeojson.toGeojson(json); +osmtogeojson(json, { + flatProperties: true, + uninterestingTags: {foo:true} +}); diff --git a/osmtogeojson/osmtogeojson.d.ts b/osmtogeojson/osmtogeojson.d.ts new file mode 100644 index 0000000000..0edee35094 --- /dev/null +++ b/osmtogeojson/osmtogeojson.d.ts @@ -0,0 +1,96 @@ +// Type definitions for osmtogeojson 2.2.5 +// Project: https://github.com/tyrasd/osmtogeojson.git +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "osmtogeojson" { + export interface OsmToGeoJSON { + (data: Document|OsmJSON.Root, options?: Options): GeoJSON.GeoJSONObject; + toGeojson(data: Document|OsmJSON.Root, options?: Options): GeoJSON.GeoJSONObject; + } + + export interface Options { + verbose?: boolean; + /** + * If true, the resulting GeoJSON feature's properties will be a simple key-value list instead of a structured json object (with separate tags and metadata). default: false + */ + flatProperties?: boolean; + /** + * Either a blacklist of tag keys or a callback function. Will be used to decide if a feature is interesting enough for its own GeoJSON feature. + */ + uninterestingTags?: { [tag: string]: boolean; }|Function; //TODO: type function + /** + * Either a json object or callback function that is used to determine if a closed way should be treated as a Polygon or LineString. + */ + polygonFeatures?: any|Function; //TODO: type this + } + + export namespace GeoJSON { + export interface GeoJSONObject { + type: string; + } + + export interface Feature extends GeoJSONObject { + id?: string; + geometry: Geometry; + properties: any; //TODO: type this + } + + export interface FeatureCollection extends GeoJSONObject { + features: Feature[]; + } + + export interface Geometry extends GeoJSONObject { + coordinates: Coordinate|Coordinate[]|Coordinate[][]; + } + + export interface GeometryCollection extends GeoJSONObject { + geometries: Geometry[]; + } + + export type Coordinate2d = [number, number]; + export type Coordinate3d = [number, number, number]; + export type Coordinate = Coordinate2d|Coordinate3d; + } + + export namespace OsmJSON { + export interface Root { + elements: (Node|Way|Relationship)[]; + } + + export interface OsmJSONObject { + type: string; + id: number; + tags?: { [name: string]: string; } + timestamp?: string; + version?: number; + changeset?: number; + user?: string; + uid?: number; + } + + export interface Node extends OsmJSONObject { + lat: number; + lon: number; + } + + export interface Way extends OsmJSONObject { + nodes: number[]; + } + + export interface Relationship extends OsmJSONObject { + members: Member[]; + } + + export interface Member { + type: string; + ref: number; + role: string; + } + } + + var osmtogeojson: OsmToGeoJSON; + + export default osmtogeojson; +} + From 811fc834c743e52fbc5acc9f97b9de27a31afe3e Mon Sep 17 00:00:00 2001 From: tkqubo Date: Tue, 5 Jan 2016 00:39:30 +0900 Subject: [PATCH 288/441] Add osmtogeojson --- osmtogeojson/osmtogeojson-tests.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osmtogeojson/osmtogeojson-tests.ts b/osmtogeojson/osmtogeojson-tests.ts index 3bb83c1002..a4debe4c11 100644 --- a/osmtogeojson/osmtogeojson-tests.ts +++ b/osmtogeojson/osmtogeojson-tests.ts @@ -1,9 +1,11 @@ /// +/// import osmtogeojson from 'osmtogeojson'; import {OsmJSON, GeoJSON} from 'osmtogeojson'; +import * as xmldom from 'xmldom'; -let xml: Document = (new DOMParser()).parseFromString("", 'text/xml'); +let xml: Document = (new xmldom.DOMParser()).parseFromString("", 'text/xml'); let geojson: GeoJSON.FeatureCollection = { type: "FeatureCollection", features: [ From 868b56d377ac0e47b68d5f2b2e34af049ce18a78 Mon Sep 17 00:00:00 2001 From: tiso Date: Fri, 8 Jan 2016 10:08:21 +0100 Subject: [PATCH 289/441] Modify scpacing for sortDirectionCycle in interface IColumnDefOf --- ui-grid/ui-grid.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 89778d5733..a480d7bb4d 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -3767,12 +3767,12 @@ declare module uiGrid { */ sortCellFiltered?: boolean; /** - * (optional) An array of sort directions, specifying the order that they should cycle through as - * the user repeatedly clicks on the column heading. The default is [null, uiGridConstants.ASC, uiGridConstants.DESC]. - * Null refers to the unsorted state. This does not affect the initial sort direction; use the sort property for that. - * If suppressRemoveSort is also set, the unsorted state will be skipped even if it is listed here. Each direction may - * not appear in the list more than once (e.g. [ASC, DESC, DESC] is not allowed), and the list may not be empty.* - */ + *(optional) An array of sort directions, specifying the order that they should cycle through as + * the user repeatedly clicks on the column heading. The default is [null, uiGridConstants.ASC, uiGridConstants.DESC]. + * Null refers to the unsorted state. This does not affect the initial sort direction; use the sort property for that. + * If suppressRemoveSort is also set, the unsorted state will be skipped even if it is listed here. Each direction may + * not appear in the list more than once (e.g. [ASC, DESC, DESC] is not allowed), and the list may not be empty.* + */ sortDirectionCycle?: Array; /** Algorithm to use for sorting this column */ sortingAlgorithm?: (a: any, b: any) => number; From d93a96c3eff416144ea3d989eddf0af62fd53d7c Mon Sep 17 00:00:00 2001 From: Niko Kovacic Date: Fri, 8 Jan 2016 11:36:35 +0100 Subject: [PATCH 290/441] Added ui-select to TypeScript definitions --- ui-select/ui-select-tests.ts | 9 +++++++++ ui-select/ui-select.d.ts | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 ui-select/ui-select-tests.ts create mode 100644 ui-select/ui-select.d.ts diff --git a/ui-select/ui-select-tests.ts b/ui-select/ui-select-tests.ts new file mode 100644 index 0000000000..e0017576f3 --- /dev/null +++ b/ui-select/ui-select-tests.ts @@ -0,0 +1,9 @@ +/// + +angular + .module('main', ['ui-select']) + .config(function(uiSelectConfig: angular.ui.select.ISelectConfig) { + uiSelectConfig.appendToBody = true; + uiSelectConfig.resetSearchInput = true; + uiSelectConfig.theme = "bootstrap"; + }); \ No newline at end of file diff --git a/ui-select/ui-select.d.ts b/ui-select/ui-select.d.ts new file mode 100644 index 0000000000..e223b947e1 --- /dev/null +++ b/ui-select/ui-select.d.ts @@ -0,0 +1,19 @@ +// Type definitions for ui-select 0.13.2 +// Project: https://github.com/angular-ui/ui-select +// Definitions by: Niko Kovačič +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "ui-select" { + var _: string; + export = _; +} + +declare module angular.ui.select { + interface ISelectConfig { + appendToBody: boolean; + resetSearchInput: boolean; + theme: string; + } +} From 9b36091bd5e929310f609b284f728dd6f7948e23 Mon Sep 17 00:00:00 2001 From: Julien Paroche Date: Fri, 8 Jan 2016 12:19:59 +0100 Subject: [PATCH 291/441] Add clone method from version 1.3.0 --- tinycolor/tinycolor.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tinycolor/tinycolor.d.ts b/tinycolor/tinycolor.d.ts index 4d36c084ba..d7bc543420 100644 --- a/tinycolor/tinycolor.d.ts +++ b/tinycolor/tinycolor.d.ts @@ -329,6 +329,11 @@ interface tinycolorInstance { * Gets the complement of the current color */ complement(): tinycolorInstance; + + /** + * Gets a new instance with the current color + */ + clone(): tinycolorInstance; } declare module Readable { From e64dec93fead201b2a961bd17382b9a44f131277 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 8 Jan 2016 16:35:30 +0500 Subject: [PATCH 292/441] lodash: signatures of _.isPlainObject have been changed --- lodash/lodash-tests.ts | 22 ++++++++++++++++++---- lodash/lodash.d.ts | 7 +++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2b..5544a0b98f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6106,10 +6106,24 @@ module TestIsObject { } // _.isPlainObject -result = _.isPlainObject(any); -result = _(1).isPlainObject(); -result = _([]).isPlainObject(); -result = _({}).isPlainObject(); +module TestIsPlainObject { + { + let result: boolean; + + result = _.isPlainObject(any); + result = _(1).isPlainObject(); + result = _([]).isPlainObject(); + result = _({}).isPlainObject(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isPlainObject(); + result = _([]).chain().isPlainObject(); + result = _({}).chain().isPlainObject(); + } +} // _.isRegExp module TestIsRegExp { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c45ec90eea..0214c2d96e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10154,6 +10154,13 @@ declare module _ { isPlainObject(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isPlainObject + */ + isPlainObject(): LoDashExplicitWrapper; + } + //_.isRegExp interface LoDashStatic { /** From 4dd5bea6f4a757c5a993d970bb0da9e28e802d6f Mon Sep 17 00:00:00 2001 From: Samuel Marks Date: Fri, 8 Jan 2016 23:53:19 +1100 Subject: [PATCH 293/441] Next.ifError => https://github.com/restify/node-restify/commit/070725fa3e2b1d7b5e0ec7824b2d1f2d5a713964 --- restify/restify.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 6fb2e6718c..a73ca09bad 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -184,6 +184,7 @@ declare module "restify" { interface Next { (err?: any): any; + ifError: (err?: any) => any; } interface RequestHandler { From e9f89b9659014fbb1680249cd959384fa5ec2f1a Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Fri, 8 Jan 2016 14:01:17 +0100 Subject: [PATCH 294/441] fix implicit typing --- vec3/vec3.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vec3/vec3.d.ts b/vec3/vec3.d.ts index 30e8a04586..29bac0c561 100644 --- a/vec3/vec3.d.ts +++ b/vec3/vec3.d.ts @@ -3,14 +3,14 @@ // Definitions by: Xavier Stouder // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module "vec3"{ - class Vec3{ +declare module "vec3" { + class Vec3 { constructor(x: number, y: number, z: number); constructor(location: number[]); constructor(location: {x: number; y: number; z: number}); constructor(locationStr: string); - set(x, y, z): Vec3; + set(x: number, y: number, z: number): Vec3; update(other: Vec3): Vec3; floored(): Vec3; floor(): Vec3; From 1fed7c61fa0fa5bde54707de5c1663fedba2b333 Mon Sep 17 00:00:00 2001 From: Niko Kovacic Date: Fri, 8 Jan 2016 14:19:13 +0100 Subject: [PATCH 295/441] Angular Formly IFormlyConfig added missing properties. --- angular-formly/angular-formly-tests.ts | 9 +++++++++ angular-formly/angular-formly.d.ts | 16 +++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/angular-formly/angular-formly-tests.ts b/angular-formly/angular-formly-tests.ts index 2374fde4ad..0ec57ed445 100644 --- a/angular-formly/angular-formly-tests.ts +++ b/angular-formly/angular-formly-tests.ts @@ -20,6 +20,15 @@ class FormConfig { name: 'customInput', extends: 'input' }); + + formlyConfig.disableWarnings = true; + formlyConfig.templateManipulators = undefined; + + formlyConfig.extras.apiCheckInstance = null; + formlyConfig.extras.defaultHideDirective = 'ng-if'; + formlyConfig.extras.disableNgModelAttrsManipulator = true; + formlyConfig.extras.errorExistsAndShouldBeVisibleExpression = angular.noop; + formlyConfig.extras.explicitAsync = true; } } diff --git a/angular-formly/angular-formly.d.ts b/angular-formly/angular-formly.d.ts index 7ee3d31945..b5688ed7a7 100644 --- a/angular-formly/angular-formly.d.ts +++ b/angular-formly/angular-formly.d.ts @@ -558,10 +558,24 @@ declare module AngularFormly { validateOptions?: Function; } + interface IFormlyConfigExtras { + disableNgModelAttrsManipulator: boolean; + apiCheckInstance: any; + ngModelAttrsManipulatorPreferUnbound: boolean; + removeChromeAutoComplete: boolean; + defaultHideDirective: string; + errorExistsAndShouldBeVisibleExpression: any; + getFieldId: Function; + fieldTransform: Function; + explicitAsync: boolean; + } + interface IFormlyConfig { + disableWarnings: boolean; + extras: IFormlyConfigExtras; setType(typeOptions: ITypeOptions): void; setWrapper(wrapperOptions: IWrapperOptions): void; - + templateManipulators: ITemplateManipulators; } interface ITemplateScopeOptions { From 89ccc5f3cd92a48129121eab7809e0a84eb9be18 Mon Sep 17 00:00:00 2001 From: Niko Kovacic Date: Fri, 8 Jan 2016 14:30:32 +0100 Subject: [PATCH 296/441] Added additional tests for extra property --- angular-formly/angular-formly-tests.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/angular-formly/angular-formly-tests.ts b/angular-formly/angular-formly-tests.ts index 0ec57ed445..01449aa4b7 100644 --- a/angular-formly/angular-formly-tests.ts +++ b/angular-formly/angular-formly-tests.ts @@ -29,6 +29,9 @@ class FormConfig { formlyConfig.extras.disableNgModelAttrsManipulator = true; formlyConfig.extras.errorExistsAndShouldBeVisibleExpression = angular.noop; formlyConfig.extras.explicitAsync = true; + formlyConfig.extras.fieldTransform = angular.noop; + formlyConfig.extras.getFieldId = angular.noop; + formlyConfig.extras.ngModelAttrsManipulatorPreferUnbound = true; } } From 2684cdb76471a68c691245c1d6e6f5e2f9a54f36 Mon Sep 17 00:00:00 2001 From: Andrei Alecu Date: Thu, 7 Jan 2016 16:48:50 +0200 Subject: [PATCH 297/441] Fix `size()` when in `chain()` --- underscore/underscore-tests.ts | 5 +++-- underscore/underscore.d.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/underscore/underscore-tests.ts b/underscore/underscore-tests.ts index 661daf8c6d..74cef85ec7 100644 --- a/underscore/underscore-tests.ts +++ b/underscore/underscore-tests.ts @@ -493,10 +493,11 @@ function strong_typed_values_tests() { return [r.title, true]; }).object().value(); - _(dictionaryLike).each((x) => { + var x: number = _(dictionaryLike).chain().filter((x) => { console.log(x.title); console.log(x.value.toFixed()); - }); + return x.title == 'item1'; + }).size().value(); _.values<{title: string, value: number}>(dictionaryLike); } diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 468c321023..b17785a0fb 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -2824,7 +2824,7 @@ interface _Chain { * Wrapped type `any`. * @see _.size **/ - size(): _Chain; + size(): _ChainSingle; /********* * Arrays * From e19066cf24f05ffee4a8add300bb9b9c188323f6 Mon Sep 17 00:00:00 2001 From: Niko Kovacic Date: Fri, 8 Jan 2016 15:25:42 +0100 Subject: [PATCH 298/441] Small lint fixes. --- angular-formly/angular-formly.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/angular-formly/angular-formly.d.ts b/angular-formly/angular-formly.d.ts index b5688ed7a7..8c07ea8001 100644 --- a/angular-formly/angular-formly.d.ts +++ b/angular-formly/angular-formly.d.ts @@ -16,8 +16,8 @@ declare module 'angular-formly' { declare module AngularFormly { - interface IFieldArray extends Array { - + interface IFieldArray extends Array { + } interface IFieldGroup { @@ -160,7 +160,7 @@ declare module AngularFormly { */ asyncValidators?: { [key: string]: string | IExpressionFunction | IValidator; - } + }; /** * This is a great way to add custom behavior to a specific field. It is injectable with the $scope of the @@ -210,7 +210,7 @@ declare module AngularFormly { */ expressionProperties?: { [key: string]: string | IExpressionFunction | IValidator; - } + }; /** @@ -219,7 +219,7 @@ declare module AngularFormly { * * see http://docs.angular-formly.com/docs/field-configuration-object#hide-boolean */ - hide?: boolean + hide?: boolean; /** @@ -432,7 +432,7 @@ declare module AngularFormly { */ show?: boolean; - } + }; /** @@ -446,7 +446,7 @@ declare module AngularFormly { */ validators?: { [key: string]: string | IExpressionFunction | IValidator; - } + }; /** From 1b27a84c361c0522b9b448e98099cefd03b67b14 Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Fri, 8 Jan 2016 16:19:18 +0100 Subject: [PATCH 299/441] Try to fix... --- vec3/vec3-tests.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vec3/vec3-tests.ts b/vec3/vec3-tests.ts index 4395f47be9..8196b9d939 100644 --- a/vec3/vec3-tests.ts +++ b/vec3/vec3-tests.ts @@ -1,2 +1,5 @@ -import * as vec3 from "vec3" -let myVector: vec3.Vec3 = new vec3.Vec3(10, 10, 10); \ No newline at end of file +/// + +import {Vec3} from "vec3"; +let myVector: Vec3 = new Vec3(10, 10, 10); +console.log(myVector.toString()); \ No newline at end of file From 36797eab8f7fc75c931b58292b15d2664f76f79f Mon Sep 17 00:00:00 2001 From: rdogmartin Date: Fri, 8 Jan 2016 08:42:09 -0700 Subject: [PATCH 300/441] Added test --- jqueryui/jqueryui-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index bc84cb475a..14de7019a9 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1471,6 +1471,7 @@ function test_menu() { $(".selector").menu({ position: { my: "left top", at: "right-5 top+5" } }); $(".selector").menu({ role: null }); $(".selector").menu("option", { disabled: true }); + $(".selector").menu({ select: (e, ui) => { } }); } From f757b992b0cd7aee6bc30d7038aac98b60d240bc Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Fri, 8 Jan 2016 17:49:03 +0100 Subject: [PATCH 301/441] Prismarine Recipe --- prismarine-recipe/prismarine-recipe-tests.ts | 3 ++ .../typings/prismarine-recipe.d.ts | 32 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 prismarine-recipe/prismarine-recipe-tests.ts create mode 100644 prismarine-recipe/typings/prismarine-recipe.d.ts diff --git a/prismarine-recipe/prismarine-recipe-tests.ts b/prismarine-recipe/prismarine-recipe-tests.ts new file mode 100644 index 0000000000..d4da5ae392 --- /dev/null +++ b/prismarine-recipe/prismarine-recipe-tests.ts @@ -0,0 +1,3 @@ +import * as prismarineRecipe from "prismarine-recipe"; +let Recipe = prismarineRecipe("1.8").Recipe; +console.log(JSON.stringify(Recipe.find(5)[0], null, 2)); \ No newline at end of file diff --git a/prismarine-recipe/typings/prismarine-recipe.d.ts b/prismarine-recipe/typings/prismarine-recipe.d.ts new file mode 100644 index 0000000000..2b414ddfec --- /dev/null +++ b/prismarine-recipe/typings/prismarine-recipe.d.ts @@ -0,0 +1,32 @@ +declare module "prismarine-recipe"{ + function prismarineRecipe(version: string): prismarineRecipe.MCRecipeVersion; + + module prismarineRecipe{ + interface Recipe{ + result: RecipeItem; + inShape: RecipeItem[][]; + outShape: RecipeItem[][]; + ingredients: RecipeItem[]; + requiresTable: boolean; + delta: RecipeItem; + } + interface RecipeStatic{ + find(itemType: number, metadata?: number): Recipe[]; + } + interface MCRecipeVersion{ + Recipe: RecipeStatic; + RecipeItem: RecipeItemStatic; + } + interface RecipeItem{ + id: number; + metadata: number; + count?: number; + } + interface RecipeItemStatic{ + fromEnum(itemFromRecipeEnum: number[] | number | RecipeItem): RecipeItem; + clone(recipeItem: RecipeItem): RecipeItem; + } + } + + export = prismarineRecipe; +} From 92563f5296c6f5171286ed0129252fa46f0b5cdb Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Fri, 8 Jan 2016 17:50:07 +0100 Subject: [PATCH 302/441] Revert "Prismarine Recipe" This reverts commit f757b992b0cd7aee6bc30d7038aac98b60d240bc. --- prismarine-recipe/prismarine-recipe-tests.ts | 3 -- .../typings/prismarine-recipe.d.ts | 32 ------------------- 2 files changed, 35 deletions(-) delete mode 100644 prismarine-recipe/prismarine-recipe-tests.ts delete mode 100644 prismarine-recipe/typings/prismarine-recipe.d.ts diff --git a/prismarine-recipe/prismarine-recipe-tests.ts b/prismarine-recipe/prismarine-recipe-tests.ts deleted file mode 100644 index d4da5ae392..0000000000 --- a/prismarine-recipe/prismarine-recipe-tests.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as prismarineRecipe from "prismarine-recipe"; -let Recipe = prismarineRecipe("1.8").Recipe; -console.log(JSON.stringify(Recipe.find(5)[0], null, 2)); \ No newline at end of file diff --git a/prismarine-recipe/typings/prismarine-recipe.d.ts b/prismarine-recipe/typings/prismarine-recipe.d.ts deleted file mode 100644 index 2b414ddfec..0000000000 --- a/prismarine-recipe/typings/prismarine-recipe.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -declare module "prismarine-recipe"{ - function prismarineRecipe(version: string): prismarineRecipe.MCRecipeVersion; - - module prismarineRecipe{ - interface Recipe{ - result: RecipeItem; - inShape: RecipeItem[][]; - outShape: RecipeItem[][]; - ingredients: RecipeItem[]; - requiresTable: boolean; - delta: RecipeItem; - } - interface RecipeStatic{ - find(itemType: number, metadata?: number): Recipe[]; - } - interface MCRecipeVersion{ - Recipe: RecipeStatic; - RecipeItem: RecipeItemStatic; - } - interface RecipeItem{ - id: number; - metadata: number; - count?: number; - } - interface RecipeItemStatic{ - fromEnum(itemFromRecipeEnum: number[] | number | RecipeItem): RecipeItem; - clone(recipeItem: RecipeItem): RecipeItem; - } - } - - export = prismarineRecipe; -} From ee54597e99178c48aea20a268af6160406545551 Mon Sep 17 00:00:00 2001 From: error Date: Fri, 8 Jan 2016 11:02:19 -0600 Subject: [PATCH 303/441] add easing tests --- jquery/jquery-tests.ts | 102 +++++++++++++++++++++---------------- jqueryui/jqueryui-tests.ts | 25 ++++++++- 2 files changed, 80 insertions(+), 47 deletions(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 27eea1c813..32e5c28e79 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -88,7 +88,7 @@ function test_ajax() { alert('Load was performed.'); }, error: function (jqXHR, textStatus, errorThrown) { - alert('Load failed. responseJSON=' + jqXHR.responseJSON); + alert('Load failed. responseJSON=' + jqXHR.responseJSON); } }); var _super = jQuery.ajaxSettings.xhr; @@ -1155,7 +1155,7 @@ function test_dblclick() { divdbl.dblclick(function () { divdbl.toggleClass('dbl'); }); - $('#target').dblclick(); + $('#target').dblclick(); } function test_delay() { @@ -1710,6 +1710,18 @@ function test_focusout() { }); } +function test_easing() { + var easing = jQuery.easing, + easing_fns = ["linear", "swing"], + step = Math.pow( 2, -3 ); // use power of 2 to prevent floating point rounding error + easing_fns.forEach( function( name ) { + var fn = easing[ name ]; + for( var i = 0; i <= 1; i += step ) { + console.log( "$.easing." + name + "(" + i + "): " + fn.call(easing, i) ); + } + } ); +} + function test_fx() { jQuery.fx.interval = 100; $("input").click(function () { @@ -2740,7 +2752,7 @@ function test_keyup() { } function test_resize() { - $('#other').resize(); + $('#other').resize(); $('#other').resize(function () { alert('Handler for .resize() called.'); }); @@ -2750,7 +2762,7 @@ function test_resize() { } function test_scroll() { - $('#other').scroll(); + $('#other').scroll(); $('#other').scroll(function () { alert('Handler for .scroll() called.'); }); @@ -2760,7 +2772,7 @@ function test_scroll() { } function test_select() { - $('#other').select(); + $('#other').select(); $('#other').select(function () { alert('Handler for .select() called.'); }); @@ -3147,8 +3159,8 @@ function test_text() { } $('#item').click(function(e) { - if (e.ctrlKey) { console.log('control pressed'); } - if (e.altKey) { console.log('alt pressed'); } + if (e.ctrlKey) { console.log('control pressed'); } + if (e.altKey) { console.log('alt pressed'); } }); function test_addBack() { @@ -3165,27 +3177,27 @@ function test_addBack() { // http://api.jquery.com/jQuery.parseHTML/ function test_parseHTML() { - var $log = $( "#log" ), - str = "hello, my name is jQuery.", - html = $.parseHTML( str ), - nodeNames = []; + var $log = $( "#log" ), + str = "hello, my name is jQuery.", + html = $.parseHTML( str ), + nodeNames = []; - // Append the parsed HTML - $log.append( html ); + // Append the parsed HTML + $log.append( html ); - // Gather the parsed HTML's node names - $.each( html, function( i, el ) { - nodeNames[i] = "
    • " + el.nodeName + "
    • "; - }); + // Gather the parsed HTML's node names + $.each( html, function( i, el ) { + nodeNames[i] = "
    • " + el.nodeName + "
    • "; + }); - // Insert the node names - $log.append( "

      Node Names:

      " ); - $( "
        " ) - .append( nodeNames.join( "" ) ) - .appendTo( $log ); + // Insert the node names + $log.append( "

        Node Names:

        " ); + $( "
          " ) + .append( nodeNames.join( "" ) ) + .appendTo( $log ); - // parse HTML with all parameters - $.parseHTML( str, document, true ); + // parse HTML with all parameters + $.parseHTML( str, document, true ); } // http://api.jquery.com/jQuery.parseJSON/ @@ -3218,7 +3230,7 @@ function test_not() { $("p").not("#selected"); $("p").not($("div p.selected")); - + var el1 = $("
          ")[0]; var el2 = $("
          ")[0]; $("p").not([el1, el2]); @@ -3367,30 +3379,30 @@ function test_deferred_promise() { } function test_promise_then_change_type() { - function request() { - var def = $.Deferred(); - var promise = def.promise(null); + function request() { + var def = $.Deferred(); + var promise = def.promise(null); - def.rejectWith(this, [new Error()]); + def.rejectWith(this, [new Error()]); - return promise; - } + return promise; + } - function count() { - var def = request(); - return def.then(data => { - try { - var count: number = parseInt(data.count, 10); - } catch (err) { - return $.Deferred().reject(err).promise(); - } - return $.Deferred().resolve(count).promise(); - }); - } + function count() { + var def = request(); + return def.then(data => { + try { + var count: number = parseInt(data.count, 10); + } catch (err) { + return $.Deferred().reject(err).promise(); + } + return $.Deferred().resolve(count).promise(); + }); + } - count().done(data => { - }).fail((exception: Error) => { - }); + count().done(data => { + }).fail((exception: Error) => { + }); } function test_promise_then_not_return_deferred() { diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index bc84cb475a..6bf4d9eb46 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1458,8 +1458,8 @@ function test_dialog() { $(".selector").dialog({ title: "Dialog Title" }); $(".selector").dialog({ width: 500 }); $(".selector").dialog({ zIndex: 20 }); - var $el = $( ".selector" ).dialog( "moveToTop" ); - var isOpen = $( ".selector" ).dialog( "isOpen" ); + var $el = $( ".selector" ).dialog( "moveToTop" ); + var isOpen = $( ".selector" ).dialog( "isOpen" ); } @@ -1818,3 +1818,24 @@ function test_widget() { $(".selector").jQuery.Widget("option", "disabled", true); $(".selector").jQuery.Widget("option", { disabled: true }); } + +function test_easing() { + var easing = jQuery.easing, + easing_fns = ["easeInQuad", "easeOutQuad", "easeInOutQuad", + "easeInCubic", "easeOutCubic", "easeInOutCubic", + "easeInQuart", "easeOutQuart", "easeInOutQuart", + "easeInQuint", "easeOutQuint", "easeInOutQuint", + "easeInExpo", "easeOutExpo", "easeInOutExpo", + "easeInSine", "easeOutSine", "easeInOutSine", + "easeInCirc", "easeOutCirc", "easeInOutCirc", + "easeInElastic", "easeOutElastic", "easeInOutElastic", + "easeInBack", "easeOutBack", "easeInOutBack", + "easeInBounce", "easeOutBounce", "easeInOutBounce"], + step = Math.pow( 2, -3 ); // use power of 2 to prevent floating point rounding error + easing_fns.forEach( function( name ) { + var fn = easing[ name ]; + for( var i = 0; i <= 1; i += step ) { + console.log( "$.easing." + name + "(" + i + "): " + fn.call(easing, i) ); + } + } ); +} From ca6fb1fb78ed94654d841bbe2163851bbb20da40 Mon Sep 17 00:00:00 2001 From: error Date: Fri, 8 Jan 2016 11:15:12 -0600 Subject: [PATCH 304/441] Revert "add easing tests" This reverts commit ee54597e99178c48aea20a268af6160406545551. --- jquery/jquery-tests.ts | 102 ++++++++++++++++--------------------- jqueryui/jqueryui-tests.ts | 25 +-------- 2 files changed, 47 insertions(+), 80 deletions(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 32e5c28e79..27eea1c813 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -88,7 +88,7 @@ function test_ajax() { alert('Load was performed.'); }, error: function (jqXHR, textStatus, errorThrown) { - alert('Load failed. responseJSON=' + jqXHR.responseJSON); + alert('Load failed. responseJSON=' + jqXHR.responseJSON); } }); var _super = jQuery.ajaxSettings.xhr; @@ -1155,7 +1155,7 @@ function test_dblclick() { divdbl.dblclick(function () { divdbl.toggleClass('dbl'); }); - $('#target').dblclick(); + $('#target').dblclick(); } function test_delay() { @@ -1710,18 +1710,6 @@ function test_focusout() { }); } -function test_easing() { - var easing = jQuery.easing, - easing_fns = ["linear", "swing"], - step = Math.pow( 2, -3 ); // use power of 2 to prevent floating point rounding error - easing_fns.forEach( function( name ) { - var fn = easing[ name ]; - for( var i = 0; i <= 1; i += step ) { - console.log( "$.easing." + name + "(" + i + "): " + fn.call(easing, i) ); - } - } ); -} - function test_fx() { jQuery.fx.interval = 100; $("input").click(function () { @@ -2752,7 +2740,7 @@ function test_keyup() { } function test_resize() { - $('#other').resize(); + $('#other').resize(); $('#other').resize(function () { alert('Handler for .resize() called.'); }); @@ -2762,7 +2750,7 @@ function test_resize() { } function test_scroll() { - $('#other').scroll(); + $('#other').scroll(); $('#other').scroll(function () { alert('Handler for .scroll() called.'); }); @@ -2772,7 +2760,7 @@ function test_scroll() { } function test_select() { - $('#other').select(); + $('#other').select(); $('#other').select(function () { alert('Handler for .select() called.'); }); @@ -3159,8 +3147,8 @@ function test_text() { } $('#item').click(function(e) { - if (e.ctrlKey) { console.log('control pressed'); } - if (e.altKey) { console.log('alt pressed'); } + if (e.ctrlKey) { console.log('control pressed'); } + if (e.altKey) { console.log('alt pressed'); } }); function test_addBack() { @@ -3177,27 +3165,27 @@ function test_addBack() { // http://api.jquery.com/jQuery.parseHTML/ function test_parseHTML() { - var $log = $( "#log" ), - str = "hello, my name is jQuery.", - html = $.parseHTML( str ), - nodeNames = []; + var $log = $( "#log" ), + str = "hello, my name is jQuery.", + html = $.parseHTML( str ), + nodeNames = []; - // Append the parsed HTML - $log.append( html ); + // Append the parsed HTML + $log.append( html ); - // Gather the parsed HTML's node names - $.each( html, function( i, el ) { - nodeNames[i] = "
        1. " + el.nodeName + "
        2. "; - }); + // Gather the parsed HTML's node names + $.each( html, function( i, el ) { + nodeNames[i] = "
        3. " + el.nodeName + "
        4. "; + }); - // Insert the node names - $log.append( "

          Node Names:

          " ); - $( "
            " ) - .append( nodeNames.join( "" ) ) - .appendTo( $log ); + // Insert the node names + $log.append( "

            Node Names:

            " ); + $( "
              " ) + .append( nodeNames.join( "" ) ) + .appendTo( $log ); - // parse HTML with all parameters - $.parseHTML( str, document, true ); + // parse HTML with all parameters + $.parseHTML( str, document, true ); } // http://api.jquery.com/jQuery.parseJSON/ @@ -3230,7 +3218,7 @@ function test_not() { $("p").not("#selected"); $("p").not($("div p.selected")); - + var el1 = $("
              ")[0]; var el2 = $("
              ")[0]; $("p").not([el1, el2]); @@ -3379,30 +3367,30 @@ function test_deferred_promise() { } function test_promise_then_change_type() { - function request() { - var def = $.Deferred(); - var promise = def.promise(null); + function request() { + var def = $.Deferred(); + var promise = def.promise(null); - def.rejectWith(this, [new Error()]); + def.rejectWith(this, [new Error()]); - return promise; - } + return promise; + } - function count() { - var def = request(); - return def.then(data => { - try { - var count: number = parseInt(data.count, 10); - } catch (err) { - return $.Deferred().reject(err).promise(); - } - return $.Deferred().resolve(count).promise(); - }); - } + function count() { + var def = request(); + return def.then(data => { + try { + var count: number = parseInt(data.count, 10); + } catch (err) { + return $.Deferred().reject(err).promise(); + } + return $.Deferred().resolve(count).promise(); + }); + } - count().done(data => { - }).fail((exception: Error) => { - }); + count().done(data => { + }).fail((exception: Error) => { + }); } function test_promise_then_not_return_deferred() { diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index 6bf4d9eb46..bc84cb475a 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1458,8 +1458,8 @@ function test_dialog() { $(".selector").dialog({ title: "Dialog Title" }); $(".selector").dialog({ width: 500 }); $(".selector").dialog({ zIndex: 20 }); - var $el = $( ".selector" ).dialog( "moveToTop" ); - var isOpen = $( ".selector" ).dialog( "isOpen" ); + var $el = $( ".selector" ).dialog( "moveToTop" ); + var isOpen = $( ".selector" ).dialog( "isOpen" ); } @@ -1818,24 +1818,3 @@ function test_widget() { $(".selector").jQuery.Widget("option", "disabled", true); $(".selector").jQuery.Widget("option", { disabled: true }); } - -function test_easing() { - var easing = jQuery.easing, - easing_fns = ["easeInQuad", "easeOutQuad", "easeInOutQuad", - "easeInCubic", "easeOutCubic", "easeInOutCubic", - "easeInQuart", "easeOutQuart", "easeInOutQuart", - "easeInQuint", "easeOutQuint", "easeInOutQuint", - "easeInExpo", "easeOutExpo", "easeInOutExpo", - "easeInSine", "easeOutSine", "easeInOutSine", - "easeInCirc", "easeOutCirc", "easeInOutCirc", - "easeInElastic", "easeOutElastic", "easeInOutElastic", - "easeInBack", "easeOutBack", "easeInOutBack", - "easeInBounce", "easeOutBounce", "easeInOutBounce"], - step = Math.pow( 2, -3 ); // use power of 2 to prevent floating point rounding error - easing_fns.forEach( function( name ) { - var fn = easing[ name ]; - for( var i = 0; i <= 1; i += step ) { - console.log( "$.easing." + name + "(" + i + "): " + fn.call(easing, i) ); - } - } ); -} From e0078362c7022c5c943f8b64e67f822800141784 Mon Sep 17 00:00:00 2001 From: error Date: Fri, 8 Jan 2016 11:18:33 -0600 Subject: [PATCH 305/441] add easing tests for jQuery and jQueryUI --- jquery/jquery-tests.ts | 12 ++++++++++++ jqueryui/jqueryui-tests.ts | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 27eea1c813..a1c545a6f2 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -1710,6 +1710,18 @@ function test_focusout() { }); } +function test_easing() { + var easing = jQuery.easing, + easing_fns = ["linear", "swing"], + step = Math.pow( 2, -3 ); // use power of 2 to prevent floating point rounding error + easing_fns.forEach( function( name ) { + var fn = easing[ name ]; + for( var i = 0; i <= 1; i += step ) { + console.log( "$.easing." + name + "(" + i + "): " + fn.call(easing, i) ); + } + } ); +} + function test_fx() { jQuery.fx.interval = 100; $("input").click(function () { diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index bc84cb475a..56a371f99b 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1818,3 +1818,24 @@ function test_widget() { $(".selector").jQuery.Widget("option", "disabled", true); $(".selector").jQuery.Widget("option", { disabled: true }); } + +function test_easing() { + var easing = jQuery.easing, + easing_fns = ["easeInQuad", "easeOutQuad", "easeInOutQuad", + "easeInCubic", "easeOutCubic", "easeInOutCubic", + "easeInQuart", "easeOutQuart", "easeInOutQuart", + "easeInQuint", "easeOutQuint", "easeInOutQuint", + "easeInExpo", "easeOutExpo", "easeInOutExpo", + "easeInSine", "easeOutSine", "easeInOutSine", + "easeInCirc", "easeOutCirc", "easeInOutCirc", + "easeInElastic", "easeOutElastic", "easeInOutElastic", + "easeInBack", "easeOutBack", "easeInOutBack", + "easeInBounce", "easeOutBounce", "easeInOutBounce"], + step = Math.pow( 2, -3 ); // use power of 2 to prevent floating point rounding error + easing_fns.forEach( function( name ) { + var fn = easing[ name ]; + for( var i = 0; i <= 1; i += step ) { + console.log( "$.easing." + name + "(" + i + "): " + fn.call(easing, i) ); + } + } ); +} From 70a1f40bc8ef810b4272d37553cf86c6785be7f8 Mon Sep 17 00:00:00 2001 From: Dominique Rau Date: Fri, 8 Jan 2016 16:27:40 +0100 Subject: [PATCH 306/441] Update according to https://github.com/gulpjs/vinyl/releases/tag/v1.1.0 (fix) Add missing semicolons and tests mend --- vinyl/vinyl-0.4.3.d.ts | 108 +++++++ vinyl/vinyl-0.4.3.tests.ts | 560 +++++++++++++++++++++++++++++++++++++ vinyl/vinyl-tests.ts | 170 ++++++++--- vinyl/vinyl.d.ts | 42 ++- 4 files changed, 840 insertions(+), 40 deletions(-) create mode 100644 vinyl/vinyl-0.4.3.d.ts create mode 100644 vinyl/vinyl-0.4.3.tests.ts diff --git a/vinyl/vinyl-0.4.3.d.ts b/vinyl/vinyl-0.4.3.d.ts new file mode 100644 index 0000000000..3669de261d --- /dev/null +++ b/vinyl/vinyl-0.4.3.d.ts @@ -0,0 +1,108 @@ +// Type definitions for vinyl 0.4.3 +// Project: https://github.com/wearefractal/vinyl +// Definitions by: vvakame , jedmao +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "vinyl" { + + import fs = require("fs"); + + /** + * A virtual file format. + */ + class File { + constructor(options?: { + /** + * Default: process.cwd() + */ + cwd?: string; + /** + * Used for relative pathing. Typically where a glob starts. + */ + base?: string; + /** + * Full path to the file. + */ + path?: string; + /** + * Path history. Has no effect if options.path is passed. + */ + history?: string[]; + /** + * The result of an fs.stat call. See fs.Stats for more information. + */ + stat?: fs.Stats; + /** + * File contents. + * Type: Buffer, Stream, or null + */ + contents?: Buffer | NodeJS.ReadWriteStream; + }); + + /** + * Default: process.cwd() + */ + public cwd: string; + /** + * Used for relative pathing. Typically where a glob starts. + */ + public base: string; + /** + * Full path to the file. + */ + public path: string; + public stat: fs.Stats; + /** + * Type: Buffer|Stream|null (Default: null) + */ + public contents: Buffer | NodeJS.ReadableStream; + /** + * Returns path.relative for the file base and file path. + * Example: + * var file = new File({ + * cwd: "/", + * base: "/test/", + * path: "/test/file.js" + * }); + * console.log(file.relative); // file.js + */ + public relative: string; + + public isBuffer(): boolean; + + public isStream(): boolean; + + public isNull(): boolean; + + public isDirectory(): boolean; + + /** + * Returns a new File object with all attributes cloned. Custom attributes are deep-cloned. + */ + public clone(opts?: { contents?: boolean }): File; + + /** + * If file.contents is a Buffer, it will write it to the stream. + * If file.contents is a Stream, it will pipe it to the stream. + * If file.contents is null, it will do nothing. + */ + public pipe( + stream: T, + opts?: { + /** + * If false, the destination stream will not be ended (same as node core). + */ + end?: boolean; + }): T; + + /** + * Returns a pretty String interpretation of the File. Useful for console.log. + */ + public inspect(): string; + } + + export = File; + +} \ No newline at end of file diff --git a/vinyl/vinyl-0.4.3.tests.ts b/vinyl/vinyl-0.4.3.tests.ts new file mode 100644 index 0000000000..22a7d775a1 --- /dev/null +++ b/vinyl/vinyl-0.4.3.tests.ts @@ -0,0 +1,560 @@ +/// +/// + +/// + +import File = require('vinyl'); +import Stream = require('stream'); +import fs = require('fs'); + +declare var fakeStream: NodeJS.ReadWriteStream; + +describe('File', () => { + + describe('constructor()', () => { + + it('should default cwd to process.cwd', done => { + var file = new File(); + file.cwd.should.equal(process.cwd()); + done(); + }); + + it('should default base to cwd', done => { + var cwd = "/"; + var file = new File({cwd: cwd}); + file.base.should.equal(cwd); + done(); + }); + + it('should default base to cwd even when none is given', done => { + var file = new File(); + file.base.should.equal(process.cwd()); + done(); + }); + + it('should default path to null', done => { + var file = new File(); + should.not.exist(file.path); + done(); + }); + + it('should default stat to null', done => { + var file = new File(); + should.not.exist(file.stat); + done(); + }); + + it('should default contents to null', done => { + var file = new File(); + should.not.exist(file.contents); + done(); + }); + + it('should set base to given value', done => { + var val = "/"; + var file = new File({base: val}); + file.base.should.equal(val); + done(); + }); + + it('should set cwd to given value', done => { + var val = "/"; + var file = new File({cwd: val}); + file.cwd.should.equal(val); + done(); + }); + + it('should set path to given value', done => { + var val = "/test.coffee"; + var file = new File({path: val}); + file.path.should.equal(val); + done(); + }); + + it('should set stat to given value', done => { + var val = {}; + var file = new File({stat: val}); + file.stat.should.equal(val); + done(); + }); + + it('should set contents to given value', done => { + var val = new Buffer("test"); + var file = new File({contents: val}); + file.contents.should.equal(val); + done(); + }); + }); + + describe('isBuffer()', () => { + it('should return true when the contents are a Buffer', done => { + var val = new Buffer("test"); + var file = new File({contents: val}); + file.isBuffer().should.equal(true); + done(); + }); + + it('should return false when the contents are a Stream', done => { + var file = new File({ contents: fakeStream}); + file.isBuffer().should.equal(false); + done(); + }); + + it('should return false when the contents are a null', done => { + var file = new File({contents: null}); + file.isBuffer().should.equal(false); + done(); + }); + }); + + describe('isStream()', () => { + it('should return false when the contents are a Buffer', done => { + var val = new Buffer("test"); + var file = new File({contents: val}); + file.isStream().should.equal(false); + done(); + }); + + it('should return true when the contents are a Stream', done => { + var file = new File({ contents: fakeStream}); + file.isStream().should.equal(true); + done(); + }); + + it('should return false when the contents are a null', done => { + var file = new File({contents: null}); + file.isStream().should.equal(false); + done(); + }); + }); + + describe('isNull()', () => { + it('should return false when the contents are a Buffer', done => { + var val = new Buffer("test"); + var file = new File({contents: val}); + file.isNull().should.equal(false); + done(); + }); + + it('should return false when the contents are a Stream', done => { + var file = new File({ contents: fakeStream}); + file.isNull().should.equal(false); + done(); + }); + + it('should return true when the contents are a null', done => { + var file = new File({contents: null}); + file.isNull().should.equal(true); + done(); + }); + }); + + describe('isDirectory()', () => { + var fakeStat = { + isDirectory() { + return true; + } + }; + + it('should return false when the contents are a Buffer', done => { + var val = new Buffer("test"); + var file = new File({contents: val, stat: fakeStat}); + file.isDirectory().should.equal(false); + done(); + }); + + it('should return false when the contents are a Stream', done => { + var file = new File({ contents: fakeStream, stat: fakeStat}); + file.isDirectory().should.equal(false); + done(); + }); + + it('should return true when the contents are a null', done => { + var file = new File({contents: null, stat: fakeStat}); + file.isDirectory().should.equal(true); + done(); + }); + }); + + describe('clone()', () => { + it('should copy all attributes over with Buffer', done => { + var options = { + cwd: "/", + base: "/test/", + path: "/test/test.coffee", + contents: new Buffer("test") + }; + var file = new File(options); + var file2 = file.clone(); + + file2.should.not.equal(file, 'refs should be different'); + file2.cwd.should.equal(file.cwd); + file2.base.should.equal(file.base); + file2.path.should.equal(file.path); + + let fileContents = file.contents; + let file2Contents = file2.contents; + + file2Contents.should.not.equal(fileContents, 'buffer ref should be different'); + + let fileUtf8Contents = fileContents instanceof Buffer ? + fileContents.toString('utf8') : + (fileContents).toString(); + let file2Utf8Contents = file2Contents instanceof Buffer ? + file2Contents.toString('utf8') : + (file2Contents).toString(); + + file2Utf8Contents.should.equal(fileUtf8Contents); + done(); + }); + + it('should copy all attributes over with Stream', done => { + var options = { + cwd: "/", + base: "/test/", + path: "/test/test.coffee", + contents: fakeStream + }; + var file = new File(options); + var file2 = file.clone(); + + file2.should.not.equal(file, 'refs should be different'); + file2.cwd.should.equal(file.cwd); + file2.base.should.equal(file.base); + file2.path.should.equal(file.path); + file2.contents.should.equal(file.contents, 'stream ref should be the same'); + done(); + }); + + it('should copy all attributes over with null', done => { + var options = { + cwd: "/", + base: "/test/", + path: "/test/test.coffee", + contents: fakeStream + }; + var file = new File(options); + var file2 = file.clone(); + + file2.should.not.equal(file, 'refs should be different'); + file2.cwd.should.equal(file.cwd); + file2.base.should.equal(file.base); + file2.path.should.equal(file.path); + should.not.exist(file2.contents); + done(); + }); + + it('should properly clone the `stat` property', done => { + var options = { + cwd: "/", + base: "/test/", + path: "/test/test.js", + contents: new Buffer("test"), + stat: fs.statSync(__filename) + }; + + var file = new File(options); + var copy = file.clone(); + + // ReSharper disable WrongExpressionStatement + copy.stat.isFile().should.be.true; + copy.stat.isDirectory().should.be.false; + // ReSharper restore WrongExpressionStatement + + done(); + }); + }); + + describe('pipe()', () => { + it('should write to stream with Buffer', done => { + var options = { + cwd: "/", + base: "/test/", + path: "/test/test.coffee", + contents: new Buffer("test") + }; + var file = new File(options); + var stream = new Stream.PassThrough(); + stream.on('data', (chunk: any) => { + should.exist(chunk); + (chunk instanceof Buffer).should.equal(true, 'should write as a buffer'); + chunk.toString('utf8').should.equal(options.contents.toString('utf8')); + }); + stream.on('end', () => { + done(); + }); + var ret = file.pipe(stream); + ret.should.equal(stream, 'should return the stream'); + }); + + it('should pipe to stream with Stream', done => { + var testChunk = new Buffer("test"); + var options = { + cwd: "/", + base: "/test/", + path: "/test/test.coffee", + contents: new Stream.PassThrough() + }; + var file = new File(options); + var stream = new Stream.PassThrough(); + stream.on('data', (chunk: any) => { + should.exist(chunk); + (chunk instanceof Buffer).should.equal(true, 'should write as a buffer'); + chunk.toString('utf8').should.equal(testChunk.toString('utf8')); + done(); + }); + var ret = file.pipe(stream); + ret.should.equal(stream, 'should return the stream'); + + let fileContents = file.contents; + if (fileContents instanceof Buffer) { + fileContents.write(testChunk.toString()); + } + }); + + it('should do nothing with null', done => { + var options = { + cwd: "/", + base: "/test/", + path: "/test/test.coffee", + contents: fakeStream + }; + var file = new File(options); + var stream = new Stream.PassThrough(); + stream.on('data', () => { + throw new Error("should not write"); + }); + stream.on('end', () => { + done(); + }); + var ret = file.pipe(stream); + ret.should.equal(stream, 'should return the stream'); + }); + + it('should write to stream with Buffer', done => { + var options = { + cwd: "/", + base: "/test/", + path: "/test/test.coffee", + contents: new Buffer("test") + }; + var file = new File(options); + var stream = new Stream.PassThrough(); + stream.on('data', (chunk: any) => { + should.exist(chunk); + (chunk instanceof Buffer).should.equal(true, 'should write as a buffer'); + chunk.toString('utf8').should.equal(options.contents.toString('utf8')); + done(); + }); + stream.on('end', () => { + throw new Error("should not end"); + }); + var ret = file.pipe(stream, {end: false}); + ret.should.equal(stream, 'should return the stream'); + }); + + it('should pipe to stream with Stream', done => { + var testChunk = new Buffer("test"); + var options = { + cwd: "/", + base: "/test/", + path: "/test/test.coffee", + contents: new Stream.PassThrough() + }; + var file = new File(options); + var stream = new Stream.PassThrough(); + stream.on('data', (chunk: any) => { + should.exist(chunk); + (chunk instanceof Buffer).should.equal(true, 'should write as a buffer'); + chunk.toString('utf8').should.equal(testChunk.toString('utf8')); + done(); + }); + stream.on('end', () => { + throw new Error("should not end"); + }); + var ret = file.pipe(stream, {end: false}); + ret.should.equal(stream, 'should return the stream'); + + let fileContents = file.contents; + if (fileContents instanceof Buffer) { + fileContents.write(testChunk.toString()); + } + }); + + it('should do nothing with null', done => { + var options = { + cwd: "/", + base: "/test/", + path: "/test/test.coffee", + contents: fakeStream + }; + var file = new File(options); + var stream = new Stream.PassThrough(); + stream.on('data', () => { + throw new Error("should not write"); + }); + stream.on('end', () => { + throw new Error("should not end"); + }); + var ret = file.pipe(stream, {end: false}); + ret.should.equal(stream, 'should return the stream'); + process.nextTick(done); + }); + }); + + describe('inspect()', () => { + it('should return correct format when no contents and no path', done => { + var file = new File(); + file.inspect().should.equal(''); + done(); + }); + + it('should return correct format when Buffer and no path', done => { + var val = new Buffer("test"); + var file = new File({ + contents: val + }); + file.inspect().should.equal('>'); + done(); + }); + + it('should return correct format when Buffer and relative path', done => { + var val = new Buffer("test"); + var file = new File({ + cwd: "/", + base: "/test/", + path: "/test/test.coffee", + contents: val + }); + file.inspect().should.equal('>'); + done(); + }); + + it('should return correct format when Buffer and only path and no base', done => { + var val = new Buffer("test"); + var file = new File({ + cwd: "/", + path: "/test/test.coffee", + contents: val + }); + delete file.base; + file.inspect().should.equal('>'); + done(); + }); + + it('should return correct format when Stream and relative path', done => { + var file = new File({ + cwd: "/", + base: "/test/", + path: "/test/test.coffee", + contents: new Stream.PassThrough() + }); + file.inspect().should.equal('>'); + done(); + }); + + it('should return correct format when null and relative path', done => { + var file = new File({ + cwd: "/", + base: "/test/", + path: "/test/test.coffee", + contents: null + }); + file.inspect().should.equal(''); + done(); + }); + }); + + describe('contents get/set', () => { + it('should work with Buffer', done => { + var val = new Buffer("test"); + var file = new File(); + file.contents = val; + file.contents.should.equal(val); + done(); + }); + + it('should work with Stream', done => { + var val = new Stream.PassThrough(); + var file = new File(); + file.contents = val; + file.contents.should.equal(val); + done(); + }); + + it('should work with null', done => { + var file = new File(); + file.contents = null; + (file.contents === null).should.equal(true); + done(); + }); + + it('should not work with string', done => { + var val = "test"; + var file = new File(); + try { + file.contents = new Buffer(val); + } catch (err) { + should.exist(err); + done(); + } + }); + }); + + describe('relative get/set', () => { + it('should error on set', done => { + var file = new File(); + try { + file.relative = "test"; + } catch (err) { + should.exist(err); + done(); + } + }); + + it('should error on get when no base', done => { + var a: string; + var file = new File(); + delete file.base; + try { + // ReSharper disable once AssignedValueIsNeverUsed + a = file.relative; + } catch (err) { + should.exist(err); + done(); + } + }); + + it('should error on get when no path', done => { + var a: string; + var file = new File(); + try { + // ReSharper disable once AssignedValueIsNeverUsed + a = file.relative; + } catch (err) { + should.exist(err); + done(); + } + }); + + it('should return a relative path from base', done => { + var file = new File({ + cwd: "/", + base: "/test/", + path: "/test/test.coffee" + }); + file.relative.should.equal("test.coffee"); + done(); + }); + + it('should return a relative path from cwd', done => { + var file = new File({ + cwd: "/", + path: "/test/test.coffee" + }); + file.relative.should.equal("test/test.coffee"); + done(); + }); + }); + +}); diff --git a/vinyl/vinyl-tests.ts b/vinyl/vinyl-tests.ts index cb1ceaea68..1d39646b11 100644 --- a/vinyl/vinyl-tests.ts +++ b/vinyl/vinyl-tests.ts @@ -22,13 +22,13 @@ describe('File', () => { it('should default base to cwd', done => { var cwd = "/"; var file = new File({cwd: cwd}); - file.base.should.equal(cwd); + file.basename.should.equal(cwd); done(); }); it('should default base to cwd even when none is given', done => { var file = new File(); - file.base.should.equal(process.cwd()); + file.basename.should.equal(process.cwd()); done(); }); @@ -53,7 +53,7 @@ describe('File', () => { it('should set base to given value', done => { var val = "/"; var file = new File({base: val}); - file.base.should.equal(val); + file.basename.should.equal(val); done(); }); @@ -84,6 +84,41 @@ describe('File', () => { file.contents.should.equal(val); done(); }); + + it('should default basename to cwd', done => { + var cwd = "/"; + var file = new File({cwd: cwd}); + file.basename.should.equal(cwd); + done(); + }); + + it('should default basename to cwd even when none is given', done => { + var file = new File(); + file.basename.should.equal(process.cwd()); + done(); + }); + + it('should set basename to given value', done => { + var val = "/"; + var file = new File({base: val}); + file.basename.should.equal(val); + done(); + }); + + it('should default extname to null', done => { + var cwd = "/"; + var file = new File({cwd: cwd}); + should.not.exist(file.path); + done(); + }); + + it('should default dirname to null', done => { + var cwd = "/"; + var file = new File({cwd: cwd}); + should.not.exist(file.dirname); + done(); + }); + }); describe('isBuffer()', () => { @@ -149,33 +184,6 @@ describe('File', () => { }); }); - describe('isDirectory()', () => { - var fakeStat = { - isDirectory() { - return true; - } - }; - - it('should return false when the contents are a Buffer', done => { - var val = new Buffer("test"); - var file = new File({contents: val, stat: fakeStat}); - file.isDirectory().should.equal(false); - done(); - }); - - it('should return false when the contents are a Stream', done => { - var file = new File({ contents: fakeStream, stat: fakeStat}); - file.isDirectory().should.equal(false); - done(); - }); - - it('should return true when the contents are a null', done => { - var file = new File({contents: null, stat: fakeStat}); - file.isDirectory().should.equal(true); - done(); - }); - }); - describe('clone()', () => { it('should copy all attributes over with Buffer', done => { var options = { @@ -189,7 +197,7 @@ describe('File', () => { file2.should.not.equal(file, 'refs should be different'); file2.cwd.should.equal(file.cwd); - file2.base.should.equal(file.base); + file2.basename.should.equal(file.basename); file2.path.should.equal(file.path); let fileContents = file.contents; @@ -220,7 +228,7 @@ describe('File', () => { file2.should.not.equal(file, 'refs should be different'); file2.cwd.should.equal(file.cwd); - file2.base.should.equal(file.base); + file2.basename.should.equal(file.basename); file2.path.should.equal(file.path); file2.contents.should.equal(file.contents, 'stream ref should be the same'); done(); @@ -238,7 +246,7 @@ describe('File', () => { file2.should.not.equal(file, 'refs should be different'); file2.cwd.should.equal(file.cwd); - file2.base.should.equal(file.base); + file2.basename.should.equal(file.basename); file2.path.should.equal(file.path); should.not.exist(file2.contents); done(); @@ -258,7 +266,6 @@ describe('File', () => { // ReSharper disable WrongExpressionStatement copy.stat.isFile().should.be.true; - copy.stat.isDirectory().should.be.false; // ReSharper restore WrongExpressionStatement done(); @@ -437,7 +444,7 @@ describe('File', () => { path: "/test/test.coffee", contents: val }); - delete file.base; + delete file.basename; file.inspect().should.equal('>'); done(); }); @@ -515,7 +522,7 @@ describe('File', () => { it('should error on get when no base', done => { var a: string; var file = new File(); - delete file.base; + delete file.basename; try { // ReSharper disable once AssignedValueIsNeverUsed a = file.relative; @@ -557,4 +564,95 @@ describe('File', () => { }); }); + describe('path get/set', () => { + + it('should return an absolute path', done => { + var file = new File({ + cwd: "/", + base: "/test/", + path: "/test/test.coffee" + }); + file.path.should.equal("/test/test.coffee"); + done(); + }); + + }); + + describe('history get', () => { + it('should error on set', done => { + var file = new File(); + try { + file.history = []; + } catch (err) { + should.exist(err); + done(); + } + }); + + it('should return an history', done => { + var file = new File({ + cwd: "/", + base: "/test/", + path: "/test/test.coffee" + }); + file.history.should.equal(["/test/test.coffee"]); + done(); + }); + + }); + + describe('dirname get', () => { + + it('should return an dirname', done => { + var file = new File({ + cwd: "/", + base: "/test/", + path: "/test/test.coffee" + }); + file.dirname.should.equal("test"); + done(); + }); + + it('should set dirname to given value', done => { + var file = new File(); + file.dirname = ".ext" + file.dirname.should.equal(".ext") + done(); + }); + + it('should set dirname to null', done => { + var file = new File(); + file.dirname = null + should.not.exist(file.dirname) + done(); + }); + }); + + describe('extname get/set', () => { + + it('should return an extname', done => { + var file = new File({ + cwd: "/", + base: "/test/", + path: "/test/test.coffee" + }); + file.dirname.should.equal(".coffee"); + done(); + }); + + it('should set extname to given value', done => { + var file = new File(); + file.extname = ".ext" + file.extname.should.equal(".ext") + done(); + }); + + it('should set extname to null', done => { + var file = new File(); + file.extname = null + should.not.exist(file.extname) + done(); + }); + }); + }); diff --git a/vinyl/vinyl.d.ts b/vinyl/vinyl.d.ts index 39960361fe..77bf252b7a 100644 --- a/vinyl/vinyl.d.ts +++ b/vinyl/vinyl.d.ts @@ -1,4 +1,4 @@ -// Type definitions for vinyl 0.4.3 +// Type definitions for vinyl 1.1.0 // Project: https://github.com/wearefractal/vinyl // Definitions by: vvakame , jedmao // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -14,26 +14,32 @@ declare module "vinyl" { */ class File { constructor(options?: { + /** * Default: process.cwd() */ cwd?: string; + /** * Used for relative pathing. Typically where a glob starts. */ base?: string; + /** * Full path to the file. */ path?: string; + /** * Path history. Has no effect if options.path is passed. */ history?: string[]; + /** * The result of an fs.stat call. See fs.Stats for more information. */ stat?: fs.Stats; + /** * File contents. * Type: Buffer, Stream, or null @@ -45,19 +51,40 @@ declare module "vinyl" { * Default: process.cwd() */ public cwd: string; + /** * Used for relative pathing. Typically where a glob starts. */ + public dirname: string; + public basename: string; public base: string; + /** * Full path to the file. */ public path: string; public stat: fs.Stats; + + /** + * Gets and sets stem (filename without suffix) for the file path. + */ + public stem: string; + + /** + * Gets and sets path.extname for the file path + */ + public extname: string; + + /** + * Array of path values the file object has had + */ + public history: string[]; + /** * Type: Buffer|Stream|null (Default: null) */ public contents: Buffer | NodeJS.ReadableStream; + /** * Returns path.relative for the file base and file path. * Example: @@ -70,18 +97,25 @@ declare module "vinyl" { */ public relative: string; + /** + * Returns true if file.contents is a Buffer. + */ public isBuffer(): boolean; + /** + * Returns true if file.contents is a Stream. + */ public isStream(): boolean; + /** + * Returns true if file.contents is null. + */ public isNull(): boolean; - public isDirectory(): boolean; - /** * Returns a new File object with all attributes cloned. Custom attributes are deep-cloned. */ - public clone(opts?: { contents?: boolean }): File; + public clone(opts?: { contents?: boolean, deep?:boolean }): File; /** * If file.contents is a Buffer, it will write it to the stream. From c44772fa6a7d07071baa6e11c9007b6d978f2d81 Mon Sep 17 00:00:00 2001 From: error Date: Fri, 8 Jan 2016 14:36:01 -0600 Subject: [PATCH 307/441] update easing tests for jQuery and jQueryUI --- jquery/jquery-tests.ts | 18 +++++++------ jqueryui/jqueryui-tests.ts | 55 ++++++++++++++++++++++++++------------ 2 files changed, 48 insertions(+), 25 deletions(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index a1c545a6f2..08e66551a7 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -1711,15 +1711,17 @@ function test_focusout() { } function test_easing() { - var easing = jQuery.easing, - easing_fns = ["linear", "swing"], - step = Math.pow( 2, -3 ); // use power of 2 to prevent floating point rounding error - easing_fns.forEach( function( name ) { - var fn = easing[ name ]; - for( var i = 0; i <= 1; i += step ) { - console.log( "$.easing." + name + "(" + i + "): " + fn.call(easing, i) ); + const easing = jQuery.easing; + + function test_easing_function( name: string, fn: JQueryEasingFunction ) { + const step = Math.pow( 2, -3 ); // use power of 2 to prevent floating point rounding error + for( let i = 0; i <= 1; i += step ) { + console.log( `$.easing.${name}(${i}): ${fn.call(easing, i)}` ); } - } ); + } + + test_easing_function( "linear", easing.linear ); + test_easing_function( "swing", easing.swing ); } function test_fx() { diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index 56a371f99b..c6d4f110ca 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1820,22 +1820,43 @@ function test_widget() { } function test_easing() { - var easing = jQuery.easing, - easing_fns = ["easeInQuad", "easeOutQuad", "easeInOutQuad", - "easeInCubic", "easeOutCubic", "easeInOutCubic", - "easeInQuart", "easeOutQuart", "easeInOutQuart", - "easeInQuint", "easeOutQuint", "easeInOutQuint", - "easeInExpo", "easeOutExpo", "easeInOutExpo", - "easeInSine", "easeOutSine", "easeInOutSine", - "easeInCirc", "easeOutCirc", "easeInOutCirc", - "easeInElastic", "easeOutElastic", "easeInOutElastic", - "easeInBack", "easeOutBack", "easeInOutBack", - "easeInBounce", "easeOutBounce", "easeInOutBounce"], - step = Math.pow( 2, -3 ); // use power of 2 to prevent floating point rounding error - easing_fns.forEach( function( name ) { - var fn = easing[ name ]; - for( var i = 0; i <= 1; i += step ) { - console.log( "$.easing." + name + "(" + i + "): " + fn.call(easing, i) ); + const easing = jQuery.easing; + + function test_easing_function( name: string, fn: JQueryEasingFunction ) { + const step = Math.pow( 2, -3 ); // use power of 2 to prevent floating point rounding error + for( let i = 0; i <= 1; i += step ) { + console.log( `$.easing.${name}(${i}): ${fn.call(easing, i)}` ); } - } ); + } + + test_easing_function("easeInQuad", easing.easeInQuad); + test_easing_function("easeOutQuad", easing.easeOutQuad); + test_easing_function("easeInOutQuad", easing.easeInOutQuad); + test_easing_function("easeInCubic", easing.easeInCubic); + test_easing_function("easeOutCubic", easing.easeOutCubic); + test_easing_function("easeInOutCubic", easing.easeInOutCubic); + test_easing_function("easeInQuart", easing.easeInQuart); + test_easing_function("easeOutQuart", easing.easeOutQuart); + test_easing_function("easeInOutQuart", easing.easeInOutQuart); + test_easing_function("easeInQuint", easing.easeInQuint); + test_easing_function("easeOutQuint", easing.easeOutQuint); + test_easing_function("easeInOutQuint", easing.easeInOutQuint); + test_easing_function("easeInExpo", easing.easeInExpo); + test_easing_function("easeOutExpo", easing.easeOutExpo); + test_easing_function("easeInOutExpo", easing.easeInOutExpo); + test_easing_function("easeInSine", easing.easeInSine); + test_easing_function("easeOutSine", easing.easeOutSine); + test_easing_function("easeInOutSine", easing.easeInOutSine); + test_easing_function("easeInCirc", easing.easeInCirc); + test_easing_function("easeOutCirc", easing.easeOutCirc); + test_easing_function("easeInOutCirc", easing.easeInOutCirc); + test_easing_function("easeInElastic", easing.easeInElastic); + test_easing_function("easeOutElastic", easing.easeOutElastic); + test_easing_function("easeInOutElastic", easing.easeInOutElastic); + test_easing_function("easeInBack", easing.easeInBack); + test_easing_function("easeOutBack", easing.easeOutBack); + test_easing_function("easeInOutBack", easing.easeInOutBack); + test_easing_function("easeInBounce", easing.easeInBounce); + test_easing_function("easeOutBounce", easing.easeOutBounce); + test_easing_function("easeInOutBounce", easing.easeInOutBounce); } From fda3d9c587df3940304c9b68ea33d6c985ff0623 Mon Sep 17 00:00:00 2001 From: ccrowhurstram Date: Fri, 8 Jan 2016 21:29:18 +0000 Subject: [PATCH 308/441] add latest ng-table typing --- ng-table/ng-table-tests.ts | 114 +++++ ng-table/ng-table.d.ts | 838 +++++++++++++++++++++++++++++++++++++ 2 files changed, 952 insertions(+) create mode 100644 ng-table/ng-table-tests.ts create mode 100644 ng-table/ng-table.d.ts diff --git a/ng-table/ng-table-tests.ts b/ng-table/ng-table-tests.ts new file mode 100644 index 0000000000..1cc9c47a02 --- /dev/null +++ b/ng-table/ng-table-tests.ts @@ -0,0 +1,114 @@ +/// + +interface IPerson { + age: number; + name: string; +} + +function printPerson(p: IPerson) { + console.log('age: ' + p.age); + console.log('name: ' + p.name); +} + +// NgTableParams signature tests +namespace NgTableParamsTests { + + let initialParams: NgTable.IParamValues = { + filter: { name: 'Christian' }, + sorting: { age: 'asc' } + }; + let settings: NgTable.ISettings = { + dataset: [{ age: 1, name: 'Christian' }, { age: 2, name: 'Lee' }, { age: 40, name: 'Christian' }], + filterOptions: { + filterComparator: true, + filterDelay: 100 + }, + counts: [10, 20, 50] + }; + + export let tableParams = new NgTableParams(initialParams, settings); + + // modify parameters + tableParams.filter({ name: 'Lee' }); + tableParams.sorting('age', 'desc'); + tableParams.count(10); + tableParams.group(item => (item.age * 10).toString()); + + // modify settings at runtime + tableParams.settings({ + dataset: [{ age: 1, name: 'Brandon' }, { age: 2, name: 'Lee' }] + }); + + tableParams.reload().then(rows => { + rows.forEach(printPerson); + }); +} + +// Dynamic table column signature tests +namespace ColumnTests { + interface ICustomColFields { + field: string; + } + let dynamicCols: (NgTable.Columns.IDynamicTableColDef & ICustomColFields)[]; + + dynamicCols.push({ + class: () => 'table', + field: 'age', + filter: { age: 'number' }, + sortable: true, + show: true, + title: 'Age of Person', + titleAlt: 'Age' + }); +} + +namespace EventsTests { + declare let events: NgTable.Events.IEventsChannel; + + let unregistrationFuncs: NgTable.Events.IUnregistrationFunc[] = []; + let x: NgTable.Events.IUnregistrationFunc; + + x = events.onAfterCreated(params => { + // do stuff + }); + unregistrationFuncs.push(x); + + x = events.onAfterReloadData((params, newData, oldData) => { + newData.forEach(row => { + if (isDataGroup(row)) { + row.data.forEach(printPerson) + } else { + printPerson(row); + } + }); + }, NgTableParamsTests.tableParams); + unregistrationFuncs.push(x); + + x = events.onDatasetChanged((params, newDataset, oldDataset) => { + if (newDataset != null) { + newDataset.forEach(printPerson); + } + }, NgTableParamsTests.tableParams); + unregistrationFuncs.push(x); + + x = events.onPagesChanged((params, newButtons, oldButtons) => { + newButtons.forEach(printPageButton); + }, NgTableParamsTests.tableParams); + unregistrationFuncs.push(x); + + unregistrationFuncs.forEach(f => { + f(); + }); + + + function printPageButton(btn: NgTable.IPageButton) { + console.log('type: ' + btn.type); + console.log('number: ' + btn['number']); + console.log('current: ' + btn.current); + console.log('active: ' + btn.active); + } + + function isDataGroup(row: any): row is NgTable.Data.IDataRowGroup { + return ('$hideRows' in row); + } +} \ No newline at end of file diff --git a/ng-table/ng-table.d.ts b/ng-table/ng-table.d.ts new file mode 100644 index 0000000000..ab485a2779 --- /dev/null +++ b/ng-table/ng-table.d.ts @@ -0,0 +1,838 @@ +// Type definitions for ng-table +// Project: https://github.com/esvit/ng-table +// Definitions by: Christian Crowhurst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +/** + * Parameters manager for an ngTable directive + */ +declare class NgTableParams { + /** + * The page of data rows currently being displayed in the table + */ + data: T[]; + + constructor(baseParameters?: NgTable.IParamValues, baseSettings?: NgTable.ISettings) + + /** + * Returns the number of data rows per page + */ + count(): number + /** + * Sets the number of data rows per page. + * Changes to count will cause `isDataReloadRequired` to return true + */ + count(count: number): NgTableParams + + /** + * Returns the current filter values used to restrict the set of data rows. + * @param trim supply true to return the current filter minus any insignificant values + * (null, undefined and empty string) + */ + filter(trim?: boolean): NgTable.IFilterValues + /** + * Sets filter values to the `filter` supplied; any existing filter will be removed + * Changes to filter will cause `isDataReloadRequired` to return true and the current `page` to be set to 1 + */ + filter(filter: NgTable.IFilterValues): NgTableParams + /** + * Generate array of pages. + * When no arguments supplied, the current parameter state of this `NgTableParams` instance will be used + */ + generatePagesArray(currentPage?: number, totalItems?: number, pageSize?: number, maxBlocks?: number): NgTable.IPageButton[] + /** + * Returns the current grouping used to group the data rows + */ + group(): NgTable.Grouping + /** + * Sets grouping to the `field` and `sortDirection` supplied; any existing grouping will be removed + * Changes to group will cause `isDataReloadRequired` to return true and the current `page` to be set to 1 + */ + group(field: string, sortDirection?: string): NgTableParams + /** + * Sets grouping to the `group` supplied; any existing grouping will be removed. + * Changes to group will cause `isDataReloadRequired` to return true and the current `page` to be set to 1 + */ + group(group: NgTable.Grouping): NgTableParams + /** + * Returns true when an attempt to `reload` the current `parameter` values have resulted in a failure. + * This method will continue to return true until the `reload` is successfully called or when the + * `parameter` values have changed + */ + hasErrorState(): boolean + /** + * Returns true if `filter` has significant filter value(s) (any value except null, undefined, or empty string), + * otherwise false + */ + hasFilter(): boolean + /** + * Return true when a change to `filters` require the `reload` method + * to be run so as to ensure the data presented to the user reflects these filters + */ + hasFilterChanges(): boolean + /** + * Returns true when at least one group has been set + */ + hasGroup(): boolean + /** + * Returns true when the `group` and when supplied, the `sortDirection` matches an existing group + */ + hasGroup(group: string | NgTable.IGroupingFunc, sortDirection?: string): boolean + /** + * Return true when a change to this instance should require the `reload` method + * to be run so as to ensure the data rows presented to the user reflects the current state. + * + * Note that this method will return false when the `reload` method has run but fails. In this case + * `hasErrorState` will return true. + * + * The built-in `ngTable` directives will watch for when this function returns true and will then call + * the `reload` method to load its data rows + */ + isDataReloadRequired(): boolean + /** + * Returns sorting values in a format that can be consumed by the angular `$orderBy` filter service + */ + orderBy(): string[] + /** + * Trigger a reload of the data rows + */ + reload>(): ng.IPromise + /** + * Returns the settings for the table. + */ + settings(): NgTable.ISettings + /** + * Sets the settings for the table; new setting values will be merged with the existing settings. + * Supplying a new `dataset` will cause `isDataReloadRequired` to return true and the `ngTableEventsChannel` + * to fire its `datasetChanged` event + */ + settings(newSettings: NgTable.ISettings): NgTableParams + /** + * Returns the current sorting used to order the data rows. + * Changes to sorting will cause `isDataReloadRequired` to return true + */ + sorting(): NgTable.ISortingValues + /** + * Sets sorting values to the `sorting` supplied; any existing sorting will be removed. + * Changes to sorting will cause `isDataReloadRequired` to return true + */ + sorting(sorting: NgTable.ISortingValues): NgTableParams + /** + * Sets sorting to the `field` and `direction` supplied; any existing sorting will be removed + */ + sorting(field: string, direction: string): NgTableParams + /** + * Returns the index of the current "slice" of data rows + */ + page(): number + /** + * Sets the index of the current "slice" of data rows. The index starts at 1. + * Changing the page number will cause `isDataReloadRequired` to return true + */ + page(page: number): NgTableParams + /** + * Returns the count of the data rows that match the current `filter` + */ + total(): number + /** + * Sets `settings().total` to the value supplied. + * Typically you will need to set a `total` in the body of any custom `getData` function + * you supply as a setting value to this instance. + * @example + * var tp = new NgTableParams({}, { getData: customGetData }) + * function customGetData(params) { + * var queryResult = /* code to fetch current data rows and total *\/ + * params.total(queryResult.total); + * return queryResult.dataRowsPage; + * } + */ + total(total: number): NgTableParams + /** + * Returns the current parameter values uri-encoded. Set `asString` to + * true for the parameters to be returned as an array of strings of the form 'paramName=value' + * otherwise parameters returned as a key-value object + */ + url(asString?: boolean): { [name: string]: string } | string[] +} + +declare namespace NgTable { + + interface IDataSettings { + applyPaging?: boolean; + } + + /** + * An angular value object that allow for overriding of the initial default values used when constructing + * an instance of `NgTableParams` + */ + interface IDefaults { + params?: IParamValues; + settings?: ISettings + } + + /** + * Map of the names of fields declared on a data row and the corrosponding filter value + */ + interface IFilterValues { [name: string]: any } + + /** + * Map of the names of fields on a data row and the corrosponding sort direction; + * Set the value of a key to undefined to let value of `ISettings.defaultSort` apply + */ + interface ISortingValues { [name: string]: string } + + type Grouping = IGroupValues | IGroupingFunc; + + /** + * Map of the names of fields on a data row and the corrosponding sort direction + */ + interface IGroupValues { [name: string]: string } + + /** + * Signature of a function that should return the name of the group + * that the `item` should be placed within + */ + interface IGroupingFunc { + (item: T): string; + /** + * 'asc' or 'desc'; leave undefined to let the value of `ISettings.groupOptions.defaultSort` apply + */ + sortDirection?: string + } + + /** + * The runtime values for `NgTableParams` that determine the set of data rows and + * how they are to be displayed in a table + */ + interface IParamValues { + /** + * The index of the "slice" of data rows, starting at 1, to be displayed by the table. + */ + page?: number; + /** + * The number of data rows per page + */ + count?: number; + /** + * The filter that should be applied to restrict the set of data rows + */ + filter?: IFilterValues; + /** + * The sort order that should be applied to the data rows. + */ + sorting?: ISortingValues; + /** + * The grouping that should be applied to the data rows + */ + group?: string | Grouping; + } + + + type FilterComparator = boolean | IFilterComparatorFunc; + + interface IFilterComparatorFunc { + (actual: T, expected: T): boolean; + } + + interface IFilterFunc { + (data: T[], filter: IFilterValues, filterComparator: FilterComparator): T[] + } + + + interface IFilterSettings { + /** + * Use this to determine how items are matched against the filter values. + * This setting is identical to the `comparator` parameter supported by the angular + * `$filter` filter service + * + * Defaults to `undefined` which will result in a case insensitive susbstring match when + * `IDefaultGetData` service is supplying the implementation for the + * `ISettings.getData` function + */ + filterComparator?: FilterComparator; + /** + * A duration to wait for the user to stop typing before applying the filter. + * - Defaults to 0 for small managed inmemory arrays ie where a `ISettings.dataset` argument is + * supplied to `NgTableParams.settings`. + * - Defaults to 500 milliseconds otherwise. + */ + filterDelay?: number; + /** + * The number of elements up to which a managed inmemory array is considered small. Defaults to 10000. + */ + filterDelayThreshold?: number; + /** + * Overrides `IDefaultGetDataProvider.filterFilterName`. + * The value supplied should be the name of the angular `$filter` service that will be selected to perform + * the actual filter logic. + * Defaults to 'filter'. + */ + filterFilterName?: string; + /** + * Tells `IDefaultGetData` to use this function supplied to perform the filtering instead of selecting an angular $filter. + */ + filterFn?: IFilterFunc; + /** + * The layout to use when multiple html templates are to rendered in a single table header column. + * Available values: + * - stack (the default) + * - horizontal + */ + filterLayout?: string + } + + interface IGroupSettings { + /** + * The default sort direction that will be used whenever a group is supplied that + * does not define its own sort direction + */ + defaultSort?: string; + /** + * Determines whether groups should be displayed expanded to show their items. Defaults to true + */ + isExpanded?: boolean; + } + + /** + * Definition of the buttons rendered by the data row pager directive + */ + interface IPageButton { + type: string; + number?: number; + active: boolean; + current?: boolean; + } + + /** + * Configuration settings for `NgTableParams` + */ + interface ISettings { + /** + * Returns true whenever a call to `getData` is in progress + */ + $loading?: boolean; + /** + * An array that contains all the data rows that NgTable should manage. + * The `gateData` function will be used to manage the data rows + * that ultimately will be displayed. + */ + dataset?: T[]; + dataOptions?: {}; + /** + * The total number of data rows before paging has been applied. + * Typically you will not need to supply this yourself + */ + total?: number; + /** + * The default sort direction that will be used whenever a sorting is supplied that + * does not define its own sort direction + */ + defaultSort?: string; + filterOptions?: IFilterSettings; + groupOptions?: IGroupSettings; + /** + * The page size buttons that should be displayed. Each value defined in the array + * determines the possible values that can be supplied to `NgTableParams.page()` + */ + counts?: number[]; + /** + * The collection of interceptors that should apply to the results of a call to + * the `getData` function before the data rows are displayed in the table + */ + interceptors?: IInterceptor[]; + /** + * Configuration for the template that will display the page size buttons + */ + paginationMaxBlocks?: number; + /** + * Configuration for the template that will display the page size buttons + */ + paginationMinBlocks?: number; + /** + * The html tag that will be used to display the sorting indicator in the table header + */ + sortingIndicator?: string; + /** + * The function that will be used fetch data rows. Leave undefined to let the `IDefaultGetData` + * service provide a default implementation that will work with the `dataset` array you supply. + * + * Typically you will supply a custom function when you need to execute filtering, paging and sorting + * on the server + */ + getData?: Data.IGetDataFunc | Data.IInterceptableGetDataFunc; + /** + * The function that will be used group data rows according to the groupings returned by `NgTableParams.group()` + */ + getGroups?: Data.IGetGroupFunc; + } + + /** + * Configuration values that determine the behaviour of the `ngTableFilterConfig` service + */ + interface IFilterConfigValues { + /** + * The default base url to use when deriving the url for a filter template given just an alias name + * Defaults to 'ng-table/filters/' + */ + defaultBaseUrl?: string; + /** + * The extension to use when deriving the url of a filter template when given just an alias name + */ + defaultExt?: string; + /** + * A map of alias names and their corrosponding urls. A lookup against this map will be used + * to find the url matching an alias name. + * If no match is found then a url will be derived using the following pattern `${defaultBaseUrl}${aliasName}.${defaultExt}` + */ + aliasUrls?: { [name: string]: string }; + } + + /** + * The angular provider used to configure the behaviour of the `ngTableFilterConfig` service + */ + interface IFilterConfigProvider { + $get: IFilterConfig; + /** + * Reset back to factory defaults the config values that `ngTableFilterConfig` service will use + */ + resetConfigs(): void; + /** + * Set the config values used by `ngTableFilterConfig` service + */ + setConfig(customConfig: IFilterConfigValues): void; + } + + /** + * A key value-pair map where the key is the name of a field in a data row and the value is the definition + * for the template used to render a filter cell in the header of a html table. + * Where the value is supplied as a string this should either be url to a html template or an alias to a url registered + * using the `ngTableFilterConfigProvider` + * @example + * vm.ageFilter = { "age": "number" } + * @example + * vm.ageFilter = { "age": "my/custom/ageTemplate.html" } + * @example + * vm.ageFilter = { "age": { id: "number", placeholder: "Age of person"} } + */ + interface IFilterTemplateDefMap { + [name: string]: string | IFilterTemplateDef + } + + /** + * A fully qualified template definition for a single filter + */ + interface IFilterTemplateDef { + /** + * A url to a html template of an alias to a url registered using the `ngTableFilterConfigProvider` + */ + id: string, + /** + * The text that should be rendered as a prompt to assist the user when entering a filter value + */ + placeholder: string + } + + /** + * Exposes configuration values and methods used to return the location of the html + * templates used to render the filter row of an ng-table directive + */ + interface IFilterConfig { + /** + * Readonly copy of the final values used to configure the service. + */ + config: IFilterConfigValues, + /** + * Return the url of the html filter template for the supplied definition and key. + * For more information see the documentation for `IFilterTemplateMap` + */ + getTemplateUrl(filterDef: string | IFilterTemplateDef, filterKey?: string): string, + /** + * Return the url of the html filter template registered with the alias supplied + */ + getUrlForAlias(aliasName: string, filterKey?: string): string + } + + interface InternalTableParams extends NgTableParams { + isNullInstance: boolean + } + + /** + * A custom object that can be registered with an NgTableParams instance that can be used + * to post-process the results (and failures) returned by its `getData` function + */ + interface IInterceptor { + response?: (data: TData, params: NgTableParams) => TData; + responseError?: (reason: any, params: NgTableParams) => any; + } + + type SelectData = ISelectOption[] | ISelectDataFunc + + interface ISelectOption { + id: string | number; + title: string; + } + + interface ISelectDataFunc { + (): ISelectOption[] | ng.IPromise + } + + /** + * Definition of the constructor function that will construct new instances of `NgTableParams`. + * On construction of `NgTableParams` the `ngTableEventsChannel` will fire its `afterCreated` event. + */ + interface ITableParamsConstructor { + new (baseParameters?: IParamValues, baseSettings?: ISettings): NgTableParams + } + + + namespace Data { + + type DataResult = T | IDataRowGroup; + + interface IDataRowGroup { + data: T[]; + $hideRows: boolean; + value: string; + } + + /** + * A default implementation of the getData function that will apply the `filter`, `orderBy` and + * paging values from the `NgTableParams` instance supplied to the data array supplied. + * + * A call to this function will: + * - return the resulting array + * - assign the total item count after filtering to the `total` of the `NgTableParams` instance supplied + */ + interface IDefaultGetData { + (data: T[], params: NgTableParams): T[]; + /** + * Convenience function that this service will use to apply paging to the data rows. + * + * Returns a slice of rows from the `data` array supplied and sets the `NgTableParams.total()` + * on the `params` instance supplied to `data.length` + */ + applyPaging(data: T[], params: NgTableParams): T[], + /** + * Returns a reference to the function that this service will use to filter data rows + */ + getFilterFn(params: NgTableParams): IFilterFunc, + /** + * Returns a reference to the function that this service will use to sort data rows + */ + getOrderByFn(params?: NgTableParams): void + } + + /** + * Allows for the configuration of the ngTableDefaultGetData service. + */ + interface IDefaultGetDataProvider { + $get(): IDefaultGetData; + /** + * The name of a angular filter that knows how to apply the values returned by + * `NgTableParams.filter()` to restrict an array of data. + * (defaults to the angular `filter` filter service) + */ + filterFilterName: string, + /** + * The name of a angular filter that knows how to apply the values returned by + * `NgTableParams.orderBy()` to sort an array of data. + * (defaults to the angular `orderBy` filter service) + */ + sortingFilterName: string + } + + interface IGetDataBcShimFunc { + (originalFunc: ILegacyGetDataFunc): { (params: NgTableParams): ng.IPromise } + } + + /** + * Signature of a function that will called whenever NgTable requires to load data rows + * into the table. + * `params` is the table requesting the data rows + */ + interface IGetDataFunc { + (params: NgTableParams): T[] | ng.IPromise; + } + + interface IGetGroupFunc { + (params: NgTableParams): { [name: string]: IDataRowGroup[] } + } + + /** + * Variation of the `IGetDataFunc` function signature that allows for flexibility for + * the shape of the return value. + * Typcially you will use this function signature when you want to configure `NgTableParams` with + * interceptors that will return the final data rows array. + */ + interface IInterceptableGetDataFunc { + (params: NgTableParams): TResult; + } + + interface ILegacyGetDataFunc { + ($defer: ng.IDeferred, params: NgTableParams): void + } + } + + namespace Events { + interface IEventSelectorFunc { + (publisher: NgTableParams): boolean + } + + type EventSelector = NgTableParams | IEventSelectorFunc + + interface IDatasetChangedListener { + (publisher: NgTableParams, newDataset: T[], oldDataset: T[]): any + } + interface IAfterCreatedListener { + (publisher: NgTableParams): any + } + interface IAfterReloadDataListener { + (publisher: NgTableParams, newData: NgTable.Data.DataResult[], oldData: NgTable.Data.DataResult[]): any + } + interface IPagesChangedListener { + (publisher: NgTableParams, newPages: NgTable.IPageButton[], oldPages: NgTable.IPageButton[]): any + } + + interface IUnregistrationFunc { + (): void + } + + interface IEventsChannel { + /** + * Subscribe to receive notification whenever a new `NgTableParams` instance has finished being constructed. + * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. Supply a + * `scope` to have angular automatically unregister the listener when the `scope` is destroyed. + * + * @param listener the function that will be called when the event fires + * @param scope the angular `$scope` that will limit the lifetime of the event subscription + * @param eventFilter a predicate function that should return true to receive the event + * @return a unregistration function that when called will unregister the `listener` + */ + onAfterCreated(listener: Events.IAfterCreatedListener, scope: ng.IScope, eventFilter?: Events.IEventSelectorFunc): IUnregistrationFunc; + /** + * Subscribe to receive notification whenever a new `NgTableParams` instance has finished being constructed. + * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. + * + * @param listener the function that will be called when the event fires + * @param eventFilter a predicate function that should return true to receive the event + * @return a unregistration function that when called will unregister the `listener` + */ + onAfterCreated(listener: Events.IAfterCreatedListener, eventFilter?: Events.IEventSelectorFunc): IUnregistrationFunc; + /** + * Subscribe to receive notification whenever the `reload` method of an `NgTableParams` instance has successfully executed + * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. Supply a + * `scope` to have angular automatically unregister the listener when the `scope` is destroyed. + * + * @param listener the function that will be called when the event fires + * @param scope the angular `$scope` that will limit the lifetime of the event subscription + * @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event + * @return a unregistration function that when called will unregister the `listener` + */ + onAfterReloadData(listener: Events.IAfterReloadDataListener, scope: ng.IScope, eventFilter?: Events.EventSelector): IUnregistrationFunc; + /** + * Subscribe to receive notification whenever the `reload` method of an `NgTableParams` instance has successfully executed + * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. + * + * @param listener the function that will be called when the event fires + * @param eventFilter a predicate function that should return true to receive the event + * @return a unregistration function that when called will unregister the `listener` + */ + onAfterReloadData(listener: Events.IAfterReloadDataListener, eventFilter?: Events.EventSelector): IUnregistrationFunc; + + /** + * Subscribe to receive notification whenever a new data rows *array* is supplied as a `settings` value to a `NgTableParams` instance. + * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. Supply a + * `scope` to have angular automatically unregister the listener when the `scope` is destroyed. + * + * @param listener the function that will be called when the event fires + * @param scope the angular `$scope` that will limit the lifetime of the event subscription + * @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event + * @return a unregistration function that when called will unregister the `listener` + */ + onDatasetChanged(listener: Events.IDatasetChangedListener, scope: ng.IScope, eventFilter?: Events.EventSelector): IUnregistrationFunc; + /** + * Subscribe to receive notification whenever a new data rows *array* is supplied as a `settings` value to a `NgTableParams` instance. + * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. + * + * @param listener the function that will be called when the event fires + * @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event + * @return a unregistration function that when called will unregister the `listener` + */ + onDatasetChanged(listener: Events.IDatasetChangedListener, eventFilter?: Events.EventSelector): IUnregistrationFunc; + + /** + * Subscribe to receive notification whenever the paging buttons for an `NgTableParams` instance change + * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. Supply a + * `scope` to have angular automatically unregister the listener when the `scope` is destroyed. + * + * @param listener the function that will be called when the event fires + * @param scope the angular `$scope` that will limit the lifetime of the event subscription + * @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event + * @return a unregistration function that when called will unregister the `listener` + */ + onPagesChanged(listener: Events.IPagesChangedListener, scope: ng.IScope, eventFilter?: Events.EventSelector): IUnregistrationFunc; + /** + * Subscribe to receive notification whenever the paging buttons for an `NgTableParams` instance change + * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. + * + * @param listener the function that will be called when the event fires + * @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event + * @return a unregistration function that when called will unregister the `listener` + */ + onPagesChanged(listener: Events.IPagesChangedListener, eventFilter?: Events.EventSelector): IUnregistrationFunc; + + publishAfterCreated(publisher: NgTableParams): void; + publishAfterReloadData(publisher: NgTableParams, newData: T[], oldData: T[]): void; + publishDatasetChanged(publisher: NgTableParams, newDataset: T[], oldDataset: T[]): void; + publishPagesChanged(publisher: NgTableParams, newPages: NgTable.IPageButton[], oldPages: NgTable.IPageButton[]): void; + } + } + + namespace Columns { + + type ColumnFieldContext = ng.IScope & { + $column: IColumnDef; + $columns: IColumnDef[]; + } + + interface IColumnField { + (context?: ColumnFieldContext): T; + assign($scope: ng.IScope, value: T): void; + } + + /** + * The definition of the column within a ngTable. + * When using `ng-table` directive a column definition will be parsed from each `td` tag found in the + * `tr` data row tag. + * + * @example + * + * + * + * + */ + interface IColumnDef { + /** + * Custom CSS class that should be added to the `th` tag(s) of this column in the table header + * + * To set this on the `td` tag of a html table use the attribute `header-class` or `data-header-class` + */ + class: IColumnField; + /** + * The `ISelectOption`s that can be used in a html filter template for this colums. + */ + data?: SelectData; + /** + * The index position of this column within the `$columns` container array + */ + id: number; + /** + * The definition of 0 or more html filter templates that should be rendered for this column in + * the table header + */ + filter: IColumnField; + /** + * Supplies the `ISelectOption`s that can be used in a html filter template for this colums. + * At the creation of the `NgTableParams` this field will be called and the result then assigned + * to the `data` field of this column. + */ + filterData: IColumnField | SelectData>; + /** + * The name of the data row field that will be used to group on, or false when this column + * does not support grouping + */ + groupable: IColumnField; + /** + * The url of a custom html template that should be used to render a table header for this column + * + * To set this on the `td` tag for a html table use the attribute `header` or `data-header` + */ + headerTemplateURL: IColumnField; + /** + * The text that should be used as a tooltip for this column in the table header + */ + headerTitle: IColumnField; + /** + * Determines whether this column should be displayed in the table + * + * To set this on the `td` tag for a html table use the attribute `ng-if` + */ + show: IColumnField; + /** + * The name of the data row field that will be used to sort on, or false when this column + * does not support sorting + */ + sortable: IColumnField; + /** + * The title of this column that should be displayed in the table header + */ + title: IColumnField; + /** + * An alternate column title. Typically this can be used for responsive table layouts + * where the titleAlt should be used for small screen sizes + */ + titleAlt: IColumnField; + } + + type DynamicTableColField = IDynamicTableColFieldFunc | T; + + interface IDynamicTableColFieldFunc { + (context: ColumnFieldContext): T; + } + + /** + * The definition of the column supplied to a ngTableDynamic directive. + */ + interface IDynamicTableColDef { + /** + * Custom CSS class that should be added to the `th` tag(s) of this column in the table header + */ + class?: DynamicTableColField; + /** + * The definition of 0 or more html filter templates that should be rendered for this column in + * the table header + */ + filter?: DynamicTableColField; + /** + * Supplies the `ISelectOption`s that can be used in a html filter template for this colums. + * At the creation of the `NgTableParams` this field will be called and the result then assigned + * to the `data` field of this column. + */ + filterData?: DynamicTableColField | SelectData>; + /** + * The name of the data row field that will be used to group on, or false when this column + * does not support grouping + */ + groupable?: DynamicTableColField; + /** + * The url of a custom html template that should be used to render a table header for this column + */ + headerTemplateURL?: DynamicTableColField; + /** + * The text that should be used as a tooltip for this column in the table header + */ + headerTitle?: DynamicTableColField; + /** + * Determines whether this column should be displayed in the table + */ + show?: DynamicTableColField; + /** + * The name of the data row field that will be used to sort on, or false when this column + * does not support sorting + */ + sortable?: DynamicTableColField; + /** + * The title of this column that should be displayed in the table header + */ + title?: DynamicTableColField; + /** + * An alternate column title. Typically this can be used for responsive table layouts + * where the titleAlt should be used for small screen sizes + */ + titleAlt?: DynamicTableColField; + } + } +} + From 07c1937a85b506cb599f82a8f9be0100878b5dad Mon Sep 17 00:00:00 2001 From: Tadeusz Hucal Date: Sat, 9 Jan 2016 00:05:13 +0100 Subject: [PATCH 309/441] Angular GrowlV2 - added missing message methods; fixed module name --- angular-growl-v2/angular-growl-v2-tests.ts | 4 ++++ angular-growl-v2/angular-growl-v2.d.ts | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/angular-growl-v2/angular-growl-v2-tests.ts b/angular-growl-v2/angular-growl-v2-tests.ts index fdb661161e..c03e0725ad 100644 --- a/angular-growl-v2/angular-growl-v2-tests.ts +++ b/angular-growl-v2/angular-growl-v2-tests.ts @@ -58,4 +58,8 @@ app.controller("Ctrl", ($scope:angular.IScope, growlMessages.destroyAllMessages(0); growlMessages.addMessage(messages[0]); growlMessages.deleteMessage(messages[1]); + + var testMessage = growl.warning(message); + testMessage.setText("Some other message"); + testMessage.destroy(); }); diff --git a/angular-growl-v2/angular-growl-v2.d.ts b/angular-growl-v2/angular-growl-v2.d.ts index a8e2620713..07c0dbe372 100644 --- a/angular-growl-v2/angular-growl-v2.d.ts +++ b/angular-growl-v2/angular-growl-v2.d.ts @@ -39,6 +39,16 @@ declare module angular.growl { */ interface IGrowlMessage extends IGrowlMessageConfig { text: string; + + /** + * Destroy the message. + */ + destroy(): void; + /** + * Update the message body. + * @param newText new message body + */ + setText(newText: string): void; } /** @@ -223,7 +233,7 @@ declare module angular.growl { * @param referenceId * @param limitMessages */ - initDirective(referenceId: number, limitMessages: number): ng.IDirective; + initDirective(referenceId: number, limitMessages: number): angular.IDirective; /** * Get current messages From 0fbf24e27e240cc59b8d9c27610a2fe055fda75d Mon Sep 17 00:00:00 2001 From: stephenjelfs Date: Sat, 9 Jan 2016 12:12:42 +0100 Subject: [PATCH 310/441] Fixed-Data-Table row mouse event method signatures should include event parameters. --- fixed-data-table/fixed-data-table-tests.tsx | 24 +++++++++++++++++++++ fixed-data-table/fixed-data-table.d.ts | 16 +++++++------- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/fixed-data-table/fixed-data-table-tests.tsx b/fixed-data-table/fixed-data-table-tests.tsx index 1f10a9fdb5..2c8e04a7d5 100644 --- a/fixed-data-table/fixed-data-table-tests.tsx +++ b/fixed-data-table/fixed-data-table-tests.tsx @@ -161,3 +161,27 @@ class MyTable4 extends React.Component<{}, MyTable4State> { ); } } + +// Listen for events +class MyTable5 extends React.Component<{}, {}> { + render(): React.ReactElement { + return ( + {}} + onScrollEnd={(x: number, y: number) => {}} + onContentHeightChange={(newHeight: number) => {}} + onRowClick={(event: React.SyntheticEvent, rowIndex: number) => {}} + onRowDoubleClick={(event: React.SyntheticEvent, rowIndex: number) => {}} + onRowMouseDown={(event: React.SyntheticEvent, rowIndex: number) => {}} + onRowMouseEnter={(event: React.SyntheticEvent, rowIndex: number) => {}} + onRowMouseLeave={(event: React.SyntheticEvent, rowIndex: number) => {}} + onColumnResizeEndCallback={(newColumnWidth: number, columnKey: string) => {}}> + // add columns +
              + ); + } +} diff --git a/fixed-data-table/fixed-data-table.d.ts b/fixed-data-table/fixed-data-table.d.ts index 219b7e39ff..843eb458e2 100644 --- a/fixed-data-table/fixed-data-table.d.ts +++ b/fixed-data-table/fixed-data-table.d.ts @@ -187,13 +187,13 @@ declare module FixedDataTable { * Callback that is called when scrolling starts with * current horizontal and vertical scroll values. */ - onScrollStart?: (horizontalScroll: number, verticalScroll: number) => void; + onScrollStart?: (x: number, y: number) => void; /** * Callback that is called when scrolling ends or stops with * new horizontal and vertical scroll values. */ - onScrollEnd?: (horizontalScroll: number, verticalScroll: number) => void; + onScrollEnd?: (x: number, y: number) => void; /** * Callback that is called when rowHeightGetter returns a @@ -201,35 +201,35 @@ declare module FixedDataTable { * is necessary because initially table estimates heights * of some parts of the content. */ - onContentHeightChange?: (height: number) => void; + onContentHeightChange?: (newHeight: number) => void; /** * Callback that is called when a row is clicked. */ - onRowClick?: (index: number) => void; + onRowClick?: (event: __React.SyntheticEvent, rowIndex: number) => void; /** * Callback that is called when a row is double clicked. */ - onRowDoubleClick?: (index: number) => void; + onRowDoubleClick?: (event: __React.SyntheticEvent, rowIndex: number) => void; /** * Callback that is called when a mouse-down event happens * on a row. */ - onRowMouseDown?: (index: number) => void; + onRowMouseDown?: (event: __React.SyntheticEvent, rowIndex: number) => void; /** * Callback that is called when a mouse-enter event happens * on a row. */ - onRowMouseEnter?: (index: number) => void; + onRowMouseEnter?: (event: __React.SyntheticEvent, rowIndex: number) => void; /** * Callback that is called when a mouse-leave event happens * on a row. */ - onRowMouseLeave?: (index: number) => void; + onRowMouseLeave?: (event: __React.SyntheticEvent, rowIndex: number) => void; /** * Callback that is called when resizer has been released From 88dd64ae4f16a3444bb636c2cc28ebe572917054 Mon Sep 17 00:00:00 2001 From: mzsm Date: Sat, 9 Jan 2016 20:33:20 +0900 Subject: [PATCH 311/441] Support Wii U Internet Browser, Extended Functionality --- wiiu/wiiu-tests.ts | 56 +++++++++++++++++++++++ wiiu/wiiu.d.ts | 112 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 168 insertions(+) create mode 100644 wiiu/wiiu-tests.ts create mode 100644 wiiu/wiiu.d.ts diff --git a/wiiu/wiiu-tests.ts b/wiiu/wiiu-tests.ts new file mode 100644 index 0000000000..0417e252a0 --- /dev/null +++ b/wiiu/wiiu-tests.ts @@ -0,0 +1,56 @@ +/// + +var state = window.wiiu.gamepad.update(); +if( !state.isEnabled || !state.isDataValid ){ + console.log('gyro X:' + state.gyroX.toString() + ' Y:' + state.gyroY.toString() + ' Z:' + state.gyroZ.toString()); + console.log('angle X:' + state.angleX.toString() + ' Y:' + state.angleY.toString() + ' Z:' + state.angleZ.toString()); + console.log('dirX X:' + state.dirXx.toString() + ' Y:' + state.dirXy.toString() + ' Z:' + state.dirXz.toString()); + console.log('dirY X:' + state.dirYx.toString() + ' Y:' + state.dirYy.toString() + ' Z:' + state.dirYz.toString()); + console.log('dirZ X:' + state.dirZx.toString() + ' Y:' + state.dirZy.toString() + ' Z:' + state.dirZz.toString()); + console.log('acc X:' + state.accX.toString() + ' Y:' + state.accY.toString() + ' Z:' + state.accZ.toString()); + console.log('LStick axis X:' + state.lStickX.toString() + ' Y:' + state.lStickY.toString()); + console.log('RStick axis X:' + state.rStickX.toString() + ' Y:' + state.rStickY.toString()); + + if(state.hold & window.wiiu.Button.A){ + console.log('pushing A button'); + } + + if( state.tpTouch && state.tpValidity == window.wiiu.TPValidity.VALID ){ + console.log("touch X:" + state.contentX.toString() + " Y:" + state.contentY.toString()); + } +} + +document.getElementById('video').addEventListener('wiiu_videoplayer_end', (e) => { + console.log(e); + console.log('VideoPlayer end'); +}); + +if(window.wiiu.videoplayer.viewMode == 0){ + window.wiiu.videoplayer.viewMode = 1; +} +window.wiiu.videoplayer.end(); + +window.addEventListener('wiiu_imageview_start', (e) => { + console.log(e); + console.log('ImageViewer start'); +}); +window.addEventListener('wiiu_imageview_end', (e) => { + console.log(e); + console.log('ImageViewer end'); +}); +window.addEventListener('wiiu_imageview_change_viewmode', (e) => { + console.log(e); + console.log('ImageViewer change viewmode'); + if(window.wiiu.imageview.viewMode == 1){ + window.wiiu.imageview.viewMode = 0; + } +}); +window.addEventListener('wiiu_imageview_change_content', (e) => { + console.log(e); + console.log('ImageViewer change content'); +}); +window.addEventListener('wiiu_imageview_error', (e) => { + console.log(e); + console.log('ImageViewer error'); + console.log(window.wiiu.imageview.getErrorCode()); +}); diff --git a/wiiu/wiiu.d.ts b/wiiu/wiiu.d.ts new file mode 100644 index 0000000000..b7111c91b4 --- /dev/null +++ b/wiiu/wiiu.d.ts @@ -0,0 +1,112 @@ +// Type definitions for Wii U Internet Browser, Extended Functionality +// Project: https://www.nintendo.co.jp/wiiu/hardware/internetbrowser/extended_functionality.html +// Definitions by: MIZUSHIMA Junki +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module wiiu { + const enum TPValidity { + VALID = 0, + X_INVALID = 1, + Y_INVALID = 2, + INVALID = 3 + } + const enum Button { + MINUS = 0x00000004, + SELECT = MINUS, + PLUS = 0x00000008, + START = PLUS, + R = 0x00000010, + L = 0x00000020, + ZR = 0x00000040, + ZL = 0x00000080, + DOWN = 0x00000100, + UP = 0x00000200, + RIGHT = 0x00000400, + LEFT = 0x00000800, + Y = 0x00001000, + X = 0x00002000, + B = 0x00004000, + A = 0x00008000, + R_STICK = 0x00020000, + L_STICK = 0x00040000, + R_STICK_DOWN = 0x00800000, + R_STICK_UP = 0x01000000, + R_STICK_RIGHT = 0x02000000, + R_STICK_LEFT = 0x04000000, + L_STICK_DOWN = 0x08000000, + L_STICK_UP = 0x10000000, + L_STICK_RIGHT = 0x20000000, + L_STICK_LEFT = 0x40000000 + } + + interface WiiuGamePad { + isEnabled: boolean; + isDataValid: boolean; + tpTouch: boolean; + tpValidity: number; + contentX: number; + contentY: number; + lStickX: number; + lStickY: number; + rStickX: number; + rStickY: number; + hold: number; + accX: number; + accY: number; + accZ: number; + gyroX: number; + gyroY: number; + gyroZ: number; + angleX: number; + angleY: number; + angleZ: number; + dirXx: number; + dirXy: number; + dirYx: number; + dirXz: number; + dirYy: number; + dirYz: number; + dirZx: number; + dirZz: number; + dirZy: number; + + update(): WiiuGamePad; + } + + interface VideoPlayer { + viewMode: number; + + end(): boolean; + } + + const enum ImageViewErrorCode { + UNSUPPORTED_FORMAT = 202, + DIMENSIONS_TOO_LARGE = 203, + FILE_SIZE_TOO_LARGE = 204, + TOO_MANY_PIXELS_PROGRESSIVE_JPEG = 205 + } + + interface ImageView { + viewMode: number; + + end(): boolean; + getErrorCode(): number; + } + + var gamepad: WiiuGamePad; + var videoplayer: VideoPlayer; + var imageview: ImageView; +} + +interface HTMLElement { + addEventListener(type: "wiiu_videoplayer_end", listener: (ev: CustomEvent) => any, useCapture?: boolean): void; +} + +interface Window { + wiiu: typeof wiiu; + addEventListener(type: "wiiu_imageview_start", listener: (ev: CustomEvent) => any, useCapture?: boolean): void; + addEventListener(type: "wiiu_imageview_end", listener: (ev: CustomEvent) => any, useCapture?: boolean): void; + addEventListener(type: "wiiu_imageview_change_viewmode", listener: (ev: CustomEvent) => any, useCapture?: boolean): void; + addEventListener(type: "wiiu_imageview_change_content", listener: (ev: CustomEvent) => any, useCapture?: boolean): void; + addEventListener(type: "wiiu_imageview_error", listener: (ev: CustomEvent) => any, useCapture?: boolean): void; +} From fb2254b775339aaf10b9f71f801c46b978481fb0 Mon Sep 17 00:00:00 2001 From: mzsm Date: Sat, 9 Jan 2016 20:40:38 +0900 Subject: [PATCH 312/441] Rename title --- wiiu/wiiu.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wiiu/wiiu.d.ts b/wiiu/wiiu.d.ts index b7111c91b4..184fc5f0a8 100644 --- a/wiiu/wiiu.d.ts +++ b/wiiu/wiiu.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Wii U Internet Browser, Extended Functionality +// Type definitions for Extended Functionality of Wii U Internet Browser // Project: https://www.nintendo.co.jp/wiiu/hardware/internetbrowser/extended_functionality.html // Definitions by: MIZUSHIMA Junki // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 2eecb30774e4b92855e3f2f8487a79f4b8998d63 Mon Sep 17 00:00:00 2001 From: "Igor N. Dultsev" Date: Sat, 9 Jan 2016 18:40:21 +0600 Subject: [PATCH 313/441] fixed module export type from Exphbs to ExpressHandleBars Since it is now working this way --- express-handlebars/express-handlebars.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/express-handlebars/express-handlebars.d.ts b/express-handlebars/express-handlebars.d.ts index 04eb071629..70137e1d33 100644 --- a/express-handlebars/express-handlebars.d.ts +++ b/express-handlebars/express-handlebars.d.ts @@ -1,6 +1,7 @@ // Type definitions for express-handlebars // Project: https://github.com/ericf/express-handlebars // Definitions by: Sam Saint-Pettersen +// Updated by: Igor Dultsev // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -40,7 +41,12 @@ interface Exphbs { renderView(viewPath: string, optionsOrCallback: any, callback?: () => string): void; } +interface ExpressHandlebars { + (options?: ExphbsOptions): Function; + create (options?: ExphbsOptions): Exphbs; +} + declare module "express-handlebars" { - var exphbs: Exphbs; + var exphbs: ExpressHandlebars; export = exphbs; } From abd3d655962a537a8369e7a9b81956cc39127584 Mon Sep 17 00:00:00 2001 From: "Igor N. Dultsev" Date: Sat, 9 Jan 2016 18:40:38 +0600 Subject: [PATCH 314/441] updated test to reflect changes in typing file --- express-handlebars/express-handlebars-tests.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/express-handlebars/express-handlebars-tests.ts b/express-handlebars/express-handlebars-tests.ts index 3fa6ef31da..982ff23679 100644 --- a/express-handlebars/express-handlebars-tests.ts +++ b/express-handlebars/express-handlebars-tests.ts @@ -6,9 +6,8 @@ import express = require('express'); import exphbs = require('express-handlebars'); var app = express(); -var hbs: Exphbs = exphbs.create({defaultLayout: 'main'}); -app.engine('handlebars', hbs.engine); +app.engine('handlebars', exphbs({defaultLayout: 'main'})); app.set('view engine', 'handlebars'); app.listen(1337); From 2c157f229f62f851b9fa116f8a11d364ba29a97a Mon Sep 17 00:00:00 2001 From: "Igor N. Dultsev" Date: Sat, 9 Jan 2016 18:50:38 +0600 Subject: [PATCH 315/441] Fix header --- express-handlebars/express-handlebars.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/express-handlebars/express-handlebars.d.ts b/express-handlebars/express-handlebars.d.ts index 70137e1d33..1f24f5ea44 100644 --- a/express-handlebars/express-handlebars.d.ts +++ b/express-handlebars/express-handlebars.d.ts @@ -1,7 +1,6 @@ // Type definitions for express-handlebars // Project: https://github.com/ericf/express-handlebars -// Definitions by: Sam Saint-Pettersen -// Updated by: Igor Dultsev +// Definitions by: Sam Saint-Pettersen , Igor Dultsev // Definitions: https://github.com/borisyankov/DefinitelyTyped /// From f5f2993142a8692b8f5ae7838fd96bb4d655c31a Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 9 Jan 2016 18:24:48 +0500 Subject: [PATCH 316/441] lodash: signatures of _.toArray have been changed --- lodash/lodash-tests.ts | 38 ++++++++++++++++++++++++++------------ lodash/lodash.d.ts | 35 +++++++++++++++++++++++------------ 2 files changed, 49 insertions(+), 24 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2b..3119daee68 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6255,15 +6255,13 @@ module TestToArray { let array: TResult[]; let list: _.List; let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; { let result: string[]; + result = _.toArray(''); result = _.toArray(''); - - result = (function (a: string) {return _.toArray(arguments);})(''); - - result = _((function (a: string) {return arguments;})('')).toArray().value(); } { @@ -6272,22 +6270,38 @@ module TestToArray { result = _.toArray(array); result = _.toArray(list); result = _.toArray(dictionary); + result = _.toArray(numericDictionary); - result = _(array).toArray().value(); - result = _(list).toArray().value(); - result = _(dictionary).toArray().value(); + result = _.toArray(array); + result = _.toArray(list); + result = _.toArray(dictionary); + result = _.toArray(numericDictionary); } { let result: any[]; result = _.toArray(); - result = _.toArray(42); - result = _.toArray(true); + result = _.toArray(42); + result = _.toArray(true); + } - result = _('').toArray().value(); - result = _(42).toArray().value(); - result = _(true).toArray().value(); + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).toArray(); + result = _(list).toArray(); + result = _(dictionary).toArray(); + result = _(numericDictionary).toArray(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().toArray(); + result = _(list).chain().toArray(); + result = _(dictionary).chain().toArray(); + result = _(numericDictionary).chain().toArray(); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c45ec90eea..6b3d269fdf 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10320,12 +10320,7 @@ declare module _ { * @param value The value to convert. * @return Returns the converted array. */ - toArray(value: string): string[]; - - /** - * @see _.toArray - */ - toArray(value: List|Dictionary): T[]; + toArray(value: List|Dictionary|NumericDictionary): T[]; /** * @see _.toArray @@ -10335,12 +10330,7 @@ declare module _ { /** * @see _.toArray */ - toArray(value: TValue): any[]; - - /** - * @see _.toArray - */ - toArray(value?: any): any[]; + toArray(value?: any): TResult[]; } interface LoDashImplicitWrapper { @@ -10364,6 +10354,27 @@ declare module _ { toArray(): LoDashImplicitArrayWrapper; } + interface LoDashExplicitWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + //_.toPlainObject interface LoDashStatic { /** From 58ba924b2ac9c213c0bf1ce9c4100b1c4ff2082f Mon Sep 17 00:00:00 2001 From: Robert Van Gorkom Date: Sat, 9 Jan 2016 08:54:45 -0800 Subject: [PATCH 317/441] Adding meteor roles definitions. --- meteor-roles/meteor-roles-tests.ts | 150 ++++++++++++++++ meteor-roles/meteor-roles.d.ts | 264 +++++++++++++++++++++++++++++ 2 files changed, 414 insertions(+) create mode 100644 meteor-roles/meteor-roles-tests.ts create mode 100644 meteor-roles/meteor-roles.d.ts diff --git a/meteor-roles/meteor-roles-tests.ts b/meteor-roles/meteor-roles-tests.ts new file mode 100644 index 0000000000..dae900800c --- /dev/null +++ b/meteor-roles/meteor-roles-tests.ts @@ -0,0 +1,150 @@ +/// +/// +/// + +/** + * All code below was copied from the examples at https://github.com/alanning/meteor-roles/. + * When necessary, code was added to make the examples work (e.g. declaring a variable + * that was assumed to have been declared earlier) + */ + +var joesUserId = '1234'; +Roles.addUsersToRoles(joesUserId, ['manage-team','schedule-game'], 'manchester-united.com') +Roles.addUsersToRoles(joesUserId, ['player','goalie'], 'real-madrid.com') + +Roles.userIsInRole(joesUserId, 'manage-team', 'manchester-united.com') // => true +Roles.userIsInRole(joesUserId, 'manage-team', 'real-madrid.com') // => false + +Roles.addUsersToRoles(joesUserId, 'super-admin', Roles.GLOBAL_GROUP) + +var bobsUserId = '1234'; +Roles.addUsersToRoles(bobsUserId, ['manage-team','schedule-game']) +// internal representation - no groups +// user.roles = ['manage-team','schedule-game'] + +Roles.addUsersToRoles(joesUserId, ['manage-team','schedule-game'], 'manchester-united.com') +Roles.addUsersToRoles(joesUserId, ['player','goalie'], 'real-madrid.com') +// internal representation - groups +// NOTE: MongoDB uses periods to represent hierarchy so periods in group names +// are converted to underscores. +// +// user.roles = { +// 'manchester-united_com': ['manage-team','schedule-game'], +// 'real-madrid_com': ['player','goalie'] +// } + +Meteor.roles.find({}); + + + +var users = [ + {name:"Normal User",email:"normal@example.com",roles:[]}, + {name:"View-Secrets User",email:"view@example.com",roles:['view-secrets']}, + {name:"Manage-Users User",email:"manage@example.com",roles:['manage-users']}, + {name:"Admin User",email:"admin@example.com",roles:['admin']} +]; + +_.each(users, function (user) { + var id : string; + + id = Accounts.createUser({ + email: user.email, + password: "apple1", + profile: { name: user.name } + }); + + if (user.roles.length > 0) { + // Need _id of existing user record so this call must come + // after `Accounts.createUser` or `Accounts.onCreate` + Roles.addUsersToRoles(id, user.roles, 'default-group'); + } + +}); + + + +// server/publish.js + +// Give authorized users access to sensitive data by group +Meteor.publish('secrets', function (group : string) { + if (Roles.userIsInRole(this.userId, ['view-secrets','admin'], group)) { + +// return Meteor.secrets.find({group: group}); + + } else { + + // user not authorized. do not publish secrets + this.stop(); + return; + + } +}); + + +Accounts.validateNewUser(function (user : Meteor.User) { + var loggedInUser = Meteor.user(); + + if (Roles.userIsInRole(loggedInUser, ['admin','manage-users'])) { + // NOTE: This example assumes the user is not using groups. + return true; + } + + throw new Meteor.Error('403', "Not authorized to create new users"); +}); + + +// server/userMethods.js + +Meteor.methods({ + /** + * delete a user from a specific group + * + * @method deleteUser + * @param {String} targetUserId _id of user to delete + * @param {String} group Company to update permissions for + */ + deleteUser: function (targetUserId : string, group : string) { + var loggedInUser = Meteor.user() + + if (!loggedInUser || + !Roles.userIsInRole(loggedInUser, + ['manage-users', 'support-staff'], group)) { + throw new Meteor.Error('403', "Access denied") + } + + // remove permissions for target group + Roles.setUserRoles(targetUserId, [], group) + + // do other actions required when a user is removed... + } +}) + + + +// server/userMethods.js + +Meteor.methods({ + /** + * update a user's permissions + * + * @param {Object} targetUserId Id of user to update + * @param {Array} roles User's new permissions + * @param {String} group Company to update permissions for + */ + updateRoles: function (targetUserId : string, roles : string[], group : string) { + var loggedInUser = Meteor.user() + + if (!loggedInUser || + !Roles.userIsInRole(loggedInUser, + ['manage-users', 'support-staff'], group)) { + throw new Meteor.Error('403', "Access denied") + } + + Roles.setUserRoles(targetUserId, roles, group) + } +}) + + + + + diff --git a/meteor-roles/meteor-roles.d.ts b/meteor-roles/meteor-roles.d.ts new file mode 100644 index 0000000000..95e4223ac1 --- /dev/null +++ b/meteor-roles/meteor-roles.d.ts @@ -0,0 +1,264 @@ +/// + +// Type definitions for Meteor Roles 1.2.14 +// Project: https://github.com/alanning/meteor-roles/ +// Definitions by: Robbie Van Gorkom +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** + * Provides functions related to user authorization. Compatible with built-in Meteor accounts packages. + * + * @module Roles + */ +declare module Roles { + /** + * Constant used to reference the special 'global' group that + * can be used to apply blanket permissions across all groups. + * + * @example + * Roles.addUsersToRoles(user, 'admin', Roles.GLOBAL_GROUP) + * Roles.userIsInRole(user, 'admin') // => true + * + * Roles.setUserRoles(user, 'support-staff', Roles.GLOBAL_GROUP) + * Roles.userIsInRole(user, 'support-staff') // => true + * Roles.userIsInRole(user, 'admin') // => false + * + * @property GLOBAL_GROUP + * @type String + * @static + * @final + */ + var GLOBAL_GROUP : string; + + /** + * Subscription handle for the currently logged in user's permissions. + * + * NOTE: The corresponding publish function, `_roles`, depends on + * `this.userId` so it will automatically re-run when the currently + * logged-in user changes. + * + * @example + * + * `Roles.subscription.ready()` // => `true` if user roles have been loaded + * + * @property subscription + * @type Object + * @for Roles + */ + var subscription : Subscription; + + /** + * Add users to roles. Will create roles as needed. + * + * NOTE: Mixing grouped and non-grouped roles for the same user + * is not supported and will throw an error. + * + * Makes 2 calls to database: + * 1. retrieve list of all existing roles + * 2. update users' roles + * + * @example + * Roles.addUsersToRoles(userId, 'admin') + * Roles.addUsersToRoles(userId, ['view-secrets'], 'example.com') + * Roles.addUsersToRoles([user1, user2], ['user','editor']) + * Roles.addUsersToRoles([user1, user2], ['glorious-admin', 'perform-action'], 'example.org') + * Roles.addUsersToRoles(userId, 'admin', Roles.GLOBAL_GROUP) + * + * @method addUsersToRoles + * @param {Array|String} users User id(s) or object(s) with an _id field + * @param {Array|String} roles Name(s) of roles/permissions to add users to + * @param {String} [group] Optional group name. If supplied, roles will be + * specific to that group. + * Group names can not start with '$' or numbers. + * Periods in names '.' are automatically converted + * to underscores. + * The special group Roles.GLOBAL_GROUP provides + * a convenient way to assign blanket roles/permissions + * across all groups. The roles/permissions in the + * Roles.GLOBAL_GROUP group will be automatically + * included in checks for any group. + */ + function addUsersToRoles( + user : string|string[]|Object|Object[], + roles : string|string[], + group? : string + ) : void; + + /** + * Create a new role. Whitespace will be trimmed. + * + * @method createRole + * @param {String} role Name of role + * @return {String} id of new role + */ + function createRole(role : string) : string; + + /** + * Delete an existing role. Will throw "Role in use" error if any users + * are currently assigned to the target role. + * + * @method deleteRole + * @param {String} role Name of role + */ + function deleteRole (role : string) : void; + + /** + * Retrieve set of all existing roles + * + * @method getAllRoles + * @return {Cursor} cursor of existing roles + */ + function getAllRoles() : Mongo.Cursor; + + /** + * Retrieve users groups, if any + * + * @method getGroupsForUser + * @param {String|Object} user User Id or actual user object + * @param {String} [role] Optional name of roles to restrict groups to. + * + * @return {Array} Array of user's groups, unsorted. Roles.GLOBAL_GROUP will be omitted + */ + function getGroupsForUser( + user : string|Object, + role? : string + ) : string[]; + + /** + * Retrieve users roles + * + * @method getRolesForUser + * @param {String|Object} user User Id or actual user object + * @param {String} [group] Optional name of group to restrict roles to. + * User's Roles.GLOBAL_GROUP will also be included. + * @return {Array} Array of user's roles, unsorted. + */ + function getRolesForUser( + user : string|Object, + group? : string + ) : Role[]; + + /** + * Retrieve all users who are in target role. + * + * NOTE: This is an expensive query; it performs a full collection scan + * on the users collection since there is no index set on the 'roles' field. + * This is by design as most queries will specify an _id so the _id index is + * used automatically. + * + * @method getUsersInRole + * @param {Array|String} role Name of role/permission. If array, users + * returned will have at least one of the roles + * specified but need not have _all_ roles. + * @param {String} [group] Optional name of group to restrict roles to. + * User's Roles.GLOBAL_GROUP will also be checked. + * @param {Object} [options] Optional options which are passed directly + * through to `Meteor.users.find(query, options)` + * @return {Cursor} cursor of users in role + */ + function getUsersInRole( + role : string|string[], + group? : string, + options? : { + sort?: Mongo.SortSpecifier; + skip?: number; + limit?: number; + fields?: Mongo.FieldSpecifier; + reactive?: boolean; + transform?: Function; + }) : Mongo.Cursor; + + /** + * Remove users from roles + * + * @example + * Roles.removeUsersFromRoles(users.bob, 'admin') + * Roles.removeUsersFromRoles([users.bob, users.joe], ['editor']) + * Roles.removeUsersFromRoles([users.bob, users.joe], ['editor', 'user']) + * Roles.removeUsersFromRoles(users.eve, ['user'], 'group1') + * + * @method removeUsersFromRoles + * @param {Array|String} users User id(s) or object(s) with an _id field + * @param {Array|String} roles Name(s) of roles to add users to + * @param {String} [group] Optional. Group name. If supplied, only that + * group will have roles removed. + */ + function removeUsersFromRoles( + user : string|string[]|Object|Object[], + roles? : string[], + group? : string + ) : void; + + /** + * Set a users roles/permissions. + * + * @example + * Roles.setUserRoles(userId, 'admin') + * Roles.setUserRoles(userId, ['view-secrets'], 'example.com') + * Roles.setUserRoles([user1, user2], ['user','editor']) + * Roles.setUserRoles([user1, user2], ['glorious-admin', 'perform-action'], 'example.org') + * Roles.setUserRoles(userId, 'admin', Roles.GLOBAL_GROUP) + * + * @method setUserRoles + * @param {Array|String} users User id(s) or object(s) with an _id field + * @param {Array|String} roles Name(s) of roles/permissions to add users to + * @param {String} [group] Optional group name. If supplied, roles will be + * specific to that group. + * Group names can not start with '$'. + * Periods in names '.' are automatically converted + * to underscores. + * The special group Roles.GLOBAL_GROUP provides + * a convenient way to assign blanket roles/permissions + * across all groups. The roles/permissions in the + * Roles.GLOBAL_GROUP group will be automatically + * included in checks for any group. + */ + function setUserRoles ( + user : string|string[]|Object|Object[], + roles : string|string[], + group? : string + ) : void; + + /** + * Check if user has specified permissions/roles + * + * @example + * // non-group usage + * Roles.userIsInRole(user, 'admin') + * Roles.userIsInRole(user, ['admin','editor']) + * Roles.userIsInRole(userId, 'admin') + * Roles.userIsInRole(userId, ['admin','editor']) + * + * // per-group usage + * Roles.userIsInRole(user, ['admin','editor'], 'group1') + * Roles.userIsInRole(userId, ['admin','editor'], 'group1') + * Roles.userIsInRole(userId, ['admin','editor'], Roles.GLOBAL_GROUP) + * + * // this format can also be used as short-hand for Roles.GLOBAL_GROUP + * Roles.userIsInRole(user, 'admin') + * + * @method userIsInRole + * @param {String|Object} user User Id or actual user object + * @param {String|Array} roles Name of role/permission or Array of + * roles/permissions to check against. If array, + * will return true if user is in _any_ role. + * @param {String} [group] Optional. Name of group. If supplied, limits check + * to just that group. + * The user's Roles.GLOBAL_GROUP will always be checked + * whether group is specified or not. + * @return {Boolean} true if user is in _any_ of the target roles + */ + function userIsInRole( + user : string|string[]|Object|Object[], + roles : string|string[], + group? : string + ) : boolean; + + interface Role { + name : string; + } +} // module + +declare module Meteor { + var roles : Mongo.Collection; +} From 3005019f55de22a17a8c547cd8c6a4746fe51b19 Mon Sep 17 00:00:00 2001 From: Robert Van Gorkom Date: Sat, 9 Jan 2016 09:00:50 -0800 Subject: [PATCH 318/441] Fixing declaration format. --- meteor-roles/meteor-roles.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meteor-roles/meteor-roles.d.ts b/meteor-roles/meteor-roles.d.ts index 95e4223ac1..487300b82e 100644 --- a/meteor-roles/meteor-roles.d.ts +++ b/meteor-roles/meteor-roles.d.ts @@ -1,10 +1,10 @@ -/// - // Type definitions for Meteor Roles 1.2.14 // Project: https://github.com/alanning/meteor-roles/ // Definitions by: Robbie Van Gorkom // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + /** * Provides functions related to user authorization. Compatible with built-in Meteor accounts packages. * From c4947dc14b09e9a45890ac5405638c9112fd8d67 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 10 Jan 2016 12:29:07 +0500 Subject: [PATCH 319/441] node: definition of the module "tty" has been changed --- node/node-tests.ts | 20 +++++++++++++++++++- node/node.d.ts | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index eaab3c2c8d..d3a76a983a 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -9,6 +9,7 @@ import * as crypto from "crypto"; import * as tls from "tls"; import * as http from "http"; import * as net from "net"; +import * as tty from "tty"; import * as dgram from "dgram"; import * as querystring from "querystring"; import * as path from "path"; @@ -281,7 +282,7 @@ module http_tests { }); var agent: http.Agent = http.globalAgent; - + http.request({ agent: false }); @@ -293,6 +294,23 @@ module http_tests { }); } +//////////////////////////////////////////////////// +/// TTY tests : http://nodejs.org/api/tty.html +//////////////////////////////////////////////////// + +module tty_tests { + let rs: tty.ReadStream; + let ws: tty.WriteStream; + + let rsIsRaw: boolean = rs.isRaw; + rs.setRawMode(true); + + let wsColumns: number = ws.columns; + let wsRows: number = ws.rows; + + let isTTY: boolean = tty.isatty(1); +} + //////////////////////////////////////////////////// /// Dgram tests : http://nodejs.org/api/dgram.html //////////////////////////////////////////////////// diff --git a/node/node.d.ts b/node/node.d.ts index 450facb4a5..6c4fbfa475 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1909,10 +1909,12 @@ declare module "tty" { export interface ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; + isTTY: boolean; } export interface WriteStream extends net.Socket { columns: number; rows: number; + isTTY: boolean; } } From 005ff4b6d71cc7b474386446948b4f6b2f5f7d19 Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Sun, 10 Jan 2016 18:28:42 +0100 Subject: [PATCH 320/441] The definition was incomplete --- recursive-readdir/recursive-readdir.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/recursive-readdir/recursive-readdir.d.ts b/recursive-readdir/recursive-readdir.d.ts index b948fac871..4cd17c80b4 100644 --- a/recursive-readdir/recursive-readdir.d.ts +++ b/recursive-readdir/recursive-readdir.d.ts @@ -3,13 +3,16 @@ // Definitions by: Elisée Maurer // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module "recursive-readdir" { +/// +declare module "recursive-readdir" { + import * as fs from "fs"; module RecursiveReaddir { interface readdir { (path: string, callback: (error: Error, files: string[]) => any): void; // ignorePattern supports glob syntax via https://github.com/isaacs/minimatch - (path: string, ignorePattern: string[], callback: (error: Error, files: string[]) => any): void; + (path: string, ignorePattern: (string | ((file: string, stats: fs.Stats) => void))[], callback: (error: Error, files: string[]) => any): void; + (path: string, ignoreFunction: (file: string, stats: fs.Stats) => void, callback: (error: Error, files: string[]) => any): void; } } From 7329ae6688394e18feca20a9afbdc99979475be8 Mon Sep 17 00:00:00 2001 From: Manuel Rueda Date: Sun, 10 Jan 2016 19:43:37 -0300 Subject: [PATCH 321/441] add typing for promise --- promise/promise-test.ts | 21 +++++++++++++++++++++ promise/promise.d.ts | 31 +++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 promise/promise-test.ts create mode 100644 promise/promise.d.ts diff --git a/promise/promise-test.ts b/promise/promise-test.ts new file mode 100644 index 0000000000..140d170b1a --- /dev/null +++ b/promise/promise-test.ts @@ -0,0 +1,21 @@ +/// + +var prom = new Promise((resolve, reject) => { + resolve(true); +}); + +var prom2 = new Promise((resolve, reject) => { + resolve(true); +}); + +prom.then((val) => { + console.log(val); +}).catch(() => { + +}); + +var prom3 = Promise.all([prom, prom2]); + +prom3.then((resolve: Array) => { + +}); diff --git a/promise/promise.d.ts b/promise/promise.d.ts new file mode 100644 index 0000000000..387a013975 --- /dev/null +++ b/promise/promise.d.ts @@ -0,0 +1,31 @@ +// Type definitions for promise v7.1.1 +// Project: https://www.promisejs.org/ +// Definitions by: Manuel Rueda +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Support AMD require +declare module 'promise' { + export = Promise; +} + +declare var Promise: Promise.Ipromise; + +declare module Promise { + + export interface Ipromise { + new (resolver: (resolve: (value: T) => void, reject: (reason: any) => void) => void): IThenable; + + resolve: (value: T) => IThenable; + reject: (value: T) => IThenable; + all: (array: Array>) => IThenable>; + denodeify: (fn: Function) => IThenable; + nodeify: (fn: Function) => Function; + } + + export interface IThenable { + then(onFulfilled?: (value: T) => IThenable|R, onRejected?: (error: any) => IThenable|R): IThenable; + catch(onRejected?: (error: any) => IThenable|R): IThenable; + done(onFulfilled?: (value: T) => IThenable|R, onRejected?: (error: any) => IThenable|R): IThenable; + nodeify(callbacl: Function): IThenable; + } +} From 52b68b9e9c434c51c78ee27066a5c473b112ba3f Mon Sep 17 00:00:00 2001 From: Manuel Rueda Date: Sun, 10 Jan 2016 19:46:46 -0300 Subject: [PATCH 322/441] fix typo --- promise/promise.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/promise/promise.d.ts b/promise/promise.d.ts index 387a013975..9237b89088 100644 --- a/promise/promise.d.ts +++ b/promise/promise.d.ts @@ -26,6 +26,6 @@ declare module Promise { then(onFulfilled?: (value: T) => IThenable|R, onRejected?: (error: any) => IThenable|R): IThenable; catch(onRejected?: (error: any) => IThenable|R): IThenable; done(onFulfilled?: (value: T) => IThenable|R, onRejected?: (error: any) => IThenable|R): IThenable; - nodeify(callbacl: Function): IThenable; + nodeify(callback: Function): IThenable; } } From 2d4654128dd3304fffe0561e980d8b379d873528 Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Sun, 10 Jan 2016 22:40:14 -0800 Subject: [PATCH 323/441] Maker.js 0.6.8 added exporter options --- maker.js/makerjs-tests.ts | 16 ++++++++++++- maker.js/makerjs.d.ts | 50 ++++++++++++++++++++++++++++++++++----- 2 files changed, 59 insertions(+), 7 deletions(-) diff --git a/maker.js/makerjs-tests.ts b/maker.js/makerjs-tests.ts index 4b6b5f80e2..e314f09669 100644 --- a/maker.js/makerjs-tests.ts +++ b/maker.js/makerjs-tests.ts @@ -42,7 +42,19 @@ function test() { makerjs.exporter.toDXF(model); makerjs.exporter.toOpenJsCad(model); makerjs.exporter.toSTL(model); - makerjs.exporter.toSVG(model); + makerjs.exporter.toSVG(model, + { + annotate: true, + fontSize: '', + origin: [], + scale: 9.9, + stroke: '', + strokeWidth: '', + svgAttrs: {}, + units: '', + useSvgPathOnly: false, + viewBox: false + }); makerjs.exporter.tryGetModelUnits(model); } @@ -51,6 +63,7 @@ function test() { makerjs.kit.getParameterValues(null); ({}).max; ({}).metaParameters; + ({}).notes; } function testMeasure() { @@ -83,6 +96,7 @@ function test() { makerjs.model.rotate(makerjs.model.scale(model, 6), 45, [0,0]); makerjs.model.scale(model, 7); makerjs.model.walkPaths(model, (modelContext: MakerJs.IModel, pathId: string, pathContext: MakerJs.IPath) => {}); + model.exporterOptions = { foo: 'bar' }; } function testModels(): MakerJs.IModel[] { diff --git a/maker.js/makerjs.d.ts b/maker.js/makerjs.d.ts index cb217adb49..b45a1ceffb 100644 --- a/maker.js/makerjs.d.ts +++ b/maker.js/makerjs.d.ts @@ -345,6 +345,12 @@ declare module MakerJs { * Optional layer of this model. */ layer?: string; + /** + * Optional exporter options for this model. + */ + exporterOptions?: { + [exporterName: string]: any; + }; } /** * Callback signature for model.walkPaths(). @@ -412,6 +418,10 @@ declare module MakerJs { * Each element of the array corresponds to a parameter of the constructor, in order. */ metaParameters?: IMetaParameter[]; + /** + * Information about this kit, in plain text or markdown format. + */ + notes?: string; } } declare module MakerJs.angle { @@ -1225,12 +1235,36 @@ declare module MakerJs.exporter { * Optional size of curve facets. */ facetSize?: number; + /** + * Optional override of function name, default is "main". + */ + functionName?: string; + /** + * Optional options applied to specific first-child models by model id. + */ + modelMap?: IOpenJsCadOptionsMap; + } + interface IOpenJsCadOptionsMap { + [modelId: string]: IOpenJsCadOptions; } } declare module MakerJs.exporter { function toSVG(modelToExport: IModel, options?: ISVGRenderOptions): string; function toSVG(pathsToExport: IPath[], options?: ISVGRenderOptions): string; function toSVG(pathToExport: IPath, options?: ISVGRenderOptions): string; + /** + * Map of MakerJs unit system to SVG unit system + */ + interface svgUnitConversion { + [unitType: string]: { + svgUnitType: string; + scaleConversion: number; + }; + } + /** + * Map of MakerJs unit system to SVG unit system + */ + var svgUnit: svgUnitConversion; /** * SVG rendering options. */ @@ -1239,6 +1273,10 @@ declare module MakerJs.exporter { * Optional attributes to add to the root svg tag. */ svgAttrs?: IXmlTagAttrs; + /** + * SVG font size and font size units. + */ + fontSize?: string; /** * SVG stroke width of paths. This may have a unit type suffix, if not, the value will be in the same unit system as the units property. */ @@ -1246,27 +1284,27 @@ declare module MakerJs.exporter { /** * SVG color of the rendered paths. */ - stroke: string; + stroke?: string; /** * Scale of the SVG rendering. */ - scale: number; + scale?: number; /** * Indicate that the id's of paths should be rendered as SVG text elements. */ - annotate: boolean; + annotate?: boolean; /** * Rendered reference origin. */ - origin: IPoint; + origin?: IPoint; /** * Use SVG < path > elements instead of < line >, < circle > etc. */ - useSvgPathOnly: boolean; + useSvgPathOnly?: boolean; /** * Flag to use SVG viewbox. */ - viewBox: boolean; + viewBox?: boolean; } } declare module MakerJs.models { From b3109b5c64dc07a42fa00e191ba8a87e009a04b5 Mon Sep 17 00:00:00 2001 From: WAEL BEN ZID Date: Mon, 11 Jan 2016 09:09:46 +0100 Subject: [PATCH 324/441] Naming convention fixed --- prettyjson/prettyjson-tests.ts | 2 +- prettyjson/prettyjson.d.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/prettyjson/prettyjson-tests.ts b/prettyjson/prettyjson-tests.ts index 9d7c43918d..80ecbbb0f7 100644 --- a/prettyjson/prettyjson-tests.ts +++ b/prettyjson/prettyjson-tests.ts @@ -1,6 +1,6 @@ /// -var options: prettyjson.IOptions, +var options: prettyjson.RendererOptions, input: string, output: string, version: string; diff --git a/prettyjson/prettyjson.d.ts b/prettyjson/prettyjson.d.ts index b2a6399ac8..cf2a69c197 100644 --- a/prettyjson/prettyjson.d.ts +++ b/prettyjson/prettyjson.d.ts @@ -20,7 +20,7 @@ declare module prettyjson { * * @return {string} pretty serialized json data ready to display. */ - export function render(data: any, options?: IOptions, indentation?: number): string; + export function render(data: any, options?: RendererOptions, indentation?: number): string; /** * Render pretty json from a string. @@ -31,9 +31,9 @@ declare module prettyjson { * * @return {string} pretty serialized json data ready to display. */ - export function renderString(data: string, options?: IOptions, indentation?: number): string; + export function renderString(data: string, options?: RendererOptions, indentation?: number): string; - export interface IOptions { + export interface RendererOptions { /** * Define behavior for Array objects From 99a4e27e9b376ad0636a5b8430076ce460f55ba3 Mon Sep 17 00:00:00 2001 From: Niko Kovacic Date: Mon, 11 Jan 2016 13:27:33 +0100 Subject: [PATCH 325/441] FieldGroup property in IFieldGroup should be optional. --- angular-formly/angular-formly.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-formly/angular-formly.d.ts b/angular-formly/angular-formly.d.ts index 8c07ea8001..f42b35a89e 100644 --- a/angular-formly/angular-formly.d.ts +++ b/angular-formly/angular-formly.d.ts @@ -24,7 +24,7 @@ declare module AngularFormly { data?: Object; className?: string; elementAttributes?: string; - fieldGroup: IFieldArray; + fieldGroup?: IFieldArray; form?: Object; hide?: boolean; hideExpression?: string | IExpressionFunction; From 8acb8a3f7bfef5469cae1c249beb9c44259e1d3d Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Mon, 11 Jan 2016 13:53:15 +0000 Subject: [PATCH 326/441] Fix return type of Entry.{moveTo,copyTo} in filesystem.d.ts --- filesystem/filesystem.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/filesystem/filesystem.d.ts b/filesystem/filesystem.d.ts index 1b76846b4d..d99105f0bc 100644 --- a/filesystem/filesystem.d.ts +++ b/filesystem/filesystem.d.ts @@ -161,7 +161,7 @@ interface Entry { * A move of a file on top of an existing file must attempt to delete and replace that file. * A move of a directory on top of an existing empty directory must attempt to delete and replace that directory. */ - moveTo(parent:DirectoryEntry, newName?:string, successCallback?:EntryCallback, errorCallback?:ErrorCallback):string; + moveTo(parent:DirectoryEntry, newName?:string, successCallback?:EntryCallback, errorCallback?:ErrorCallback):void; /** * Copy an entry to a different location on the file system. It is an error to try to: @@ -178,7 +178,7 @@ interface Entry { * * Directory copies are always recursive--that is, they copy all contents of the directory. */ - copyTo(parent:DirectoryEntry, newName?:string, successCallback?:EntryCallback, errorCallback?:ErrorCallback):string; + copyTo(parent:DirectoryEntry, newName?:string, successCallback?:EntryCallback, errorCallback?:ErrorCallback):void; /** * Returns a URL that can be used to identify this entry. Unlike the URN defined in [FILE-API-ED], it has no specific expiration; as it describes a location on disk, it should be valid at least as long as that location exists. From 948f0629b2cfc28db174feb4ba5da1d28a4de863 Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Mon, 11 Jan 2016 15:06:54 +0100 Subject: [PATCH 327/441] added old author; grammatical corrections, stop() now returns void instead of any --- keyboardjs/keyboardjs.d.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/keyboardjs/keyboardjs.d.ts b/keyboardjs/keyboardjs.d.ts index 6a5c10f962..0d6783ee8f 100644 --- a/keyboardjs/keyboardjs.d.ts +++ b/keyboardjs/keyboardjs.d.ts @@ -1,6 +1,7 @@ // Type definitions for KeyboardJS v2.2.0 // Project: https://github.com/RobertWHurst/KeyboardJS -// Definitions by: David Asmuth +// Definitions by: Vincent Bortone , +// David Asmuth // Definitions: https://github.com/borisyankov/DefinitelyTyped // KeyboardJS is a library for use in the browser (node.js compatible). @@ -36,14 +37,14 @@ declare module keyboardjs { /** * Binds a keyCombo to specific callback functions. * @param keyCombo String of keys to be pressed to execute callbacks. - * @param pressed Callback that gets execute when the keyCombostate is 'pressed', can be null. - * @param released Callback that gets execute when the keyCombostate is 'released' + * @param pressed Callback that gets executed when the keyComboState is 'pressed', can be null. + * @param released Callback that gets executed when the keyComboState is 'released' */ export function bind(keyCombo: string, pressed: Callback, released: Callback): void; /** * Binds a keyCombo to specific callback functions. * @param keyCombo String of keys to be pressed to execute callbacks. - * @param pressed Callback that gets executed when the keyCombostate is 'pressed' + * @param pressed Callback that gets executed when the keyComboState is 'pressed' */ export function bind(keyCombo: string, pressed: Callback): void; @@ -125,9 +126,9 @@ declare module keyboardjs { export function watch(): void; /** - * Detaches KeyboardJS from the window and documant/element + * Detaches KeyboardJS from the window and document/element */ - export function stop(); + export function stop(): void; } declare module 'keyboardjs' { From 890d4d8bfea9ba2fd03fb76c82cd95e236a48433 Mon Sep 17 00:00:00 2001 From: DavidCai <376462191@qq.com> Date: Mon, 11 Jan 2016 22:23:56 +0800 Subject: [PATCH 328/441] add koa2.d.ts --- koa2/koa2-tests.ts | 20 +++++++ koa2/koa2.d.ts | 135 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 koa2/koa2-tests.ts create mode 100644 koa2/koa2.d.ts diff --git a/koa2/koa2-tests.ts b/koa2/koa2-tests.ts new file mode 100644 index 0000000000..7c460d475f --- /dev/null +++ b/koa2/koa2-tests.ts @@ -0,0 +1,20 @@ +/// +import * as Koa from "koa"; + +const app = new Koa(); + +app.use((ctx, next) => { + const start: any = new Date(); + return next().then(() => { + const end: any = new Date(); + const ms = end - start; + console.log(`${ctx.method} ${ctx.url} - ${ms}ms`); + }); +}); + +// response +app.use(ctx => { + ctx.body = "Hello World"; +}); + +app.listen(3000); diff --git a/koa2/koa2.d.ts b/koa2/koa2.d.ts new file mode 100644 index 0000000000..0433e2b09b --- /dev/null +++ b/koa2/koa2.d.ts @@ -0,0 +1,135 @@ +// Type definitions for Koa 2.x +// Project: http://koajs.com +// Definitions by: DavidCai1993 +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* =================== USAGE =================== + + import * as Koa from "koa" + const app = new Koa() + + =============================================== */ +/// + +declare module "koa" { + import { EventEmitter } from "events"; + import * as http from "http"; + import * as net from "net"; + + interface IContext extends IRequest, IResponse { + body?: any; + request?: IRequest; + response?: IResponse; + originalUrl?: string; + state?: any; + name?: string; + cookies?: any; + writable?: Boolean; + respond?: Boolean; + app?: Koa; + req?: http.IncomingMessage; + res?: http.ServerResponse; + onerror(err: any): void; + toJSON(): any; + inspect(): any; + throw(): void; + assert(): void; + } + + interface IRequest { + _querycache?: string; + app?: Koa; + req?: http.IncomingMessage; + res?: http.ServerResponse; + response?: IResponse; + ctx?: IContext; + headers?: any; + header?: any; + method?: string; + length?: any; + url?: string; + origin?: string; + originalUrl?: string; + href?: string; + path?: string; + querystring?: string; + query?: any; + search?: string; + idempotent?: Boolean; + socket?: net.Socket; + protocol?: string; + host?: string; + hostname?: string; + fresh?: Boolean; + stale?: Boolean; + charset?: string; + secure?: Boolean; + ips?: Array; + ip?: string; + subdomains?: Array; + accept?: any; + type?: string; + accepts?: () => any; + acceptsEncodings?: () => any; + acceptsCharsets?: () => any; + acceptsLanguages?: () => any; + is?: (types: any) => any; + toJSON?: () => any; + inspect?: () => any; + get?: (field: string) => string; + } + + interface IResponse { + _body?: any; + _explicitStatus?: Boolean; + app?: Koa; + res?: http.ServerResponse; + req?: http.IncomingMessage; + ctx?: IContext; + request?: IRequest; + socket?: net.Socket; + header?: any; + headers?: any; + status?: number; + message?: string; + type?: string; + body?: any; + length?: any; + headerSent?: Boolean; + lastModified?: Date; + etag?: string; + writable?: Boolean; + is?: (types: any) => any; + redirect?: (url: string, alt: string) => void; + attachment?: (filename?: string) => void; + vary?: (field: string) => void; + get?: (field: string) => string; + set?: (field: any, val: any) => void; + remove?: (field: string) => void; + append?: (field: string, val: any) => void; + toJSON?: () => any; + inspect?: () => any; + } + + class Koa extends EventEmitter { + keys: Array; + subdomainOffset: number; + proxy: Boolean; + server: http.Server; + env: string; + context: IContext; + request: IRequest; + response: IResponse; + silent: Boolean; + constructor(); + use(middleware: (ctx: IContext, next: Function) => any): Koa; + callback(): (req: http.IncomingMessage, res: http.ServerResponse) => void; + listen(port: number, callback?: Function): http.Server; + toJSON(): any; + inspect(): any; + onerror(err: any): void; + } + + let K: typeof Koa; + export = K +} From 19850bf86c876e0c2544842114878ece4664941a Mon Sep 17 00:00:00 2001 From: Niko Kovacic Date: Mon, 11 Jan 2016 15:43:58 +0100 Subject: [PATCH 329/441] Added forceAsyncReload method to $translateProvider. --- angular-translate/angular-translate-tests.ts | 1 + angular-translate/angular-translate.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/angular-translate/angular-translate-tests.ts b/angular-translate/angular-translate-tests.ts index a19d27adec..8ef1ab2e39 100644 --- a/angular-translate/angular-translate-tests.ts +++ b/angular-translate/angular-translate-tests.ts @@ -26,6 +26,7 @@ app.config(($translateProvider: angular.translate.ITranslateProvider) => { $translateProvider.preferredLanguage('en'); $translateProvider.useLoader('customLoader'); + $translateProvider.forceAsyncReload(true); }); interface Scope extends ng.IScope { diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index 960012a576..379bd05ecb 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -87,6 +87,7 @@ declare module angular.translate { fallbackLanguage(): ITranslateProvider; fallbackLanguage(language: string): ITranslateProvider; fallbackLanguage(languages: string[]): ITranslateProvider; + forceAsyncReload(value: boolean): ITranslateProvider; use(): string; use(key: string): ITranslateProvider; storageKey(): string; From 96c7488d5f84129c7a108d2124fc4d9d90bb6331 Mon Sep 17 00:00:00 2001 From: DavidCai <376462191@qq.com> Date: Mon, 11 Jan 2016 23:23:15 +0800 Subject: [PATCH 330/441] rename koa2 to koa --- koa2/koa2-tests.ts => koa/koa-tests.ts | 2 +- koa2/koa2.d.ts => koa/koa.d.ts | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename koa2/koa2-tests.ts => koa/koa-tests.ts (90%) rename koa2/koa2.d.ts => koa/koa.d.ts (100%) diff --git a/koa2/koa2-tests.ts b/koa/koa-tests.ts similarity index 90% rename from koa2/koa2-tests.ts rename to koa/koa-tests.ts index 7c460d475f..e984364973 100644 --- a/koa2/koa2-tests.ts +++ b/koa/koa-tests.ts @@ -1,4 +1,4 @@ -/// +/// import * as Koa from "koa"; const app = new Koa(); diff --git a/koa2/koa2.d.ts b/koa/koa.d.ts similarity index 100% rename from koa2/koa2.d.ts rename to koa/koa.d.ts From 6c53e8f8572775932e15ccdf4c889f4f79c83dde Mon Sep 17 00:00:00 2001 From: Manuel Rueda Date: Mon, 11 Jan 2016 12:24:32 -0300 Subject: [PATCH 331/441] Fix tests file name --- promise/{promise-test.ts => promise-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename promise/{promise-test.ts => promise-tests.ts} (100%) diff --git a/promise/promise-test.ts b/promise/promise-tests.ts similarity index 100% rename from promise/promise-test.ts rename to promise/promise-tests.ts From 4146ca6918fe8dafa3ca1fc43444493d04dc14eb Mon Sep 17 00:00:00 2001 From: Urs Wegmann Date: Mon, 11 Jan 2016 17:09:44 +0100 Subject: [PATCH 332/441] Add relativeUrls to IOptions --- gulp-less/gulp-less.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/gulp-less/gulp-less.d.ts b/gulp-less/gulp-less.d.ts index 9ca5e35b7b..ed1ab5f0fc 100644 --- a/gulp-less/gulp-less.d.ts +++ b/gulp-less/gulp-less.d.ts @@ -10,6 +10,7 @@ declare module "gulp-less" { interface IOptions { paths: string[]; plugins?: any[]; + relativeUrls?: boolean; } function less(options?: IOptions): NodeJS.ReadWriteStream; From c0bc8907bd25a1179d171f27fd7609011ac1ab8d Mon Sep 17 00:00:00 2001 From: Kirill Chaban Date: Mon, 11 Jan 2016 22:09:57 +0300 Subject: [PATCH 333/441] material-ui: fix misprint in time-picker Renamed textFieldStye to textFieldStyle --- material-ui/material-ui-tests.tsx | 4 ++++ material-ui/material-ui.d.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/material-ui/material-ui-tests.tsx b/material-ui/material-ui-tests.tsx index b5875f76d8..ffd9b18144 100644 --- a/material-ui/material-ui-tests.tsx +++ b/material-ui/material-ui-tests.tsx @@ -23,6 +23,7 @@ import CardActions = require("material-ui/lib/card/card-actions"); import Dialog = require("material-ui/lib/dialog"); import DropDownMenu = require("material-ui/lib/drop-down-menu"); import DatePicker = require("material-ui/lib/date-picker/date-picker"); +import TimePicker = require("material-ui/lib/time-picker"); import RadioButtonGroup = require("material-ui/lib/radio-button-group"); import RadioButton = require("material-ui/lib/radio-button"); import Toggle = require("material-ui/lib/toggle"); @@ -193,6 +194,9 @@ class MaterialUiTests extends React.Component<{}, MaterialUiTestsState> implemen element = ; + // "http://material-ui.com/#/components/time-picker" + element = + // "http://material-ui.com/#/components/dialog" let standardActions = [ { text: 'Cancel' }, diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index 8e135ce21c..e727107cd6 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -1296,7 +1296,7 @@ declare namespace __MaterialUI { format?: string; pedantic?: boolean; style?: __React.CSSProperties; - textFieldStye?: __React.CSSProperties; + textFieldStyle?: __React.CSSProperties; autoOk?: boolean; openDialog?: () => void; onFocus?: React.FocusEventHandler; From 2e36df31fefbe865f9c457ce525f66c932935d99 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 12 Jan 2016 00:03:57 +0500 Subject: [PATCH 334/441] lodash: signatures of _.merge have been changed --- lodash/lodash-tests.ts | 35 ++++++++++++++++++++++++++++ lodash/lodash.d.ts | 53 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 1 deletion(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 4dfaa33f18..900d6c6268 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8478,6 +8478,41 @@ module TestMerge { { a: [1] }, { a: true }).value(); + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(initialValue).chain().merge(mergingValue); + result = _(initialValue).chain().merge(mergingValue, customizer); + result = _(initialValue).chain().merge(mergingValue, customizer, any); + + result = _(initialValue).chain().merge({}, mergingValue); + result = _(initialValue).chain().merge({}, mergingValue, customizer); + result = _(initialValue).chain().merge({}, mergingValue, customizer, any); + + result = _(initialValue).chain().merge({}, {}, mergingValue); + result = _(initialValue).chain().merge({}, {}, mergingValue, customizer); + result = _(initialValue).chain().merge({}, {}, mergingValue, customizer, any); + + result = _(initialValue).chain().merge({}, {}, {}, mergingValue); + result = _(initialValue).chain().merge({}, {}, {}, mergingValue, customizer); + result = _(initialValue).chain().merge({}, {}, {}, mergingValue, customizer, any); + + result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue); + result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue, customizer); + result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({ a: 1 }).chain().merge({ b: "string" }, { c: {} }, { d: [1] }, { e: true }); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({ a: 1 }).chain().merge({ a: "string" }, { a: {} }, { a: [1] }, { a: true }); + } } // _.methods diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 5f0c07777a..3a37fc9ddf 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -13018,7 +13018,7 @@ declare module _ { source4: TSource4, customizer?: MergeCustomizer, thisArg?: any - ): TObject & TSource1 & TSource2 & TSource3 & TSource4; + ): TObject & TSource1 & TSource2 & TSource3 & TSource4; /** * @see _.merge @@ -13080,6 +13080,57 @@ declare module _ { ): LoDashImplicitObjectWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.merge + */ + merge( + source: TSource, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + ...otherArgs: any[] + ): LoDashExplicitObjectWrapper; + } + //_.methods interface LoDashStatic { /** From 39e510415cb398c5b982f68adec1a82f84bebadd Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 12 Jan 2016 01:10:13 +0500 Subject: [PATCH 335/441] node: definition of the module "crypto" has been changed --- node/node-tests.ts | 7 +++++++ node/node.d.ts | 14 +++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index d3a76a983a..9aebe5c53c 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -203,6 +203,13 @@ function stream_readable_pipe_test() { var hmacResult: string = crypto.createHmac('md5', 'hello').update('world').digest('hex'); +{ + let hmac: crypto.Hmac; + (hmac = crypto.createHmac('md5', 'hello')).end('world', 'utf8', () => { + let hash: Buffer|string = hmac.read(); + }); +} + function crypto_cipher_decipher_string_test() { var key:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]); var clearText:string = "This is the clear text."; diff --git a/node/node.d.ts b/node/node.d.ts index 6c4fbfa475..a7f1a1617e 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1681,13 +1681,13 @@ declare module "crypto" { export function createHash(algorithm: string): Hash; export function createHmac(algorithm: string, key: string): Hmac; export function createHmac(algorithm: string, key: Buffer): Hmac; - interface Hash { + export interface Hash { update(data: any, input_encoding?: string): Hash; digest(encoding: 'buffer'): Buffer; digest(encoding: string): any; digest(): Buffer; } - interface Hmac { + export interface Hmac extends NodeJS.ReadWriteStream { update(data: any, input_encoding?: string): Hmac; digest(encoding: 'buffer'): Buffer; digest(encoding: string): any; @@ -1695,7 +1695,7 @@ declare module "crypto" { } export function createCipher(algorithm: string, password: any): Cipher; export function createCipheriv(algorithm: string, key: any, iv: any): Cipher; - interface Cipher { + export interface Cipher { update(data: Buffer): Buffer; update(data: string, input_encoding?: string, output_encoding?: string): string; final(): Buffer; @@ -1704,7 +1704,7 @@ declare module "crypto" { } export function createDecipher(algorithm: string, password: any): Decipher; export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher; - interface Decipher { + export interface Decipher { update(data: Buffer): Buffer; update(data: string, input_encoding?: string, output_encoding?: string): string; final(): Buffer; @@ -1712,18 +1712,18 @@ declare module "crypto" { setAutoPadding(auto_padding: boolean): void; } export function createSign(algorithm: string): Signer; - interface Signer extends NodeJS.WritableStream { + export interface Signer extends NodeJS.WritableStream { update(data: any): void; sign(private_key: string, output_format: string): string; } export function createVerify(algorith: string): Verify; - interface Verify extends NodeJS.WritableStream { + export interface Verify extends NodeJS.WritableStream { update(data: any): void; verify(object: string, signature: string, signature_format?: string): boolean; } export function createDiffieHellman(prime_length: number): DiffieHellman; export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman; - interface DiffieHellman { + export interface DiffieHellman { generateKeys(encoding?: string): string; computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string; getPrime(encoding?: string): string; From ceedbb35506c4b20867ddb495e8626ea04f38969 Mon Sep 17 00:00:00 2001 From: Max Shmelev Date: Mon, 11 Jan 2016 18:34:47 -0500 Subject: [PATCH 336/441] Support TypeScript 1.7 modules This fix allows to import modules in TypesScript 1.7 using `import` keyword, like: import * as sinonChai from 'sinon-chai'; The current version gives compilation error: "Module sinon-chai resolves to a non-module entity" --- sinon-chai/sinon-chai.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/sinon-chai/sinon-chai.d.ts b/sinon-chai/sinon-chai.d.ts index 03bd0e81da..1695b1e54d 100644 --- a/sinon-chai/sinon-chai.d.ts +++ b/sinon-chai/sinon-chai.d.ts @@ -80,5 +80,6 @@ declare module Chai { declare module "sinon-chai" { function sinonChai(chai: any, utils: any): void; + namespace sinonChai { } export = sinonChai; } From 57112090daefe2e0fb29726d9bd170b19c43d336 Mon Sep 17 00:00:00 2001 From: Matthias Thomann Date: Tue, 12 Jan 2016 08:45:04 +0100 Subject: [PATCH 337/441] Added missing options to SliderOptions and DialogOptions --- jqueryui/jqueryui-tests.ts | 4 +++- jqueryui/jqueryui.d.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index bc84cb475a..75ad6f3cd8 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1441,6 +1441,7 @@ function test_dialog() { $(".selector").dialog({ buttons: [ { text: "Ok", click: function () { $(this).dialog("close"); } } ] } ); $(".selector").dialog({ closeOnEscape: false }); $(".selector").dialog({ closeText: "hide" }); + $(".selector").dialog({ appendTo: "appendTo" }); $(".selector").dialog({ dialogClass: "alert" }); $(".selector").dialog({ disabled: true }); $(".selector").dialog({ draggable: false }); @@ -1489,7 +1490,8 @@ function test_slider() { value: 123, range: "min", animate: true, - orientation: "vertical" + orientation: "vertical", + highlight: true }); $("#slider-range").slider({ range: true, diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index ade8eb735d..08735884bf 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -345,6 +345,7 @@ declare module JQueryUI { buttons?: { [buttonText: string]: (event?: Event) => void } | DialogButtonOptions[]; closeOnEscape?: boolean; closeText?: string; + appendTo?: string; dialogClass?: string; disabled?: boolean; draggable?: boolean; @@ -634,6 +635,7 @@ declare module JQueryUI { step?: number; value?: number; values?: number[]; + highlight?: boolean; } interface SliderUIParams { From ac0fcd9ac803963b666aeb46b545be098bfe6ee6 Mon Sep 17 00:00:00 2001 From: Philipp Stucki Date: Tue, 12 Jan 2016 11:04:46 +0100 Subject: [PATCH 338/441] adds definitions for https://github.com/mattijs/node-rsync --- rsync/rsync-tests.ts | 157 +++++++++++++++++++++++++++++++++++++++++++ rsync/rsync.d.ts | 97 ++++++++++++++++++++++++++ 2 files changed, 254 insertions(+) create mode 100644 rsync/rsync-tests.ts create mode 100644 rsync/rsync.d.ts diff --git a/rsync/rsync-tests.ts b/rsync/rsync-tests.ts new file mode 100644 index 0000000000..6e12213bd2 --- /dev/null +++ b/rsync/rsync-tests.ts @@ -0,0 +1,157 @@ +/// + +import * as Rsync from 'rsync'; + +// -------------------------- +// simple usage +// Build the command +const rs = new Rsync() + .shell('ssh') + .flags('az') + .source('/path/to/source') + .destination('server:/path/to/destination'); + +// Execute the command +rs.execute(function(error, code, cmd) { + // we're done +}); + +// -------------------------- +// api +const rsync = new Rsync(); + + +// set(flags, set) +rsync.set('a') + .set('progress') + .set('list-only') + .set('exclude-from', '/path/to/exclude-file'); + +// unset +rsync.unset('progress') + .unset('quiet'); + +// flags// As String +rsync.flags('avz'); // set +rsync.flags('avz', false); // unset + +// As String arguments +rsync.flags('a', 'v', 'z'); // set +rsync.flags('a', 'v', 'z', false); // unset + +// As Array +rsync.flags(['a', 'v', 'z']); // set +rsync.flags(['a', 'z'], false); // unset + +// As Object +rsync.flags({ + 'a': true, // set + 'z': true, // set + 'v': false // unset +}); + + +// isSet(option) +rsync.set('quiet'); +rsync.isSet('quiet'); // is TRUE +rsync.isSet('q'); // is FALSE + + +// option(option) +rsync.option('rsh'); // returns String value +rsync.option('progress'); // returns NULL + + +// command() +const command = rsync.command(); + + +// output(stdoutHandler, stderrHandler) +rsync.output( + function(data) { + // do things like parse progress + }, function(data) { + // do things like parse error output + } +); + + +// execute(callback, stdoutHandler, stderrHandler) +// signal handler function +const quitting = function() { + if (rsyncPid) { + rsyncPid.kill(); + } + process.exit(); +} +process.on("SIGINT", quitting); // run signal handler on CTRL-C +process.on("SIGTERM", quitting); // run signal handler on SIGTERM +process.on("exit", quitting); // run signal handler when main process exits + +// simple execute +var rsyncPid = rsync.execute(function(error, code, cmd) { + // we're done +}); + +// execute with stream callbacks +var rsyncPid = rsync.execute( + function(error, code, cmd) { + // we're done + }, function(data) { + // do things like parse progress + }, function(data) { + // do things like parse error output + } +); + + +// option shorthands +rsync.shell('ssh') + .delete() + .progress() + .archive() + .compress() + .recursive() + .update() + .quiet() + .dirs() + .links() + .dry(); + + +// accessor methods +rsync.executable('executable'); +const e = rsync.executable(); + +rsync.executableShell('executableShell'); +const s = rsync.executableShell(); + +rsync.destination('destination'); +const d = rsync.destination(); + +rsync.source('/a/path') + .source('/b/path'); +rsync.source(['/a/path', '/b/path']); +const src = rsync.source() + + +// patterns +// on an existing Rsync object +rsync.patterns([ '-.git', { action: '+', pattern: '/some_dir' }]); + +// exclude(pattern) +// chained +rsync.exclude('.git') + .exclude('.DS_Store'); + +// as Array +rsync.exclude(['.git', '.DS_Store']); + + +// include(pattern) +// chained +rsync.include('/a/file') + .include('/b/file'); + +// as Array +rsync.include(['/a/file', '/b/file']); \ No newline at end of file diff --git a/rsync/rsync.d.ts b/rsync/rsync.d.ts new file mode 100644 index 0000000000..137e9c1d1b --- /dev/null +++ b/rsync/rsync.d.ts @@ -0,0 +1,97 @@ +// Type definitions for node-rsync v0.4.0 +// Project: https://github.com/mattijs/node-rsync +// Definitions by: Philipp Stucki +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module 'rsync' { + import * as child_process from 'child_process'; + interface StreamDataHandler { + (data: any): void; + } + + interface Pattern { + action: string; + pattern: string; + } + + interface Flag { + [name: string]: boolean; + } + + interface Rsync { + // instance methods + set(option: string, value: string): Rsync; + set(option: string): Rsync; + + unset(option: string): Rsync; + + flags(flags: string, set?: boolean): Rsync; + flags(flags: Flag): Rsync; + flags(flags: string[], set?: boolean): Rsync; + flags(...flags: any[]): Rsync + + isSet(option: string): boolean; + + option(option: string): any; + + args(): string[]; + + command(): string; + + output(stdout: StreamDataHandler, stderr: StreamDataHandler):Rsync; + + execute(callback: (err: Error, code: number, cmd: string) => void): child_process.ChildProcess; + execute( + callback: (err: Error, code: number, cmd: string) => void, + stdout: StreamDataHandler, + stderr: StreamDataHandler + ): child_process.ChildProcess; + + + // option shorthands + shell(shell: string): Rsync; + delete(): Rsync; + progress(): Rsync; + archive(): Rsync; + compress(): Rsync; + recursive(): Rsync; + update(): Rsync; + quiet(): Rsync; + dirs(): Rsync; + links(): Rsync; + dry(): Rsync; + // source(): Rsync; + + // accessor methods + executable(): string; + executable(e: string): Rsync; + + executableShell(): string; + executableShell(e: string): Rsync; + + destination(): string; + destination(d: string): Rsync; + + source(): string[]; + source(s: string): Rsync; + source(s: string[]): Rsync; + + // pattern accessors + patterns(patterns: (string|Pattern)[]): Rsync; + + exclude(p: string): Rsync; + exclude(p: string[]): Rsync; + + include(p: string): Rsync; + include(p: string[]): Rsync; + } + + interface RsyncStatic { + new(): Rsync; + } + + const e: RsyncStatic; + export = e; +} From c491f170acf84de20b47f018c5cbfad82537c557 Mon Sep 17 00:00:00 2001 From: Philipp Stucki Date: Tue, 12 Jan 2016 11:13:53 +0100 Subject: [PATCH 339/441] removes obsolete source() definition --- rsync/rsync.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/rsync/rsync.d.ts b/rsync/rsync.d.ts index 137e9c1d1b..bcbf0d0b46 100644 --- a/rsync/rsync.d.ts +++ b/rsync/rsync.d.ts @@ -62,7 +62,6 @@ declare module 'rsync' { dirs(): Rsync; links(): Rsync; dry(): Rsync; - // source(): Rsync; // accessor methods executable(): string; From 60ec68376b3c66dca9b47073d8703fa4f2ebca38 Mon Sep 17 00:00:00 2001 From: Philipp Stucki Date: Tue, 12 Jan 2016 14:10:24 +0100 Subject: [PATCH 340/441] small linting fixes --- rsync/rsync.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rsync/rsync.d.ts b/rsync/rsync.d.ts index bcbf0d0b46..9c828e6fbc 100644 --- a/rsync/rsync.d.ts +++ b/rsync/rsync.d.ts @@ -30,7 +30,7 @@ declare module 'rsync' { flags(flags: string, set?: boolean): Rsync; flags(flags: Flag): Rsync; flags(flags: string[], set?: boolean): Rsync; - flags(...flags: any[]): Rsync + flags(...flags: any[]): Rsync; isSet(option: string): boolean; @@ -40,7 +40,7 @@ declare module 'rsync' { command(): string; - output(stdout: StreamDataHandler, stderr: StreamDataHandler):Rsync; + output(stdout: StreamDataHandler, stderr: StreamDataHandler): Rsync; execute(callback: (err: Error, code: number, cmd: string) => void): child_process.ChildProcess; execute( From 4cdea2aaeb4a26873828d463c97dc36fad8d85d6 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Tue, 12 Jan 2016 15:37:58 +0200 Subject: [PATCH 341/441] Updated to version 2.11.1. Added now function in MomentStatic. Added isSameOrBefore and creationData in Moment. --- moment/moment-node.d.ts | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 3471a8fc30..99c32854af 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Moment.js 2.10.5 +// Type definitions for Moment.js 2.11.1 // Project: https://github.com/timrwood/moment -// Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya , Matt Brooks +// Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya , Matt Brooks , Gal Talmor // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module moment { @@ -115,6 +115,18 @@ declare module moment { toJSON(): string; } + interface MomentLocale { + ordinal(n: number): string; + } + + interface MomentCreationData { + input?: string, + format?: string, + locale: MomentLocale, + isUTC: boolean, + strict?: boolean + } + interface Moment { format(format: string): string; format(): string; @@ -292,6 +304,9 @@ declare module moment { isSame(b: Moment | string | number | Date | number[], granularity?: string): boolean; isBetween(a: Moment | string | number | Date | number[], b: Moment | string | number | Date | number[], granularity?: string): boolean; + // Since version 2.10.7+ + isSameOrBefore(b: Moment | string | number | Date | number[], granularity?: string); + // Deprecated as of 2.8.0. lang(language: string): Moment; lang(reset: boolean): Moment; @@ -317,9 +332,12 @@ declare module moment { set(unit: string, value: number): Moment; set(objectLiteral: MomentInput): Moment; - /*This returns an object containing year, month, day-of-month, hour, minute, seconds, milliseconds.*/ - //Works with version 2.10.5+ + /* This returns an object containing year, month, day-of-month, hour, minute, seconds, milliseconds. */ + // Works with version 2.10.5+ toObject(): MomentDateObject; + + // Since version 2.10.7+ + creationData(): MomentCreationData; } type formatFunction = () => string; @@ -479,6 +497,9 @@ declare module moment { relativeTimeThreshold(threshold: string): number | boolean; relativeTimeThreshold(threshold: string, limit: number): boolean; + // Since version 2.10.7+ + now(): number; + /** * Constant used to enable explicit ISO_8601 format parsing. */ From a4931e69071bce862ddeefebd9999f29df7a699c Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Tue, 12 Jan 2016 23:10:54 +0900 Subject: [PATCH 342/441] Update del.d.ts 1.2.0 -> 2.2.0 --- del/del-tests.ts | 2 ++ del/del.d.ts | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/del/del-tests.ts b/del/del-tests.ts index 867781d63d..d3c45c9659 100644 --- a/del/del-tests.ts +++ b/del/del-tests.ts @@ -35,3 +35,5 @@ paths = del.sync(["tmp/*.js", "!tmp/unicorn.js"], {force: true}); paths = del.sync("tmp/*.js"); paths = del.sync("tmp/*.js", {force: true}); + +paths = del.sync("tmp/*.js", {dryRun: true}); diff --git a/del/del.d.ts b/del/del.d.ts index 060861d8a1..88316f4f29 100644 --- a/del/del.d.ts +++ b/del/del.d.ts @@ -1,6 +1,6 @@ -// Type definitions for del v1.2.0 +// Type definitions for del v2.2.0 // Project: https://github.com/sindresorhus/del -// Definitions by: Asana +// Definitions by: Asana , Aya Morisawa // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -20,7 +20,8 @@ declare module "del" { function sync(patterns: string[], options?: Options): string[]; interface Options extends glob.IOptions { - force?: boolean + force?: boolean; + dryRun?: boolean; } } From ba4191f9dded38121c981d7989928da435a29aa6 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Tue, 12 Jan 2016 16:17:07 +0200 Subject: [PATCH 343/441] Updated to version 2.11.1. Added now function in MomentStatic. Added isSameOrBefore and creationData in Moment. --- moment/moment-node.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 99c32854af..89178262f9 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -305,7 +305,7 @@ declare module moment { isBetween(a: Moment | string | number | Date | number[], b: Moment | string | number | Date | number[], granularity?: string): boolean; // Since version 2.10.7+ - isSameOrBefore(b: Moment | string | number | Date | number[], granularity?: string); + isSameOrBefore(b: Moment | string | number | Date | number[], granularity?: string): boolean; // Deprecated as of 2.8.0. lang(language: string): Moment; From 4f99c3c7e56b93e8b859fdaa008319224f887b6e Mon Sep 17 00:00:00 2001 From: guischdi Date: Tue, 12 Jan 2016 15:18:58 +0100 Subject: [PATCH 344/441] update shel.task() signature add done function to method signature of shell.task() --- gulp-shell/gulp-shell.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulp-shell/gulp-shell.d.ts b/gulp-shell/gulp-shell.d.ts index d88f27ed6a..4d18d610c8 100644 --- a/gulp-shell/gulp-shell.d.ts +++ b/gulp-shell/gulp-shell.d.ts @@ -10,7 +10,7 @@ declare module "gulp-shell" { namespace shell { interface Shell { (commands: string|string[], options?: Option): NodeJS.ReadWriteStream; - task(commands: string|string[], options?: Option): () => NodeJS.ReadWriteStream; + task(commands: string|string[], options?: Option): (done: Function) => NodeJS.ReadWriteStream; } interface Option { From a29b4dbbd98e2ff2c31588cfe573d1417bc2b33d Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Wed, 13 Jan 2016 00:17:02 +0900 Subject: [PATCH 345/441] Fix #7131 --- fs-extra/fs-extra.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs-extra/fs-extra.d.ts b/fs-extra/fs-extra.d.ts index d997d12a89..e4f800185f 100644 --- a/fs-extra/fs-extra.d.ts +++ b/fs-extra/fs-extra.d.ts @@ -70,8 +70,8 @@ declare module "fs-extra" { export function readJSON(file: string, callback?: (err: Error) => void): void; export function readJSON(file: string, options?: OpenOptions, callback?: (err: Error) => void): void; - export function readJsonSync(file: string, options?: OpenOptions): void; - export function readJSONSync(file: string, options?: OpenOptions): void; + export function readJsonSync(file: string, options?: OpenOptions): any; + export function readJSONSync(file: string, options?: OpenOptions): any; export function remove(dir: string, callback?: (err: Error) => void): void; export function removeSync(dir: string): void; From fc129dfe1ac8805399121feb406de91c9572b3f8 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Tue, 12 Jan 2016 17:51:02 +0200 Subject: [PATCH 346/441] Updated to version 2.11.1. Added now function in MomentStatic. Added isSameOrBefore and creationData in Moment. --- moment/moment-node.d.ts | 51 ++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 89178262f9..6102d1e132 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -5,6 +5,8 @@ declare module moment { + type MomentComparable = Moment | string | number | Date | number[]; + interface MomentDateObject { years?: number; /* One digit */ @@ -271,8 +273,8 @@ declare module moment { dayOfYear(): number; dayOfYear(d: number): Moment; - from(f: Moment | string | number | Date | number[], suffix?: boolean): string; - to(f: Moment | string | number | Date | number[], suffix?: boolean): string; + from(f: MomentComparable, suffix?: boolean): string; + to(f: MomentComparable, suffix?: boolean): string; toNow(withoutPrefix?: boolean): string; diff(b: Moment): number; @@ -296,18 +298,22 @@ declare module moment { isDST(): boolean; isBefore(): boolean; - isBefore(b: Moment | string | number | Date | number[], granularity?: string): boolean; + isBefore(b: MomentComparable, granularity?: string): boolean; isAfter(): boolean; - isAfter(b: Moment | string | number | Date | number[], granularity?: string): boolean; + isAfter(b: MomentComparable, granularity?: string): boolean; - isSame(b: Moment | string | number | Date | number[], granularity?: string): boolean; - isBetween(a: Moment | string | number | Date | number[], b: Moment | string | number | Date | number[], granularity?: string): boolean; + isSame(b: MomentComparable, granularity?: string): boolean; + isBetween(a: MomentComparable, b: MomentComparable, granularity?: string): boolean; - // Since version 2.10.7+ - isSameOrBefore(b: Moment | string | number | Date | number[], granularity?: string): boolean; + /** + * @since 2.10.7+ + */ + isSameOrBefore(b: MomentComparable, granularity?: string): boolean; - // Deprecated as of 2.8.0. + /** + * @deprecated since version 2.8.0 + */ lang(language: string): Moment; lang(reset: boolean): Moment; lang(): MomentLanguage; @@ -320,11 +326,15 @@ declare module moment { localeData(reset: boolean): Moment; localeData(): MomentLanguage; - // Deprecated as of 2.7.0. + /** + * @deprecated since version 2.7.0 + */ max(date: Moment | string | number | Date | any[]): Moment; max(date: string, format: string): Moment; - // Deprecated as of 2.7.0. + /** + * @deprecated since version 2.7.0 + */ min(date: Moment | string | number | Date | any[]): Moment; min(date: string, format: string): Moment; @@ -332,11 +342,16 @@ declare module moment { set(unit: string, value: number): Moment; set(objectLiteral: MomentInput): Moment; - /* This returns an object containing year, month, day-of-month, hour, minute, seconds, milliseconds. */ - // Works with version 2.10.5+ + /** + * This returns an object containing year, month, day-of-month, hour, minute, seconds, milliseconds. + * @since 2.10.5+ + */ toObject(): MomentDateObject; - // Since version 2.10.7+ + /** + * @since 2.10.7+ + */ + creationData(): MomentCreationData; } @@ -444,7 +459,9 @@ declare module moment { isDuration(): boolean; isDuration(d: any): boolean; - // Deprecated in 2.8.0. + /** + * @deprecated since version 2.8.0 + */ lang(language?: string): string; lang(language?: string, definition?: MomentLanguage): string; @@ -497,7 +514,9 @@ declare module moment { relativeTimeThreshold(threshold: string): number | boolean; relativeTimeThreshold(threshold: string, limit: number): boolean; - // Since version 2.10.7+ + /** + * @since 2.10.7+ + */ now(): number; /** From 8aacd9222c7e36171adb3dfbd6178a90965d91d8 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Tue, 12 Jan 2016 18:02:48 +0200 Subject: [PATCH 347/441] Updated to version 2.11.1. Added now function in MomentStatic. Added isSameOrBefore and creationData in Moment. --- moment/moment-node.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 6102d1e132..a11fad1dc6 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -351,7 +351,6 @@ declare module moment { /** * @since 2.10.7+ */ - creationData(): MomentCreationData; } From 97ec10cb6c917dce7668f3833679506162c0f5c4 Mon Sep 17 00:00:00 2001 From: John Hasselkus Date: Tue, 12 Jan 2016 10:14:33 -0600 Subject: [PATCH 348/441] mongoose.d.ts Document interface should define _id as any In the Document interface definition of mongoose.d.ts, the _id field definition of _id: Types.ObjectId was wrong, as it can be any type. This commit changes the definition to _id: any to allow interfaces that extend Document to refine the definition of _id as appropriate to match the schema of the model/collection. --- mongoose/mongoose-tests.ts | 10 ++++++++++ mongoose/mongoose.d.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mongoose/mongoose-tests.ts b/mongoose/mongoose-tests.ts index 3cb9c3575b..806272f45c 100644 --- a/mongoose/mongoose-tests.ts +++ b/mongoose/mongoose-tests.ts @@ -41,6 +41,16 @@ var schema: mongoose.Schema = new Schema({ name: String }, { collection: 'actor' schema.set('collection', 'actor'); var Model = mongoose.model('Actor', schema, 'actor'); +interface IZip extends mongoose.Document { + _id: string; +} +interface IPerson extends mongoose.Document { + _id: mongoose.Types.ObjectId; +} +interface IThing extends mongoose.Document { + _id: number; +} + var names: string[] = mongoose.modelNames(); var names: string[] = db.modelNames(); mongoose.plugin((schema: mongoose.Schema) => { diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index b971622675..6871dc3448 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -423,7 +423,7 @@ declare module "mongoose" { export interface Document { id?: string; - _id: Types.ObjectId; + _id: any; equals(doc: Document): boolean; get(path: string, type?: new(...args: any[]) => any): any; From 022f77341ec34dd5d5144edecf729573614431d1 Mon Sep 17 00:00:00 2001 From: Nimish Telang Date: Tue, 12 Jan 2016 16:27:04 +0000 Subject: [PATCH 349/441] Update helmet CSP typings --- helmet/helmet-tests.ts | 36 +++++++++++++++++++++++++++++++++++- helmet/helmet.d.ts | 32 +++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/helmet/helmet-tests.ts b/helmet/helmet-tests.ts index d2509a0224..83fd224a71 100644 --- a/helmet/helmet-tests.ts +++ b/helmet/helmet-tests.ts @@ -15,11 +15,45 @@ function helmetTest() { /** * @summary Test for {@see helmet#xssFilter} function. */ -function contentSecurityPolicyTest() { +function xssFilterTest() { app.use(helmet.xssFilter()); app.use(helmet.xssFilter({ setOnOldIE: true })); } +/** + * @summary Test for {@see helmet#csp} function + */ + +function contentSecurityPolicyTest() { + + // taken directly from helmet-csp docs + const config = { + // Specify directives as normal. + directives: { + defaultSrc: ["'self'", 'default.com'], + scriptSrc: ["'self'", "'unsafe-inline'"], + styleSrc: ['style.com'], + imgSrc: ['img.com', 'data:'], + sandbox: ['allow-forms', 'allow-scripts'], + reportUri: '/report-violation', + + objectSrc: ["'self'"], // An empty array allows nothing through + }, + + // Set to true if you only want browsers to report errors, not block them + reportOnly: false, + + // Set to true if you want to blindly set all headers: Content-Security-Policy, + // X-WebKit-CSP, and X-Content-Security-Policy. + setAllHeaders: false, + + // Set to true if you want to disable CSP on Android where it can be buggy. + disableAndroid: false + } + app.use(helmet.csp()); + app.use(helmet.contentSecurityPolicy(config)); +} + /** * @summary Test for {@see helmet#frameguard} function. */ diff --git a/helmet/helmet.d.ts b/helmet/helmet.d.ts index 35d9bf3aef..4d07730dbd 100644 --- a/helmet/helmet.d.ts +++ b/helmet/helmet.d.ts @@ -7,7 +7,24 @@ declare module "helmet" { import express = require("express"); - + + interface IHelmetCspDirectives { + defaultSrc? : string[]; + scriptSrc? : string[]; + styleSrc? : string[]; + imgSrc? : string[]; + sandbox? : string[]; + reportUri? : string; + objectSrc? : string[]; + } + + interface IHelmetCspConfiguration { + reportOnly? : boolean; + setAllHeaders? : boolean; + disableAndroid? : boolean; + directives? : IHelmetCspDirectives + } + /** * @summary Interface for helmet class. * @interface @@ -70,6 +87,19 @@ declare module "helmet" { * @param {Object} options The options. */ xssFilter(options ?: Object):express.RequestHandler; + + /** + * @summary Set policy around third-party content via headers + * @return {RequestHandler} The Request handler + * @param {Object} options The options + */ + csp(options ?: IHelmetCspConfiguration): express.RequestHandler; + + /** + * @see csp + */ + contentSecurityPolicy(options ?: IHelmetCspConfiguration): express.RequestHandler; + } var helmet: Helmet; From a94a38a68f9d670b46ba23f9c5af67018fedd7d8 Mon Sep 17 00:00:00 2001 From: igochkov Date: Tue, 12 Jan 2016 23:38:11 +0100 Subject: [PATCH 350/441] Typeahead constructor and events signitures changed to reflect latest 0.11.1 typeahead documentation --- typeahead/typeahead.d.ts | 842 ++++++++++++++++++++++++++++++++------- 1 file changed, 700 insertions(+), 142 deletions(-) diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index 8164d430e1..aa1db2b444 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -6,148 +6,706 @@ /// interface JQuery { - - /** - * Destroys previously initialized typeaheads. This entails reverting - * DOM modifications and removing event handlers. - * - * @constructor - * @param methodName Method 'destroy' - */ - typeahead(methodName: 'destroy'): 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; - - /** - * 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 '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; - - /** - * 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 Array of datasets - */ - 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; - - on(events: "typeahead:active", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:active", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:active", handler: (ev: JQueryEventObject) => any): JQuery; - off(events: "typeahead:active", handler: (ev: JQueryEventObject) => any): JQuery; - - on(events: "typeahead:idle", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:idle", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:idle", handler: (ev: JQueryEventObject) => any): JQuery; - off(events: "typeahead:idle", handler: (ev: JQueryEventObject) => any): JQuery; - - on(events: "typeahead:open", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:open", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:open", handler: (ev: JQueryEventObject) => any): JQuery; - off(events: "typeahead:open", handler: (ev: JQueryEventObject) => any): JQuery; - - on(events: "typeahead:close", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:close", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:close", handler: (ev: JQueryEventObject) => any): JQuery; - off(events: "typeahead:close", handler: (ev: JQueryEventObject) => any): JQuery; - - on(events: "typeahead:change", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:change", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:change", handler: (ev: JQueryEventObject) => any): JQuery; - off(events: "typeahead:change", handler: (ev: JQueryEventObject) => any): JQuery; - - on(events: "typeahead:render", selector: string, data: any, handler: (ev: JQueryEventObject, suggestions: Array, async: boolean, datasetName: string) => any): JQuery; - on(events: "typeahead:render", selector: string, handler: (ev: JQueryEventObject, suggestions: Array, async: boolean, datasetName: string) => any): JQuery; - on(events: "typeahead:render", handler: (ev: JQueryEventObject, suggestions: Array, async: boolean, datasetName: string) => any): JQuery; - off(events: "typeahead:render", handler: (ev: JQueryEventObject, suggestions: Array, async: boolean, datasetName: string) => any): JQuery; - - on(events: "typeahead:select", selector: string, data: any, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - on(events: "typeahead:select", selector: string, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - on(events: "typeahead:select", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - off(events: "typeahead:select", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - - on(events: "typeahead:autocomplete", selector: string, data: any, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - on(events: "typeahead:autocomplete", selector: string, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - on(events: "typeahead:autocomplete", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - off(events: "typeahead:autocomplete", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - - on(events: "typeahead:cursorchange", selector: string, data: any, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - on(events: "typeahead:cursorchange", selector: string, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - on(events: "typeahead:cursorchange", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - off(events: "typeahead:cursorchange", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - - on(events: "typeahead:asyncrequest", selector: string, data: any, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - on(events: "typeahead:asyncrequest", selector: string, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - on(events: "typeahead:asyncrequest", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - off(events: "typeahead:asyncrequest", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - - on(events: "typeahead:asynccancel", selector: string, data: any, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - on(events: "typeahead:asynccancel", selector: string, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - on(events: "typeahead:asynccancel", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - off(events: "typeahead:asynccancel", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - - on(events: "typeahead:asyncreceive", selector: string, data: any, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - on(events: "typeahead:asyncreceive", selector: string, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - on(events: "typeahead:asyncreceive", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - off(events: "typeahead:asyncreceive", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; + /** + * For a given input[type="text"], enables typeahead functionality. + * + * @constructor + * @param options Options hash that's used for configuration + * @param datasets Array of datasets + */ + typeahead(options: Twitter.Typeahead.Options, datasets: Twitter.Typeahead.Dataset[]): JQuery; + + /** + * For a given input[type="text"], enables typeahead functionality. + * + * @constructor + * @param options Options hash that's used for configuration + * @param datasets One or more datasets passed as rest parameters. + */ + typeahead(options: Twitter.Typeahead.Options, ...datasets: Twitter.Typeahead.Dataset[]): 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; + + /** + * Accommodates the val overload. + * + * @constructor + * @param methodName Method 'val' + */ + typeahead(methodName: string): string; + + /** + * Sets the value of the typeahead. This should be used in place of jQuery#val. + * + * @constructor + * @param methodName Method 'val' + * @param val The value to be set + */ + typeahead(methodName: 'val', val: string): JQuery; + + /** + * Accommodates the set val overload. + * + * @constructor + * @param methodName Method 'val' + * @param val The value to be set + */ + typeahead(methodName: string, val: string): JQuery; + + /** + * Opens the suggestion menu. + * + * @constructor + * @param methodName Method 'open' + */ + typeahead(methodName: 'open'): JQuery; + + /** + * Closes the suggestion menu. + * + * @constructor + * @param methodName Method 'close' + */ + typeahead(methodName: 'close'): JQuery; + + /** + * Removes typeahead functionality and reverts the input element back to its original state. + * + * @constructor + * @param methodName Method 'destroy' + */ + typeahead(methodName: 'destroy'): JQuery; + + /** + * Attach an event handler function for typeahead:active event to the selected elements. + * + * @param events typeahead:active event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:active", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:active event to the selected elements. + * + * @param events typeahead:active event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:active", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:active event to the selected elements. + * + * @param events typeahead:active event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:active", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:active event to the selected elements. + * + * @param events typeahead:active event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:active", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:idle event to the selected elements. + * + * @param events typeahead:idle event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:idle", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:idle event to the selected elements. + * + * @param events typeahead:idle event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:idle", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:idle event to the selected elements. + * + * @param events typeahead:idle event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:idle", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:idle event to the selected elements. + * + * @param events typeahead:idle event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:idle", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:open event to the selected elements. + * + * @param events typeahead:open event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:open", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:open event to the selected elements. + * + * @param events typeahead:open event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:open", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:open event to the selected elements. + * + * @param events typeahead:open event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:open", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:open event to the selected elements. + * + * @param events typeahead:open event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:open", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:close event to the selected elements. + * + * @param events typeahead:close event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:close", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:close event to the selected elements. + * + * @param events typeahead:close event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:close", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:close event to the selected elements. + * + * @param events typeahead:close event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:close", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:close event to the selected elements. + * + * @param events typeahead:close event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:close", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:change event to the selected elements. + * + * @param events typeahead:change event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:change", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:change event to the selected elements. + * + * @param events typeahead:change event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:change", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:change event to the selected elements. + * + * @param events typeahead:change event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:change", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:change event to the selected elements. + * + * @param events typeahead:change event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:change", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:render event to the selected elements. + * + * @param events typeahead:render event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:render", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:render event to the selected elements. + * + * @param events typeahead:render event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:render", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:render event to the selected elements. + * + * @param events typeahead:render event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:render", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:render event to the selected elements. + * + * @param events typeahead:render event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:render", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:select event to the selected elements. + * + * @param events typeahead:select event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:select", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:select event to the selected elements. + * + * @param events typeahead:select event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:select", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:select event to the selected elements. + * + * @param events typeahead:select event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:select", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:select event to the selected elements. + * + * @param events typeahead:select event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:select", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:autocomplete event to the selected elements. + * + * @param events typeahead:autocomplete event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:autocomplete", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:autocomplete event to the selected elements. + * + * @param events typeahead:autocomplete event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:autocomplete", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:autocomplete event to the selected elements. + * + * @param events typeahead:autocomplete event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:autocomplete", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:autocomplete event to the selected elements. + * + * @param events typeahead:autocomplete event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:autocomplete", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:cursorchange event to the selected elements. + * + * @param events typeahead:cursorchange event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:cursorchange", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:cursorchange event to the selected elements. + * + * @param events typeahead:cursorchange event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:cursorchange", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:cursorchange event to the selected elements. + * + * @param events typeahead:cursorchange event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:cursorchange", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:cursorchange event to the selected elements. + * + * @param events typeahead:cursorchange event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:cursorchange", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncrequest event to the selected elements. + * + * @param events typeahead:asyncrequest event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:asyncrequest", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncrequest event to the selected elements. + * + * @param events typeahead:asyncrequest event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asyncrequest", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncrequest event to the selected elements. + * + * @param events typeahead:asyncrequest event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asyncrequest", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncrequest event to the selected elements. + * + * @param events typeahead:asyncrequest event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asyncrequest", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asynccancel event to the selected elements. + * + * @param events typeahead:asynccancel event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:asynccancel", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asynccancel event to the selected elements. + * + * @param events typeahead:asynccancel event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asynccancel", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asynccancel event to the selected elements. + * + * @param events typeahead:asynccancel event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asynccancel", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asynccancel event to the selected elements. + * + * @param events typeahead:asynccancel event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asynccancel", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncreceive event to the selected elements. + * + * @param events typeahead:asyncreceive event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:asyncreceive", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncreceive event to the selected elements. + * + * @param events typeahead:asyncreceive event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asyncreceive", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncreceive event to the selected elements. + * + * @param events typeahead:asyncreceive event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asyncreceive", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncreceive event to the selected elements. + * + * @param events typeahead:asyncreceive event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asyncreceive", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:active event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:active", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:active event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:active", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:idle event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:idle", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:idle event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:idle", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:open event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:open", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:open event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:open", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:close event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:close", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:close event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:close", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:change event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:change", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:change event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:change", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:render event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:render", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:render event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:render", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:select event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:select", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:select event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:select", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:autocomplete event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:autocomplete", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:autocomplete event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:autocomplete", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:cursorchange event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:cursorchange", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:cursorchange event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:cursorchange", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:asyncrequest event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:asyncrequest", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:asyncrequest event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:asyncrequest", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:asynccancel event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:asynccancel", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:asynccancel event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:asynccancel", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:asyncreceive event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:asyncreceive", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:asyncreceive event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:asyncreceive", handler: (eventObject: JQueryEventObject) => any): JQuery; } declare module Twitter.Typeahead { From f7bbba882dd6220f130e0befa674bc343d29ff69 Mon Sep 17 00:00:00 2001 From: vangorra Date: Tue, 12 Jan 2016 18:19:50 -0800 Subject: [PATCH 351/441] Adding subscribe method to meteor angular IScope. --- angular-meteor/angular-meteor.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/angular-meteor/angular-meteor.d.ts b/angular-meteor/angular-meteor.d.ts index 6df5bc63d2..e536e32030 100644 --- a/angular-meteor/angular-meteor.d.ts +++ b/angular-meteor/angular-meteor.d.ts @@ -51,6 +51,16 @@ declare module angular.meteor { * @return This method returns this, which the the reactive context, in order to provide the ability to chain the logic. */ helpers(definitions : { [helperName : string] : () => Mongo.Cursor }): IScope; + + /** + * This method is a wrapper of Tracker.autorun and shares exactly the same API. + * The autorun method is part of the ReactiveContext, and available on every context and $scope. + * The argument of this method is a callback, which will be called each time Autorun will be used. + * The Autorun will stop automatically when when it's context ($scope) is destroyed. + * + * @param runFunc - The function to run. It receives one argument: the Computation object that will be returned. + */ + autorun(runFunc : () => void) : Tracker.Computation; } /** From 1735153b55c4616192219e7edaecdef3971bd5b3 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 13 Jan 2016 04:20:47 +0100 Subject: [PATCH 352/441] Add definitions for gulp-filter (https://github.com/sindresorhus/gulp-filter) --- gulp-filter/gulp-filter-tests.ts | 71 ++++++++++++++++++++++++++++++++ gulp-filter/gulp-filter.d.ts | 33 +++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 gulp-filter/gulp-filter-tests.ts create mode 100644 gulp-filter/gulp-filter.d.ts diff --git a/gulp-filter/gulp-filter-tests.ts b/gulp-filter/gulp-filter-tests.ts new file mode 100644 index 0000000000..a542ef5485 --- /dev/null +++ b/gulp-filter/gulp-filter-tests.ts @@ -0,0 +1,71 @@ +/// +/// +/// +/// +/// + +import * as gulp from 'gulp'; +import * as uglify from 'gulp-uglify'; +import * as less from 'gulp-less'; +import * as concat from 'gulp-concat'; +import * as filter from 'gulp-filter'; + +// Filter only +gulp.task('default', () => { + // create filter instance inside task function + const f = filter(['*', '!src/vendor']); + + return gulp.src('src/*.js') + // filter a subset of the files + .pipe(f) + // run them through a plugin + .pipe(uglify()) + .pipe(gulp.dest('dist')); +}); + +// Restoring filtered files +gulp.task('default', () => { + // create filter instance inside task function + const f = filter(['*', '!src/vendor'], {restore: true}); + + return gulp.src('src/*.js') + // filter a subset of the files + .pipe(f) + // run them through a plugin + .pipe(uglify()) + // bring back the previously filtered out files (optional) + .pipe(f.restore) + .pipe(gulp.dest('dist')); +}); + +// Multiple filters +gulp.task('default', () => { + const jsFilter = filter('**/*.js', {restore: true}); + const lessFilter = filter('**/*.less', {restore: true}); + + return gulp.src('assets/**') + .pipe(jsFilter) + .pipe(concat('bundle.js')) + .pipe(jsFilter.restore) + .pipe(lessFilter) + .pipe(less()) + .pipe(lessFilter.restore) + .pipe(gulp.dest('out/')); +}); + +// Restore as a file source +gulp.task('default', () => { + const f = filter(['*', '!src/vendor'], {restore: true, passthrough: false}); + + const stream = gulp.src('src/*.js') + // filter a subset of the files + .pipe(f) + // run them through a plugin + .pipe(uglify()) + .pipe(gulp.dest('dist')); + + // use filtered files as a gulp file source + f.restore.pipe(gulp.dest('vendor-dist')); + + return stream; +}); diff --git a/gulp-filter/gulp-filter.d.ts b/gulp-filter/gulp-filter.d.ts new file mode 100644 index 0000000000..2e37f3bcb0 --- /dev/null +++ b/gulp-filter/gulp-filter.d.ts @@ -0,0 +1,33 @@ +// Type definitions for gulp-filter v3.0.1 +// Project: https://github.com/sindresorhus/gulp-filter +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// +/// + +declare module 'gulp-filter' { + import File = require('vinyl'); + import * as Minimatch from 'minimatch'; + + namespace filter { + interface FileFunction { + (file: File): boolean; + } + + interface Options extends Minimatch.IOptions { + restore?: boolean; + passthrough?: boolean; + } + + // A transform stream with a .restore object + interface Filter extends NodeJS.ReadWriteStream { + restore: NodeJS.ReadWriteStream + } + } + + function filter(pattern: string | string[] | filter.FileFunction, options?: filter.Options): filter.Filter; + + export = filter; +} From 15b9154db282c7d10236a18a978d3d21f5a6d575 Mon Sep 17 00:00:00 2001 From: Norgerman Date: Wed, 13 Jan 2016 13:59:22 +0800 Subject: [PATCH 353/441] change ResultSet.rows from Object[] to any[] --- any-db/any-db.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/any-db/any-db.d.ts b/any-db/any-db.d.ts index 04817623a0..f14befb204 100644 --- a/any-db/any-db.d.ts +++ b/any-db/any-db.d.ts @@ -50,7 +50,7 @@ declare module "any-db" { /** * Result rows */ - rows: Object[]; + rows: any[]; /** * Result field descriptions */ From cf21ce49f0c2aad22adf98ec961f1fb46918b65a Mon Sep 17 00:00:00 2001 From: Sam Verschueren Date: Wed, 13 Jan 2016 08:42:58 +0100 Subject: [PATCH 354/441] add camelcase --- camelcase/camelcase-tests.ts | 12 ++++++++++++ camelcase/camelcase.d.ts | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100644 camelcase/camelcase-tests.ts create mode 100644 camelcase/camelcase.d.ts diff --git a/camelcase/camelcase-tests.ts b/camelcase/camelcase-tests.ts new file mode 100644 index 0000000000..bb2ce92827 --- /dev/null +++ b/camelcase/camelcase-tests.ts @@ -0,0 +1,12 @@ +/// + +import camelCase from 'camelcase'; + +camelCase('foo-bar'); +camelCase('foo_bar'); +camelCase('Foo-Bar'); +camelCase('--foo.bar'); +camelCase('__foo__bar__'); +camelCase('foo bar'); +camelCase('foo', 'bar'); +camelCase('__foo__', '--bar'); diff --git a/camelcase/camelcase.d.ts b/camelcase/camelcase.d.ts new file mode 100644 index 0000000000..c13eab8a5a --- /dev/null +++ b/camelcase/camelcase.d.ts @@ -0,0 +1,8 @@ +// Type definitions for camelcase +// Project: https://github.com/sindresorhus/camelcase +// Definitions by: Sam Verschueren +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "camelcase" { + export default function camelcase(...args: string[]): string; +} From 8b515b23637d52a56741bca9a6e67d42ff0422df Mon Sep 17 00:00:00 2001 From: Sam Verschueren Date: Wed, 13 Jan 2016 08:48:52 +0100 Subject: [PATCH 355/441] add dot-prop --- dot-prop/dot-prop-tests.ts | 12 ++++++++++++ dot-prop/dot-prop.d.ts | 9 +++++++++ 2 files changed, 21 insertions(+) create mode 100644 dot-prop/dot-prop-tests.ts create mode 100644 dot-prop/dot-prop.d.ts diff --git a/dot-prop/dot-prop-tests.ts b/dot-prop/dot-prop-tests.ts new file mode 100644 index 0000000000..605a72de35 --- /dev/null +++ b/dot-prop/dot-prop-tests.ts @@ -0,0 +1,12 @@ +/// + +import * as dotProp from 'dot-prop'; + +dotProp.get({foo: {bar: 'unicorn'}}, 'foo.bar'); +dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep'); +dotProp.get({foo: {'dot.dot': 'unicorn'}}, 'foo.dot\\.dot'); + +const obj = {foo: {bar: 'a'}}; +dotProp.set(obj, 'foo.bar', 'b'); +dotProp.set(obj, 'foo.baz', 'x'); +dotProp.set(obj, 'foo.dot\\.dot', 'unicorn'); diff --git a/dot-prop/dot-prop.d.ts b/dot-prop/dot-prop.d.ts new file mode 100644 index 0000000000..c2f52c1627 --- /dev/null +++ b/dot-prop/dot-prop.d.ts @@ -0,0 +1,9 @@ +// Type definitions for dot-prop +// Project: https://github.com/sindresorhus/dot-prop +// Definitions by: Sam Verschueren +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "dot-prop" { + export function get(object: any, path: string): any; + export function set(object: any, path: string, value: any): void; +} From 321e862d5a3618f2ce96de0b4cc4075f4e93fad9 Mon Sep 17 00:00:00 2001 From: Nimish Telang Date: Wed, 13 Jan 2016 14:48:03 +0000 Subject: [PATCH 356/441] Update convict definitions to add custom formats --- convict/convict-tests.ts | 43 +++++++++++++++++++++++++++++- convict/convict.d.ts | 57 ++++++++++++++++++++++++---------------- 2 files changed, 76 insertions(+), 24 deletions(-) diff --git a/convict/convict-tests.ts b/convict/convict-tests.ts index 6cde3b38c0..54a5701410 100644 --- a/convict/convict-tests.ts +++ b/convict/convict-tests.ts @@ -6,6 +6,39 @@ import validator = require('validator'); // define a schema +// straight from the convict tests +const format : convict.Format = { + name: 'float-percent', + validate: function(val) { + if (val !== 0 && (!val || val > 1 || val < 0)) { + throw new Error('must be a float between 0 and 1, inclusive'); + } + }, + coerce: function(val) { + return +( val); + } +}; + +convict.addFormat(format); +convict.addFormats({ + prime: { + validate: function(val) { + function isPrime(n: number) { + if (n <= 1) return false; // zero and one are not prime + for (var i=2; i*i <= n; i++) { + if (n % i === 0) return false; + } + return true; + } + if (!isPrime(val)) throw new Error('must be a prime number'); + }, + coerce: function(val) { + return parseInt(val, 10); + } + } + }); + + var conf = convict({ env: { doc: 'The applicaton environment.', @@ -46,7 +79,15 @@ var conf = convict({ env: 'PORT', arg: 'port', } - } + }, + primeNumber: { + format: 'prime', + default: 17 + }, + percentNumber: { + format: 'float-percent', + default: 0.5 + }, }); diff --git a/convict/convict.d.ts b/convict/convict.d.ts index 74ed100389..332441b207 100644 --- a/convict/convict.d.ts +++ b/convict/convict.d.ts @@ -4,30 +4,41 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module "convict" { - function convict(schema: convict.Schema): convict.Config; + module convict { - module convict { - interface Schema { - [name: string]: convict.Schema | { - default: any; - doc?: string; - format?: any; - env?: string; - arg?: string; - }; - } + interface Format { + name?: string; + validate?: (val: any) => void; + coerce?: (val: any) => any; + } - interface Config { - get(name: string): any; - default(name: string): any; - has(name: string): boolean; - set(name: string, value: any): void; - load(conf: Object): void; - loadFile(file: string): void; - loadFile(files: string[]): void; - validate(): void; - } - } + interface Schema { + [name: string]: convict.Schema | { + default: any; + doc?: string; + format?: any; + env?: string; + arg?: string; + }; + } - export = convict; + interface Config { + get(name: string): any; + default(name: string): any; + has(name: string): boolean; + set(name: string, value: any): void; + load(conf: Object): void; + loadFile(file: string): void; + loadFile(files: string[]): void; + validate(): void; + } + } + interface convict { + addFormat(format: convict.Format): void; + addFormats(formats: { [name: string]: convict.Format }): void; + (config: convict.Schema): convict.Config; + } + var convict : convict; + export = convict; } + From 981c9d1112a5151c714aeec84e20ce0a92083256 Mon Sep 17 00:00:00 2001 From: Nimish Telang Date: Wed, 13 Jan 2016 17:18:43 +0000 Subject: [PATCH 357/441] Add missing methods to config --- convict/convict-tests.ts | 9 +++++++++ convict/convict.d.ts | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/convict/convict-tests.ts b/convict/convict-tests.ts index 54a5701410..3bd64c5929 100644 --- a/convict/convict-tests.ts +++ b/convict/convict-tests.ts @@ -19,6 +19,9 @@ const format : convict.Format = { } }; + + + convict.addFormat(format); convict.addFormats({ prime: { @@ -113,4 +116,10 @@ if (conf.has('key')) { } }); } + +conf.getSchema(); +conf.getProperties(); +conf.getSchemaString(); +conf.toString(); + // vim:et:sw=2:ts=2 diff --git a/convict/convict.d.ts b/convict/convict.d.ts index 332441b207..51c1f6a689 100644 --- a/convict/convict.d.ts +++ b/convict/convict.d.ts @@ -31,6 +31,28 @@ declare module "convict" { loadFile(file: string): void; loadFile(files: string[]): void; validate(): void; + /** + * Exports all the properties (that is the keys and their current values) as a {JSON} {Object} + * @returns {Object} A {JSON} compliant {Object} + */ + getProperties() : Object; + /** + * Exports the schema as a {JSON} {Object} + * @returns {Object} A {JSON} compliant {Object} + */ + getSchema() : Object; + + /** + * Exports all the properties (that is the keys and their current values) as a JSON string. + * @returns {String} a string representing this object + */ + toString() : string; + + /** + * Exports the schema as a JSON string. + * @returns {String} a string representing the schema of this {Config} + */ + getSchemaString() : string; } } interface convict { From 592d0403d180fc0fe79352999da27e288fdefa9c Mon Sep 17 00:00:00 2001 From: Nimish Telang Date: Wed, 13 Jan 2016 17:59:59 +0000 Subject: [PATCH 358/441] Refine format type in schema --- convict/convict.d.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/convict/convict.d.ts b/convict/convict.d.ts index 51c1f6a689..87788e0963 100644 --- a/convict/convict.d.ts +++ b/convict/convict.d.ts @@ -16,7 +16,16 @@ declare module "convict" { [name: string]: convict.Schema | { default: any; doc?: string; - format?: any; + /** + * From the implementation: + * + * format can be a: + * - predefine type, as seen below + * - an array of enumerated values, e.g. ["production", "development", "testing"] + * - built-in JavaScript type, i.e. Object, Array, String, Number, Boolean + * - or if omitted, the Object.prototype.toString.call of the default value + */ + format?: string | Array | Function; env?: string; arg?: string; }; From 7581efb4ebce6d0d89569cfb2cfba20dfbadf7b1 Mon Sep 17 00:00:00 2001 From: Nimish Telang Date: Wed, 13 Jan 2016 18:00:50 +0000 Subject: [PATCH 359/441] Update docs --- convict/convict.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/convict/convict.d.ts b/convict/convict.d.ts index 87788e0963..14ecae8f8d 100644 --- a/convict/convict.d.ts +++ b/convict/convict.d.ts @@ -24,6 +24,8 @@ declare module "convict" { * - an array of enumerated values, e.g. ["production", "development", "testing"] * - built-in JavaScript type, i.e. Object, Array, String, Number, Boolean * - or if omitted, the Object.prototype.toString.call of the default value + * + * The docs also state that any function that validates is ok too */ format?: string | Array | Function; env?: string; From f2851bcb9503a7f1b0a5d1485eb364a21c9c3534 Mon Sep 17 00:00:00 2001 From: igochkov Date: Wed, 13 Jan 2016 21:47:56 +0100 Subject: [PATCH 360/441] Typeahead options extended with classNames to reflect latest 0.11.1 typeahead documentation --- typeahead/typeahead.d.ts | 88 ++++++++++++++++++++++++++++++++-------- 1 file changed, 71 insertions(+), 17 deletions(-) diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index aa1db2b444..13315b6aac 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -709,6 +709,34 @@ interface JQuery { } declare module Twitter.Typeahead { + /** + * When initializing a typeahead, there are a number of options you can configure. + */ + interface Options { + /** + * If true, when suggestions are rendered, pattern matches for the current query in text nodes will be wrapped in a strong element with its class set to {{classNames.highlight}}. + * Defaults to false. + */ + highlight?: boolean; + + /** + * If false, the typeahead will not show a hint. + * Defaults to true. + */ + hint?: boolean; + + /** + * The minimum character length needed before suggestions start getting rendered. + * Defaults to 1. + */ + minLength?: number; + + /** + * Used for overriding the default class names. + */ + classNames?: ClassNames; + } + /** * A dataset is an object that defines a set of data that hydrates * suggestions. Typeaheads can be backed by multiple datasets. @@ -743,7 +771,7 @@ declare module Twitter.Typeahead { /** * Can be used in place of display above. * - */ + */ displayKey?: string | ((obj: any) => string); /** @@ -801,27 +829,53 @@ declare module Twitter.Typeahead { } - /** - * When initializing a typeahead, there are a number of options you can configure. + * Used for overriding the default class names. */ - interface Options { + interface ClassNames { /** - * highlight: If true, when suggestions are rendered, - * pattern matches for the current query in text nodes will be wrapped in a strong element. - * Defaults to false. - */ - highlight?: boolean; - + * Added to input that's initialized into a typeahead. Defaults to tt-input. + */ + input?: string; + /** - * If false, the typeahead will not show a hint. Defaults to true. - */ - hint?: boolean; - + * Added to hint input.Defaults to tt- hint. + */ + hint?: string; + /** - * The minimum character length needed before suggestions start getting rendered. Defaults to 1. - */ - minLength?: number; + * Added to menu element.Defaults to tt- menu. + */ + menu?: string; + + /** + * Added to dataset elements.to Defaults to tt- dataset. + */ + dataset?: string; + /** + * Added to suggestion elements.Defaults to tt- suggestion. + */ + suggestion?: string; + + /** + * Added to menu element when it contains no content.Defaults to tt- empty. + */ + empty?: string; + + /** + * Added to menu element when it is opened.Defaults to tt- open. + */ + open?: string; + + /** + * Added to suggestion element when menu cursor moves to said suggestion.Defaults to tt- cursor. + */ + cursor?: string; + + /** + * Added to the element that wraps highlighted text.Defaults to tt- highlight. + */ + highlight?: string; } } From 9e53dceb17d7fb134e68b811ef1c96f7102c5406 Mon Sep 17 00:00:00 2001 From: igochkov Date: Wed, 13 Jan 2016 22:09:31 +0100 Subject: [PATCH 361/441] Typeahead dataset and templates changed to reflect latest 0.11.1 typeahead documentation --- typeahead/typeahead.d.ts | 167 ++++++++++++++++++++------------------- 1 file changed, 87 insertions(+), 80 deletions(-) diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index 13315b6aac..69da168ea8 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -709,9 +709,6 @@ interface JQuery { } declare module Twitter.Typeahead { - /** - * When initializing a typeahead, there are a number of options you can configure. - */ interface Options { /** * If true, when suggestions are rendered, pattern matches for the current query in text nodes will be wrapped in a strong element with its class set to {{classNames.highlight}}. @@ -737,96 +734,106 @@ declare module Twitter.Typeahead { classNames?: ClassNames; } - /** - * A dataset is an object that defines a set of data that hydrates - * suggestions. Typeaheads can be backed by multiple datasets. - * Given a query, a typeahead instance will inspect its backing - * datasets and display relevant suggestions to the end-user. - */ - interface Dataset { - /** - * 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, syncResults: (result: Array) => void, asyncResults?: (result: Array) => void) => void); - - /** - * 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. - */ - name?: string; - - /** - * 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. - */ - display?: string | ((obj: any) => string); - - /** - * Can be used in place of display above. - * - */ - displayKey?: string | ((obj: any) => string); - - /** - * 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; - async?: boolean; + /** + * A typeahead is composed of one or more datasets. When an end-user + * modifies the value of a typeahead, each dataset will attempt to render + * suggestions for the new value. + * For most use cases, one dataset should suffice. It's only in the scenario + * where you want rendered suggestions to be grouped based on some sort of + * categorical relationship that you'd need to use multiple datasets. For + * example, on twitter.com, the search typeahead groups results into recent + * searches, trends, and accounts that would be a great use case for using + * multiple datasets. + */ + interface Dataset { + /** + * The backing data source for suggestions. + * Expected to be a function with the signature (query, syncResults, asyncResults). + * syncResults should be called with suggestions computed synchronously and + * asyncResults should be called with suggestions computed asynchronously + * (e.g. suggestions that come for an AJAX request). + * source can also be a Bloodhound instance. + */ + source: Bloodhound | ((query: string, syncResults: (result: Array) => void, asyncResults?: (result: Array) => void) => void); + + /** + * Lets the dataset know if async suggestions should be expected. + * If not set, this information is inferred from the signature of + * source i.e. if the source function expects 3 arguments, async will + * be set to true. + */ + async?: boolean; + + /** + * The name of the dataset. + * This will be appended to {{classNames.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. + */ + name?: string; + + /** + * The max number of suggestions to be displayed. Defaults to 5. + */ + limit?: number; + + /** + * For a given suggestion, 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 stringifying the suggestion. + */ + display?: string | ((obj: T) => string); + + /** + * 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; } - - interface Templates { - /** - * 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?: any; - - /** - * 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?: any; - - /** - * 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?: 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. + */ + interface Templates { /** * 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. - */ - notFound?: (query: string) => string; - + */ + notFound?: string | ((query: string) => string); + /** * Rendered when 0 synchronous suggestions are available but asynchronous suggestions are expected. * Can be either a HTML string or a precompiled template. * If it's a precompiled template, the passed in context will contain query. - */ - pending?: (query: string) => string; + */ + pending?: string | ((query: string) => 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?: (datum: any) => string; + * Rendered at the top of the dataset when suggestions are present. Can be either a HTML string or + * a precompiled template. If it's a precompiled template, the passed in context will contain + * query and suggestions. + */ + header?: string | ((query: string, suggestions: Array) => string); + /** + * Rendered at the bottom of the dataset when suggestions are present. Can be either a HTML string or + * a precompiled template. If it's a precompiled template, the passed in context will contain + * query and suggestions. + */ + footer?: string | ((query: string, suggestions: Array) => 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 display wrapped in a div tag i.e.
              {{value}}
              . + */ + suggestion?: (suggestion: T) => string; } /** From 954b68bfffc7475491c245d4595ccdf8b01f15ba Mon Sep 17 00:00:00 2001 From: igochkov Date: Wed, 13 Jan 2016 22:16:17 +0100 Subject: [PATCH 362/441] Typeahead constructors changed to be generic --- typeahead/typeahead.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index 69da168ea8..b229bb29d2 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -13,7 +13,7 @@ interface JQuery { * @param options Options hash that's used for configuration * @param datasets Array of datasets */ - typeahead(options: Twitter.Typeahead.Options, datasets: Twitter.Typeahead.Dataset[]): JQuery; + typeahead(options: Twitter.Typeahead.Options, datasets: Twitter.Typeahead.Dataset[]): JQuery; /** * For a given input[type="text"], enables typeahead functionality. @@ -22,7 +22,7 @@ interface JQuery { * @param options Options hash that's used for configuration * @param datasets One or more datasets passed as rest parameters. */ - typeahead(options: Twitter.Typeahead.Options, ...datasets: Twitter.Typeahead.Dataset[]): JQuery; + typeahead(options: Twitter.Typeahead.Options, ...datasets: Twitter.Typeahead.Dataset[]): JQuery; /** * Returns the current value of the typeahead. From 5da897b7fb2f4efced8a56f3209793ee141dc353 Mon Sep 17 00:00:00 2001 From: igochkov Date: Wed, 13 Jan 2016 22:44:50 +0100 Subject: [PATCH 363/441] Bloodhoud class changed to reflect latest 0.11.1 typeahead documentation --- typeahead/typeahead.d.ts | 127 +++++++++++++++++++++++---------------- 1 file changed, 75 insertions(+), 52 deletions(-) diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index b229bb29d2..2b6a577d91 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -1057,65 +1057,88 @@ declare module Bloodhound { } } +/** + * Bloodhound is the typeahead.js suggestion engine. Bloodhound is robust, + * flexible, and offers advanced functionalities such as prefetching, + * intelligent caching, fast lookups, and backfilling with remote data. + */ declare class Bloodhound { + /** + * The constructor function. + * + * @constructor + * @param options Options hash + */ constructor(options: Bloodhound.BloodhoundOptions); - /** - * wraps the suggestion engine in an adapter that is compatible with the typeahead jQuery plugin - */ - public ttAdapter(): any; - /** - * Kicks off the initialization of the suggestion engine. This includes processing the data provided through local and fetching/processing the data provided through prefetch. - * Until initialized, all other methods will behave as no-ops. - * Returns a jQuery promise which is resolved when engine has been initialized. - * - * After the initial call of initialize, how subsequent invocations of the method behave depends on the reinitialize argument. - * If reinitialize is falsy, the method will not execute the initialization logic and will just return the same jQuery promise returned by the initial invocation. - * If reinitialize is truthy, the method will behave as if it were being called for the first time. - * - * var promise1 = engine.initialize(); - * var promise2 = engine.initialize(); - * var promise3 = engine.initialize(true); - * - * promise1 === promise2; - * promise3 !== promise1 && promise3 !== promise2; - */ - public initialize(reinitialize?: boolean): JQueryPromise; - /** - * Takes one argument, datums, which is expected to be an array of datums. - * The passed in datums will get added to the search index that powers the suggestion engine. - */ - public add(datums: T[]): void; - /** - * Removes all suggestions from the search index. - */ - public clear(): void; - /** - * If you're using prefetch, data gets cached in local storage in an effort to cut down on unnecessary network requests. - * clearPrefetchCache offers a way to programmatically clear said cache. - */ - public clearPrefetchCache(): void; - /** - * If you're using remote, Bloodhound will cache the 10 most recent responses in an effort to provide a better user experience. - * clearRemoteCache offers a way to programmatically clear said cache. - */ - public clearRemoteCache(): void; - /** - * Returns a reference to the Bloodhound constructor and reverts window.Bloodhound to its previous value. Can be used to avoid naming collisions. - */ - public noConflict(): any; /** - * Computes a set of suggestions for query. cb will be invoked with an array of datums that represent said set. - * cb will always be invoked once synchronously with suggestions that were available on the client. - * If those suggestions are insufficient (# of suggestions is less than limit) and remote was configured, cb may also be invoked asynchronously with the suggestions available on the client mixed with suggestions from the remote source. - */ - public get(query: string, cb: (datums: T[]) => void): void; + * Returns a reference to Bloodhound and reverts window.Bloodhound to its + * previous value. Can be used to avoid naming collisions. + */ + public static noConflict(): any; /** - * The Bloodhound suggestion engine is token-based, so how datums and queries are tokenized plays a vital role in the quality of search results. - * Specify how you want datums and queries tokenized. - */ + * The Bloodhound suggestion engine is token-based, so how datums and queries are tokenized plays a vital role in the quality of search results. + * Specify how you want datums and queries tokenized. + */ public static tokenizers: Bloodhound.Tokenizers; + + /** + * Kicks off the initialization of the suggestion engine. Initialization + * entails adding the data provided by local and prefetch to the internal + * search index as well as setting up transport mechanism used by remote. + * Before #initialize is called, the #get and #search methods will effectively be no-ops. + * + * Note, unless the initialize option is false, this method is implicitly called by the constructor. + * + * After initialization, how subsequent invocations of #initialize behave depends on + * the reinitialize argument. If reinitialize is falsy, the method will not execute the + * initialization logic and will just return the same jQuery promise returned + * by the initial invocation. If reinitialize is truthy, the method will behave + * as if it were being called for the first time. + */ + public initialize(reinitialize?: boolean): JQueryPromise; + + /** + * Takes one argument, data, which is expected to be an array. + * The data passed in will get added to the internal search index. + */ + public add(data: T[]): void; + + /** + * Returns the data in the local search index corresponding to ids + */ + public get(ids: number[]): T[]; + + /** + * Returns the data that matches query. Matches found in the local search + * index will be passed to the sync callback. If the data passed to sync + * doesn't contain at least sufficient number of datums, remote data will + * be requested and then passed to the async callback. + */ + public search(query: string, sync: (datums: T[]) => void, async: (datums: T[]) => void): T[]; + + /** + * Returns all items from the internal search index. + */ + public all(): T[]; + + /** + * Clears the internal search index that's powered by local, prefetch, and #add. + */ + public clear(): Bloodhound; + + /** + * If you're using prefetch, data gets cached in local storage in an effort to cut down on unnecessary network requests. + * clearPrefetchCache offers a way to programmatically clear said cache. + */ + public clearPrefetchCache(): Bloodhound; + + /** + * If you're using remote, Bloodhound will cache the 10 most recent responses in an effort to provide a better user experience. + * clearRemoteCache offers a way to programmatically clear said cache. + */ + public clearRemoteCache(): Bloodhound; } declare module "bloodhound" { From 8665d354b1c5af70ec2c09d4439c7768d00f6ced Mon Sep 17 00:00:00 2001 From: igochkov Date: Thu, 14 Jan 2016 00:10:13 +0100 Subject: [PATCH 364/441] BloodhoudOptions, PrefetchOptions and RemoteOptions changed to reflect latest 0.11.1 typeahead documentation --- typeahead/typeahead.d.ts | 304 +++++++++++++++++++++++---------------- 1 file changed, 182 insertions(+), 122 deletions(-) diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index 2b6a577d91..482e557a3c 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -754,7 +754,7 @@ declare module Twitter.Typeahead { * (e.g. suggestions that come for an AJAX request). * source can also be a Bloodhound instance. */ - source: Bloodhound | ((query: string, syncResults: (result: Array) => void, asyncResults?: (result: Array) => void) => void); + source: Bloodhound | ((query: string, syncResults: (result: T[]) => void, asyncResults?: (result: T[]) => void) => void); /** * Lets the dataset know if async suggestions should be expected. @@ -819,14 +819,14 @@ declare module Twitter.Typeahead { * a precompiled template. If it's a precompiled template, the passed in context will contain * query and suggestions. */ - header?: string | ((query: string, suggestions: Array) => string); + header?: string | ((query: string, suggestions: T[]) => string); /** * Rendered at the bottom of the dataset when suggestions are present. Can be either a HTML string or * a precompiled template. If it's a precompiled template, the passed in context will contain * query and suggestions. */ - footer?: string | ((query: string, suggestions: Array) => string); + footer?: string | ((query: string, suggestions: T[]) => string); /** * Used to render a single suggestion. If set, this has to be a precompiled template. @@ -889,171 +889,218 @@ declare module Twitter.Typeahead { declare module Bloodhound { interface BloodhoundOptions { /** - * Transforms a datum into an array of string tokens - * - * @constructor - * @param datum individual units that compose the dataset - */ - datumTokenizer?: any; + * Transforms a datum into an array of string tokens. + * + * @param datum Suggestion. + * @returns An array of string tokens. + */ + datumTokenizer: (datum: T) => string[]; + /** - * Transforms a query into an array of string tokens - * - * @constructor - * @param query tokenizer query - */ - queryTokenizer?: any; + * Transforms a query into an array of string tokens. + * + * @param quiery Query. + * @returns An array of string tokens. + */ + queryTokenizer: (query: string) => string[]; + /** - * The max number of suggestions to return from Bloodhound#get. - * If not reached, the data source will attempt to backfill the suggestions from remote. Defaults to 5 - */ - limit?: number; + * If set to false, the Bloodhound instance will not be implicitly + * initialized by the constructor function. Defaults to true. + */ + initialize: boolean; + /** - * If set, this is expected to be a function with the signature (remoteMatch, localMatch) that returns true if the datums are duplicates or false otherwise. - * If not set, duplicate detection will not be performed. - */ - dupDetector?: (remoteMatch: T, localMatch: T) => boolean; + * Given a datum, returns a unique id for it. + * Defaults to JSON.stringify. Note that it is highly recommended + * to override this option. + * + * @param datum Suggestion. + * @returns Unique id for the suggestion. + */ + identify: (datum: T) => number; + /** - * A compare function used to sort matched datums for a given query. - */ + * If the number of datums provided from the internal search index is + * less than sufficient, remote will be used to backfill search + * requests triggered by calling #search. Defaults to 5. + */ + sufficient?: number; + + /** + * A compare function used to sort data returned from the internal search index. + * + * @param a First suggestion. + * @param b Second suggestion. + * @returns Comparison result. + */ sorter?: (a: T, b: T) => number; + /** - * An array of datums or a function that returns an array of datums. - */ - local?: () => T[]; + * An array of data or a function that returns an array of data. + * The data will be added to the internal search index when #initialize is called. + */ + local?: T[] | (() => T[]); + /** - * Can be a URL to a JSON file containing an array of datums or, if more configurability is needed, a prefetch options hash. - */ - prefetch?: PrefetchOptions; + * Can be a URL to a JSON file containing an array of data or, + * if more configurability is needed, a prefetch options hash. + */ + prefetch?: string | PrefetchOptions; + /** - * 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 hash. - */ - remote?: RemoteOptions; + * Can be a URL to fetch data from when the data provided by the internal + * search index is insufficient or, if more configurability is needed, + * a remote options hash. + */ + remote?: string | RemoteOptions; } - /** - * 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. - */ + /** + * Prefetched data is fetched and processed on initialization. If the browser + * supports local storage, the processed data will be cached there to prevent + * additional network requests on subsequent page loads. + * + * WARNING: While it's possible to get away with it for smaller data sets, + * prefetched data isn't meant to contain entire sets of data. Rather, it should + * act as a first-level cache. Ignoring this warning means you'll run the risk + * of hitting local storage limits. + */ interface PrefetchOptions { /** - * A URL to a JSON file containing an array of datums. Required. - */ + * The URL prefetch data should be loaded from. + */ url: string; + /** - * The time (in milliseconds) the prefetched data should be cached - * in localStorage. Defaults to 86400000 (1 day). - */ + * If false, will not attempt to read or write to local storage and + * will always load prefetch data from url on initialization. Defaults to true. + */ + cache?: boolean; + + /** + * The time (in milliseconds) the prefetched data should be cached in + * local storage. Defaults to 86400000 (1 day). + */ ttl?: number; + /** - * A function that transforms the response body into an array of datums. - * - * @param parsedResponse Response body - */ - filter?: (parsedResponse: any) => T[]; - /** The key that data will be stored in local storage under. Defaults to value of url. - * - */ + * The key that data will be stored in local storage under. + * Defaults to value of url. + */ cacheKey?: string; + /** - * A string used for thumbprinting prefetched data. If this doesn't match what's stored in local storage, the data will be refetched. - */ + * A string used for thumbprinting prefetched data. If this doesn't + * match what's stored in local storage, the data will be refetched. + */ thumbprint?: string; + /** - * The ajax settings object passed to jQuery.ajax. - */ - ajax?: JQueryAjaxSettings; + * A function that provides a hook to allow you to prepare the settings + * object passed to transport when a request is about to be made. + * Defaults to the identity function. + * + * @param settings The default settings object created internally by the Bloodhound instance. + * @returns A settings object. + */ + prepare?: (settings: JQueryAjaxSettings) => JQueryAjaxSettings; + + /** + * A function with the signature transform(response) that allows you to + * transform the prefetch response before the Bloodhound instance operates + * on it. Defaults to the identity function. + * + * @param response Prefetch response. + * @returns Transform response. + */ + transform?: (response: JQueryPromise) => JQueryPromise; } /** - * 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. - */ + * Bloodhound only goes to the network when the internal search engine cannot + * provide a sufficient number of results. In order to prevent an obscene + * number of requests being made to the remote endpoint, requests are rate-limited. + */ interface RemoteOptions { /** - * A URL to make requests to when the data provided by local and - * prefetch is insufficient. Required. - */ + * The URL remote data should be loaded from. + */ url: string; - /** - * 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'. - */ - rateLimitby?: string; - /** - * The time interval in milliseconds that will be used by rateLimitFn. - * Defaults to 300. - */ - rateLimitWait?: number; /** - * Transforms the response body into an array of datums. - * - * @param parsedResponse Response body - */ - filter?: (parsedResponse: any) => T[]; - /** - * The ajax settings object passed to jQuery.ajax. - */ - ajax?: JQueryAjaxSettings; - - /** - * A function that provides a hook to allow you to prepare the settings object passed to transport - * when a request is about to be made. The function signature should be prepare(query, settings), - * where query is the query #search was called with and settings is the default settings object - * created internally by the Bloodhound instance. The prepare function should return a settings object. - * [Note: Added in 0.11.1] + * A function that provides a hook to allow you to prepare the settings + * object passed to transport when a request is about to be made. + * The function signature should be prepare(query, settings), where query + * is the query #search was called with and settings is the default settings + * object created internally by the Bloodhound instance. The prepare function + * should return a settings object. Defaults to the identity function. * * @param query The query #search was called with. * @param settings The default settings object created internally by Bloodhound. * @returns A JqueryAjaxSettings object. */ prepare?: (query: string, settings: JQueryAjaxSettings) => JQueryAjaxSettings; + + /** + * A convenience option for prepare. If set, prepare will be a function + * that replaces the value of this option in url with the URI encoded query. + */ + wildcard?: string; + + /** + * The method used to rate-limit network requests. + * Can be either debounce or throttle. Defaults to debounce. + */ + rateLimitby?: string; + + /** + * The time interval in milliseconds that will be used by rateLimitBy. + * Defaults to 300. + */ + rateLimitWait?: number; + + /** + * A function with the signature transform(response) that allows you to + * transform the remote response before the Bloodhound instance operates on it. + * Defaults to the identity function. + * + * @param response Prefetch response. + * @returns Transform response. + */ + transform?: (response: JQueryPromise) => JQueryPromise; } /** - * The most common tokenization methods. + * Build-in tokenization methods. */ interface Tokenizers { /** - * Split a given string on whitespace characters. - */ - whitespace(query: string): string[]; + * Split a given string on whitespace characters. + */ + whitespace(str: string): string[]; + /** - * Split a given string on non-word characters. - */ - nonword(query: string): string[]; + * Split a given string on non-word characters. + */ + nonword(str: string): string[]; /** - * Instances of the most common tokenization methods. - */ + * Instances of the build-in tokenization methods. + */ obj: ObjTokenizer; } interface ObjTokenizer { /** - * Split a given string on whitespace characters. - */ - whitespace(query: string): string[]; + * Split a given string on whitespace characters. + */ + whitespace(str: string): string[]; + /** - * Split a given string on non-word characters. - */ - nonword(query: string): string[]; + * Split a given string on non-word characters. + */ + nonword(str: string): string[]; } } @@ -1067,7 +1114,7 @@ declare class Bloodhound { * The constructor function. * * @constructor - * @param options Options hash + * @param options Options hash. */ constructor(options: Bloodhound.BloodhoundOptions); @@ -1096,17 +1143,25 @@ declare class Bloodhound { * initialization logic and will just return the same jQuery promise returned * by the initial invocation. If reinitialize is truthy, the method will behave * as if it were being called for the first time. + * + * @param reinitialize How subsequent invocations of #initialize will behave. + * @returns jQuery promise. */ - public initialize(reinitialize?: boolean): JQueryPromise; + public initialize(reinitialize?: boolean): JQueryPromise; /** * Takes one argument, data, which is expected to be an array. * The data passed in will get added to the internal search index. + * + * @param data Data to be added to the internal search index. */ public add(data: T[]): void; /** - * Returns the data in the local search index corresponding to ids + * Returns the data in the local search index corresponding to ids. + * + * @param ids Data ids. + * @returns The corresponding data. */ public get(ids: number[]): T[]; @@ -1115,6 +1170,11 @@ declare class Bloodhound { * index will be passed to the sync callback. If the data passed to sync * doesn't contain at least sufficient number of datums, remote data will * be requested and then passed to the async callback. + * + * @param query Query. + * @param sync Sync callback + * @param async Async callback. + * @returns The data that matches query. */ public search(query: string, sync: (datums: T[]) => void, async: (datums: T[]) => void): T[]; From 22198fa6979252e923277fb315984bbc0a8e8c8a Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Thu, 14 Jan 2016 09:53:40 +0800 Subject: [PATCH 365/441] fix gulp-replace import --- gulp-replace/gulp-replace-tests.ts | 6 +++--- gulp-replace/gulp-replace.d.ts | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gulp-replace/gulp-replace-tests.ts b/gulp-replace/gulp-replace-tests.ts index a914bfd44e..8e043d7748 100644 --- a/gulp-replace/gulp-replace-tests.ts +++ b/gulp-replace/gulp-replace-tests.ts @@ -1,11 +1,11 @@ /// /// -import gulp = require("gulp"); -import replace = require("gulp-replace"); +import * as gulp from "gulp"; +import * as replace from "gulp-replace"; gulp.task('templates', function(){ gulp.src(['file.txt']) .pipe(replace("test", "foo")) .pipe(replace(/foo(.{3})/g, '$1foo')) .pipe(gulp.dest('build/file.txt')); -}); \ No newline at end of file +}); diff --git a/gulp-replace/gulp-replace.d.ts b/gulp-replace/gulp-replace.d.ts index cf6ef7164c..f32e33bbe7 100644 --- a/gulp-replace/gulp-replace.d.ts +++ b/gulp-replace/gulp-replace.d.ts @@ -17,5 +17,7 @@ declare module "gulp-replace" { function replace(pattern: string, replacement: string | Replacer, opts?: Options): NodeJS.ReadWriteStream; function replace(pattern: RegExp, replacement: string | Replacer, opts?: Options): NodeJS.ReadWriteStream; + namespace replace {} + export = replace; -} \ No newline at end of file +} From 2d76fd638294c140626cc3e3aebc8b89fc969761 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Wed, 13 Jan 2016 17:49:33 +0900 Subject: [PATCH 366/441] fix: more appropriate interface name for OSM models --- osmtogeojson/osmtogeojson-tests.ts | 2 +- osmtogeojson/osmtogeojson.d.ts | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osmtogeojson/osmtogeojson-tests.ts b/osmtogeojson/osmtogeojson-tests.ts index a4debe4c11..f7d52c0754 100644 --- a/osmtogeojson/osmtogeojson-tests.ts +++ b/osmtogeojson/osmtogeojson-tests.ts @@ -33,7 +33,7 @@ osmtogeojson(xml, { uninterestingTags: {foo:true} }); -let json: OsmJSON.Root = { +let json: OsmJSON.OsmJSONObject = { elements: [ { type: "node", diff --git a/osmtogeojson/osmtogeojson.d.ts b/osmtogeojson/osmtogeojson.d.ts index 0edee35094..ad29c1b73a 100644 --- a/osmtogeojson/osmtogeojson.d.ts +++ b/osmtogeojson/osmtogeojson.d.ts @@ -5,8 +5,8 @@ declare module "osmtogeojson" { export interface OsmToGeoJSON { - (data: Document|OsmJSON.Root, options?: Options): GeoJSON.GeoJSONObject; - toGeojson(data: Document|OsmJSON.Root, options?: Options): GeoJSON.GeoJSONObject; + (data: Document|OsmJSON.OsmJSONObject, options?: Options): GeoJSON.GeoJSONObject; + toGeojson(data: Document|OsmJSON.OsmJSONObject, options?: Options): GeoJSON.GeoJSONObject; } export interface Options { @@ -54,11 +54,11 @@ declare module "osmtogeojson" { } export namespace OsmJSON { - export interface Root { + export interface OsmJSONObject { elements: (Node|Way|Relationship)[]; } - export interface OsmJSONObject { + export interface Element { type: string; id: number; tags?: { [name: string]: string; } @@ -69,16 +69,16 @@ declare module "osmtogeojson" { uid?: number; } - export interface Node extends OsmJSONObject { + export interface Node extends Element { lat: number; lon: number; } - export interface Way extends OsmJSONObject { + export interface Way extends Element { nodes: number[]; } - export interface Relationship extends OsmJSONObject { + export interface Relationship extends Element { members: Member[]; } From 5aa6dff6990465c7fb41504538ad7aa133ab01d3 Mon Sep 17 00:00:00 2001 From: jwbay Date: Wed, 13 Jan 2016 23:29:30 -0500 Subject: [PATCH 367/441] update typings for should.js from 3.x to 8.x --- should/should-tests.ts | 150 ++++++++++++++++++++++++++++++++--------- should/should.d.ts | 93 ++++++++++++++++++------- 2 files changed, 186 insertions(+), 57 deletions(-) diff --git a/should/should-tests.ts b/should/should-tests.ts index 43b21d0efc..41c814aea3 100644 --- a/should/should-tests.ts +++ b/should/should-tests.ts @@ -15,6 +15,20 @@ should.throws(() => {}); should.doesNotThrow(() => {}); should.ifError('value'); +(0).should + .a + .an + .and + .be + .has + .have + .is + .it + .of + .the + .which + .with + .equal(0) class User { name: string; @@ -60,36 +74,48 @@ should.not.exist(null); should.not.exist(''); should.not.exist({}); -true.should.be.ok; -'yay'.should.be.ok; -(1).should.be.ok; +true.should.be.ok(); +'yay'.should.be.ok(); +(1).should.be.ok(); -false.should.not.be.ok; -''.should.not.be.ok; -(0).should.not.be.ok; +false.should.not.be.ok(); +''.should.not.be.ok(); +(0).should.not.be.ok(); -true.should.be.true -'1'.should.not.be.true -false +true.should.be.true(); +true.should.be.True(); +'1'.should.not.be.true(); -false.should.be.false; -(0).should.not.be.false; +false.should.be.false(); +false.should.be.False(); +(0).should.not.be.false(); var args = function (a: string, b: string, c: string) { return arguments; }; -args.should.be.arguments; -['a'].should.not.be.arguments; +args.should.be.arguments(); +args.should.be.Arguments(); +['a'].should.not.be.arguments(); -['a'].should.be.empty; -''.should.be.empty; -({ length: 0 }).should.be.empty; +['a'].should.be.empty(); +''.should.be.empty(); +({ length: 0 }).should.be.empty(); ({ foo: 'bar' }).should.eql({ foo: 'bar' }); [1, 2, 3].should.eql([1, 2, 3]); +[1, 2, 3].should.deepEqual([1, 2, 3]); (4).should.equal(4); 'test'.should.equal('test'); [1, 2, 3].should.not.equal([1, 2, 3]); +'ab'.should.equalOneOf('a', 10, 'ab'); +'ab'.should.equalOneOf(['a', 10, 'ab']); + +({a: 10}).should.be.oneOf('a', 10, 'ab', {a: 10}); +({a: 10}).should.be.oneOf(['a', 10, 'ab', {a: 10}]); + +'1'.should.be.exactly('1'); +'1'.should.not.be.exactly(1); + user.age.should.be.within(5, 50); user.should.be.of.type('object'); @@ -114,7 +140,29 @@ user.should.have.property('age', 15); user.should.not.have.property('rawr'); user.should.not.have.property('age', 0); +({ a: 10 }).should.have.properties('a'); +({ a: 10, b: 20 }).should.have.properties([ 'a' ]); +({ a: 10, b: 20 }).should.have.properties({ b: 20 }); ({ foo: 'bar' }).should.have.ownProperty('foo'); +({ foo: 'bar' }).should.hasOwnProperty('foo'); +({ a: {b: 10}}).should.have.propertyByPath('a', 'b').eql(10); +({ a: 10 }).should.have.propertyWithDescriptor('a', { enumerable: true }); + +NaN.should.be.NaN(); +Infinity.should.be.Infinity(); +new Date().should.be.a.Date(); +({}).should.be.an.Object(); +"".should.be.a.String(); +true.should.be.a.Boolean(); +(4).should.be.a.Number(); +new ReferenceError("error").should.be.an.Error(); +(function() {}).should.be.a.Function(); +User.should.be.a.class(); +User.should.be.a.Class(); +'a'.should.not.be.a.generator(); +[].should.be.iterable(); +[].should.be.an.iterator(); +[].should.be.an.Array(); var res = {}; res.should.have.status(200); @@ -123,30 +171,60 @@ res.should.have.header('content-length'); res.should.have.header('Content-Length', '123'); res.should.have.header('content-length', '123'); -res.should.be.json; +res.should.be.json(); -res.should.be.html; +res.should.be.html(); -[1, 2, 3].should.include(3); -[1, 2, 3].should.include(2); -[1, 2, 3].should.not.include(4); +[1, 2, 3].should.containEql(3); +[1, 2, 3].should.containEql(2); +[1, 2, 3].should.not.containEql(4); -'foo bar baz'.should.include('foo'); -'foo bar baz'.should.include('bar'); -'foo bar baz'.should.include('baz'); -'foo bar baz'.should.not.include('FOO'); +'foo bar baz'.should.containEql('foo'); +'foo bar baz'.should.containEql('bar'); +'foo bar baz'.should.containEql('baz'); +'foo bar baz'.should.not.containEql('FOO') var tobi = { name: 'Tobi', age: 1 }; var jane = { name: 'Jane', age: 5 }; var tj = { name: 'TJ', pet: tobi }; -tj.should.include({ pet: tobi }); -tj.should.include({ pet: tobi, name: 'TJ' }); -tj.should.not.include({ pet: jane }); -tj.should.not.include({ name: 'Someone' }); +tj.should.containEql({ pet: tobi }); +tj.should.containEql({ pet: tobi, name: 'TJ' }); +tj.should.not.containEql({ pet: jane }); +tj.should.not.containEql({ name: 'Someone' }); -[[1], [2], [3]].should.includeEql([3]); -[[1], [2], [3]].should.includeEql([2]); -[[1], [2], [3]].should.not.includeEql([4]); +[[1], [2], [3]].should.containEql([3]); +[[1], [2], [3]].should.containEql([2]); +[[1], [2], [3]].should.not.containEql([4]); + +var spy = function() { }; +spy.should.be.alwaysCalledOn({}); +spy.should.be.alwaysCalledWith(1, 2); +spy.should.be.alwaysCalledWithExactly(1, 2); +spy.should.be.alwaysCalledWithMatch(1, 2); +spy.should.have.alwaysThrew("ReferenceError"); +spy.should.have.callCount(1); +spy.should.be.called(); +spy.should.be.calledOn({}); +spy.should.be.calledOnce(); +spy.should.be.calledTwice(); +spy.should.be.calledThrice(); +spy.should.be.calledWith(1, 2); +spy.should.be.calledWithExactly(1, 2); +spy.should.be.calledWithMatch(1, 2); +spy.should.be.calledWithNew(); +spy.should.be.neverCalledWith(1, 2); +spy.should.be.neverCalledWithMatch(1, 2); +spy.should.have.threw("ReferenceError"); + +(10).should.be.aboveOrEqual(0); +(10).should.be.aboveOrEqual(10); +(10).should.be.greaterThanOrEqual(0); +(10).should.be.greaterThanOrEqual(10); + +(0).should.be.belowOrEqual(10); +(0).should.be.belowOrEqual(0); +(0).should.be.lessThanOrEqual(10); +(0).should.be.lessThanOrEqual(0); (function () { throw new Error('fail'); @@ -170,9 +248,17 @@ tj.should.not.include({ name: 'Someone' }); var obj = { foo: 'bar', baz: 'raz' }; obj.should.have.keys('foo', 'bar'); obj.should.have.keys(['foo', 'bar']); +obj.should.have.key('foo'); + +({ a: 10 }).should.have.enumerable('a'); +({ a: 10 }).should.have.enumerable('a', 10); +({ a: 10, b: 10 }).should.have.enumerables('a', 'b'); (1).should.eql(0, 'some useful description'); +[ 1, 2, 3].should.containDeep([2, 1]); +[ 1, 2, [ 1, 2, 3 ]].should.containDeep([ 1, [ 3, 1 ]]); + [ 1, 2, 3].should.containDeepOrdered([1, 2]); [ 1, 2, [ 1, 2, 3 ]].should.containDeepOrdered([ 1, [ 2, 3 ]]); diff --git a/should/should.d.ts b/should/should.d.ts index 26a42d7edc..d4ab3ef383 100644 --- a/should/should.d.ts +++ b/should/should.d.ts @@ -1,5 +1,5 @@ -// Type definitions for should.js 3.1.2 -// Project: https://github.com/visionmedia/should.js +// Type definitions for should.js v8.1.1 +// Project: https://github.com/shouldjs/should.js // Definitions by: Alex Varju , Maxime LUCE // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -13,34 +13,49 @@ interface ShouldAssertion { an: ShouldAssertion; and: ShouldAssertion; be: ShouldAssertion; + has: ShouldAssertion; have: ShouldAssertion; + is: ShouldAssertion; + it: ShouldAssertion; with: ShouldAssertion; + which: ShouldAssertion; + the: ShouldAssertion; of: ShouldAssertion; not: ShouldAssertion; // validators - arguments: ShouldAssertion; - empty: ShouldAssertion; - ok: ShouldAssertion; - true: ShouldAssertion; - false: ShouldAssertion; - NaN: ShouldAssertion; - Infinity: ShouldAssertion; - Array: ShouldAssertion; - Object: ShouldAssertion; - String: ShouldAssertion; - Boolean: ShouldAssertion; - Number: ShouldAssertion; - Error: ShouldAssertion; - Function: ShouldAssertion; + arguments(): ShouldAssertion; + empty(): ShouldAssertion; + ok(): ShouldAssertion; + true(): ShouldAssertion; + false(): ShouldAssertion; + NaN(): ShouldAssertion; + Infinity(): ShouldAssertion; + Array(): ShouldAssertion; + Object(): ShouldAssertion; + String(): ShouldAssertion; + Boolean(): ShouldAssertion; + Number(): ShouldAssertion; + Error(): ShouldAssertion; + Function(): ShouldAssertion; + Date(): ShouldAssertion; + Class(): ShouldAssertion; + generator(): ShouldAssertion; + iterable(): ShouldAssertion; + iterator(): ShouldAssertion; eql(expected: any, description?: string): ShouldAssertion; equal(expected: any, description?: string): ShouldAssertion; + equalOneOf(...values: any[]): ShouldAssertion; within(start: number, finish: number, description?: string): ShouldAssertion; approximately(value: number, delta: number, description?: string): ShouldAssertion; type(expected: any, description?: string): ShouldAssertion; instanceof(constructor: Function, description?: string): ShouldAssertion; above(n: number, description?: string): ShouldAssertion; below(n: number, description?: string): ShouldAssertion; + aboveOrEqual(n: number, description?: string): ShouldAssertion; + greaterThanOrEqual(n: number, description?: string): ShouldAssertion; + belowOrEqual(n: number, description?: string): ShouldAssertion; + lessThanOrEqual(n: number, description?: string): ShouldAssertion; match(other: {}, description?: string): ShouldAssertion; match(other: (val: any) => any, description?: string): ShouldAssertion; match(regexp: RegExp, description?: string): ShouldAssertion; @@ -60,32 +75,60 @@ interface ShouldAssertion { properties(name: string): ShouldAssertion; properties(descriptor: any): ShouldAssertion; properties(...properties: string[]): ShouldAssertion; + propertyByPath(...properties: string[]): ShouldAssertion; + propertyWithDescriptor(name: string, descriptor: PropertyDescriptor): ShouldAssertion; + oneOf(...values: any[]): ShouldAssertion; ownProperty(name: string, description?: string): ShouldAssertion; - contain(obj: any): ShouldAssertion; containEql(obj: any): ShouldAssertion; containDeep(obj: any): ShouldAssertion; containDeepOrdered(obj: any): ShouldAssertion; keys(...allKeys: string[]): ShouldAssertion; keys(allKeys: string[]): ShouldAssertion; - header(field: string, val?: string): ShouldAssertion; - status(code: number): ShouldAssertion; - json: ShouldAssertion; - html: ShouldAssertion; + enumerable(property: string, value?: any): ShouldAssertion; + enumerables(...properties: string[]): ShouldAssertion; startWith(expected: string, message?: any): ShouldAssertion; endWith(expected: string, message?: any): ShouldAssertion; throw(message?: any): ShouldAssertion; - // deprecated - include(obj: any, description?: string): ShouldAssertion; - includeEql(obj: any[], description?: string): ShouldAssertion; + //http + header(field: string, val?: string): ShouldAssertion; + status(code: number): ShouldAssertion; + json(): ShouldAssertion; + html(): ShouldAssertion; + + //stubs + alwaysCalledOn(thisTarget: any): ShouldAssertion; + alwaysCalledWith(...arguments: any[]): ShouldAssertion; + alwaysCalledWithExactly(...arguments: any[]): ShouldAssertion; + alwaysCalledWithMatch(...arguments: any[]): ShouldAssertion; + alwaysCalledWithNew(): ShouldAssertion; + alwaysThrew(exception?: any): ShouldAssertion; + callCount(count: number): ShouldAssertion; + called(): ShouldAssertion; + calledOn(thisTarget: any): ShouldAssertion; + calledOnce(): ShouldAssertion; + calledTwice(): ShouldAssertion; + calledThrice(): ShouldAssertion; + calledWith(...arguments: any[]): ShouldAssertion; + calledWithExactly(...arguments: any[]): ShouldAssertion; + calledWithMatch(...arguments: any[]): ShouldAssertion; + calledWithNew(): ShouldAssertion; + neverCalledWith(...arguments: any[]): ShouldAssertion; + neverCalledWithMatch(...arguments: any[]): ShouldAssertion; + threw(exception?: any): ShouldAssertion; // aliases + True(): ShouldAssertion; + False(): ShouldAssertion; + Arguments(): ShouldAssertion; + class(): ShouldAssertion; + deepEqual(expected: any, description?: string): ShouldAssertion; exactly(expected: any, description?: string): ShouldAssertion; instanceOf(constructor: Function, description?: string): ShouldAssertion; throwError(message?: any): ShouldAssertion; lengthOf(n: number, description?: string): ShouldAssertion; key(key: string): ShouldAssertion; - haveOwnProperty(name: string, description?: string): ShouldAssertion; + hasOwnProperty(name: string, description?: string): ShouldAssertion; greaterThan(n: number, description?: string): ShouldAssertion; lessThan(n: number, description?: string): ShouldAssertion; } From bc795de3e0d6c1d2bfbe088acdc0f5545eed7296 Mon Sep 17 00:00:00 2001 From: Ivaylo Gochkov Date: Thu, 14 Jan 2016 10:02:30 +0100 Subject: [PATCH 368/441] Version number changed in the header of the file. * Version number changed in the header of the file. * BloodhoundOptions - initialize made optional - identify made optional * PrefetchOptions - the signiture of transform changed * RemoteOptions - the signiture of transform changed --- typeahead/typeahead.d.ts | 814 +++++++++++++++++++-------------------- 1 file changed, 407 insertions(+), 407 deletions(-) diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index 482e557a3c..b9228b4304 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -1,11 +1,11 @@ -// Type definitions for typeahead.js 0.10.4 -// Project: http://twitter.github.io/typeahead.js/ -// Definitions by: Ivaylo Gochkov , Gidon Junge -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -interface JQuery { +// Type definitions for typeahead.js 0.11.1 +// Project: http://twitter.github.io/typeahead.js/ +// Definitions by: Ivaylo Gochkov , Gidon Junge +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface JQuery { /** * For a given input[type="text"], enables typeahead functionality. * @@ -705,35 +705,35 @@ interface JQuery { * @param events typeahead:asyncreceive event. * @param handler A handler function previously attached for the event(s), or the special value false. */ - off(events: "typeahead:asyncreceive", handler: (eventObject: JQueryEventObject) => any): JQuery; -} - -declare module Twitter.Typeahead { - interface Options { - /** - * If true, when suggestions are rendered, pattern matches for the current query in text nodes will be wrapped in a strong element with its class set to {{classNames.highlight}}. - * Defaults to false. - */ - highlight?: boolean; - - /** - * If false, the typeahead will not show a hint. - * Defaults to true. - */ - hint?: boolean; - - /** - * The minimum character length needed before suggestions start getting rendered. - * Defaults to 1. - */ - minLength?: number; - - /** - * Used for overriding the default class names. - */ - classNames?: ClassNames; - } - + off(events: "typeahead:asyncreceive", handler: (eventObject: JQueryEventObject) => any): JQuery; +} + +declare module Twitter.Typeahead { + interface Options { + /** + * If true, when suggestions are rendered, pattern matches for the current query in text nodes will be wrapped in a strong element with its class set to {{classNames.highlight}}. + * Defaults to false. + */ + highlight?: boolean; + + /** + * If false, the typeahead will not show a hint. + * Defaults to true. + */ + hint?: boolean; + + /** + * The minimum character length needed before suggestions start getting rendered. + * Defaults to 1. + */ + minLength?: number; + + /** + * Used for overriding the default class names. + */ + classNames?: ClassNames; + } + /** * A typeahead is composed of one or more datasets. When an end-user * modifies the value of a typeahead, each dataset will attempt to render @@ -742,7 +742,7 @@ declare module Twitter.Typeahead { * where you want rendered suggestions to be grouped based on some sort of * categorical relationship that you'd need to use multiple datasets. For * example, on twitter.com, the search typeahead groups results into recent - * searches, trends, and accounts that would be a great use case for using + * searches, trends, and accounts – that would be a great use case for using * multiple datasets. */ interface Dataset { @@ -792,170 +792,170 @@ declare module Twitter.Typeahead { * its first argument and returns a HTML string. */ templates?: Templates; - } - + } + /** * 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. - */ - interface Templates { - /** - * 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. - */ - notFound?: string | ((query: string) => string); - - /** - * Rendered when 0 synchronous suggestions are available but asynchronous suggestions are expected. - * Can be either a HTML string or a precompiled template. - * If it's a precompiled template, the passed in context will contain query. - */ - pending?: string | ((query: string) => string); - - /** - * Rendered at the top of the dataset when suggestions are present. Can be either a HTML string or - * a precompiled template. If it's a precompiled template, the passed in context will contain - * query and suggestions. - */ - header?: string | ((query: string, suggestions: T[]) => string); - - /** - * Rendered at the bottom of the dataset when suggestions are present. Can be either a HTML string or - * a precompiled template. If it's a precompiled template, the passed in context will contain - * query and suggestions. - */ - footer?: string | ((query: string, suggestions: T[]) => 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 display wrapped in a div tag i.e.
              {{value}}
              . - */ - suggestion?: (suggestion: T) => string; - } - - /** - * Used for overriding the default class names. - */ - interface ClassNames { - /** - * Added to input that's initialized into a typeahead. Defaults to tt-input. - */ + */ + interface Templates { + /** + * 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. + */ + notFound?: string | ((query: string) => string); + + /** + * Rendered when 0 synchronous suggestions are available but asynchronous suggestions are expected. + * Can be either a HTML string or a precompiled template. + * If it's a precompiled template, the passed in context will contain query. + */ + pending?: string | ((query: string) => string); + + /** + * Rendered at the top of the dataset when suggestions are present. Can be either a HTML string or + * a precompiled template. If it's a precompiled template, the passed in context will contain + * query and suggestions. + */ + header?: string | ((query: string, suggestions: T[]) => string); + + /** + * Rendered at the bottom of the dataset when suggestions are present. Can be either a HTML string or + * a precompiled template. If it's a precompiled template, the passed in context will contain + * query and suggestions. + */ + footer?: string | ((query: string, suggestions: T[]) => 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 display wrapped in a div tag i.e.
              {{value}}
              . + */ + suggestion?: (suggestion: T) => string; + } + + /** + * Used for overriding the default class names. + */ + interface ClassNames { + /** + * Added to input that's initialized into a typeahead. Defaults to tt-input. + */ input?: string; - /** - * Added to hint input.Defaults to tt- hint. + /** + * Added to hint input.Defaults to tt- hint. */ hint?: string; - /** - * Added to menu element.Defaults to tt- menu. + /** + * Added to menu element.Defaults to tt- menu. */ menu?: string; - /** - * Added to dataset elements.to Defaults to tt- dataset. + /** + * Added to dataset elements.to Defaults to tt- dataset. */ dataset?: string; - /** - * Added to suggestion elements.Defaults to tt- suggestion. + /** + * Added to suggestion elements.Defaults to tt- suggestion. */ suggestion?: string; - /** - * Added to menu element when it contains no content.Defaults to tt- empty. + /** + * Added to menu element when it contains no content.Defaults to tt- empty. */ empty?: string; - /** - * Added to menu element when it is opened.Defaults to tt- open. + /** + * Added to menu element when it is opened.Defaults to tt- open. */ open?: string; - /** - * Added to suggestion element when menu cursor moves to said suggestion.Defaults to tt- cursor. + /** + * Added to suggestion element when menu cursor moves to said suggestion.Defaults to tt- cursor. */ cursor?: string; - /** - * Added to the element that wraps highlighted text.Defaults to tt- highlight. + /** + * Added to the element that wraps highlighted text.Defaults to tt- highlight. */ - highlight?: string; - } -} - -declare module Bloodhound { - interface BloodhoundOptions { - /** - * Transforms a datum into an array of string tokens. - * - * @param datum Suggestion. - * @returns An array of string tokens. - */ - datumTokenizer: (datum: T) => string[]; - - /** - * Transforms a query into an array of string tokens. - * - * @param quiery Query. - * @returns An array of string tokens. - */ - queryTokenizer: (query: string) => string[]; - - /** - * If set to false, the Bloodhound instance will not be implicitly - * initialized by the constructor function. Defaults to true. - */ - initialize: boolean; - - /** - * Given a datum, returns a unique id for it. - * Defaults to JSON.stringify. Note that it is highly recommended - * to override this option. - * - * @param datum Suggestion. - * @returns Unique id for the suggestion. - */ - identify: (datum: T) => number; - - /** - * If the number of datums provided from the internal search index is - * less than sufficient, remote will be used to backfill search - * requests triggered by calling #search. Defaults to 5. - */ - sufficient?: number; - - /** - * A compare function used to sort data returned from the internal search index. - * - * @param a First suggestion. - * @param b Second suggestion. - * @returns Comparison result. - */ - sorter?: (a: T, b: T) => number; - - /** - * An array of data or a function that returns an array of data. - * The data will be added to the internal search index when #initialize is called. - */ - local?: T[] | (() => T[]); - - /** - * Can be a URL to a JSON file containing an array of data or, - * if more configurability is needed, a prefetch options hash. - */ - prefetch?: string | PrefetchOptions; - - /** - * Can be a URL to fetch data from when the data provided by the internal - * search index is insufficient or, if more configurability is needed, - * a remote options hash. - */ - remote?: string | RemoteOptions; - } - + highlight?: string; + } +} + +declare module Bloodhound { + interface BloodhoundOptions { + /** + * Transforms a datum into an array of string tokens. + * + * @param datum Suggestion. + * @returns An array of string tokens. + */ + datumTokenizer: (datum: T) => string[]; + + /** + * Transforms a query into an array of string tokens. + * + * @param quiery Query. + * @returns An array of string tokens. + */ + queryTokenizer: (query: string) => string[]; + + /** + * If set to false, the Bloodhound instance will not be implicitly + * initialized by the constructor function. Defaults to true. + */ + initialize?: boolean; + + /** + * Given a datum, returns a unique id for it. + * Defaults to JSON.stringify. Note that it is highly recommended + * to override this option. + * + * @param datum Suggestion. + * @returns Unique id for the suggestion. + */ + identify?: (datum: T) => number; + + /** + * If the number of datums provided from the internal search index is + * less than sufficient, remote will be used to backfill search + * requests triggered by calling #search. Defaults to 5. + */ + sufficient?: number; + + /** + * A compare function used to sort data returned from the internal search index. + * + * @param a First suggestion. + * @param b Second suggestion. + * @returns Comparison result. + */ + sorter?: (a: T, b: T) => number; + + /** + * An array of data or a function that returns an array of data. + * The data will be added to the internal search index when #initialize is called. + */ + local?: T[] | (() => T[]); + + /** + * Can be a URL to a JSON file containing an array of data or, + * if more configurability is needed, a prefetch options hash. + */ + prefetch?: string | PrefetchOptions; + + /** + * Can be a URL to fetch data from when the data provided by the internal + * search index is insufficient or, if more configurability is needed, + * a remote options hash. + */ + remote?: string | RemoteOptions; + } + /** * Prefetched data is fetched and processed on initialization. If the browser * supports local storage, the processed data will be cached there to prevent @@ -965,242 +965,242 @@ declare module Bloodhound { * prefetched data isn't meant to contain entire sets of data. Rather, it should * act as a first-level cache. Ignoring this warning means you'll run the risk * of hitting local storage limits. - */ - interface PrefetchOptions { - /** - * The URL prefetch data should be loaded from. - */ - url: string; - - /** - * If false, will not attempt to read or write to local storage and - * will always load prefetch data from url on initialization. Defaults to true. - */ - cache?: boolean; - - /** - * The time (in milliseconds) the prefetched data should be cached in - * local storage. Defaults to 86400000 (1 day). - */ - ttl?: number; - - /** - * The key that data will be stored in local storage under. - * Defaults to value of url. - */ - cacheKey?: string; - - /** - * A string used for thumbprinting prefetched data. If this doesn't - * match what's stored in local storage, the data will be refetched. - */ - thumbprint?: string; - - /** - * A function that provides a hook to allow you to prepare the settings - * object passed to transport when a request is about to be made. - * Defaults to the identity function. - * - * @param settings The default settings object created internally by the Bloodhound instance. - * @returns A settings object. - */ - prepare?: (settings: JQueryAjaxSettings) => JQueryAjaxSettings; - - /** - * A function with the signature transform(response) that allows you to - * transform the prefetch response before the Bloodhound instance operates - * on it. Defaults to the identity function. - * - * @param response Prefetch response. - * @returns Transform response. - */ - transform?: (response: JQueryPromise) => JQueryPromise; - } - - /** - * Bloodhound only goes to the network when the internal search engine cannot - * provide a sufficient number of results. In order to prevent an obscene - * number of requests being made to the remote endpoint, requests are rate-limited. - */ - interface RemoteOptions { - /** - * The URL remote data should be loaded from. - */ - url: string; - - /** - * A function that provides a hook to allow you to prepare the settings - * object passed to transport when a request is about to be made. - * The function signature should be prepare(query, settings), where query - * is the query #search was called with and settings is the default settings - * object created internally by the Bloodhound instance. The prepare function - * should return a settings object. Defaults to the identity function. - * - * @param query The query #search was called with. - * @param settings The default settings object created internally by Bloodhound. - * @returns A JqueryAjaxSettings object. - */ - prepare?: (query: string, settings: JQueryAjaxSettings) => JQueryAjaxSettings; - - /** - * A convenience option for prepare. If set, prepare will be a function - * that replaces the value of this option in url with the URI encoded query. - */ - wildcard?: string; - - /** - * The method used to rate-limit network requests. - * Can be either debounce or throttle. Defaults to debounce. - */ - rateLimitby?: string; - - /** - * The time interval in milliseconds that will be used by rateLimitBy. - * Defaults to 300. - */ - rateLimitWait?: number; - - /** - * A function with the signature transform(response) that allows you to - * transform the remote response before the Bloodhound instance operates on it. - * Defaults to the identity function. - * - * @param response Prefetch response. - * @returns Transform response. - */ - transform?: (response: JQueryPromise) => JQueryPromise; - } - - /** - * Build-in tokenization methods. - */ - interface Tokenizers { - /** - * Split a given string on whitespace characters. - */ - whitespace(str: string): string[]; - - /** - * Split a given string on non-word characters. - */ - nonword(str: string): string[]; - - /** - * Instances of the build-in tokenization methods. - */ - obj: ObjTokenizer; - } - - interface ObjTokenizer { - /** - * Split a given string on whitespace characters. - */ - whitespace(str: string): string[]; - - /** - * Split a given string on non-word characters. - */ - nonword(str: string): string[]; - } -} - -/** - * Bloodhound is the typeahead.js suggestion engine. Bloodhound is robust, - * flexible, and offers advanced functionalities such as prefetching, - * intelligent caching, fast lookups, and backfilling with remote data. - */ -declare class Bloodhound { + */ + interface PrefetchOptions { + /** + * The URL prefetch data should be loaded from. + */ + url: string; + + /** + * If false, will not attempt to read or write to local storage and + * will always load prefetch data from url on initialization. Defaults to true. + */ + cache?: boolean; + + /** + * The time (in milliseconds) the prefetched data should be cached in + * local storage. Defaults to 86400000 (1 day). + */ + ttl?: number; + + /** + * The key that data will be stored in local storage under. + * Defaults to value of url. + */ + cacheKey?: string; + + /** + * A string used for thumbprinting prefetched data. If this doesn't + * match what's stored in local storage, the data will be refetched. + */ + thumbprint?: string; + + /** + * A function that provides a hook to allow you to prepare the settings + * object passed to transport when a request is about to be made. + * Defaults to the identity function. + * + * @param settings The default settings object created internally by the Bloodhound instance. + * @returns A settings object. + */ + prepare?: (settings: JQueryAjaxSettings) => JQueryAjaxSettings; + + /** + * A function with the signature transform(response) that allows you to + * transform the prefetch response before the Bloodhound instance operates + * on it. Defaults to the identity function. + * + * @param response Prefetch response. + * @returns Transform response. + */ + transform?: (response: T[]) => T[]; + } + + /** + * Bloodhound only goes to the network when the internal search engine cannot + * provide a sufficient number of results. In order to prevent an obscene + * number of requests being made to the remote endpoint, requests are rate-limited. + */ + interface RemoteOptions { + /** + * The URL remote data should be loaded from. + */ + url: string; + + /** + * A function that provides a hook to allow you to prepare the settings + * object passed to transport when a request is about to be made. + * The function signature should be prepare(query, settings), where query + * is the query #search was called with and settings is the default settings + * object created internally by the Bloodhound instance. The prepare function + * should return a settings object. Defaults to the identity function. + * + * @param query The query #search was called with. + * @param settings The default settings object created internally by Bloodhound. + * @returns A JqueryAjaxSettings object. + */ + prepare?: (query: string, settings: JQueryAjaxSettings) => JQueryAjaxSettings; + + /** + * A convenience option for prepare. If set, prepare will be a function + * that replaces the value of this option in url with the URI encoded query. + */ + wildcard?: string; + + /** + * The method used to rate-limit network requests. + * Can be either debounce or throttle. Defaults to debounce. + */ + rateLimitby?: string; + + /** + * The time interval in milliseconds that will be used by rateLimitBy. + * Defaults to 300. + */ + rateLimitWait?: number; + + /** + * A function with the signature transform(response) that allows you to + * transform the remote response before the Bloodhound instance operates on it. + * Defaults to the identity function. + * + * @param response Prefetch response. + * @returns Transform response. + */ + transform?: (response: T[]) => T[]; + } + + /** + * Build-in tokenization methods. + */ + interface Tokenizers { + /** + * Split a given string on whitespace characters. + */ + whitespace(str: string): string[]; + + /** + * Split a given string on non-word characters. + */ + nonword(str: string): string[]; + + /** + * Instances of the build-in tokenization methods. + */ + obj: ObjTokenizer; + } + + interface ObjTokenizer { + /** + * Split a given string on whitespace characters. + */ + whitespace(str: string): string[]; + + /** + * Split a given string on non-word characters. + */ + nonword(str: string): string[]; + } +} + +/** + * Bloodhound is the typeahead.js suggestion engine. Bloodhound is robust, + * flexible, and offers advanced functionalities such as prefetching, + * intelligent caching, fast lookups, and backfilling with remote data. + */ +declare class Bloodhound { /** * The constructor function. * * @constructor * @param options Options hash. - */ - constructor(options: Bloodhound.BloodhoundOptions); - - /** - * Returns a reference to Bloodhound and reverts window.Bloodhound to its - * previous value. Can be used to avoid naming collisions. - */ - public static noConflict(): any; - - /** - * The Bloodhound suggestion engine is token-based, so how datums and queries are tokenized plays a vital role in the quality of search results. - * Specify how you want datums and queries tokenized. - */ - public static tokenizers: Bloodhound.Tokenizers; - - /** - * Kicks off the initialization of the suggestion engine. Initialization - * entails adding the data provided by local and prefetch to the internal - * search index as well as setting up transport mechanism used by remote. - * Before #initialize is called, the #get and #search methods will effectively be no-ops. - * - * Note, unless the initialize option is false, this method is implicitly called by the constructor. - * - * After initialization, how subsequent invocations of #initialize behave depends on - * the reinitialize argument. If reinitialize is falsy, the method will not execute the - * initialization logic and will just return the same jQuery promise returned - * by the initial invocation. If reinitialize is truthy, the method will behave - * as if it were being called for the first time. - * - * @param reinitialize How subsequent invocations of #initialize will behave. - * @returns jQuery promise. - */ - public initialize(reinitialize?: boolean): JQueryPromise; - - /** - * Takes one argument, data, which is expected to be an array. - * The data passed in will get added to the internal search index. - * - * @param data Data to be added to the internal search index. - */ - public add(data: T[]): void; - - /** - * Returns the data in the local search index corresponding to ids. - * - * @param ids Data ids. - * @returns The corresponding data. - */ - public get(ids: number[]): T[]; - - /** - * Returns the data that matches query. Matches found in the local search - * index will be passed to the sync callback. If the data passed to sync - * doesn't contain at least sufficient number of datums, remote data will - * be requested and then passed to the async callback. - * - * @param query Query. - * @param sync Sync callback - * @param async Async callback. - * @returns The data that matches query. - */ - public search(query: string, sync: (datums: T[]) => void, async: (datums: T[]) => void): T[]; - + */ + constructor(options: Bloodhound.BloodhoundOptions); + + /** + * Returns a reference to Bloodhound and reverts window.Bloodhound to its + * previous value. Can be used to avoid naming collisions. + */ + public static noConflict(): any; + + /** + * The Bloodhound suggestion engine is token-based, so how datums and queries are tokenized plays a vital role in the quality of search results. + * Specify how you want datums and queries tokenized. + */ + public static tokenizers: Bloodhound.Tokenizers; + + /** + * Kicks off the initialization of the suggestion engine. Initialization + * entails adding the data provided by local and prefetch to the internal + * search index as well as setting up transport mechanism used by remote. + * Before #initialize is called, the #get and #search methods will effectively be no-ops. + * + * Note, unless the initialize option is false, this method is implicitly called by the constructor. + * + * After initialization, how subsequent invocations of #initialize behave depends on + * the reinitialize argument. If reinitialize is falsy, the method will not execute the + * initialization logic and will just return the same jQuery promise returned + * by the initial invocation. If reinitialize is truthy, the method will behave + * as if it were being called for the first time. + * + * @param reinitialize How subsequent invocations of #initialize will behave. + * @returns jQuery promise. + */ + public initialize(reinitialize?: boolean): JQueryPromise; + + /** + * Takes one argument, data, which is expected to be an array. + * The data passed in will get added to the internal search index. + * + * @param data Data to be added to the internal search index. + */ + public add(data: T[]): void; + + /** + * Returns the data in the local search index corresponding to ids. + * + * @param ids Data ids. + * @returns The corresponding data. + */ + public get(ids: number[]): T[]; + + /** + * Returns the data that matches query. Matches found in the local search + * index will be passed to the sync callback. If the data passed to sync + * doesn't contain at least sufficient number of datums, remote data will + * be requested and then passed to the async callback. + * + * @param query Query. + * @param sync Sync callback + * @param async Async callback. + * @returns The data that matches query. + */ + public search(query: string, sync: (datums: T[]) => void, async: (datums: T[]) => void): T[]; + /** * Returns all items from the internal search index. - */ - public all(): T[]; - - /** - * Clears the internal search index that's powered by local, prefetch, and #add. - */ - public clear(): Bloodhound; - - /** - * If you're using prefetch, data gets cached in local storage in an effort to cut down on unnecessary network requests. - * clearPrefetchCache offers a way to programmatically clear said cache. - */ - public clearPrefetchCache(): Bloodhound; - - /** - * If you're using remote, Bloodhound will cache the 10 most recent responses in an effort to provide a better user experience. - * clearRemoteCache offers a way to programmatically clear said cache. - */ - public clearRemoteCache(): Bloodhound; -} - -declare module "bloodhound" { - export = Bloodhound; -} + */ + public all(): T[]; + + /** + * Clears the internal search index that's powered by local, prefetch, and #add. + */ + public clear(): Bloodhound; + + /** + * If you're using prefetch, data gets cached in local storage in an effort to cut down on unnecessary network requests. + * clearPrefetchCache offers a way to programmatically clear said cache. + */ + public clearPrefetchCache(): Bloodhound; + + /** + * If you're using remote, Bloodhound will cache the 10 most recent responses in an effort to provide a better user experience. + * clearRemoteCache offers a way to programmatically clear said cache. + */ + public clearRemoteCache(): Bloodhound; +} + +declare module "bloodhound" { + export = Bloodhound; +} From 2acb434381b9182f391a5b9e5779de425eded757 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Thu, 14 Jan 2016 23:50:59 +1100 Subject: [PATCH 369/441] expanded upon event API --- google.analytics/ga-tests.ts | 10 ++++++++++ google.analytics/ga.d.ts | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/google.analytics/ga-tests.ts b/google.analytics/ga-tests.ts index ba4f80dea9..226d1432b6 100644 --- a/google.analytics/ga-tests.ts +++ b/google.analytics/ga-tests.ts @@ -23,6 +23,16 @@ describe('UniversalAnalytics', () => { ga('create', 'UA-65432-1', 'auto', {some: 'config'}); ga('send', 'pageview'); ga('send', 'pageview', {some: 'details'}); + ga('send', 'event', 'Videos', 'play', 'Fall Campaign'); + ga('send', {hitType: 'event', eventCategory: 'Videos', eventAction: 'play', eventLabel: 'Fall Campaign'}); + ga('send', 'event', 'Videos', 'play', 'Fall Campaign', {nonInteraction: true}); + ga('send', 'pageview', '/page'); + ga('send', 'social', {'socialNetwork': 'facebook', 'socialAction': 'like', 'socialTarget': 'http://foo.com'}); + ga('send', 'social', {'socialNetwork': 'google+', 'socialAction': 'plus', 'socialTarget': 'http://foo.com'}); + ga('send', 'timing', {'timingCategory': 'category', 'timingVar': 'lookup', 'timingValue': 123}); + ga('send', 'timing', {'timingCategory': 'category', 'timingVar': 'lookup', 'timingValue': 123, 'timingLabel': 'label'}); + ga('trackerName.send', 'event', 'load'); + ga.create('UA-65432-1', 'auto'); ga.create('UA-65432-1', {some: 'config'}); ga.create('UA-65432-1', 'auto', {some: 'config'}); diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index a8e1b1e252..9fc9d34cc9 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -36,15 +36,48 @@ interface GoogleAnalytics { async: boolean; } +enum HitType { + 'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing' +} + declare module UniversalAnalytics { // https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference interface ga { l: number; q: any[]; + + (command: 'send', hitType: 'event', eventCategory: string, eventAction: string, + eventLabel?: string, eventValue?: number, fieldsObject?: {} ): void; + (command: 'send', hitType: 'event', fieldsObject: { + eventCategory: string + eventAction: string, + eventLabel?: string, + eventValue?: number, + nonInteraction?: boolean}): void; + (command: 'send', fieldsObject: { + hitType: 'event', + eventCategory: string + eventAction: string, + eventLabel?: string, + eventValue?: number, + nonInteraction?: boolean}): void; + (command: 'send', hitType: 'pageview', page: string): void; + (command: 'send', hitType: 'social', + socialNetwork: string, socialAction: string, socialTarget: string): void; + (command: 'send', hitType: 'social', + fieldsObject: {socialNetwork: string, socialAction: string, socialTarget: string}): void; + (command: 'send', hitType: 'timing', + timingCategory: string, timingVar: string, timingValue: number): void; + (command: 'send', hitType: 'timing', + fieldsObject: {timingCategory: string, timingVar: string, timingValue: number}): void; + (command: 'send', hitType: HitType, ...fields): void; + (command: 'send', fieldsObject: {}): void; + + (command: string, hitDetails: {}): void; (command: string, poly: string, opt_poly?: {}): UniversalAnalytics.Tracker; (command: string, trackingId: string, auto: string, opt_configObject?: {}): UniversalAnalytics.Tracker; - (command: string, hitDetails: {}): void; + create(trackingId: string, opt_configObject?: {}): UniversalAnalytics.Tracker; create(trackingId: string, auto: string, opt_configObject?: {}): UniversalAnalytics.Tracker; getAll(): UniversalAnalytics.Tracker[]; From ac5fc67d21f6438c7cab98fa0406de8d5ae76c2b Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Thu, 14 Jan 2016 23:54:30 +1100 Subject: [PATCH 370/441] expanded upon event API --- google.analytics/ga-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/google.analytics/ga-tests.ts b/google.analytics/ga-tests.ts index 226d1432b6..dd03e0d253 100644 --- a/google.analytics/ga-tests.ts +++ b/google.analytics/ga-tests.ts @@ -24,9 +24,9 @@ describe('UniversalAnalytics', () => { ga('send', 'pageview'); ga('send', 'pageview', {some: 'details'}); ga('send', 'event', 'Videos', 'play', 'Fall Campaign'); - ga('send', {hitType: 'event', eventCategory: 'Videos', eventAction: 'play', eventLabel: 'Fall Campaign'}); - ga('send', 'event', 'Videos', 'play', 'Fall Campaign', {nonInteraction: true}); - ga('send', 'pageview', '/page'); + ga('send', {hitType: 'event', eventCategory: 'Videos', eventAction: 'play', eventLabel: 'Fall Campaign'}); + ga('send', 'event', 'Videos', 'play', 'Fall Campaign', {nonInteraction: true}); + ga('send', 'pageview', '/page'); ga('send', 'social', {'socialNetwork': 'facebook', 'socialAction': 'like', 'socialTarget': 'http://foo.com'}); ga('send', 'social', {'socialNetwork': 'google+', 'socialAction': 'plus', 'socialTarget': 'http://foo.com'}); ga('send', 'timing', {'timingCategory': 'category', 'timingVar': 'lookup', 'timingValue': 123}); From c2eb5ac249145f436ef7998f044a9edf2fb0b856 Mon Sep 17 00:00:00 2001 From: Lucas Woo Date: Thu, 14 Jan 2016 21:49:31 +0800 Subject: [PATCH 371/441] add definitions for https://github.com/markbao/speakeasy --- speakeasy/speakeasy-test.ts | 26 +++++++++++++++++++ speakeasy/speakeasy.d.ts | 51 +++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 speakeasy/speakeasy-test.ts create mode 100644 speakeasy/speakeasy.d.ts diff --git a/speakeasy/speakeasy-test.ts b/speakeasy/speakeasy-test.ts new file mode 100644 index 0000000000..ae483bb8ee --- /dev/null +++ b/speakeasy/speakeasy-test.ts @@ -0,0 +1,26 @@ +/// + +import speakeasy = require('speakeasy'); + +speakeasy.generate_key({length: 20, google_auth_qr: true}); + +// normal use. +speakeasy.hotp({key: 'secret', counter: 582}); + +// use a custom length. +speakeasy.hotp({key: 'secret', counter: 582, length: 8}); + +// use a custom encoding. +speakeasy.hotp({key: 'AJFIEJGEHIFIU7148SF', counter: 147, encoding: 'base32'}); + +// normal use. +speakeasy.totp({key: 'secret'}); + +// use a custom time step. +speakeasy.totp({key: 'secret', step: 60}); + +// use a custom time. +speakeasy.totp({key: 'secret', time: 159183717}); + +// use a initial time. +speakeasy.totp({key: 'secret', initial_time: 4182881485}); diff --git a/speakeasy/speakeasy.d.ts b/speakeasy/speakeasy.d.ts new file mode 100644 index 0000000000..4017c4f7eb --- /dev/null +++ b/speakeasy/speakeasy.d.ts @@ -0,0 +1,51 @@ +// Type definitions for speakeasy v1.0.4 +// Project: https://github.com/markbao/speakeasy +// Definitions by: Lucas Woo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "speakeasy" { + + interface IKey { + ascii: string; + base32: string; + hex: string; + qr_code_ascii: string; + qr_code_hex: string; + qr_code_base32: string; + google_auth_qr: string; + } + + interface GenerateOptions { + length?: number; + symbols?: boolean; + qr_codes?: boolean; + google_auth_qr?: boolean; + name?: string; + } + + interface TotpOptions { + key: string; + step?: number; + time?: number; + initial_time?: number; + length?: number; + encoding?: string; + } + + interface HotpOptions { + key: string; + counter: number; + length?: number; + encoding?: string; + } + + export function generate_key(options: GenerateOptions): IKey; + + export function hotp(options: HotpOptions): string; + + export function counter(options: HotpOptions): string; + + export function totp(options: TotpOptions): string; + + export function time(options: TotpOptions): string; +} From ef1741f3d614a6da73e3a46d4dc191def7e645a4 Mon Sep 17 00:00:00 2001 From: D062356 Date: Thu, 14 Jan 2016 08:48:25 -0800 Subject: [PATCH 372/441] Added missing indexOf function and constructor to buffer --- node/node-tests.ts | 10 ++++++++++ node/node.d.ts | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/node/node-tests.ts b/node/node-tests.ts index 9aebe5c53c..8faf5fed62 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -134,6 +134,7 @@ function bufferTests() { var base64Buffer = new Buffer('','base64'); var octets: Uint8Array = null; var octetBuffer = new Buffer(octets); + var copiedBuffer = new Buffer(utf8Buffer); console.log(Buffer.isBuffer(octetBuffer)); console.log(Buffer.isEncoding('utf8')); console.log(Buffer.byteLength('xyz123')); @@ -159,6 +160,15 @@ function bufferTests() { // fill returns the input buffer. b.fill('a').fill('b'); + + { + let buffer = new Buffer('123'); + let index: number; + index = buffer.indexOf("23"); + index = buffer.indexOf("23", 1); + index = buffer.indexOf(23); + index = buffer.indexOf(buffer); + } } diff --git a/node/node.d.ts b/node/node.d.ts index a7f1a1617e..928b823e59 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -113,6 +113,12 @@ declare var Buffer: { * @param array The octets to store. */ new (array: any[]): Buffer; + /** + * Copies the passed {buffer} data onto a new {Buffer} instance. + * + * @param buffer The buffer to copy. + */ + new (buffer: Buffer): Buffer; prototype: Buffer; /** * Returns true if {obj} is a Buffer @@ -395,6 +401,7 @@ interface NodeBuffer { writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; fill(value: any, offset?: number, end?: number): Buffer; + indexOf(value: string | number | Buffer, byteOffset?: number): number; } /************************************************ From a1c9ad7d5be39cad7d32a725286b0769af567ad4 Mon Sep 17 00:00:00 2001 From: Jean-Philipe Pellerin Date: Thu, 14 Jan 2016 15:51:30 -0500 Subject: [PATCH 373/441] Added the object in the auth additional configuration options. These changes are based on the braking changes introduced in hapi 12.0.0. --- hapi/hapi.d.ts | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index b31c24b163..aa814fcc32 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -395,21 +395,19 @@ declare module "hapi" { 'required'authentication is required. 'optional'authentication is optional (must be valid if present). 'try'same as 'optional' but allows for invalid authentication. */ - mode: string; + mode?: string; /** a string array of strategy names in order they should be attempted.If only one strategy is used, strategy can be used instead with the single string value.Defaults to the default authentication strategy which is available only when a single strategy is configured. */ - strategies: string | Array; + strategies?: string | Array; /** if set, the payload (in requests other than 'GET' and 'HEAD') is authenticated after it is processed.Requires a strategy with payload authentication support (e.g.Hawk).Cannot be set to a value other than 'required' when the scheme sets the options.payload to true.Available values: falseno payload authentication.This is the default value. 'required'payload authentication required.This is the default value when the scheme sets options.payload to true. 'optional'payload authentication performed only when the client includes payload authentication information (e.g.hash attribute in Hawk). */ payload?: string; - /** the application scope required to access the route.Value can be a scope string or an array of scope strings.The authenticated credentials object scope property must contain at least one of the scopes defined to access the route.Set to false to remove scope requirements.Defaults to no scope required. */ - scope?: string|Array|boolean; - /** the required authenticated entity type.If set, must match the entity value of the authentication credentials.Available values: - anythe authentication can be on behalf of a user or application.This is the default value. - userthe authentication must be on behalf of a user. - appthe authentication must be on behalf of an application. */ - entity?: string; + /** + * an object or array of objects specifying the route access rules. Each rule is evaluated against an incoming + * request and access is granted if at least one rule matches. Each rule object must include at least one of: + */ + access?: IRouteAdditionalConfigurationAuthAccess | IRouteAdditionalConfigurationAuthAccess[]; }; /** an object passed back to the provided handler (via this) when called. */ bind?: any; @@ -640,6 +638,29 @@ declare module "hapi" { */ tags?: string[] } + + /** + * specifying the route access rules. Each rule is evaluated against an incoming request and access is granted if at least one rule matches + */ + export interface IRouteAdditionalConfigurationAuthAccess { + /** + * the application scope required to access the route. Value can be a scope string or an array of scope strings. + * The authenticated credentials object scope property must contain at least one of the scopes defined to access the route. + * If a scope string begins with a + character, that scope is required. If a scope string begins with a ! character, + * that scope is forbidden. For example, the scope ['!a', '+b', 'c', 'd'] means the incoming request credentials' + * scope must not include 'a', must include 'b', and must include on of 'c' or 'd'. You may also access properties + * on the request object (query and params} to populate a dynamic scope by using {} characters around the property name, + * such as 'user-{params.id}'. Defaults to false (no scope requirements). + */ + scope?: string|Array|boolean; + /** the required authenticated entity type. If set, must match the entity value of the authentication credentials. Available values: + * any - the authentication can be on behalf of a user or application. This is the default value. + * user - the authentication must be on behalf of a user which is identified by the presence of a user attribute in the credentials object returned by the authentication strategy. + * app - the authentication must be on behalf of an application which is identified by the lack of presence of a user attribute in the credentials object returned by the authentication strategy. + */ + entity?: string; + } + /** server.realm http://hapijs.com/api#serverrealm The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin). From 6e2b3966c7656379784f5bf54f0711b227df766b Mon Sep 17 00:00:00 2001 From: igochkov Date: Thu, 14 Jan 2016 23:43:19 +0100 Subject: [PATCH 374/441] Complete rewrite of the typeahead tests to reflect latest 0.11.1 typeahead documentation --- typeahead/typeahead-tests.ts | 717 +++++++++++++++++++++-------------- typeahead/typeahead.d.ts | 7 +- 2 files changed, 446 insertions(+), 278 deletions(-) diff --git a/typeahead/typeahead-tests.ts b/typeahead/typeahead-tests.ts index ec2b2e2f3d..be2f3b34b1 100644 --- a/typeahead/typeahead-tests.ts +++ b/typeahead/typeahead-tests.ts @@ -1,302 +1,469 @@ /// /// -// -// Examples from http://twitter.github.com/typeahead.js/examples -// - -var substringMatcher = function (strs: any) { - return function findMatches(q: string, syncResults: (x: Array) => void) { - var matches: Array<{ value: string }> = []; - // regex used to determine if a string contains the substring `q` - var 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 }); - } - }); - - syncResults(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' -]; - - -function test_method_names() { - $('#the-basics .typeahead').typeahead('destroy'); - $('#the-basics .typeahead').typeahead('open'); - $('#the-basics .typeahead').typeahead('close'); - $('#the-basics .typeahead').typeahead('val'); - $('#the-basics .typeahead').typeahead('val', 'test value'); -} - - -function test_options() { - - var dataSets: Twitter.Typeahead.Dataset[] = []; - - function with_empty_options() { - $('#the-basics .typeahead').typeahead({}, dataSets); - } - - function with_hint_option() { - $('#the-basics .typeahead').typeahead({ hint: true }, dataSets); - } - - function with_highlight_option() { - $('#the-basics .typeahead').typeahead({ highlight: true }, dataSets); - } - - function with_minLength_option() { - $('#the-basics .typeahead').typeahead({ minLength: 1 }, dataSets); - } - - function with_all_options() { - $('#the-basics .typeahead').typeahead({ - hint: true, - highlight: true, - minLength: 1 - }, - dataSets - ); - } -} - -function test_datasets_array() { - +function test_typeahead() { var options: Twitter.Typeahead.Options = {}; + var dataset: Twitter.Typeahead.Dataset = { source: null }; - function with_only_source() { - $('#the-basics .typeahead').typeahead(options, [{ - source: substringMatcher(states) - }]); + function test_typeahead_methods() { + $('.typeahead').typeahead(options, dataset); + $('.typeahead').typeahead(options, new Array(dataset)); + $('.typeahead').typeahead('val'); + $('.typeahead').typeahead('val', 'test value'); + $('.typeahead').typeahead('open'); + $('.typeahead').typeahead('close'); + $('.typeahead').typeahead('destroy'); } - function with_name_option() { + function test_typeahead_options() { + function options_empty() { + $('.typeahead').typeahead({}, dataset); + } - $('#the-basics .typeahead').typeahead(options, [{ - name: 'states', - source: substringMatcher(states), - }]); + function test_typeahead_option_hint() { + $('.typeahead').typeahead({ hint: true }, dataset); + } + + function test_typeahead_option_minLength() { + $('.typeahead').typeahead({ minLength: 1 }, dataset); + } + + function test_typeahead_option_highlight() { + $('.typeahead').typeahead({ highlight: true }, dataset); + } + + function test_typeahead_option_classNames() { + $('.typeahead').typeahead({ classNames: { input: 'tt-input' } }, dataset); + } + + function test_typeahead_options_all() { + $('.typeahead').typeahead({ + hint: true, + minLength: 1, + highlight: true, + classNames: { input: 'tt-input' } + }, dataset); + } } - function with_displayKey_option() { - $('#the-basics .typeahead').typeahead(options, [{ - display: 'value', - source: substringMatcher(states) - }] - ); + function test_typeahead_classNames() { + function test_typeahead_classNames_empty() { + var className: Twitter.Typeahead.ClassNames = {}; + } + + function test_typeahead_className_input() { + var className: Twitter.Typeahead.ClassNames = { input: 'tt-input' }; + } + + function test_typeahead_className_hint() { + var className: Twitter.Typeahead.ClassNames = { hint: 'tt-hint' }; + } + + function test_typeahead_className_menu() { + var className: Twitter.Typeahead.ClassNames = { menu: 'tt-menu' }; + } + + function test_typeahead_className_dataset() { + var className: Twitter.Typeahead.ClassNames = { dataset: 'tt-dataset' }; + } + + function test_typeahead_className_suggestion() { + var className: Twitter.Typeahead.ClassNames = { suggestion: 'tt-suggestion' }; + } + + function test_typeahead_className_empty() { + var className: Twitter.Typeahead.ClassNames = { empty: 'tt-empty' }; + } + + function test_typeahead_className_open() { + var className: Twitter.Typeahead.ClassNames = { open: 'tt-open' }; + } + + function test_typeahead_className_cursor() { + var className: Twitter.Typeahead.ClassNames = { cursor: 'tt-cursor' }; + } + + function test_typeahead_className_highlight() { + var className: Twitter.Typeahead.ClassNames = { highlight: 'tt-highlight' }; + } + + function test_typeahead_classNames_all() { + var className: Twitter.Typeahead.ClassNames = { + input: 'tt-input', + hint: 'tt-hint', + menu: 'tt-menu', + dataset: 'tt-dataset', + suggestion: 'tt-suggestion', + empty: 'tt-empty', + open: 'tt-open', + cursor: 'tt-cursor', + highlight: 'tt-highlight' + }; + } } - function with_templates_option() { - $('#the-basics .typeahead').typeahead(options, [{ - templates: {}, - source: substringMatcher(states) - }] - ); + function test_typeahead_datasets() { + function test_typeahead_dataset_source_bloodhout() { + var bo: Bloodhound.BloodhoundOptions = { datumTokenizer: null, queryTokenizer: null }; + var engine: Bloodhound = new Bloodhound(bo); + var dataset: Twitter.Typeahead.Dataset = { source: engine }; + } + + function test_typeahead_dataset_source_function() { + var dataset: Twitter.Typeahead.Dataset = { source: (query: string, syncResults: (result: string[]) => void, asyncResults?: (result: string[]) => void) => { } }; + } + + function test_typeahead_dataset_async() { + var dataset: Twitter.Typeahead.Dataset = { + source: null, + async: true + }; + } + + function test_typeahead_dataset_name() { + var dataset: Twitter.Typeahead.Dataset = { + source: null, + name: 'name' + }; + } + + function test_typeahead_dataset_limit() { + var dataset: Twitter.Typeahead.Dataset = { + source: null, + limit: 5 + }; + } + + function test_typeahead_dataset_display_string() { + var dataset: Twitter.Typeahead.Dataset = { + source: null, + display: "key" + }; + } + + function test_typeahead_dataset_display_function() { + var dataset: Twitter.Typeahead.Dataset = { + source: null, + display: (obj: string) => { return 'key'; } + }; + } } - function with_all_options() { - $('#the-basics .typeahead').typeahead(options, [{ - name: 'states', - display: 'value', - templates: {}, - source: substringMatcher(states) - }] - ); - } + function test_typeahead_templates() { + function test_typeahead_templates_empty() { + var templates: Twitter.Typeahead.Templates = {}; + } - function with_multiple_datasets() { - $('#the-basics .typeahead').typeahead(options, [ - { - name: 'states', - display: 'value', - templates: {}, - source: substringMatcher(states) - }, - { - name: 'states alternative', - display: 'value', - templates: {}, - source: substringMatcher(states) - } - ]); + function dataset_template_notfound_string() { + var templates: Twitter.Typeahead.Templates = { notFound: 'not found' }; + } + + function dataset_template_notfound_function() { + var templates: Twitter.Typeahead.Templates = { notFound: (query: string) => { return 'not found'; } }; + } + + function dataset_template_pending_string() { + var templates: Twitter.Typeahead.Templates = { pending: 'pending' }; + } + + function dataset_template_pending_function() { + var templates: Twitter.Typeahead.Templates = { pending: (query: string) => { return 'pending'; } }; + } + + function dataset_template_header_string() { + var templates: Twitter.Typeahead.Templates = { header: 'header' }; + } + + function dataset_template_header_function() { + var templates: Twitter.Typeahead.Templates = { header: (query: string) => { return 'header'; } }; + } + + function dataset_template_footer_string() { + var templates: Twitter.Typeahead.Templates = { footer: 'footer' }; + } + + function dataset_template_footer_function() { + var templates: Twitter.Typeahead.Templates = { footer: (query: string) => { return 'footer'; } }; + } + + function dataset_template_suggestion() { + var templates: Twitter.Typeahead.Templates = { suggestion: (suggestion: string) => { return 'suggestion'; } }; + } } } +function test_bloodhout() { + var options: Bloodhound.BloodhoundOptions = { datumTokenizer: null, queryTokenizer: null }; + var engine: Bloodhound = new Bloodhound(options); -function test_datasets_objects() { - - var options: Twitter.Typeahead.Options = {}; - - function with_only_source() { - $('#the-basics .typeahead').typeahead(options, { - source: substringMatcher(states) - }); + function test_bloodhout_static() { + var old: Bloodhound = Bloodhound.noConflict(); + var tokenizers: Bloodhound.Tokenizers = Bloodhound.tokenizers; } - function with_name_option() { + function test_bloodhout_methods() { + // initialize + var promise1: JQueryPromise = engine.initialize(); + var promise2: JQueryPromise = engine.initialize(); + var promise3: JQueryPromise = engine.initialize(true); - $('#the-basics .typeahead').typeahead(options, { - name: 'states', - source: substringMatcher(states), - }); + // add + engine.add(new Array()); + + // get + var data1: string[] = engine.get(new Array()); + + // search + var sync: (datums: string[]) => {}; + var async: (datums: string[]) => {}; + var data2: string[] = engine.search("query", sync, async); + + // all + var data3: string[] = engine.all(); + + // clear + var engine1: Bloodhound = engine.clear(); + + // clearPrefetchCache + var engine2: Bloodhound = engine.clearPrefetchCache(); + + // clearRemoteCache + var engine3: Bloodhound = engine.clearRemoteCache(); } - function with_displayKey_option() { - $('#the-basics .typeahead').typeahead(options, - { - display: 'value', - source: substringMatcher(states) + function test_bloodhout_options() { + function test_bloodhout_options_datumTokenizer() { + var options: Bloodhound.BloodhoundOptions = { + datumTokenizer: (datum: string) => { return new Array(); }, + queryTokenizer: null + }; + } + + function test_bloodhout_options_queryTokenizer() { + var options: Bloodhound.BloodhoundOptions = { + datumTokenizer: null, + queryTokenizer: (query: string) => { return new Array(); } + }; + } + + function test_bloodhout_options_initialize() { + var options: Bloodhound.BloodhoundOptions = { + datumTokenizer: null, + queryTokenizer: null, + initialize: true + }; + } + + function test_bloodhout_options_sufficient() { + var options: Bloodhound.BloodhoundOptions = { + datumTokenizer: null, + queryTokenizer: null, + sufficient: 5 + }; + } + + function test_bloodhout_options_sorter() { + var options: Bloodhound.BloodhoundOptions = { + datumTokenizer: null, + queryTokenizer: null, + sorter: (a: string, b: string) => { return 0 } + }; + } + + function test_bloodhout_options_local_array() { + var options: Bloodhound.BloodhoundOptions = { + datumTokenizer: null, + queryTokenizer: null, + local: new Array() + }; + } + + function test_bloodhout_options_local_function() { + var options: Bloodhound.BloodhoundOptions = { + datumTokenizer: null, + queryTokenizer: null, + local: () => { return new Array() } + }; + } + + function test_bloodhout_options_prefetch_string() { + var options: Bloodhound.BloodhoundOptions = { + datumTokenizer: null, + queryTokenizer: null, + prefetch: 'url' + }; + } + + function test_bloodhout_options_prefetch_object() { + var options: Bloodhound.BloodhoundOptions = { + datumTokenizer: null, + queryTokenizer: null, + prefetch: { url: 'url' } + }; + } + + function test_bloodhout_options_remote_string() { + var options: Bloodhound.BloodhoundOptions = { + datumTokenizer: null, + queryTokenizer: null, + remote: 'url' + }; + } + + function test_bloodhout_options_remote_object() { + var options: Bloodhound.BloodhoundOptions = { + datumTokenizer: null, + queryTokenizer: null, + remote: { url: 'url' } + }; + } + + function test_bloodhout_options_all() { + var options: Bloodhound.BloodhoundOptions = { + datumTokenizer: (datum: string) => { return new Array(); }, + queryTokenizer: (query: string) => { return new Array(); }, + initialize: true, + sufficient: 5, + sorter: (a: string, b: string) => { return 0 }, + local: () => { return new Array() }, + prefetch: { url: 'url' }, + remote: { url: 'url' } + }; + } + } + + function test_bloodhout_prefetch_options() { + function test_bloodhout_prefetch_options_url() { + var options: Bloodhound.PrefetchOptions = { + url: 'url' + }; + } + + function test_bloodhout_prefetch_options_cache() { + var options: Bloodhound.PrefetchOptions = { + url: 'url', + cache: true + }; + } + + function test_bloodhout_prefetch_options_ttl() { + var options: Bloodhound.PrefetchOptions = { + url: 'url', + ttl: 86400000 // 1 day + }; + } + + function test_bloodhout_prefetch_options_cacheKey() { + var options: Bloodhound.PrefetchOptions = { + url: 'url', + cacheKey: 'url' + }; + } + + function test_bloodhout_prefetch_options_thumbprint() { + var options: Bloodhound.PrefetchOptions = { + url: 'url', + thumbprint: 'thumbprint' + }; + } + + function test_bloodhout_prefetch_options_prepare() { + var ajaxSettings: JQueryAjaxSettings = { url: 'url' }; + + var options: Bloodhound.PrefetchOptions = { + url: 'url', + prepare: (settings: JQueryAjaxSettings) => { return ajaxSettings; } + }; + } + + function test_bloodhout_prefetch_options_transform() { + var options: Bloodhound.PrefetchOptions = { + url: 'url', + transform: (response: string[]) => { return new Array(); } + }; + } + + function test_bloodhout_prefetch_options_all() { + var ajaxSettings: JQueryAjaxSettings = { url: 'url' }; + + var options: Bloodhound.PrefetchOptions = { + url: 'url', + cache: true, + ttl: 86400000, + cacheKey: 'url', + thumbprint: 'thumbprint', + prepare: (settings: JQueryAjaxSettings) => { return ajaxSettings; }, + transform: (response: string[]) => { return new Array(); } + }; + } + } + + function test_bloodhout_remote_options() { + function test_bloodhout_remote_options_url() { + var options: Bloodhound.RemoteOptions = { + url: 'url' + }; + } + + function test_bloodhout_remote_options_prepare() { + var ajaxSettings: JQueryAjaxSettings = { url: 'url' }; + + var options: Bloodhound.RemoteOptions = { + url: 'url', + prepare: (query: string, settings: JQueryAjaxSettings) => { return ajaxSettings; } + }; + } + + function test_bloodhout_remote_options_wildcard() { + var options: Bloodhound.RemoteOptions = { + url: 'url', + wildcard: '%QUERY' + }; + } + + function test_bloodhout_remote_options_rateLimitby() { + var options: Bloodhound.RemoteOptions = { + url: 'url', + rateLimitby: 'debounce' + }; + } + + function test_bloodhout_remote_options_rateLimitWait() { + var options: Bloodhound.RemoteOptions = { + url: 'url', + rateLimitWait: 300 + }; + } + + function test_bloodhout_remote_options_transform() { + var options: Bloodhound.RemoteOptions = { + url: 'url', + transform: (response: string[]) => { return new Array(); } + }; + } + + function test_bloodhout_remote_options_all() { + var ajaxSettings: JQueryAjaxSettings = { url: 'url' }; + + var options: Bloodhound.RemoteOptions = { + url: 'url', + prepare: (query: string, settings: JQueryAjaxSettings) => { return ajaxSettings; }, + wildcard: '%QUERY', + rateLimitby: 'debounce', + rateLimitWait: 300, + transform: (response: string[]) => { return new Array(); } + }; + } + } + + function test_bloodhout_tokenizers() { + var tokenizers: Bloodhound.Tokenizers = { + whitespace: (str: string) => { return new Array(); }, + nonword: (str: string) => { return new Array(); }, + obj: { + whitespace: (str: string) => { return new Array(); }, + nonword: (str: string) => { return new Array(); } } - ); + }; } - - function with_templates_option() { - $('#the-basics .typeahead').typeahead(options, - { - templates: {}, - source: substringMatcher(states) - } - ); - } - - function with_all_options() { - $('#the-basics .typeahead').typeahead(options, - { - name: 'states', - display: x => x.value, - templates: {}, - source: substringMatcher(states) - } - ); - } - - function with_multiple_objects() { - $('#the-basics .typeahead').typeahead(options, - { - name: 'states', - display: 'value', - templates: {}, - source: substringMatcher(states) - }, - { - name: 'states alternative', - display: 'value', - templates: {}, - source: substringMatcher(states) - } - ); - } -} - -function test_dataset_templates() { - - var options: Twitter.Typeahead.Options = {}; - - function with_no_options() { - $('#the-basics .typeahead').typeahead(options, { - source: substringMatcher(states), - templates: {} - }); - } - - function with_empty_option() { - $('#the-basics .typeahead').typeahead(options, { - source: substringMatcher(states), - templates: { empty: 'no results' } - }); - } - - function with_empty_option_as_a_function() { - $('#the-basics .typeahead').typeahead(options, { - source: substringMatcher(states), - templates: { - empty: function (context: any) { - return context.name; - } - } - }); - } - - function with_footer_option() { - $('#the-basics .typeahead').typeahead(options, { - source: substringMatcher(states), - templates: { footer: 'custom footer' } - }); - } - - function with_footer_option_as_a_function() { - $('#the-basics .typeahead').typeahead(options, { - source: substringMatcher(states), - templates: { - footer: function (context: any) { - return context.name; - } - } - }); - } - - function with_header_option() { - $('#the-basics .typeahead').typeahead(options, { - source: substringMatcher(states), - templates: { header: 'custom header' } - }); - } - - function with_header_option_as_a_function() { - $('#the-basics .typeahead').typeahead(options, { - source: substringMatcher(states), - templates: { - header: function (context: any) { - return context.name; - } - } - }); - } - - function with_suggestion_option() { - $('#the-basics .typeahead').typeahead(options, { - source: substringMatcher(states), - templates: { - suggestion: function (context) { - return context.name; - } - } - }); - } - - function with_all_options() { - $('#the-basics .typeahead').typeahead(options, { - source: substringMatcher(states), - templates: { - empty: 'no results', - footer: 'custom footer', - header: 'custom header', - suggestion: function (context) { - return context.name; - } - }, - }); - } -} - -function test_value() { - var value: string = $('foo').typeahead('val'); - $('foo').typeahead('val', value); } \ No newline at end of file diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index b9228b4304..b842786ccd 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -20,9 +20,10 @@ interface JQuery { * * @constructor * @param options Options hash that's used for configuration - * @param datasets One or more datasets passed as rest parameters. + * @param dataset At least one dataset is required + * @param datasets Rest of the datasets. */ - typeahead(options: Twitter.Typeahead.Options, ...datasets: Twitter.Typeahead.Dataset[]): JQuery; + typeahead(options: Twitter.Typeahead.Options, dataset: Twitter.Typeahead.Dataset, ...datasets: Twitter.Typeahead.Dataset[]): JQuery; /** * Returns the current value of the typeahead. @@ -1122,7 +1123,7 @@ declare class Bloodhound { * Returns a reference to Bloodhound and reverts window.Bloodhound to its * previous value. Can be used to avoid naming collisions. */ - public static noConflict(): any; + public static noConflict(): Bloodhound; /** * The Bloodhound suggestion engine is token-based, so how datums and queries are tokenized plays a vital role in the quality of search results. From da079d9eda78490d8803a3d325c81ed743d84cb4 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Fri, 15 Jan 2016 10:53:32 +1100 Subject: [PATCH 375/441] added missing commas --- google.analytics/ga.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index 9fc9d34cc9..505bb3b493 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -48,16 +48,16 @@ declare module UniversalAnalytics { q: any[]; (command: 'send', hitType: 'event', eventCategory: string, eventAction: string, - eventLabel?: string, eventValue?: number, fieldsObject?: {} ): void; + eventLabel?: string, eventValue?: number, fieldsObject?: {}): void; (command: 'send', hitType: 'event', fieldsObject: { - eventCategory: string + eventCategory: string, eventAction: string, eventLabel?: string, eventValue?: number, nonInteraction?: boolean}): void; (command: 'send', fieldsObject: { hitType: 'event', - eventCategory: string + eventCategory: string, eventAction: string, eventLabel?: string, eventValue?: number, From 1e3e963bf5ea4f36e98a816caa971fe918b74897 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 15 Jan 2016 02:45:07 +0100 Subject: [PATCH 376/441] Options should be inside the namespace --- gulp-autoprefixer/gulp-autoprefixer.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gulp-autoprefixer/gulp-autoprefixer.d.ts b/gulp-autoprefixer/gulp-autoprefixer.d.ts index 4ab8cf40d8..d372358eba 100644 --- a/gulp-autoprefixer/gulp-autoprefixer.d.ts +++ b/gulp-autoprefixer/gulp-autoprefixer.d.ts @@ -6,15 +6,15 @@ /// declare module "gulp-autoprefixer" { - interface Options { - browsers?: string[]; - cascade?: boolean; - remove?: boolean; + namespace autoPrefixer { + interface Options { + browsers?: string[]; + cascade?: boolean; + remove?: boolean; + } } - function autoPrefixer(opts?: Options): NodeJS.ReadWriteStream; - - namespace autoPrefixer {} + function autoPrefixer(opts?: autoPrefixer.Options): NodeJS.ReadWriteStream; export = autoPrefixer; } From f7c3fc2b5a7e469cde0df354838bdf1b889b06c5 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 15 Jan 2016 02:49:28 +0100 Subject: [PATCH 377/441] Options and SizeStream should be inside the namespace --- gulp-size/gulp-size.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/gulp-size/gulp-size.d.ts b/gulp-size/gulp-size.d.ts index 022e9b1713..ba13c55a2c 100644 --- a/gulp-size/gulp-size.d.ts +++ b/gulp-size/gulp-size.d.ts @@ -6,20 +6,20 @@ /// declare module 'gulp-size' { - interface IOptions { - showFiles?: boolean; - gzip?: boolean; - title?: string; + namespace size { + interface Options { + showFiles?: boolean; + gzip?: boolean; + title?: string; + } + + interface SizeStream extends NodeJS.ReadWriteStream { + size: number; + prettySize: string; + } } - interface ISizeStream extends NodeJS.ReadWriteStream { - size: number; - prettySize: string; - } - - function size(options?: IOptions): ISizeStream; - - namespace size {} + function size(options?: size.Options): size.SizeStream; export = size; } From fc5ea7aac41189c376803e19a59e87ec167477b1 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 15 Jan 2016 02:50:07 +0100 Subject: [PATCH 378/441] Fix import --- gulp-rev-replace/gulp-rev-replace-tests.ts | 8 ++++---- gulp-rev-replace/gulp-rev-replace.d.ts | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/gulp-rev-replace/gulp-rev-replace-tests.ts b/gulp-rev-replace/gulp-rev-replace-tests.ts index e7c5d9c180..7610183d86 100644 --- a/gulp-rev-replace/gulp-rev-replace-tests.ts +++ b/gulp-rev-replace/gulp-rev-replace-tests.ts @@ -3,10 +3,10 @@ /// /// -import gulp = require('gulp'); -import revReplace = require('gulp-rev-replace'); -import rev = require('gulp-rev'); -import useref = require('gulp-useref'); +import * as gulp from 'gulp'; +import * as revReplace from 'gulp-rev-replace'; +import * as rev from 'gulp-rev'; +import * as useref from 'gulp-useref'; gulp.task("index", () => { return gulp.src("src/index.html") diff --git a/gulp-rev-replace/gulp-rev-replace.d.ts b/gulp-rev-replace/gulp-rev-replace.d.ts index 3e683d183d..6c258573d8 100644 --- a/gulp-rev-replace/gulp-rev-replace.d.ts +++ b/gulp-rev-replace/gulp-rev-replace.d.ts @@ -6,16 +6,18 @@ /// declare module 'gulp-rev-replace' { - interface IOptions { - canonicalUris?: boolean; - replaceInExtensions?: Array; - prefix?: string; - manifest?: NodeJS.ReadWriteStream; - modifyUnreved?: Function; - modifyReved?: Function; + namespace revReplace { + interface Options { + canonicalUris?: boolean; + replaceInExtensions?: Array; + prefix?: string; + manifest?: NodeJS.ReadWriteStream; + modifyUnreved?: Function; + modifyReved?: Function; } + } - function revReplace(options?: IOptions): NodeJS.ReadWriteStream; + function revReplace(options?: revReplace.Options): NodeJS.ReadWriteStream; - export = revReplace; + export = revReplace; } From 0b23833fb157916c5e9eefdb06827a8a9fef69a2 Mon Sep 17 00:00:00 2001 From: Norgerman Date: Fri, 15 Jan 2016 10:58:26 +0800 Subject: [PATCH 379/441] add useQuerystring into request.CoreOptions --- request/request.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/request/request.d.ts b/request/request.d.ts index d47ed5f9aa..4d51fd14b8 100644 --- a/request/request.d.ts +++ b/request/request.d.ts @@ -110,6 +110,7 @@ declare module 'request' { passphrase?: string; ca?: Buffer; har?: HttpArchiveRequest; + useQuerystring?: boolean; } interface UriOptions { From a4d7c74e725b545e187bceb8aa28f3374082331e Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Fri, 15 Jan 2016 14:23:30 +1100 Subject: [PATCH 380/441] hitType: string, // 'event' --- google.analytics/ga.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index 505bb3b493..abc4d4a8d5 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -56,7 +56,7 @@ declare module UniversalAnalytics { eventValue?: number, nonInteraction?: boolean}): void; (command: 'send', fieldsObject: { - hitType: 'event', + hitType: string, // 'event' eventCategory: string, eventAction: string, eventLabel?: string, From 98ff9a0a9cfb2adcc3cf006a2bdcb0e5938202d0 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Fri, 15 Jan 2016 14:30:46 +1100 Subject: [PATCH 381/441] moved HitType --- google.analytics/ga.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index abc4d4a8d5..9166f7192f 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -36,12 +36,12 @@ interface GoogleAnalytics { async: boolean; } -enum HitType { - 'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing' -} - declare module UniversalAnalytics { // https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference + + enum HitType { + 'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing' + } interface ga { l: number; @@ -56,7 +56,7 @@ declare module UniversalAnalytics { eventValue?: number, nonInteraction?: boolean}): void; (command: 'send', fieldsObject: { - hitType: string, // 'event' + hitType: HitType, // 'event' eventCategory: string, eventAction: string, eventLabel?: string, From fc5b458c58dd3c41b0d663c471bf96ce14b57819 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Fri, 15 Jan 2016 14:41:15 +1100 Subject: [PATCH 382/441] ...fields: any --- google.analytics/ga.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index 9166f7192f..1f20ed5388 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -71,7 +71,7 @@ declare module UniversalAnalytics { timingCategory: string, timingVar: string, timingValue: number): void; (command: 'send', hitType: 'timing', fieldsObject: {timingCategory: string, timingVar: string, timingValue: number}): void; - (command: 'send', hitType: HitType, ...fields): void; + (command: 'send', hitType: HitType, ...fields: any): void; (command: 'send', fieldsObject: {}): void; (command: string, hitDetails: {}): void; From 16691b210184c242bc9cbdb98f8d51d6f0022981 Mon Sep 17 00:00:00 2001 From: Lucas Woo Date: Fri, 15 Jan 2016 11:53:31 +0800 Subject: [PATCH 383/441] rename test file --- speakeasy/{speakeasy-test.ts => speakeasy-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename speakeasy/{speakeasy-test.ts => speakeasy-tests.ts} (100%) diff --git a/speakeasy/speakeasy-test.ts b/speakeasy/speakeasy-tests.ts similarity index 100% rename from speakeasy/speakeasy-test.ts rename to speakeasy/speakeasy-tests.ts From db036a4d67535fd050a16746b95bd43d1f93caaa Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Fri, 15 Jan 2016 15:39:11 +1100 Subject: [PATCH 384/441] (command: 'send', hitType: HitType, ...fields: any[]): void; --- google.analytics/ga.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index 1f20ed5388..f51c84dc7d 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -71,7 +71,7 @@ declare module UniversalAnalytics { timingCategory: string, timingVar: string, timingValue: number): void; (command: 'send', hitType: 'timing', fieldsObject: {timingCategory: string, timingVar: string, timingValue: number}): void; - (command: 'send', hitType: HitType, ...fields: any): void; + (command: 'send', hitType: HitType, ...fields: any[]): void; (command: 'send', fieldsObject: {}): void; (command: string, hitDetails: {}): void; From 7c64a2a73d131106efcd8746c89bb8b979c1d6f1 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Fri, 15 Jan 2016 17:36:20 +1100 Subject: [PATCH 385/441] (command: string, hitType: string, ...fields: any[]): void; --- google.analytics/ga.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index f51c84dc7d..1cbbba44ee 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -74,6 +74,7 @@ declare module UniversalAnalytics { (command: 'send', hitType: HitType, ...fields: any[]): void; (command: 'send', fieldsObject: {}): void; + (command: string, hitType: string, ...fields: any[]): void; (command: string, hitDetails: {}): void; (command: string, poly: string, opt_poly?: {}): UniversalAnalytics.Tracker; (command: string, trackingId: string, auto: string, opt_configObject?: {}): UniversalAnalytics.Tracker; From f01a2fc54936a95df3e72be2d014ac82754e96cf Mon Sep 17 00:00:00 2001 From: Kevin Smets Date: Fri, 15 Jan 2016 12:37:02 +0100 Subject: [PATCH 386/441] Update log4js's typings --- log4js/log4js.d.ts | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/log4js/log4js.d.ts b/log4js/log4js.d.ts index 4888b9f518..4a1160ec1b 100644 --- a/log4js/log4js.d.ts +++ b/log4js/log4js.d.ts @@ -8,6 +8,20 @@ declare module "log4js" { import express = require('express'); + /** + * Replaces the console + * @param logger + * @returns void + */ + export function replaceConsole(logger?: Logger): void; + + /** + * Restores the console + * @param logger + * @returns void + */ + export function restoreConsole(logger?: Logger): void; + /** * Get a logger instance. Instance is cached on categoryName level. * @@ -137,7 +151,7 @@ declare module "log4js" { } export interface ConsoleAppenderConfig extends AppenderConfigBase {} - + export interface FileAppenderConfig extends AppenderConfigBase { filename: string; } @@ -156,24 +170,24 @@ declare module "log4js" { pattern: string; alwaysIncludePattern: boolean; } - + export interface SmtpAppenderConfig extends AppenderConfigBase { /** Comma separated list of email recipients */ recipients: string; - + /** Sender of all emails (defaults to transport user) */ sender: string; - + /** Subject of all email messages (defaults to first event's message)*/ subject: string; - + /** * The time in seconds between sending attempts (defaults to 0). * All events are buffered and sent in one email during this time. * If 0 then every event sends an email */ sendInterval: number; - + SMTP: { host: string; secure: boolean; @@ -190,14 +204,14 @@ declare module "log4js" { backup: number; pollInterval: number; } - + export interface GelfAppenderConfig extends AppenderConfigBase { host: string; hostname: string; port: string; facility: string; } - + export interface MultiprocessAppenderConfig extends AppenderConfigBase { mode: string; loggerPort: number; @@ -205,25 +219,25 @@ declare module "log4js" { facility: string; appender?: AppenderConfig; } - + export interface LogglyAppenderConfig extends AppenderConfigBase { /** Loggly customer token - https://www.loggly.com/docs/api-sending-data/ */ token: string; - + /** Loggly customer subdomain (use 'abc' for abc.loggly.com) */ subdomain: string; - + /** an array of strings to help segment your data & narrow down search results in Loggly */ tags: string[]; - + /** Enable JSON logging by setting to 'true' */ json: boolean; } - + export interface ClusteredAppenderConfig extends AppenderConfigBase { appenders?: AppenderConfig[]; } - + type CoreAppenderConfig = ConsoleAppenderConfig | FileAppenderConfig | DateFileAppenderConfig @@ -233,11 +247,10 @@ declare module "log4js" { | MultiprocessAppenderConfig | LogglyAppenderConfig | ClusteredAppenderConfig - + interface CustomAppenderConfig extends AppenderConfigBase { [prop: string]: any; } type AppenderConfig = CoreAppenderConfig | CustomAppenderConfig; } - From 7c3971b0247e6c18ee7f2ab3eb15247f4858bd79 Mon Sep 17 00:00:00 2001 From: Niko Kovacic Date: Fri, 15 Jan 2016 14:31:39 +0100 Subject: [PATCH 387/441] Updated ng-file-upload interface to version 11.1.1 --- ng-file-upload/ng-file-upload-tests.ts | 121 +++++++---- ng-file-upload/ng-file-upload.d.ts | 275 +++++++++++++++++++++++-- 2 files changed, 334 insertions(+), 62 deletions(-) diff --git a/ng-file-upload/ng-file-upload-tests.ts b/ng-file-upload/ng-file-upload-tests.ts index 6ff4404025..f7fdcf1015 100644 --- a/ng-file-upload/ng-file-upload-tests.ts +++ b/ng-file-upload/ng-file-upload-tests.ts @@ -1,53 +1,88 @@ /// -module controllers { +"use strict"; - "use strict"; +let controllerId = "upload"; - var controllerId = "upload"; +class UploadController { + static $inject = ["Upload"]; - class Upload { + constructor(private Upload: angular.angularFileUpload.IUploadService) { + this.Upload.setDefaults({ + ngfAccept: "image/*", + ngfAllowDir: true, + ngfEnableFirefoxPaste: true, + ngfHideOnDropNotAvailable: true, + ngfMaxDuration: 20, + ngfMaxFiles: 10, + ngfMaxSize: "10MB", + ngfMaxTotalSize: "10MB", + ngfMinDuration: "10s", + ngfMinRatio: "8:10,1.6", + ngfMinSize: "9MB", + ngfMultiple: true, + ngfRatio: "8:10,1.6", + ngfStopPropagation: true, + ngfValidateForce: true + }); + } + + onFileSelect(files: Array) { - static $inject = ["$upload"]; - constructor( - private $upload: angular.angularFileUpload.IUploadService - ) { - } + this.Upload + .upload({ + url: "/api/upload", + method: "POST", + data: { + media: files, + extraData: { + test: true + } + } + }).abort().xhr((evt: any) => { + console.log("xhr"); + }).progress((evt: angular.angularFileUpload.IFileProgressEvent) => { + let percent = parseInt((100.0 * evt.loaded / evt.total).toString(), 10); + console.log("upload progress: " + percent + "% for " + evt.config.data.media[0]); + }).error((data: any, status: number, response: any, headers: any) => { + console.error(data, status, response, headers); + }).success((data: any, status: number, headers: any, config: angular.angularFileUpload.IFileUploadConfigFile) => { + // file is uploaded successfully + console.log("Success!", data, status, headers, config); + }); - onFileSelect($files: File[]) { - // $files: an array of files selected, each file has name, size, and type. - for (var i = 0; i < $files.length; i++) { - var file = $files[i]; - this.$upload.upload({ - url: "/api/upload", - method: "POST", - data: { - extraData: { - fileName: file.name, - test: "anything" - } - }, - file: file - }) - .abort() - .xhr((evt: any) => { - console.log('xhr'); - }) - .progress((evt: angular.angularFileUpload.IFileProgressEvent) => { - var percent = parseInt((100.0 * evt.loaded / evt.total).toString(), 10); - console.log("upload progress: " + percent + "% for " + evt.config.file.name); - }) - .error((data: any, status: number, response: any, headers: any) => { - console.error(data, status, response, headers); - }) - .success((data: any, status: number, headers: any, config: angular.angularFileUpload.IFileUploadConfigFile) => { - // file is uploaded successfully - console.log("Success!", data, status, headers, config); - }); + this.Upload + .base64DataUrl(files[0]) + .then((file: string) => { + console.log(file); + }) - } - } - } + this.Upload + .dataUrl(files[0], true) + .then((result: string) => { + console.log(result); + }); - angular.module("app").controller(controllerId, Upload); + this.Upload + .imageDimensions(files[0]) + .then((imageDimensions) => { + console.log(imageDimensions.height + " " + imageDimensions.width); + }); + + this.Upload.isResizeSupported(); + this.Upload.isResumeSupported(); + this.Upload.isUploadInProgress(); + + let json = this.Upload.json({ test: true }), + jsonBlob = this.Upload.jsonBlob({ test: true }), + fileWithNewName = this.Upload.rename(files[0], "newName.jpg"); + + this.Upload + .resize(files[0], 1024, 1024, 0.7, 'image/jpeg', 0.9, true) + .then((resizedFile) => { + console.log(resizedFile); + }); + } } + +angular.module("app").controller("UploadController", UploadController); diff --git a/ng-file-upload/ng-file-upload.d.ts b/ng-file-upload/ng-file-upload.d.ts index 79b1a91f1f..ae646b5162 100644 --- a/ng-file-upload/ng-file-upload.d.ts +++ b/ng-file-upload/ng-file-upload.d.ts @@ -1,43 +1,280 @@ -// Type definitions for Angular File Upload 4.2.1 +// Type definitions for Angular File Upload 11.1.1 // Project: https://github.com/danialfarid/ng-file-upload // Definitions by: John Reilly // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +declare module "ng-file-upload" { + let angularFileUploadDefaultExport: string; + export = angularFileUploadDefaultExport; +} + declare module angular.angularFileUpload { + interface ImageDimensions { + height: number; + width: number; + } + + interface FileUploadOptions { + /** + * Standard HTML accept attr, browser specific select popup window + * @type {string} + */ + ngfAccept?: string; + /** + * Default true, allow dropping files only for Chrome webkit browser + * @type {boolean} + */ + ngfAllowDir?: boolean; + /** + * Default false, enable firefox image paste by making element contenteditable + * @type {boolean} + */ + ngfEnableFirefoxPaste?: boolean; + /** + * Default false, hides element if file drag&drop is not + * @type {boolean} + */ + ngfHideOnDropNotAvailable?: boolean; + /** + * Validate error name: minDuration + * @type {(number|string)} + */ + ngfMinDuration: number | string; + ngfMinSize?: number | string; + /** + * Validate error name: minRatio + * @type {(number|string)} + */ + ngfMinRatio?: number | string; + /** + * Validate error name: maxDuration + * @type {(number|string)} + */ + ngfMaxDuration?: number | string; + /** + * Maximum number of files allowed to be selected or dropped, validate error name: maxFiles + * @type {number} + */ + ngfMaxFiles?: number; + /** + * Validate error name: maxSize + * @type {(number|string)} + */ + ngfMaxSize?: number | string; + /** + * Validate error name: maxTotalSize + * @type {(number|string)} + */ + ngfMaxTotalSize?: number | string; + /** + * Allows selecting multiple files + * @type {boolean} + */ + ngfMultiple?: boolean; + /** + * List of comma separated valid aspect ratio of images in float or 2:3 format + * @type {string} + */ + ngfRatio?: string; + /** + * Default false, whether to propagate drag/drop events. + * @type {boolean} + */ + ngfStopPropagation?: boolean; + /** + * Default false, if true file.$error will be set if the dimension or duration + * values for validations cannot be calculated for example image load error or unsupported video by the browser. + * By default it would assume the file is valid if the duration or dimension cannot be calculated by the browser. + * @type {boolean} + */ + ngfValidateForce?: boolean; + } interface IUploadService { - + /** + * Convert a single file or array of files to a single or array of + * base64 data url representation of the file(s). + * Could be used to send file in base64 format inside json to the databases + * + * @param {Array} + * @return {angular.IPromise} + */ + base64DataUrl(files: File | Array): angular.IPromise | string>; + /** + * Convert the file to blob url object or base64 data url based on boolean disallowObjectUrl value + * + * @param {File} file + * @param {boolean} [disallowObjectUrl] + * @return {angular.IPromise} + */ + dataUrl(file: File, disallowObjectUrl?: boolean): angular.IPromise; + /** + * Alternative way of uploading, send the file binary with the file's content-type. + * Could be used to upload files to CouchDB, imgur, etc... html5 FileReader is needed. + * This is equivalent to angular $http() but allow you to listen to the progress event for HTML5 browsers. + * + * @param {IRequestConfig} config + * @return {angular.IPromise} + */ http(config: IRequestConfig): IUploadPromise; - upload(config: IFileUploadConfigFiles|IFileUploadConfigFile): IUploadPromise; + /** + * Get image file dimensions + * + * @param {File} file + * @return {angular.IPromise} + */ + imageDimensions(file: File): angular.IPromise; + /** + * Returns boolean showing if image resize is supported by this browser + * + * @return {boolean} + */ + isResizeSupported(): boolean; + /** + * Returns boolean showing if resumable upload is supported by this browser + * + * @return {boolean} + */ + isResumeSupported(): boolean; + /** + * Returns true if there is an upload in progress. Can be used to prompt user before closing browser tab + * + * @return {boolean} + */ + isUploadInProgress(): boolean; + /** + * Converts the value to json to send data as json string. Same as angular.toJson(obj) + * + * @param {Object} obj + * @return {string} + */ + json(obj: Object): string; + /** + * Converts the object to a Blob object with application/json content type + * for jsob byte streaming support + * + * @param {Object} obj + * @return {Blob} + */ + jsonBlob(obj: Object): Blob; + /** + * Returns a file which will be uploaded with the newName instead of original file name + * + * @param {File} file + * @param {string} newName + * @return {File} + */ + rename(file: File, newName: string): File; + /** + * Resizes an image. Returns a promise + * + * @param {File} file + * @param {number} [width] + * @param {number} [height] + * @param {number} [quality] + * @param {string} [type] + * @param {number} [ratio] + * @param {boolean} [centerCrop] + * @return {angular.IPromise} + */ + resize(file: File, width?: number, height?: number, quality?: number, type?: string, + ratio?: number | string, centerCrop?: boolean): angular.IPromise; + /** + * Set the default values for ngf-select and ngf-drop directives + * + * @param {FileUploadOptions} defaultFileUploadOptions + */ + setDefaults(defaultFileUploadOptions: FileUploadOptions): void; + /** + * Upload a file. Returns a Promise, + * + * @param {IFileUploadConfigFile} config + * @return {IUploadPromise} + */ + upload(config: IFileUploadConfigFile): IUploadPromise; } interface IUploadPromise extends IHttpPromise { + /** + * Cancel/abort the upload in progress. + * + * @return {IUploadPromise} + */ abort(): IUploadPromise; progress(callback: IHttpPromiseCallback): IUploadPromise; + /** + * Access or attach event listeners to the underlying XMLHttpRequest + * + * @param {IHttpPromiseCallback} + * @return {IUploadPromise} + */ xhr(callback: IHttpPromiseCallback): IUploadPromise; } interface IFileUploadConfigFile extends IRequestConfig { - - file: File; - fileName?: string; - } - - interface IFileUploadConfigFiles extends IRequestConfig { - - file: File[]; - fileName?: string; - } - - interface IFilesProgressEvent extends ProgressEvent { - - config: IFileUploadConfigFiles; + /** + * Specify the file and optional data to be sent to the server. + * Each field including nested objects will be sent as a form data multipart. + * Samples: {pic: file, username: username} + * {files: files, otherInfo: {id: id, person: person,...}} multiple files (html5) + * {profiles: {[{pic: file1, username: username1}, {pic: file2, username: username2}]} nested array multiple files (html5) + * {file: file, info: Upload.json({id: id, name: name, ...})} send fields as json string + * {file: file, info: Upload.jsonBlob({id: id, name: name, ...})} send fields as json blob, 'application/json' content_type + * {picFile: Upload.rename(file, 'profile.jpg'), title: title} send file with picFile key and profile.jpg file name + * + * @type {Object} + */ + data: any; + /** + * upload.php script, node.js route, or servlet url + * @type {string} + */ + url: string; + /** + * This is to accommodate server implementations expecting nested data object keys in .key or [key] format. + * Example: data: {rec: {name: 'N', pic: file}} sent as: rec[name] -> N, rec[pic] -> file + * data: {rec: {name: 'N', pic: file}, objectKey: '.k'} sent as: rec.name -> N, rec.pic -> file + * @type {string} + */ + objectKey?: string; + /** + * This is to accommodate server implementations expecting array data object keys in '[i]' or '[]' or + * ''(multiple entries with same key) format. + * Example: data: {rec: [file[0], file[1], ...]} sent as: rec[0] -> file[0], rec[1] -> file[1],... + * data: {rec: {rec: [f[0], f[1], ...], arrayKey: '[]'} sent as: rec[] -> f[0], rec[] -> f[1],... + * @type {string} + */ + arrayKey?: string; + /** + * Uploaded file size so far on the server + * @type {string} + */ + resumeSizeUrl?: string; + /** + * Reads the uploaded file size from resumeSizeUrl GET response + * @type {Function} + */ + resumeSizeResponseReader?: Function; + /** + * Function that returns a prommise which will be resolved to the upload file size on the server. + * @type {[type]} + */ + resumeSize?: Function; + /** + * Upload in chunks of specified size + * @type {(number|string)} + */ + resumeChunkSize?: number | string; + /** + * Default false, experimental as hotfix for potential library conflicts with other plugins + * @type {boolean} + */ + disableProgress?: boolean; } interface IFileProgressEvent extends ProgressEvent { - config: IFileUploadConfigFile; } -} +} \ No newline at end of file From 4a4f44b4b040c32086655200635314f7a45112de Mon Sep 17 00:00:00 2001 From: Andrey Kurosh Date: Fri, 15 Jan 2016 17:14:10 +0300 Subject: [PATCH 388/441] Clipboard.js definitions. --- clipboard.js/clipboard.js-tests.ts | 20 ++++++++++ clipboard.js/clipboard.js.d.ts | 59 ++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 clipboard.js/clipboard.js-tests.ts create mode 100644 clipboard.js/clipboard.js.d.ts diff --git a/clipboard.js/clipboard.js-tests.ts b/clipboard.js/clipboard.js-tests.ts new file mode 100644 index 0000000000..5adbeda27c --- /dev/null +++ b/clipboard.js/clipboard.js-tests.ts @@ -0,0 +1,20 @@ +/// + +var cb1 = new clipboardjs.Clipboard('.btn'); +var cb2 = new clipboardjs.Clipboard('.btn', { + action: elem => 'copy' +}); +var cb3 = new clipboardjs.Clipboard('.btn', { + action: elem => 'copy', + text: elem => null +}); +var cb4 = new clipboardjs.Clipboard('.btn', { + action: elem => 'copy', + target: elem => null +}); + +cb1.destroy(); + +cb2.on('success', function(e) { }); +cb2.on('error', function(e) { }); + diff --git a/clipboard.js/clipboard.js.d.ts b/clipboard.js/clipboard.js.d.ts new file mode 100644 index 0000000000..26b1a92015 --- /dev/null +++ b/clipboard.js/clipboard.js.d.ts @@ -0,0 +1,59 @@ +// Type definitions for clipboard.js 1.5.5 +// Project: https://github.com/zenorocha/clipboard.js +// Definitions by: Andrei Kurosh +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module clipboardjs { + + export class Clipboard { + constructor (selector: string, options?: ITargetOptions); + constructor (selector: string, options?: ITextOptions); + + /** + * Subscribes to events that indicate the result of a copy/cut operation. + * @param type {String} Event type ('success' or 'error'). + * @param handler Callback function. + */ + on(type: "success", handler: (e: Event) => void); + on(type: "error", handler: (e: Event) => void); + on(type: string, handler: (e: Event) => void); + + /** + * Clears all event bindings. + */ + destroy(); + } + + interface IOptions { + /** + * Overwrites default command ('cut' or 'copy'). + * @param {Element} elem Current element + * @returns {String} Only 'cut' or 'copy'. + */ + action?: (elem: Element) => string; + } + + // Two different interfaces, because 'target' and 'text' attributes cannot be used together. + + interface ITargetOptions extends IOptions { + /** + * Overwrites default target input element. + * @param {Element} elem Current element + * @returns {Element} element to use. + */ + target?: (elem: Element) => Element; + } + + interface ITextOptions extends IOptions { + /** + * Returns the explicit text to copy. + * @param {Element} elem Current element + * @returns {String} Text to be copied. + */ + text?: (elem: Element) => string; + } +} + +declare module 'clipboardjs' { + export = clipboardjs; +} \ No newline at end of file From c4193a4d81b914dd8f233583131dc57fbb136d91 Mon Sep 17 00:00:00 2001 From: Andrey Kurosh Date: Fri, 15 Jan 2016 17:24:43 +0300 Subject: [PATCH 389/441] Tests & compilation fixes. --- clipboard.js/clipboard.js-tests.ts | 6 ++++-- clipboard.js/clipboard.js.d.ts | 17 +++++------------ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/clipboard.js/clipboard.js-tests.ts b/clipboard.js/clipboard.js-tests.ts index 5adbeda27c..962bf34e05 100644 --- a/clipboard.js/clipboard.js-tests.ts +++ b/clipboard.js/clipboard.js-tests.ts @@ -1,14 +1,16 @@ -/// +/// var cb1 = new clipboardjs.Clipboard('.btn'); var cb2 = new clipboardjs.Clipboard('.btn', { action: elem => 'copy' }); var cb3 = new clipboardjs.Clipboard('.btn', { - action: elem => 'copy', text: elem => null }); var cb4 = new clipboardjs.Clipboard('.btn', { + target: elem => null +}); +var cb5 = new clipboardjs.Clipboard('.btn', { action: elem => 'copy', target: elem => null }); diff --git a/clipboard.js/clipboard.js.d.ts b/clipboard.js/clipboard.js.d.ts index 26b1a92015..6a8af8519a 100644 --- a/clipboard.js/clipboard.js.d.ts +++ b/clipboard.js/clipboard.js.d.ts @@ -6,22 +6,21 @@ declare module clipboardjs { export class Clipboard { - constructor (selector: string, options?: ITargetOptions); - constructor (selector: string, options?: ITextOptions); + constructor(selector: string, options?: IOptions); /** * Subscribes to events that indicate the result of a copy/cut operation. * @param type {String} Event type ('success' or 'error'). * @param handler Callback function. */ - on(type: "success", handler: (e: Event) => void); - on(type: "error", handler: (e: Event) => void); - on(type: string, handler: (e: Event) => void); + on(type: "success", handler: (e: Event) => void): void; + on(type: "error", handler: (e: Event) => void): void; + on(type: string, handler: (e: Event) => void): void; /** * Clears all event bindings. */ - destroy(); + destroy(): void; } interface IOptions { @@ -31,20 +30,14 @@ declare module clipboardjs { * @returns {String} Only 'cut' or 'copy'. */ action?: (elem: Element) => string; - } - // Two different interfaces, because 'target' and 'text' attributes cannot be used together. - - interface ITargetOptions extends IOptions { /** * Overwrites default target input element. * @param {Element} elem Current element * @returns {Element} element to use. */ target?: (elem: Element) => Element; - } - interface ITextOptions extends IOptions { /** * Returns the explicit text to copy. * @param {Element} elem Current element From 04371efd2aec9f2f8a5b11a23a0ca991a503b19f Mon Sep 17 00:00:00 2001 From: Jimmy Anderson Date: Fri, 15 Jan 2016 09:36:33 -0500 Subject: [PATCH 390/441] Add ignoreReadonly option --- bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts index bd8a3ff54e..8affae9a7f 100644 --- a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts +++ b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts @@ -56,6 +56,7 @@ declare module BootstrapV3DatetimePicker { inline?: boolean; toolbarPlacement?: string; showClear?: boolean; + ignoreReadonly?: boolean; } interface Datetimepicker { From ce6e288c4d14d66c216b153dd25558e01c6628ed Mon Sep 17 00:00:00 2001 From: Nimish Telang Date: Fri, 15 Jan 2016 16:46:36 +0000 Subject: [PATCH 391/441] Update express router type, to work around typescript issue #1805 --- express/express-tests.ts | 20 +++++++++++++++++++- express/express.d.ts | 6 ++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/express/express-tests.ts b/express/express-tests.ts index 72beb0790f..de39e2c8a8 100644 --- a/express/express-tests.ts +++ b/express/express-tests.ts @@ -21,7 +21,25 @@ app.get('/', function(req, res){ res.send('hello world'); }); -var router = express.Router(); +const router = express.Router(); + + +const pathStr : string = 'test'; +const pathRE : RegExp = /test/; +const path = true? pathStr : pathRE; + +router.get(path); +router.put(path) +router.post(path); +router.delete(path); +router.get(pathStr); +router.put(pathStr) +router.post(pathStr); +router.delete(pathStr); +router.get(pathRE); +router.put(pathRE) +router.post(pathRE); +router.delete(pathRE); router.use((req, res, next) => { next(); }) router.route('/users') diff --git a/express/express.d.ts b/express/express.d.ts index db1981d5df..1a37840492 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -44,8 +44,7 @@ declare module "express" { } interface IRouterMatcher { - (name: string, ...handlers: RequestHandler[]): T; - (name: RegExp, ...handlers: RequestHandler[]): T; + (name: string|RegExp, ...handlers: RequestHandler[]): T; } interface IRouter extends RequestHandler { @@ -881,8 +880,7 @@ declare module "express" { set(setting: string, val: any): Application; get: { (name: string): any; // Getter - (name: string, ...handlers: RequestHandler[]): Application; - (name: RegExp, ...handlers: RequestHandler[]): Application; + (name: string|RegExp, ...handlers: RequestHandler[]): Application; }; /** From 37afc2c83af2b87a3d2812d2fd2615a6dde825ae Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 15 Jan 2016 09:44:10 -0800 Subject: [PATCH 392/441] improve typings for 12.x --- hapi/hapi.d.ts | 1949 +++++++++++++++++++++++++----------------------- 1 file changed, 1009 insertions(+), 940 deletions(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index aa814fcc32..a832922b81 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -1,129 +1,129 @@ -// Type definitions for hapi 8.8.0 +// Type definitions for hapi 12.0.1 // Project: http://github.com/spumko/hapi // Definitions by: Jason Swearingen // Definitions: https://github.com/borisyankov/DefinitelyTyped -//This is a total rewrite of Hakubo's original hapi.d.ts, as it was out of date/incomplete. +//Note/Disclaimer: This .d.ts was created against hapi v8.x but has been incrementally upgraded to 12.x. Some newer features/changes may be missing. YMMV. /// declare module "hapi" { - import http = require("http"); - import stream = require("stream"); - import Events = require("events"); + import http = require("http"); + import stream = require("stream"); + import Events = require("events"); - interface IDictionary { - [key: string]: T; - } + interface IDictionary { + [key: string]: T; + } - interface IThenable { - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IThenable; - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IThenable; - } + interface IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IThenable; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IThenable; + } - interface IPromise extends IThenable { - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IPromise; - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IPromise; - catch(onRejected?: (error: any) => U | IThenable): IPromise; - } + interface IPromise extends IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IPromise; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IPromise; + catch(onRejected?: (error: any) => U | IThenable): IPromise; + } /** Boom Module for errors. https://github.com/hapijs/boom * boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: */ - export interface IBoom extends Error { - /** if true, indicates this is a Boom object instance. */ - isBoom: boolean; - /** convenience bool indicating status code >= 500. */ - isServer: boolean; - /** the error message. */ - message: string; - /** the formatted response.Can be directly manipulated after object construction to return a custom error response.Allowed root keys: */ - output: { - /** the HTTP status code (typically 4xx or 5xx). */ - statusCode: number; - /** an object containing any HTTP headers where each key is a header name and value is the header content. */ - headers: IDictionary; - /** the formatted object used as the response payload (stringified).Can be directly manipulated but any changes will be lost if reformat() is called.Any content allowed and by default includes the following content: */ - payload: { - /** the HTTP status code, derived from error.output.statusCode. */ - statusCode: number; - /** the HTTP status message (e.g. 'Bad Request', 'Internal Server Error') derived from statusCode. */ - error: string; - /** the error message derived from error.message. */ - message: string; - }; - }; - /** reformat()rebuilds error.output using the other object properties. */ - reformat(): void; + export interface IBoom extends Error { + /** if true, indicates this is a Boom object instance. */ + isBoom: boolean; + /** convenience bool indicating status code >= 500. */ + isServer: boolean; + /** the error message. */ + message: string; + /** the formatted response.Can be directly manipulated after object construction to return a custom error response.Allowed root keys: */ + output: { + /** the HTTP status code (typically 4xx or 5xx). */ + statusCode: number; + /** an object containing any HTTP headers where each key is a header name and value is the header content. */ + headers: IDictionary; + /** the formatted object used as the response payload (stringified).Can be directly manipulated but any changes will be lost if reformat() is called.Any content allowed and by default includes the following content: */ + payload: { + /** the HTTP status code, derived from error.output.statusCode. */ + statusCode: number; + /** the HTTP status message (e.g. 'Bad Request', 'Internal Server Error') derived from statusCode. */ + error: string; + /** the error message derived from error.message. */ + message: string; + }; + }; + /** reformat()rebuilds error.output using the other object properties. */ + reformat(): void; - } + } - /** cache functionality via the "CatBox" module. */ - export interface ICatBoxCacheOptions { - /** a prototype function or catbox engine object. */ - engine: any; - /** an identifier used later when provisioning or configuring caching for server methods or plugins. Each cache name must be unique. A single item may omit the name option which defines the default cache. If every cache includes a name, a default memory cache is provisions as well. */ - name?: string; - /** if true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. */ - shared?: boolean; - } + /** cache functionality via the "CatBox" module. */ + export interface ICatBoxCacheOptions { + /** a prototype function or catbox engine object. */ + engine: any; + /** an identifier used later when provisioning or configuring caching for server methods or plugins. Each cache name must be unique. A single item may omit the name option which defines the default cache. If every cache includes a name, a default memory cache is provisions as well. */ + name?: string; + /** if true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. */ + shared?: boolean; + } - /** Any connections configuration server defaults can be included to override and customize the individual connection. */ - export interface IServerConnectionOptions extends IConnectionConfigurationServerDefaults { - /** - the public hostname or IP address. Used only to set server.info.host and server.info.uri. If not configured, defaults to the operating system hostname and if not available, to 'localhost'.*/ - host?: string; - /** - sets the host name or IP address the connection will listen on.If not configured, defaults to host if present, otherwise to all available network interfaces (i.e. '0.0.0.0').Set to 127.0.0.1 or localhost to restrict connection to only those coming from the same machine.*/ - address?: string; - /** - the TCP port the connection will listen to.Defaults to an ephemeral port (0) which uses an available port when the server is started (and assigned to server.info.port).If port is a string containing a '/' character, it is used as a UNIX domain socket path and if it starts with '\.\pipe' as a Windows named pipe.*/ - port?: string|number; - /** - the full public URI without the path (e.g. 'http://example.com:8080').If present, used as the connection info.uri otherwise constructed from the connection settings.*/ - uri?: string; - /** - optional node.js HTTP (or HTTPS) http.Server object or any compatible object.If the listener needs to be manually started, set autoListen to false.If the listener uses TLS, set tls to true.*/ - listener?: any; - /** - indicates that the connection.listener will be started manually outside the framework.Cannot be specified with a port setting.Defaults to true.*/ - autoListen?: boolean; - /** caching headers configuration: */ - cache?: { - /** - an array of HTTP response status codes (e.g. 200) which are allowed to include a valid caching directive.Defaults to [200]. */ - statuses: number[]; - }; - /** - a string or string array of labels used to server.select() specific connections matching the specified labels.Defaults to an empty array [](no labels).*/ - labels?: string|string[]; - /** - used to create an HTTPS connection.The tls object is passed unchanged as options to the node.js HTTPS server as described in the node.js HTTPS documentation.Set to true when passing a listener object that has been configured to use TLS directly. */ - tls?: boolean|Object; + /** Any connections configuration server defaults can be included to override and customize the individual connection. */ + export interface IServerConnectionOptions extends IConnectionConfigurationServerDefaults { + /** - the public hostname or IP address. Used only to set server.info.host and server.info.uri. If not configured, defaults to the operating system hostname and if not available, to 'localhost'.*/ + host?: string; + /** - sets the host name or IP address the connection will listen on.If not configured, defaults to host if present, otherwise to all available network interfaces (i.e. '0.0.0.0').Set to 127.0.0.1 or localhost to restrict connection to only those coming from the same machine.*/ + address?: string; + /** - the TCP port the connection will listen to.Defaults to an ephemeral port (0) which uses an available port when the server is started (and assigned to server.info.port).If port is a string containing a '/' character, it is used as a UNIX domain socket path and if it starts with '\.\pipe' as a Windows named pipe.*/ + port?: string | number; + /** - the full public URI without the path (e.g. 'http://example.com:8080').If present, used as the connection info.uri otherwise constructed from the connection settings.*/ + uri?: string; + /** - optional node.js HTTP (or HTTPS) http.Server object or any compatible object.If the listener needs to be manually started, set autoListen to false.If the listener uses TLS, set tls to true.*/ + listener?: any; + /** - indicates that the connection.listener will be started manually outside the framework.Cannot be specified with a port setting.Defaults to true.*/ + autoListen?: boolean; + /** caching headers configuration: */ + cache?: { + /** - an array of HTTP response status codes (e.g. 200) which are allowed to include a valid caching directive.Defaults to [200]. */ + statuses: number[]; + }; + /** - a string or string array of labels used to server.select() specific connections matching the specified labels.Defaults to an empty array [](no labels).*/ + labels?: string | string[]; + /** - used to create an HTTPS connection.The tls object is passed unchanged as options to the node.js HTTPS server as described in the node.js HTTPS documentation.Set to true when passing a listener object that has been configured to use TLS directly. */ + tls?: boolean | { key?: string; cert?: string; pfx?: string; } | Object; - } + } - export interface IConnectionConfigurationServerDefaults { - /** application-specific connection configuration which can be accessed via connection.settings.app. Provides a safe place to store application configuration without potential conflicts with the framework internals. Should not be used to configure plugins which should use plugins[name]. Note the difference between connection.settings.app which is used to store configuration values and connection.app which is meant for storing run-time state. */ - app?: any; - /** connection load limits configuration where: */ - load?: { - /** maximum V8 heap size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ - maxHeapUsedBytes: number; - /** maximum process RSS size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ - maxRssBytes: number; - /** maximum event loop delay duration in milliseconds over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ - maxEventLoopDelay: number; - }; - /** plugin-specific configuration which can later be accessed via connection.settings.plugins. Provides a place to store and pass connection-specific plugin configuration. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between connection.settings.plugins which is used to store configuration values and connection.plugins which is meant for storing run-time state. */ - plugins?: any; - /** controls how incoming request URIs are matched against the routing table: */ - router?: { - /** determines whether the paths '/example' and '/EXAMPLE' are considered different resources. Defaults to true. */ - isCaseSensitive: boolean; - /** removes trailing slashes on incoming paths. Defaults to false. */ - stripTrailingSlash: boolean; - }; - /** a route options object used to set the default configuration for every route. */ - routes?: IRouteAdditionalConfigurationOptions; - state?: IServerState; - } + export interface IConnectionConfigurationServerDefaults { + /** application-specific connection configuration which can be accessed via connection.settings.app. Provides a safe place to store application configuration without potential conflicts with the framework internals. Should not be used to configure plugins which should use plugins[name]. Note the difference between connection.settings.app which is used to store configuration values and connection.app which is meant for storing run-time state. */ + app?: any; + /** connection load limits configuration where: */ + load?: { + /** maximum V8 heap size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxHeapUsedBytes: number; + /** maximum process RSS size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxRssBytes: number; + /** maximum event loop delay duration in milliseconds over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxEventLoopDelay: number; + }; + /** plugin-specific configuration which can later be accessed via connection.settings.plugins. Provides a place to store and pass connection-specific plugin configuration. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between connection.settings.plugins which is used to store configuration values and connection.plugins which is meant for storing run-time state. */ + plugins?: any; + /** controls how incoming request URIs are matched against the routing table: */ + router?: { + /** determines whether the paths '/example' and '/EXAMPLE' are considered different resources. Defaults to true. */ + isCaseSensitive: boolean; + /** removes trailing slashes on incoming paths. Defaults to false. */ + stripTrailingSlash: boolean; + }; + /** a route options object used to set the default configuration for every route. */ + routes?: IRouteAdditionalConfigurationOptions; + state?: IServerState; + } - /** Note that the options object is deeply cloned and cannot contain any values that are unsafe to perform deep copy on.*/ - export interface IServerOptions { - /** application-specific configuration which can later be accessed via server.settings.app. Note the difference between server.settings.app which is used to store static configuration values and server.app which is meant for storing run-time state. Defaults to {}. */ - app?: any; + /** Note that the options object is deeply cloned and cannot contain any values that are unsafe to perform deep copy on.*/ + export interface IServerOptions { + /** application-specific configuration which can later be accessed via server.settings.app. Note the difference between server.settings.app which is used to store static configuration values and server.app which is meant for storing run-time state. Defaults to {}. */ + app?: any; /** sets up server-side caching. Every server includes a default cache for storing application state. By default, a simple memory-based cache is created which has limited capacity and capabilities. hapi uses catbox for its cache which includes support for common storage solutions (e.g. Redis, MongoDB, Memcached, and Riak). Caching is only utilized if methods and plugins explicitly store their state in the cache. The server cache configuration only defines the storage container itself. cache can be assigned: a prototype function (usually obtained by calling require() on a catbox strategy such as require('catbox-redis')). a configuration object with the following options: @@ -132,86 +132,86 @@ declare module "hapi" { sharedif true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. other options passed to the catbox strategy used. an array of the above object for configuring multiple cache instances, each with a unique name. When an array of objects is provided, multiple cache connections are established and each array item (except one) must include a name. */ - cache?: string|ICatBoxCacheOptions|Array|any; - /** sets the default connections configuration which can be overridden by each connection where: */ - connections?: IConnectionConfigurationServerDefaults; - /** determines which logged events are sent to the console (this should only be used for development and does not affect which events are actually logged internally and recorded). Set to false to disable all console logging, or to an object*/ - debug?: boolean|{ - /** - a string array of server log tags to be displayed via console.error() when the events are logged via server.log() as well as internally generated server logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error. */ - log: string[]; - /** - a string array of request log tags to be displayed via console.error() when the events are logged via request.log() as well as internally generated request logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error.*/ - request: string[]; - }; - /** file system related settings*/ - files?: { - /** sets the maximum number of file etag hash values stored in the etags cache. Defaults to 10000.*/ - etagsCacheMaxSize?: number; - }; - /** process load monitoring*/ - load?: { - /** the frequency of sampling in milliseconds. Defaults to 0 (no sampling).*/ - sampleInterval?: number; - }; + cache?: string | ICatBoxCacheOptions | Array | any; + /** sets the default connections configuration which can be overridden by each connection where: */ + connections?: IConnectionConfigurationServerDefaults; + /** determines which logged events are sent to the console (this should only be used for development and does not affect which events are actually logged internally and recorded). Set to false to disable all console logging, or to an object*/ + debug?: boolean | { + /** - a string array of server log tags to be displayed via console.error() when the events are logged via server.log() as well as internally generated server logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error. */ + log: string[]; + /** - a string array of request log tags to be displayed via console.error() when the events are logged via request.log() as well as internally generated request logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error.*/ + request: string[]; + }; + /** file system related settings*/ + files?: { + /** sets the maximum number of file etag hash values stored in the etags cache. Defaults to 10000.*/ + etagsCacheMaxSize?: number; + }; + /** process load monitoring*/ + load?: { + /** the frequency of sampling in milliseconds. Defaults to 0 (no sampling).*/ + sampleInterval?: number; + }; - /** options passed to the mimos module (https://github.com/hapijs/mimos) when generating the mime database used by the server and accessed via server.mime.*/ - mime?: any; - /** if true, does not load the inert (file and directory support), h2o2 (proxy support), and vision (views support) plugins automatically. The plugins can be loaded manually after construction. Defaults to false (plugins loaded). */ - minimal?: boolean; - /** plugin-specific configuration which can later be accessed via server.settings.plugins. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between server.settings.plugins which is used to store static configuration values and server.plugins which is meant for storing run-time state. Defaults to {}.*/ - plugins?: IDictionary; + /** options passed to the mimos module (https://github.com/hapijs/mimos) when generating the mime database used by the server and accessed via server.mime.*/ + mime?: any; + /** if true, does not load the inert (file and directory support), h2o2 (proxy support), and vision (views support) plugins automatically. The plugins can be loaded manually after construction. Defaults to false (plugins loaded). */ + minimal?: boolean; + /** plugin-specific configuration which can later be accessed via server.settings.plugins. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between server.settings.plugins which is used to store static configuration values and server.plugins which is meant for storing run-time state. Defaults to {}.*/ + plugins?: IDictionary; - } + } - export interface IServerViewCompile { - (template: string, options: any): void; - (template: string, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: boolean) => void) => void) => void): void; - } + export interface IServerViewCompile { + (template: string, options: any): void; + (template: string, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: boolean) => void) => void) => void): void; + } - export interface IServerViewsAdditionalOptions { - /** path - the root file path used to resolve and load the templates identified when calling reply.view().Defaults to current working directory.*/ - path?: string; + export interface IServerViewsAdditionalOptions { + /** path - the root file path used to resolve and load the templates identified when calling reply.view().Defaults to current working directory.*/ + path?: string; /**partialsPath - the root file path where partials are located.Partials are small segments of template code that can be nested and reused throughout other templates.Defaults to no partials support (empty path). */ - partialsPath?: string; - /**helpersPath - the directory path where helpers are located.Helpers are functions used within templates to perform transformations and other data manipulations using the template context or other inputs.Each '.js' file in the helpers directory is loaded and the file name is used as the helper name.The files must export a single method with the signature function(context) and return a string.Sub - folders are not supported and are ignored.Defaults to no helpers support (empty path).Note that jade does not support loading helpers this way.*/ - helpersPath?: string; - /**relativeTo - a base path used as prefix for path and partialsPath.No default.*/ - relativeTo?: string; + partialsPath?: string; + /**helpersPath - the directory path where helpers are located.Helpers are functions used within templates to perform transformations and other data manipulations using the template context or other inputs.Each '.js' file in the helpers directory is loaded and the file name is used as the helper name.The files must export a single method with the signature function(context) and return a string.Sub - folders are not supported and are ignored.Defaults to no helpers support (empty path).Note that jade does not support loading helpers this way.*/ + helpersPath?: string; + /**relativeTo - a base path used as prefix for path and partialsPath.No default.*/ + relativeTo?: string; - /**layout - if set to true or a layout filename, layout support is enabled.A layout is a single template file used as the parent template for other view templates in the same engine.If true, the layout template name must be 'layout.ext' where 'ext' is the engine's extension. Otherwise, the provided filename is suffixed with the engine's extension and loaded.Disable layout when using Jade as it will handle including any layout files independently.Defaults to false.*/ - layout?: boolean; - /**layoutPath - the root file path where layout templates are located (using the relativeTo prefix if present). Defaults to path.*/ - layoutPath?: string; - /**layoutKeyword - the key used by the template engine to denote where primary template content should go.Defaults to 'content'.*/ - layoutKeywork?: string; - /**encoding - the text encoding used by the templates when reading the files and outputting the result.Defaults to 'utf8'.*/ - encoding?: string; - /**isCached - if set to false, templates will not be cached (thus will be read from file on every use).Defaults to true.*/ - isCached?: boolean; - /**allowAbsolutePaths - if set to true, allows absolute template paths passed to reply.view().Defaults to false.*/ - allowAbsolutePaths?: boolean; - /**allowInsecureAccess - if set to true, allows template paths passed to reply.view() to contain '../'.Defaults to false.*/ - allowInsecureAccess?: boolean; - /**compileOptions - options object passed to the engine's compile function. Defaults to empty options {}.*/ - compileOptions?: any; - /**runtimeOptions - options object passed to the returned function from the compile operation.Defaults to empty options {}.*/ - runtimeOptions?: any; - /**contentType - the content type of the engine results.Defaults to 'text/html'.*/ - contentType?: string; - /**compileMode - specify whether the engine compile() method is 'sync' or 'async'.Defaults to 'sync'.*/ - compileMode?: string; - /**context - a global context used with all templates.The global context option can be either an object or a function that takes no arguments and returns a context object.When rendering views, the global context will be merged with any context object specified on the handler or using reply.view().When multiple context objects are used, values from the global context always have lowest precedence.*/ - context?: any; - } + /**layout - if set to true or a layout filename, layout support is enabled.A layout is a single template file used as the parent template for other view templates in the same engine.If true, the layout template name must be 'layout.ext' where 'ext' is the engine's extension. Otherwise, the provided filename is suffixed with the engine's extension and loaded.Disable layout when using Jade as it will handle including any layout files independently.Defaults to false.*/ + layout?: boolean; + /**layoutPath - the root file path where layout templates are located (using the relativeTo prefix if present). Defaults to path.*/ + layoutPath?: string; + /**layoutKeyword - the key used by the template engine to denote where primary template content should go.Defaults to 'content'.*/ + layoutKeywork?: string; + /**encoding - the text encoding used by the templates when reading the files and outputting the result.Defaults to 'utf8'.*/ + encoding?: string; + /**isCached - if set to false, templates will not be cached (thus will be read from file on every use).Defaults to true.*/ + isCached?: boolean; + /**allowAbsolutePaths - if set to true, allows absolute template paths passed to reply.view().Defaults to false.*/ + allowAbsolutePaths?: boolean; + /**allowInsecureAccess - if set to true, allows template paths passed to reply.view() to contain '../'.Defaults to false.*/ + allowInsecureAccess?: boolean; + /**compileOptions - options object passed to the engine's compile function. Defaults to empty options {}.*/ + compileOptions?: any; + /**runtimeOptions - options object passed to the returned function from the compile operation.Defaults to empty options {}.*/ + runtimeOptions?: any; + /**contentType - the content type of the engine results.Defaults to 'text/html'.*/ + contentType?: string; + /**compileMode - specify whether the engine compile() method is 'sync' or 'async'.Defaults to 'sync'.*/ + compileMode?: string; + /**context - a global context used with all templates.The global context option can be either an object or a function that takes no arguments and returns a context object.When rendering views, the global context will be merged with any context object specified on the handler or using reply.view().When multiple context objects are used, values from the global context always have lowest precedence.*/ + context?: any; + } - export interface IServerViewsEnginesOptions extends IServerViewsAdditionalOptions { + export interface IServerViewsEnginesOptions extends IServerViewsAdditionalOptions { /**- the npm module used for rendering the templates.The module object must contain: "module", the rendering function. The required function signature depends on the compileMode settings. * If the compileMode is 'sync', the signature is compile(template, options), the return value is a function with signature function(context, options), and the method is allowed to throw errors.If the compileMode is 'async', the signature is compile(template, options, callback) where callback has the signature function(err, compiled) where compiled is a function with signature function(context, options, callback) and callback has the signature function(err, rendered).*/ - module: { - compile? (template: any, options: any): (context: any, options: any) => void; - compile? (template: any, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: any) => void) => void) => void): void; - }; - } + module: { + compile?(template: any, options: any): (context: any, options: any) => void; + compile?(template: any, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: any) => void) => void) => void): void; + }; + } /**Initializes the server views manager var Hapi = require('hapi'); @@ -226,12 +226,12 @@ declare module "hapi" { }); When server.views() is called within a plugin, the views manager is only available to plugins methods. */ - export interface IServerViewsConfiguration extends IServerViewsAdditionalOptions { - /** - required object where each key is a file extension (e.g. 'html', 'hbr'), mapped to the npm module used for rendering the templates.Alternatively, the extension can be mapped to an object with the following options:*/ - engines: IDictionary|IServerViewsEnginesOptions; - /** defines the default filename extension to append to template names when multiple engines are configured and not explicit extension is provided for a given template. No default value.*/ - defaultExtension?: string; - } + export interface IServerViewsConfiguration extends IServerViewsAdditionalOptions { + /** - required object where each key is a file extension (e.g. 'html', 'hbr'), mapped to the npm module used for rendering the templates.Alternatively, the extension can be mapped to an object with the following options:*/ + engines: IDictionary | IServerViewsEnginesOptions; + /** defines the default filename extension to append to template names when multiple engines are configured and not explicit extension is provided for a given template. No default value.*/ + defaultExtension?: string; + } /** Concludes the handler activity by setting a response and returning control over to the framework where: erran optional error response. @@ -239,273 +239,280 @@ declare module "hapi" { Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first. FLOW CONTROL: When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */ - export interface IReply { - (err: Error, - result?: string|number|boolean|Buffer|stream.Stream | IPromise | T, - /** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */ - credentialData?: any - ): IBoom; - /** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */ - (result: string|number|boolean|Buffer|stream.Stream | IPromise | T): Response; + export interface IReply { + (err: Error, + result?: string | number | boolean | Buffer | stream.Stream | IPromise | T, + /** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */ + credentialData?: any + ): IBoom; + /** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */ + (result: string | number | boolean | Buffer | stream.Stream | IPromise | T): Response; /** Returns control back to the framework without setting a response. If called in the handler, the response defaults to an empty payload with status code 200. * The data argument is only used for passing back authentication data and is ignored elsewhere. */ - continue(credentialData?: any): void; + continue(credentialData?: any): void; - /** Transmits a file from the file system. The 'Content-Type' header defaults to the matching mime type based on filename extension. The response flow control rules do not apply. */ - file( - /** the file path. */ - path: string, - /** optional settings: */ - options?: { - /** - an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ - filename?: string; + /** Transmits a file from the file system. The 'Content-Type' header defaults to the matching mime type based on filename extension. The response flow control rules do not apply. */ + file( + /** the file path. */ + path: string, + /** optional settings: */ + options?: { + /** - an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ + filename?: string; /** specifies whether to include the 'Content-Disposition' header with the response. Available values: false - header is not included. This is the default value. 'attachment' 'inline'*/ - mode?: boolean|string; - /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. */ - lookupCompressed: boolean; - }): void; + mode?: boolean | string; + /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. */ + lookupCompressed: boolean; + }): void; /** Concludes the handler activity by returning control over to the router with a templatized view response. the response flow control rules apply. */ - view( - /** the template filename and path, relative to the templates path configured via the server views manager. */ - template: string, - /** optional object used by the template to render context-specific result. Defaults to no context {}. */ - context?: {}, - /** optional object used to override the server's views manager configuration for this response. Cannot override isCached, partialsPath, or helpersPath which are only loaded at initialization. */ - options?: any): Response; + view( + /** the template filename and path, relative to the templates path configured via the server views manager. */ + template: string, + /** optional object used by the template to render context-specific result. Defaults to no context {}. */ + context?: {}, + /** optional object used to override the server's views manager configuration for this response. Cannot override isCached, partialsPath, or helpersPath which are only loaded at initialization. */ + options?: any): Response; /** Concludes the handler activity by returning control over to the router and informing the router that a response has already been sent back directly via request.raw.res and that no further response action is needed The response flow control rules do not apply. */ - close(options?: { - /** if false, the router will not call request.raw.res.end()) to ensure the response was ended. Defaults to true. */ - end?: boolean; - }): void; + close(options?: { + /** if false, the router will not call request.raw.res.end()) to ensure the response was ended. Defaults to true. */ + end?: boolean; + }): void; /** Proxies the request to an upstream endpoint. the response flow control rules do not apply. */ - proxy(/** an object including the same keys and restrictions defined by the route proxy handler options. */ - options: IProxyHandlerConfig): void; + proxy(/** an object including the same keys and restrictions defined by the route proxy handler options. */ + options: IProxyHandlerConfig): void; /** Redirects the client to the specified uri. Same as calling reply().redirect(uri). he response flow control rules apply. */ - redirect(uri: string): Response; - } + redirect(uri: string): ResponseRedirect; + } - export interface ISessionHandler { - (request: Request, reply: IReply): void; - } - export interface IRequestHandler { - (request: Request): T; - } + export interface ISessionHandler { + (request: Request, reply: IReply): void; + } + export interface IRequestHandler { + (request: Request): T; + } - export interface IFailAction { - (source: string, error: any, next: () => void): void - } - /** generates a reverse proxy handler */ - export interface IProxyHandlerConfig { - /** the upstream service host to proxy requests to. The same path on the client request will be used as the path on the host.*/ - host?: string; - /** the upstream service port. */ - port?: number; + export interface IFailAction { + (source: string, error: any, next: () => void): void + } + /** generates a reverse proxy handler */ + export interface IProxyHandlerConfig { + /** the upstream service host to proxy requests to. The same path on the client request will be used as the path on the host.*/ + host?: string; + /** the upstream service port. */ + port?: number; /** The protocol to use when making a request to the proxied host: 'http' 'https'*/ - protocol?: string; - /** an absolute URI used instead of the incoming host, port, protocol, path, and query. Cannot be used with host, port, protocol, or mapUri.*/ - uri?: string; - /** if true, forwards the headers sent from the client to the upstream service being proxied to, headers sent from the upstream service will also be forwarded to the client. Defaults to false.*/ - passThrough?: boolean; - /** localStatePassThrough - if false, any locally defined state is removed from incoming requests before being passed upstream. This is a security feature to prevent local state (e.g. authentication cookies) from leaking upstream to other servers along with the cookies intended for those servers. This value can be overridden on a per state basis via the server.state() passThrough option. Defaults to false.*/ - localStatePassThrough?: boolean; - /**acceptEncoding - if false, does not pass-through the 'Accept-Encoding' HTTP header which is useful when using an onResponse post-processing to avoid receiving an encoded response (e.g. gzipped). Can only be used together with passThrough. Defaults to true (passing header).*/ - acceptEncoding?: boolean; - /** rejectUnauthorized - sets the rejectUnauthorized property on the https agent making the request. This value is only used when the proxied server uses TLS/SSL. When set it will override the node.js rejectUnauthorized property. If false then ssl errors will be ignored. When true the server certificate is verified and an 500 response will be sent when verification fails. This shouldn't be used alongside the agent setting as the agent will be used instead. Defaults to the https agent default value of true.*/ - rejectUnauthorized?: boolean; - /**if true, sets the 'X-Forwarded-For', 'X-Forwarded-Port', 'X-Forwarded-Proto' headers when making a request to the proxied upstream endpoint. Defaults to false.*/ - xforward?: boolean; - /** the maximum number of HTTP redirections allowed, to be followed automatically by the handler. Set to false or 0 to disable all redirections (the response will contain the redirection received from the upstream service). If redirections are enabled, no redirections (301, 302, 307, 308) will be passed along to the client, and reaching the maximum allowed redirections will return an error response. Defaults to false.*/ - redirects?: boolean|number; - /**number of milliseconds before aborting the upstream request. Defaults to 180000 (3 minutes).*/ - timeout?: number; + protocol?: string; + /** an absolute URI used instead of the incoming host, port, protocol, path, and query. Cannot be used with host, port, protocol, or mapUri.*/ + uri?: string; + /** if true, forwards the headers sent from the client to the upstream service being proxied to, headers sent from the upstream service will also be forwarded to the client. Defaults to false.*/ + passThrough?: boolean; + /** localStatePassThrough - if false, any locally defined state is removed from incoming requests before being passed upstream. This is a security feature to prevent local state (e.g. authentication cookies) from leaking upstream to other servers along with the cookies intended for those servers. This value can be overridden on a per state basis via the server.state() passThrough option. Defaults to false.*/ + localStatePassThrough?: boolean; + /**acceptEncoding - if false, does not pass-through the 'Accept-Encoding' HTTP header which is useful when using an onResponse post-processing to avoid receiving an encoded response (e.g. gzipped). Can only be used together with passThrough. Defaults to true (passing header).*/ + acceptEncoding?: boolean; + /** rejectUnauthorized - sets the rejectUnauthorized property on the https agent making the request. This value is only used when the proxied server uses TLS/SSL. When set it will override the node.js rejectUnauthorized property. If false then ssl errors will be ignored. When true the server certificate is verified and an 500 response will be sent when verification fails. This shouldn't be used alongside the agent setting as the agent will be used instead. Defaults to the https agent default value of true.*/ + rejectUnauthorized?: boolean; + /**if true, sets the 'X-Forwarded-For', 'X-Forwarded-Port', 'X-Forwarded-Proto' headers when making a request to the proxied upstream endpoint. Defaults to false.*/ + xforward?: boolean; + /** the maximum number of HTTP redirections allowed, to be followed automatically by the handler. Set to false or 0 to disable all redirections (the response will contain the redirection received from the upstream service). If redirections are enabled, no redirections (301, 302, 307, 308) will be passed along to the client, and reaching the maximum allowed redirections will return an error response. Defaults to false.*/ + redirects?: boolean | number; + /**number of milliseconds before aborting the upstream request. Defaults to 180000 (3 minutes).*/ + timeout?: number; /** a function used to map the request URI to the proxied URI. Cannot be used together with host, port, protocol, or uri. The function signature is function(request, callback) where: request - is the incoming request object. callback - is function(err, uri, headers) where: err - internal error condition. uri - the absolute proxy URI. headers - optional object where each key is an HTTP request header and the value is the header content.*/ - mapUri?: (request: Request, callback: (err: any, uri: string, headers?: { [key: string]: string }) => void) => void; - /** a custom function for processing the response from the upstream service before sending to the client. Useful for custom error handling of responses from the proxied endpoint or other payload manipulation. Function signature is function(err, res, request, reply, settings, ttl) where: - err - internal or upstream error returned from attempting to contact the upstream proxy. - res - the node response object received from the upstream service. res is a readable stream (use the wreck module read method to easily convert it to a Buffer or string). - request - is the incoming request object. - reply - the reply interface function. - settings - the proxy handler configuration. - ttl - the upstream TTL in milliseconds if proxy.ttl it set to 'upstream' and the upstream response included a valid 'Cache-Control' header with 'max-age'.*/ - onResponse?: ( - err: any, - res: http.ServerResponse, - req: Request, - reply: () => void, - settings: IProxyHandlerConfig, - ttl: number - ) => void; - /** if set to 'upstream', applies the upstream response caching policy to the response using the response.ttl() method (or passed as an argument to the onResponse method if provided).*/ - ttl?: number; - /** - a node http(s) agent to be used for connections to upstream server. see https://nodejs.org/api/http.html#http_class_http_agent */ - agent?: http.Agent; - /** sets the maximum number of sockets available per outgoing proxy host connection. false means use the wreck module default value (Infinity). Does not affect non-proxy outgoing client connections. Defaults to Infinity.*/ - maxSockets?: boolean|number; - } - /** TODO: fill in joi definition */ - export interface IJoi { + mapUri?: (request: Request, callback: (err: any, uri: string, headers?: { [key: string]: string }) => void) => void; + /** a custom function for processing the response from the upstream service before sending to the client. Useful for custom error handling of responses from the proxied endpoint or other payload manipulation. Function signature is function(err, res, request, reply, settings, ttl) where: - err - internal or upstream error returned from attempting to contact the upstream proxy. - res - the node response object received from the upstream service. res is a readable stream (use the wreck module read method to easily convert it to a Buffer or string). - request - is the incoming request object. - reply - the reply interface function. - settings - the proxy handler configuration. - ttl - the upstream TTL in milliseconds if proxy.ttl it set to 'upstream' and the upstream response included a valid 'Cache-Control' header with 'max-age'.*/ + onResponse?: ( + err: any, + res: http.ServerResponse, + req: Request, + reply: IReply, + settings: IProxyHandlerConfig, + ttl: number + ) => void; + /** if set to 'upstream', applies the upstream response caching policy to the response using the response.ttl() method (or passed as an argument to the onResponse method if provided).*/ + ttl?: number; + /** - a node http(s) agent to be used for connections to upstream server. see https://nodejs.org/api/http.html#http_class_http_agent */ + agent?: http.Agent; + /** sets the maximum number of sockets available per outgoing proxy host connection. false means use the wreck module default value (Infinity). Does not affect non-proxy outgoing client connections. Defaults to Infinity.*/ + maxSockets?: boolean | number; + } + /** TODO: fill in joi definition */ + export interface IJoi { - } - /** a validation function using the signature function(value, options, next) */ - export interface IValidationFunction { + } + /** a validation function using the signature function(value, options, next) */ + export interface IValidationFunction { - (/** the object containing the path parameters. */ - value: any, - /** the server validation options. */ - options: any, - /** the callback function called when validation is completed. */ - next: (err: any, value: any) => void): void; - } - /** a custom error handler function with the signature 'function(request, reply, source, error)` */ - export interface IRouteFailFunction { - /** a custom error handler function with the signature 'function(request, reply, source, error)` */ - ( - /** - the [request object]. */ - request: Request, - /** the continuation reply interface. */ - reply: IReply, - /** the source of the invalid field (e.g. 'path', 'query', 'payload'). */ - source: string, - /** the error object prepared for the client response (including the validation function error under error.data). */ - error: any): void; - } + (/** the object containing the path parameters. */ + value: any, + /** the server validation options. */ + options: any, + /** the callback function called when validation is completed. */ + next: (err: any, value: any) => void): void; + } + /** a custom error handler function with the signature 'function(request, reply, source, error)` */ + export interface IRouteFailFunction { + /** a custom error handler function with the signature 'function(request, reply, source, error)` */ + ( + /** - the [request object]. */ + request: Request, + /** the continuation reply interface. */ + reply: IReply, + /** the source of the invalid field (e.g. 'path', 'query', 'payload'). */ + source: string, + /** the error object prepared for the client response (including the validation function error under error.data). */ + error: any): void; + } - /** Each route can be customize to change the default behavior of the request lifecycle using the following options: */ - export interface IRouteAdditionalConfigurationOptions { - /** application specific configuration.Should not be used by plugins which should use plugins[name] instead. */ - app?: any; + /** Each route can be customize to change the default behavior of the request lifecycle using the following options: */ + export interface IRouteAdditionalConfigurationOptions { + /** application specific configuration.Should not be used by plugins which should use plugins[name] instead. */ + app?: any; /** authentication configuration.Value can be: false to disable authentication if a default strategy is set. a string with the name of an authentication strategy registered with server.auth.strategy(). an object */ - auth?: boolean|string| - { + auth?: boolean | string | + { /** the authentication mode.Defaults to 'required' if a server authentication strategy is configured, otherwise defaults to no authentication.Available values: 'required'authentication is required. 'optional'authentication is optional (must be valid if present). 'try'same as 'optional' but allows for invalid authentication. */ - mode?: string; - /** a string array of strategy names in order they should be attempted.If only one strategy is used, strategy can be used instead with the single string value.Defaults to the default authentication strategy which is available only when a single strategy is configured. */ - strategies?: string | Array; + mode?: string; + /** a string array of strategy names in order they should be attempted.If only one strategy is used, strategy can be used instead with the single string value.Defaults to the default authentication strategy which is available only when a single strategy is configured. */ + strategies?: string | Array; /** if set, the payload (in requests other than 'GET' and 'HEAD') is authenticated after it is processed.Requires a strategy with payload authentication support (e.g.Hawk).Cannot be set to a value other than 'required' when the scheme sets the options.payload to true.Available values: falseno payload authentication.This is the default value. 'required'payload authentication required.This is the default value when the scheme sets options.payload to true. 'optional'payload authentication performed only when the client includes payload authentication information (e.g.hash attribute in Hawk). */ - payload?: string; + payload?: string; + /** the application scope required to access the route.Value can be a scope string or an array of scope strings.The authenticated credentials object scope property must contain at least one of the scopes defined to access the route.Set to false to remove scope requirements.Defaults to no scope required. */ + scope?: string | Array | boolean; + /** the required authenticated entity type.If set, must match the entity value of the authentication credentials.Available values: + anythe authentication can be on behalf of a user or application.This is the default value. + userthe authentication must be on behalf of a user. + appthe authentication must be on behalf of an application. */ + entity?: string; /** * an object or array of objects specifying the route access rules. Each rule is evaluated against an incoming * request and access is granted if at least one rule matches. Each rule object must include at least one of: */ - access?: IRouteAdditionalConfigurationAuthAccess | IRouteAdditionalConfigurationAuthAccess[]; - }; - /** an object passed back to the provided handler (via this) when called. */ - bind?: any; - /** if the route method is 'GET', the route can be configured to include caching directives in the response using the following options */ - cache?: { + access?: IRouteAdditionalConfigurationAuthAccess | IRouteAdditionalConfigurationAuthAccess[]; + }; + /** an object passed back to the provided handler (via this) when called. */ + bind?: any; + /** if the route method is 'GET', the route can be configured to include caching directives in the response using the following options */ + cache?: { /** mines the privacy flag included in clientside caching using the 'Cache-Control' header.Values are: fault'no privacy flag.This is the default setting. 'public'mark the response as suitable for public caching. 'private'mark the response as suitable only for private caching. */ - privacy: string; - /** relative expiration expressed in the number of milliseconds since the item was saved in the cache.Cannot be used together with expiresAt. */ - expiresIn: number; - /** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire.Cannot be used together with expiresIn. */ - expiresAt: string; - }; - /** the Cross- Origin Resource Sharing protocol allows browsers to make cross- origin API calls.CORS is required by web applications running inside a browser which are loaded from a different domain than the API server.CORS headers are disabled by default. To enable, set cors to true, or to an object with the following options: */ - cors?: { - /** a strings array of allowed origin servers ('Access-Control-Allow-Origin').The array can contain any combination of fully qualified origins along with origin strings containing a wildcard '' character, or a single `''origin string. Defaults to any origin['*']`. */ - origin?: Array; - /** if true, matches the value of the incoming 'Origin' header to the list of origin values ('*' matches anything) and if a match is found, uses that as the value of the 'Access-Control-Allow-Origin' response header.When false, the origin config is returned as- is.Defaults to true. */ - matchOrigin?: boolean; - /** if false, prevents the connection from returning the full list of non- wildcard origin values if the incoming origin header does not match any of the values.Has no impact if matchOrigin is set to false.Defaults to true. */ - isOriginExposed?: boolean; - /** number of seconds the browser should cache the CORS response ('Access-Control-Max-Age').The greater the value, the longer it will take before the browser checks for changes in policy.Defaults to 86400 (one day). */ - maxAge?: number; - /** a strings array of allowed headers ('Access-Control-Allow-Headers').Defaults to ['Authorization', 'Content-Type', 'If-None-Match']. */ - headers?: string[]; - /** a strings array of additional headers to headers.Use this to keep the default headers in place. */ - additionalHeaders?: string[]; - /** a strings array of allowed HTTP methods ('Access-Control-Allow-Methods').Defaults to ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS']. */ - methods?: string[]; - /** a strings array of additional methods to methods.Use this to keep the default methods in place. */ - additionalMethods?: string[]; - /** a strings array of exposed headers ('Access-Control-Expose-Headers').Defaults to ['WWW-Authenticate', 'Server-Authorization']. */ - exposedHeaders?: string[]; - /** a strings array of additional headers to exposedHeaders.Use this to keep the default headers in place. */ - additionalExposedHeaders?: string[]; - /** if true, allows user credentials to be sent ('Access-Control-Allow-Credentials').Defaults to false. */ - credentials?: boolean; - /** if false, preserves existing CORS headers set manually before the response is sent.Defaults to true. */ - override?: boolean; - }; - /** defines the behavior for serving static resources using the built-in route handlers for files and directories: */ - files?: {/** determines the folder relative paths are resolved against when using the file and directory handlers. */ - relativeTo: string; - }; + privacy: string; + /** relative expiration expressed in the number of milliseconds since the item was saved in the cache.Cannot be used together with expiresAt. */ + expiresIn: number; + /** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire.Cannot be used together with expiresIn. */ + expiresAt: string; + }; + /** the Cross- Origin Resource Sharing protocol allows browsers to make cross- origin API calls.CORS is required by web applications running inside a browser which are loaded from a different domain than the API server.CORS headers are disabled by default. To enable, set cors to true, or to an object with the following options: */ + cors?: { + /** a strings array of allowed origin servers ('Access-Control-Allow-Origin').The array can contain any combination of fully qualified origins along with origin strings containing a wildcard '' character, or a single `''origin string. Defaults to any origin['*']`. */ + origin?: Array; + /** if true, matches the value of the incoming 'Origin' header to the list of origin values ('*' matches anything) and if a match is found, uses that as the value of the 'Access-Control-Allow-Origin' response header.When false, the origin config is returned as- is.Defaults to true. */ + matchOrigin?: boolean; + /** if false, prevents the connection from returning the full list of non- wildcard origin values if the incoming origin header does not match any of the values.Has no impact if matchOrigin is set to false.Defaults to true. */ + isOriginExposed?: boolean; + /** number of seconds the browser should cache the CORS response ('Access-Control-Max-Age').The greater the value, the longer it will take before the browser checks for changes in policy.Defaults to 86400 (one day). */ + maxAge?: number; + /** a strings array of allowed headers ('Access-Control-Allow-Headers').Defaults to ['Authorization', 'Content-Type', 'If-None-Match']. */ + headers?: string[]; + /** a strings array of additional headers to headers.Use this to keep the default headers in place. */ + additionalHeaders?: string[]; + /** a strings array of allowed HTTP methods ('Access-Control-Allow-Methods').Defaults to ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS']. */ + methods?: string[]; + /** a strings array of additional methods to methods.Use this to keep the default methods in place. */ + additionalMethods?: string[]; + /** a strings array of exposed headers ('Access-Control-Expose-Headers').Defaults to ['WWW-Authenticate', 'Server-Authorization']. */ + exposedHeaders?: string[]; + /** a strings array of additional headers to exposedHeaders.Use this to keep the default headers in place. */ + additionalExposedHeaders?: string[]; + /** if true, allows user credentials to be sent ('Access-Control-Allow-Credentials').Defaults to false. */ + credentials?: boolean; + /** if false, preserves existing CORS headers set manually before the response is sent.Defaults to true. */ + override?: boolean; + }; + /** defines the behavior for serving static resources using the built-in route handlers for files and directories: */ + files?: {/** determines the folder relative paths are resolved against when using the file and directory handlers. */ + relativeTo: string; + }; - /** an alternative location for the route handler option. */ - handler?: ISessionHandler | string | IRouteHandlerConfig; - /** an optional unique identifier used to look up the route using server.lookup(). */ - id?: number; - /** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */ - json?: { - /** the replacer function or array.Defaults to no action. */ - replacer?: Function | string[]; - /** number of spaces to indent nested object keys.Defaults to no indentation. */ - space?: number|string; - /** string suffix added after conversion to JSON string.Defaults to no suffix. */ - suffix?: string; - }; - /** enables JSONP support by setting the value to the query parameter name containing the function name used to wrap the response payload.For example, if the value is 'callback', a request comes in with 'callback=me', and the JSON response is '{ "a":"b" }', the payload will be 'me({ "a":"b" });'.Does not work with stream responses. */ - jsonp?: string; - /** determines how the request payload is processed: */ - payload?: { + /** an alternative location for the route handler option. */ + handler?: ISessionHandler | string | IRouteHandlerConfig; + /** an optional unique identifier used to look up the route using server.lookup(). */ + id?: number; + /** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */ + json?: { + /** the replacer function or array.Defaults to no action. */ + replacer?: Function | string[]; + /** number of spaces to indent nested object keys.Defaults to no indentation. */ + space?: number | string; + /** string suffix added after conversion to JSON string.Defaults to no suffix. */ + suffix?: string; + }; + /** enables JSONP support by setting the value to the query parameter name containing the function name used to wrap the response payload.For example, if the value is 'callback', a request comes in with 'callback=me', and the JSON response is '{ "a":"b" }', the payload will be 'me({ "a":"b" });'.Does not work with stream responses. */ + jsonp?: string; + /** determines how the request payload is processed: */ + payload?: { /** the type of payload representation requested. The value must be one of: 'data'the incoming payload is read fully into memory.If parse is true, the payload is parsed (JSON, formdecoded, multipart) based on the 'Content- Type' header.If parse is false, the raw Buffer is returned.This is the default value except when a proxy handler is used. 'stream'the incoming payload is made available via a Stream.Readable interface.If the payload is 'multipart/form-data' and parse is true, fields values are presented as text while files are provided as streams.File streams from a 'multipart/form-data' upload will also have a property hapi containing filename and headers properties. 'file'the incoming payload in written to temporary file in the directory specified by the server's payload.uploads settings. If the payload is 'multipart/ formdata' and parse is true, fields values are presented as text while files are saved. Note that it is the sole responsibility of the application to clean up the files generated by the framework. This can be done by keeping track of which files are used (e.g. using the request.app object), and listening to the server 'response' event to perform any needed cleaup. */ - output?: string; + output?: string; /** can be true, false, or gunzip; determines if the incoming payload is processed or presented raw. true and gunzip includes gunzipping when the appropriate 'Content-Encoding' is specified on the received request. If parsing is enabled and the 'Content-Type' is known (for the whole payload as well as parts), the payload is converted into an object when possible. If the format is unknown, a Bad Request (400) error response is sent. Defaults to true, except when a proxy handler is used. The supported mime types are: 'application/json' 'application/x-www-form-urlencoded' 'application/octet-stream' 'text/ *' 'multipart/form-data' */ - parse?: string | boolean; - /** a string or an array of strings with the allowed mime types for the endpoint.Defaults to any of the supported mime types listed above.Note that allowing other mime types not listed will not enable them to be parsed, and that if parsing mode is 'parse', the request will result in an error response. */ - allow?: string | string[]; - /** a mime type string overriding the 'Content-Type' header value received.Defaults to no override. */ - override?: string; - /** limits the size of incoming payloads to the specified byte count.Allowing very large payloads may cause the server to run out of memory.Defaults to 1048576 (1MB). */ - maxBytes?: number; - /** payload reception timeout in milliseconds.Sets the maximum time allowed for the client to transmit the request payload (body) before giving up and responding with a Request Timeout (408) error response.Set to false to disable.Defaults to 10000 (10 seconds). */ - timeout?: number; - /** the directory used for writing file uploads.Defaults to os.tmpDir(). */ - uploads?: string; + parse?: string | boolean; + /** a string or an array of strings with the allowed mime types for the endpoint.Defaults to any of the supported mime types listed above.Note that allowing other mime types not listed will not enable them to be parsed, and that if parsing mode is 'parse', the request will result in an error response. */ + allow?: string | string[]; + /** a mime type string overriding the 'Content-Type' header value received.Defaults to no override. */ + override?: string; + /** limits the size of incoming payloads to the specified byte count.Allowing very large payloads may cause the server to run out of memory.Defaults to 1048576 (1MB). */ + maxBytes?: number; + /** payload reception timeout in milliseconds.Sets the maximum time allowed for the client to transmit the request payload (body) before giving up and responding with a Request Timeout (408) error response.Set to false to disable.Defaults to 10000 (10 seconds). */ + timeout?: number; + /** the directory used for writing file uploads.Defaults to os.tmpDir(). */ + uploads?: string; /** determines how to handle payload parsing errors. Allowed values are: 'error'return a Bad Request (400) error response. This is the default value. 'log'report the error but continue processing the request. 'ignore'take no action and continue processing the request. */ - failAction?: string; - }; - /** pluginspecific configuration.plugins is an object where each key is a plugin name and the value is the plugin configuration. */ - plugins?: IDictionary; - /** an array with [route prerequisites] methods which are executed in serial or in parallel before the handler is called. */ - pre?: any[]; - /** validation rules for the outgoing response payload (response body).Can only validate object response: */ - response?: { + failAction?: string; + }; + /** pluginspecific configuration.plugins is an object where each key is a plugin name and the value is the plugin configuration. */ + plugins?: IDictionary; + /** an array with [route prerequisites] methods which are executed in serial or in parallel before the handler is called. */ + pre?: any[]; + /** validation rules for the outgoing response payload (response body).Can only validate object response: */ + response?: { /** the default response object validation rules (for all non-error responses) expressed as one of: trueany payload allowed (no validation performed). This is the default. falseno payload allowed. @@ -514,55 +521,57 @@ declare module "hapi" { valuethe object containing the response object. optionsthe server validation options. next(err)the callback function called when validation is completed. */ - schema: boolean|any; - /** HTTP status- codespecific validation rules.The status key is set to an object where each key is a 3 digit HTTP status code and the value has the same definition as schema.If a response status code is not present in the status object, the schema definition is used, expect for errors which are not validated by default. */ - status: number; - /** the percent of responses validated (0100).Set to 0 to disable all validation.Defaults to 100 (all responses). */ - sample: number; + schema: boolean | any; + /** HTTP status- codespecific validation rules.The status key is set to an object where each key is a 3 digit HTTP status code and the value has the same definition as schema.If a response status code is not present in the status object, the schema definition is used, expect for errors which are not validated by default. */ + status: number; + /** the percent of responses validated (0100).Set to 0 to disable all validation.Defaults to 100 (all responses). */ + sample: number; /** defines what to do when a response fails validation.Options are: errorreturn an Internal Server Error (500) error response.This is the default value. loglog the error but send the response. */ - failAction: string; - /** if true, applies the validation rule changes to the response.Defaults to false. */ - modify: boolean; - /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ - options: any; - }; - /** sets common security headers (disabled by default).To enable set security to true or to an object with the following options */ - security?: boolean| { - /** controls the 'Strict-Transport-Security' header.If set to true the header will be set to max- age=15768000, if specified as a number the maxAge parameter will be set to that number.Defaults to true.You may also specify an object with the following fields: */ - hsts: boolean|number|{ - /** the max- age portion of the header, as a number.Default is 15768000. */ - maxAge?: number; - /** a boolean specifying whether to add the includeSubdomains flag to the header. */ - includeSubdomains?: boolean; - }; - /** controls the 'X-Frame-Options' header.When set to true the header will be set to DENY, you may also specify a string value of 'deny' or 'sameorigin'.To use the 'allow-from' rule, you must set this to an object with the following fields: */ - xframe: { - /** either 'deny', 'sameorigin', or 'allow-from' */ - rule: string; - /** when rule is 'allow-from' this is used to form the rest of the header, otherwise this field is ignored.If rule is 'allow-from' but source is unset, the rule will be automatically changed to 'sameorigin'. */ - source: string; - }; - /** boolean that controls the 'X-XSS-PROTECTION' header for IE.Defaults to true which sets the header to equal '1; mode=block'.NOTE: This setting can create a security vulnerability in versions of IE below 8, as well as unpatched versions of IE8.See here and here for more information.If you actively support old versions of IE, it may be wise to explicitly set this flag to false. */ - xss: boolean; - /** boolean controlling the 'X-Download-Options' header for IE, preventing downloads from executing in your context.Defaults to true setting the header to 'noopen'. */ - noOpen: boolean; - /** boolean controlling the 'X-Content-Type-Options' header.Defaults to true setting the header to its only and default option, 'nosniff'. */ - noSniff: boolean; - }; - /** HTTP state management (cookies) allows the server to store information on the client which is sent back to the server with every request (as defined in RFC 6265).state supports the following options: */ - state?: { - /** determines if incoming 'Cookie' headers are parsed and stored in the request.state object.Defaults to true. */ - parse: boolean; + failAction: string; + /** if true, applies the validation rule changes to the response.Defaults to false. */ + modify: boolean; + /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ + options: any; + }; + /** sets common security headers (disabled by default).To enable set security to true or to an object with the following options */ + security?: boolean | { + /** controls the 'Strict-Transport-Security' header.If set to true the header will be set to max- age=15768000, if specified as a number the maxAge parameter will be set to that number.Defaults to true.You may also specify an object with the following fields: */ + hsts?: boolean | number | { + /** the max- age portion of the header, as a number.Default is 15768000. */ + maxAge?: number; + /** a boolean specifying whether to add the includeSubdomains flag to the header. */ + includeSubdomains?: boolean; + /** a boolean specifying whether to add the 'preload' flag (used to submit domains inclusion in Chrome's HTTP Strict Transport Security (HSTS) preload list) to the header. */ + preload?: boolean; + }; + /** controls the 'X-Frame-Options' header.When set to true the header will be set to DENY, you may also specify a string value of 'deny' or 'sameorigin'.To use the 'allow-from' rule, you must set this to an object with the following fields: */ + xframe?: { + /** either 'deny', 'sameorigin', or 'allow-from' */ + rule: string; + /** when rule is 'allow-from' this is used to form the rest of the header, otherwise this field is ignored.If rule is 'allow-from' but source is unset, the rule will be automatically changed to 'sameorigin'. */ + source: string; + }; + /** boolean that controls the 'X-XSS-PROTECTION' header for IE.Defaults to true which sets the header to equal '1; mode=block'.NOTE: This setting can create a security vulnerability in versions of IE below 8, as well as unpatched versions of IE8.See here and here for more information.If you actively support old versions of IE, it may be wise to explicitly set this flag to false. */ + xss?: boolean; + /** boolean controlling the 'X-Download-Options' header for IE, preventing downloads from executing in your context.Defaults to true setting the header to 'noopen'. */ + noOpen?: boolean; + /** boolean controlling the 'X-Content-Type-Options' header.Defaults to true setting the header to its only and default option, 'nosniff'. */ + noSniff?: boolean; + }; + /** HTTP state management (cookies) allows the server to store information on the client which is sent back to the server with every request (as defined in RFC 6265).state supports the following options: */ + state?: { + /** determines if incoming 'Cookie' headers are parsed and stored in the request.state object.Defaults to true. */ + parse: boolean; /** determines how to handle cookie parsing errors.Allowed values are: 'error'return a Bad Request (400) error response.This is the default value. 'log'report the error but continue processing the request. 'ignore'take no action. */ - failAction: string; - }; - /** request input validation rules for various request components.When using a Joi validation object, the values of the other inputs (i.e.headers, query, params, payload, and auth) are made available under the validation context (accessible in rules as Joi.ref('$query.key')).Note that validation is performed in order(i.e.headers, params, query, payload) and if type casting is used (converting a string to number), the value of inputs not yet validated will reflect the raw, unvalidated and unmodified values.The validate object supports: */ - validate?: { + failAction: string; + }; + /** request input validation rules for various request components.When using a Joi validation object, the values of the other inputs (i.e.headers, query, params, payload, and auth) are made available under the validation context (accessible in rules as Joi.ref('$query.key')).Note that validation is performed in order(i.e.headers, params, query, payload) and if type casting is used (converting a string to number), the value of inputs not yet validated will reflect the raw, unvalidated and unmodified values.The validate object supports: */ + validate?: { /** validation rules for incoming request headers.Values allowed: * trueany headers allowed (no validation performed).This is the default. falseno headers allowed (this will cause all valid HTTP requests to fail). @@ -572,7 +581,7 @@ declare module "hapi" { optionsthe server validation options. next(err, value)the callback function called when validation is completed. */ - headers?: boolean | IJoi | IValidationFunction; + headers?: boolean | IJoi | IValidationFunction; /** validation rules for incoming request path parameters, after matching the path against the route and extracting any parameters then stored in request.params.Values allowed: @@ -583,7 +592,7 @@ declare module "hapi" { valuethe object containing the path parameters. optionsthe server validation options. next(err, value)the callback function called when validation is completed. */ - params?: boolean | IJoi | IValidationFunction; + params?: boolean | IJoi | IValidationFunction; /** validation rules for an incoming request URI query component (the key- value part of the URI between '?' and '#').The query is parsed into its individual key- value pairs (using the qs module) and stored in request.query prior to validation.Values allowed: trueany query parameters allowed (no validation performed).This is the default. falseno query parameters allowed. @@ -592,7 +601,7 @@ declare module "hapi" { valuethe object containing the query parameters. optionsthe server validation options. next(err, value)the callback function called when validation is completed. */ - query?: boolean | IJoi | IValidationFunction; + query?: boolean | IJoi | IValidationFunction; /** validation rules for an incoming request payload (request body).Values allowed: trueany payload allowed (no validation performed).This is the default. falseno payload allowed. @@ -601,9 +610,9 @@ declare module "hapi" { valuethe object containing the payload object. optionsthe server validation options. next(err, value)the callback function called when validation is completed. */ - payload?: boolean | IJoi | IValidationFunction; - /** an optional object with error fields copied into every validation error response. */ - errorFields?: any; + payload?: boolean | IJoi | IValidationFunction; + /** an optional object with error fields copied into every validation error response. */ + errorFields?: any; /** determines how to handle invalid requests.Allowed values are: 'error'return a Bad Request (400) error response.This is the default value. 'log'log the error but continue processing the request. @@ -613,36 +622,36 @@ declare module "hapi" { replythe continuation reply interface. sourcethe source of the invalid field (e.g. 'path', 'query', 'payload'). errorthe error object prepared for the client response (including the validation function error under error.data). */ - failAction?: string | IRouteFailFunction; - /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ - options?: any; - }; - /** define timeouts for processing durations: */ - timeout?: { - /** response timeout in milliseconds.Sets the maximum time allowed for the server to respond to an incoming client request before giving up and responding with a Service Unavailable (503) error response.Disabled by default (false). */ - server: boolean|number; - /** by default, node sockets automatically timeout after 2 minutes.Use this option to override this behavior.Defaults to undefined which leaves the node default unchanged.Set to false to disable socket timeouts. */ - socket: boolean|number; - }; + failAction?: string | IRouteFailFunction; + /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ + options?: any; + }; + /** define timeouts for processing durations: */ + timeout?: { + /** response timeout in milliseconds.Sets the maximum time allowed for the server to respond to an incoming client request before giving up and responding with a Service Unavailable (503) error response.Disabled by default (false). */ + server: boolean | number; + /** by default, node sockets automatically timeout after 2 minutes.Use this option to override this behavior.Defaults to undefined which leaves the node default unchanged.Set to false to disable socket timeouts. */ + socket: boolean | number; + }; /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). *route description used for generating documentation (string). */ - description?: string; + description?: string; /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). *route notes used for generating documentation (string or array of strings). */ - notes?: string|string[]; + notes?: string | string[]; /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). *route tags used for generating documentation (array of strings). */ - tags?: string[] - } + tags?: string[] + } /** * specifying the route access rules. Each rule is evaluated against an incoming request and access is granted if at least one rule matches */ - export interface IRouteAdditionalConfigurationAuthAccess { + export interface IRouteAdditionalConfigurationAuthAccess { /** * the application scope required to access the route. Value can be a scope string or an array of scope strings. * The authenticated credentials object scope property must contain at least one of the scopes defined to access the route. @@ -652,14 +661,14 @@ declare module "hapi" { * on the request object (query and params} to populate a dynamic scope by using {} characters around the property name, * such as 'user-{params.id}'. Defaults to false (no scope requirements). */ - scope?: string|Array|boolean; + scope?: string | Array | boolean; /** the required authenticated entity type. If set, must match the entity value of the authentication credentials. Available values: * any - the authentication can be on behalf of a user or application. This is the default value. * user - the authentication must be on behalf of a user which is identified by the presence of a user attribute in the credentials object returned by the authentication strategy. * app - the authentication must be on behalf of an application which is identified by the lack of presence of a user attribute in the credentials object returned by the authentication strategy. */ - entity?: string; - } + entity?: string; + } /** server.realm http://hapijs.com/api#serverrealm The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), @@ -671,33 +680,33 @@ declare module "hapi" { return next(); }; */ - export interface IServerRealm { - /** when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method */ - modifiers: { - /** routes preferences: */ - route: { - /** - the route path prefix used by any calls to server.route() from the server. */ - prefix: string; - /** the route virtual host settings used by any calls to server.route() from the server. */ - vhost: string; - }; + export interface IServerRealm { + /** when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method */ + modifiers: { + /** routes preferences: */ + route: { + /** - the route path prefix used by any calls to server.route() from the server. */ + prefix: string; + /** the route virtual host settings used by any calls to server.route() from the server. */ + vhost: string; + }; - }; - /** the active plugin name (empty string if at the server root). */ - plugin: string; - /** plugin-specific state to be shared only among activities sharing the same active state. plugins is an object where each key is a plugin name and the value is the plugin state. */ - plugins: IDictionary; - /** settings overrides */ - settings: { - files: { - relativeTo: any; - }; - bind: any; - } - } + }; + /** the active plugin name (empty string if at the server root). */ + plugin: string; + /** plugin-specific state to be shared only among activities sharing the same active state. plugins is an object where each key is a plugin name and the value is the plugin state. */ + plugins: IDictionary; + /** settings overrides */ + settings: { + files: { + relativeTo: any; + }; + bind: any; + } + } /** server.state(name, [options]) http://hapijs.com/api#serverstatename-options HTTP state management uses client cookies to persist a state across multiple requests. Registers a cookie definitions where:*/ - export interface IServerState { + export interface IServerState { /** - the cookie name string. */name: string; /** - are the optional cookie settings: */options: { @@ -709,51 +718,51 @@ declare module "hapi" { /** if present and the cookie was not received from the client or explicitly set by the route handler, the cookie is automatically added to the response with the provided value. The value can be a function with signature function(request, next) where: request - the request object. next - the continuation function using the function(err, value) signature.*/ - autoValue: (request: Request, next: (err: any, value: any) => void) => void; + autoValue: (request: Request, next: (err: any, value: any) => void) => void; /** - encoding performs on the provided value before serialization. Options are: 'none' - no encoding. When used, the cookie value must be a string. This is the default value. 'base64' - string value is encoded using Base64. 'base64json' - object value is JSON-stringified than encoded using Base64. 'form' - object value is encoded using the x-www-form-urlencoded method. 'iron' - Encrypts and sign the value using iron.*/ - encoding: string; + encoding: string; /** - an object used to calculate an HMAC for cookie integrity validation.This does not provide privacy, only a mean to verify that the cookie value was generated by the server.Redundant when 'iron' encoding is used.Options are:*/sign: { /** - algorithm options.Defaults to require('iron').defaults.integrity.*/integrity: any; /** - password used for HMAC key generation.*/password: string; - }; + }; /** - password used for 'iron' encoding.*/password: string; /** - options for 'iron' encoding.Defaults to require('iron').defaults.*/iron: any; /** - if false, errors are ignored and treated as missing cookies.*/ignoreErrors: boolean; /** - if true, automatically instruct the client to remove invalid cookies.Defaults to false.*/clearInvalid: boolean; /** - if false, allows any cookie value including values in violation of RFC 6265. Defaults to true.*/strictHeader: boolean; /** - overrides the default proxy localStatePassThrough setting.*/passThrough: any; - }; - } + }; + } - export interface IFileHandlerConfig { - /** a path string or function as described above.*/ - path: string; - /** an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ - filename?: string; + export interface IFileHandlerConfig { + /** a path string or function as described above.*/ + path: string; + /** an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ + filename?: string; /**- specifies whether to include the 'Content-Disposition' header with the response. Available values: false - header is not included. This is the default value. 'attachment' 'inline'*/ - mode?: boolean| string; - /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false.*/ - lookupCompressed: boolean; - } + mode?: boolean | string; + /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false.*/ + lookupCompressed: boolean; + } /**http://hapijs.com/api#route-handler Built-in handlers The framework comes with a few built-in handler types available by setting the route handler config to an object containing one of these keys.*/ - export interface IRouteHandlerConfig { + export interface IRouteHandlerConfig { /** generates a static file endpoint for serving a single file. file can be set to: a relative or absolute file path string (relative paths are resolved based on the route files configuration). a function with the signature function(request) which returns the relative or absolute file path. an object with the following options */ - file?: string | IRequestHandler |IFileHandlerConfig; + file?: string | IRequestHandler | IFileHandlerConfig; /** directory - generates a directory endpoint for serving static content from a directory. Routes using the directory handler must include a path parameter at the end of the path string (e.g. /path/to/somewhere/{param} where the parameter name does not matter). The path parameter can use any of the parameter options (e.g. {param} for one level files only, {param?} for one level files or the directory root, {param*} for any level, or {param*3} for a specific level). If additional path parameters are present, they are ignored for the purpose of selecting the file system resource. The directory handler is an object with the following options: path - (required) the directory root path (relative paths are resolved based on the route files configuration). Value can be: a single path string used as the prefix for any resources requested by appending the request path parameter to the provided string. @@ -765,111 +774,111 @@ declare module "hapi" { redirectToSlash - optional boolean, determines if requests for a directory without a trailing slash are redirected to the same path with the missing slash. Useful for ensuring relative links inside the response are resolved correctly. Disabled when the server config router.stripTrailingSlash is true.Defaults to false. lookupCompressed - optional boolean, instructs the file processor to look for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. defaultExtension - optional string, appended to file requests if the requested file is not found. Defaults to no extension.*/ - directory?: { - path: string |Array | IRequestHandler | IRequestHandler>; - index?: boolean; - listing?: boolean; - showHidden?: boolean; - redirectToSlash?: boolean; - lookupCompressed?: boolean; - defaultExtension?: string; - }; - proxy?: IProxyHandlerConfig; - view?: string | { - 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 | IFailAction; - }; - payload: { - output: { - data: any; - stream: any; - file: any; - }; - parse?: any; - allow?: string|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|boolean|{ - mode: string; - strategies: Array; - payload?: boolean|string; - tos?: boolean|string; - scope?: string|Array; - entity: string; - }; - cors?: boolean; - jsonp?: string; - description?: string; - notes?: string|Array; - tags?: Array; - }; - } + directory?: { + path: string | Array | IRequestHandler | IRequestHandler>; + index?: boolean | string | string[]; + listing?: boolean; + showHidden?: boolean; + redirectToSlash?: boolean; + lookupCompressed?: boolean; + defaultExtension?: string; + }; + proxy?: IProxyHandlerConfig; + view?: string | { + 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 | IFailAction; + }; + payload: { + output: { + data: any; + stream: any; + file: any; + }; + parse?: any; + allow?: string | 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 | boolean | { + mode: string; + strategies: Array; + payload?: boolean | string; + tos?: boolean | string; + scope?: string | Array; + entity: string; + }; + cors?: boolean; + jsonp?: string; + description?: string; + notes?: string | Array; + tags?: Array; + }; + } /** Route configuration The route configuration object*/ - export interface IRouteConfiguration { - /** - (required) the absolute path used to match incoming requests (must begin with '/'). Incoming requests are compared to the configured paths based on the connection router configuration option.The path can include named parameters enclosed in {} which will be matched against literal values in the request as described in Path parameters.*/ - path: string; + export interface IRouteConfiguration { + /** - (required) the absolute path used to match incoming requests (must begin with '/'). Incoming requests are compared to the configured paths based on the connection router configuration option.The path can include named parameters enclosed in {} which will be matched against literal values in the request as described in Path parameters.*/ + path: string; /** - (required) the HTTP method.Typically one of 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', or 'OPTIONS'.Any HTTP method is allowed, except for 'HEAD'.Use '*' to match against any HTTP method (only when an exact match was not found, and any match with a specific method will be given a higher priority over a wildcard match). * Can be assigned an array of methods which has the same result as adding the same route with different methods manually.*/ - method: string|string[]; - /** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/ - vhost?: string; - /** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/ - handler: ISessionHandler | string | IRouteHandlerConfig; - /** - additional route options.*/ - config?: IRouteAdditionalConfigurationOptions; - } - /** Route public interface When route information is returned or made available as a property. http://hapijs.com/api#route-public-interface */ - export interface IRoute { + method: string | string[]; + /** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/ + vhost?: string; + /** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/ + handler: ISessionHandler | string | IRouteHandlerConfig; + /** - additional route options.*/ + config?: IRouteAdditionalConfigurationOptions; + } + /** Route public interface When route information is returned or made available as a property. http://hapijs.com/api#route-public-interface */ + export interface IRoute { - /** the route HTTP method. */ - method: string; - /** the route path. */ - path: string; - /** the route vhost option if configured. */ - vhost?: string|Array; - /** the [active realm] associated with the route.*/ - realm: IServerRealm; - /** the [route options] object with all defaults applied. */ - settings: IRouteAdditionalConfigurationOptions; - } + /** the route HTTP method. */ + method: string; + /** the route path. */ + path: string; + /** the route vhost option if configured. */ + vhost?: string | Array; + /** the [active realm] associated with the route.*/ + realm: IServerRealm; + /** the [route options] object with all defaults applied. */ + settings: IRouteAdditionalConfigurationOptions; + } - export interface IServerAuthScheme { + export interface IServerAuthScheme { /** authenticate(request, reply) - required function called on each incoming request configured with the authentication scheme where: request - the request object. reply - the reply interface the authentication method must call when done authenticating the request where: @@ -899,7 +908,7 @@ declare module "hapi" { }; }; server.auth.scheme('custom', scheme);*/ - authenticate(request: Request, reply: IReply): void; + authenticate(request: Request, reply: IReply): void; /** payload(request, reply) - optional function called to authenticate the request payload where: request - the request object. reply(err, response) - is called if authentication failed where: @@ -907,70 +916,70 @@ declare module "hapi" { response - any authentication response action such as redirection. Ignored if err is present, otherwise required. reply.continue() - is called if payload authentication succeeded. When the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'.*/ - payload? (request: Request, reply: IReply): void; + payload?(request: Request, reply: IReply): void; /** response(request, reply) - optional function called to decorate the response with authentication headers before the response headers or payload is written where: request - the request object. reply(err, response) - is called if an error occurred where: err - any authentication error. response - any authentication response to send instead of the current response. Ignored if err is present, otherwise required. reply.continue() - is called if the operation succeeded.*/ - response? (request: Request, reply: IReply): void; - /** an optional object */ - options?: { - /** if true, requires payload validation as part of the scheme and forbids routes from disabling payload auth validation. Defaults to false.*/ - payload: boolean; - } - } + response?(request: Request, reply: IReply): void; + /** an optional object */ + options?: { + /** if true, requires payload validation as part of the scheme and forbids routes from disabling payload auth validation. Defaults to false.*/ + payload: boolean; + } + } - export interface IServerInject { - (options: string | { - /** the request HTTP method (e.g. 'POST'). Defaults to 'GET'.*/ - method: string; - /** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/ - url: string; - /** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/ - headers?: IDictionary; - /** n optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/ - payload?: string|{}|Buffer; - /** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/ - credentials?: any; - /** an optional artifacts object containing authentication artifact information. The artifacts are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Ignored if set without credentials. Defaults to no artifacts.*/ - artifacts?: any; - /** sets the initial value of request.app*/ - app?: any; - /** sets the initial value of request.plugins*/ - plugins?: any; - /** allows access to routes with config.isInternal set to true. Defaults to false.*/ - allowInternals?: boolean; - /** sets the remote address for the incoming connection.*/ - remoteAddress?: boolean; + export interface IServerInject { + (options: string | { + /** the request HTTP method (e.g. 'POST'). Defaults to 'GET'.*/ + method: string; + /** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/ + url: string; + /** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/ + headers?: IDictionary; + /** n optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/ + payload?: string | {} | Buffer; + /** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/ + credentials?: any; + /** an optional artifacts object containing authentication artifact information. The artifacts are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Ignored if set without credentials. Defaults to no artifacts.*/ + artifacts?: any; + /** sets the initial value of request.app*/ + app?: any; + /** sets the initial value of request.plugins*/ + plugins?: any; + /** allows access to routes with config.isInternal set to true. Defaults to false.*/ + allowInternals?: boolean; + /** sets the remote address for the incoming connection.*/ + remoteAddress?: boolean; /**object with options used to simulate client request stream conditions for testing: error - if true, emits an 'error' event after payload transmission (if any). Defaults to false. close - if true, emits a 'close' event after payload transmission (if any). Defaults to false. end - if false, does not end the stream. Defaults to true.*/ - simulate?: { - error: boolean; - close: boolean; - end: boolean; - }; - }, - callback: ( - /**the response object where: - statusCode - the HTTP status code. - headers - an object containing the headers set. - payload - the response payload string. - rawPayload - the raw response payload buffer. - raw - an object with the injection request and response objects: - req - the simulated node request object. - res - the simulated node response object. - result - the raw handler response (e.g. when not a stream or a view) before it is serialized for transmission. If not available, the value is set to payload. Useful for inspection and reuse of the internal objects returned (instead of parsing the response string). - request - the request object.*/ - res: { statusCode: number; headers: IDictionary; payload: string; rawPayload: Buffer; raw: { req: http.ClientRequest; res: http.ServerResponse }; result: string; request: Request }) => void - ):void; + simulate?: { + error: boolean; + close: boolean; + end: boolean; + }; + }, + callback: ( + /**the response object where: + statusCode - the HTTP status code. + headers - an object containing the headers set. + payload - the response payload string. + rawPayload - the raw response payload buffer. + raw - an object with the injection request and response objects: + req - the simulated node request object. + res - the simulated node response object. + result - the raw handler response (e.g. when not a stream or a view) before it is serialized for transmission. If not available, the value is set to payload. Useful for inspection and reuse of the internal objects returned (instead of parsing the response string). + request - the request object.*/ + res: { statusCode: number; headers: IDictionary; payload: string; rawPayload: Buffer; raw: { req: http.ClientRequest; res: http.ServerResponse }; result: string; request: Request }) => void + ): void; - } + } /** host - optional host to filter routes matching a specific virtual host. Defaults to all virtual hosts. @@ -981,44 +990,44 @@ declare module "hapi" { settings - the route config with defaults applied. method - the HTTP method in lower case. path - the route path.*/ - export interface IConnectionTable { - info: any; - labels: any; - table: IRoute[]; - } + export interface IConnectionTable { + info: any; + labels: any; + table: IRoute[]; + } - export interface ICookieSettings { - /** - time - to - live in milliseconds.Defaults to null (session time- life - cookies are deleted when the browser is closed).*/ - ttl?: number; - /** - sets the 'Secure' flag.Defaults to false.*/ - isSecure?: boolean; - /** - sets the 'HttpOnly' flag.Defaults to false.*/ - isHttpOnly?: boolean; - /** - the path scope.Defaults to null (no path).*/ - path?: string; - /** - the domain scope.Defaults to null (no domain).*/ - domain?: any; + export interface ICookieSettings { + /** - time - to - live in milliseconds.Defaults to null (session time- life - cookies are deleted when the browser is closed).*/ + ttl?: number; + /** - sets the 'Secure' flag.Defaults to false.*/ + isSecure?: boolean; + /** - sets the 'HttpOnly' flag.Defaults to false.*/ + isHttpOnly?: boolean; + /** - the path scope.Defaults to null (no path).*/ + path?: string; + /** - the domain scope.Defaults to null (no domain).*/ + domain?: any; /** - if present and the cookie was not received from the client or explicitly set by the route handler, the cookie is automatically added to the response with the provided value.The value can be a function with signature function(request, next) where: request - the request object. next - the continuation function using the function(err, value) signature.*/ - autoValue?: (request: Request, next: (err: any, value: any) => void) => void; + autoValue?: (request: Request, next: (err: any, value: any) => void) => void; /** - encoding performs on the provided value before serialization.Options are: 'none' - no encoding.When used, the cookie value must be a string.This is the default value. 'base64' - string value is encoded using Base64. 'base64json' - object value is JSON- stringified than encoded using Base64. 'form' - object value is encoded using the x- www - form - urlencoded method. */ - encoding?: string; + encoding?: string; /** - an object used to calculate an HMAC for cookie integrity validation.This does not provide privacy, only a mean to verify that the cookie value was generated by the server.Redundant when 'iron' encoding is used.Options are: integrity - algorithm options.Defaults to require('iron').defaults.integrity. password - password used for HMAC key generation. */ - sign?: { integrity: any; password: string; } - password?: string; - iron?: any; - ignoreErrors?: boolean; - clearInvalid?: boolean; - strictHeader?: boolean; - passThrough?: any; - } + sign?: { integrity: any; password: string; } + password?: string; + iron?: any; + ignoreErrors?: boolean; + clearInvalid?: boolean; + strictHeader?: boolean; + passThrough?: any; + } /** method - the method function with the signature is one of: function(arg1, arg2, ..., argn, next) where: @@ -1031,26 +1040,26 @@ declare module "hapi" { arg1, arg2, etc. - the method function arguments. the callback option is set to false. the method must returns a value (result, Error, or a promise) or throw an Error.*/ - export interface IServerMethod { - //(): void; - //(next: (err: any, result: any, ttl: number) => void): void; - //(arg1: any): void; - //(arg1: any, arg2: any, next: (err: any, result: any, ttl: number) => void): void; - //(arg1: any, arg2: any): void; - (...args: any[]): void; + export interface IServerMethod { + //(): void; + //(next: (err: any, result: any, ttl: number) => void): void; + //(arg1: any): void; + //(arg1: any, arg2: any, next: (err: any, result: any, ttl: number) => void): void; + //(arg1: any, arg2: any): void; + (...args: any[]): void; - } + } /** options - optional configuration: bind - a context object passed back to the method function (via this) when called. Defaults to active context (set via server.bind() when the method is registered. cache - the same cache configuration used in server.cache(). callback - if false, expects the method to be a synchronous function. Note that using a synchronous function with caching will convert the method interface to require a callback as an additional argument with the signature function(err, result, cached, report) since the cache interface cannot return values synchronously. Defaults to true. generateKey - a function used to generate a unique key (for caching) from the arguments passed to the method function (the callback argument is not passed as input). The server will automatically generate a unique key if the function's arguments are all of types 'string', 'number', or 'boolean'. However if the method uses other types of arguments, a key generation function must be provided which takes the same arguments as the function and returns a unique string (or null if no key can be generated).*/ - export interface IServerMethodOptions { - bind?: any; - cache?: ICatBoxCacheOptions; - callback?: boolean; - generateKey?(args: any[]): string; - } + export interface IServerMethodOptions { + bind?: any; + cache?: ICatBoxCacheOptions; + callback?: boolean; + generateKey?(args: any[]): string; + } /** Request object The request object is created internally for each incoming request. It is different from the node.js request object received from the HTTP server callback (which is available in request.raw.req). The request object methods and properties change throughout the request lifecycle. @@ -1086,114 +1095,116 @@ declare module "hapi" { return reply.continue(); });*/ - export class Request extends Events.EventEmitter { - /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ - app: any; - /** authentication information*/ - auth: { - /** true is the request has been successfully authenticated, otherwise false.*/ - isAuthenticated: boolean; - /** the credential object received during the authentication process. The presence of an object does not mean successful authentication.*/ - credentials: any; - /** an artifact object received from the authentication strategy and used in authentication-related actions.*/ - artifacts: any; - /** the route authentication mode.*/ - mode: any; - /** the authentication error is failed and mode set to 'try'.*/ - error: any; - /** an object used by the ['cookie' authentication scheme] https://github.com/hapijs/hapi-auth-cookie */ - session: any - }; - /** the node domain object used to protect against exceptions thrown in extensions, handlers and route prerequisites. Can be used to manually bind callback functions otherwise bound to other domains.*/ - domain: any; - /** the raw request headers (references request.raw.headers).*/ - headers: IDictionary; - /** a unique request identifier (using the format '{now}:{connection.info.id}:{5 digits counter}').*/ - id: number; - /** request information */ - info: { - /** request reception timestamp. */ - received: number; - /** request response timestamp (0 is not responded yet). */ - responded: number; - /** remote client IP address. */ + export class Request extends Events.EventEmitter { + /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ + app: any; + /** authentication information*/ + auth: { + /** true is the request has been successfully authenticated, otherwise false.*/ + isAuthenticated: boolean; + /** the credential object received during the authentication process. The presence of an object does not mean successful authentication. can be set in the validate function's callback.*/ + credentials: any; + /** an artifact object received from the authentication strategy and used in authentication-related actions.*/ + artifacts: any; + /** the route authentication mode.*/ + mode: any; + /** the authentication error is failed and mode set to 'try'.*/ + error: any; + /** an object used by the ['cookie' authentication scheme] https://github.com/hapijs/hapi-auth-cookie */ + session: any + }; + /** the connection used by this request*/ + connection: ServerConnection; + /** the node domain object used to protect against exceptions thrown in extensions, handlers and route prerequisites. Can be used to manually bind callback functions otherwise bound to other domains.*/ + domain: any; + /** the raw request headers (references request.raw.headers).*/ + headers: IDictionary; + /** a unique request identifier (using the format '{now}:{connection.info.id}:{5 digits counter}').*/ + id: number; + /** request information */ + info: { + /** request reception timestamp. */ + received: number; + /** request response timestamp (0 is not responded yet). */ + responded: number; + /** remote client IP address. */ - remoteAddress: string; - /** remote client port. */ - remotePort: number; - /** content of the HTTP 'Referrer' (or 'Referer') header. */ - referrer: string; - /** content of the HTTP 'Host' header (e.g. 'example.com:8080'). */ - host: string; - /** the hostname part of the 'Host' header (e.g. 'example.com').*/ - hostname: string; - }; - /** the request method in lower case (e.g. 'get', 'post'). */ - method: string; - /** the parsed content-type header. Only available when payload parsing enabled and no payload error occurred. */ - mime: string; - /** an object containing the values of params, query, and payload before any validation modifications made. Only set when input validation is performed.*/ - orig: { - params: any; - query: any; - payload: any; - }; - /** an object where each key is a path parameter name with matching value as described in Path parameters.*/ - params: IDictionary; - /** an array containing all the path params values in the order they appeared in the path.*/ - paramsArray: string[]; - /** the request URI's path component. */ - path: string; - /** the request payload based on the route payload.output and payload.parse settings.*/ - payload: any; - /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state.*/ - plugins: any; - /** an object where each key is the name assigned by a route prerequisites function. The values are the raw values provided to the continuation function as argument. For the wrapped response object, use responses.*/ - pre: IDictionary; - /** the response object when set. The object can be modified but must not be assigned another object. To replace the response with another from within an extension point, use reply(response) to override with a different response. Contains null when no response has been set (e.g. when a request terminates prematurely when the client disconnects).*/ - response: Response; - /**preResponses - same as pre but represented as the response object created by the pre method.*/ - preResponses: any; - /**an object containing the query parameters.*/ - query: any; - /** an object containing the Node HTTP server objects. Direct interaction with these raw objects is not recommended.*/ - raw: { - req: http.ClientRequest; - res: http.ServerResponse; - }; - /** the route public interface.*/ - route: IRoute; - /** the server object. */ - server: Server; - /** Special key reserved for plugins implementing session support. Plugins utilizing this key must check for null value to ensure there is no conflict with another similar server. */ - session: any; - /** an object containing parsed HTTP state information (cookies) where each key is the cookie name and value is the matching cookie content after processing using any registered cookie definition. */ - state: any; - /** complex object contining details on the url */ - url: { - /** null when i tested */ - auth: any; - /** null when i tested */ - hash: any; - /** null when i tested */ - host: any; - /** null when i tested */ - hostname: any; - href: string; - path: string; - /** path without search*/ - pathname: string; - /** null when i tested */ - port: any; - /** null when i tested */ - protocol: any; - /** querystring parameters*/ - query: IDictionary; - /** querystring parameters as a string*/ - search: string; - /** null when i tested */ - slashes: any; - }; + remoteAddress: string; + /** remote client port. */ + remotePort: number; + /** content of the HTTP 'Referrer' (or 'Referer') header. */ + referrer: string; + /** content of the HTTP 'Host' header (e.g. 'example.com:8080'). */ + host: string; + /** the hostname part of the 'Host' header (e.g. 'example.com').*/ + hostname: string; + }; + /** the request method in lower case (e.g. 'get', 'post'). */ + method: string; + /** the parsed content-type header. Only available when payload parsing enabled and no payload error occurred. */ + mime: string; + /** an object containing the values of params, query, and payload before any validation modifications made. Only set when input validation is performed.*/ + orig: { + params: any; + query: any; + payload: any; + }; + /** an object where each key is a path parameter name with matching value as described in Path parameters.*/ + params: IDictionary; + /** an array containing all the path params values in the order they appeared in the path.*/ + paramsArray: string[]; + /** the request URI's path component. */ + path: string; + /** the request payload based on the route payload.output and payload.parse settings.*/ + payload: stream.Readable | Buffer | any; + /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state.*/ + plugins: any; + /** an object where each key is the name assigned by a route prerequisites function. The values are the raw values provided to the continuation function as argument. For the wrapped response object, use responses.*/ + pre: IDictionary; + /** the response object when set. The object can be modified but must not be assigned another object. To replace the response with another from within an extension point, use reply(response) to override with a different response. Contains null when no response has been set (e.g. when a request terminates prematurely when the client disconnects).*/ + response: Response; + /**preResponses - same as pre but represented as the response object created by the pre method.*/ + preResponses: any; + /**an object containing the query parameters.*/ + query: any; + /** an object containing the Node HTTP server objects. Direct interaction with these raw objects is not recommended.*/ + raw: { + req: http.ClientRequest; + res: http.ServerResponse; + }; + /** the route public interface.*/ + route: IRoute; + /** the server object. */ + server: Server; + /** Special key reserved for plugins implementing session support. Plugins utilizing this key must check for null value to ensure there is no conflict with another similar server. */ + session: any; + /** an object containing parsed HTTP state information (cookies) where each key is the cookie name and value is the matching cookie content after processing using any registered cookie definition. */ + state: any; + /** complex object contining details on the url */ + url: { + /** null when i tested */ + auth: any; + /** null when i tested */ + hash: any; + /** null when i tested */ + host: any; + /** null when i tested */ + hostname: any; + href: string; + path: string; + /** path without search*/ + pathname: string; + /** null when i tested */ + port: any; + /** null when i tested */ + protocol: any; + /** querystring parameters*/ + query: IDictionary; + /** querystring parameters as a string*/ + search: string; + /** null when i tested */ + slashes: any; + }; /** request.setUrl(url) Available only in 'onRequest' extension methods. @@ -1211,7 +1222,7 @@ declare module "hapi" { request.setUrl('/test'); return reply.continue(); });*/ - setUrl(url: string): void; + setUrl(url: string): void; /** request.setMethod(method) Available only in 'onRequest' extension methods. @@ -1229,7 +1240,7 @@ declare module "hapi" { request.setMethod('GET'); return reply.continue(); });*/ - setMethod(method: string): void; + setMethod(method: string): void; /** request.log(tags, [data, [timestamp]]) Always available. @@ -1257,13 +1268,13 @@ declare module "hapi" { return reply(); }; */ - log( - /** a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events.*/ - tags: string|string[], - /** an optional message string or object with the application data being logged.*/ - data?: string, - /** an optional timestamp expressed in milliseconds. Defaults to Date.now() (now).*/ - timestamp?: number): void; + log( + /** a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events.*/ + tags: string | string[], + /** an optional message string or object with the application data being logged.*/ + data?: string, + /** an optional timestamp expressed in milliseconds. Defaults to Date.now() (now).*/ + timestamp?: number): void; /** request.getLog([tags], [internal]) Always available. @@ -1275,11 +1286,11 @@ declare module "hapi" { request.getLog(['error'], true); request.getLog(false);*/ - getLog( - /** is a single tag string or array of tag strings. If no tags specified, returns all events.*/ - tags?: string, - /** filters the events to only those with a matching event.internal value. If true, only internal logs are included. If false, only user event are included. Defaults to all events (undefined).*/ - internal?: boolean): string[]; + getLog( + /** is a single tag string or array of tag strings. If no tags specified, returns all events.*/ + tags?: string, + /** filters the events to only those with a matching event.internal value. If true, only internal logs are included. If false, only user event are included. Defaults to all events (undefined).*/ + internal?: boolean): string[]; /** request.tail([name]) @@ -1316,10 +1327,10 @@ declare module "hapi" { console.log('Request completed including db activity'); });*/ - tail( - /** an optional tail name used for logging purposes.*/ - name?: string): Function; - } + tail( + /** an optional tail name used for logging purposes.*/ + name?: string): Function; + } /** Response events The response object supports the following events: @@ -1351,14 +1362,14 @@ declare module "hapi" { return reply.continue(); });*/ - export class Response extends Events.EventEmitter { - isBoom: boolean; - /** the HTTP response status code. Defaults to 200 (except for errors).*/ - statusCode: number; - /** an object containing the response headers where each key is a header field name. Note that this is an incomplete list of headers to be included with the response. Additional headers will be added once the response is prepare for transmission.*/ - headers: IDictionary; - /** the value provided using the reply interface.*/ - source: any; + export class Response extends Events.EventEmitter { + isBoom: boolean; + /** the HTTP response status code. Defaults to 200 (except for errors).*/ + statusCode: number; + /** an object containing the response headers where each key is a header field name. Note that this is an incomplete list of headers to be included with the response. Additional headers will be added once the response is prepare for transmission.*/ + headers: IDictionary; + /** the value provided using the reply interface.*/ + source: any; /** a string indicating the type of source with available values: 'plain' - a plain response such as string, number, null, or simple object (e.g. not a Stream, Buffer, or view). 'buffer' - a Buffer. @@ -1366,11 +1377,11 @@ declare module "hapi" { 'file' - a file generated with reply.file() of via the directory handler. 'stream' - a Stream. 'promise' - a Promise object. */ - variety: string; - /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ - app: any; - /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state. */ - plugins: any; + variety: string; + /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ + app: any; + /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state. */ + plugins: any; /** settings - response handling flags: charset - the 'Content-Type' HTTP header 'charset' property. Defaults to 'utf-8'. encoding - the string encoding scheme used to serial data into the HTTP payload when source is a string or marshals into a string. Defaults to 'utf8'. @@ -1378,39 +1389,39 @@ declare module "hapi" { stringify - options used for source value requiring stringification. Defaults to no replacer and no space padding. ttl - if set, overrides the route cache expiration milliseconds value set in the route config. Defaults to no override. varyEtag - if true, a suffix will be automatically added to the 'ETag' header at transmission time (separated by a '-' character) when the HTTP 'Vary' header is present.*/ - settings: { - charset: string; - encoding: string; - passThrough: boolean; - stringify: any; - ttl: number; - varyEtag: boolean; - } + settings: { + charset: string; + encoding: string; + passThrough: boolean; + stringify: any; + ttl: number; + varyEtag: boolean; + } /** sets the HTTP 'Content-Length' header (to avoid chunked transfer encoding) where: length - the header value. Must match the actual payload size.*/ - bytes(length: number): Response; - /** sets the 'Content-Type' HTTP header 'charset' property where: charset - the charset property value.*/ - charset(charset: string): Response; + bytes(length: number): Response; + /** sets the 'Content-Type' HTTP header 'charset' property where: charset - the charset property value.*/ + charset(charset: string): Response; /** sets the HTTP status code where: statusCode - the HTTP status code.*/ - code(statusCode: number): Response; - /** sets the HTTP status code to Created (201) and the HTTP 'Location' header where: uri - an absolute or relative URI used as the 'Location' header value.*/ - created(uri: string): Response; + code(statusCode: number): Response; + /** sets the HTTP status code to Created (201) and the HTTP 'Location' header where: uri - an absolute or relative URI used as the 'Location' header value.*/ + created(uri: string): Response; - /** encoding(encoding) - sets the string encoding scheme used to serial data into the HTTP payload where: encoding - the encoding property value (see node Buffer encoding).*/ - encoding(encoding: string): Response; + /** encoding(encoding) - sets the string encoding scheme used to serial data into the HTTP payload where: encoding - the encoding property value (see node Buffer encoding).*/ + encoding(encoding: string): Response; /** etag(tag, options) - sets the representation entity tag where: tag - the entity tag string without the double-quote. options - optional settings where: weak - if true, the tag will be prefixed with the 'W/' weak signifier. Weak tags will fail to match identical tags for the purpose of determining 304 response status. Defaults to false. vary - if true and content encoding is set or applied to the response (e.g 'gzip' or 'deflate'), the encoding name will be automatically added to the tag at transmission time (separated by a '-' character). Ignored when weak is true. Defaults to true.*/ - etag(tag: string, options: { - weak: boolean; vary: boolean; - }): Response; + etag(tag: string, options: { + weak: boolean; vary: boolean; + }): Response; /**header(name, value, options) - sets an HTTP header where: name - the header name. @@ -1419,39 +1430,120 @@ declare module "hapi" { append - if true, the value is appended to any existing header value using separator. Defaults to false. separator - string used as separator when appending to an exiting value. Defaults to ','. override - if false, the header value is not set if an existing value present. Defaults to true.*/ - header(name: string, value: string, options?: { - append: boolean; - separator: string; - override: boolean; - }): Response; + header(name: string, value: string, options?: { + append: boolean; + separator: string; + override: boolean; + }): Response; /** location(uri) - sets the HTTP 'Location' header where: uri - an absolute or relative URI used as the 'Location' header value.*/ - location(uri: string): Response; + location(uri: string): Response; /** redirect(uri) - sets an HTTP redirection response (302) and decorates the response with additional methods listed below, where: uri - an absolute or relative URI used to redirect the client to another resource. */ - redirect(uri: string): Response; + redirect(uri: string): Response; /** replacer(method) - sets the JSON.stringify() replacer argument where: method - the replacer function or array. Defaults to none.*/ - replacer(method: Function| Array): Response; + replacer(method: Function | Array): Response; /** spaces(count) - sets the JSON.stringify() space argument where: count - the number of spaces to indent nested object keys. Defaults to no indentation. */ - spaces(count: number): Response; + spaces(count: number): Response; /**state(name, value, [options]) - sets an HTTP cookie where: name - the cookie name. value - the cookie value. If no encoding is defined, must be a string. options - optional configuration. If the state was previously registered with the server using server.state(), the specified keys in options override those same keys in the server definition (but not others).*/ - state(name: string, value: string, options?: any): Response; + state(name: string, value: string, options?: any): Response; + /** sets a string suffix when the response is process via JSON.stringify().*/ + suffix(suffix: string): void; + /** overrides the default route cache expiration rule for this response instance where: +msec - the time-to-live value in milliseconds.*/ + ttl(msec: number): void; /** type(mimeType) - sets the HTTP 'Content-Type' header where: mimeType - is the mime type. Should only be used to override the built-in default for each response type. */ - type(mimeType: string): Response; - } - + type(mimeType: string): Response; + /** clears the HTTP cookie by setting an expired value where: +name - the cookie name. +options - optional configuration for expiring cookie. If the state was previously registered with the server using server.state(), the specified keys in options override those same keys in the server definition (but not others).*/ + unstate(name: string, options?: { [key: string]: string }): void; + /** adds the provided header to the list of inputs affected the response generation via the HTTP 'Vary' header where: +header - the HTTP request header name.*/ + vary(header: string): void; + } + /** When using the redirect() method, the response object provides these additional methods */ + export class ResponseRedirect extends Response { + /** sets the status code to 302 or 307 (based on the rewritable() setting) where: +isTemporary - if false, sets status to permanent. Defaults to true.*/ + temporary(isTemporary: boolean): void; + /** sets the status code to 301 or 308 (based on the rewritable() setting) where: +isPermanent - if true, sets status to temporary. Defaults to false. */ + permanent(isPermanent: boolean): void; + /** sets the status code to 301/302 for rewritable (allows changing the request method from 'POST' to 'GET') or 307/308 for non-rewritable (does not allow changing the request method from 'POST' to 'GET'). Exact code based on the temporary() or permanent() setting. Arguments: +isRewritable - if false, sets to non-rewritable. Defaults to true. +Permanent Temporary +Rewritable 301 302(1) +Non-rewritable 308(2) 307 +Notes: 1. Default value. 2. Proposed code, not supported by all clients. */ + rewritable(isRewritable: boolean): void; + } + /** info about a server connection */ + export interface IServerConnectionInfo { + /** - a unique connection identifier (using the format '{hostname}:{pid}:{now base36}').*/ + id: string; + /** - the connection creation timestamp.*/ + created: number; + /** - the connection start timestamp (0 when stopped).*/ + started: number; + /** the connection port based on the following rules: + the configured port value before the server has been started. + the actual port assigned when no port is configured or set to 0 after the server has been started.*/ + port: number; + /** - the host name the connection was configured to. Defaults to the operating system hostname when available, otherwise 'localhost'.*/ + host: string; + /** - the active IP address the connection was bound to after starting.Set to undefined until the server has been started or when using a non TCP port (e.g. UNIX domain socket).*/ + address: string; + /** - the protocol used: + 'http' - HTTP. + 'https' - HTTPS. + 'socket' - UNIX domain socket or Windows named pipe.*/ + protocol: string; + /** a string representing the connection (e.g. 'http://example.com:8080' or 'socket:/unix/domain/socket/path'). Contains the uri setting if provided, otherwise constructed from the available settings. If no port is available or set to 0, the uri will not include a port component.*/ + uri: string; + } + /** + * undocumented. The connection object constructed after calling server.connection(); + * can be accessed via server.connections; or request.connection; + */ + export class ServerConnection extends Events.EventEmitter { + domain: any; + _events: { route: Function, domain: Function, _events: Function, _eventsCount: Function, _maxListeners: Function }; + _eventsCount: number; + settings: IServerConnectionOptions; + server: Server; + /** ex: "tcp" */ + type: string; + _started: boolean; + /** dictionary of sockets */ + _connections: { [ip_port: string]: any }; + _onConnection: Function; + registrations: any; + _extensions: any; + _requestCounter: { value: number; min: number; max: number }; + _load: any; + states: { + settings: any; cookies: any; names: any[] + }; + auth: { connection: ServerConnection; _schemes: any; _strategies: any; settings: any; }; + _router: any; + MSPluginsCollection: any; + applicationCache: any; + addEventListener: any; + info: IServerConnectionInfo; + } /** Server http://hapijs.com/api#server rver object is the main application container. The server manages all incoming connections along with all the facilities provided by the framework. A server can contain more than one connection (e.g. listen to port 80 and 8080). @@ -1467,9 +1559,9 @@ declare module "hapi" { 'tail' - emitted when a request finished processing, including any registered tails. Single event per request. Note that the server object should not be used to emit application events as its internal implementation is designed to fan events out to the various plugin selections and not for application events. MORE EVENTS HERE: http://hapijs.com/api#server-events*/ - export class Server extends Events.EventEmitter { + export class Server extends Events.EventEmitter { - constructor(options?: IServerOptions); + constructor(options?: IServerOptions); /** Provides a safe place to store server-specific run-time application data without potential conflicts with the framework internals. The data can be accessed whenever the server is accessible. Initialized with an empty object. var Hapi = require('hapi'); server = new Hapi.Server(); @@ -1477,7 +1569,7 @@ declare module "hapi" { var handler = function (request, reply) { return reply(request.server.app.key); }; */ - app: any; + app: any; /** An array containing the server's connections. When the server object is returned from server.select(), the connections array only includes the connections matching the selection criteria. var server = new Hapi.Server(); server.connection({ port: 80, labels: 'a' }); @@ -1485,7 +1577,7 @@ declare module "hapi" { // server.connections.length === 2 var a = server.select('a'); // a.connections.length === 1*/ - connections: Array; + connections: Array; /** When the server contains exactly one connection, info is an object containing information about the sole connection. * When the server contains more than one connection, each server.connections array member provides its own connection.info. var server = new Hapi.Server(); @@ -1495,41 +1587,18 @@ declare module "hapi" { // server.info === null // server.connections[1].info.port === 8080 */ - info: { - /** - a unique connection identifier (using the format '{hostname}:{pid}:{now base36}').*/ - id: string; - /** - the connection creation timestamp.*/ - created: number; - /** - the connection start timestamp (0 when stopped).*/ - started: number; - /** the connection port based on the following rules: - the configured port value before the server has been started. - the actual port assigned when no port is configured or set to 0 after the server has been started.*/ - port: number; - - /** - the host name the connection was configured to. Defaults to the operating system hostname when available, otherwise 'localhost'.*/ - host: string; - /** - the active IP address the connection was bound to after starting.Set to undefined until the server has been started or when using a non TCP port (e.g. UNIX domain socket).*/ - address: string; - /** - the protocol used: - 'http' - HTTP. - 'https' - HTTPS. - 'socket' - UNIX domain socket or Windows named pipe.*/ - protocol: string; - /** a string representing the connection (e.g. 'http://example.com:8080' or 'socket:/unix/domain/socket/path'). Contains the uri setting if provided, otherwise constructed from the available settings. If no port is available or set to 0, the uri will not include a port component.*/ - uri: string; - }; + info: IServerConnectionInfo; /** An object containing the process load metrics (when load.sampleInterval is enabled): rss - RSS memory usage. var Hapi = require('hapi'); var server = new Hapi.Server({ load: { sampleInterval: 1000 } }); console.log(server.load.rss);*/ - load: { - /** - event loop delay milliseconds.*/ - eventLoopDelay: number; - /** - V8 heap usage.*/ - heapUsed: number; - }; + load: { + /** - event loop delay milliseconds.*/ + eventLoopDelay: number; + /** - V8 heap usage.*/ + heapUsed: number; + }; /** When the server contains exactly one connection, listener is the node HTTP server object of the sole connection. When the server contains more than one connection, each server.connections array member provides its own connection.listener. var Hapi = require('hapi'); @@ -1540,7 +1609,7 @@ declare module "hapi" { io.sockets.on('connection', function(socket) { socket.emit({ msg: 'welcome' }); });*/ - listener: http.Server; + listener: http.Server; /** server.methods An object providing access to the server methods where each server method name is an object property. @@ -1552,7 +1621,7 @@ declare module "hapi" { server.methods.add(1, 2, function (err, result) { // result === 3 });*/ - methods: IDictionary; + methods: IDictionary; /** server.mime Provides access to the server MIME database used for setting content-type information. The object must not be modified directly but only through the mime server setting. @@ -1572,7 +1641,7 @@ declare module "hapi" { var server = new Hapi.Server(options); // server.mime.path('code.js').type === 'application/javascript' // server.mime.path('file.npm').type === 'node/module'*/ - mime: any; + mime: any; /**server.plugins An object containing the values exposed by each plugin registered where each key is a plugin name and the values are the exposed properties by each plugin using server.expose(). Plugins may set the value of the server.plugins[name] object directly or via the server.expose() method. exports.register = function (server, options, next) { @@ -1583,7 +1652,7 @@ declare module "hapi" { exports.register.attributes = { name: 'example' };*/ - plugins: IDictionary; + plugins: IDictionary; /** server.realm The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin). Realms are a limited version of a sandbox where plugins can maintain state used by the framework when adding routes, extensions, and other properties. modifiers - when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method and includes: @@ -1600,11 +1669,11 @@ declare module "hapi" { console.log(server.realm.modifiers.route.prefix); return next(); };*/ - realm: IServerRealm; + realm: IServerRealm; /** server.root The root server object containing all the connections and the root server methods (e.g. start(), stop(), connection()).*/ - root: Server; + root: Server; /** server.settings The server configuration object after defaults applied. var Hapi = require('hapi'); @@ -1614,14 +1683,14 @@ declare module "hapi" { } }); // server.settings.app === { key: 'value' }*/ - settings: IServerOptions; + settings: IServerOptions; /** server.version The hapi module version number. var Hapi = require('hapi'); var server = new Hapi.Server(); // server.version === '8.0.0'*/ - version: string; + version: string; /** server.after(method, [dependencies]) Adds a method to be called after all the plugin dependencies have been registered and before the server starts (only called if the server is started) where: @@ -1640,9 +1709,9 @@ declare module "hapi" { // After method already executed }); server.auth.default(options)*/ - after(method: (plugin: any, next: (err: any) => void) => void, dependencies: string|string[]): void; + after(method: (plugin: any, next: (err: any) => void) => void, dependencies: string | string[]): void; - auth: { + auth: { /** server.auth.default(options) Sets a default strategy which is applied to every route where: options - a string with the default strategy name or an object with a specified strategy or strategies using the same format as the route auth handler options. @@ -1660,14 +1729,14 @@ declare module "hapi" { return reply(request.auth.credentials.user); } });*/ - default(options: string):void; + default(options: string): void; /** server.auth.scheme(name, scheme) Registers an authentication scheme where: name - the scheme name. scheme - the method implementing the scheme with signature function(server, options) where: server - a reference to the server object the scheme is added to. options - optional scheme settings used to instantiate a strategy.*/ - scheme(name: string, + scheme(name: string, /** When the scheme authenticate() method implementation calls reply() with an error condition, the specifics of the error affect whether additional authentication strategies will be attempted if configured for the route. If the err returned by the reply() method includes a message, no additional strategies will be attempted. If the err does not include a message but does include a scheme name (e.g. Boom.unauthorized(null, 'Custom')), additional strategies will be attempted in order of preference. n the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'. server = new Hapi.Server(); @@ -1685,7 +1754,7 @@ declare module "hapi" { }; }; */ - scheme: (server: Server, options: any) => IServerAuthScheme): void; + scheme: (server: Server, options: any) => IServerAuthScheme): void; /** server.auth.strategy(name, scheme, [mode], [options]) Registers an authentication strategy where: @@ -1707,7 +1776,7 @@ declare module "hapi" { } } });*/ - strategy(name: string, scheme: any, mode?: boolean, options?: any):void; + strategy(name: string, scheme: any, mode?: boolean | string, options?: any): void; /** server.auth.test(strategy, request, next) Tests a request against an authentication strategy where: @@ -1733,8 +1802,8 @@ declare module "hapi" { }); } });*/ - test(strategy: string, request: Request, next: (err: any, credentials: any) => void): void; - }; + test(strategy: string, request: Request, next: (err: any, credentials: any) => void): void; + }; /** server.bind(context) Sets a global context used as the default bind object when adding a route or an extension where: context - the object used to bind this in handler and extension methods. @@ -1750,7 +1819,7 @@ declare module "hapi" { server.route({ method: 'GET', path: '/', handler: handler }); return next(); };*/ - bind(context: any): void; + bind(context: any): void; /** server.cache(options) @@ -1773,7 +1842,7 @@ declare module "hapi" { // value === { capital: 'oslo' }; }); });*/ - cache(options: ICatBoxCacheOptions): void; + cache(options: ICatBoxCacheOptions): void; /** server.connection([options]) Adds an incoming server connection @@ -1787,7 +1856,7 @@ declare module "hapi" { // server.connections.length === 2 // web.connections.length === 1 // admin.connections.length === 1 */ - connection(options: IServerConnectionOptions): Server; + connection(options: IServerConnectionOptions): Server; /** server.decorate(type, property, method) Extends various framework interfaces with custom methods where: type - the interface being decorated. Supported types: @@ -1809,7 +1878,7 @@ declare module "hapi" { return reply.success(); } });*/ - decorate(type: string, property: string, method: Function):void; + decorate(type: string, property: string, method: Function): void; /** server.dependency(dependencies, [after]) Used within a plugin to declares a required dependency on other plugins where: @@ -1826,7 +1895,7 @@ declare module "hapi" { // Additional plugin registration logic return next(); };*/ - dependency(dependencies: string|string[], after?: (server: Server, next: (err: any) => void) => void): void; + dependency(dependencies: string | string[], after?: (server: Server, next: (err: any) => void) => void): void; /** server.expose(key, value) @@ -1837,7 +1906,7 @@ declare module "hapi" { server.expose('util', function () { console.log('something'); }); return next(); };*/ - expose(key: string, value: any): void; + expose(key: string, value: any): void; /** server.expose(obj) Merges a deep copy of an object into to the existing content of server.plugins[name] where: @@ -1846,13 +1915,13 @@ declare module "hapi" { server.expose({ util: function () { console.log('something'); } }); return next(); };*/ - expose(obj: any): void; + expose(obj: any): void; /** server.ext(event, method, [options]) Registers an extension function in one of the available extension points where: event - the event name. method - a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is function(request, reply) where: - request - the request object. + request - the request object. NOTE: Access the Response via request.response reply - the reply interface which is used to return control back to the framework. To continue normal execution of the request lifecycle, reply.continue() must be called. To abort processing and return a response to the client, call reply(value) where value is an error or any other valid response. this - the object provided via options.bind or the current active context set with server.bind(). options - an optional object with the following: @@ -1873,7 +1942,7 @@ declare module "hapi" { server.route({ method: 'GET', path: '/test', handler: handler }); server.start(); // All requests will get routed to '/test'*/ - ext(event: string, method: (request: Request, reply: IReply, bind?: any) => void, options?: { before: string|string[]; after: string|string[]; bind?: any }): void; + ext(event: string, method: (request: Request, reply: IReply, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void; /** server.handler(name, method) Registers a new handler type to be used in routes where: @@ -1913,7 +1982,7 @@ declare module "hapi" { } }; server.handler('test', handler);*/ - handler(name: string, method: (route: IRoute, options: THandlerConfig) => ISessionHandler): void; + handler(name: string, method: (route: IRoute, options: THandlerConfig) => ISessionHandler): void; /** When the server contains exactly one connection, injects a request into the sole connection simulating an incoming HTTP request without making an actual socket connection. Injection is useful for testing purposes as well as for invoking routing logic internally without the overhead or limitations of the network stack. Utilizes the [shot module | https://github.com/hapijs/shot ] for performing injections, with some additional options and response properties @@ -1929,7 +1998,7 @@ declare module "hapi" { console.log(res.result); }); */ - inject: IServerInject; + inject: IServerInject; /** server.log(tags, [data, [timestamp]]) Logs server events that cannot be associated with a specific request. When called the server emits a 'log' event which can be used by other listeners or plugins to record the information or output to the console. The arguments are: @@ -1945,7 +2014,7 @@ declare module "hapi" { } }); server.log(['test', 'error'], 'Test event');*/ - log(tags: string|string[], data?: string|any, timestamp?: number): void; + log(tags: string | string[], data?: string | any, timestamp?: number): void; /**server.lookup(id) When the server contains exactly one connection, looks up a route configuration where: id - the route identifier as set in the route options. @@ -1962,7 +2031,7 @@ declare module "hapi" { }); var route = server.lookup('root'); When the server contains more than one connection, each server.connections array member provides its own connection.lookup() method.*/ - lookup(id: string): IRoute; + lookup(id: string): IRoute; /** server.match(method, path, [host]) When the server contains exactly one connection, looks up a route configuration where: method - the HTTP method (e.g. 'GET', 'POST'). @@ -1981,7 +2050,7 @@ declare module "hapi" { }); var route = server.match('get', '/'); When the server contains more than one connection, each server.connections array member provides its own connection.match() method.*/ - match(method: string, path: string, host?: string): IRoute; + match(method: string, path: string, host?: string): IRoute; @@ -2025,11 +2094,11 @@ declare module "hapi" { server.methods.sumSync(4, 5, function (err, result) { console.log(result); }); */ - method( - /** a unique method name used to invoke the method via server.methods[name]. When configured with caching enabled, server.methods[name].cache.drop(arg1, arg2, ..., argn, callback) can be used to clear the cache for a given key. Supports using nested names such as utils.users.get which will automatically create the missing path under server.methods and can be accessed for the previous example via server.methods.utils.users.get.*/ - name: string, - method: IServerMethod, - options?: IServerMethodOptions):void; + method( + /** a unique method name used to invoke the method via server.methods[name]. When configured with caching enabled, server.methods[name].cache.drop(arg1, arg2, ..., argn, callback) can be used to clear the cache for a given key. Supports using nested names such as utils.users.get which will automatically create the missing path under server.methods and can be accessed for the previous example via server.methods.utils.users.get.*/ + name: string, + method: IServerMethod, + options?: IServerMethodOptions): void; /**server.method(methods) @@ -2050,11 +2119,11 @@ declare module "hapi" { } } });*/ - method(methods: { - name: string; method: IServerMethod; options?: IServerMethodOptions - }| Array<{ - name: string; method: IServerMethod; options?: IServerMethodOptions - }>):void; + method(methods: { + name: string; method: IServerMethod; options?: IServerMethodOptions + } | Array<{ + name: string; method: IServerMethod; options?: IServerMethodOptions + }>): void; /**server.path(relativeTo) Sets the path prefix used to locate static resources (files and view templates) when relative paths are used where: relativeTo - the path prefix added to any relative file path starting with '.'. @@ -2064,7 +2133,7 @@ declare module "hapi" { server.route({ path: '/file', method: 'GET', handler: { file: './test.html' } }); next(); };*/ - path(relativeTo: string): void; + path(relativeTo: string): void; /**server.register(plugins, [options], callback) Registers a plugin where: plugins - an object or array of objects where each one is either: @@ -2089,15 +2158,15 @@ declare module "hapi" { console.log('Failed loading plugin'); } });*/ - register(plugins: any|any[], options: { - select: string|string[]; - routes: { - prefix: string; vhost?: string|string[] - }; - } - , callback: (err: any) => void):void; + register(plugins: any | any[], options: { + select: string | string[]; + routes: { + prefix: string; vhost?: string | string[] + }; + } + , callback: (err: any) => void): void; - register(plugins: any|any[], callback: (err: any) => void):void; + register(plugins: any | any[], callback: (err: any) => void): void; /**server.render(template, context, [options], callback) Utilizes the server views manager to render a template where: @@ -2122,7 +2191,7 @@ declare module "hapi" { server.render('hello', context, function (err, rendered, config) { console.log(rendered); });*/ - render(template: string, context: any, options: any, callback: (err: any, rendered: any, config: any) => void):void; + render(template: string, context: any, options: any, callback: (err: any, rendered: any, config: any) => void): void; /** server.route(options) Adds a connection route where: options - a route configuration object or an array of configuration objects. @@ -2134,8 +2203,8 @@ declare module "hapi" { { method: 'GET', path: '/1', handler: function (request, reply) { return reply('ok'); } }, { method: 'GET', path: '/2', handler: function (request, reply) { return reply('ok'); } } ]);*/ - route(options: IRouteConfiguration):void; - route(options: IRouteConfiguration[]):void; + route(options: IRouteConfiguration): void; + route(options: IRouteConfiguration[]): void; /**server.select(labels) Selects a subset of the server's connections where: labels - a single string or array of strings of labels used as a logical OR statement to select all the connections with matching labels in their configuration. @@ -2149,7 +2218,7 @@ declare module "hapi" { var a = server.select('a'); // The server with port 80 var ab = server.select(['a','b']); // A list of servers containing the server with port 80 and the server with port 8080 var c = server.select('c'); // A list of servers containing the server with port 8081 and the server with port 8082 */ - select(labels: string|string[]): Server|Server[]; + select(labels: string | string[]): Server | Server[]; /** server.start([callback]) Starts the server connections by listening for incoming requests on the configured port of each listener (unless the connection was configured with autoListen set to false), where: callback - optional callback when server startup is completed or failed with the signature function(err) where: @@ -2160,7 +2229,7 @@ declare module "hapi" { server.start(function (err) { console.log('Server started at: ' + server.info.uri); });*/ - start(callback?: (err: any) => void): void; + start(callback?: (err: any) => void): void; /** server.state(name, [options]) HTTP state management uses client cookies to persist a state across multiple requests. Registers a cookie definitions State defaults can be modified via the server connections.routes.state configuration option. @@ -2192,7 +2261,7 @@ declare module "hapi" { console.error(event); } }); */ - state(name: string, options?: ICookieSettings): void; + state(name: string, options?: ICookieSettings): void; /** server.stop([options], [callback]) Stops the server's connections by refusing to accept any new connections or requests (existing connections will continue until closed or timeout), where: @@ -2205,7 +2274,7 @@ declare module "hapi" { server.stop({ timeout: 60 * 1000 }, function () { console.log('Server stopped'); });*/ - stop(options?: { timeout: number }, callback?: () => void): void; + stop(options?: { timeout: number }, callback?: () => void): void; /**server.table([host]) Returns a copy of the routing table where: host - optional host to filter routes matching a specific virtual host. Defaults to all virtual hosts. @@ -2236,7 +2305,7 @@ declare module "hapi" { // } //] */ - table(host?: any): IConnectionTable; + table(host?: any): IConnectionTable; /**server.views(options) Initializes the server views manager @@ -2250,7 +2319,7 @@ declare module "hapi" { path: '/static/templates' }); When server.views() is called within a plugin, the views manager is only available to plugins methods.*/ - views(options: IServerViewsConfiguration): void; + views(options: IServerViewsConfiguration): void; - } + } } From 8d852210cf8378ac5fe11380b5d1d17f2e5b0968 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 15 Jan 2016 09:48:12 -0800 Subject: [PATCH 393/441] fix bluebird.d.ts promise.delay() typing: ms is first arg. see http://bluebirdjs.com/docs/api/promise.delay.html --- bluebird/bluebird.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index 023eab7aa2..2dfdcf854f 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -106,8 +106,8 @@ interface PromiseConstructor { * Returns a promise that will be fulfilled with `value` (or `undefined`) after given `ms` milliseconds. If `value` is a promise, the delay will start counting down when it is fulfilled and the returned promise will be fulfilled with the fulfillment value of the `value` promise. */ // TODO enable more overloads - delay(value: PromiseLike, ms: number): Promise; - delay(value: T, ms: number): Promise; + delay(ms: number, value: PromiseLike): Promise; + delay(ms: number, value: T): Promise; delay(ms: number): Promise; /** From 82a2b628a36a0d66d1c8623a51cca07899f1a187 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 15 Jan 2016 10:13:52 -0800 Subject: [PATCH 394/441] fix bluebird test file for proper Promise.delay() parameter order. --- bluebird/bluebird-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bluebird/bluebird-tests.ts b/bluebird/bluebird-tests.ts index b1829c52ed..00f6e951fa 100644 --- a/bluebird/bluebird-tests.ts +++ b/bluebird/bluebird-tests.ts @@ -754,8 +754,8 @@ Promise.longStackTraces(); //TODO enable delay -fooProm = Promise.delay(fooThen, num); -fooProm = Promise.delay(foo, num); +fooProm = Promise.delay(num, fooThen); +fooProm = Promise.delay(num, foo); voidProm = Promise.delay(num); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 5bff5f871a0ea58be885fb52146cb67b86bcc1ae Mon Sep 17 00:00:00 2001 From: Will Johnston Date: Fri, 15 Jan 2016 12:19:16 -0600 Subject: [PATCH 395/441] adding catch onto Thenable, updating tests --- es6-promise/es6-promise-tests.ts | 57 +++++++++++++++++--------------- es6-promise/es6-promise.d.ts | 1 + 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/es6-promise/es6-promise-tests.ts b/es6-promise/es6-promise-tests.ts index 0980ac26cc..ac4f92d3d5 100644 --- a/es6-promise/es6-promise-tests.ts +++ b/es6-promise/es6-promise-tests.ts @@ -68,6 +68,9 @@ promiseNumber = thenWithUndefinedFullFillAndPromiseReject; var thenWithNoResultAndNoReject = promiseString.then(); promiseNumber = thenWithNoResultAndNoReject; +var catchAfterThen = promiseString.then().catch(); +promiseNumber = catchAfterThen; + var voidPromise = new Promise(function (resolve) { resolve(); }); //catch test @@ -161,31 +164,31 @@ getJSON('story.json').then(function(story: Story) { (document.querySelector('.spinner')).style.display = 'none'; }); -interface T1 { - __t1: string; -} - -interface T2 { - __t2: string; -} - -interface T3 { - __t3: string; -} - -function f1(): Promise { - return Promise.resolve({ __t1: "foo_t1" }); -} - -function f2(x: T1): T2 { - return { __t2: x.__t1 + ":foo_21" }; -} - -var x3 = f1() - .then(f2, (e: Error) => { - console.log("error 1"); - throw e; -}) - .then((x: T2) => { - return { __t3: x.__t2 + "bar" }; +interface T1 { + __t1: string; +} + +interface T2 { + __t2: string; +} + +interface T3 { + __t3: string; +} + +function f1(): Promise { + return Promise.resolve({ __t1: "foo_t1" }); +} + +function f2(x: T1): T2 { + return { __t2: x.__t1 + ":foo_21" }; +} + +var x3 = f1() + .then(f2, (e: Error) => { + console.log("error 1"); + throw e; +}) + .then((x: T2) => { + return { __t3: x.__t2 + "bar" }; }); \ No newline at end of file diff --git a/es6-promise/es6-promise.d.ts b/es6-promise/es6-promise.d.ts index daf7134f7f..a8f8d78451 100644 --- a/es6-promise/es6-promise.d.ts +++ b/es6-promise/es6-promise.d.ts @@ -6,6 +6,7 @@ interface Thenable { then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Thenable; + catch(onRejected?: (error: any) => U | Thenable): Thenable; } declare class Promise implements Thenable { From 0224e96881ac7a7ee8017defbe397ff5d8c77c15 Mon Sep 17 00:00:00 2001 From: Will Johnston Date: Fri, 15 Jan 2016 12:25:22 -0600 Subject: [PATCH 396/441] fixing promises a plus test for compatibility with es6 promises --- promises-a-plus/promises-a-plus-tests.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/promises-a-plus/promises-a-plus-tests.ts b/promises-a-plus/promises-a-plus-tests.ts index bf6cc5ce07..0d7f5261af 100644 --- a/promises-a-plus/promises-a-plus-tests.ts +++ b/promises-a-plus/promises-a-plus-tests.ts @@ -4,9 +4,9 @@ /// /// -var thenNum: PromisesAPlus.Thenable; -var thenStr: PromisesAPlus.Thenable; -var thenBool: PromisesAPlus.Thenable; +var thenNum: PromisesAPlus.Thenable; +var thenStr: PromisesAPlus.Thenable; +var thenBool: PromisesAPlus.Thenable; var impl: PromisesAPlus.PromiseImpl; @@ -45,9 +45,9 @@ function testCompatibleWithRxJS() { } function testCompatibleWithES6Promises() { - // from spec to ES6 - var es6ThenNum: Thenable = thenNum; - var es6ThenStr: Thenable = thenStr; + // define ES6 thenables + var es6ThenNum: Thenable; + var es6ThenStr: Thenable; // from ES6 to spec thenNum = es6ThenNum; From 7554cff7c4dd34decc2f3dc0d711a6c288174eee Mon Sep 17 00:00:00 2001 From: Kevin Smets Date: Fri, 15 Jan 2016 20:26:20 +0100 Subject: [PATCH 397/441] Fixed restoreConsole --- log4js/log4js.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/log4js/log4js.d.ts b/log4js/log4js.d.ts index 4a1160ec1b..ab172a1221 100644 --- a/log4js/log4js.d.ts +++ b/log4js/log4js.d.ts @@ -17,10 +17,9 @@ declare module "log4js" { /** * Restores the console - * @param logger * @returns void */ - export function restoreConsole(logger?: Logger): void; + export function restoreConsole(): void; /** * Get a logger instance. Instance is cached on categoryName level. From 33e0e801f1f2d1f13430883794cdf104099dce6c Mon Sep 17 00:00:00 2001 From: haizz Date: Fri, 15 Jan 2016 22:32:20 +0200 Subject: [PATCH 398/441] Update react-bootstrap.d.ts --- react-bootstrap/react-bootstrap.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/react-bootstrap/react-bootstrap.d.ts b/react-bootstrap/react-bootstrap.d.ts index c63c55e9d0..597b80cbdc 100644 --- a/react-bootstrap/react-bootstrap.d.ts +++ b/react-bootstrap/react-bootstrap.d.ts @@ -120,6 +120,8 @@ declare module "react-bootstrap" { eventKey?: any; header?: boolean; href?: string; + onClick?: Function; + onKeyDown?: Function; onSelect?: Function; target?: string; title?: string; From 684cd0268c021d426175802f14d8c38153463cab Mon Sep 17 00:00:00 2001 From: abraaoalves Date: Sat, 16 Jan 2016 16:07:04 -0300 Subject: [PATCH 399/441] add wiredep definition --- wiredep/wiredep-tests.ts | 17 ++ wiredep/wiredep.d.ts | 372 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 389 insertions(+) create mode 100644 wiredep/wiredep-tests.ts create mode 100644 wiredep/wiredep.d.ts diff --git a/wiredep/wiredep-tests.ts b/wiredep/wiredep-tests.ts new file mode 100644 index 0000000000..4a8313bd67 --- /dev/null +++ b/wiredep/wiredep-tests.ts @@ -0,0 +1,17 @@ +/// +/// + +import gulp = require('gulp'); +import wiredep = require('wiredep'); + +gulp.task('bower', function () { + gulp.src('./src/footer.html') + .pipe(wiredep.stream({ + cwd:'.', + overrides:{ + optional: 'configuration', + goes: 'here' + } + })) + .pipe(gulp.dest('./dest')); +}); \ No newline at end of file diff --git a/wiredep/wiredep.d.ts b/wiredep/wiredep.d.ts new file mode 100644 index 0000000000..add84b1641 --- /dev/null +++ b/wiredep/wiredep.d.ts @@ -0,0 +1,372 @@ +// Type definitions for Wiredep v3.0.x +// Project: https://github.com/taptapship/wiredep +// Definitions by: Abraão Alves +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'wiredep' { + + interface PathFiles{ + [type: string]: string[]; + } + + /** + * @return {PathFiles} paths to your files by extension + * @example: + * { + * js: [ + * 'paths/to/your/js/files.js', + * 'in/their/order/of/dependency.js' + * ], + * css: [ + * 'paths/to/your/css/files.css' + * ], + * // etc. + * } + */ + function Wiredep(config: WiredepParams): PathFiles; + + module Wiredep { + export function stream(config: WiredepParams): NodeJS.ReadWriteStream; + } + + + interface WiredepParams { + src?: string | string[]; + /** + * the directory of your Bower packages. + * Default: '.bowerrc'.directory || bower_components + */ + directory?: string; + /** + * your bower.json file contents. + * Default: require('./bower.json') + */ + bowerJson?: string; + + + // ----- Advanced Configuration ----- + // All of the below settings are for advanced configuration, to + // give your project support for additional file types and more + // control. + // + // Out of the box, wiredep will handle HTML files just fine for + // JavaScript and CSS injection. + + /** + * path to where we are pretending to be + */ + cwd?: string; + /** + * Default: true + */ + dependencies?: boolean; + /** + * Default: false + */ + devDependencies?: boolean; + /** + * Default: false + */ + includeSelf?: boolean; + /** + * @example: + * [ /jquery/, 'bower_components/modernizr/modernizr.js' ] + */ + exclude?: Array; + + /** + * string or regexp to ignore from the injected filepath + * @example: + * [ /jquery/, 'bower_components/modernizr/modernizr.js' ] + */ + ignorePath?: string | RegExp; + + /** + * This inline object offers another way to define your overrides if + * modifying your project's `bower.json` isn't an option. + */ + overrides?: Object; + + /** + * If not overridden, an error will throw + * + * err.code can be: + * - "PKG_NOT_INSTALLED" (a Bower package was not found) + * - "BOWER_COMPONENTS_MISSING" (cannot find the `bower_components` directory) + */ + onError?: (err: Error) => void; + + /** + * @param {string} filePath name of file that was updated + */ + onFileUpdated?: (filePath: string) => void; + + /** + * @param {FileObject} fileObject + */ + onPathInjected?: (fileObject: FileObject) => void; + + /** + * @param {string} pkg name of bower package without main + */ + onMainNotFound?: (pkg: string) => void; + + fileTypes? : FileTypes; + } + + interface FileObject { + /** + * type of wiredep block ('js', 'css', etc) + */ + block: string; + /** + * name of file that was updated + */ + file: string; + /** + * path to file that was injected + */ + path: string + } + + interface FileTypes { + fileExtension: { + /** + * match the beginning-to-end of a bower block in this type of file + */ + block: RegExp; + detect: { + /** + * match the way this type of file is included + */ + typeOfBowerFile: RegExp; + }; + replace: { + /** + * + */ + typeOfBowerFile: string; + /** + * @exemple: + * return '' + */ + anotherTypeOfBowerFile: (filePath) => string; + } + }; + + // defaults: + html: { + /** + * @example: + * /(([ \t]*))(\n|\r|.)*?()/gi + */ + block: RegExp; + + detect: { + /** + * @example: + * /' + */ + js: string; + /** + * @example: + * '' + */ + css: string; + }; + }; + + jade: { + /** + * @example: + * /(([ \t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi + */ + block: RegExp; + detect: { + /** + * @example: + * /script\(.*src=['"]([^'"]+)/gi + */ + js: RegExp; + /** + * @example: + * /link\(.*href=['"]([^'"]+)/gi + */ + css: RegExp; + }; + + replace: { + /** + * @example: + * 'script(src=\'{{filePath}}\')' + */ + js: string; + /** + * @example: + * 'link(rel=\'stylesheet\', href=\'{{filePath}}\')' + */ + css: string; + } + }; + + less: { + /** + * @example: + * /(([ \t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi + */ + block: RegExp; + detect: { + /** + * @example: + * /@import\s['"](.+css)['"]/gi + */ + css: RegExp; + /** + * @example: + * /@import\s['"](.+less)['"]/gi + */ + less: RegExp + }; + + replace: { + /** + * @example: + * '@import "{{filePath}}";' + */ + css: string; + /** + * @example: + * '@import "{{filePath}}";' + */ + less: string; + }; + }; + + scss: { + /** + * @example: + * /(([ \t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi + */ + block: RegExp; + detect: { + /** + * @example: + * /@import\s['"](.+css)['"]/gi + */ + css: RegExp; + /** + * @example: + * /@import\s['"](.+sass)['"]/gi + */ + sass: RegExp; + /** + * @example: + * /@import\s['"](.+scss)['"]/gi + */ + scss: RegExp; + }, + replace: { + /** + * @example: + * '@import "{{filePath}}";' + */ + css: string; + /** + * @example: + * '@import "{{filePath}}";' + */ + sass: string; + /** + * @example: + * '@import "{{filePath}}";' + */ + scss: string; + } + }; + + styl: { + /** + * @example: + * /(([ \t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi + */ + block: RegExp; + + detect: { + /** + * @example: + * /@import\s['"](.+css)['"]/gi + */ + css: RegExp; + /** + * @example: + * /@import\s['"](.+styl)['"]/gi + */ + styl: RegExp; + }; + replace: { + /** + * @example: + * '@import "{{filePath}}"' + */ + css: string; + /** + * @example: + * '@import "{{filePath}}"' + */ + styl: string; + }; + }; + + yaml: { + /** + * @example: + * /(([ \t]*)#\s*bower:*(\S*))(\n|\r|.)*?(#\s*endbower)/gi + */ + block: RegExp; + + detect: { + /** + * @example: + * /-\s(.+js)/gi + */ + js: RegExp; + /** + * @example: + * /-\s(.+css)/gi + */ + css: RegExp; + }; + + replace: { + /** + * @example: + * '- {{filePath}}' + */ + js: string; + /** + * @example: + * '- {{filePath}}' + */ + css: string; + }; + }; + } + + +export = Wiredep; +} \ No newline at end of file From 263c39f5766f8eb9b8738b1cba6591efb131f21f Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 16 Jan 2016 22:57:14 +0500 Subject: [PATCH 400/441] base-x and bs58: definitions and tests added --- base-x/base-x-tests.ts | 14 ++++++++++++++ base-x/base-x.d.ts | 28 ++++++++++++++++++++++++++++ bs58/bs58-tests.ts | 12 ++++++++++++ bs58/bs58.d.ts | 14 ++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 base-x/base-x-tests.ts create mode 100644 base-x/base-x.d.ts create mode 100644 bs58/bs58-tests.ts create mode 100644 bs58/bs58.d.ts diff --git a/base-x/base-x-tests.ts b/base-x/base-x-tests.ts new file mode 100644 index 0000000000..3e082c45ba --- /dev/null +++ b/base-x/base-x-tests.ts @@ -0,0 +1,14 @@ +/// + +import * as basex from 'base-x'; + +let bs16: BaseX.BaseConverter = basex('0123456789ABCDEF'); + +{ + let encoded: string; + + encoded = bs16.encode([255]); + encoded = bs16.encode({0: 255, length: 1}); +} + +let decoded: number[] = bs16.decode('FF'); diff --git a/base-x/base-x.d.ts b/base-x/base-x.d.ts new file mode 100644 index 0000000000..681a058062 --- /dev/null +++ b/base-x/base-x.d.ts @@ -0,0 +1,28 @@ +// Type definitions for base-x v1.0.1 +// Project: https://github.com/cryptocoinjs/base-x +// Definitions by: Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare namespace BaseX { + interface EncodeBuffer { + [index: number]: number; + length: number; + } + + interface BaseConverter { + encode: (buffer: EncodeBuffer) => string; + decode: (string: string) => number[]; + } + + interface Base { + (ALPHABET: string): BaseX.BaseConverter + } +} + +declare module "base-x" { + namespace base {} + + let base: BaseX.Base; + + export = base; +} diff --git a/bs58/bs58-tests.ts b/bs58/bs58-tests.ts new file mode 100644 index 0000000000..8016469269 --- /dev/null +++ b/bs58/bs58-tests.ts @@ -0,0 +1,12 @@ +/// + +import * as bs58 from 'bs58'; + +{ + let encoded: string; + + encoded = bs58.encode([255]); + encoded = bs58.encode({0: 255, length: 1}); +} + +let decoded: number[] = bs58.decode('5Q'); diff --git a/bs58/bs58.d.ts b/bs58/bs58.d.ts new file mode 100644 index 0000000000..02b1cd3183 --- /dev/null +++ b/bs58/bs58.d.ts @@ -0,0 +1,14 @@ +// Type definitions for bs58 3.0.0 +// Project: https://github.com/cryptocoinjs/bs58 +// Definitions by: Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "bs58" { + namespace base58 {} + + let base58: BaseX.BaseConverter; + + export = base58; +} From 73f1ee61d99dbdcfd5456a1f07a297bd69906ee2 Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 16 Jan 2016 11:20:17 -0800 Subject: [PATCH 401/441] remove dependency on es6-promise.d.ts (it prevented using with other promise library definitions) --- axios/axios.d.ts | 264 ++++++++++++++++++++++++----------------------- 1 file changed, 137 insertions(+), 127 deletions(-) diff --git a/axios/axios.d.ts b/axios/axios.d.ts index 48f57a73a3..fd19caf94b 100644 --- a/axios/axios.d.ts +++ b/axios/axios.d.ts @@ -3,160 +3,170 @@ // Definitions by: Marcel Buesing // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// declare module Axios { - /** - * - request body data type - */ - interface AxiosXHRConfigBase { + interface IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IThenable; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IThenable; + } + + interface IPromise extends IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IPromise; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IPromise; + catch(onRejected?: (error: any) => U | IThenable): IPromise; + } /** - * Change the request data before it is sent to the server. - * This is only applicable for request methods 'PUT', 'POST', and 'PATCH' - * The last function in the array must return a string or an ArrayBuffer + * - request body data type */ - transformRequest?: ((data:T) => U)|[(data:T) => U]; + interface AxiosXHRConfigBase { + + /** + * Change the request data before it is sent to the server. + * This is only applicable for request methods 'PUT', 'POST', and 'PATCH' + * The last function in the array must return a string or an ArrayBuffer + */ + transformRequest?: ((data: T) => U) | [(data: T) => U]; + + /** + * change the response data to be made before it is passed to then/catch + */ + transformResponse?: (data: T) => U; + + /** + * custom headers to be sent + */ + headers?: Object; + + /** + * URL parameters to be sent with the request + */ + params?: Object; + + /** + * indicates whether or not cross-site Access-Control requests + * should be made using credentials + */ + withCredentials?: boolean; + + /** + * indicates the type of data that the server will respond with + * options are 'arraybuffer', 'blob', 'document', 'json', 'text' + */ + responseType?: string; + + /** + * name of the cookie to use as a value for xsrf token + */ + xsrfCookieName?: string; + + /** + * name of the http header that carries the xsrf token value + */ + xsrfHeaderName?: string; + + } /** - * change the response data to be made before it is passed to then/catch + * - request body data type */ - transformResponse?: (data:T) => U; + interface AxiosXHRConfig extends AxiosXHRConfigBase { + /** + * server URL that will be used for the request, options are: + * GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH + */ + url: string; + + /** + * request method to be used when making the request + */ + method?: string; + + /** + * data to be sent as the request body + * Only applicable for request methods 'PUT', 'POST', and 'PATCH' + * When no `transformRequest` is set, must be a string, an ArrayBuffer or a hash + */ + data?: T; + } /** - * custom headers to be sent + * - expected response type, + * - request body data type */ - headers?: Object; + interface AxiosXHR { + /** + * Response that was provided by the server + */ + data: T; + + /** + * HTTP status code from the server response + */ + status: number; + + /** + * HTTP status message from the server response + */ + statusText: string; + + /** + * headers that the server responded with + */ + headers: Object; + + /** + * config that was provided to `axios` for the request + */ + config: AxiosXHRConfig; + } /** - * URL parameters to be sent with the request + * - expected response type, + * - request body data type */ - params?: Object; + interface AxiosStatic { - /** - * indicates whether or not cross-site Access-Control requests - * should be made using credentials - */ - withCredentials?: boolean; + (config: AxiosXHRConfig): IPromise>; - /** - * indicates the type of data that the server will respond with - * options are 'arraybuffer', 'blob', 'document', 'json', 'text' - */ - responseType?: string; + new (config: AxiosXHRConfig): IPromise>; - /** - * name of the cookie to use as a value for xsrf token - */ - xsrfCookieName?: string; - - /** - * name of the http header that carries the xsrf token value - */ - xsrfHeaderName?: string; - - } - - /** - * - request body data type - */ - interface AxiosXHRConfig extends AxiosXHRConfigBase { - /** - * server URL that will be used for the request, options are: - * GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH - */ - url: string; - - /** - * request method to be used when making the request - */ - method?: string; - - /** - * data to be sent as the request body - * Only applicable for request methods 'PUT', 'POST', and 'PATCH' - * When no `transformRequest` is set, must be a string, an ArrayBuffer or a hash - */ - data?: T; - } - - /** - * - expected response type, - * - request body data type - */ - interface AxiosXHR { - /** - * Response that was provided by the server - */ - data: T; - - /** - * HTTP status code from the server response - */ - status: number; - - /** - * HTTP status message from the server response - */ - statusText: string; - - /** - * headers that the server responded with - */ - headers: Object; - - /** - * config that was provided to `axios` for the request - */ - config: AxiosXHRConfig; - } - - /** - * - expected response type, - * - request body data type - */ - interface AxiosStatic { - - (config: AxiosXHRConfig): Promise>; - - new (config: AxiosXHRConfig): Promise>; - - /** - * convenience alias, method = GET - */ - get(url: string, config?: AxiosXHRConfigBase): Promise>; + /** + * convenience alias, method = GET + */ + get(url: string, config?: AxiosXHRConfigBase): IPromise>; - /** - * convenience alias, method = DELETE - */ - delete(url: string, config?: AxiosXHRConfigBase): Promise>; + /** + * convenience alias, method = DELETE + */ + delete(url: string, config?: AxiosXHRConfigBase): IPromise>; - /** - * convenience alias, method = HEAD - */ - head(url: string, config?: AxiosXHRConfigBase): Promise>; + /** + * convenience alias, method = HEAD + */ + head(url: string, config?: AxiosXHRConfigBase): IPromise>; - /** - * convenience alias, method = POST - */ - post(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>; + /** + * convenience alias, method = POST + */ + post(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; - /** - * convenience alias, method = PUT - */ - put(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>; + /** + * convenience alias, method = PUT + */ + put(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; - /** - * convenience alias, method = PATCH - */ - patch(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>; - } + /** + * convenience alias, method = PATCH + */ + patch(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; + } } declare var axios: Axios.AxiosStatic; declare module "axios" { - export = axios; + export = axios; } From 5421783adfaf9b99e9274f4488cfc0ee73f17a56 Mon Sep 17 00:00:00 2001 From: SrTobi Date: Sat, 16 Jan 2016 00:30:37 +0100 Subject: [PATCH 402/441] added copy-paste --- copy-paste/copy-paste-tests.ts | 16 ++++++++++++ copy-paste/copy-paste.d.ts | 46 ++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 copy-paste/copy-paste-tests.ts create mode 100644 copy-paste/copy-paste.d.ts diff --git a/copy-paste/copy-paste-tests.ts b/copy-paste/copy-paste-tests.ts new file mode 100644 index 0000000000..400c32a2a2 --- /dev/null +++ b/copy-paste/copy-paste-tests.ts @@ -0,0 +1,16 @@ +/// +/// + +import * as CopyPaste from 'copy-paste'; + +class TestClass {} + +let strRet: string = CopyPaste.copy("content"); +strRet = CopyPaste.copy("content", (err: Error) => { return; }); + + +let objRet: TestClass = CopyPaste.copy(new TestClass()); +objRet = CopyPaste.copy(new TestClass(), (err: Error) => { return; }); + +strRet = CopyPaste.paste(); +CopyPaste.paste((err: Error, content: string) => { return; }); \ No newline at end of file diff --git a/copy-paste/copy-paste.d.ts b/copy-paste/copy-paste.d.ts new file mode 100644 index 0000000000..a8a844b5bf --- /dev/null +++ b/copy-paste/copy-paste.d.ts @@ -0,0 +1,46 @@ +// Type definitions for copy-paste v1.1.3 +// Project: https://github.com/xavi-/node-copy-paste +// Definitions by: Tobias Kahlert +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'copy-paste' { + + export type CopyCallback = (err: Error) => void; + export type PasteCallback = (err: Error, content: string) => void; + + /** + * Asynchronously replaces the current contents of the clip board with text. + * + * @param {T} content Takes either a string, array, object, or readable stream. + * @return {T} Returns the same value passed in. + */ + export function copy(content: T): T; + + /** + * Asynchronously replaces the current contents of the clip board with text. + * + * @param {T} content Takes either a string, array, object, or readable stream. + * @param {CopyCallback} callback will fire when the copy operation is complete. + * @return {T} Returns the same value passed in. + */ + export function copy(content: T, callback: CopyCallback): T; + + + /** + * Synchronously returns the current contents of the system clip board. + * + * Note: The synchronous version of paste is not always availabled. + * An error message is shown if the synchronous version of paste is used on an unsupported platform. + * The asynchronous version of paste is always available. + * + * @return {string} Returns the current contents of the system clip board. + */ + export function paste(): string; + + /** + * Asynchronously returns the current contents of the system clip board. + * + * @param {PasteCallback} callback The contents of the system clip board are passed to the callback as the second parameter. + */ + export function paste(callback: PasteCallback): void; +} \ No newline at end of file From c1dc967273846cde4088f7f1c3b7438ed4a5f88d Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Sun, 17 Jan 2016 14:44:57 +0100 Subject: [PATCH 403/441] matter-js updated to version 0.9.0 --- matter-js/matter-js-tests.ts | 26 +- matter-js/matter-js.d.ts | 4478 +++++++++++++++++++++++----------- 2 files changed, 3100 insertions(+), 1404 deletions(-) diff --git a/matter-js/matter-js-tests.ts b/matter-js/matter-js-tests.ts index 31649fc44d..410a9eceab 100644 --- a/matter-js/matter-js-tests.ts +++ b/matter-js/matter-js-tests.ts @@ -7,25 +7,25 @@ var Engine = Matter.Engine, Composites = Matter.Composites, Constraint = Matter.Constraint, Events = Matter.Events, - Query = Matter.Query + Query = Matter.Query; -var engine = Engine.create(document.body) +var engine = Engine.create(); //Bodies -var box1 = Bodies.rectangle(400,200,80,80) +var box1 = Bodies.rectangle(400,200,80,80); var box2 = Bodies.rectangle(400,610,810,60, { angle: 10, angularSpeed: 11, angularVelocity: 1, density: 4, isStatic: true -}) +}); -var circle1 = Bodies.circle(100,100,50) +var circle1 = Bodies.circle(100,100,50); -World.addBody(engine.world, box1) -World.add(engine.world, [box2, circle1]) +World.addBody(engine.world, box1); +World.add(engine.world, [box2, circle1]); //Composites @@ -40,18 +40,18 @@ var constraint1 = Constraint.create({ bodyA: box1, bodyB: box2, stiffness: 0.02 -}) +}); //Query var collisions = Query.ray([box1, box2, circle1], {x:1, y:2}, {x:3, y:4}); -World.addConstraint(engine.world, constraint1) +World.addConstraint(engine.world, constraint1); //events -Events.on(engine, "beforeTick", (e:any)=>{ - -}) +Events.on(engine, "beforeTick", (e:Matter.IEventTimestamped)=>{ + +}); -Engine.run(engine) +Engine.run(engine); diff --git a/matter-js/matter-js.d.ts b/matter-js/matter-js.d.ts index e4c72b13c1..aa9f5c0b3c 100644 --- a/matter-js/matter-js.d.ts +++ b/matter-js/matter-js.d.ts @@ -1,1480 +1,3183 @@ -// Type definitions for Matter.js 0.8.0 +// Type definitions for Matter.js - EDGE // Project: https://github.com/liabru/matter-js -// Definitions by: Ivane Gegia +// Definitions by: Ivane Gegia , +// David Asmuth // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module Matter -{ - export interface IEngineOptions - { - +declare module Matter { + /** + * The `Matter.Axes` module contains methods for creating and manipulating sets of axes. + * + * @class Axes + */ + export class Axes { + /** + * Creates a new set of axes from the given vertices. + * @method fromVertices + * @param {vertices} vertices + * @return {axes} A new axes from the given vertices + */ + static fromVertices(vertices: Array): Array; + /** + * Rotates a set of axes by the given angle. + * @method rotate + * @param {axes} axes + * @param {number} angle + */ + static rotate(axes: Array, angle: number): void; } - export interface IEngineTimingOptions - { + /** + * The `Matter.Bodies` module contains factory methods for creating rigid body models + * with commonly used body configurations (such as rectangles, circles and other polygons). + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Bodies + */ + export class Bodies { /** - *A Number that specifies the time correction factor to apply to the current timestep. It is automatically handled when using Engine.run, but is also only optional even if you use your own game loop. The value is defined as delta / lastDelta, i.e. the percentage change of delta between steps. This value is always 1 (no correction) when frame rate is constant or engine.timing.isFixed is true. If the framerate and hence delta are changing, then correction should be applied to the current update to account for the change. See the paper on Time Corrected Verlet for more information. + * Creates a new rigid body model with a circle hull. + * The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method circle + * @param {number} x + * @param {number} y + * @param {number} radius + * @param {object} [options] + * @param {number} [maxSides] + * @return {body} A new circle body */ - correction:number; + static circle(x: number, y: number, radius: number, options?: IBodyDefinition, maxSides?: number): Body; /** - * A Number that specifies the time step between updates in milliseconds. If engine.timing.isFixed is set to true, then delta is fixed. If it is false, then delta can dynamically change to maintain the correct apparant simulation speed. + * Creates a new rigid body model with a regular polygon hull with the given number of sides. + * The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method polygon + * @param {number} x + * @param {number} y + * @param {number} sides + * @param {number} radius + * @param {object} [options] + * @return {body} A new regular polygon body */ - delta:number; + static polygon(x: number, y: number, sides: number, radius: number, options?: IBodyDefinition): Body; /** - * A Number that specifies the global scaling factor of time for all bodies. A value of 0 freezes the simulation. A value of 0.1 gives a slow-motion effect. A value of 1.2 gives a speed-up effect. + * Creates a new rigid body model with a rectangle hull. + * The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method rectangle + * @param {number} x + * @param {number} y + * @param {number} width + * @param {number} height + * @param {object} [options] + * @return {body} A new rectangle body */ - timeScale:number; + static rectangle(x: number, y: number, width: number, height: number, options?: IBodyDefinition): Body; /** - * A Number that specifies the current simulation-time in milliseconds starting from 0. It is incremented on every Engine.update by the timing.delta. + * Creates a new rigid body model with a trapezoid hull. + * The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method trapezoid + * @param {number} x + * @param {number} y + * @param {number} width + * @param {number} height + * @param {number} slope + * @param {object} [options] + * @return {body} A new trapezoid body */ - timestamp:number; - + static trapezoid(x: number, y: number, width: number, height: number, slope: number, options?: IBodyDefinition): Body; /** - * An integer Number that specifies the number of velocity iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance. - */ - velocityIterations:number; - + * Creates a body using the supplied vertices (or an array containing multiple sets of vertices). + * If the vertices are convex, they will pass through as supplied. + * Otherwise if the vertices are concave, they will be decomposed if [poly-decomp.js](https://github.com/schteppe/poly-decomp.js) is available. + * Note that this process is not guaranteed to support complex sets of vertices (e.g. those with holes may fail). + * By default the decomposition will discard collinear edges (to improve performance). + * It can also optionally discard any parts that have an area less than `minimumArea`. + * If the vertices can not be decomposed, the result will fall back to using the convex hull. + * The options parameter is an object that specifies any `Matter.Body` properties you wish to override the defaults. + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method fromVertices + * @param {number} x + * @param {number} y + * @param [[vector]] vertexSets + * @param {object} [options] + * @param {bool} [flagInternal=false] + * @param {number} [removeCollinear=0.01] + * @param {number} [minimumArea=10] + * @return {body} + */ + static fromVertices(x: number, y: number, vertexSets: Array>, options?: IBodyDefinition, flagInternal?: boolean, removeCollinear?: number, minimumArea?: number): Body; } - export class Engine - { + export interface IBodyDefinition { /** - * Clears the engine including the world, pairs and broadphase. - * @param engine - */ - static clear(engine:Engine):void; - - /** - * Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults. All properties have default values, and many are pre-calculated automatically based on other properties. See the properites section below for detailed information on what you can pass via the options object. - * @param element - * @param options - */ - static create(element?: HTMLElement|IEngineOptions, options?:IEngineOptions):Engine; - - /** - * Merges two engines by keeping the configuration of engineA but replacing the world with the one from engineB. - * @param engineA - * @param engineB - */ - static merge(engineA:Engine, engineB:Engine):void; - - /** - * Renders the world by calling its defined renderer engine.render.controller. Triggers beforeRender and afterRender events. - * @param engineA - * @param engineB - */ - static render(engineA:Engine, engineB:Engine):void; - - /** - * An optional utility function that provides a game loop, that handles updating the engine for you. Calls Engine.update and Engine.render on the requestAnimationFrame event automatically. Handles time correction and non-fixed dynamic timing (if enabled). Triggers beforeTick, tick and afterTick events. - * @param engine - */ - static run(engine:Engine):void; - - /** - * Moves the simulation forward in time by delta ms. Triggers beforeUpdate and afterUpdate events. + * A `Number` specifying the angle of the body, in radians. * - * @param engine - * @param delta - * @param correction - */ - static update(engine:Engine, delta:number, correction?:number):void; - + * @property angle + * @type number + * @default 0 + */ + angle?: number; /** - * An integer Number that specifies the number of constraint iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance. The default value of 2 is usually very adequate. - */ - constraintIterations:number; - + * A `Number` that _measures_ the current angular speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.angularVelocity`). + * + * @readOnly + * @property angularSpeed + * @type number + * @default 0 + */ + angularSpeed?: number; /** - * A flag that specifies whether the engine is running or not. - */ - enabled:boolean; - + * A `Number` that _measures_ the current angular velocity of the body after the last `Body.update`. It is read-only. + * If you need to modify a body's angular velocity directly, you should apply a torque or simply change the body's `angle` (as the engine uses position-Verlet integration). + * + * @readOnly + * @property angularVelocity + * @type number + * @default 0 + */ + angularVelocity?: number; /** - * A flag that specifies whether the engine should allow sleeping via the Matter.Sleeping module. Sleeping can improve stability and performance, but often at the expense of accuracy. - */ - enableSleeping:boolean; - + * A `Number` that _measures_ the area of the body's convex hull, calculated at creation by `Body.create`. + * + * @property area + * @type string + * @default + */ + area?: number; /** - * An integer Number that specifies the number of position iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance. - */ - positionIterations:number; - + * An array of unique axis vectors (edge normals) used for collision detection. + * These are automatically calculated from the given convex hull (`vertices` array) in `Body.create`. + * They are constantly updated by `Body.update` during the simulation. + * + * @property axes + * @type vector[] + */ + axes?: Array; /** - * An instance of a Render controller. The default value is a Matter.Render instance created by Engine.create. One may also develop a custom renderer module based on Matter.Render and pass an instance of it to Engine.create via options.render. - A minimal custom renderer object must define at least three functions: create, clear and world (see Matter.Render). It is also possible to instead pass the module reference via options.render.controller and Engine.create will instantiate one for you. - */ - render:Render; - + * A `Bounds` object that defines the AABB region for the body. + * It is automatically calculated from the given convex hull (`vertices` array) in `Body.create` and constantly updated by `Body.update` during simulation. + * + * @property bounds + * @type bounds + */ + bounds?: Bounds; /** - * An Object containing properties regarding the timing systems of the engine. - */ - timing:IEngineTimingOptions; - + * A `Number` that defines the density of the body, that is its mass per unit area. + * If you pass the density via `Body.create` the `mass` property is automatically calculated for you based on the size (area) of the object. + * This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood). + * + * @property density + * @type number + * @default 0.001 + */ + density?: number; /** - * A World composite object that will contain all simulated bodies and constraints. - */ - world:World; + * A `Vector` that specifies the force to apply in the current step. It is zeroed after every `Body.update`. See also `Body.applyForce`. + * + * @property force + * @type vector + * @default { x: 0, y: 0 } + */ + force?: Vector; + /** + * A `Number` that defines the friction of the body. The value is always positive and is in the range `(0, 1)`. + * A value of `0` means that the body may slide indefinitely. + * A value of `1` means the body may come to a stop almost instantly after a force is applied. + * + * The effects of the value may be non-linear. + * High values may be unstable depending on the body. + * The engine uses a Coulomb friction model including static and kinetic friction. + * Note that collision response is based on _pairs_ of bodies, and that `friction` values are _combined_ with the following formula: + * + * Math.min(bodyA.friction, bodyB.friction) + * + * @property friction + * @type number + * @default 0.1 + */ + friction?: number; + /** + * A `Number` that defines the air friction of the body (air resistance). + * A value of `0` means the body will never slow as it moves through space. + * The higher the value, the faster a body slows when moving through space. + * The effects of the value are non-linear. + * + * @property frictionAir + * @type number + * @default 0.01 + */ + frictionAir?: number; + /** + * An integer `Number` uniquely identifying number generated in `Body.create` by `Common.nextId`. + * + * @property id + * @type number + */ + id?: number; + /** + * A `Number` that defines the moment of inertia (i.e. second moment of area) of the body. + * It is automatically calculated from the given convex hull (`vertices` array) and density in `Body.create`. + * If you modify this value, you must also modify the `body.inverseInertia` property (`1 / inertia`). + * + * @property inertia + * @type number + */ + inertia?: number; + /** + * A `Number` that defines the inverse moment of inertia of the body (`1 / inertia`). + * If you modify this value, you must also modify the `body.inertia` property. + * + * @property inverseInertia + * @type number + */ + inverseInertia?: number; + /** + * A `Number` that defines the inverse mass of the body (`1 / mass`). + * If you modify this value, you must also modify the `body.mass` property. + * + * @property inverseMass + * @type number + */ + inverseMass?: number; + /** + * A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken. + * If you need to set a body as sleeping, you should use `Sleeping.set` as this requires more than just setting this flag. + * + * @property isSleeping + * @type boolean + * @default false + */ + isSleeping?: boolean; + /** + * A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed. + * If you need to set a body as static after its creation, you should use `Body.setStatic` as this requires more than just setting this flag. + * + * @property isStatic + * @type boolean + * @default false + */ + isStatic?: boolean; + /** + * An arbitrary `String` name to help the user identify and manage bodies. + * + * @property label + * @type string + * @default "Body" + */ + + label?: string; + /** + * A `Number` that defines the mass of the body, although it may be more appropriate to specify the `density` property instead. + * If you modify this value, you must also modify the `body.inverseMass` property (`1 / mass`). + * + * @property mass + * @type number + */ + mass?: number; + /** + * A `Number` that _measures_ the amount of movement a body currently has (a combination of `speed` and `angularSpeed`). It is read-only and always positive. + * It is used and updated by the `Matter.Sleeping` module during simulation to decide if a body has come to rest. + * + * @readOnly + * @property motion + * @type number + * @default 0 + */ + motion?: number; + /** + * A `Vector` that specifies the current world-space position of the body. + * + * @property position + * @type vector + * @default { x: 0, y: */ + position?: Vector; + /** + * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. + * + * @property render + * @type object + */ + render?: IBodyRenderOptions; + /** + * A `Number` that defines the restitution (elasticity) of the body. The value is always positive and is in the range `(0, 1)`. + * A value of `0` means collisions may be perfectly inelastic and no bouncing may occur. + * A value of `0.8` means the body may bounce back with approximately 80% of its kinetic energy. + * Note that collision response is based on _pairs_ of bodies, and that `restitution` values are _combined_ with the following formula: + * + * Math.max(bodyA.restitution, bodyB.restitution) + * + * @property restitution + * @type number + * @default 0 + */ + restitution?: number; + /** + * A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the `Matter.Sleeping` module (if sleeping is enabled by the engine). + * + * @property sleepThreshold + * @type number + * @default 60 + */ + sleepThreshold?: number; + /** + * A `Number` that specifies a tolerance on how far a body is allowed to 'sink' or rotate into other bodies. + * Avoid changing this value unless you understand the purpose of `slop` in physics engines. + * The default should generally suffice, although very large bodies may require larger values for stable stacking. + * + * @property slop + * @type number + * @default 0.05 + */ + slop?: number; + /** + * A `Number` that _measures_ the current speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.velocity`). + * + * @readOnly + * @property speed + * @type number + * @default 0 + */ + speed?: number; + /** + * A `Number` that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed. + * + * @property timeScale + * @type number + * @default 1 + */ + timeScale?: number; + /** + * A `Number` that specifies the torque (turning force) to apply in the current step. It is zeroed after every `Body.update`. + * + * @property torque + * @type number + * @default 0 + */ + torque?: number; + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "body" + */ + type?: string; + /** + * A `Vector` that _measures_ the current velocity of the body after the last `Body.update`. It is read-only. + * If you need to modify a body's velocity directly, you should either apply a force or simply change the body's `position` (as the engine uses position-Verlet integration). + * + * @readOnly + * @property velocity + * @type vector + * @default { x: 0, y: 0 } + */ + velocity?: Vector; + /** + * An array of `Vector` objects that specify the convex hull of the rigid body. + * These should be provided about the origin `(0, 0)`. E.g. + * + * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] + * + * When passed via `Body.create`, the vertices are translated relative to `body.position` (i.e. world-space, and constantly updated by `Body.update` during simulation). + * The `Vector` objects are also augmented with additional properties required for efficient collision detection. + * + * Other properties such as `inertia` and `bounds` are automatically calculated from the passed vertices (unless provided via `options`). + * Concave hulls are not currently supported. The module `Matter.Vertices` contains useful methods for working with vertices. + * + * @property vertices + * @type vector[] + */ + vertices?: Array; + /** + * An array of bodies that make up this body. + * The first body in the array must always be a self reference to the current body instance. + * All bodies in the `parts` array together form a single rigid compound body. + * Parts are allowed to overlap, have gaps or holes or even form concave bodies. + * Parts themselves should never be added to a `World`, only the parent body should be. + * Use `Body.setParts` when setting parts to ensure correct updates of all properties. + * + * @property parts + * @type body[] + */ + parts?: Array; + /** + * A self reference if the body is _not_ a part of another body. + * Otherwise this is a reference to the body that this is a part of. + * See `body.parts`. + * + * @property parent + * @type body + */ + parent?: Body; + /** + * A `Number` that defines the static friction of the body (in the Coulomb friction model). + * A value of `0` means the body will never 'stick' when it is nearly stationary and only dynamic `friction` is used. + * The higher the value (e.g. `10`), the more force it will take to initially get the body moving when nearly stationary. + * This value is multiplied with the `friction` property to make it easier to change `friction` and maintain an appropriate amount of static friction. + * + * @property frictionStatic + * @type number + * @default 0.5 + */ + frictionStatic?: number; + /** + * An `Object` that specifies the collision filtering properties of this body. + * + * Collisions between two bodies will obey the following rules: + * - If the two bodies have the same non-zero value of `collisionFilter.group`, + * they will always collide if the value is positive, and they will never collide + * if the value is negative. + * - If the two bodies have different values of `collisionFilter.group` or if one + * (or both) of the bodies has a value of 0, then the category/mask rules apply as follows: + * + * Each body belongs to a collision category, given by `collisionFilter.category`. This + * value is used as a bit field and the category should have only one bit set, meaning that + * the value of this property is a power of two in the range [1, 2^31]. Thus, there are 32 + * different collision categories available. + * + * Each body also defines a collision bitmask, given by `collisionFilter.mask` which specifies + * the categories it collides with (the value is the bitwise AND value of all these categories). + * + * Using the category/mask rules, two bodies `A` and `B` collide if each includes the other's + * category in its mask, i.e. `(categoryA & maskB) !== 0` and `(categoryB & maskA) !== 0` + * are both true. + * + * @property collisionFilter + * @type object + */ + collisionFilter?: ICollisionFilter; + } - interface IWorldOptions - { + export interface IBodyRenderOptions { + + /** + * A flag that indicates if the body should be rendered. + * + * @property render.visible + * @type boolean + * @default true + */ + visible: boolean; + + /** + * An `Object` that defines the sprite properties to use when rendering, if any. + * + * @property render.sprite + * @type object + */ + sprite: IBodyRenderOptionsSprite; + + /** + * A String that defines the fill style to use when rendering the body (if a sprite is not defined). It is the same as when using a canvas, so it accepts CSS style property values. + Default: a random colour + */ + fillStyle: string; + + /** + * A Number that defines the line width to use when rendering the body outline (if a sprite is not defined). A value of 0 means no outline will be rendered. + Default: 1.5 + */ + lineWidth: number; + + + + /** + * A String that defines the stroke style to use when rendering the body outline (if a sprite is not defined). It is the same as when using a canvas, so it accepts CSS style property values. + Default: a random colour + */ + strokeStyle: string; + + + + } + + export interface IBodyRenderOptionsSprite { + /** + * An `String` that defines the path to the image to use as the sprite texture, if any. + * + * @property render.sprite.texture + * @type string + */ + texture: string; + + /** + * A `Number` that defines the scaling in the x-axis for the sprite, if any. + * + * @property render.sprite.xScale + * @type number + * @default 1 + */ + xScale: number; + + /** + * A `Number` that defines the scaling in the y-axis for the sprite, if any. + * + * @property render.sprite.yScale + * @type number + * @default 1 + */ + yScale: number; + } + + /** + * The `Matter.Body` module contains methods for creating and manipulating body models. + * A `Matter.Body` is a rigid body that can be simulated by a `Matter.Engine`. + * Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the module `Matter.Bodies`. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + + * @class Body + */ + export class Body { + /** + * Applies a force to a body from a given world-space position, including resulting torque. + * @method applyForce + * @param {body} body + * @param {vector} position + * @param {vector} force + */ + static applyForce(body: Body, position: Vector, force: Vector): void; + + /** + * Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults. + * All properties have default values, and many are pre-calculated automatically based on other properties. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {} options + * @return {body} body + */ + static create(options: IBodyDefinition): Body; + /** + * Rotates a body by a given angle relative to its current angle, without imparting any angular velocity. + * @method rotate + * @param {body} body + * @param {number} rotation + */ + static rotate(body: Body, rotation: number): void; + /** + * Returns the next unique group index for which bodies will collide. + * If `isNonColliding` is `true`, returns the next unique group index for which bodies will _not_ collide. + * See `body.collisionFilter` for more information. + * @method nextGroup + * @param {bool} [isNonColliding=false] + * @return {Number} Unique group index + */ + static nextGroup(isNonColliding: boolean): number; + /** + * Returns the next unique category bitfield (starting after the initial default category `0x0001`). + * There are 32 available. See `body.collisionFilter` for more information. + * @method nextCategory + * @return {Number} Unique category bitfield + */ + static nextCategory(): number; + /** + * Given a property and a value (or map of), sets the property(s) on the body, using the appropriate setter functions if they exist. + * Prefer to use the actual setter functions in performance critical situations. + * @method set + * @param {body} body + * @param {} settings A property name (or map of properties and values) to set on the body. + * @param {} value The value to set if `settings` is a single property name. + */ + static set(body: Body, settings: any, value?: any): void; + /** + * Sets the mass of the body. Inverse mass and density are automatically updated to reflect the change. + * @method setMass + * @param {body} body + * @param {number} mass + */ + static setMass(body: Body, mass: number): void; + /** + * Sets the density of the body. Mass is automatically updated to reflect the change. + * @method setDensity + * @param {body} body + * @param {number} density + */ + static setDensity(body: Body, density: number): void; + /** + * Sets the moment of inertia (i.e. second moment of area) of the body of the body. + * Inverse inertia is automatically updated to reflect the change. Mass is not changed. + * @method setInertia + * @param {body} body + * @param {number} inertia + */ + static setInterna(body: Body, interna: number): void; + /** + * Sets the body's vertices and updates body properties accordingly, including inertia, area and mass (with respect to `body.density`). + * Vertices will be automatically transformed to be orientated around their centre of mass as the origin. + * They are then automatically translated to world space based on `body.position`. + * + * The `vertices` argument should be passed as an array of `Matter.Vector` points (or a `Matter.Vertices` array). + * Vertices must form a convex hull, concave hulls are not supported. + * + * @method setVertices + * @param {body} body + * @param {vector[]} vertices + */ + static setVertices(body: Body, vertices: Array): void; + /** + * Sets the parts of the `body` and updates mass, inertia and centroid. + * Each part will have its parent set to `body`. + * By default the convex hull will be automatically computed and set on `body`, unless `autoHull` is set to `false.` + * Note that this method will ensure that the first part in `body.parts` will always be the `body`. + * @method setParts + * @param {body} body + * @param [body] parts + * @param {bool} [autoHull=true] + */ + static setParts(body: Body, parts: Body, autoHull: boolean): void; + /** + * Sets the position of the body instantly. Velocity, angle, force etc. are unchanged. + * @method setPosition + * @param {body} body + * @param {vector} position + */ + static setPosition(body: Body, position: Vector): void; + /** + * Sets the angle of the body instantly. Angular velocity, position, force etc. are unchanged. + * @method setAngle + * @param {body} body + * @param {number} angle + */ + static setAngle(body: Body, angle: number): void; + /** + * Sets the linear velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`. + * @method setVelocity + * @param {body} body + * @param {vector} velocity + */ + static setVelocity(body: Body, velocity: Vector): void; + /** + * Sets the angular velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`. + * @method setAngularVelocity + * @param {body} body + * @param {number} velocity + */ + static setAngularVelocity(body: Body, velocity: number): void; + + + + /** + * Sets the body as static, including isStatic flag and setting mass and inertia to Infinity. + * @method setStatic + * @param {body} body + * @param {bool} isStatic + */ + static setStatic(body: Body, isStatic: boolean): void; + + /** + * Scales the body, including updating physical properties (mass, area, axes, inertia), from a world-space point (default is body centre). + * @method scale + * @param {body} body + * @param {number} scaleX + * @param {number} scaleY + * @param {vector} [point] + */ + static scale(body: Body, scaleX: number, scaleY: number, point?: Vector): void; + + /** + * Moves a body by a given vector relative to its current position, without imparting any velocity. + * @method translate + * @param {body} body + * @param {vector} translation + */ + static translate(body: Body, translation: Vector): void; + + /** + * Performs a simulation step for the given `body`, including updating position and angle using Verlet integration. + * @method update + * @param {body} body + * @param {number} deltaTime + * @param {number} timeScale + * @param {number} correction + */ + static update(body: Body, deltaTime: number, timeScale: number, correction: number): void; + + /** + * A `Number` specifying the angle of the body, in radians. + * + * @property angle + * @type number + * @default 0 + */ + angle: number; + /** + * A `Number` that _measures_ the current angular speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.angularVelocity`). + * + * @readOnly + * @property angularSpeed + * @type number + * @default 0 + */ + angularSpeed: number; + /** + * A `Number` that _measures_ the current angular velocity of the body after the last `Body.update`. It is read-only. + * If you need to modify a body's angular velocity directly, you should apply a torque or simply change the body's `angle` (as the engine uses position-Verlet integration). + * + * @readOnly + * @property angularVelocity + * @type number + * @default 0 + */ + angularVelocity: number; + /** + * A `Number` that _measures_ the area of the body's convex hull, calculated at creation by `Body.create`. + * + * @property area + * @type string + * @default + */ + area: number; + /** + * An array of unique axis vectors (edge normals) used for collision detection. + * These are automatically calculated from the given convex hull (`vertices` array) in `Body.create`. + * They are constantly updated by `Body.update` during the simulation. + * + * @property axes + * @type vector[] + */ + axes: Array; + /** + * A `Bounds` object that defines the AABB region for the body. + * It is automatically calculated from the given convex hull (`vertices` array) in `Body.create` and constantly updated by `Body.update` during simulation. + * + * @property bounds + * @type bounds + */ + bounds: Bounds; + /** + * A `Number` that defines the density of the body, that is its mass per unit area. + * If you pass the density via `Body.create` the `mass` property is automatically calculated for you based on the size (area) of the object. + * This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood). + * + * @property density + * @type number + * @default 0.001 + */ + density: number; + /** + * A `Vector` that specifies the force to apply in the current step. It is zeroed after every `Body.update`. See also `Body.applyForce`. + * + * @property force + * @type vector + * @default { x: 0, y: 0 } + */ + force: Vector; + /** + * A `Number` that defines the friction of the body. The value is always positive and is in the range `(0, 1)`. + * A value of `0` means that the body may slide indefinitely. + * A value of `1` means the body may come to a stop almost instantly after a force is applied. + * + * The effects of the value may be non-linear. + * High values may be unstable depending on the body. + * The engine uses a Coulomb friction model including static and kinetic friction. + * Note that collision response is based on _pairs_ of bodies, and that `friction` values are _combined_ with the following formula: + * + * Math.min(bodyA.friction, bodyB.friction) + * + * @property friction + * @type number + * @default 0.1 + */ + friction: number; + /** + * A `Number` that defines the air friction of the body (air resistance). + * A value of `0` means the body will never slow as it moves through space. + * The higher the value, the faster a body slows when moving through space. + * The effects of the value are non-linear. + * + * @property frictionAir + * @type number + * @default 0.01 + */ + frictionAir: number; + /** + * An integer `Number` uniquely identifying number generated in `Body.create` by `Common.nextId`. + * + * @property id + * @type number + */ + id: number; + /** + * A `Number` that defines the moment of inertia (i.e. second moment of area) of the body. + * It is automatically calculated from the given convex hull (`vertices` array) and density in `Body.create`. + * If you modify this value, you must also modify the `body.inverseInertia` property (`1 / inertia`). + * + * @property inertia + * @type number + */ + inertia: number; + /** + * A `Number` that defines the inverse moment of inertia of the body (`1 / inertia`). + * If you modify this value, you must also modify the `body.inertia` property. + * + * @property inverseInertia + * @type number + */ + inverseInertia: number; + /** + * A `Number` that defines the inverse mass of the body (`1 / mass`). + * If you modify this value, you must also modify the `body.mass` property. + * + * @property inverseMass + * @type number + */ + inverseMass: number; + /** + * A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken. + * If you need to set a body as sleeping, you should use `Sleeping.set` as this requires more than just setting this flag. + * + * @property isSleeping + * @type boolean + * @default false + */ + isSleeping: boolean; + /** + * A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed. + * If you need to set a body as static after its creation, you should use `Body.setStatic` as this requires more than just setting this flag. + * + * @property isStatic + * @type boolean + * @default false + */ + isStatic: boolean; + /** + * An arbitrary `String` name to help the user identify and manage bodies. + * + * @property label + * @type string + * @default "Body" + */ + + label: string; + /** + * A `Number` that defines the mass of the body, although it may be more appropriate to specify the `density` property instead. + * If you modify this value, you must also modify the `body.inverseMass` property (`1 / mass`). + * + * @property mass + * @type number + */ + mass: number; + /** + * A `Number` that _measures_ the amount of movement a body currently has (a combination of `speed` and `angularSpeed`). It is read-only and always positive. + * It is used and updated by the `Matter.Sleeping` module during simulation to decide if a body has come to rest. + * + * @readOnly + * @property motion + * @type number + * @default 0 + */ + motion: number; + /** + * A `Vector` that specifies the current world-space position of the body. + * + * @property position + * @type vector + * @default { x: 0, y: */ + position: Vector; + /** + * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. + * + * @property render + * @type object + */ + render: IBodyRenderOptions; + /** + * A `Number` that defines the restitution (elasticity) of the body. The value is always positive and is in the range `(0, 1)`. + * A value of `0` means collisions may be perfectly inelastic and no bouncing may occur. + * A value of `0.8` means the body may bounce back with approximately 80% of its kinetic energy. + * Note that collision response is based on _pairs_ of bodies, and that `restitution` values are _combined_ with the following formula: + * + * Math.max(bodyA.restitution, bodyB.restitution) + * + * @property restitution + * @type number + * @default 0 + */ + restitution: number; + /** + * A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the `Matter.Sleeping` module (if sleeping is enabled by the engine). + * + * @property sleepThreshold + * @type number + * @default 60 + */ + sleepThreshold: number; + /** + * A `Number` that specifies a tolerance on how far a body is allowed to 'sink' or rotate into other bodies. + * Avoid changing this value unless you understand the purpose of `slop` in physics engines. + * The default should generally suffice, although very large bodies may require larger values for stable stacking. + * + * @property slop + * @type number + * @default 0.05 + */ + slop: number; + /** + * A `Number` that _measures_ the current speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.velocity`). + * + * @readOnly + * @property speed + * @type number + * @default 0 + */ + speed: number; + /** + * A `Number` that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed. + * + * @property timeScale + * @type number + * @default 1 + */ + timeScale: number; + /** + * A `Number` that specifies the torque (turning force) to apply in the current step. It is zeroed after every `Body.update`. + * + * @property torque + * @type number + * @default 0 + */ + torque: number; + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "body" + */ + type: string; + /** + * A `Vector` that _measures_ the current velocity of the body after the last `Body.update`. It is read-only. + * If you need to modify a body's velocity directly, you should either apply a force or simply change the body's `position` (as the engine uses position-Verlet integration). + * + * @readOnly + * @property velocity + * @type vector + * @default { x: 0, y: 0 } + */ + velocity: Vector; + /** + * An array of `Vector` objects that specify the convex hull of the rigid body. + * These should be provided about the origin `(0, 0)`. E.g. + * + * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] + * + * When passed via `Body.create`, the vertices are translated relative to `body.position` (i.e. world-space, and constantly updated by `Body.update` during simulation). + * The `Vector` objects are also augmented with additional properties required for efficient collision detection. + * + * Other properties such as `inertia` and `bounds` are automatically calculated from the passed vertices (unless provided via `options`). + * Concave hulls are not currently supported. The module `Matter.Vertices` contains useful methods for working with vertices. + * + * @property vertices + * @type vector[] + */ + vertices: Array; + /** + * An array of bodies that make up this body. + * The first body in the array must always be a self reference to the current body instance. + * All bodies in the `parts` array together form a single rigid compound body. + * Parts are allowed to overlap, have gaps or holes or even form concave bodies. + * Parts themselves should never be added to a `World`, only the parent body should be. + * Use `Body.setParts` when setting parts to ensure correct updates of all properties. + * + * @property parts + * @type body[] + */ + parts: Array; + /** + * A self reference if the body is _not_ a part of another body. + * Otherwise this is a reference to the body that this is a part of. + * See `body.parts`. + * + * @property parent + * @type body + */ + parent: Body; + /** + * A `Number` that defines the static friction of the body (in the Coulomb friction model). + * A value of `0` means the body will never 'stick' when it is nearly stationary and only dynamic `friction` is used. + * The higher the value (e.g. `10`), the more force it will take to initially get the body moving when nearly stationary. + * This value is multiplied with the `friction` property to make it easier to change `friction` and maintain an appropriate amount of static friction. + * + * @property frictionStatic + * @type number + * @default 0.5 + */ + frictionStatic: number; + /** + * An `Object` that specifies the collision filtering properties of this body. + * + * Collisions between two bodies will obey the following rules: + * - If the two bodies have the same non-zero value of `collisionFilter.group`, + * they will always collide if the value is positive, and they will never collide + * if the value is negative. + * - If the two bodies have different values of `collisionFilter.group` or if one + * (or both) of the bodies has a value of 0, then the category/mask rules apply as follows: + * + * Each body belongs to a collision category, given by `collisionFilter.category`. This + * value is used as a bit field and the category should have only one bit set, meaning that + * the value of this property is a power of two in the range [1, 2^31]. Thus, there are 32 + * different collision categories available. + * + * Each body also defines a collision bitmask, given by `collisionFilter.mask` which specifies + * the categories it collides with (the value is the bitwise AND value of all these categories). + * + * Using the category/mask rules, two bodies `A` and `B` collide if each includes the other's + * category in its mask, i.e. `(categoryA & maskB) !== 0` and `(categoryB & maskA) !== 0` + * are both true. + * + * @property collisionFilter + * @type object + */ + collisionFilter: ICollisionFilter; + + } + + export interface IBound { + min: { x: number, y: number } + max: { x: number, y: number } + } + + /** + * Internal Class, not generally used outside of the engine's internals. + * The `Matter.Bounds` module contains methods for creating and manipulating axis-aligned bounding boxes (AABB). + * + * @class Bounds + */ + export class Bounds { + + } + + export interface ICompositeDefinition { + /** + * An array of `Body` that are _direct_ children of this composite. + * To add or remove bodies you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allBodies` method. + * + * @property bodies + * @type body[] + * @default [] + */ + bodies?: Array; + + /** + * An array of `Composite` that are _direct_ children of this composite. + * To add or remove composites you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allComposites` method. + * + * @property composites + * @type composite[] + * @default [] + */ + composites?: Array; + + /** + * An array of `Constraint` that are _direct_ children of this composite. + * To add or remove constraints you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allConstraints` method. + * + * @property constraints + * @type constraint[] + * @default [] + */ + constraints?: Array; + + /** + * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. + * + * @property id + * @type number + */ + id?: number; + + /** + * A flag that specifies whether the composite has been modified during the current step. + * Most `Matter.Composite` methods will automatically set this flag to `true` to inform the engine of changes to be handled. + * If you need to change it manually, you should use the `Composite.setModified` method. + * + * @property isModified + * @type boolean + * @default false + */ + isModified?: boolean; + + /** + * An arbitrary `String` name to help the user identify and manage composites. + * + * @property label + * @type string + * @default "Composite" + */ + label?: string; + + /** + * The `Composite` that is the parent of this composite. It is automatically managed by the `Matter.Composite` methods. + * + * @property parent + * @type composite + * @default null + */ + parent?: Composite; + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "composite" + */ + type?: String; + } + + /** + * The `Matter.Composite` module contains methods for creating and manipulating composite bodies. + * A composite body is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`, therefore composites form a tree structure. + * It is important to use the functions in this module to modify composites, rather than directly modifying their properties. + * Note that the `Matter.World` object is also a type of `Matter.Composite` and as such all composite methods here can also operate on a `Matter.World`. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Composite + */ + export class Composite { + /** + * Generic add function. Adds one or many body(s), constraint(s) or a composite(s) to the given composite. + * Triggers `beforeAdd` and `afterAdd` events on the `composite`. + * @method add + * @param {composite} composite + * @param {} object + * @return {composite} The original composite with the objects added + */ + static add(composite: Composite, object: Body | Composite | Constraint): Composite; + + /** + * Returns all bodies in the given composite, including all bodies in its children, recursively. + * @method allBodies + * @param {composite} composite + * @return {body[]} All the bodies + */ + static allBodies(composite: Composite): Array; + + /** + * Returns all composites in the given composite, including all composites in its children, recursively. + * @method allComposites + * @param {composite} composite + * @return {composite[]} All the composites + */ + static allComposites(composite: Composite): Array; + + /** + * Returns all constraints in the given composite, including all constraints in its children, recursively. + * @method allConstraints + * @param {composite} composite + * @return {constraint[]} All the constraints + */ + static allConstraints(composite: Composite): Array; + + /** + * Removes all bodies, constraints and composites from the given composite. + * Optionally clearing its children recursively. + * @method clear + * @param {composite} composite + * @param {boolean} keepStatic + * @param {boolean} [deep=false] + */ + static clear(composite: Composite, keepStatic: boolean, deep?: boolean): void; + + /** + * Creates a new composite. The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properites section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {} [options] + * @return {composite} A new composite + */ + static create(options?: ICompositeDefinition): Composite; + + /** + * Searches the composite recursively for an object matching the type and id supplied, null if not found. + * @method get + * @param {composite} composite + * @param {number} id + * @param {string} type + * @return {object} The requested object, if found + */ + static get(composite: Composite, id: number, type: string): Body | Composite | Constraint; + + /** + * Moves the given object(s) from compositeA to compositeB (equal to a remove followed by an add). + * @method move + * @param {compositeA} compositeA + * @param {object[]} objects + * @param {compositeB} compositeB + * @return {composite} Returns compositeA + */ + static move(compositeA: Composite, objects: Array, compositeB: Composite): Composite; + + /** + * Assigns new ids for all objects in the composite, recursively. + * @method rebase + * @param {composite} composite + * @return {composite} Returns composite + */ + static rebase(composite: Composite): Composite; + + /** + * Generic remove function. Removes one or many body(s), constraint(s) or a composite(s) to the given composite. + * Optionally searching its children recursively. + * Triggers `beforeRemove` and `afterRemove` events on the `composite`. + * @method remove + * @param {composite} composite + * @param {} object + * @param {boolean} [deep=false] + * @return {composite} The original composite with the objects removed + */ + static remove(composite: Composite, object: Body | Composite | Constraint, deep?: boolean): Composite; + + + + /** + * Sets the composite's `isModified` flag. + * If `updateParents` is true, all parents will be set (default: false). + * If `updateChildren` is true, all children will be set (default: false). + * @method setModified + * @param {composite} composite + * @param {boolean} isModified + * @param {boolean} [updateParents=false] + * @param {boolean} [updateChildren=false] + */ + static setModified(composite: Composite, isModified: boolean, updateParents?: boolean, updateChildren?: boolean): void; + /** + * Translates all children in the composite by a given vector relative to their current positions, + * without imparting any velocity. + * @method translate + * @param {composite} composite + * @param {vector} translation + * @param {bool} [recursive=true] + */ + static translate(composite: Composite, translation: Vector, recursive?: boolean): void; + /** + * Rotates all children in the composite by a given angle about the given point, without imparting any angular velocity. + * @method rotate + * @param {composite} composite + * @param {number} rotation + * @param {vector} point + * @param {bool} [recursive=true] + */ + static rotate(composite: Composite, rotation: number, point: Vector, recursive?: boolean): void; + /** + * Scales all children in the composite, including updating physical properties (mass, area, axes, inertia), from a world-space point. + * @method scale + * @param {composite} composite + * @param {number} scaleX + * @param {number} scaleY + * @param {vector} point + * @param {bool} [recursive=true] + */ + static scale(composite: Composite, scaleX: number, scaleY: number, point: Vector, recursive?: boolean): void; + + + /** + * An array of `Body` that are _direct_ children of this composite. + * To add or remove bodies you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allBodies` method. + * + * @property bodies + * @type body[] + * @default [] + */ + bodies: Array; + + /** + * An array of `Composite` that are _direct_ children of this composite. + * To add or remove composites you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allComposites` method. + * + * @property composites + * @type composite[] + * @default [] + */ + composites: Array; + + /** + * An array of `Constraint` that are _direct_ children of this composite. + * To add or remove constraints you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allConstraints` method. + * + * @property constraints + * @type constraint[] + * @default [] + */ + constraints: Array; + + /** + * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. + * + * @property id + * @type number + */ + id: number; + + /** + * A flag that specifies whether the composite has been modified during the current step. + * Most `Matter.Composite` methods will automatically set this flag to `true` to inform the engine of changes to be handled. + * If you need to change it manually, you should use the `Composite.setModified` method. + * + * @property isModified + * @type boolean + * @default false + */ + isModified: boolean; + + /** + * An arbitrary `String` name to help the user identify and manage composites. + * + * @property label + * @type string + * @default "Composite" + */ + label: string; + + /** + * The `Composite` that is the parent of this composite. It is automatically managed by the `Matter.Composite` methods. + * + * @property parent + * @type composite + * @default null + */ + parent: Composite; + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "composite" + */ + type: String; } /** - * The Matter.World module contains methods for creating and manipulating the world composite. A Matter.World is a Matter.Composite body, which is a collection of Matter.Body, Matter.Constraint and other Matter.Composite. A Matter.World has a few additional properties including gravity and bounds. It is important to use the functions in the Matter.Composite module to modify the world composite, rather than directly modifying its properties. There are also a few methods here that alias those in Matter.Composite for easier readability. - */ - export class World - { + * The `Matter.Composites` module contains factory methods for creating composite bodies + * with commonly used configurations (such as stacks and chains). + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Composites + */ + export class Composites { + /** + * Creates a composite with simple car setup of bodies and constraints. + * @method car + * @param {number} xx + * @param {number} yy + * @param {number} width + * @param {number} height + * @param {number} wheelSize + * @return {composite} A new composite car body + */ + static car(xx: number, yy: number, width: number, height: number, wheelSize: number): Composite; + + /** + * Chains all bodies in the given composite together using constraints. + * @method chain + * @param {composite} composite + * @param {number} xOffsetA + * @param {number} yOffsetA + * @param {number} xOffsetB + * @param {number} yOffsetB + * @param {object} options + * @return {composite} A new composite containing objects chained together with constraints + */ + static chain(composite: Composite, xOffsetA: number, yOffsetA: number, xOffsetB: number, yOffsetB: number, options: any): Composite; + + /** + * Connects bodies in the composite with constraints in a grid pattern, with optional cross braces. + * @method mesh + * @param {composite} composite + * @param {number} columns + * @param {number} rows + * @param {boolean} crossBrace + * @param {object} options + * @return {composite} The composite containing objects meshed together with constraints + */ + static mesh(composite: Composite, columns: number, rows: number, crossBrace: boolean, options: any): Composite; + + /** + * Creates a composite with a Newton's Cradle setup of bodies and constraints. + * @method newtonsCradle + * @param {number} xx + * @param {number} yy + * @param {number} number + * @param {number} size + * @param {number} length + * @return {composite} A new composite newtonsCradle body + */ + newtonsCradle(xx: number, yy: number, _number: number, size: number, length: number): Composite; + + /** + * Create a new composite containing bodies created in the callback in a pyramid arrangement. + * This function uses the body's bounds to prevent overlaps. + * @method pyramid + * @param {number} xx + * @param {number} yy + * @param {number} columns + * @param {number} rows + * @param {number} columnGap + * @param {number} rowGap + * @param {function} callback + * @return {composite} A new composite containing objects created in the callback + */ + static pyramid(xx: number, yy: number, columns: number, rows: number, columnGap: number, rowGap: number, callback: Function): Composite; + + /** + * Creates a simple soft body like object. + * @method softBody + * @param {number} xx + * @param {number} yy + * @param {number} columns + * @param {number} rows + * @param {number} columnGap + * @param {number} rowGap + * @param {boolean} crossBrace + * @param {number} particleRadius + * @param {} particleOptions + * @param {} constraintOptions + * @return {composite} A new composite softBody + */ + static softBody(xx: number, yy: number, columns: number, rows: number, columnGap: number, rowGap: number, crossBrace: boolean, particleRadius: number, particleOptions: any, constraintOptions: any): Composite; + + /** + * Create a new composite containing bodies created in the callback in a grid arrangement. + * This function uses the body's bounds to prevent overlaps. + * @method stack + * @param {number} xx + * @param {number} yy + * @param {number} columns + * @param {number} rows + * @param {number} columnGap + * @param {number} rowGap + * @param {function} callback + * @return {composite} A new composite containing objects created in the callback + */ + static stack(xx: number, yy: number, columns: number, rows: number, columnGap: number, rowGap: number, callback: Function): Composite; + } + + export interface IConstraintDefinition { + /** + * The first possible `Body` that this constraint is attached to. + * + * @property bodyA + * @type body + * @default null + */ + bodyA?: Body; + + /** + * The second possible `Body` that this constraint is attached to. + * + * @property bodyB + * @type body + * @default null + */ + bodyB?: Body; + + /** + * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. + * + * @property id + * @type number + */ + id?: number; + + /** + * An arbitrary `String` name to help the user identify and manage bodies. + * + * @property label + * @type string + * @default "Constraint" + */ + label?: string; + + /** + * A `Number` that specifies the target resting length of the constraint. + * It is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. + * + * @property length + * @type number + */ + length?: number; + + /** + * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. + * + * @property pointA + * @type vector + * @default { x: 0, y: 0 } + */ + pointA?: Vector; + + /** + * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. + * + * @property pointB + * @type vector + * @default { x: 0, y: 0 } + */ + pointB?: Vector; + + /** + * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. + * + * @property render + * @type object + */ + render?: IConstraintRenderDefinition; + + /** + * A `Number` that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. + * A value of `1` means the constraint should be very stiff. + * A value of `0.2` means the constraint acts like a soft spring. + * + * @property stiffness + * @type number + * @default 1 + */ + stiffness?: number; + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "constraint" + */ + type?: string; + } + + export interface IConstraintRenderDefinition { + /** + * A `Number` that defines the line width to use when rendering the constraint outline. + * A value of `0` means no outline will be rendered. + * + * @property render.lineWidth + * @type number + * @default 2 + */ + lineWidth: number; + + /** + * A `String` that defines the stroke style to use when rendering the constraint outline. + * It is the same as when using a canvas, so it accepts CSS style property values. + * + * @property render.strokeStyle + * @type string + * @default a random colour + */ + strokeStyle: string; + + /** + * A flag that indicates if the constraint should be rendered. + * + * @property render.visible + * @type boolean + * @default true + */ + visible: boolean; + } + + + /** + * The `Matter.Constraint` module contains methods for creating and manipulating constraints. + * Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position). + * The stiffness of constraints can be modified to create springs or elastic. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Constraint + */ + export class Constraint { + /** + * Creates a new constraint. + * All properties have default values, and many are pre-calculated automatically based on other properties. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {} options + * @return {constraint} constraint + */ + static create(options: IConstraintDefinition): Constraint; + + /** + * The first possible `Body` that this constraint is attached to. + * + * @property bodyA + * @type body + * @default null + */ + bodyA: Body; + + /** + * The second possible `Body` that this constraint is attached to. + * + * @property bodyB + * @type body + * @default null + */ + bodyB: Body; + + /** + * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. + * + * @property id + * @type number + */ + id: number; + + /** + * An arbitrary `String` name to help the user identify and manage bodies. + * + * @property label + * @type string + * @default "Constraint" + */ + label: string; + + /** + * A `Number` that specifies the target resting length of the constraint. + * It is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. + * + * @property length + * @type number + */ + length: number; + + /** + * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. + * + * @property pointA + * @type vector + * @default { x: 0, y: 0 } + */ + pointA: Vector; + + /** + * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. + * + * @property pointB + * @type vector + * @default { x: 0, y: 0 } + */ + pointB: Vector; + + /** + * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. + * + * @property render + * @type object + */ + render: IConstraintRenderDefinition; + + /** + * A `Number` that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. + * A value of `1` means the constraint should be very stiff. + * A value of `0.2` means the constraint acts like a soft spring. + * + * @property stiffness + * @type number + * @default 1 + */ + stiffness: number; + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "constraint" + */ + type: string; + } + + + + export interface IEngineDefinition { + /** + * An integer `Number` that specifies the number of position iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. + * + * @property positionIterations + * @type number + * @default 6 + */ + positionIterations?: number; + /** + * An integer `Number` that specifies the number of velocity iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. + * + * @property velocityIterations + * @type number + * @default 4 + */ + velocityIterations?: number; + /** + * An integer `Number` that specifies the number of constraint iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. + * The default value of `2` is usually very adequate. + * + * @property constraintIterations + * @type number + * @default 2 + */ + constraintIterations?: number; + + /** + * A flag that specifies whether the engine should allow sleeping via the `Matter.Sleeping` module. + * Sleeping can improve stability and performance, but often at the expense of accuracy. + * + * @property enableSleeping + * @type boolean + * @default false + */ + enableSleeping?: boolean; + /** + * An `Object` containing properties regarding the timing systems of the engine. + * + * @property timing + * @type object + */ + timing?: IEngineTimingOptions; + /** + * An instance of a broadphase controller. The default value is a `Matter.Grid` instance created by `Engine.create`. + * + * @property broadphase + * @type grid + * @default a Matter.Grid instance + */ + grid?: Grid; + /** + * A `World` composite object that will contain all simulated bodies and constraints. + * + * @property world + * @type world + * @default a Matter.World instance + */ + world?: World; + + } + + export interface IEngineTimingOptions { + /** + * A `Number` that specifies the global scaling factor of time for all bodies. + * A value of `0` freezes the simulation. + * A value of `0.1` gives a slow-motion effect. + * A value of `1.2` gives a speed-up effect. + * + * @property timing.timeScale + * @type number + * @default 1 + */ + timeScale: number; + + /** + * A `Number` that specifies the current simulation-time in milliseconds starting from `0`. + * It is incremented on every `Engine.update` by the given `delta` argument. + * + * @property timing.timestamp + * @type number + * @default 0 + */ + timestamp: number; + } + + /** + * The `Matter.Engine` module contains methods for creating and manipulating engines. + * An engine is a controller that manages updating the simulation of the world. + * See `Matter.Runner` for an optional game loop utility. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Engine + */ + export class Engine { + /** + * Clears the engine including the world, pairs and broadphase. + * @method clear + * @param {engine} engine + */ + static clear(engine: Engine): void; + + /** + * Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults. + * All properties have default values, and many are pre-calculated automatically based on other properties. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {HTMLElement} element + * @param {object} [options] + * @return {engine} engine + */ + static create(element?: HTMLElement | IEngineDefinition, options?: IEngineDefinition): Engine; + + /** + * Merges two engines by keeping the configuration of `engineA` but replacing the world with the one from `engineB`. + * @method merge + * @param {engine} engineA + * @param {engine} engineB + */ + static merge(engineA: Engine, engineB: Engine): void; + + + /** + * Moves the simulation forward in time by `delta` ms. + * The `correction` argument is an optional `Number` that specifies the time correction factor to apply to the update. + * This can help improve the accuracy of the simulation in cases where `delta` is changing between updates. + * The value of `correction` is defined as `delta / lastDelta`, i.e. the percentage change of `delta` over the last step. + * Therefore the value is always `1` (no correction) when `delta` constant (or when no correction is desired, which is the default). + * See the paper on Time Corrected Verlet for more information. + * + * Triggers `beforeUpdate` and `afterUpdate` events. + * Triggers `collisionStart`, `collisionActive` and `collisionEnd` events. + * @method update + * @param {engine} engine + * @param {number} delta + * @param {number} [correction] + */ + static update(engine: Engine, delta: number, correction?: number): Engine; + + /** + * An alias for `Runner.run`, see `Matter.Runner` for more information. + * @method run + * @param {engine} engine + */ + static run(enige: Engine): void; + + /** + * An instance of a broadphase controller. The default value is a `Matter.Grid` instance created by `Engine.create`. + * + * @property broadphase + * @type grid + * @default a Matter.Grid instance + */ + broadphase: Grid; + /** + * An integer `Number` that specifies the number of constraint iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. + * The default value of `2` is usually very adequate. + * + * @property constraintIterations + * @type number + * @default 2 + */ + constraintIterations: number; + + /** + * A flag that specifies whether the engine is running or not. + */ + enabled: boolean; + + /** + * A flag that specifies whether the engine should allow sleeping via the `Matter.Sleeping` module. + * Sleeping can improve stability and performance, but often at the expense of accuracy. + * + * @property enableSleeping + * @type boolean + * @default false + */ + enableSleeping: boolean; + + /** + * An integer `Number` that specifies the number of position iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. + * + * @property positionIterations + * @type number + * @default 6 + */ + positionIterations: number; + + /** + * An instance of a `Render` controller. The default value is a `Matter.Render` instance created by `Engine.create`. + * One may also develop a custom renderer module based on `Matter.Render` and pass an instance of it to `Engine.create` via `options.render`. + * + * A minimal custom renderer object must define at least three functions: `create`, `clear` and `world` (see `Matter.Render`). + * It is also possible to instead pass the _module_ reference via `options.render.controller` and `Engine.create` will instantiate one for you. + * + * @property render + * @type render + * @default a Matter.Render instance + */ + render: Render; + + /** + * An `Object` containing properties regarding the timing systems of the engine. + * + * @property timing + * @type object + */ + timing: IEngineTimingOptions; + + /** + * An integer `Number` that specifies the number of velocity iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. + * + * @property velocityIterations + * @type number + * @default 4 + */ + velocityIterations: number; + + /** + * A `World` composite object that will contain all simulated bodies and constraints. + * + * @property world + * @type world + * @default a Matter.World instance + */ + world: World; + } + + + export interface IGridDefinition { + + } + + /** + * The `Matter.Grid` module contains methods for creating and manipulating collision broadphase grid structures. + * + * @class Grid + */ + export class Grid { + /** + * Creates a new grid. + * @method create + * @param {} options + * @return {grid} A new grid + */ + static create(options?: IGridDefinition): Grid; + + /** + * Updates the grid. + * @method update + * @param {grid} grid + * @param {body[]} bodies + * @param {engine} engine + * @param {boolean} forceUpdate + */ + static update(grid: Grid, bodies: Array, engine: Engine, forceUpdate: boolean): void; + + /** + * Clears the grid. + * @method clear + * @param {grid} grid + */ + static clear(grid: Grid): void; + + } + + export interface IMouseConstraintDefinition { + /** + * The `Constraint` object that is used to move the body during interaction. + * + * @property constraint + * @type constraint + */ + constraint?: Constraint; + + /** + * An `Object` that specifies the collision filter properties. + * The collision filter allows the user to define which types of body this mouse constraint can interact with. + * See `body.collisionFilter` for more information. + * + * @property collisionFilter + * @type object + */ + collisionFilter?: ICollisionFilter; + + /** + * The `Body` that is currently being moved by the user, or `null` if no body. + * + * @property body + * @type body + * @default null + */ + body?: Body; + + /** + * The `Mouse` instance in use. If not supplied in `MouseConstraint.create`, one will be created. + * + * @property mouse + * @type mouse + * @default mouse + */ + mouse?: Mouse; + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "constraint" + */ + + type?: string; + } + + /** + * The `Matter.MouseConstraint` module contains methods for creating mouse constraints. + * Mouse constraints are used for allowing user interaction, providing the ability to move bodies via the mouse or touch. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class MouseConstraint + */ + export class MouseConstraint { + /** + * Creates a new mouse constraint. + * All properties have default values, and many are pre-calculated automatically based on other properties. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {engine} engine + * @param {} options + * @return {MouseConstraint} A new MouseConstraint + */ + create(engine: Engine, options: IMouseConstraintDefinition): MouseConstraint; + + /** + * The `Constraint` object that is used to move the body during interaction. + * + * @property constraint + * @type constraint + */ + constraint: Constraint; + + /** + * An `Object` that specifies the collision filter properties. + * The collision filter allows the user to define which types of body this mouse constraint can interact with. + * See `body.collisionFilter` for more information. + * + * @property collisionFilter + * @type object + */ + collisionFilter: ICollisionFilter; + + /** + * The `Body` that is currently being moved by the user, or `null` if no body. + * + * @property body + * @type body + * @default null + */ + body: Body; + + /** + * The `Mouse` instance in use. If not supplied in `MouseConstraint.create`, one will be created. + * + * @property mouse + * @type mouse + * @default mouse + */ + mouse: Mouse; + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "constraint" + */ + + type: string; + } + + export interface IPair { + id: number; + bodyA: Body; + bodyB: Body; + contacts: any; + activeContacts: any; + separation: number; + isActive: boolean; + timeCreated: number; + timeUpdated: number, + inverseMass: number; + friction: number; + frictionStatic: number; + restitution: number; + slop: number; + } + + /** + * The `Matter.Query` module contains methods for performing collision queries. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Query + */ + export class Query { + /** + * Casts a ray segment against a set of bodies and returns all collisions, ray width is optional. Intersection points are not provided. + * @method ray + * @param {body[]} bodies + * @param {vector} startPoint + * @param {vector} endPoint + * @param {number} [rayWidth] + * @return {object[]} Collisions + */ + static ray(bodies: Array, startPoint: Vector, endPoint: Vector, rayWidth?: number): Array; + + /** + * Returns all bodies whose bounds are inside (or outside if set) the given set of bounds, from the given set of bodies. + * @method region + * @param {body[]} bodies + * @param {bounds} bounds + * @param {bool} [outside=false] + * @return {body[]} The bodies matching the query + */ + static region(bodies: Array, bounds: Bounds, outside?: boolean): Array; + + /** + * Returns all bodies whose vertices contain the given point, from the given set of bodies. + * @method point + * @param {body[]} bodies + * @param {vector} point + * @return {body[]} The bodies matching the query + */ + static point(bodies: Array, point: Vector): Array; + } + + export interface IRenderDefinition { + /** + * A back-reference to the `Matter.Render` module. + * + * @property controller + * @type render + */ + controller?: any; + /** + * A reference to the element where the canvas is to be inserted (if `render.canvas` has not been specified) + * + * @property element + * @type HTMLElement + * @default null + */ + element?: HTMLElement; + /** + * The canvas element to render to. If not specified, one will be created if `render.element` has been specified. + * + * @property canvas + * @type HTMLCanvasElement + * @default null + */ + canvas?: HTMLCanvasElement; + + /** + * The configuration options of the renderer. + * + * @property options + * @type {} + */ + options?: IRendererOptions; + + /** + * A `Bounds` object that specifies the drawing view region. + * Rendering will be automatically transformed and scaled to fit within the canvas size (`render.options.width` and `render.options.height`). + * This allows for creating views that can pan or zoom around the scene. + * You must also set `render.options.hasBounds` to `true` to enable bounded rendering. + * + * @property bounds + * @type bounds + */ + bounds?: Bounds; + + /** + * The 2d rendering context from the `render.canvas` element. + * + * @property context + * @type CanvasRenderingContext2D + */ + context?: CanvasRenderingContext2D; + + /** + * The sprite texture cache. + * + * @property textures + * @type {} + */ + textures?: any; + + + } + + export interface IRendererOptions { + /** + * The target width in pixels of the `render.canvas` to be created. + * + * @property options.width + * @type number + * @default 800 + */ + width?: number; + + /** + * The target height in pixels of the `render.canvas` to be created. + * + * @property options.height + * @type number + * @default 600 + */ + height?: number; + + /** + * A flag that specifies if `render.bounds` should be used when rendering. + * + * @property options.hasBounds + * @type boolean + * @default false + */ + hasBounds?: boolean; + + + + + } + + /** + * The `Matter.Render` module is the default `render.controller` used by a `Matter.Engine`. + * This renderer is HTML5 canvas based and supports a number of drawing options including sprites and viewports. + * + * It is possible develop a custom renderer module based on `Matter.Render` and pass an instance of it to `Engine.create` via `options.render`. + * A minimal custom renderer object must define at least three functions: `create`, `clear` and `world` (see `Matter.Render`). + * + * See also `Matter.RenderPixi` for an alternate WebGL, scene-graph based renderer. + * + * @class Render + */ + export class Render { + /** + * Creates a new renderer. The options parameter is an object that specifies any properties you wish to override the defaults. + * All properties have default values, and many are pre-calculated automatically based on other properties. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {object} [options] + * @return {render} A new renderer + */ + static create(options: IRenderDefinition): Render; + /** + * Sets the pixel ratio of the renderer and updates the canvas. + * To automatically detect the correct ratio, pass the string `'auto'` for `pixelRatio`. + * @method setPixelRatio + * @param {render} render + * @param {number} pixelRatio + */ + static setPixelRatio(render: Render, pixelRatio: number): void; + /** + * Renders the given `engine`'s `Matter.World` object. + * This is the entry point for all rendering and should be called every time the scene changes. + * @method world + * @param {engine} engine + */ + static world(engine: Engine): void; + + /** + * A back-reference to the `Matter.Render` module. + * + * @property controller + * @type render + */ + controller: any; + /** + * A reference to the element where the canvas is to be inserted (if `render.canvas` has not been specified) + * + * @property element + * @type HTMLElement + * @default null + */ + element: HTMLElement; + /** + * The canvas element to render to. If not specified, one will be created if `render.element` has been specified. + * + * @property canvas + * @type HTMLCanvasElement + * @default null + */ + canvas: HTMLCanvasElement; + + /** + * The configuration options of the renderer. + * + * @property options + * @type {} + */ + options: IRendererOptions; + + /** + * A `Bounds` object that specifies the drawing view region. + * Rendering will be automatically transformed and scaled to fit within the canvas size (`render.options.width` and `render.options.height`). + * This allows for creating views that can pan or zoom around the scene. + * You must also set `render.options.hasBounds` to `true` to enable bounded rendering. + * + * @property bounds + * @type bounds + */ + bounds: Bounds; + + /** + * The 2d rendering context from the `render.canvas` element. + * + * @property context + * @type CanvasRenderingContext2D + */ + context: CanvasRenderingContext2D; + + /** + * The sprite texture cache. + * + * @property textures + * @type {} + */ + textures: any; + } + + + + export interface IRunnerOptions { + /** + * A `Boolean` that specifies if the runner should use a fixed timestep (otherwise it is variable). + * If timing is fixed, then the apparent simulation speed will change depending on the frame rate (but behaviour will be deterministic). + * If the timing is variable, then the apparent simulation speed will be constant (approximately, but at the cost of determininism). + * + * @property isFixed + * @type boolean + * @default false + */ + isFixed?: boolean; + + /** + * A `Number` that specifies the time step between updates in milliseconds. + * If `engine.timing.isFixed` is set to `true`, then `delta` is fixed. + * If it is `false`, then `delta` can dynamically change to maintain the correct apparent simulation speed. + * + * @property delta + * @type number + * @default 1000 / 60 + */ + delta?: number; + } + + /** + * The `Matter.Runner` module is an optional utility which provides a game loop, + * that handles updating and rendering a `Matter.Engine` for you within a browser. + * It is intended for demo and testing purposes, but may be adequate for simple games. + * If you are using your own game loop instead, then you do not need the `Matter.Runner` module. + * Instead just call `Engine.update(engine, delta)` in your own loop. + * Note that the method `Engine.run` is an alias for `Runner.run`. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Runner + */ + export class Runner { + /** + * Creates a new Runner. The options parameter is an object that specifies any properties you wish to override the defaults. + * @method create + * @param {} options + */ + static create(options:IRunnerOptions): Runner; + /** + * Continuously ticks a `Matter.Engine` by calling `Runner.tick` on the `requestAnimationFrame` event. + * @method run + * @param {engine} engine + */ + static run(runner: Runner, engine: Engine): Runner; + /** + * Continuously ticks a `Matter.Engine` by calling `Runner.tick` on the `requestAnimationFrame` event. + * @method run + * @param {engine} engine + */ + static run(engine: Engine): Runner; + /** + * A game loop utility that updates the engine and renderer by one step (a 'tick'). + * Features delta smoothing, time correction and fixed or dynamic timing. + * Triggers `beforeTick`, `tick` and `afterTick` events on the engine. + * Consider just `Engine.update(engine, delta)` if you're using your own loop. + * @method tick + * @param {runner} runner + * @param {engine} engine + * @param {number} time + */ + static tick(runner: Runner, engine: Engine, time: number): void; + /** + * Ends execution of `Runner.run` on the given `runner`, by canceling the animation frame request event loop. + * If you wish to only temporarily pause the engine, see `engine.enabled` instead. + * @method stop + * @param {runner} runner + */ + static stop(runner: Runner): void; + /** + * Alias for `Runner.run`. + * @method start + * @param {runner} runner + * @param {engine} engine + */ + static start(runner: Runner, engine: Engine): void; + + /** + * A flag that specifies whether the runner is running or not. + * + * @property enabled + * @type boolean + * @default true + */ + enabled: boolean; + + /** + * A `Boolean` that specifies if the runner should use a fixed timestep (otherwise it is variable). + * If timing is fixed, then the apparent simulation speed will change depending on the frame rate (but behaviour will be deterministic). + * If the timing is variable, then the apparent simulation speed will be constant (approximately, but at the cost of determininism). + * + * @property isFixed + * @type boolean + * @default false + */ + isFixed: boolean; + + /** + * A `Number` that specifies the time step between updates in milliseconds. + * If `engine.timing.isFixed` is set to `true`, then `delta` is fixed. + * If it is `false`, then `delta` can dynamically change to maintain the correct apparent simulation speed. + * + * @property delta + * @type number + * @default 1000 / 60 + */ + delta: number; + } + + /** + * The `Matter.Sleeping` module contains methods to manage the sleeping state of bodies. + * + * @class Sleeping + */ + export class Sleeping { + static set(body: Body, isSleeping: boolean): void; + } + + /** + * The `Matter.Svg` module contains methods for converting SVG images into an array of vector points. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Svg + */ + export class Svg { + /** + * Converts an SVG path into an array of vector points. + * If the input path forms a concave shape, you must decompose the result into convex parts before use. + * See `Bodies.fromVertices` which provides support for this. + * Note that this function is not guaranteed to support complex paths (such as those with holes). + * @method pathToVertices + * @param {SVGPathElement} path + * @param {Number} [sampleLength=15] + * @return {Vector[]} points + */ + static pathToVertices(path: SVGPathElement, sampleLength: number): Array; + } + + /** + * The `Matter.Vector` module contains methods for creating and manipulating vectors. + * Vectors are the basis of all the geometry related operations in the engine. + * A `Matter.Vector` object is of the form `{ x: 0, y: 0 }`. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Vector + */ + export class Vector { + + x: number; + y: number; + + /** + * Creates a new vector. + * @method create + * @param {number} x + * @param {number} y + * @return {vector} A new vector + */ + static create(x?: number, y?: number): Vector; + + /** + * Returns a new vector with `x` and `y` copied from the given `vector`. + * @method clone + * @param {vector} vector + * @return {vector} A new cloned vector + */ + static clone(vector: Vector): Vector; + + + /** + * Returns the cross-product of three vectors. + * @method cross3 + * @param {vector} vectorA + * @param {vector} vectorB + * @param {vector} vectorC + * @return {number} The cross product of the three vectors + */ + static cross3(vectorA: Vector, vectorB: Vector, vectorC: Vector):number; + + /** + * Adds the two vectors. + * @method add + * @param {vector} vectorA + * @param {vector} vectorB + * @param {vector} [output] + * @return {vector} A new vector of vectorA and vectorB added + */ + static add(vectorA: Vector, vectorB: Vector, output?: Vector): Vector; + + /** + * Returns the angle in radians between the two vectors relative to the x-axis. + * @method angle + * @param {vector} vectorA + * @param {vector} vectorB + * @return {number} The angle in radians + */ + static angle(vectorA: Vector, vectorB: Vector): number; + + /** + * Returns the cross-product of two vectors. + * @method cross + * @param {vector} vectorA + * @param {vector} vectorB + * @return {number} The cross product of the two vectors + */ + static cross(vectorA: Vector, vectorB: Vector): number; + + /** + * Divides a vector and a scalar. + * @method div + * @param {vector} vector + * @param {number} scalar + * @return {vector} A new vector divided by scalar + */ + static div(vector: Vector, scalar: number): Vector; + + /** + * Returns the dot-product of two vectors. + * @method dot + * @param {vector} vectorA + * @param {vector} vectorB + * @return {number} The dot product of the two vectors + */ + static dot(vectorA: Vector, vectorB: Vector): Number; + + /** + * Returns the magnitude (length) of a vector. + * @method magnitude + * @param {vector} vector + * @return {number} The magnitude of the vector + */ + static magnitude(vector: Vector): number; + + /** + * Returns the magnitude (length) of a vector (therefore saving a `sqrt` operation). + * @method magnitudeSquared + * @param {vector} vector + * @return {number} The squared magnitude of the vector + */ + static magnitudeSquared(vector: Vector): number; + + /** + * Multiplies a vector and a scalar. + * @method mult + * @param {vector} vector + * @param {number} scalar + * @return {vector} A new vector multiplied by scalar + */ + static mult(vector: Vector, scalar: number): Vector; + + /** + * Negates both components of a vector such that it points in the opposite direction. + * @method neg + * @param {vector} vector + * @return {vector} The negated vector + */ + static neg(vector: Vector): Vector; + + /** + * Normalises a vector (such that its magnitude is `1`). + * @method normalise + * @param {vector} vector + * @return {vector} A new vector normalised + */ + static normalise(vector: Vector): Vector; + + /** + * Returns the perpendicular vector. Set `negate` to true for the perpendicular in the opposite direction. + * @method perp + * @param {vector} vector + * @param {bool} [negate=false] + * @return {vector} The perpendicular vector + */ + static perp(vector: Vector, negate?: boolean): Vector; + + /** + * Rotates the vector about (0, 0) by specified angle. + * @method rotate + * @param {vector} vector + * @param {number} angle + * @return {vector} A new vector rotated about (0, 0) + */ + static rotate(vector: Vector, angle: number): Vector; + + /** + * Rotates the vector about a specified point by specified angle. + * @method rotateAbout + * @param {vector} vector + * @param {number} angle + * @param {vector} point + * @param {vector} [output] + * @return {vector} A new vector rotated about the point + */ + static rotateAbout(vector: Vector, angle: number, point: Vector, output?: Vector): Vector; + + /** + * Subtracts the two vectors. + * @method sub + * @param {vector} vectorA + * @param {vector} vectorB + * @param {vector} [output] + * @return {vector} A new vector of vectorA and vectorB subtracted + */ + static sub(vectorA: Vector, vectorB: Vector, optional?: Vector): Vector; + } + + /** + * The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices. + * A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`. + * A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull). + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Vertices + */ + export class Vertices { + /** + * Returns the average (mean) of the set of vertices. + * @method mean + * @param {vertices} vertices + * @return {vector} The average point + */ + static mean(vertices: Array): Array; + + /** + * Sorts the input vertices into clockwise order in place. + * @method clockwiseSort + * @param {vertices} vertices + * @return {vertices} vertices + */ + static clockwiseSort(vertices: Array): Array; + + /** + * Returns true if the vertices form a convex shape (vertices must be in clockwise order). + * @method isConvex + * @param {vertices} vertices + * @return {bool} `true` if the `vertices` are convex, `false` if not (or `null` if not computable). + */ + static isConvex(vertices: Array): boolean; + + /** + * Returns the convex hull of the input vertices as a new array of points. + * @method hull + * @param {vertices} vertices + * @return [vertex] vertices + */ + static hull(vertices: Array): Array; + + /** + * Returns the area of the set of vertices. + * @method area + * @param {vertices} vertices + * @param {bool} signed + * @return {number} The area + */ + static area(vertices: Array, signed: boolean): number; + + /** + * Returns the centre (centroid) of the set of vertices. + * @method centre + * @param {vertices} vertices + * @return {vector} The centre point + */ + static centre(vertices: Array): Vector; + + /** + * Chamfers a set of vertices by giving them rounded corners, returns a new set of vertices. + * The radius parameter is a single number or an array to specify the radius for each vertex. + * @method chamfer + * @param {vertices} vertices + * @param {number[]} radius + * @param {number} quality + * @param {number} qualityMin + * @param {number} qualityMax + */ + static chamfer(vertices: Array, radius: Array, quality: number, qualityMin: number, qualityMax: number): void; + + + /** + * Returns `true` if the `point` is inside the set of `vertices`. + * @method contains + * @param {vertices} vertices + * @param {vector} point + * @return {boolean} True if the vertices contains point, otherwise false + */ + static contains(vertices: Array, point: Vector): boolean; + + /** + * Creates a new set of `Matter.Body` compatible vertices. + * The `points` argument accepts an array of `Matter.Vector` points orientated around the origin `(0, 0)`, for example: + * + * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] + * + * The `Vertices.create` method returns a new array of vertices, which are similar to Matter.Vector objects, + * but with some additional references required for efficient collision detection routines. + * + * Note that the `body` argument is not optional, a `Matter.Body` reference must be provided. + * + * @method create + * @param {vector[]} points + * @param {body} body + */ + static create(points: Array, body: Body): void; + + /** + * Parses a string containing ordered x y pairs separated by spaces (and optionally commas), + * into a `Matter.Vertices` object for the given `Matter.Body`. + * For parsing SVG paths, see `Svg.pathToVertices`. + * @method fromPath + * @param {string} path + * @param {body} body + * @return {vertices} vertices + */ + static fromPath(path: string, body: Body): Array; + + /** + * Returns the moment of inertia (second moment of area) of the set of vertices given the total mass. + * @method inertia + * @param {vertices} vertices + * @param {number} mass + * @return {number} The polygon's moment of inertia + */ + static inertia(vertices: Array, mass: number): number; + + /** + * Rotates the set of vertices in-place. + * @method rotate + * @param {vertices} vertices + * @param {number} angle + * @param {vector} point + */ + static rotate(vertices: Array, angle: number, point: Vector): void; + + /** + * Scales the vertices from a point (default is centre) in-place. + * @method scale + * @param {vertices} vertices + * @param {number} scaleX + * @param {number} scaleY + * @param {vector} point + */ + static scale(vertices: Array, scaleX: number, scaleY: number, point: Vector): void; + + /** + * Translates the set of vertices in-place. + * @method translate + * @param {vertices} vertices + * @param {vector} vector + * @param {number} scalar + */ + static translate(vertices: Array, vector: Vector, scalar: number): void; + } + + interface IWorldDefinition extends ICompositeDefinition { + gravity?: Vector; + bounds?: Bounds; + } + + /** + * The `Matter.World` module contains methods for creating and manipulating the world composite. + * A `Matter.World` is a `Matter.Composite` body, which is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`. + * A `Matter.World` has a few additional properties including `gravity` and `bounds`. + * It is important to use the functions in the `Matter.Composite` module to modify the world composite, rather than directly modifying its properties. + * There are also a few methods here that alias those in `Matter.Composite` for easier readability. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class World + * @extends Composite + */ + export class World { /** * Add objects or arrays of objects of types: Body, Constraint, Composite * @param world * @param body * @returns world */ - static add(world:World, body:Body|Array|Composite|Array|Constraint|Array):World; + static add(world: World, body: Body | Array | Composite | Array | Constraint | Array): World; /** * An alias for Composite.addBody since World is also a Composite - * @param world - * @param body - * @returns world + * @method addBody + * @param {world} world + * @param {body} body + * @return {world} The original world with the body added */ - static addBody(world:World, body:Body):World; + static addBody(world: World, body: Body): World; /** * An alias for Composite.add since World is also a Composite - * @param world - * @param composite + * @method addComposite + * @param {world} world + * @param {composite} composite + * @return {world} The original world with the objects from composite added */ - static addComposite(world:World, composite:Composite):World; + static addComposite(world: World, composite: Composite): World; /** - * An alias for Composite.addConstraint since World is also a Composite. - * @param world - * @param constraint + * An alias for Composite.addConstraint since World is also a Composite + * @method addConstraint + * @param {world} world + * @param {constraint} constraint + * @return {world} The original world with the constraint added */ - static addConstraint(world:World, constraint:Constraint):World; + static addConstraint(world: World, constraint: Constraint): World; /** - * An alias for Composite.clear since World is also a Composite. - * @param world - * @param keepStatic + * An alias for Composite.clear since World is also a Composite + * @method clear + * @param {world} world + * @param {boolean} keepStatic */ - static clear(world:World, keepStatic:boolean):void; + static clear(world: World, keepStatic: boolean): void; /** - * Creates a new world composite. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section below for detailed information on what you can pass via the options object. - * @param options + * Creates a new world composite. The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @constructor + * @param {} options + * @return {world} A new world */ - static create(options:IWorldOptions):World; + static create(options: IWorldDefinition): World; + + gravity: Vector; + bounds: Bounds; } - export interface IBodyDefinition - { - angle?:number; - angularSpeed?:number; - angularVelocity?:number; - area?:number; - axes?:Array; - bounds?:Bounds; - density?:number; - force?:Vector; - friction?:number; - frictionAir?:number; - groupId?:number; - id?:number; - inertia?:number; - inverseInertia?:number; - inverseMass?:number; - isSleeping?:boolean; - isStatic?:boolean; - label?:string; - mass?:number; - motion?:number; - position?:Vector; - render?:IBodyRenderOptions; - restitution?:number; - sleepThreshold?:number; - slop?:number; - speed?:number; - timeScale?:number; - torque?:number; - type?:string; - velocity?:Vector; - vertices?:Array; + + + export interface ICollisionFilter { + category: number; + mask: number; + group: number; } - /** - * The Matter.Body module contains methods for creating and manipulating body models. A Matter.Body is a rigid body that can be simulated by a Matter.Engine. Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the module Matter.Bodies. - */ - export class Body - { - /** - * Applies a force to a body from a given world-space position, including resulting torque. - * @param body - * @param position - * @param force - */ - static applyForce(body:Body, position:Vector, force:Vector):void; - /** - * Applys a mass dependant force to all given bodies. - * @param bodies - * @param gravity - */ - static applyGravityAll(bodies:Array, gravity:Vector):void; - /** - * Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults. All properties have default values, and many are pre-calculated automatically based on other properties. See the properites section below for detailed information on what you can pass via the options object. - * @param options - */ - static create(options:IBodyDefinition):Body; - /** - * Returns the next unique groupID number. - */ - static nextGroupId():number; - /** - * Zeroes the body.force and body.torque force buffers. - * @param bodies - */ - static resetForcesAll(bodies:Array):void; - /** - * Rotates a body by a given angle relative to its current angle, without imparting any angular velocity. - * @param body - * @param angle - */ - static rotate(body:Body, angle:number):void; - /** - * Sets the body as static, including isStatic flag and setting mass and inertia to Infinity. - * @param isStatic - */ - setStatic(isStatic:boolean):void; - /** - * Scales the body, including updating physical properties (mass, area, axes, inertia), from a world-space point (default is body centre). - * @param body - * @param scaleX - * @param scaleY - * @param poinst - */ - static scale(body:Body, scaleX:number, scaleY:number, poinst?:Vector):void; - /** - * Moves a body by a given vector relative to its current position, without imparting any velocity. - * - * @param body - * @param translation - */ - static translate(body:Body, translation:Vector):void; - /** - *Performs a simulation step for the given body, including updating position and angle using Verlet integration. - * - * @param body - * @param deltaTime - * @param timeScale - * @param correction - */ - static update(body:Body, deltaTime:number, timeScale:number, correction:number):void; - /** - * Applys Body.update to all given bodies. - * - * @param bodies - * @param deltaTime - * @param timeScale - * @param correction - * @param worldBounds - */ - static updateAll ( bodies:Array, deltaTime:number, timeScale:number, correction:number, worldBounds:Bounds ):void; - /** - * A Number specifying the angle of the body, in radians. - */ - angle:number; - /** - * A Number that measures the current angular speed of the body after the last Body.update. It is read-only and always positive (it's the magnitude of body.angularVelocity). - */ - angularSpeed:number; - /** - * A Number that measures the current angular velocity of the body after the last Body.update. It is read-only. If you need to modify a body's angular velocity directly, you should apply a torque or simply change the body's angle (as the engine uses position-Verlet integration). - */ - angularVelocity:number; - /** - * A Number that measures the area of the body's convex hull, calculated at creation by Body.create. - */ - area:number; - /** - * An array of unique axis vectors (edge normals) used for collision detection. These are automatically calculated from the given convex hull (vertices array) in Body.create. They are constantly updated by Body.update during the simulation. - */ - axes:Array; - /** - * A Bounds object that defines the AABB region for the body. It is automatically calculated from the given convex hull (vertices array) in Body.create and constantly updated by Body.update during simulation. - */ - bounds:Bounds; - /** - * A Number that defines the density of the body, that is its mass per unit area. If you pass the density via Body.create the mass property is automatically calculated for you based on the size (area) of the object. This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood). - */ - density:number; - - /** - * A Vector that specifies the force to apply in the current step. It is zeroed after every Body.update. See also Body.applyForce. - */ - force:Vector; - - /** - * A Number that defines the friction of the body. The value is always positive and is in the range (0, 1). A value of 0 means that the body may slide indefinitely. A value of 1 means the body may come to a stop almost instantly after a force is applied. - The effects of the value may be non-linear. High values may be unstable depending on the body. The engine uses a Coulomb friction model including static and kinetic friction. Note that collision response is based on pairs of bodies, and that friction values are combined with the following formula: - Math.min(bodyA.friction, bodyB.friction) - */ - friction:number; - - /** - * A Number that defines the air friction of the body (air resistance). A value of 0 means the body will never slow as it moves through space. The higher the value, the faster a body slows when moving through space. The effects of the value are non-linear. - Default: 0.01 - */ - frictionAir:number; - - /** - * An integer Number that specifies the collision group the body belongs to. Bodies with the same groupId are considered as-one body and therefore do not interact. This allows for creation of segmented bodies that can self-intersect, such as a rope. The default value 0 means the body does not belong to a group, and can interact with all other bodies. - Default: 0 - */ - groupId:number; - - /** - * An integer Number uniquely identifying number generated in Body.create by Common.nextId. - */ - id:number; - - /** - * A Number that defines the moment of inertia (i.e. second moment of area) of the body. It is automatically calculated from the given convex hull (vertices array) and density in Body.create. If you modify this value, you must also modify the body.inverseInertia property (1 / inertia). - */ - inertia:number; - - /** - * A Number that defines the inverse moment of inertia of the body (1 / inertia). If you modify this value, you must also modify the body.inertia property. - */ - inverseInertia:number; - - /** - * A Number that defines the inverse mass of the body (1 / mass). If you modify this value, you must also modify the body.mass property. - */ - inverseMass:number; - - /** - * A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken. If you need to set a body as sleeping, you should use Sleeping.set as this requires more than just setting this flag. - Default: false - */ - isSleeping:boolean; - - /** - * A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed. If you need to set a body as static after its creation, you should use Body.setStatic as this requires more than just setting this flag. - Default: false - */ - isStatic:boolean; - - /** - * An arbitrary String name to help the user identify and manage bodies. - Default: "Body" - */ - label:string; - - /** - * A Number that defines the mass of the body, although it may be more appropriate to specify the density property instead. If you modify this value, you must also modify the body.inverseMass property (1 / mass). - */ - mass:number; - - /** - * A Number that measures the amount of movement a body currently has (a combination of speed and angularSpeed). It is read-only and always positive. It is used and updated by the Matter.Sleeping module during simulation to decide if a body has come to rest. - Default: 0 - */ - motion:number; - - /** - * A Vector that specifies the current world-space position of the body. - Default: { x: 0, y: 0 } - */ - position:Vector; - - /** - * An Object that defines the rendering properties to be consumed by the module Matter.Render. - */ - render:IBodyRenderOptions; - - /** - * A Number that defines the restitution (elasticity) of the body. The value is always positive and is in the range (0, 1). A value of 0 means collisions may be perfectly inelastic and no bouncing may occur. A value of 0.8 means the body may bounce back with approximately 80% of its kinetic energy. Note that collision response is based on pairs of bodies, and that restitution values are combined with the following formula: - Math.max(bodyA.restitution, bodyB.restitution) - Default: 0 - */ - restitution:number; - - /** - * A Number that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the Matter.Sleeping module (if sleeping is enabled by the engine). - Default: 60 - */ - sleepThreshold:number; - - /** - * A Number that specifies a tollerance on how far a body is allowed to 'sink' or rotate into other bodies. Avoid changing this value unless you understand the purpose of slop in physics engines. The default should generally suffice, although very large bodies may require larger values for stable stacking. - Default: 0.05 - */ - slop:number; - - /** - * A Number that measures the current speed of the body after the last Body.update. It is read-only and always positive (it's the magnitude of body.velocity). - Default: 0 - */ - speed:number; - - /** - * A Number that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed. - Default: 1 - */ - timeScale:number; - - /** - * A Number that specifies the torque (turning force) to apply in the current step. It is zeroed after every Body.update. - Default: 0 - */ - torque:number; - - /** - *A String denoting the type of object. - Default: "body" - */ - type:string; - - /** - * A Vector that measures the current velocity of the body after the last Body.update. It is read-only. If you need to modify a body's velocity directly, you should either apply a force or simply change the body's position (as the engine uses position-Verlet integration). - Default: { x: 0, y: 0 } - */ - velocity:Vector; - - /** - * An array of Vector objects that specify the convex hull of the rigid body. These should be provided about the origin (0, 0). E.g. - [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] - When passed via Body.create, the verticies are translated relative to body.position (i.e. world-space, and constantly updated by Body.update during simulation). The Vector objects are also augmented with additional properties required for efficient collision detection. - Other properties such as inertia and bounds are automatically calculated from the passed vertices (unless provided via options). Concave hulls are not currently supported. The module Matter.Vertices contains useful methods for working with vertices. - */ - vertices:Array; + export interface IMousePoint { + x: number; + y: number; } - export class Bodies { - /** - * Creates a new rigid body model with a circle hull. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. - * - * @param x - * @param y - * @param radius - * @param options - * @param maxSides - */ - static circle(x:number, y:number, radius:number, options?:IBodyDefinition, maxSides?:number):Body; - - /** - * Creates a new rigid body model with a regular polygon hull with the given number of sides. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. - * - * @param x - * @param y - * @param sides - * @param radius - * @param options - */ - static polygon(x:number, y:number, sides:number, radius:number, options?:IBodyDefinition):Body; - - /** - * Creates a new rigid body model with a rectangle hull. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. - * - * @param x - * @param y - * @param width - * @param height - * @param options - */ - static rectangle(x:number, y:number, width:number, height:number, options?:IBodyDefinition):Body; - - /** - * Creates a new rigid body model with a trapezoid hull. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. - * - * @param x - * @param y - * @param width - * @param height - * @param slope - * @param options - */ - static trapezoid(x:number, y:number, width:number, height:number, slope:number, options?:IBodyDefinition):Body; - + export class Mouse { + static create(element: HTMLElement): Mouse; + static setElement(mouse: Mouse, element: HTMLElement): void; + static clearSourceEvents(mouse: Mouse): void; + static setOffset(mouse: Mouse, offset: Vector): void; + static setScale(mouse: Mouse, scale: Vector): void; + element: HTMLElement; + absolute: IMousePoint; + position: IMousePoint; + mousedownPosition: IMousePoint; + mouseupPosition: IMousePoint; + offset: IMousePoint; + scale: IMousePoint; + wheelDelta: number; + button: number; + pixelRatio: number; } - export interface IBodyRenderOptions - { - /** - * A String that defines the fill style to use when rendering the body (if a sprite is not defined). It is the same as when using a canvas, so it accepts CSS style property values. - Default: a random colour - */ - fillStyle:string; - /** - * A Number that defines the line width to use when rendering the body outline (if a sprite is not defined). A value of 0 means no outline will be rendered. - Default: 1.5 - */ - lineWidth:number; - /** - * An Object that defines the sprite properties to use when rendering, if any. - */ - sprite:IBodyRenderOptionsSprite; - /** - * A String that defines the stroke style to use when rendering the body outline (if a sprite is not defined). It is the same as when using a canvas, so it accepts CSS style property values. - Default: a random colour - */ - strokeStyle:string; - /** - * A flag that indicates if the body should be rendered. - Default: true - */ - visible:boolean; + + + + export interface IEvent { + /** + * The name of the event + */ + name: string; + /** + * The source object of the event + */ + source: T; } - export interface IBodyRenderOptionsSprite - { + export interface IEventComposite extends IEvent { /** - * An String that defines the path to the image to use as the sprite texture, if any. + * EventObjects (may be a single body, constraint, composite or a mixed array of these) */ - texture:string; - - /** - * A Number that defines the scaling in the x-axis for the sprite, if any. - Default: 1 - */ - xScale:number; - - /** - * A Number that defines the scaling in the y-axis for the sprite, if any. - Default: 1 - */ - yScale:number; + object: any; } - export class Bounds - { - + export interface IEventTimestamped extends IEvent { + /** + * The engine.timing.timestamp of the event + */ + timestamp: number; } - export class Vector - { - - x:number; - y:number; - + export interface IEventCollision extends IEventTimestamped { /** - * Adds the two vectors. - * - * @param vectorA - * @param vectorB - * @returns A new vector of vectorA and vectorB added. + * The collision pair */ - static add ( vectorA:Vector, vectorB:Vector ):Vector; - - /** - * Returns the angle in radians between the two vectors relative to the x-axis. - * - * @param vectorA - * @param vectorB - * @returns The angle in radians. - */ - static angle ( vectorA:Vector, vectorB:Vector ):number; - - /** - * Returns the cross-product of two vectors. - * - * @param vectorA - * @param vectorB - * @returns The cross product of the two vectors. - */ - static cross ( vectorA:Vector, vectorB:Vector ):number; - - /** - * Divides a vector and a scalar. - * - * @param vector - * @param scalar - * @returns A new vector divided by scalar. - */ - static div ( vector:Vector, scalar:number ):Vector; - - /** - * Returns the dot-product of two vectors. - * - * @param vectorA - * @param vectorB - * @returns The dot product of the two vectors - */ - static dot ( vectorA:Vector, vectorB:Vector ):Number; - - /** - * Returns the magnitude (length) of a vector. - * - * @param vector - * @returns The magnitude of the vector - */ - static magnitude ( vector:Vector ):number; - - /** - * Returns the magnitude (length) of a vector (therefore saving a sqrt operation). - * - * @param vector - * @returns The squared magnitude of the vector. - */ - static magnitudeSquared ( vector:Vector ):number; - - /** - * Multiplies a vector and a scalar. - * - * @param vector - * @param scalar - * @returns A new vector multiplied by scalar - */ - static mult ( vector:Vector, scalar:number ):Vector; - - /** - * Negates both components of a vector such that it points in the opposite direction. - * @param vector - * @returns The negated vector. - */ - static neg ( vector:Vector ):Vector; - - /** - * Normalises a vector (such that its magnitude is 1). - * - * @param vector - * @returns A new vector normalised - */ - static normalise ( vector:Vector ):Vector; - - /** - * Returns the perpendicular vector. Set negate to true for the perpendicular in the opposite direction. - * - * @param vector - * @param negate - * @returns The perpendicular vector - */ - static perp ( vector:Vector, negate?:boolean ):Vector; - - /** - * Rotates the vector about (0, 0) by specified angle. - * - * @param vector - * @param angle - * @returns A new vector rotated about (0, 0) - */ - static rotate ( vector:Vector, angle:number ):Vector; - - /** - * Rotates the vector about a specified point by specified angle. - * - * @param vector - * @param angle - * @param point - * @returns A new vector rotated about the point - */ - static rotateAbout ( vector:Vector, angle:number, point:Vector ):Vector; - - /** - * Subtracts the two vectors. - * - * @param vectorA - * @param vectorB - * @returns A new vector of vectorA and vectorB subtracted - */ - static sub ( vectorA:Vector, vectorB:Vector ):Vector; + pairs: Array; } - export class Constraint - { + + export class Events { + /** - * Creates a new constraint. All properties have default values, and many are pre-calculated automatically based on other properties. See the properites section below for detailed information on what you can pass via the options object. + * Fired when a body starts sleeping (where `this` is the body). + * + * @event sleepStart + * @this {body} The body that has started sleeping + * @param {} event An event object + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "sleepStart", callback: (e: IEvent) => void): void; + /** + * Fired when a body ends sleeping (where `this` is the body). * - * @param options - * @returns constraint - */ - static create(options:IConstraintDefinition):Constraint; + * @event sleepEnd + * @this {body} The body that has ended sleeping + * @param {} event An event object + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "sleepEnd", callback: (e: IEvent) => void): void; + + /** + * Fired when a call to `Composite.add` is made, before objects have been added. + * + * @event beforeAdd + * @param {} event An event object + * @param {} event.object The object(s) to be added (may be a single body, constraint, composite or a mixed array of these) + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "beforeAdd", callback: (e: IEventComposite) => void): void; + + /** + * Fired when a call to `Composite.add` is made, after objects have been added. + * + * @event afterAdd + * @param {} event An event object + * @param {} event.object The object(s) that have been added (may be a single body, constraint, composite or a mixed array of these) + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "afterAdd", callback: (e: IEventComposite) => void): void; + + /** + * Fired when a call to `Composite.remove` is made, before objects have been removed. + * + * @event beforeRemove + * @param {} event An event object + * @param {} event.object The object(s) to be removed (may be a single body, constraint, composite or a mixed array of these) + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "beforeRemove", callback: (e: IEventComposite) => void): void; + + /** + * Fired when a call to `Composite.remove` is made, after objects have been removed. + * + * @event afterRemove + * @param {} event An event object + * @param {} event.object The object(s) that have been removed (may be a single body, constraint, composite or a mixed array of these) + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "afterRemove", callback: (e: IEventComposite) => void): void; + + + /** + * Fired after engine update and all collision events + * + * @event afterUpdate + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "afterUpdate", callback: (e: IEventTimestamped) => void): void; + + /** + * Fired before rendering + * + * @event beforeRender + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "beforeRender", callback: (e: IEventTimestamped) => void): void; + /** + * Fired after rendering + * + * @event afterRender + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "afterRender", callback: (e: IEventTimestamped) => void): void; + + + /** + * Fired just before an update + * + * @event beforeUpdate + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "beforeUpdate", callback: (e: IEventTimestamped) => void): void; + + /** + * Fired after engine update, provides a list of all pairs that are colliding in the current tick (if any) + * + * @event collisionActive + * @param {} event An event object + * @param {} event.pairs List of affected pairs + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "collisionActive", callback: (e: IEventCollision) => void): void; + + + /** + * Fired after engine update, provides a list of all pairs that have ended collision in the current tick (if any) + * + * @event collisionEnd + * @param {} event An event object + * @param {} event.pairs List of affected pairs + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "collisionEnd", callback: (e: IEventCollision) => void): void; + + /** + * Fired after engine update, provides a list of all pairs that have started to collide in the current tick (if any) + * + * @event collisionStart + * @param {} event An event object + * @param {} event.pairs List of affected pairs + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "collisionStart", callback: (e: IEventCollision) => void): void; + + /** + * Fired at the start of a tick, before any updates to the engine or timing + * + * @event beforeTick + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "beforeTick", callback: (e: IEventTimestamped) => void): void; + + /** + * Fired after engine timing updated, but just before update + * + * @event tick + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "tick", callback: (e: IEventTimestamped) => void): void; + + /** + * Fired at the end of a tick, after engine update and after rendering + * + * @event afterTick + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "afterTick", callback: (e: IEventTimestamped) => void): void; + + /** + * Fired before rendering + * + * @event beforeRender + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "beforeRender", callback: (e: IEventTimestamped) => void): void; + + /** + * Fired after rendering + * + * @event afterRender + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "afterRender", callback: (e: IEventTimestamped) => void): void; - /** - * The first possible Body that this constraint is attached to. - */ - bodyA:Body; - - /** - * The second possible Body that this constraint is attached to. - */ - bodyB:Body; - - /** - * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. - */ - id:number; - - /** - * An arbitrary String name to help the user identify and manage bodies. - * Default: "Constraint" - */ - label:string; - - /** - * A Number that specifies the target resting length of the constraint. It is calculated automatically in Constraint.create from intial positions of the constraint.bodyA and constraint.bodyB. - */ - length:number; - - /** - * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. - Default: { x: 0, y: 0 } - */ - pointA:Vector; - - /** - * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. - Default: { x: 0, y: 0 } - */ - pointB:Vector; - - /** - * An Object that defines the rendering properties to be consumed by the module Matter.Render. - */ - render:IConstraintRenderRefinition; - - /** - * A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting constraint.length. A value of 1 means the constraint should be very stiff. A value of 0.2 means the constraint acts like a soft spring. - Default: 1 - */ - stiffness:number; - - /** - * A String denoting the type of object. - Default: "constraint" - */ - type:string; - } - - export class MouseConstraint - { - create(engine:Engine, options:IMouseConstraintDefinition):MouseConstraint; - - /** - * The Constraint object that is used to move the body during interaction. - */ - constraint:Constraint; - - /** - * The Body that is currently being moved by the user, or null if no body. - Default: null - */ - dragBody:Body; - - /** - * The Vector offset at which the drag started relative to the dragBody, if any. - Default: null - */ - dragPoint:Vector; - - /** - * The Mouse instance in use. - Default: engine.input.mouse - */ - mouse:Mouse; - - /** - * A String denoting the type of object. - Default: "constraint" - */ - type:string; - } - - export interface IMouseConstraintDefinition - { - /** - * The Constraint object that is used to move the body during interaction. - */ - constraint?:Constraint; - - /** - * The Body that is currently being moved by the user, or null if no body. - Default: null - */ - dragBody?:Body; - - /** - * The Vector offset at which the drag started relative to the dragBody, if any. - Default: null - */ - dragPoint?:Vector; - - /** - * The Mouse instance in use. - Default: engine.input.mouse - */ - mouse?:Mouse; - - /** - * A String denoting the type of object. - Default: "constraint" - */ - type?:string; - } - - export class Query - { - /** - * Casts a ray segment against a set of bodies and returns all collisions, ray width is optional. Intersection points are not provided. - * - * @param bodies - * @param startPoint - * @param endPoint - * @param [rayWidth] - * - * @returns Object[] Collisions - */ - static ray( bodies:Array, startPoint:Vector, endPoint:Vector, rayWidth?:number ):Array; - - /** - * Returns all bodies whose bounds are inside (or outside if set) the given set of bounds, from the given set of bodies. - * - * @param bodies - * @param bounds - * @returns Body[] The bodies matching the query - */ - static region( bodies:Array, bounds:Bounds, outside?:boolean ):Array; - } - - export class Mouse - { - - } - - export interface IConstraintRenderRefinition - { - /** - * A Number that defines the line width to use when rendering the constraint outline. A value of 0 means no outline will be rendered. - Default: 2 - */ - lineWidth:number; - - /** - * A String that defines the stroke style to use when rendering the constraint outline. It is the same as when using a canvas, so it accepts CSS style property values. - Default: a random colour - */ - strokeStyle:string; - - /** - * A flag that indicates if the constraint should be rendered. - Default: true - */ - visible:boolean; - } - - export interface IConstraintDefinition - { - /** - * The first possible Body that this constraint is attached to. - */ - bodyA?:Body; - - /** - * The second possible Body that this constraint is attached to. - */ - bodyB?:Body; - - /** - * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. - */ - id?:number; - - /** - * An arbitrary String name to help the user identify and manage bodies. - * Default: "Constraint" - */ - label?:string; - - /** - * A Number that specifies the target resting length of the constraint. It is calculated automatically in Constraint.create from intial positions of the constraint.bodyA and constraint.bodyB. - */ - length?:number; - - /** - * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. - Default: { x: 0, y: 0 } - */ - pointA?:Vector; - - /** - * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. - Default: { x: 0, y: 0 } - */ - pointB?:Vector; - - /** - * An Object that defines the rendering properties to be consumed by the module Matter.Render. - */ - render?:IConstraintRenderRefinition; - - /** - * A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting constraint.length. A value of 1 means the constraint should be very stiff. A value of 0.2 means the constraint acts like a soft spring. - Default: 1 - */ - stiffness?:number; - - /** - * A String denoting the type of object. - Default: "constraint" - */ - type?:string; - } - - export class Composite - { - /** - * Generic add function. Adds one or many body(s), constraint(s) or a composite(s) to the given composite. - * - * @param composite - * @param object - * - * @returns The original composite with the objects added - */ - static add(composite:Composite, object:Body|Composite|Constraint ):Composite; - - /** - * Adds a body to the given composite - * - * @param composite - * @param body - * - * @returns Composite The original composite with the body added - */ - static addBody(composite:Composite, body:Body):Composite; - - /** - * Adds a composite to the given composite - * - * @param compositeA - * @param compositeB - * - * @returns The original compositeA with the objects from compositeB added - */ - static addComposite(compositeA:Composite, compositeB:Composite):Composite; - - /** - * - * @param composite - * @param constraint - * @returns The original composite with the constraint added - */ - static addConstraint(composite:Composite, constraint:Constraint):Composite; - - /** - * Returns all bodies in the given composite, including all bodies in its children, recursively. - * - * @param composite - * @returns Body[] All the bodies - */ - static allBodies(composite:Composite):Array; - - /** - * Returns all composites in the given composite, including all composites in its children, recursively. - * - * @param composite - * @returns Composite[] All the composites - */ - static allComposites(composite:Composite):Array; - - /** - * Returns all constraints in the given composite, including all constraints in its children, recursively. - * - * @param composite - * @returns Constraint[] All the constraints - */ - static allConstraints(composite:Composite):Array; - - /** - * Removes all bodies, constraints and composites from the given composite Optionally clearing its children recursively. - * - * @param world - * @param keepStatic - * @param deep - */ - static clear(world:World, keepStatic:boolean, deep?:boolean):void; - - /** - * Creates a new composite. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section below for detailed information on what you can pass via the options object. - * - * @param options - * @returns A new composite - */ - static create(options:ICompositeDefinition):Composite; - - /** - * Searches the composite recursively for an object matching the type and id supplied, null if not found - * - * @param composite - * @param id - * @param type - * @returns The requested object, if found. - */ - static get(composite:Composite,id:number,type:string):Body|Composite|Constraint; - - /** - * Moves the given object(s) from compositeA to compositeB (equal to a remove followed by an add) - * - * @param compositeA - * @param objects - * @param compositeB - * @returns Returns compositeA - */ - static move(compositeA:Composite, objects:Array, compositeB:Composite):Composite; - - /** - * Assigns new ids for all objects in the composite, recursively. - * - * @param composite - * @returns Returns composite - */ - static rebase(composite:Composite):Composite; - - /** - * Generic remove function. Removes one or many body(s), constraint(s) or a composite(s) to the given composite. Optionally searching its children recursively. - * - * @param composite - * @param object - * @param deep - * @returns The original composite with the objects removed. - */ - static remove(composite:Composite, object:Body|Composite|Constraint, deep?:boolean):Composite; - - /** - * Removes a body from the given composite, and optionally searching its children recursively. - * - * @param composite - * @param body - * @param deep - * @returns The original composite with the body removed. - */ - static removeBody(composite:Composite, body:Body, deep?:boolean):Composite; - /** - * Removes a body from the given composite. - * - * @param composite - * @param position - * @returns The original composite with the body removed. - */ - static removeBodyAt(composite:Composite, position:number):Composite; - - /** - * Removes a composite from the given composite, and optionally searching its children recursively - * - * @param compositeA - * @param compositeB - * @returns The original compositeA with the composite removed. - */ - static removeComposite(compositeA:Composite, compositeB:Composite, deep?:boolean):Composite; - - /** - * Removes a composite from the given composite - * - * @param composite - * @param position - * @returns The original composite with the composite removed. - */ - static removeCompositeAt(composite:Composite, position:number):Composite; - - /** - * Removes a constraint from the given composite, and optionally searching its children recursively - * - * @param composite - * @param constraint - * @param deep - * - * @returns The original composite with the constraint removed - */ - static removeConstraint(composite:Composite, constraint:Constraint, deep?:boolean):Composite; - - /** - * Removes a body from the given composite - * @param composite - * @param position - * @returns The original composite with the constraint removed - */ - static removeConstraintAt(composite:Composite, position:number):Composite; - - /** - * Sets the composite's isModified flag. If updateParents is true, all parents will be set (default: false). If updateChildren is true, all children will be set (default: false). - * - * @param composite - * @param isModified - * @param updateParents - */ - static setModified(composite:Composite, isModified:boolean, updateParents?:boolean):void; - - /** - * An array of Body that are direct children of this composite. To add or remove bodies you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allBodies method. - */ - bodies:Array; - - /** - * An array of Composite that are direct children of this composite. To add or remove composites you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allComposites method. - */ - composites:Array; - - /** - * An array of Constraint that are direct children of this composite. To add or remove constraints you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allConstraints method. - */ - constraints:Array; - - /** - * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. - */ - id:number; - - /** - * A flag that specifies whether the composite has been modified during the current step. Most Matter.Composite methods will automatically set this flag to true to inform the engine of changes to be handled. If you need to change it manually, you should use the Composite.setModified method. - */ - isModified:boolean; - - /** - * An arbitrary String name to help the user identify and manage composites. - * Default: "Composite" - */ - label:string; - - /** - * The Composite that is the parent of this composite. It is automatically managed by the Matter.Composite methods. - */ - parent:Composite; - - /** - * A String denoting the type of object. - */ - type:String; - - } - - export class Composites - { - /** - * It will create car composite, wheels, car body and constraints. - * - * @param xx - * @param yy - * @param width - * @param height - * @param wheelSize - * - * @returns A new composite car body - */ - static car ( xx:number, yy:number, width:number, height:number, wheelSize:number ):Composite; - - /** - * Creates chain - * @param composite - * @param xOffsetA - * @param yOffsetA - * @param xOffsetB - * @param yOffsetB - * @param options - */ - static chain ( composite:Composite, xOffsetA:number, yOffsetA:number, xOffsetB:number, yOffsetB:number, options:any ):Composite; - - /** - *Connects bodies in the composite with constraints in a grid pattern, with optional cross braces - * - * @param composite - * @param columns - * @param rows - * @param crossBrace - * @param options - * @returns The composite containing objects meshed together with constraints - */ - static mesh(composite:Composite, columns:number, rows:number, crossBrace:boolean, options:any ):Composite; - - /** - * Creates newton cradle - * @param xx - * @param yy - * @param _number - * @param size - * @param length - * @returns A new composite newtonsCradle body - */ - newtonsCradle(xx:number, yy:number, _number:number, size:number, length:number):Composite; - - /** - * Creates pyramid - * - * @param xx - * @param yy - * @param columns - * @param rows - * @param columnGap - * @param rowGap - * @param callback - * @return A new composite containing objects created in the callback - */ - static pyramid(xx:number, yy:number, columns:number, rows:number, columnGap:number, rowGap:number, callback:Function):Composite; - - /** - * Creates a simple soft body like object - * - * @param xx - * @param yy - * @param columns - * @param rows - * @param columnGap - * @param rowGap - * @param crossBrace - * @param particleRadius - * @param particleOptions - * @param constraintOptions - * - * @returns A new composite softBody - */ - static softBody ( xx:number, yy:number, columns:number, rows:number, columnGap:number, rowGap:number, crossBrace:boolean, particleRadius:number, particleOptions:any, constraintOptions:any ):Composite; - - /** - * Creates objects in and stacks them up. - * @param xx - * @param yy - * @param columns - * @param rows - * @param columnGap - * @param rowGap - * @param callback - * @returns A new composite containing objects created in the callback - */ - static stack ( xx:number, yy:number, columns:number, rows:number, columnGap:number, rowGap:number, callback:Function ):Composite; - } - - export interface ICompositeDefinition - { - /** - * An array of Body that are direct children of this composite. To add or remove bodies you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allBodies method. - */ - bodies?:Array; - - /** - * An array of Composite that are direct children of this composite. To add or remove composites you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allComposites method. - */ - composites?:Array; - - /** - * An array of Constraint that are direct children of this composite. To add or remove constraints you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allConstraints method. - */ - constraints?:Array; - - /** - * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. - */ - id?:number; - - /** - * A flag that specifies whether the composite has been modified during the current step. Most Matter.Composite methods will automatically set this flag to true to inform the engine of changes to be handled. If you need to change it manually, you should use the Composite.setModified method. - */ - isModified?:boolean; - - /** - * An arbitrary String name to help the user identify and manage composites. - * Default: "Composite" - */ - label?:string; - - /** - * The Composite that is the parent of this composite. It is automatically managed by the Matter.Composite methods. - */ - parent?:Composite; - - /** - * A String denoting the type of object. - */ - type?:String; - } - - export class Vertices - { - /** - * Returns the area of the set of vertices. - * - * @param vertices - * @param signed - */ - static area ( vertices:Array, signed:boolean ):number; - - /** - * Returns the centre (centroid) of the set of vertices. - * @param vertices - * @returns The centre point - */ - static centre ( vertices:Array ):Vector; - - /** - * Chamfers a set of vertices by giving them rounded corners, returns a new set of vertices. The radius parameter is a single number or an array to specify the radius for each vertex. - * @param vertices - */ - static chamfer ( vertices:Array, radius:Array, quality:number, qualityMin:number, qualityMax:number ):void; - - - /** - * Returns true if the point is inside the set of vertices. - * - * @param vertices - * @returns True if the vertices contains point, otherwise false. - */ - static contains ( vertices:Array, point:Vector ):boolean; - - /** - * Creates a new set of Matter.Body compatible vertices. The vertices argument accepts an array of Matter.Vector orientated around the origin (0, 0), for example: - [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] - The Vertices.create method then inserts additional indexing properties required for efficient collision detection routines. - - * @param vertices - * @param body - */ - static create ( vertices:Array, body:Body):void; - - /** - * Parses a simple SVG-style path into a set of Matter.Vector points. - * - * @param path - * @returns vertices - */ - static fromPath ( path:string ):Array; - - /** - * Returns the moment of inertia (second moment of area) of the set of vertices given the total mass. - * - * @param vertices - * @returns The polygon's moment of inertia - */ - static inertia ( vertices:Array, mass:number ):number; - - /** - * Rotates the set of vertices in-place. - * - * @param vertices - * @param angle - * @param point - */ - static rotate ( vertices:Array, angle:number, point:Vector ):void; - - /** - * Scales the vertices from a point (default is centre) in-place. - * - * @param vertices - * @param scaleX - * @param scaleY - * @param point - */ - static scale( vertices:Array, scaleX:number, scaleY:number, point:Vector ):void; - - /** - * Translates the set of vertices in-place. - * - * @param vertices - */ - static translate ( vertices:Array, vector:Vector, scalar:number ):void; - } - - export class Render - { - - } - - export class Events - { - /** - * Fired after rendering - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"afterRender", callback:(e:any) => void ):void; - - /** - * Fired after engine update and after rendering - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"afterUpdate", callback:(e:any) => void ):void; - - /** - * Fired just before rendering - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"beforeRender", callback:(e:any) => void ):void; - - /** - * Fired at the start of a tick, before any updates to the engine or timing - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"beforeTick", callback:(e:any) => void ):void; - - /** - * Fired just before an update - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"beforeUpdate", callback:(e:any) => void ):void; - - /** - * Fired after engine update, provides a list of all pairs that are colliding in the current tick (if any) - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"collisionActive", callback:(e:any) => void ):void; - - - /** - * Fired after engine update, provides a list of all pairs that have ended collision in the current tick (if any) - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"collisionEnd", callback:(e:any) => void ):void; - - /** - * Fired after engine update, provides a list of all pairs that have started to collide in the current tick (if any) - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"collisionStart", callback:(e:any) => void ):void; /** * Fired when the mouse is down (or a touch has started) during the last step @@ -1482,7 +3185,7 @@ declare module Matter * @param name * @param callback */ - static on(obj:Engine, name:"mousedown", callback:(e:any) => void ):void; + static on(obj: Engine, name: "mousedown", callback: (e: any) => void): void; /** * Fired when the mouse has moved (or a touch moves) during the last step @@ -1490,7 +3193,7 @@ declare module Matter * @param name * @param callback */ - static on(obj:Engine, name:"mousemove", callback:(e:any) => void ):void; + static on(obj: Engine, name: "mousemove", callback: (e: any) => void): void; /** * Fired when the mouse is up (or a touch has ended) during the last step @@ -1498,35 +3201,28 @@ declare module Matter * @param name * @param callback */ - static on(obj:Engine, name:"mouseup", callback:(e:any) => void ):void; + static on(obj: Engine, name: "mouseup", callback: (e: any) => void): void; - /** - * Fired after engine timing updated, but just before engine state updated - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"tick", callback:(e:any) => void ):void; - static on(obj:Engine, name:string, callback:(e:any) => void ):void; + static on(obj: Engine, name: string, callback: (e: any) => void): void; /** * Removes the given event callback. If no callback, clears all callbacks in eventNames. If no eventNames, clears all events. * - * @param obj - * @param eventName - * @param callback - */ - static off(obj:any, eventName:string, callback: (e:any) => void ):void; + * @param obj + * @param eventName + * @param callback + */ + static off(obj: any, eventName: string, callback: (e: any) => void): void; /** * Fires all the callbacks subscribed to the given object's eventName, in the order they subscribed, if any. * - * @param object - * @param eventNames - * @param event - */ - static trigger( object:any, eventNames:string, event: (e:any) => void ):void; + * @param object + * @param eventNames + * @param event + */ + static trigger(object: any, eventNames: string, event: (e: any) => void): void; } } From 6670de8685a6623e6907316abc84d4847b47927e Mon Sep 17 00:00:00 2001 From: abraaoalves Date: Sun, 17 Jan 2016 12:06:17 -0300 Subject: [PATCH 404/441] fix error "implicity any" --- wiredep/wiredep.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wiredep/wiredep.d.ts b/wiredep/wiredep.d.ts index add84b1641..ec256b47b8 100644 --- a/wiredep/wiredep.d.ts +++ b/wiredep/wiredep.d.ts @@ -152,7 +152,7 @@ declare module 'wiredep' { * @exemple: * return '' */ - anotherTypeOfBowerFile: (filePath) => string; + anotherTypeOfBowerFile: (filePath: string) => string; } }; From 6a287502dab374e7d4cbf18ea1ac5dff7f74726a Mon Sep 17 00:00:00 2001 From: Olivier CHEVET Date: Sun, 17 Jan 2016 17:38:52 +0100 Subject: [PATCH 405/441] Added missing functions from version 3.31 - reset - epilog/epilogue - locale - detectLocale - choices - exitProcess Added an extra prototype for version, accepting a function argument --- yargs/yargs-tests.ts | 64 ++++++++++++++++++++++++++++++++++++++++++++ yargs/yargs.d.ts | 17 ++++++++++++ 2 files changed, 81 insertions(+) diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index f20254990a..d504cd1813 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -134,6 +134,16 @@ function Argv$options() { ; } +function Argv$choices() { + // example from documentation + var argv = yargs + .alias('i', 'ingredient') + .describe('i', 'choose your sandwich ingredients') + .choices('i', ['peanut-butter', 'jelly', 'banana', 'pickles']) + .help('help') + .argv +} + function command() { var argv = yargs .usage('npm ') @@ -208,4 +218,58 @@ function Argv$version() { var argv3 = yargs .version('1.0.0', '--version', 'description'); + + var argv4 = yargs + .version( function() { return '1.0.0'; }, '--version', 'description'); +} + +function Argv$locale() { + var argv = yargs + .usage('./$0 - follow ye instructions true') + .option('option', { + alias: 'o', + describe: "'tis a mighty fine option", + demand: true + }) + .command('run', "Arrr, ya best be knowin' what yer doin'") + .example('$0 run foo', "shiver me timbers, here's an example for ye") + .help('help') + .wrap(70) + .locale('pirate') + .argv +} + +function Argv$epilogue() { + var argv = yargs + .epilogue('for more information, find our manual at http://example.com'); +} + +function Argv$reset() { + var ya = yargs + .usage('$0 command') + .command('hello', 'hello command') + .command('world', 'world command') + .demand(1, 'must provide a valid command'), + argv = yargs.argv, + command = argv._[0]; + + if (command === 'hello') { + ya.reset() + .usage('$0 hello') + .help('h') + .example('$0 hello', 'print the hello message!') + .argv + + console.log('hello!'); + } else if (command === 'world'){ + ya.reset() + .usage('$0 world') + .help('h') + .example('$0 world', 'print the world message!') + .argv + + console.log('world!'); + } else { + ya.showHelp(); + } } diff --git a/yargs/yargs.d.ts b/yargs/yargs.d.ts index 03b7c05dcd..637137fbf1 100644 --- a/yargs/yargs.d.ts +++ b/yargs/yargs.d.ts @@ -11,6 +11,13 @@ declare module "yargs" { (...args: any[]): any; parse(...args: any[]): any; + reset(): Argv; + + locale(): string; + locale(loc:string): Argv; + + detectLocale(detect:boolean): Argv; + alias(shortName: string, longName: string): Argv; alias(aliases: { [shortName: string]: string }): Argv; alias(aliases: { [shortName: string]: string[] }): Argv; @@ -71,6 +78,9 @@ declare module "yargs" { string(key: string): Argv; string(keys: string[]): Argv; + choices(choices: Object): Argv; + choices(key: string, values:any[]): Argv; + config(key: string): Argv; config(keys: string[]): Argv; @@ -81,12 +91,18 @@ declare module "yargs" { help(): string; help(option: string, description?: string): Argv; + epilog(msg: string): Argv; + epilogue(msg: string): Argv; + version(version: string, option?: string, description?: string): Argv; + version(version: () => string, option?: string, description?: string): Argv; showHelpOnFail(enable: boolean, message?: string): Argv; showHelp(func?: (message: string) => any): Argv; + exitProcess(enabled:boolean): Argv; + /* Undocumented */ normalize(key: string): Argv; @@ -115,6 +131,7 @@ declare module "yargs" { description?: any; desc?: any; requiresArg?: any; + choices?:string[]; } type SyncCompletionFunction = (current: string, argv: any) => string[]; From b64f4c98948d5378e32ee7bab158793257f07ec2 Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Sun, 17 Jan 2016 21:08:52 +0100 Subject: [PATCH 406/441] module name added, removed empty lines --- matter-js/matter-js.d.ts | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/matter-js/matter-js.d.ts b/matter-js/matter-js.d.ts index aa9f5c0b3c..ed5412b523 100644 --- a/matter-js/matter-js.d.ts +++ b/matter-js/matter-js.d.ts @@ -4,6 +4,9 @@ // David Asmuth // Definitions: https://github.com/borisyankov/DefinitelyTyped +declare module 'matter-js' { + export = Matter; +} declare module Matter { /** @@ -2882,32 +2885,12 @@ declare module Matter { } - - export interface ICollisionFilter { category: number; mask: number; group: number; } - - - - - - - - - - - - - - - - - - export interface IMousePoint { x: number; y: number; @@ -2932,14 +2915,6 @@ declare module Matter { pixelRatio: number; } - - - - - - - - export interface IEvent { /** * The name of the event @@ -3177,8 +3152,6 @@ declare module Matter { */ static on(obj: Engine, name: "afterRender", callback: (e: IEventTimestamped) => void): void; - - /** * Fired when the mouse is down (or a touch has started) during the last step * @param obj From 4128f7af06c355e3526b7cf7cbb85e2e43bff167 Mon Sep 17 00:00:00 2001 From: Florent Poujol Date: Sun, 17 Jan 2016 21:46:29 +0100 Subject: [PATCH 407/441] Update definitions for socket.io to v1.4.4. --- socket.io/socket.io.d.ts | 58 +++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index 3556068589..67fb7dd9a4 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -1,6 +1,6 @@ -// Type definitions for socket.io 1.3.5 +// Type definitions for socket.io 1.4.4 // Project: http://socket.io/ -// Definitions by: PROGRE , Damian Connolly +// Definitions by: PROGRE , Damian Connolly , Florent Poujol // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -248,6 +248,18 @@ declare module SocketIO { * @see send( ...args ) */ write( ...args: any[] ): Namespace; + + /** + * Gets a list of clients + * @return The default '/' Namespace + */ + clients( ...args: any[] ): Namespace; + + /** + * Sets the compress flag + * @return The default '/' Namespace + */ + compress( ...args: any[] ): Namespace; } /** @@ -360,9 +372,10 @@ declare module SocketIO { server: Server; /** - * A list of all the Sockets connected to this Namespace + * A dictionary of all the Sockets connected to this Namespace, where + * the Socket ID is the key */ - sockets: Socket[]; + sockets: { [id: string]: Socket }; /** * A dictionary of all the Sockets connected to this Namespace, where @@ -437,6 +450,19 @@ declare module SocketIO { * @ This Namespace */ on( event: string, listener: Function ): Namespace; + + /** + * Gets a list of clients. + * @return This Namespace + */ + clients( fn: Function ): Namespace; + + /** + * Sets the compress flag. + * @param compress If `true`, compresses the sending data + * @return This Namespace + */ + compress( compress: boolean ): Namespace; } /** @@ -506,9 +532,10 @@ declare module SocketIO { }; /** - * The list of rooms that this Socket is currently in + * The list of rooms that this Socket is currently in, where + * the ID the the room ID */ - rooms: string[]; + rooms: { [id: string]: string }; /** * Is the Socket currently connected? @@ -702,6 +729,13 @@ declare module SocketIO { * @return An array of callback Functions, or an empty array if we don't have any */ listeners( event: string ):Function[]; + + /** + * Sets the compress flag + * @param compress If `true`, compresses the sending data + * @return This Socket + */ + compress( compress: boolean ): Socket; } /** @@ -715,10 +749,10 @@ declare module SocketIO { nsp: Namespace; /** - * A dictionary of all the rooms that we have in this namespace, each room - * a dictionary of all the sockets currently in that room + * A dictionary of all the rooms that we have in this namespace + * The rooms are made of a `sockets` key which is the dictionary of sockets per ID */ - rooms: {[room: string]: {[id: string]: boolean }}; + rooms: {[room: string]: {sockets: {[id: string]: boolean }}}; /** * A dictionary of all the socket ids that we're dealing with, and all @@ -809,10 +843,10 @@ declare module SocketIO { request: any; /** - * The list of sockets currently connect via this client (i.e. to different - * namespaces) + * The dictionary of sockets currently connect via this client (i.e. to different + * namespaces) where the Socket ID is the key */ - sockets: Socket[]; + sockets: {[id: string]: Socket}; /** * A dictionary of all the namespaces for this client, with the Socket that From 495f2734927a644e913f9ed8f4d7d903f276f41d Mon Sep 17 00:00:00 2001 From: Florent Poujol Date: Fri, 15 Jan 2016 21:43:29 +0100 Subject: [PATCH 408/441] Update definitions for socket.io-client to v1.4.4. --- socket.io-client/socket.io-client.d.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/socket.io-client/socket.io-client.d.ts b/socket.io-client/socket.io-client.d.ts index 32f51aea49..56d0a0f5b5 100644 --- a/socket.io-client/socket.io-client.d.ts +++ b/socket.io-client/socket.io-client.d.ts @@ -1,6 +1,6 @@ -// Type definitions for socket.io-client 1.3.5 +// Type definitions for socket.io-client 1.4.4 // Project: http://socket.io/ -// Definitions by: PROGRE , Damian Connolly +// Definitions by: PROGRE , Damian Connolly , Florent Poujol // Definitions: https://github.com/borisyankov/DefinitelyTyped declare var io: SocketIOClientStatic; @@ -219,6 +219,7 @@ declare module SocketIOClient { * connect * connect_error * connect_timeout + * connecting * disconnect * error * reconnect @@ -226,6 +227,8 @@ declare module SocketIOClient { * reconnect_failed * reconnect_error * reconnecting + * ping + * pong * then the event is emitted normally. Otherwise, if we're connected, the * event is sent. Otherwise, it's buffered. * @@ -248,6 +251,13 @@ declare module SocketIOClient { * @see close() */ disconnect():Socket; + + /** + * Sets the compress flag. + * @param compress If `true`, compresses the sending data + * @return this Socket + */ + compress(compress: boolean):Socket; } /** @@ -308,7 +318,7 @@ declare module SocketIOClient { /** * The currently connected sockets */ - connected: Socket[]; + connecting: Socket[]; /** * If we should auto connect (also used when creating Sockets). Set via the From fe559849bffe3845ee62e585b4765c2cf3c685be Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 13:49:09 +1100 Subject: [PATCH 409/441] ga('UA-65432-1', 'auto') actually returns `undefined` --- google.analytics/ga-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google.analytics/ga-tests.ts b/google.analytics/ga-tests.ts index dd03e0d253..acff9eb555 100644 --- a/google.analytics/ga-tests.ts +++ b/google.analytics/ga-tests.ts @@ -40,7 +40,7 @@ describe('UniversalAnalytics', () => { ga.getByName('aNamedTracker'); }); it('should excercise Tracker APIs', () => { - var tracker: UniversalAnalytics.Tracker = ga('create', 'UA-65432-1', 'auto'); + var tracker: UniversalAnalytics.Tracker = ga.create('UA-65432-1', 'auto'); var aString: string = tracker.get('aString'); var aNumber: number = tracker.get('aNumber'); var anObject: {} = tracker.get<{}>('anObject'); From 91fbf92911f47c8a3ef0c0efd856fa6e966d2fa2 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 13:49:20 +1100 Subject: [PATCH 410/441] updated API --- google.analytics/ga.d.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index 1cbbba44ee..794f4cd19b 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -46,7 +46,7 @@ declare module UniversalAnalytics { interface ga { l: number; q: any[]; - + (command: 'send', hitType: 'event', eventCategory: string, eventAction: string, eventLabel?: string, eventValue?: number, fieldsObject?: {}): void; (command: 'send', hitType: 'event', fieldsObject: { @@ -71,18 +71,22 @@ declare module UniversalAnalytics { timingCategory: string, timingVar: string, timingValue: number): void; (command: 'send', hitType: 'timing', fieldsObject: {timingCategory: string, timingVar: string, timingValue: number}): void; - (command: 'send', hitType: HitType, ...fields: any[]): void; + (command: 'send', hitType: HitType, ...fields: any[], fieldsObject?: {}): void; (command: 'send', fieldsObject: {}): void; - (command: string, hitType: string, ...fields: any[]): void; - (command: string, hitDetails: {}): void; - (command: string, poly: string, opt_poly?: {}): UniversalAnalytics.Tracker; - (command: string, trackingId: string, auto: string, opt_configObject?: {}): UniversalAnalytics.Tracker; - - create(trackingId: string, opt_configObject?: {}): UniversalAnalytics.Tracker; - create(trackingId: string, auto: string, opt_configObject?: {}): UniversalAnalytics.Tracker; + (command: 'create', trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): void; + (command: 'remove'): void; + + (command: string, ...fields?: any[], fieldsObject?: {}): void; + (command: string, ...fields: any[], fieldsObject?: {}): void; + + (readyCallback: (tracker?: UniversalAnalytics.Tracker):void): void; + + create(trackingId: string, fieldsObject?: {}): UniversalAnalytics.Tracker; + create(trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): UniversalAnalytics.Tracker; getAll(): UniversalAnalytics.Tracker[]; getByName(name: string): UniversalAnalytics.Tracker; + remove(name:string): void; } interface Tracker { From e61862aca77c16045b31c3194f0732d405cdb4ca Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 13:53:46 +1100 Subject: [PATCH 411/441] use correct callback syntax --- google.analytics/ga.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index 794f4cd19b..bab55b9e57 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -80,7 +80,7 @@ declare module UniversalAnalytics { (command: string, ...fields?: any[], fieldsObject?: {}): void; (command: string, ...fields: any[], fieldsObject?: {}): void; - (readyCallback: (tracker?: UniversalAnalytics.Tracker):void): void; + (readyCallback: (defaultTracker?: UniversalAnalytics.Tracker) => void): void; create(trackingId: string, fieldsObject?: {}): UniversalAnalytics.Tracker; create(trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): UniversalAnalytics.Tracker; From ae08e2515a5c8621ee3503c0056b9ddc0fea7039 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 14:04:30 +1100 Subject: [PATCH 412/441] `(command: string, ...fields?: any[]}): void;` should handle any other commands --- google.analytics/ga.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index bab55b9e57..b8518fc902 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -73,12 +73,12 @@ declare module UniversalAnalytics { fieldsObject: {timingCategory: string, timingVar: string, timingValue: number}): void; (command: 'send', hitType: HitType, ...fields: any[], fieldsObject?: {}): void; (command: 'send', fieldsObject: {}): void; + (command: string, hitType: HitType, ...fields: any[]): void; (command: 'create', trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): void; (command: 'remove'): void; - (command: string, ...fields?: any[], fieldsObject?: {}): void; - (command: string, ...fields: any[], fieldsObject?: {}): void; + (command: string, ...fields?: any[]}): void; (readyCallback: (defaultTracker?: UniversalAnalytics.Tracker) => void): void; From a608ac5b6701a515269be163dbb825dc5a0a81af Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 14:06:49 +1100 Subject: [PATCH 413/441] fixed typo --- google.analytics/ga.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index b8518fc902..ca142c2fb0 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -78,7 +78,7 @@ declare module UniversalAnalytics { (command: 'create', trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): void; (command: 'remove'): void; - (command: string, ...fields?: any[]}): void; + (command: string, ...fields?: any[]): void; (readyCallback: (defaultTracker?: UniversalAnalytics.Tracker) => void): void; From 86c94ff30be1cce6afbbae6edde2777857517c82 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 14:09:15 +1100 Subject: [PATCH 414/441] removed redundant declaration --- google.analytics/ga.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index ca142c2fb0..4472cf780b 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -71,7 +71,6 @@ declare module UniversalAnalytics { timingCategory: string, timingVar: string, timingValue: number): void; (command: 'send', hitType: 'timing', fieldsObject: {timingCategory: string, timingVar: string, timingValue: number}): void; - (command: 'send', hitType: HitType, ...fields: any[], fieldsObject?: {}): void; (command: 'send', fieldsObject: {}): void; (command: string, hitType: HitType, ...fields: any[]): void; From 3b751150b2818dd5a7447d95db657297e74d3695 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 14:16:08 +1100 Subject: [PATCH 415/441] non-optional rest parameter --- google.analytics/ga.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index 4472cf780b..d6c817cd5f 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -77,12 +77,13 @@ declare module UniversalAnalytics { (command: 'create', trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): void; (command: 'remove'): void; - (command: string, ...fields?: any[]): void; + (command: string, ...fields: any[]): void; (readyCallback: (defaultTracker?: UniversalAnalytics.Tracker) => void): void; - create(trackingId: string, fieldsObject?: {}): UniversalAnalytics.Tracker; create(trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): UniversalAnalytics.Tracker; + create(trackingId: string, fieldsObject?: {}): UniversalAnalytics.Tracker; + getAll(): UniversalAnalytics.Tracker[]; getByName(name: string): UniversalAnalytics.Tracker; remove(name:string): void; From 5c0a2a138ac67c1b1c13dafc5837bfcbff6a00e2 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 14:19:57 +1100 Subject: [PATCH 416/441] fixed `create` API --- google.analytics/ga.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index d6c817cd5f..68d0293a46 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -81,7 +81,8 @@ declare module UniversalAnalytics { (readyCallback: (defaultTracker?: UniversalAnalytics.Tracker) => void): void; - create(trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): UniversalAnalytics.Tracker; + create(trackingId: string, cookieDomain: string, name: string, fieldsObject?: {}): UniversalAnalytics.Tracker; + create(trackingId: string, cookieDomain: string, fieldsObject?: {}): UniversalAnalytics.Tracker; create(trackingId: string, fieldsObject?: {}): UniversalAnalytics.Tracker; getAll(): UniversalAnalytics.Tracker[]; From f03447b87052b3faac3d217b86728debf0403820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e?= Date: Mon, 18 Jan 2016 09:48:30 +0100 Subject: [PATCH 417/441] Update electron-packager.d.ts --- electron-packager/electron-packager.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/electron-packager/electron-packager.d.ts b/electron-packager/electron-packager.d.ts index a25e89fc8a..54e8162501 100644 --- a/electron-packager/electron-packager.d.ts +++ b/electron-packager/electron-packager.d.ts @@ -81,12 +81,12 @@ declare namespace ElectronPackager { /** Electron-packager done callback. */ export interface Callback { /** - * Callback wich is called when electron-packager is done. + * Callback which is called when electron-packager is done. * * @param err - Contains errors if any. - * @param appPath - Path to the newly created application. + * @param appPath - Path(s) to the newly created application(s). */ - (err: Error, appPath: string): void + (err: Error, appPath: string|string[]): void } /** Electron-packager function */ From 8ac2edf817ab77a00f0d2a1a53bb46eb2a466067 Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Mon, 18 Jan 2016 11:59:30 +0100 Subject: [PATCH 418/441] mysql: IPoolClusterConfig.restoreNodeTimeout is missing --- mysql/mysql-tests.ts | 7 +++++++ mysql/mysql.d.ts | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/mysql/mysql-tests.ts b/mysql/mysql-tests.ts index 97df14dbf4..080bece2db 100644 --- a/mysql/mysql-tests.ts +++ b/mysql/mysql-tests.ts @@ -222,6 +222,13 @@ var pool = poolCluster.of('SLAVE*', 'RANDOM'); pool.getConnection(function (err, connection) { }); pool.getConnection(function (err, connection) { }); +var poolClusterWithOptions = mysql.createPoolCluster({ + canRetry: true, + removeNodeErrorCount: 3, + restoreNodeTimeout: 1000, + defaultSelector: 'RR' +}); + // destroy poolCluster.end(); diff --git a/mysql/mysql.d.ts b/mysql/mysql.d.ts index 715c799a2f..9239c19075 100644 --- a/mysql/mysql.d.ts +++ b/mysql/mysql.d.ts @@ -408,6 +408,12 @@ declare module "mysql" { */ removeNodeErrorCount?: number; + /** + * If connection fails, specifies the number of milliseconds before another connection attempt will be made. + * If set to 0, then node will be removed instead and never re-used. (Default: 0) + */ + restoreNodeTimeout?: number; + /** * The default selector. (Default: RR) * RR: Select one alternately. (Round-Robin) From 34ae6b21bca77b453f278697e7a7e1ce784c64ab Mon Sep 17 00:00:00 2001 From: ali taheri Date: Mon, 18 Jan 2016 15:56:06 +0330 Subject: [PATCH 419/441] [iban] Support require/import style --- iban/iban.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/iban/iban.d.ts b/iban/iban.d.ts index 6a7bd803d3..14c6ae764f 100644 --- a/iban/iban.d.ts +++ b/iban/iban.d.ts @@ -55,4 +55,8 @@ interface IBANStatic { toBBAN(iban: string, separator: string[]): string; } -declare var IBAN: IBANStatic; \ No newline at end of file +declare var IBAN: IBANStatic; + +declare module 'iban' { + export = IBAN; +} From 8d948f4a02ca04895b7f408f380bf2dbb4dab68e Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Fri, 15 Jan 2016 16:51:34 +0900 Subject: [PATCH 420/441] fix code format --- sequelize/sequelize-tests-2.0.0.ts | 17 +- sequelize/sequelize-tests.ts | 4 +- sequelize/sequelize.d.ts | 310 ++++++++++++++--------------- 3 files changed, 165 insertions(+), 166 deletions(-) diff --git a/sequelize/sequelize-tests-2.0.0.ts b/sequelize/sequelize-tests-2.0.0.ts index d35074e086..0ef636c859 100644 --- a/sequelize/sequelize-tests-2.0.0.ts +++ b/sequelize/sequelize-tests-2.0.0.ts @@ -18,7 +18,7 @@ var transOpts: Sequelize.TransactionOptions; var syncOpts: Sequelize.SyncOptions; var assocOpts: Sequelize.AssociationOptions; var schemaOpts: Sequelize.SchemaOptions; -var findOpts: Sequelize.FindOptions +var findOpts: Sequelize.FindOptions; var findCrOpts: Sequelize.FindOrCreateOptions; var queryOpts: Sequelize.QueryOptions; var buildOpts: Sequelize.BuildOptions; @@ -45,7 +45,6 @@ interface modelPojo { } interface modelInst extends Sequelize.Instance, modelPojo { - }; var myModelInst: modelInst; @@ -117,12 +116,12 @@ model.find().then(function () { }, function () { }); model.find().then(function () { }); model.find().then(null, function () { }); model.find().then(function (result: modelInst) { }); -model.find().then(function (result: modelInst): Sequelize.PromiseT { return model.find(1) }); -model.find().then(function (result: modelInst): Sequelize.PromiseT { return model.find(1) }, function (): Sequelize.PromiseT { return model.find(1) }); +model.find().then(function (result: modelInst): Sequelize.PromiseT { return model.find(1); }); +model.find().then(function (result: modelInst): Sequelize.PromiseT { return model.find(1); }, function (): Sequelize.PromiseT { return model.find(1); }); model.find().catch(function () { }); model.find().catch(function (result: modelInst) { }); -model.find().catch(function (result: modelInst): Sequelize.Promise { return model.find(1) }); +model.find().catch(function (result: modelInst): Sequelize.Promise { return model.find(1); }); model.find().spread(function () { }, function () { }); model.find().spread(function () { }); @@ -130,10 +129,10 @@ model.find().spread(null, function () { }); model.find().spread(function (result: modelInst) { }); model.find().spread(function (result1: modelInst, result2: any) { }); model.find().spread(null, function (result1: any, result2: boolean) { }); -model.find().spread(function (result: modelInst): Sequelize.Promise { return model.find(1) }); -model.find().spread(function (result: modelInst): Sequelize.PromiseT { return model.find(1) }); -model.find().spread(function (result: modelInst) { }, function (): Sequelize.PromiseT { return model.find(1) }); -model.find().spread(function (result: modelInst): Sequelize.PromiseT { return model.find(1) }, function (): Sequelize.PromiseT { return model.find(1) }); +model.find().spread(function (result: modelInst): Sequelize.Promise { return model.find(1); }); +model.find().spread(function (result: modelInst): Sequelize.PromiseT { return model.find(1); }); +model.find().spread(function (result: modelInst) { }, function (): Sequelize.PromiseT { return model.find(1); }); +model.find().spread(function (result: modelInst): Sequelize.PromiseT { return model.find(1); }, function (): Sequelize.PromiseT { return model.find(1); }); promiseMe = model.findAll(findOpts, queryOpts); promiseMe = model.findAll(findOpts); diff --git a/sequelize/sequelize-tests.ts b/sequelize/sequelize-tests.ts index cda4aff119..74c7e06e80 100644 --- a/sequelize/sequelize-tests.ts +++ b/sequelize/sequelize-tests.ts @@ -906,7 +906,7 @@ User.find( { where : { intVal : { lte : 5 } } } ); User.count(); User.count( { transaction : t } ); -User.count().then( function( c ) { c.toFixed() } ); +User.count().then( function( c ) { c.toFixed(); } ); User.count( { where : ["username LIKE '%us%'"] } ); User.count( { include : [{ model : User, required : false }] } ); User.count( { distinct : true, include : [{ model : User, required : false }] } ); @@ -1122,7 +1122,7 @@ s.query( '', { raw : true, nest : false } ); s.query( 'select ? as foo, ? as bar', { type : this.sequelize.QueryTypes.SELECT, replacements : [1, 2] } ); s.query( { query : 'select ? as foo, ? as bar', values : [1, 2] }, { type : s.QueryTypes.SELECT } ); s.query( 'select :one as foo, :two as bar', { raw : true, replacements : { one : 1, two : 2 } } ); -s.transaction().then( function( t ) { s.set( { foo : 'bar' }, { transaction : t } ) } ); +s.transaction().then( function( t ) { s.set( { foo : 'bar' }, { transaction : t } ); } ); s.define( 'foo', { bar : Sequelize.STRING }, { collate : 'utf8_bin' } ); s.define( 'Foto', { name : Sequelize.STRING }, { tableName : 'photos' } ); s.databaseVersion().then( function( version ) { } ); diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 3f1e2c86fc..e33b4b8d72 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -55,7 +55,7 @@ declare module "sequelize" { * Get the associated instance. * @param options The options to use when getting the association. */ - (options?: BelongsToGetAssociationMixinOptions): Promise + (options?: BelongsToGetAssociationMixinOptions): Promise; } /** @@ -96,7 +96,7 @@ declare module "sequelize" { ( newAssociation?: TInstance | TInstancePrimaryKey, options?: BelongsToSetAssociationMixinOptions | InstanceSaveOptions - ): Promise + ): Promise; } /** @@ -132,7 +132,7 @@ declare module "sequelize" { ( values?: TAttributes, options?: BelongsToCreateAssociationMixinOptions | CreateOptions | BelongsToSetAssociationMixinOptions - ): Promise + ): Promise; } /** @@ -169,7 +169,7 @@ declare module "sequelize" { * Get the associated instance. * @param options The options to use when getting the association. */ - (options?: HasOneGetAssociationMixinOptions): Promise + (options?: HasOneGetAssociationMixinOptions): Promise; } /** @@ -210,7 +210,7 @@ declare module "sequelize" { ( newAssociation?: TInstance | TInstancePrimaryKey, options?: HasOneSetAssociationMixinOptions | HasOneGetAssociationMixinOptions | InstanceSaveOptions - ): Promise + ): Promise; } /** @@ -246,7 +246,7 @@ declare module "sequelize" { ( values?: TAttributes, options?: HasOneCreateAssociationMixinOptions | HasOneSetAssociationMixinOptions | CreateOptions - ): Promise + ): Promise; } /** @@ -296,7 +296,7 @@ declare module "sequelize" { * Get everything currently associated with this, using an optional where clause. * @param options The options to use when getting the associations. */ - (options?: HasManyGetAssociationsMixinOptions): Promise + (options?: HasManyGetAssociationsMixinOptions): Promise; } /** @@ -346,7 +346,7 @@ declare module "sequelize" { ( newAssociations?: Array, options?: HasManySetAssociationsMixinOptions | FindOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -395,7 +395,7 @@ declare module "sequelize" { ( newAssociations?: Array, options?: HasManyAddAssociationsMixinOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -444,7 +444,7 @@ declare module "sequelize" { ( newAssociation?: TInstance | TInstancePrimaryKey, options?: HasManyAddAssociationMixinOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -487,7 +487,7 @@ declare module "sequelize" { ( values?: TAttributes, options?: HasManyCreateAssociationMixinOptions | CreateOptions - ): Promise + ): Promise; } /** @@ -530,7 +530,7 @@ declare module "sequelize" { ( oldAssociated?: TInstance | TInstancePrimaryKey, options?: HasManyRemoveAssociationMixinOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -573,7 +573,7 @@ declare module "sequelize" { ( oldAssociateds?: Array, options?: HasManyRemoveAssociationsMixinOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -616,7 +616,7 @@ declare module "sequelize" { ( target: TInstance | TInstancePrimaryKey, options?: HasManyHasAssociationMixinOptions | HasManyGetAssociationsMixinOptions - ): Promise + ): Promise; } /** @@ -659,7 +659,7 @@ declare module "sequelize" { ( targets: Array, options?: HasManyHasAssociationsMixinOptions | HasManyGetAssociationsMixinOptions - ): Promise + ): Promise; } /** @@ -709,7 +709,7 @@ declare module "sequelize" { * Count everything currently associated with this, using an optional where clause. * @param options The options to use when counting the associations. */ - (options?: HasManyCountAssociationsMixinOptions): Promise + (options?: HasManyCountAssociationsMixinOptions): Promise; } /** @@ -759,7 +759,7 @@ declare module "sequelize" { * Get everything currently associated with this, using an optional where clause. * @param options The options to use when getting the associations. */ - (options?: BelongsToManyGetAssociationsMixinOptions): Promise + (options?: BelongsToManyGetAssociationsMixinOptions): Promise; } /** @@ -809,7 +809,7 @@ declare module "sequelize" { ( newAssociations?: Array, options?: BelongsToManySetAssociationsMixinOptions | FindOptions | BulkCreateOptions | InstanceUpdateOptions | InstanceDestroyOptions | TJoinTableAttributes - ): Promise + ): Promise; } /** @@ -858,7 +858,7 @@ declare module "sequelize" { ( newAssociations?: Array, options?: BelongsToManyAddAssociationsMixinOptions | FindOptions | BulkCreateOptions | InstanceUpdateOptions | InstanceDestroyOptions | TJoinTableAttributes - ): Promise + ): Promise; } /** @@ -907,7 +907,7 @@ declare module "sequelize" { ( newAssociation?: TInstance | TInstancePrimaryKey, options?: BelongsToManyAddAssociationMixinOptions | FindOptions | BulkCreateOptions | InstanceUpdateOptions | InstanceDestroyOptions | TJoinTableAttributes - ): Promise + ): Promise; } /** @@ -950,7 +950,7 @@ declare module "sequelize" { ( values?: TAttributes, options?: BelongsToManyCreateAssociationMixinOptions | CreateOptions | TJoinTableAttributes - ): Promise + ): Promise; } /** @@ -993,7 +993,7 @@ declare module "sequelize" { ( oldAssociated?: TInstance | TInstancePrimaryKey, options?: BelongsToManyRemoveAssociationMixinOptions | InstanceDestroyOptions - ): Promise + ): Promise; } /** @@ -1036,7 +1036,7 @@ declare module "sequelize" { ( oldAssociateds?: Array, options?: BelongsToManyRemoveAssociationsMixinOptions | InstanceDestroyOptions - ): Promise + ): Promise; } /** @@ -1079,7 +1079,7 @@ declare module "sequelize" { ( target: TInstance | TInstancePrimaryKey, options?: BelongsToManyHasAssociationMixinOptions | BelongsToManyGetAssociationsMixinOptions - ): Promise + ): Promise; } /** @@ -1122,7 +1122,7 @@ declare module "sequelize" { ( targets: Array, options?: BelongsToManyHasAssociationsMixinOptions | BelongsToManyGetAssociationsMixinOptions - ): Promise + ): Promise; } /** @@ -1172,7 +1172,7 @@ declare module "sequelize" { * Count everything currently associated with this, using an optional where clause. * @param options The options to use when counting the associations. */ - (options?: BelongsToManyCountAssociationsMixinOptions): Promise + (options?: BelongsToManyCountAssociationsMixinOptions): Promise; } /** @@ -1879,9 +1879,9 @@ declare module "sequelize" { ENUM: DataTypeEnum; RANGE: DataTypeRange; REAL: DataTypeReal; - DOUBLE: DataTypeDouble, - 'DOUBLE PRECISION': DataTypeDouble, - GEOMETRY: DataTypeGeometry + DOUBLE: DataTypeDouble; + "DOUBLE PRECISION": DataTypeDouble; + GEOMETRY: DataTypeGeometry; } // @@ -1942,7 +1942,7 @@ declare module "sequelize" { * * @param constraints An array of constraint names. Will defer all constraints by default. */ - ( constraints : Array ) : DeferrableSetDeferred; + ( constraints : string[] ) : DeferrableSetDeferred; } @@ -1954,7 +1954,7 @@ declare module "sequelize" { * * @param constraints An array of constraint names. Will defer all constraints by default. */ - ( constraints : Array ) : DeferrableSetImmediate; + ( constraints : string[] ) : DeferrableSetImmediate; } @@ -2018,18 +2018,18 @@ declare module "sequelize" { * @param message Error message * @param errors Array of ValidationErrorItem objects describing the validation errors */ - new ( message : string, errors? : Array ) : ValidationError; + new ( message : string, errors? : ValidationErrorItem[] ) : ValidationError; /** * Gets all validation error items for the path / field specified. * * @param path The path to be checked for error items */ - get( path : string ) : Array; - + get( path : string ) : ValidationErrorItem[]; + /** Array of ValidationErrorItem objects describing the validation errors */ - errors : Array; - + errors : ValidationErrorItem[]; + } interface ValidationErrorItem extends BaseError { @@ -2044,19 +2044,19 @@ declare module "sequelize" { * @param value The value that generated the error */ new ( message : string, type : string, path : string, value : string ) : ValidationErrorItem; - + /** An error message */ message : string; - + /** The type of the validation error */ type : string; - + /** The field that triggered the validation error */ path : string; - + /** The value that generated the error */ value : string; - + } interface DatabaseError extends BaseError { @@ -2091,7 +2091,7 @@ declare module "sequelize" { /** * Thrown when a foreign key constraint is violated in the database */ - new ( options : { parent? : Error, message? : string, index? : string, fields? : Array, table? : string } ) : ForeignKeyConstraintError; + new ( options : { parent? : Error, message? : string, index? : string, fields? : string[], table? : string } ) : ForeignKeyConstraintError; } @@ -2100,7 +2100,7 @@ declare module "sequelize" { /** * Thrown when an exclusion constraint is violated in the database */ - new ( options : { parent? : Error, message? : string, constraint? : string, fields? : Array, table? : string } ) : ExclusionConstraintError; + new ( options : { parent? : Error, message? : string, constraint? : string, fields? : string[], table? : string } ) : ExclusionConstraintError; } @@ -2217,8 +2217,8 @@ declare module "sequelize" { afterDelete? : ( instance : TInstance, options : Object, fn? : Function ) => any; beforeUpdate? : ( instance : TInstance, options : Object, fn? : Function ) => any; afterUpdate? : ( instance : TInstance, options : Object, fn? : Function ) => any; - beforeBulkCreate? : ( instances : Array, options : Object, fn? : Function ) => any; - afterBulkCreate? : ( instances : Array, options : Object, fn? : Function ) => any; + beforeBulkCreate? : ( instances : TInstance[], options : Object, fn? : Function ) => any; + afterBulkCreate? : ( instances : TInstance[], options : Object, fn? : Function ) => any; beforeBulkDestroy? : ( options : Object, fn? : Function ) => any; beforeBulkDelete? : ( options : Object, fn? : Function ) => any; afterBulkDestroy? : ( options : Object, fn? : Function ) => any; @@ -2228,7 +2228,7 @@ declare module "sequelize" { beforeFind? : ( options : Object, fn? : Function ) => any; beforeFindAfterExpandIncludeAll? : ( options : Object, fn? : Function ) => any; beforeFindAfterOptions? : ( options : Object, fn? : Function ) => any; - afterFind? : ( instancesOrInstance : Array | TInstance, options : Object, + afterFind? : ( instancesOrInstance : TInstance[] | TInstance, options : Object, fn? : Function ) => any; } @@ -2392,8 +2392,8 @@ declare module "sequelize" { * @param fn A callback function that is called with instances, options */ beforeBulkCreate( name : string, - fn : ( instances : Array, options : Object, fn? : Function ) => void ): void; - beforeBulkCreate( fn : ( instances : Array, options : Object, fn? : Function ) => void ): void; + fn : ( instances : TInstance[], options : Object, fn? : Function ) => void ): void; + beforeBulkCreate( fn : ( instances : TInstance[], options : Object, fn? : Function ) => void ): void; /** * A hook that is run after creating instances in bulk @@ -2403,8 +2403,8 @@ declare module "sequelize" { * @name afterBulkCreate */ afterBulkCreate( name : string, - fn : ( instances : Array, options : Object, fn? : Function ) => void ): void; - afterBulkCreate( fn : ( instances : Array, options : Object, fn? : Function ) => void ): void; + fn : ( instances : TInstance[], options : Object, fn? : Function ) => void ): void; + afterBulkCreate( fn : ( instances : TInstance[], options : Object, fn? : Function ) => void ): void; /** * A hook that is run before destroying instances in bulk @@ -2485,9 +2485,9 @@ declare module "sequelize" { * @param fn A callback function that is called with instance(s), options */ afterFind( name : string, - fn : ( instancesOrInstance : Array | TInstance, options : Object, + fn : ( instancesOrInstance : TInstance[] | TInstance, options : Object, fn? : Function ) => void ): void; - afterFind( fn : ( instancesOrInstance : Array | TInstance, options : Object, + afterFind( fn : ( instancesOrInstance : TInstance[] | TInstance, options : Object, fn? : Function ) => void ): void; /** @@ -2641,7 +2641,7 @@ declare module "sequelize" { * An optional array of strings, representing database columns. If fields is provided, only those columns * will be validated and saved. */ - fields? : Array; + fields? : string[]; /** * If true, the updatedAt timestamp will not be updated. @@ -2773,7 +2773,7 @@ declare module "sequelize" { * If changed is called without an argument and no keys have changed, it will return `false`. */ changed( key : string ) : boolean; - changed() : boolean | Array; + changed() : boolean | string[]; /** * Returns the previous value for key from `_previousDataValues`. @@ -2805,7 +2805,7 @@ declare module "sequelize" { * * @param options.skip An array of strings. All properties that are in this array will not be validated */ - validate( options? : { skip?: Array } ) : Promise; + validate( options? : { skip?: string[] } ) : Promise; /** * This is the same as calling `set` and then calling `save`. @@ -2846,7 +2846,7 @@ declare module "sequelize" { * If an array is provided, the same is true for each column. * If and object is provided, each column is incremented by the value given. */ - increment( fields : string | Array | Object, + increment( fields : string | string[] | Object, options? : InstanceIncrementDecrementOptions ) : Promise; /** @@ -2869,7 +2869,7 @@ declare module "sequelize" { * If an array is provided, the same is true for each column. * If and object is provided, each column is decremented by the value given */ - decrement( fields : string | Array | Object, + decrement( fields : string | string[] | Object, options? : InstanceIncrementDecrementOptions ) : Promise; /** @@ -2880,7 +2880,7 @@ declare module "sequelize" { /** * Check if this is eqaul to one of `others` by calling equals */ - equalsOneOf( others : Array> ) : boolean; + equalsOneOf( others : Instance[] ) : boolean; /** * Convert the instance to a JSON representation. Proxies to calling `get` with no keys. This means get all @@ -2922,12 +2922,12 @@ declare module "sequelize" { /** * The character(s) that separates the schema name from the table name */ - schemaDelimeter? : string, + schemaDelimeter? : string; /** * A function that gets executed while running the query to log the sql. */ - logging? : Function | boolean + logging? : Function | boolean; } @@ -2943,7 +2943,7 @@ declare module "sequelize" { * any arguments, or an array, where the first element is the name of the method, and consecutive elements * are arguments to that method. Pass null to remove all scopes, including the default. */ - method : string | Array; + method : string | any[]; } @@ -2968,7 +2968,7 @@ declare module "sequelize" { */ interface WhereGeometryOptions { type: string; - coordinates: Array | number>; + coordinates: Array; } /** @@ -3023,7 +3023,7 @@ declare module "sequelize" { /** * A list of attributes to select from the join model for belongsToMany relations */ - attributes? : Array; + attributes? : string[]; } @@ -3050,7 +3050,7 @@ declare module "sequelize" { * The alias of the relation, in case the model you want to eagerly load is aliassed. For `hasOne` / * `belongsTo`, this should be the singular name, and for `hasMany`, it should be the plural */ - as? : string; + as? : string; /** * The association you want to eagerly load. (This can be used instead of providing a model/as pair) @@ -3066,7 +3066,7 @@ declare module "sequelize" { /** * A list of attributes to select from the child model */ - attributes? : Array; + attributes? : string[]; /** * If true, converts to an inner join, which means that the parent model will only be loaded if it has any @@ -3175,7 +3175,7 @@ declare module "sequelize" { /** * A hash of search attributes. */ - where? : WhereOptions | Array; + where? : WhereOptions | string[]; /** * Include options. See `find` for details @@ -3239,7 +3239,7 @@ declare module "sequelize" { /** * If set, only columns matching those in fields will be saved */ - fields? : Array; + fields? : string[]; /** * On Duplicate @@ -3301,7 +3301,7 @@ declare module "sequelize" { /** * The fields to insert / update. Defaults to all fields */ - fields? : Array; + fields? : string[]; /** * A function that gets executed while running the query to log the sql. @@ -3318,7 +3318,7 @@ declare module "sequelize" { /** * Fields to insert (defaults to all fields) */ - fields? : Array; + fields? : string[]; /** * Should each row be subject to validation before it is inserted. The whole insert will fail if one row @@ -3348,7 +3348,7 @@ declare module "sequelize" { * Fields to update if row key already exists (on duplicate key update)? (only supported by mysql & * mariadb). By default, all fields are updated. */ - updateOnDuplicate? : Array; + updateOnDuplicate? : string[]; /** * Transaction to run query under @@ -3477,7 +3477,7 @@ declare module "sequelize" { /** * Fields to update (defaults to all fields) */ - fields? : Array; + fields? : string[]; /** * Should each row be subject to validation before it is inserted. The whole insert will fail if one row @@ -3564,7 +3564,7 @@ declare module "sequelize" { /** * The Instance class */ - Instance() : Instance; + Instance() : TInstance; /** * Remove attribute from model definition @@ -3656,7 +3656,7 @@ declare module "sequelize" { * @return Model A reference to the model, with the scope(s) applied. Calling scope again on the returned * model will clear the previous scope. */ - scope( options? : string | Array | ScopeOptions | WhereOptions ) : Model; + scope( options? : string | string[] | ScopeOptions | WhereOptions ) : Model; /** * Search for multiple instances. @@ -3720,8 +3720,8 @@ declare module "sequelize" { * * @see {Sequelize#query} */ - findAll( options? : FindOptions ) : Promise>; - all( optionz? : FindOptions ) : Promise>; + findAll( options? : FindOptions ) : Promise; + all( optionz? : FindOptions ) : Promise; /** * Search for a single instance by its primary key. This applies LIMIT 1, so the listener will @@ -3790,8 +3790,8 @@ declare module "sequelize" { * without * profiles will be counted */ - findAndCount( options? : FindOptions ) : Promise<{ rows : Array, count : number }>; - findAndCountAll( options? : FindOptions ) : Promise<{ rows : Array, count : number }>; + findAndCount( options? : FindOptions ) : Promise<{ rows : TInstance[], count : number }>; + findAndCountAll( options? : FindOptions ) : Promise<{ rows : TInstance[], count : number }>; /** * Find the maximum value of field @@ -3816,7 +3816,7 @@ declare module "sequelize" { /** * Undocumented bulkBuild */ - bulkBuild( records : Array, options? : BuildOptions ) : Array; + bulkBuild( records : TAttributes[], options? : BuildOptions ) : TInstance[]; /** * Builds a new model instance and calls save on it. @@ -3876,7 +3876,7 @@ declare module "sequelize" { * * @param records List of objects (key/value pairs) to create instances from */ - bulkCreate( records : Array, options? : BulkCreateOptions ) : Promise>; + bulkCreate( records : TAttributes[], options? : BulkCreateOptions ) : Promise; /** * Truncate all instances of the model. This is a convenient method for Model.destroy({ truncate: true }). @@ -3900,7 +3900,7 @@ declare module "sequelize" { * elements. The first element is always the number of affected rows, while the second element is the actual * affected rows (only supported in postgres with `options.returning` true.) */ - update( values : TAttributes, options : UpdateOptions ) : Promise<[number, Array]>; + update( values : TAttributes, options : UpdateOptions ) : Promise<[number, TInstance[]]>; /** * Run a describe query on the table. The result will be return to the listener as a hash of attributes and @@ -3949,7 +3949,7 @@ declare module "sequelize" { * We don't have a definition for the QueryGenerator, because I doubt it is commonly in use separately. */ QueryGenerator: any; - + /** * Returns the current sequelize instance. */ @@ -4026,7 +4026,7 @@ declare module "sequelize" { /** * Returns all tables */ - showAllTables( options? : QueryOptions ) : Promise>; + showAllTables( options? : QueryOptions ) : Promise; /** * Describe a table @@ -4062,7 +4062,7 @@ declare module "sequelize" { /** * Adds a new index to a table */ - addIndex( tableName : string | Object, attributes : Array, options? : QueryOptions, + addIndex( tableName : string | Object, attributes : string[], options? : QueryOptions, rawTablename? : string ) : Promise; /** @@ -4073,7 +4073,7 @@ declare module "sequelize" { /** * Put a name to an index */ - nameIndexes( indexes : Array, rawTablename : string ) : Promise; + nameIndexes( indexes : string[], rawTablename : string ) : Promise; /** * Returns all foreign key constraints of a table @@ -4083,7 +4083,7 @@ declare module "sequelize" { /** * Removes an index of a table */ - removeIndex( tableName : string, indexNameOrAttributes : Array | string, + removeIndex( tableName : string, indexNameOrAttributes : string[] | string, options? : QueryInterfaceOptions ) : Promise; /** @@ -4101,8 +4101,8 @@ declare module "sequelize" { /** * Inserts multiple records at once */ - bulkInsert( tableName : string, records : Array, options? : QueryOptions, - attributes? : Array | string ) : Promise; + bulkInsert( tableName : string, records : Object[], options? : QueryOptions, + attributes? : string[] | string ) : Promise; /** * Updates a row @@ -4114,7 +4114,7 @@ declare module "sequelize" { * Updates multiple rows at once */ bulkUpdate( tableName : string, values : Object, identifier : Object, options? : QueryOptions, - attributes? : Array | string ) : Promise; + attributes? : string[] | string ) : Promise; /** * Deletes a row @@ -4131,7 +4131,7 @@ declare module "sequelize" { /** * Returns selected rows */ - select( model : Model, tableName : string, options? : QueryOptions ) : Promise>; + select( model : Model, tableName : string, options? : QueryOptions ) : Promise; /** * Increments a row value @@ -4142,15 +4142,15 @@ declare module "sequelize" { /** * Selects raw without parsing the string into an object */ - rawSelect( tableName : string, options : QueryOptions, attributeSelector : string | Array, - model? : Model ) : Promise>; + rawSelect( tableName : string, options : QueryOptions, attributeSelector : string | string[], + model? : Model ) : Promise; /** * Postgres only. Creates a trigger on specified table to call the specified function with supplied * parameters. */ - createTrigger( tableName : string, triggerName : string, timingType : string, fireOnArray : Array, - functionName : string, functionParams : Array, optionsArray : Array, + createTrigger( tableName : string, triggerName : string, timingType : string, fireOnArray : any[], + functionName : string, functionParams : any[], optionsArray : string[], options? : QueryInterfaceOptions ): Promise; /** @@ -4167,19 +4167,19 @@ declare module "sequelize" { /** * Postgres only. Create a function */ - createFunction( functionName : string, params : Array, returnType : string, language : string, + createFunction( functionName : string, params : any[], returnType : string, language : string, body : string, options? : QueryOptions ) : Promise; /** * Postgres only. Drops a function */ - dropFunction( functionName : string, params : Array, + dropFunction( functionName : string, params : any[], options? : QueryInterfaceOptions ) : Promise; /** * Postgres only. Rename a function */ - renameFunction( oldFunctionName : string, params : Array, newFunctionName : string, + renameFunction( oldFunctionName : string, params : any[], newFunctionName : string, options? : QueryInterfaceOptions ) : Promise; /** @@ -4244,19 +4244,19 @@ declare module "sequelize" { // interface QueryTypes { - SELECT: string // 'SELECT' - INSERT: string // 'INSERT' - UPDATE: string // 'UPDATE' - BULKUPDATE: string // 'BULKUPDATE' - BULKDELETE: string // 'BULKDELETE' - DELETE: string // 'DELETE' - UPSERT: string // 'UPSERT' - VERSION: string // 'VERSION' - SHOWTABLES: string // 'SHOWTABLES' - SHOWINDEXES: string // 'SHOWINDEXES' - DESCRIBE: string // 'DESCRIBE' - RAW: string // 'RAW' - FOREIGNKEYS: string // 'FOREIGNKEYS' + SELECT: string; // 'SELECT' + INSERT: string; // 'INSERT' + UPDATE: string; // 'UPDATE' + BULKUPDATE: string; // 'BULKUPDATE' + BULKDELETE: string; // 'BULKDELETE' + DELETE: string; // 'DELETE' + UPSERT: string; // 'UPSERT' + VERSION: string; // 'VERSION' + SHOWTABLES: string; // 'SHOWTABLES' + SHOWINDEXES: string; // 'SHOWINDEXES' + DESCRIBE: string; // 'DESCRIBE' + RAW: string; // 'RAW' + FOREIGNKEYS: string; // 'FOREIGNKEYS' } // @@ -4404,7 +4404,7 @@ declare module "sequelize" { * }) * ``` */ - values? : Array; + values? : string[]; } @@ -4465,7 +4465,7 @@ declare module "sequelize" { * Either an object of named parameter replacements in the format `:param` or an array of unnamed * replacements to replace `?` in your SQL. */ - replacements? : Object | Array; + replacements? : Object | string[]; /** * Force the query to use the write pool, regardless of the query type. @@ -4477,7 +4477,7 @@ declare module "sequelize" { /** * A function that gets executed while running the query to log the sql. */ - logging? : Function + logging? : Function; /** * A sequelize instance used to build the return instance @@ -4608,17 +4608,17 @@ declare module "sequelize" { /** * check the value is not one of these */ - notIn? : Array> | { msg: string, args: Array> }; + notIn? : string[][] | { msg: string, args: string[][] }; /** * check the value is one of these */ - isIn? : Array> | { msg: string, args: Array> }; + isIn? : string[][] | { msg: string, args: string[][] }; /** * don't allow specific substrings */ - notContains? : Array | string | { msg: string, args: Array | string }; + notContains? : string[] | string | { msg: string, args: string[] | string }; /** * only allow values with length between 2 and 10 @@ -4694,32 +4694,32 @@ declare module "sequelize" { /** * The name of the index. Defaults to model name + _ + fields concatenated */ - name? : string, + name? : string; /** * Index type. Only used by mysql. One of `UNIQUE`, `FULLTEXT` and `SPATIAL` */ - index? : string, + index? : string; /** * The method to create the index by (`USING` statement in SQL). BTREE and HASH are supported by mysql and * postgres, and postgres additionally supports GIST and GIN. */ - method? : string, + method? : string; /** * Should the index by unique? Can also be triggered by setting type to `UNIQUE` * * Defaults to false */ - unique? : boolean, + unique? : boolean; /** * PostgreSQL will build the index without taking any write locks. Postgres only * * Defaults to false */ - concurrently? : boolean, + concurrently? : boolean; /** * An array of the fields to index. Each field can either be a string containing the name of the field, @@ -4727,7 +4727,7 @@ declare module "sequelize" { * (field name), `length` (create a prefix index of length chars), `order` (the direction the column * should be sorted in), `collate` (the collation (sort order) for the column) */ - fields? : Array + fields? : Array; } @@ -4741,12 +4741,12 @@ declare module "sequelize" { /** * Singular model name */ - singular? : string, + singular? : string; /** * Plural model name */ - plural? : string, + plural? : string; } @@ -4842,7 +4842,7 @@ declare module "sequelize" { /** * Indexes for the provided database table */ - indexes? : Array; + indexes? : DefineIndexesOptions[]; /** * Override the name of the createdAt column if a string is provided, or disable it if false. Timestamps @@ -5009,20 +5009,20 @@ declare module "sequelize" { interface ReplicationOptions { read?: { - host?: string, - port?: string | number, - username?: string, - password?: string, - database?: string - } + host?: string; + port?: string | number; + username?: string; + password?: string; + database?: string; + }; write?: { - host?: string, - port?: string | number, - username?: string, - password?: string, - database?: string - } + host?: string; + port?: string | number; + username?: string; + password?: string; + database?: string; + }; } @@ -5265,7 +5265,7 @@ declare module "sequelize" { * * @param args Each argument will be joined by OR */ - or( ...args : Array ) : or; + or( ...args : Array ) : or; /** * Creates an object representing nested where conditions for postgres's json data-type. @@ -5462,7 +5462,7 @@ declare module "sequelize" { * * @param path The path to the file that holds the model you want to import. If the part is relative, it * will be resolved relatively to the calling file - * + * * @param defineFunction An optional function that provides model definitions. Useful if you do not * want to use the module root as the define function */ @@ -5490,7 +5490,7 @@ declare module "sequelize" { * @param sql * @param options Query options */ - query( sql : string | { query: string, values: Array }, options? : QueryOptions ) : Promise; + query( sql : string | { query: string, values: any[] }, options? : QueryOptions ) : Promise; /** * Execute a query which would set an environment or user variable. The variables are set per connection, @@ -5671,17 +5671,17 @@ declare module "sequelize" { notEmpty( str : string ) : boolean; len( str : string, min : number, max : number ) : boolean; isUrl( str : string ) : boolean; - isIPv6( str : string ) : boolean - isIPv4( str : string ) : boolean - notIn( str : string, values : Array ) : boolean; + isIPv6( str : string ) : boolean; + isIPv4( str : string ) : boolean; + notIn( str : string, values : string[] ) : boolean; regex( str : string, pattern : string, modifiers : string ) : boolean; notRegex( str : string, pattern : string, modifiers : string ) : boolean; isDecimal( str : string ) : boolean; min( str : string, val : number ) : boolean; max( str : string, val : number ) : boolean; not( str : string, pattern : string, modifiers : string ) : boolean; - contains( str : string, element : Array ) : boolean; - notContains( str : string, element : Array ) : boolean; + contains( str : string, element : string[] ) : boolean; + notContains( str : string, element : string[] ) : boolean; is( str : string, pattern : string, modifiers : string ) : boolean; } @@ -5859,7 +5859,7 @@ declare module "sequelize" { * @param fn The function you want to call * @param args All further arguments will be passed as arguments to the function */ - new ( fn : string, ...args : Array ) : fn; + new ( fn : string, ...args : any[] ) : fn; } interface col { @@ -5906,7 +5906,7 @@ declare module "sequelize" { } interface and { - args: Array; + args: any[]; } interface andStatic { @@ -5919,7 +5919,7 @@ declare module "sequelize" { } interface or { - args: Array; + args: any[]; } interface orStatic { @@ -5929,7 +5929,7 @@ declare module "sequelize" { * * @param args Each argument will be joined by OR */ - new ( ...args : Array ) : or; + new ( ...args : Array ) : or; } interface json { @@ -5991,8 +5991,8 @@ declare module "sequelize" { * * @param arr Array to compact. */ - compactLite( arr : Array ): Array; - matchesDots( dots : string | Array, value : Object ) : ( item : Object ) => boolean; + compactLite( arr : T[] ): T[]; + matchesDots( dots : string | string[], value : Object ) : ( item : Object ) => boolean; } @@ -6009,13 +6009,13 @@ declare module "sequelize" { uppercaseFirst( str : string ): string; spliceStr( str : string, index : number, count : number, add : string ): string; camelize( str : string ): string; - format( arr : Array, dialect? : string ): string; + format( arr : any[], dialect? : string ): string; formatNamedParameters( sql : string, parameters : any, dialect? : string ): string; cloneDeep( obj : T, fn? : ( value : T ) => any ) : T; mapOptionFieldNames( options : T, Model : Model ) : T; - mapValueFieldNames( dataValues : Object, fields : Array, Model : Model ) : Object; - argsArePrimaryKeys( args : Array, primaryKeys : Object ) : boolean; - canTreatArrayAsAnd( arr : Array ) : boolean; + mapValueFieldNames( dataValues : Object, fields : string[], Model : Model ) : Object; + argsArePrimaryKeys( args : any[], primaryKeys : Object ) : boolean; + canTreatArrayAsAnd( arr : any[] ) : boolean; combineTableNames( tableName1 : string, tableName2 : string ): string; singularize( s : string ): string; pluralize( s : string ): string; @@ -6032,7 +6032,7 @@ declare module "sequelize" { removeNullValuesFromHash( hash : Object, omitNull? : boolean, options? : Object ): any; inherit( subClass : Object, superClass : Object ): Object; stack(): string; - sliceArgs( args : Array, begin? : number ) : Array; + sliceArgs( args : any[], begin? : number ) : any[]; now( dialect : string ): Date; tick( f : Function ): void; addTicks( s : string, tickChar? : string ): string; From 22726c075179d7ecaf22960d4c283752b11160e8 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Fri, 15 Jan 2016 16:51:34 +0900 Subject: [PATCH 421/441] change to use `this` type --- sequelize/sequelize-tests.ts | 26 +++++++++--------- sequelize/sequelize.d.ts | 52 ++++++++++++++++++------------------ 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/sequelize/sequelize-tests.ts b/sequelize/sequelize-tests.ts index 74c7e06e80..522f51dab6 100644 --- a/sequelize/sequelize-tests.ts +++ b/sequelize/sequelize-tests.ts @@ -8,7 +8,7 @@ import Sequelize = require("sequelize"); // interface AnyAttributes { }; -interface AnyInstance extends Sequelize.Instance { }; +interface AnyInstance extends Sequelize.Instance { }; var s = new Sequelize( '' ); var sequelize = s; @@ -32,7 +32,7 @@ interface GUserAttributes { username? : string; } -interface GUserInstance extends Sequelize.Instance {} +interface GUserInstance extends Sequelize.Instance {} var GUser = s.define( 'user', { id: Sequelize.INTEGER, username : Sequelize.STRING }); GUser.create({ id : 1, username : 'one' }).then( ( guser ) => guser.save() ); @@ -47,7 +47,7 @@ interface GTaskAttributes { revision? : number; name? : string; } -interface GTaskInstance extends Sequelize.Instance { +interface GTaskInstance extends Sequelize.Instance { upRevision(): void; } var GTask = s.define( 'task', { revision : Sequelize.INTEGER, name : Sequelize.STRING }); @@ -347,7 +347,7 @@ interface ProductAttributes { price?: number; }; -interface ProductInstance extends Sequelize.Instance, ProductAttributes { +interface ProductInstance extends Sequelize.Instance, ProductAttributes { // hasOne association mixins: getBarcode: Sequelize.HasOneGetAssociationMixin; setBarcode: Sequelize.HasOneSetAssociationMixin; @@ -365,7 +365,7 @@ interface BarcodeAttributes { dateIssued?: Date; }; -interface BarcodeInstance extends Sequelize.Instance, BarcodeAttributes { +interface BarcodeInstance extends Sequelize.Instance, BarcodeAttributes { // belongsTo association mixins: getProduct: Sequelize.BelongsToGetAssociationMixin; setProduct: Sequelize.BelongsToSetAssociationMixin; @@ -378,7 +378,7 @@ interface WarehouseAttributes { capacity?: number; }; -interface WarehouseInstance extends Sequelize.Instance, WarehouseAttributes { +interface WarehouseInstance extends Sequelize.Instance, WarehouseAttributes { // hasMany association mixins: getProducts: Sequelize.HasManyGetAssociationsMixin; setProducts: Sequelize.HasManySetAssociationsMixin; @@ -410,7 +410,7 @@ interface BranchAttributes { rank?: number; }; -interface BranchInstance extends Sequelize.Instance, BranchAttributes { +interface BranchInstance extends Sequelize.Instance, BranchAttributes { // belongsToMany association mixins: getWarehouses: Sequelize.BelongsToManyGetAssociationsMixin; setWarehouses: Sequelize.BelongsToManySetAssociationsMixin; @@ -440,7 +440,7 @@ interface WarehouseBranchAttributes { distance?: number; }; -interface WarehouseBranchInstance extends Sequelize.Instance, WarehouseBranchAttributes { }; +interface WarehouseBranchInstance extends Sequelize.Instance, WarehouseBranchAttributes { }; interface CustomerAttributes { id?: number; @@ -448,7 +448,7 @@ interface CustomerAttributes { credit?: number; }; -interface CustomerInstance extends Sequelize.Instance, CustomerAttributes { +interface CustomerInstance extends Sequelize.Instance, CustomerAttributes { // belongsToMany association mixins: getBranches: Sequelize.BelongsToManyGetAssociationsMixin; setBranches: Sequelize.BelongsToManySetAssociationsMixin; @@ -633,11 +633,11 @@ new s.ConnectionTimedOutError( new Error( 'original connection error message' ) // https://github.com/sequelize/sequelize/blob/v3.4.1/test/integration/hooks.test.js // -User.addHook( 'afterCreate', function( instance : Sequelize.Instance, options : Object, next : Function ) { next(); } ); -User.addHook( 'afterCreate', 'myHook', function( instance : Sequelize.Instance, options : Object, next : Function) { next(); } ); +User.addHook( 'afterCreate', function( instance : Sequelize.Instance, options : Object, next : Function ) { next(); } ); +User.addHook( 'afterCreate', 'myHook', function( instance : Sequelize.Instance, options : Object, next : Function) { next(); } ); s.addHook( 'beforeInit', function( config : Object, options : Object ) { } ); -User.hook( 'afterCreate', 'myHook', function( instance : Sequelize.Instance, options : Object, next : Function) { next(); } ); -User.hook( 'afterCreate', 'myHook', function( instance : Sequelize.Instance, options : Object, next : Function ) { next(); } ); +User.hook( 'afterCreate', 'myHook', function( instance : Sequelize.Instance, options : Object, next : Function) { next(); } ); +User.hook( 'afterCreate', 'myHook', function( instance : Sequelize.Instance, options : Object, next : Function ) { next(); } ); User.removeHook( 'afterCreate', 'myHook' ); diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index e33b4b8d72..0dcd61e864 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -2690,7 +2690,7 @@ declare module "sequelize" { * * @see Sequelize.define for more information about getters and setters */ - interface Instance { + interface Instance { /** * Returns true if this instance has not yet been persisted to the database @@ -2702,7 +2702,7 @@ declare module "sequelize" { * * @see Model */ - Model : Model; + Model : Model; /** * A reference to the sequelize instance @@ -2759,10 +2759,10 @@ declare module "sequelize" { * @param options.raw If set to true, field and virtual setters will be ignored * @param options.reset Clear all previously set data values */ - set( key : string, value : any, options? : InstanceSetOptions ) : TInstance; - set( keys : Object, options? : InstanceSetOptions ) : TInstance; - setAttributes( key : string, value : any, options? : InstanceSetOptions ) : TInstance; - setAttributes( keys : Object, options? : InstanceSetOptions ) : TInstance; + set( key : string, value : any, options? : InstanceSetOptions ) : this; + set( keys : Object, options? : InstanceSetOptions ) : this; + setAttributes( key : string, value : any, options? : InstanceSetOptions ) : this; + setAttributes( keys : Object, options? : InstanceSetOptions ) : this; /** * If changed is called with a string it will return a boolean indicating whether the value of that key in @@ -2787,7 +2787,7 @@ declare module "sequelize" { * called with an instance of `Sequelize.ValidationError`. This error will have a property for each of the * fields for which validation failed, with the error message for that field. */ - save( options? : InstanceSaveOptions ) : Promise; + save( options? : InstanceSaveOptions ) : Promise; /** * Refresh the current instance in-place, i.e. update the object with current data from the DB and return @@ -2795,7 +2795,7 @@ declare module "sequelize" { * return a new instance. With this method, all references to the Instance are updated with the new data * and no new objects are created. */ - reload( options? : FindOptions ) : Promise; + reload( options? : FindOptions ) : Promise; /** * Validate the attribute of this instance according to validation rules set in the model definition. @@ -2810,10 +2810,10 @@ declare module "sequelize" { /** * This is the same as calling `set` and then calling `save`. */ - update( key : string, value : any, options? : InstanceUpdateOptions ) : Promise; - update( keys : Object, options? : InstanceUpdateOptions ) : Promise; - updateAttributes( key : string, value : any, options? : InstanceUpdateOptions ) : Promise; - updateAttributes( keys : Object, options? : InstanceUpdateOptions ) : Promise; + update( key : string, value : any, options? : InstanceUpdateOptions ) : Promise; + update( keys : Object, options? : InstanceUpdateOptions ) : Promise; + updateAttributes( key : string, value : any, options? : InstanceUpdateOptions ) : Promise; + updateAttributes( keys : Object, options? : InstanceUpdateOptions ) : Promise; /** * Destroy the row corresponding to this instance. Depending on your setting for paranoid, the row will @@ -2847,7 +2847,7 @@ declare module "sequelize" { * If and object is provided, each column is incremented by the value given. */ increment( fields : string | string[] | Object, - options? : InstanceIncrementDecrementOptions ) : Promise; + options? : InstanceIncrementDecrementOptions ) : Promise; /** * Decrement the value of one or more columns. This is done in the database, which means it does not use @@ -2870,17 +2870,17 @@ declare module "sequelize" { * If and object is provided, each column is decremented by the value given */ decrement( fields : string | string[] | Object, - options? : InstanceIncrementDecrementOptions ) : Promise; + options? : InstanceIncrementDecrementOptions ) : Promise; /** * Check whether all values of this and `other` Instance are the same */ - equals( other : Instance ) : boolean; + equals( other : Instance ) : boolean; /** * Check if this is eqaul to one of `others` by calling equals */ - equalsOneOf( others : Instance[] ) : boolean; + equalsOneOf( others : Instance[] ) : boolean; /** * Convert the instance to a JSON representation. Proxies to calling `get` with no keys. This means get all @@ -3577,7 +3577,7 @@ declare module "sequelize" { * Sync this Model to the DB, that is create the table. Upon success, the callback will be called with the * model instance (this) */ - sync( options? : SyncOptions ) : Promise>; + sync( options? : SyncOptions ) : Promise; /** * Drop the table represented by this Model @@ -3595,7 +3595,7 @@ declare module "sequelize" { * @param schema The name of the schema * @param options */ - schema( schema : string, options? : SchemaOptions ) : Model; + schema( schema : string, options? : SchemaOptions ) : this; /** * Get the tablename of the model, taking schema into account. The method will return The name as a string @@ -3656,7 +3656,7 @@ declare module "sequelize" { * @return Model A reference to the model, with the scope(s) applied. Calling scope again on the returned * model will clear the previous scope. */ - scope( options? : string | string[] | ScopeOptions | WhereOptions ) : Model; + scope( options? : string | string[] | ScopeOptions | WhereOptions ) : this; /** * Search for multiple instances. @@ -3911,7 +3911,7 @@ declare module "sequelize" { /** * Unscope the model */ - unscoped() : Model; + unscoped() : this; } @@ -4089,7 +4089,7 @@ declare module "sequelize" { /** * Inserts a new record */ - insert( instance : Instance, tableName : string, values : Object, + insert( instance : Instance, tableName : string, values : Object, options? : QueryOptions ) : Promise; /** @@ -4107,7 +4107,7 @@ declare module "sequelize" { /** * Updates a row */ - update( instance : Instance, tableName : string, values : Object, identifier : Object, + update( instance : Instance, tableName : string, values : Object, identifier : Object, options? : QueryOptions ) : Promise; /** @@ -4119,7 +4119,7 @@ declare module "sequelize" { /** * Deletes a row */ - "delete"( instance : Instance, tableName : string, identifier : Object, + "delete"( instance : Instance, tableName : string, identifier : Object, options? : QueryOptions ) : Promise; /** @@ -4136,7 +4136,7 @@ declare module "sequelize" { /** * Increments a row value */ - increment( instance : Instance, tableName : string, values : Object, identifier : Object, + increment( instance : Instance, tableName : string, values : Object, identifier : Object, options? : QueryOptions ) : Promise; /** @@ -4482,7 +4482,7 @@ declare module "sequelize" { /** * A sequelize instance used to build the return instance */ - instance? : Instance; + instance? : Instance; /** * A sequelize model used to build the returned model instances (used to be called callee) @@ -5210,7 +5210,7 @@ declare module "sequelize" { /** * A reference to the sequelize instance class. */ - Instance : Instance; + Instance : Instance; /** * Creates a object representing a database function. This can be used in search queries, both in where and From ae84fb741f3ab88ee0ff2781f5d9a17b89369114 Mon Sep 17 00:00:00 2001 From: fverswijver Date: Tue, 19 Jan 2016 14:37:27 +0100 Subject: [PATCH 422/441] Update stacktrace-js.d.ts to include report function Added function to the definition file that was not present. --- stacktrace-js/stacktrace-js.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/stacktrace-js/stacktrace-js.d.ts b/stacktrace-js/stacktrace-js.d.ts index 9f7ce5ea2d..d20645ae98 100644 --- a/stacktrace-js/stacktrace-js.d.ts +++ b/stacktrace-js/stacktrace-js.d.ts @@ -63,4 +63,13 @@ declare module StackTrace { * @param fn {Function} */ export function deinstrument(fn:() => void): void; + + /** + * Given an Array of StackFrames, serialize and POST to given URL. + * + * @param stackframes - Array[StackFrame] + * @param url - URL as String + * @return Promise + */ + export function report(stackframes: StackFrame[], url: string): Promise; } From eb31772a9439e29d9dfb2042ea4b24764e221ab1 Mon Sep 17 00:00:00 2001 From: Richard Natal Date: Tue, 19 Jan 2016 17:24:42 -0200 Subject: [PATCH 423/441] Added oracledb --- oracledb/oracledb-tests.ts | 29 ++++ oracledb/oracledb.d.ts | 308 +++++++++++++++++++++++++++++++++++++ 2 files changed, 337 insertions(+) create mode 100644 oracledb/oracledb-tests.ts create mode 100644 oracledb/oracledb.d.ts diff --git a/oracledb/oracledb-tests.ts b/oracledb/oracledb-tests.ts new file mode 100644 index 0000000000..39b77b5c4a --- /dev/null +++ b/oracledb/oracledb-tests.ts @@ -0,0 +1,29 @@ +/// +/// + +import * as OracleDB from 'oracledb'; + +OracleDB.getConnection( + { + user: "hr", + password: "welcome", + connectString: "localhost/XE" + }, + function(err, connection) { + if (err) { + console.error(err.message); return; + } + connection.execute( + "SELECT department_id, department_name " + + "FROM departments " + + "WHERE manager_id < :id", + [110], // bind value for :id + function(err, result) { + if (err) { + console.error(err.message); return; + } + console.log(result.rows); + } + ); + } +); diff --git a/oracledb/oracledb.d.ts b/oracledb/oracledb.d.ts new file mode 100644 index 0000000000..d990a36f9b --- /dev/null +++ b/oracledb/oracledb.d.ts @@ -0,0 +1,308 @@ +// Type definitions for oracledb v1.5.0 +// Project: https://github.com/oracle/node-oracledb +// Definitions by: Richard Natal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module 'oracledb' { + import * as stream from "stream"; + + export interface ILob { + chunkSize: number; + length: number; + pieceSize: number; + offset?: number; + type: string; + /** + * Release method on ILob class. + * @remarks The cleanup() called by Release() only frees OCI error handle and Lob + * locator. These calls acquire mutex on OCI environment handle very briefly. + */ + release?(): void; + /** + * Read method on ILob class. + * @param {(err : any, chunk: string | Buffer) => void} callback Callback to recive the data from lob. + * @remarks CLobs send strings while BLobs send Buffer object. + */ + read?(callback: (err: any, chunk: string | Buffer) => void): void; + /** + * Read method on ILob class. + * @param {Buffer} data Data write into Lob. + * @param {(err: any) => void} callback Callback executed when writ is finished or when some error occured. + * @remarks CLobs send strings while BLobs send Buffer object. + */ + write?(data: Buffer, callback: (err: any) => void): void; + } + + export interface Lob extends stream.Duplex { + iLob: ILob; + chunkSize: number; + length: number; + pieceSize: number; + type: string; + + /** + * Do not call this... used internally by node-oracledb + */ + constructor(iLob: ILob, opts: stream.DuplexOptions): Lob; + constructor(iLob: ILob): Lob; + + /** + * Closes the current LOB. + * @param {(err: any) => void} callback? When passed, is called after the release. + * @returns void + */ + close(callback: (err: any) => void): void; + close(): void; + } + + export interface IConnectionAttributes { + user?: string; + password?: string; + connectString: string; + stmtCacheSize?: number; + externalAuth?: boolean; + } + + export interface IPoolAttributes extends IConnectionAttributes { + poolMax?: number; + poolMin?: number; + poolIncrement?: number; + poolTimeout?: number; + } + + export interface IExecuteOptions { + /** Maximum number of rows that will be retrieved. Used when resultSet is false. */ + maxRows?: number; + /** Number of rows to be fetched in advance. */ + prefetchRows?: number; + /** Result format - ARRAY o OBJECT */ + outFormat?: number; + /** Should use ResultSet or not. */ + resultSet?: boolean; + /** Transaction should auto commit after each statement? */ + autoCommit?: boolean; + } + + export interface IExecuteReturn { + /** Number o rows affected by the statement (used for inserts / updates)*/ + rowsAffected?: number; + /** When the statement has out parameters, it comes here. */ + outBinds?: Array | Object; + /** Metadata information - just columns names for now. */ + metaData?: Array; + /** When not using ResultSet, query results comes here. */ + rows?: Array> | Array; + /** When using ResultSet, query results comes here. */ + resultSet?: IResultSet; + } + + export interface IMetaData { + /** Column name */ + columnName: string; + } + + export interface IResultSet { + /** Metadata information - just columns names for now. */ + metaData?: Array; + /** + * Closes the ResultSet. + * @param {(err:any)=>void} callback Callback called on finish or when some error occurs + * @returns void + * @remarks After using a resultSet, it must be closed to free the resources used by the driver. + */ + close(callback: (err: any) => void): void; + /** + * Fetch one row from ResultSet. + * @param {(err:any,row:Array|Object)=>void} callback Callback called when the row is available or when some error occurs. + * @returns void + */ + getRow(callback: (err: any, row: Array | Object) => void): void; + /** + * Fetch some rows from ResultSet. + * @param {number} rowCount Number of rows to be fetched. + * @param {(err:any,rows:Array>|Array)=>void} callback Callback called when the rows are available, or when some error occurs. + * @returns void + * @remarks When the number of rows passed to the callback is less than the rowCount, no more rows are available to be fetched. + */ + getRows(rowCount: number, callback: (err: any, rows: Array> | Array) => void): void; + } + + export interface IConnection { + /** Statement cache size in bytes (read-only)*/ + stmtCacheSize: number; + /** Client id (to be sent to database) (write-only)*/ + clientId: string; + /** Module (write-only) */ + module: string; + /** Action */ + action: string; + /** Oracle server version */ + oracleServerVersion: number; + + /** + * Execute method on Connection class. + * @param {string} sql SQL Statement. + * @param {Object|Array} Binds Binds Object/Array + * @param {IExecuteOptions} options Options object + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + binds: Object | Array, + options: IExecuteOptions, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * Execute method on Connection class. + * @param {string} sql SQL Statement. + * @param {Object|Array} Binds Binds Object/Array + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + binds: Object | Array, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * Execute method on Connection class. + * @param {string} sql SQL Statement. + * @param {IExecuteOptions} options Options object + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + options: IExecuteOptions, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * Execute method on Connection class. + * @param {string} sql SQL Statement. + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * Release method on Connection class. + * @param {(err: any) => void} callback Callback function to be called when the connection has been released. + */ + release(callback: (err: any) => void): void; + + /** + * Send a commit requisition to the database. + * @param {(err: any) => void} callback Callback on commit done. + */ + commit(callback: (err: any) => void): void; + + /** + * Send a rollback requisition to database. + * @param {(err: any) => void} callback Callback on rollback done. + */ + rollback(callback: (err: any) => void): void; + + /** + * Send a break to the database. + * @param {(err: any) => void} callback Callback on break done. + */ + break(callback: (err: any) => void): void; + } + + export interface IConnectionPool { + poolMax: number; + poolMin: number; + poolIncrement: number; + poolTimeout: number; + connectionsOpen: number; + connectionsInUse: number; + stmtCacheSize: number; + /** + * Finalizes the connection pool. + * @param {(err:any)=>void} callback Callback called when the pool is terminated or when some error occurs + * @returns void + */ + terminate(callback: (err: any) => void): void; + /** + * Retrieve a connection from the pool. + * @param {(err:any,connection:IConnection)=>void} callback Callback called when the connection is available or when some error occurs. + * @returns void + * @see {@link https://jsao.io/2015/03/making-a-wrapper-module-for-the-node-js-driver-for-oracle-database/} + * @see {@link https://github.com/OraOpenSource/orawrap} + */ + getConnection(callback: (err: any, connection: IConnection) => void): void; + } + + export const DEFAULT: number; + /** Data type */ + export const STRING: number; + /** Data type */ + export const NUMBER: number; + /** Data type */ + export const DATE: number; + /** Data type */ + export const CURSOR: number; + /** Data type */ + export const BUFFER: number; + /** Data type */ + export const CLOB: number; + /** Data type */ + export const BLOB: number; + /** Bind direction */ + export const BIND_IN: number; + /** Bind direction */ + export const BIND_INOUT: number; + /** Bind direction */ + export const BIND_OUT: number; + /** outFormat */ + export const ARRAY: number; + /** outFormat */ + export const OBJECT: number; + + /** + * Do not use this method - used internally by node-oracledb. + */ + export function newLob(iLob: ILob): Lob; + + /** + * Creates a connection with the database. + * @param {IConnectionAttributes} connectionAttributes Parameters to stablish the connection. + * @param {(err:any,connection:IConnection)=>void} callback Callback to run when the connection gets stablished or when some error occurs. + * @returns void + */ + export function getConnection(connectionAttributes: IConnectionAttributes, callback: (err: any, connection: IConnection) => void): void; + + /** + * Creates a database managed connection pool. + * @param {IPoolAttributes} poolAttributes Parameters to stablish the connection pool. + * @param {(err:any,connection:IConnectionPool)=>void} callback Callback to run when the connection pool gets created or when some error occurs. + * @returns void + */ + export function createPool(poolAttributes: IPoolAttributes, callback: (err: any, connection: IConnectionPool) => void): void; + + /** Default maximum connections in created pools */ + export var poolMax: number; + /** Default minimum connections in created pools */ + export var poolMin: number; + /** Default number of connections to increment when available connections reach 0 in created pools. poolMax will be respected.*/ + export var poolIncrement: number; + /** Default timeout for unused connections in pool to be released. poolMin will be respected.*/ + export var poolTimeout: number; + /** Default size of statements cache. Used to speed up creating queries.*/ + export var stmtCacheSize: number; + /** Default number of rows that the driver will fetch in each query.*/ + export var prefetchRows: number; + /** Default transaction behaviour of auto commit for each statement. */ + export var autoCommit: boolean; + /** Default maximum number of rows to be fetched in statements not using ResultSets */ + export var maxRows: number; + /** Default format for returning rows. When ARRAY, it will return Array>. When OBJECT, it will return Array. */ + export var outFormat: number; + /** node-oracledb driver version. */ + export var version: number; + export var connectionClass: string; + /** Default authentication/authorization method. When true, the SO trusted user will be used. */ + export var externalAuth: boolean; + export var fetchAsString: any; + /** Default size in bytes that the driver will fetch from LOBs in advance. */ + export var lobPrefetchSize: number; + /** Version of OCI that is used. */ + export var oracleClientVersion: number; +} From e6231f5948a29d6ffc7bc96e7808dd7a09aa0228 Mon Sep 17 00:00:00 2001 From: Erik O'Leary Date: Tue, 19 Jan 2016 14:37:59 -0600 Subject: [PATCH 424/441] Added missing optional parameter --- chartjs/chart.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chartjs/chart.d.ts b/chartjs/chart.d.ts index 464655f78c..3c7086de5a 100644 --- a/chartjs/chart.d.ts +++ b/chartjs/chart.d.ts @@ -107,7 +107,7 @@ interface LinearInstance extends ChartInstance { getPointsAtEvent: (event: Event) => PointsAtEvent[]; update: () => void; addData: (valuesArray: number[], label: string) => void; - removeData: () => void; + removeData: (index?: number) => void; } interface CircularInstance extends ChartInstance { From a984b54b41dd3af424879e40cfacdc8f26f8bf0a Mon Sep 17 00:00:00 2001 From: Jean-Philipe Pellerin Date: Tue, 19 Jan 2016 15:51:21 -0500 Subject: [PATCH 425/441] Definition files for hapi/confidence --- confidence/confidence-tests.ts | 79 ++++++++++++++++++++++++++++++++++ confidence/confidence.d.ts | 48 +++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 confidence/confidence-tests.ts create mode 100644 confidence/confidence.d.ts diff --git a/confidence/confidence-tests.ts b/confidence/confidence-tests.ts new file mode 100644 index 0000000000..60825e0127 --- /dev/null +++ b/confidence/confidence-tests.ts @@ -0,0 +1,79 @@ +/// + +import Confidence = require('confidence'); + +let criteria = { + "env": "production", + "platform": "ios", + "xfactor": "yes", + "random": { + "a": 15 + } +}; + +/** +* The configurations in Confidence style +*/ +let config = { + "key1": "abc", + "key2": { + "$filter": "env", + "production": { + "deeper": { + "$value": "value" + } + }, + "$default": { + "$filter": "platform", + "android": 0, + "ios": 1, + "$default": 2 + } + }, + "key3": { + "sub1": 123, + "sub2": { + "$filter": "xfactor", + "yes": 6 + } + }, + "ab": { + "$filter": "random.a", + "$range": [ + { "limit": 10, "value": 4 }, + { "limit": 20, "value": 5 } + ], + "$default": 6 + }, + "$meta": { + "description": "example file" + } +}; + + +/** +* Creates an empty configuration storage container +*/ +let store = new Confidence.Store(config); + + +/** +* Validates the provided configuration, clears any existing configuration, then loads the configuration +*/ +store.load(config); + + +/** +* Retrieves a value from the configuration document after applying the provided criteria +*/ +store.get('/key1'); +//criteria - optional object +store.get('/key2', criteria); + + +/** +* Retrieves the metadata (if any) from the configuration document after applying the provided criteria +*/ +store.meta('/key1'); +//criteria - optional object +store.meta('/key2', criteria); diff --git a/confidence/confidence.d.ts b/confidence/confidence.d.ts new file mode 100644 index 0000000000..4c30b44074 --- /dev/null +++ b/confidence/confidence.d.ts @@ -0,0 +1,48 @@ +// Type definitions for Confidence v1.4.2 +// Project: https://github.com/hapijs/confidence.git +// Definitions by: Jean-Philippe Pellerin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** +* Confidence is a configuration document format, an API, and a foundation for A/B testing. +* The configuration format is designed to work with any existing JSON-based configuration, +* serving values based on object path ('/a/b/c' translates to a.b.c). In addition, +* confidence defines special $-prefixed keys used to filter values for a given criteria. +*/ +declare module 'confidence' { + + export class Store { + + /** + * @constructor + * @param {any} document - the configuration document for this document store + */ + constructor(document?: any); + + /** + * Validates the provided configuration, clears any existing configuration, then loads the configuration where: + * @param {any} document - an object containing a confidence configuration object generated from a parsed JSON document. If the document is invlaid, will throw an error. + */ + load(document: any): void; + + + /** + * Retrieves a value from the configuration document after applying the provided criteria where: + * @param {string} key - the requested key path. All keys must begin with '/'. '/' returns the the entire document. + * @param {any} criteria - optional object used as criteria for applying filters in the configuration document. Defaults to {}. + * + * @return {any} Returns the value found after applying the criteria. If the key is invalid or not found, returns undefined. + */ + get(key: string, criteria?: any): any; + + + /** + * Retrieves the metadata (if any) from the configuration document after applying the provided criteria where: + * @param {string} key - the requested key path. All keys must begin with '/'. '/' returns the the entire document. + * @param {any} criteria - optional object used as criteria for applying filters in the configuration document. Defaults to {}. + * + * @return {any} Returns the metadata found after applying the criteria. If the key is invalid or not found, or if no metadata is available, returns undefined. + */ + meta(key: string, criteria?: any): any; + } +} From 67315b6fb078b8b27c89339c09094a303548d19f Mon Sep 17 00:00:00 2001 From: Oleksandr Podoprygora Date: Tue, 19 Jan 2016 21:31:21 +0200 Subject: [PATCH 426/441] exporting module to be able to declare variable of Umzug type like Umzug.Umzug --- umzug/umzug-tests.ts | 7 +- umzug/umzug.d.ts | 181 ++++++++++++++++++++++--------------------- 2 files changed, 95 insertions(+), 93 deletions(-) diff --git a/umzug/umzug-tests.ts b/umzug/umzug-tests.ts index 95d7521fd3..fc3f5aea3e 100644 --- a/umzug/umzug-tests.ts +++ b/umzug/umzug-tests.ts @@ -2,11 +2,12 @@ /// /// -import Umzug = require("umzug"); -import Sequelize = require("sequelize"); - +import * as Umzug from "umzug"; +import * as Sequelize from "sequelize"; +var someVar:Umzug.Umzug; var umzug = new Umzug({}); +someVar = umzug; umzug.up().then(function (result) { // do something with the result diff --git a/umzug/umzug.d.ts b/umzug/umzug.d.ts index 2e2b20a7c1..82b66c6be9 100644 --- a/umzug/umzug.d.ts +++ b/umzug/umzug.d.ts @@ -7,10 +7,11 @@ /// declare module "umzug" { + import Sequelize = require("sequelize"); - import Sequelize = require("sequelize"); + module umzug { - interface MigrationOptions { + interface MigrationOptions { /* * The params that gets passed to the migrations. @@ -30,9 +31,9 @@ declare module "umzug" { */ wrap?: ( fn : T ) => T; - } + } - interface JSONStorageOptions { + interface JSONStorageOptions { /** * The path to the json storage. @@ -40,55 +41,55 @@ declare module "umzug" { */ path?: string; - } + } - interface SequelizeStorageOptions { + interface SequelizeStorageOptions { - /** - * The configured instance of Sequelize. - * Optional if `model` is passed. - */ - sequelize?: Sequelize.Sequelize; + /** + * The configured instance of Sequelize. + * Optional if `model` is passed. + */ + sequelize?: Sequelize.Sequelize; - /** - * The to be used Sequelize model. - * Must have column name matching `columnName` option - * Optional of `sequelize` is passed. - */ - model?: Sequelize.Model; + /** + * The to be used Sequelize model. + * Must have column name matching `columnName` option + * Optional of `sequelize` is passed. + */ + model?: Sequelize.Model; - /** - * The name of the to be used model. - * Defaults to 'SequelizeMeta' - */ - modelName?: string; + /** + * The name of the to be used model. + * Defaults to 'SequelizeMeta' + */ + modelName?: string; - /** - * The name of table to create if `model` option is not supplied - * Defaults to `modelName` - */ - tableName?: string; + /** + * The name of table to create if `model` option is not supplied + * Defaults to `modelName` + */ + tableName?: string; - /** - * The name of table column holding migration name. - * Defaults to 'name'. - */ - columnName: string; + /** + * The name of table column holding migration name. + * Defaults to 'name'. + */ + columnName: string; - /** - * The type of the column holding migration name. - * Defaults to `Sequelize.STRING` - */ - columnType: Sequelize.DataTypeAbstract; + /** + * The type of the column holding migration name. + * Defaults to `Sequelize.STRING` + */ + columnType: Sequelize.DataTypeAbstract; - } + } - interface ExecuteOptions { + interface ExecuteOptions { migrations?: Array; method?: string; - } + } - interface UmzugOptions { + interface UmzugOptions { /** * The storage. @@ -122,67 +123,67 @@ declare module "umzug" { */ migrations? : MigrationOptions; - } + } - interface UpDownToOptions { + interface UpDownToOptions { - /** - * It is also possible to pass the name of a migration in order to - * just run the migrations from the current state to the passed - * migration name. - */ - to: string; + /** + * It is also possible to pass the name of a migration in order to + * just run the migrations from the current state to the passed + * migration name. + */ + to: string; - } + } - interface UpDownMigrationsOptions { + interface UpDownMigrationsOptions { - /** - * Running specific migrations while ignoring the right order, can be - * done like this: - */ - migrations: Array; + /** + * Running specific migrations while ignoring the right order, can be + * done like this: + */ + migrations: Array; - } + } - class Umzug { + interface Umzug { + /** + * The execute method is a general purpose function that runs for + * every specified migrations the respective function. + */ + execute(options? : ExecuteOptions) : Promise>; - constructor(options?: UmzugOptions); + /** + * You can get a list of pending/not yet executed migrations like this: + */ + pending() : Promise>; - /** - * The execute method is a general purpose function that runs for - * every specified migrations the respective function. - */ - execute(options? : ExecuteOptions) : Promise>; + /** + * You can get a list of already executed migrations like this: + */ + executed() : Promise>; - /** - * You can get a list of pending/not yet executed migrations like this: - */ - pending() : Promise>; + /** + * The up method can be used to execute all pending migrations. + */ + up(migration?: string) : Promise; + up(migrations?: Array) : Promise>; + up(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; - /** - * You can get a list of already executed migrations like this: - */ - executed() : Promise>; + /** + * The down method can be used to revert the last executed migration. + */ + down(migration?: string) : Promise; + down(migrations?: Array) : Promise>; + down(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; - /** - * The up method can be used to execute all pending migrations. - */ - up(migration?: string) : Promise; - up(migrations?: Array) : Promise>; - up(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; + } - /** - * The down method can be used to revert the last executed migration. - */ - down(migration?: string) : Promise; - down(migrations?: Array) : Promise>; - down(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; - - } - - var umzug : typeof Umzug; - - export = umzug; + interface UmzugStatic { + new (options?: UmzugOptions) : Umzug; + } + } + var umzug : umzug.UmzugStatic; + export = umzug; } From f20ff280475b6a12d4d279860074de925ab4a738 Mon Sep 17 00:00:00 2001 From: Azhaguthasan Date: Tue, 19 Jan 2016 17:17:59 -0800 Subject: [PATCH 427/441] Included NgProgressFactory Definition --- ngprogress/ngprogress.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ngprogress/ngprogress.d.ts b/ngprogress/ngprogress.d.ts index fdcdd28cb5..20b06d9d61 100644 --- a/ngprogress/ngprogress.d.ts +++ b/ngprogress/ngprogress.d.ts @@ -15,6 +15,10 @@ declare module NgProgress { reset(): void; complete(): void; } + + export interface INgProgressFactory { + createInstance(): INgProgress; + } } From 5bf306a3f23cc4c74e5178ad7a085fb447afd4b3 Mon Sep 17 00:00:00 2001 From: DavidCai <376462191@qq.com> Date: Wed, 20 Jan 2016 12:45:33 +0800 Subject: [PATCH 428/441] fix 'can not find name' issue --- koa/koa.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/koa/koa.d.ts b/koa/koa.d.ts index 0433e2b09b..4501342781 100644 --- a/koa/koa.d.ts +++ b/koa/koa.d.ts @@ -130,6 +130,7 @@ declare module "koa" { onerror(err: any): void; } - let K: typeof Koa; - export = K + namespace Koa {} + + export = Koa; } From 9d3c0e31928a196677b1371a350a363cf1357317 Mon Sep 17 00:00:00 2001 From: Andrey Kurosh Date: Wed, 20 Jan 2016 10:54:00 +0300 Subject: [PATCH 429/441] Renamed to match npm module's name. --- clipboard.js/clipboard.js-tests.ts | 22 ------------------- clipboard/clipboard-tests.ts | 22 +++++++++++++++++++ .../clipboard.d.ts | 6 ++--- 3 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 clipboard.js/clipboard.js-tests.ts create mode 100644 clipboard/clipboard-tests.ts rename clipboard.js/clipboard.js.d.ts => clipboard/clipboard.d.ts (94%) diff --git a/clipboard.js/clipboard.js-tests.ts b/clipboard.js/clipboard.js-tests.ts deleted file mode 100644 index 962bf34e05..0000000000 --- a/clipboard.js/clipboard.js-tests.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -var cb1 = new clipboardjs.Clipboard('.btn'); -var cb2 = new clipboardjs.Clipboard('.btn', { - action: elem => 'copy' -}); -var cb3 = new clipboardjs.Clipboard('.btn', { - text: elem => null -}); -var cb4 = new clipboardjs.Clipboard('.btn', { - target: elem => null -}); -var cb5 = new clipboardjs.Clipboard('.btn', { - action: elem => 'copy', - target: elem => null -}); - -cb1.destroy(); - -cb2.on('success', function(e) { }); -cb2.on('error', function(e) { }); - diff --git a/clipboard/clipboard-tests.ts b/clipboard/clipboard-tests.ts new file mode 100644 index 0000000000..de6e9fc1ac --- /dev/null +++ b/clipboard/clipboard-tests.ts @@ -0,0 +1,22 @@ +/// + +var cb1 = new clipboard.Clipboard('.btn'); +var cb2 = new clipboard.Clipboard('.btn', { + action: elem => 'copy' +}); +var cb3 = new clipboard.Clipboard('.btn', { + text: elem => null +}); +var cb4 = new clipboard.Clipboard('.btn', { + target: elem => null +}); +var cb5 = new clipboard.Clipboard('.btn', { + action: elem => 'copy', + target: elem => null +}); + +cb1.destroy(); + +cb2.on('success', function(e) { }); +cb2.on('error', function(e) { }); + diff --git a/clipboard.js/clipboard.js.d.ts b/clipboard/clipboard.d.ts similarity index 94% rename from clipboard.js/clipboard.js.d.ts rename to clipboard/clipboard.d.ts index 6a8af8519a..ddba32b064 100644 --- a/clipboard.js/clipboard.js.d.ts +++ b/clipboard/clipboard.d.ts @@ -3,7 +3,7 @@ // Definitions by: Andrei Kurosh // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module clipboardjs { +declare module clipboard { export class Clipboard { constructor(selector: string, options?: IOptions); @@ -47,6 +47,6 @@ declare module clipboardjs { } } -declare module 'clipboardjs' { - export = clipboardjs; +declare module 'clipboard' { + export = clipboard; } \ No newline at end of file From fc78e5691045ff3cb9eed72e32bb86719f5ac61b Mon Sep 17 00:00:00 2001 From: "Rosiek.Slawomir YSI" Date: Wed, 20 Jan 2016 15:21:43 +0100 Subject: [PATCH 430/441] Initial version of oidc-token-manager definition --- .../oidc-token-manager-tests.ts | 47 ++++++++ oidc-token-manager/oidc-token-manager.d.ts | 107 ++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 oidc-token-manager/oidc-token-manager-tests.ts create mode 100644 oidc-token-manager/oidc-token-manager.d.ts diff --git a/oidc-token-manager/oidc-token-manager-tests.ts b/oidc-token-manager/oidc-token-manager-tests.ts new file mode 100644 index 0000000000..71261cce1a --- /dev/null +++ b/oidc-token-manager/oidc-token-manager-tests.ts @@ -0,0 +1,47 @@ +/// + +var config = { + client_id: "implicitclient", + redirect_uri: window.location.protocol + "//" + window.location.host + "/callback.html", + post_logout_redirect_uri: window.location.protocol + "//" + window.location.host + "/index.html", + response_type: "id_token token", + scope: "openid profile email read write", + authority: "https://localhost:44333/core", + silent_redirect_uri: window.location.protocol + "//" + window.location.host + "/frame.html", + popup_redirect_uri: window.location.protocol + "//" + window.location.host + "/popup.html", + silent_renew: true +}; +var mgr = new OidcTokenManager(config); +if (!mgr.expired) { + console.log("Token loaded, expires in: ", mgr.expires_in); + console.log("profile", mgr.profile); + console.log("access_token", !!mgr.access_token); +} +else { + console.log("No token loaded"); +} +mgr.addOnTokenObtained(function () { + console.log("token obtained, scopes: ", mgr.scopes); +}); +mgr.addOnTokenRemoved(function () { + console.log("token removed"); +}); +mgr.addOnTokenExpiring(function () { + console.log("token is about to expire"); + //mgr.renewTokenSilent(); +}); +mgr.addOnTokenExpired(function () { + console.log("token expired"); +}); + mgr.redirectForToken(); + mgr.openPopupForTokenAsync().then(function () { + console.log('popup success'); + }, function (err) { + console.log('popup error: ', err); + }); + mgr.removeToken(); + mgr.redirectForLogout(); +function toggleForget() { +} +mgr.addOnTokenObtained(toggleForget); +mgr.addOnTokenRemoved(toggleForget); \ No newline at end of file diff --git a/oidc-token-manager/oidc-token-manager.d.ts b/oidc-token-manager/oidc-token-manager.d.ts new file mode 100644 index 0000000000..ce01f457b6 --- /dev/null +++ b/oidc-token-manager/oidc-token-manager.d.ts @@ -0,0 +1,107 @@ +// Type definitions for oidc-token-manager +// Project: https://github.com/IdentityModel/oidc-token-manager +// Definitions by: Sławomir Rosiek +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module Oidc { + class DefaultHttpRequest { + getJSON(url, config); + } + + class DefaultPromise { + constructor(promise); + then(successCallback, errorCallback): DefaultPromise; + catch(errorCallback): DefaultPromise; + } + + class DefaultPromiseFactory { + resolve(value): DefaultPromise; + reject(reason): DefaultPromise; + create(callback): DefaultPromise; + } + + interface OidcClientSettings { + request_state_key?: string; + request_state_store?; + load_user_profile?: boolean; + filter_protocol_claims?: boolean; + authority?: string; + response_type?: string; + } + + interface OidcClient_Static { + new (settings: OidcClientSettings): OidcTokenManager; + } + + interface OidcClient { + isOidc: boolean; + isOAuth: boolean; + + loadMetadataAsync(): DefaultPromise; + loadX509SigningKeyAsync(): DefaultPromise; + loadUserProfile(access_token: string); + loadAuthorizationEndpoint(): void; + createTokenRequestAsync(): DefaultPromise; + createLogoutRequestAsync(id_token_hint: string): DefaultPromise; + validateIdTokenAsync(id_token: string, nonce: string, access_token: string): DefaultPromise; + validateAccessTokenAsync(id_token_contents: string, access_token: string): DefaultPromise; + validateIdTokenAndAccessTokenAsync(id_token: string, nonce: string, access_token: string): DefaultPromise; + processResponseAsync(queryString: string): DefaultPromise; + } + + interface OidcTokenManagerSettings { + persist?: boolean; + store?; + persistKey?: string; + client_id?: string; + redirect_uri?: string; + post_logout_redirect_uri?: string; + response_type?: string; + scope?: string; + authority?: string; + popup_redirect_uri?: string; + silent_redirect_uri?: string; + silent_renew?: boolean; + } + + interface PopupSettings { + features?: string; + target?: string; + } + + interface OidcTokenManager_Static { + new (settings?: OidcTokenManagerSettings): OidcTokenManager; + setPromiseFactory(promiseFactory: DefaultPromiseFactory): void; + setHttpRequest(httpRequest): void; + } + + interface OidcTokenManager { + profile; + id_token: string; + access_token: string; + expired: boolean; + expires_in: number; + expires_at: number; + scope; + scopes: any[]; + session_state; + + saveToken(token): void; + addOnTokenRemoved(cb: () => void): void; + addOnTokenObtained(cb: () => void): void; + addOnTokenExpiring(cb: () => void): void; + addOnTokenExpired(cb: () => void): void; + addOnSilentTokenRenewFailed(cb: () => void): void; + removeToken(): void; + redirectForToken(): void; + redirectForLogout(): void; + processTokenCallbackAsync(queryString?: string): DefaultPromise; + renewTokenSilentAsync(): DefaultPromise; + processTokenCallbackSilent(hash?: string): void; + openPopupForTokenAsync(popupSettings?: PopupSettings): DefaultPromise; + processTokenPopup(hash?: string): void; + } +} + +declare var OidcTokenManager: Oidc.OidcTokenManager_Static; +declare var OidcClient: Oidc.OidcClient_Static; \ No newline at end of file From 5fc15065bd14b0d2d2d600c1821c2691c155be87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20Szczepa=C5=84czyk?= Date: Wed, 20 Jan 2016 15:33:44 +0100 Subject: [PATCH 431/441] Add weeks(), asWeeks() methods to Duration interface --- moment/moment-node.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index a11fad1dc6..16b167d8ac 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -99,6 +99,9 @@ declare module moment { days(): number; asDays(): number; + weeks(): number; + asWeeks(): number; + months(): number; asMonths(): number; From fbe0e1e9b1e09e82c575fd2e4f9f61d223e3b70e Mon Sep 17 00:00:00 2001 From: "Rosiek.Slawomir YSI" Date: Wed, 20 Jan 2016 15:41:34 +0100 Subject: [PATCH 432/441] Fixed issues with travis build --- oidc-token-manager/oidc-token-manager.d.ts | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/oidc-token-manager/oidc-token-manager.d.ts b/oidc-token-manager/oidc-token-manager.d.ts index ce01f457b6..b1e3f2ceac 100644 --- a/oidc-token-manager/oidc-token-manager.d.ts +++ b/oidc-token-manager/oidc-token-manager.d.ts @@ -5,24 +5,24 @@ declare module Oidc { class DefaultHttpRequest { - getJSON(url, config); + getJSON(url: string, config: any): DefaultPromise; } class DefaultPromise { constructor(promise); - then(successCallback, errorCallback): DefaultPromise; - catch(errorCallback): DefaultPromise; + then(successCallback: () => void, errorCallback: () => void): DefaultPromise; + catch(errorCallback: () => void): DefaultPromise; } class DefaultPromiseFactory { - resolve(value): DefaultPromise; - reject(reason): DefaultPromise; - create(callback): DefaultPromise; + resolve(value: any): DefaultPromise; + reject(reason: any): DefaultPromise; + create(callback: any): DefaultPromise; } interface OidcClientSettings { request_state_key?: string; - request_state_store?; + request_state_store?: any; load_user_profile?: boolean; filter_protocol_claims?: boolean; authority?: string; @@ -51,7 +51,7 @@ declare module Oidc { interface OidcTokenManagerSettings { persist?: boolean; - store?; + store?: any; persistKey?: string; client_id?: string; redirect_uri?: string; @@ -72,19 +72,19 @@ declare module Oidc { interface OidcTokenManager_Static { new (settings?: OidcTokenManagerSettings): OidcTokenManager; setPromiseFactory(promiseFactory: DefaultPromiseFactory): void; - setHttpRequest(httpRequest): void; + setHttpRequest(httpRequest: DefaultHttpRequest): void; } interface OidcTokenManager { - profile; + profile: any; id_token: string; access_token: string; expired: boolean; expires_in: number; expires_at: number; - scope; + scope: any; scopes: any[]; - session_state; + session_state: any; saveToken(token): void; addOnTokenRemoved(cb: () => void): void; From 84a5a8bb62b78a7269a7bad1032868249caa9ce7 Mon Sep 17 00:00:00 2001 From: "Rosiek.Slawomir YSI" Date: Wed, 20 Jan 2016 15:56:02 +0100 Subject: [PATCH 433/441] Another set of fixes for definition --- oidc-token-manager/oidc-token-manager.d.ts | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/oidc-token-manager/oidc-token-manager.d.ts b/oidc-token-manager/oidc-token-manager.d.ts index b1e3f2ceac..b744f78854 100644 --- a/oidc-token-manager/oidc-token-manager.d.ts +++ b/oidc-token-manager/oidc-token-manager.d.ts @@ -9,8 +9,8 @@ declare module Oidc { } class DefaultPromise { - constructor(promise); - then(successCallback: () => void, errorCallback: () => void): DefaultPromise; + constructor(promise: any); + then(successCallback: (value?: any) => void, errorCallback: (reason?) => void): DefaultPromise; catch(errorCallback: () => void): DefaultPromise; } @@ -39,7 +39,7 @@ declare module Oidc { loadMetadataAsync(): DefaultPromise; loadX509SigningKeyAsync(): DefaultPromise; - loadUserProfile(access_token: string); + loadUserProfile(access_token: string): DefaultPromise; loadAuthorizationEndpoint(): void; createTokenRequestAsync(): DefaultPromise; createLogoutRequestAsync(id_token_hint: string): DefaultPromise; @@ -74,6 +74,19 @@ declare module Oidc { setPromiseFactory(promiseFactory: DefaultPromiseFactory): void; setHttpRequest(httpRequest: DefaultHttpRequest): void; } + + interface OidcToken { + profile: string; + id_token: string; + access_token: string; + expires_at: number; + scope: string; + scopes: string[]; + session_state: any; + expired: boolean; + expires_in: number; + toJSON(): string; + } interface OidcTokenManager { profile: any; @@ -82,11 +95,11 @@ declare module Oidc { expired: boolean; expires_in: number; expires_at: number; - scope: any; - scopes: any[]; + scope: string; + scopes: string[]; session_state: any; - saveToken(token): void; + saveToken(token: OidcToken): void; addOnTokenRemoved(cb: () => void): void; addOnTokenObtained(cb: () => void): void; addOnTokenExpiring(cb: () => void): void; From 888fd83599a9668d79e32cf484f1a9847ebde7fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Rosiek?= Date: Wed, 20 Jan 2016 17:31:56 +0100 Subject: [PATCH 434/441] Another set of fixes for definition --- oidc-token-manager/oidc-token-manager.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oidc-token-manager/oidc-token-manager.d.ts b/oidc-token-manager/oidc-token-manager.d.ts index b744f78854..f8309686b2 100644 --- a/oidc-token-manager/oidc-token-manager.d.ts +++ b/oidc-token-manager/oidc-token-manager.d.ts @@ -10,7 +10,7 @@ declare module Oidc { class DefaultPromise { constructor(promise: any); - then(successCallback: (value?: any) => void, errorCallback: (reason?) => void): DefaultPromise; + then(successCallback: (value?: any) => void, errorCallback: (reason?: any) => void): DefaultPromise; catch(errorCallback: () => void): DefaultPromise; } From 5d51369b02b48a87e5195af1a2a1dcce356fcb3a Mon Sep 17 00:00:00 2001 From: theodorz Date: Wed, 20 Jan 2016 17:37:04 +0100 Subject: [PATCH 435/441] Update to fix S3 with latest AWS SDK I removed the nested S3 Client interface, because it doesn't seem to be present in the latest AWS JS SDK (2.2.31). --- aws-sdk/aws-sdk.d.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts index f890594635..3fef2702e3 100644 --- a/aws-sdk/aws-sdk.d.ts +++ b/aws-sdk/aws-sdk.d.ts @@ -147,7 +147,8 @@ declare module "aws-sdk" { export class S3 { constructor(options?: any); - public client: s3.Client; + putObject(params: s3.PutObjectRequest, callback: (err: any, data: any) => void): void; + getObject(params: s3.GetObjectRequest, callback: (err: any, data: any) => void): void; } export class DynamoDB { @@ -1042,14 +1043,7 @@ declare module "aws-sdk" { } export module s3 { - - export interface Client { - config: ClientConfig; - - putObject(params: PutObjectRequest, callback: (err: any, data: any) => void): void; - getObject(params: GetObjectRequest, callback: (err: any, data: any) => void): void; - } - + export interface PutObjectRequest { ACL?: string; Body?: any; From ec7740ba881b4f09781809c26766d4ffbaa520a4 Mon Sep 17 00:00:00 2001 From: marcelbuesing Date: Wed, 20 Jan 2016 20:26:39 +0100 Subject: [PATCH 436/441] Update axios definitions to v0.8.1 --- axios/axios-tests.ts | 49 +++++++++++++++- axios/axios.d.ts | 134 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 165 insertions(+), 18 deletions(-) diff --git a/axios/axios-tests.ts b/axios/axios-tests.ts index 3f692307a4..184292c92e 100644 --- a/axios/axios-tests.ts +++ b/axios/axios-tests.ts @@ -8,21 +8,64 @@ interface Repository { name: string; } +interface Issue { + id: number; + title: string; +} + +axios.interceptors.request.use(config => { + console.log("Method:" + config.method + " Url:" +config.url); + return config; +}); + +axios.interceptors.response.use(config => { + console.log("Status:" + config.status); + return config; +}); + axios.get("https://api.github.com/repos/mzabriskie/axios") .then(r => console.log(r.config.method)); -axios({ +var getRepoDetails = axios({ url: "https://api.github.com/repos/mzabriskie/axios", method: HttpMethod[HttpMethod.GET], headers: {}, -}).then(r => console.log("ID:" + r.data.id + " Name: " + r.data.name)); +}).then(r => { + console.log("ID:" + r.data.id + " Name: " + r.data.name); + return r; +}); axios.post("http://example.com/", {}, { transformRequest: (data: any) => data }); -axios.post("http://example.com/", {}, { +axios.post("http://example.com/", { + headers: {'X-Custom-Header': 'foobar'} +}, { transformRequest: [ (data: any) => data ] }); + +var getRepoIssue = axios.get("https://api.github.com/repos/mzabriskie/axios/issues/1"); + +var axiosInstance = axios.create({ + baseURL: "https://api.github.com/repos/mzabriskie/axios/", + timeout: 1000 +}); + +axiosInstance.request({url: "issues/1"}); + +axios.all([getRepoDetails, getRepoDetails]).then(([repo1, repo2]) => { + var sumIds = repo1.data.id + repo2.data.id; + console.log("Sum ID:" + sumIds); + return sumIds; +}); + +var repoSum = (repo1: Axios.AxiosXHR, repo2: Axios.AxiosXHR) => { + var sumIds = repo1.data.id + repo2.data.id; + console.log("Sum ID:" + sumIds); + return sumIds; +}; + +axios.all([getRepoDetails, getRepoDetails]).then(axios.spread(repoSum)); diff --git a/axios/axios.d.ts b/axios/axios.d.ts index fd19caf94b..7348ec651b 100644 --- a/axios/axios.d.ts +++ b/axios/axios.d.ts @@ -1,9 +1,8 @@ -// Type definitions for axios 0.5.2 +// Type definitions for axios 0.8.1 // Project: https://github.com/mzabriskie/axios // Definitions by: Marcel Buesing // Definitions: https://github.com/borisyankov/DefinitelyTyped - declare module Axios { interface IThenable { @@ -18,21 +17,24 @@ declare module Axios { } /** + * HTTP Basic auth details + */ + interface AxiosHttpBasicAuth { + username: string; + password: string; + } + + /** + * Common axios XHR config interface * - request body data type */ interface AxiosXHRConfigBase { - /** - * Change the request data before it is sent to the server. - * This is only applicable for request methods 'PUT', 'POST', and 'PATCH' - * The last function in the array must return a string or an ArrayBuffer + * will be prepended to `url` unless `url` is absolute. + * It can be convenient to set `baseURL` for an instance + * of axios to pass relative URLs to methods of that instance. */ - transformRequest?: ((data: T) => U) | [(data: T) => U]; - - /** - * change the response data to be made before it is passed to then/catch - */ - transformResponse?: (data: T) => U; + baseURL?: string; /** * custom headers to be sent @@ -44,12 +46,32 @@ declare module Axios { */ params?: Object; + /** + * optional function in charge of serializing `params` + * (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/) + */ + paramsSerializer?: (params: Object) => string; + + /** + * specifies the number of milliseconds before the request times out. + * If the request takes longer than `timeout`, the request will be aborted. + */ + timeout?: number; + /** * indicates whether or not cross-site Access-Control requests * should be made using credentials */ withCredentials?: boolean; + /** + * indicates that HTTP Basic auth should be used, and supplies + * credentials. This will set an `Authorization` header, + * overwriting any existing `Authorization` custom headers you have + * set using `headers`. + */ + auth?: AxiosHttpBasicAuth; + /** * indicates the type of data that the server will respond with * options are 'arraybuffer', 'blob', 'document', 'json', 'text' @@ -66,6 +88,17 @@ declare module Axios { */ xsrfHeaderName?: string; + /** + * Change the request data before it is sent to the server. + * This is only applicable for request methods 'PUT', 'POST', and 'PATCH' + * The last function in the array must return a string or an ArrayBuffer + */ + transformRequest?: ((data: T) => U) | [(data: T) => U]; + + /** + * change the response data to be made before it is passed to then/catch + */ + transformResponse?: (data: T) => U; } /** @@ -92,7 +125,7 @@ declare module Axios { } /** - * - expected response type, + * - expected response type, * - request body data type */ interface AxiosXHR { @@ -122,16 +155,77 @@ declare module Axios { config: AxiosXHRConfig; } + interface Interceptor { + /** + * intercept request before it is sent + */ + request: RequestInterceptor; + + /** + * intercept response of request when it is received. + */ + response: ResponseInterceptor + } + + interface RequestInterceptor { + /** + * - request body data type + */ + use(fn: (config: AxiosXHRConfig) => AxiosXHRConfig): void; + } + + interface ResponseInterceptor { + /** + * - expected response type + */ + use(fn: (config: AxiosXHR) => AxiosXHR): void; + } + /** - * - expected response type, + * - expected response type, * - request body data type */ - interface AxiosStatic { + interface AxiosInstance { + /** + * Send request as configured + */ (config: AxiosXHRConfig): IPromise>; + /** + * Send request as configured + */ new (config: AxiosXHRConfig): IPromise>; + /** + * Send request as configured + */ + request(config: AxiosXHRConfig): IPromise>; + + /** + * intercept requests or responses before they are handled by then or catch + */ + interceptors: Interceptor; + + /** + * equivalent to `Promise.all` + */ + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>, T9 | IPromise>, T10 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>, T9 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR]>; + + /** + * spread array parameter to `fn`. + * note: alternative to `spread`, destructuring assignment. + */ + spread(fn: (t1: T1, t2: T2) => U): (arr: ([T1, T2])) => U; + /** * convenience alias, method = GET */ @@ -163,6 +257,16 @@ declare module Axios { */ patch(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; } + + /** + * - expected response type, + */ + interface AxiosStatic extends AxiosInstance { + /** + * create a new instance of axios with a custom config + */ + create(config: AxiosXHRConfigBase): AxiosInstance; + } } declare var axios: Axios.AxiosStatic; From a4c90beffc567638eb87752c376c25ab2152e653 Mon Sep 17 00:00:00 2001 From: Oleksandr Podoprygora Date: Wed, 20 Jan 2016 22:54:21 +0200 Subject: [PATCH 437/441] methods of Umzug class return Promise instead of Promise or Promise at least for Umzug 1.8.0 --- umzug/umzug.d.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/umzug/umzug.d.ts b/umzug/umzug.d.ts index 82b66c6be9..47cfe595f4 100644 --- a/umzug/umzug.d.ts +++ b/umzug/umzug.d.ts @@ -146,36 +146,41 @@ declare module "umzug" { } + interface Migration { + path: string; + file: string; + } + interface Umzug { /** * The execute method is a general purpose function that runs for * every specified migrations the respective function. */ - execute(options? : ExecuteOptions) : Promise>; + execute(options? : ExecuteOptions) : Promise; /** * You can get a list of pending/not yet executed migrations like this: */ - pending() : Promise>; + pending() : Promise; /** * You can get a list of already executed migrations like this: */ - executed() : Promise>; + executed() : Promise; /** * The up method can be used to execute all pending migrations. */ - up(migration?: string) : Promise; - up(migrations?: Array) : Promise>; - up(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; + up(migration?: string) : Promise; + up(migrations?: string[]) : Promise; + up(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise; /** * The down method can be used to revert the last executed migration. */ - down(migration?: string) : Promise; - down(migrations?: Array) : Promise>; - down(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; + down(migration?: string) : Promise; + down(migrations?: string[]) : Promise; + down(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise; } From 5fe89fb639d8d7f772aaac09882b7c1269fe3820 Mon Sep 17 00:00:00 2001 From: Oleksandr Podoprygora Date: Thu, 21 Jan 2016 04:45:02 +0200 Subject: [PATCH 438/441] updating version: Umzug v1.8.0 --- umzug/umzug.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umzug/umzug.d.ts b/umzug/umzug.d.ts index 47cfe595f4..b09aae88c0 100644 --- a/umzug/umzug.d.ts +++ b/umzug/umzug.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Umzug v1.7.0 +// Type definitions for Umzug v1.8.0 // Project: https://github.com/sequelize/umzug // Definitions by: Ivan Drinchev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 010286e12798f2a32a1071611bb2c4a1c2e4f9a6 Mon Sep 17 00:00:00 2001 From: achiever-ph Date: Thu, 21 Jan 2016 12:34:07 +0000 Subject: [PATCH 439/441] Added AMD Module for well-known name "amplify" --- amplifyjs/amplifyjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amplifyjs/amplifyjs.d.ts b/amplifyjs/amplifyjs.d.ts index 961d815c60..3eb8829e4a 100644 --- a/amplifyjs/amplifyjs.d.ts +++ b/amplifyjs/amplifyjs.d.ts @@ -179,4 +179,4 @@ interface amplifyStatic { } declare var amplify: amplifyStatic; - +declare module "amplify" { export =amplify; } From 2cad4a3cff770c37b40496188c246b1a60e87e2d Mon Sep 17 00:00:00 2001 From: Jason Jarrett Date: Thu, 21 Jan 2016 09:27:28 -0800 Subject: [PATCH 440/441] small change to force an update (testing NugetAutomation) --- react/react.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/react/react.d.ts b/react/react.d.ts index 15146eb9b5..8b4f32587c 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped declare namespace __React { + // // React Elements // ---------------------------------------------------------------------- From 3be6ea80f1d7880dbeabe5ae1cfb7b22fa22839c Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Fri, 22 Jan 2016 16:36:54 +0900 Subject: [PATCH 441/441] add `bson` definition files --- bson/bson-tests.ts | 23 ++++++++ bson/bson.d.ts | 133 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 bson/bson-tests.ts create mode 100644 bson/bson.d.ts diff --git a/bson/bson-tests.ts b/bson/bson-tests.ts new file mode 100644 index 0000000000..a454ed2366 --- /dev/null +++ b/bson/bson-tests.ts @@ -0,0 +1,23 @@ +/// + +import * as bson from 'bson'; + +let BSON = new bson.BSONPure.BSON(); +let Long = bson.BSONPure.Long; + +let doc = {long: Long.fromNumber(100)} + +// Serialize a document +let data = BSON.serialize(doc, false, true, false); +console.log("data:", data); + +// Deserialize the resulting Buffer +let doc_2 = BSON.deserialize(data); +console.log("doc_2:", doc_2); + + +BSON = new bson.BSONNative.BSON(); +data = BSON.serialize(doc); +doc_2 = BSON.deserialize(data); + + diff --git a/bson/bson.d.ts b/bson/bson.d.ts new file mode 100644 index 0000000000..e92801835f --- /dev/null +++ b/bson/bson.d.ts @@ -0,0 +1,133 @@ +// Type definitions for bson 0.4.21 +// Project: https://github.com/mongodb/js-bson +// Definitions by: Hiroki Horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + + +declare module 'bson' { + + module bson { + + export module BSONPure { + + export interface DeserializeOptions { + /** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. */ + evalFunctions?: boolean; + /** {Boolean, default:false}, cache evaluated functions for reuse. */ + cacheFunctions?: boolean; + /** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. */ + cacheFunctionsCrc32?: boolean; + /** {Boolean, default:false}, deserialize Binary data directly into node.js Buffer object. */ + promoteBuffers?: boolean; + } + export class BSON { + /** + * @param {Object} object the Javascript object to serialize. + * @param {Boolean} checkKeys the serializer will check if keys are valid. + * @param {Boolean} asBuffer return the serialized object as a Buffer object (ignore). + * @param {Boolean} serializeFunctions serialize the javascript functions (default:false) + * @return {Buffer} returns a TypedArray or Array depending on what your browser supports + */ + serialize(object: any, checkKeys?: boolean, asBuffer?: boolean, serializeFunctions?: boolean): Buffer; + deserialize(buffer: Buffer, options?: DeserializeOptions, isArray?: boolean): any; + } + + + export interface Binary {} + export interface BinaryStatic { + SUBTYPE_DEFAULT: number; + SUBTYPE_FUNCTION: number; + SUBTYPE_BYTE_ARRAY: number; + SUBTYPE_UUID_OLD: number; + SUBTYPE_UUID: number; + SUBTYPE_MD5: number; + SUBTYPE_USER_DEFINED: number; + + new (buffer: Buffer, subType?: number): Binary; + } + export let Binary: BinaryStatic; + + export interface Code {} + export interface CodeStatic { + new (code: string | Function, scope?: any): Code; + } + export let Code: CodeStatic; + + export interface DBRef {} + export interface DBRefStatic { + new (namespace: string, oid: ObjectID, db?: string): DBRef; + } + export let DBRef: DBRefStatic; + + export interface Double {} + export interface DoubleStatic { + new (value: number): Double; + } + export let Double: DoubleStatic; + + export interface Long {} + export interface LongStatic { + new (low: number, high: number): Long; + fromInt(i: number): Long; + fromNumber(n: number): Long; + fromBits(lowBits: number, highBits: number): Long; + fromString(s: string, opt_radix?: number): Long; + } + export let Long: LongStatic; + + export interface MaxKey {} + export interface MaxKeyStatic { + new (): MaxKey; + } + export let MaxKey: MaxKeyStatic; + + export interface MinKey {} + export interface MinKeyStatic { + new (): MinKey; + } + export let MinKey: MinKeyStatic; + + export interface ObjectID {} + export interface ObjectIDStatic { + new (id?: number | string | ObjectID): ObjectID; + createPk(): ObjectID; + createFromTime(time: number): ObjectID; + createFromHexString(hexString: string): ObjectID; + isValid(id: number | string | ObjectID): boolean; + } + export let ObjectID: ObjectIDStatic; + export let ObjectId: ObjectIDStatic; + + export interface BSONRegExp {} + export interface BSONRegExpStatic { + new (pattern: string, options: string): BSONRegExp; + } + export let BSONRegExp: BSONRegExpStatic; + + export interface Symbol {} + export interface SymbolStatic { + new (value: string): Symbol; + } + export let Symbol: SymbolStatic; + + export interface Timestamp {} + export interface TimestampStatic { + new (low: number, high: number): Timestamp; + fromInt(i: number): Timestamp; + fromNumber(n: number): Timestamp; + fromBits(lowBits: number, highBits: number): Timestamp; + fromString(s: string, opt_radix?: number): Timestamp; + } + export let Timestamp: TimestampStatic; + + } + + export let BSONNative: typeof BSONPure; + + } + + export = bson; +} +