+
+ This is red.
+
+
+ This turns red on hover.
+
+
+ This turns red when the browser is less than 600px width.
+
+
+ This is blue.
+
+
+ This is blue and turns red when the browser is less than
+ 600px width.
+
+
+ With font
+
+
;
+ }
+}
+
+const output = StyleSheetServer.renderStatic(() => {
+ return "test";
+});
+
+output.css.content;
+output.css.renderedClassNames;
+output.html;
+
+StyleSheet.rehydrate(output.css.renderedClassNames);
+
+StyleSheetTestUtils.suppressStyleInjection();
+StyleSheetTestUtils.clearBufferAndResumeStyleInjection();
diff --git a/aphrodite/aphrodite.d.ts b/aphrodite/aphrodite.d.ts
new file mode 100644
index 0000000000..89d8646e54
--- /dev/null
+++ b/aphrodite/aphrodite.d.ts
@@ -0,0 +1,76 @@
+// Type definitions for Aphrodite 0.5.0
+// Project: https://github.com/Khan/aphrodite
+// Definitions by: Alexey Svetliakov
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare module "aphrodite" {
+ import * as React from "react";
+
+ /**
+ * Aphrodite style declaration
+ */
+ export interface StyleDeclaration {
+ [key: string]: React.CSSProperties;
+ }
+
+ interface StyleSheetStatic {
+ /**
+ * Create style sheet
+ */
+ create(styles: T): T;
+ /**
+ * Rehydrate class names from server renderer
+ */
+ rehydrate(renderedClassNames: string[]): void;
+ }
+
+ export var StyleSheet: StyleSheetStatic;
+ /**
+ * Get class names from passed styles
+ */
+ export function css(...styles: any[]): string;
+
+ interface StaticRendererResult {
+ html: string;
+ css: {
+ content: string;
+ renderedClassNames: string[];
+ }
+ }
+
+ /**
+ * Utilities for using Aphrodite server-side.
+ */
+ interface StyleSheetServerStatic {
+ renderStatic(renderFunc: () => string): StaticRendererResult;
+ }
+
+ export var StyleSheetServer: StyleSheetServerStatic;
+
+ interface StyleSheetTestUtilsStatic {
+ /**
+ * Prevent styles from being injected into the DOM.
+ *
+ * This is useful in situations where you'd like to test rendering UI
+ * components which use Aphrodite without any of the side-effects of
+ * Aphrodite happening. Particularly useful for testing the output of
+ * components when you have no DOM, e.g. testing in Node without a fake DOM.
+ *
+ * Should be paired with a subsequent call to
+ * clearBufferAndResumeStyleInjection.
+ */
+ suppressStyleInjection(): void;
+ /**
+ * Opposite method of preventStyleInject.
+ */
+ clearBufferAndResumeStyleInjection(): void;
+ }
+
+ export var StyleSheetTestUtils: StyleSheetTestUtilsStatic;
+}
+
+declare module "aphrodite/no-important" {
+ export * from "aphrodite";
+}
diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts
index 270f06d36a..a5341fcb45 100644
--- a/aws-sdk/aws-sdk.d.ts
+++ b/aws-sdk/aws-sdk.d.ts
@@ -397,7 +397,7 @@ declare module "aws-sdk" {
}
export interface SendMessageParams {
- QueueUrl: string;
+ QueueUrl?: string;
MessageBody: string;
DelaySeconds?: number;
MessageAttributes?: { [name:string]: MessageAttribute; }
diff --git a/bazinga-translator/bazinga-translator-tests.ts b/bazinga-translator/bazinga-translator-tests.ts
new file mode 100644
index 0000000000..2401641815
--- /dev/null
+++ b/bazinga-translator/bazinga-translator-tests.ts
@@ -0,0 +1,12 @@
+///
+
+Translator.fallback = 'en';
+Translator.defaultDomain = 'messages';
+
+Translator.add("test", "it work", "frontend", "en");
+
+Translator.trans('key', {}, 'frontend');
+Translator.trans('key', {"foo": "bar"}, 'DOMAIN_NAME');
+
+Translator.transChoice('key', 1, {}, 'frontend');
+Translator.transChoice('key', 123, {"foo": "bar"}, 'DOMAIN_NAME');
\ No newline at end of file
diff --git a/bazinga-translator/bazinga-translator.d.ts b/bazinga-translator/bazinga-translator.d.ts
new file mode 100644
index 0000000000..5467fbfd85
--- /dev/null
+++ b/bazinga-translator/bazinga-translator.d.ts
@@ -0,0 +1,99 @@
+// Type definitions for Translator
+// Project: https://github.com/willdurand/BazingaJsTranslationBundle
+// Definitions by: Alex
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+interface BazingaTranslator {
+ /**
+ * The current locale.
+ *
+ * @type {String}
+ */
+ locale: string;
+
+ /**
+ * Fallback locale.
+ *
+ * @type {String}
+ */
+ fallback: string;
+
+ /**
+ * Placeholder prefix.
+ *
+ * @type {String}
+ */
+ placeHolderPrefix: string;
+
+ /**
+ * Placeholder suffix.
+ *
+ * @type {String}
+ */
+ placeHolderSuffix: string;
+
+ /**
+ * Default domain.
+ *
+ * @type {String}
+ */
+ defaultDomain: string;
+
+ /**
+ * Plural separator.
+ *
+ * @type {String}
+ */
+ pluralSeparator: string;
+
+ /**
+ * Adds a translation entry.
+ *
+ * @param {String} id The message id
+ * @param {String} message The message to register for the given id
+ * @param {String} [domain] The domain for the message or null to use the default
+ * @param {String} [locale] The locale or null to use the default
+ *
+ * @return {Object} Translator
+ */
+ add(id: string, message: string, domain: string, locale: string): BazingaTranslator;
+
+
+ /**
+ * Translates the given message.
+ *
+ * @param {String} id The message id
+ * @param {Object} [parameters] An array of parameters for the message
+ * @param {String} [domain] The domain for the message or null to guess it
+ * @param {String} [locale] The locale or null to use the default
+ *
+ * @return {String} The translated string
+ */
+ trans(id: string, parameters: any, domain: string, locale?: string): string;
+
+ /**
+ * Translates the given choice message by choosing a translation according to a number.
+ *
+ * @param {String} id The message id
+ * @param {Number} number The number to use to find the indice of the message
+ * @param {Object} [parameters] An array of parameters for the message
+ * @param {String} [domain] The domain for the message or null to guess it
+ * @param {String} [locale] The locale or null to use the default
+ *
+ * @return {String} The translated string
+ */
+ transChoice(id: string, number: number, parameters: any, domain: string, locale?: string): string,
+
+ /**
+ * Loads translations from JSON.
+ *
+ * @param {String} data A JSON string or object literal
+ *
+ * @return {Object} Translator
+ */
+ fromJSON(data: string): BazingaTranslator;
+
+ reset(): void;
+}
+
+declare var Translator: BazingaTranslator;
\ No newline at end of file
diff --git a/boom/boom.d.ts b/boom/boom.d.ts
index 85c2e22b35..7495e3ae68 100644
--- a/boom/boom.d.ts
+++ b/boom/boom.d.ts
@@ -44,14 +44,17 @@ declare namespace Boom {
export function rangeNotSatisfiable(message?: string, data?: any): BoomError;
export function expectationFailed(message?: string, data?: any): BoomError;
export function badData(message?: string, data?: any): BoomError;
+ export function locked(message?: string, data?: any): BoomError;
+ export function preconditionRequired(message?: string, data?: any): BoomError;
export function tooManyRequests(message?: string, data?: any): BoomError;
+ export function illegal(message?: string, data?: any): BoomError;
// 5xx
+ export function badImplementation(message?: string, data?: any): BoomError;
export function notImplemented(message?: string, data?: any): BoomError;
export function badGateway(message?: string, data?: any): BoomError;
- export function serverTimeout(message?: string, data?: any): BoomError;
+ export function serverUnavailable(message?: string, data?: any): BoomError;
export function gatewayTimeout(message?: string, data?: any): BoomError;
- export function badImplementation(message?: string, data?: any): BoomError;
}
declare module "boom" {
diff --git a/bootstrap-slider/bootstrap-slider.d.ts b/bootstrap-slider/bootstrap-slider.d.ts
index 77a5177fa0..d830e3c45a 100644
--- a/bootstrap-slider/bootstrap-slider.d.ts
+++ b/bootstrap-slider/bootstrap-slider.d.ts
@@ -35,7 +35,7 @@ interface SliderOptions {
* Default: 'horizontal'
* set the orientation. Accepts 'vertical' or 'horizontal'
*/
- orientation?: number;
+ orientation?: string;
/**
* Default: 5
* initial value. Use array to have a range slider.
diff --git a/chai-jquery/chai-jquery.d.ts b/chai-jquery/chai-jquery.d.ts
index 3d287f30fc..e7256bb7ab 100644
--- a/chai-jquery/chai-jquery.d.ts
+++ b/chai-jquery/chai-jquery.d.ts
@@ -17,7 +17,7 @@ declare namespace Chai {
html(html: string): Assertion;
text(text: string): Assertion;
value(text: string): Assertion;
- (selector: string): Assertion;
+ descendants(selector: string): Assertion;
visible: Assertion;
hidden: Assertion;
selected: Assertion;
diff --git a/chroma-js/chroma-js-0.5.6-tests.ts b/chroma-js/chroma-js-0.5.6-tests.ts
new file mode 100644
index 0000000000..cb8b593d26
--- /dev/null
+++ b/chroma-js/chroma-js-0.5.6-tests.ts
@@ -0,0 +1,120 @@
+///
+
+function test_chroma() {
+ chroma("red");
+ chroma("#ff0000");
+ chroma("#f00");
+ chroma("FF0000");
+ chroma(255, 0, 0);
+ chroma([255, 0, 0]);
+ chroma(0, 1, 0.5, 'hsl');
+ chroma([0, 1, 0.5], 'hsl');
+ chroma(0, 1, 1, 'hsv');
+ chroma("rgb(255,0,0)");
+ chroma("rgb(100%,0%,0%)");
+ chroma("hsl(0,100%,50%)");
+ chroma(53.24, 80.09, 67.20, 'lab');
+ chroma(53.24, 104.55, 40, 'lch');
+ chroma(1, 0, 0, 'gl');
+
+ chroma.hex("#ff0000");
+ chroma.hex("red");
+ chroma.hex("rgb(255, 0, 0)");
+
+ chroma.rgb(255, 0, 0);
+ chroma.hsl(0, 1, 0.5);
+ chroma.hsv(120, 0.5, 0.5);
+ chroma.lab(53.24, 80.09, 67.20);
+ chroma.lch(53.24, 104.55, 40);
+ chroma.gl(1, 0, 0);
+
+ chroma.interpolate('white', 'black', 0) // #ffffff
+ chroma.interpolate('white', 'black', 1) // #000000
+ chroma.interpolate('white', 'black', 0.5) // #7f7f7f
+ chroma.interpolate('white', 'black', 0.5, 'hsv') // #808080
+ chroma.interpolate('white', 'black', 0.5, 'lab') // #777777
+
+ chroma.interpolate('rgba(0,0,0,0)', 'rgba(255,0,0,1)', 0.5).css() //"rgba(127.5,0,0,0.5)"
+
+ var bezInterpolator = chroma.interpolate.bezier(['white', 'yellow', 'red', 'black']);
+ bezInterpolator(0).hex() // #ffffff
+ bezInterpolator(0.33).hex() // #ffcc67
+ bezInterpolator(0.66).hex() // #b65f1a
+ bezInterpolator(1).hex() // #000000
+
+ chroma.luminance('black') // 0
+ chroma.luminance('white') // 1
+ chroma.luminance('#ff0000') // 0.2126
+
+ chroma.contrast('white', 'navy') // 16.00 – ok
+ chroma.contrast('white', 'yellow') // 1.07 – not ok!
+}
+
+function test_color() {
+ chroma('red').hex() // "#FF0000""
+ chroma('red').rgb() // [255, 0, 0]
+ chroma('red').hsv() // [0, 1, 1]
+ chroma('red').hsl() // [0, 1, 0.5]
+ chroma('red').lab() // [53.2407, 80.0924, 67.2031]
+ chroma('red').lch() // [53.2407, 104.5517, 39.9990]
+ chroma('red').rgba() // [255, 0, 0, 1]
+ chroma('red').css() // "rgb(255,0,0)"
+ chroma('red').alpha(0.7).css() // "rgba(255,0,0,0.7)"
+ chroma('red').css('hsl') // "hsl(0,100%,50%)"
+ chroma('red').alpha(0.7).css('hsl') // "hsla(0,100%,50%,0.7)"
+ chroma('blue').css('hsla') // "hsla(240,100%,50%,1)"
+
+ var red = chroma('red');
+ red.alpha(0.5);
+ red.css(); // rgba(255,0,0,0.5);
+
+ chroma('red').darken().hex() // #BC0000
+ chroma('red').brighten().hex() // #FF603B
+ chroma('#eecc99').saturate().hex() // #fcc973
+ chroma('red').desaturate().hex() // #ec3d23
+
+ chroma('black').luminance() // 0
+ chroma('white').luminance() // 1
+ chroma('red').luminance() // 0.2126
+}
+
+function test_scale() {
+ var scale = chroma.scale(['lightyellow', 'navy']);
+ scale(0.5); // #7F7FB0
+
+ chroma.scale('RdYlBu');
+
+ var col = scale(0.5);
+ col.hex(); // #7F7FB0
+ col.rgb(); // [127.5, 127.5, 176]
+
+ scale = chroma.scale(['lightyellow', 'navy']).out('hex');
+ scale(0.5); // "#7F7FB0"
+
+ var scale = chroma.scale(['lightyellow', 'navy']);
+ scale.mode('hsv')(0.5); // #54C08A
+ scale.mode('hsl')(0.5); // #31FF98
+ scale.mode('lab')(0.5); // #967CB2
+ scale.mode('lch')(0.5); // #D26662
+
+ var scale = chroma.scale(['lightyellow', 'navy']).domain([0, 400]);
+ scale(200); // #7F7FB0
+
+ var scale = chroma.scale(['lightyellow', 'navy']).domain([0, 100, 200, 300, 400]);
+ scale(98); // #7F7FB0
+ scale(99); // #7F7FB0
+ scale(100); // #AAAAC0
+ scale(101); // #AAAAC0
+
+ chroma.scale(['#eee', '#900']).domain([0, 400], 7);
+ chroma.scale(['#eee', '#900']).domain([1, 1000000], 7, 'log');
+ chroma.scale(['#eee', '#900']).domain([1, 1000000], 5, 'quantiles');
+ chroma.scale(['#eee', '#900']).domain([1, 1000000], 5, 'k-means');
+ chroma.scale(['white', 'red']).domain([0, 100], 4).domain() // [0, 25, 50, 75, 100]
+
+ chroma.scale().range(['lightyellow', 'navy']);
+
+ chroma.scale(['lightyellow', 'navy']).correctLightness(true);
+
+ chroma.scale('RdYlGn').domain([0,1], 5).colors()
+}
diff --git a/chroma-js/chroma-js-0.5.6.d.ts b/chroma-js/chroma-js-0.5.6.d.ts
new file mode 100644
index 0000000000..5d785eda27
--- /dev/null
+++ b/chroma-js/chroma-js-0.5.6.d.ts
@@ -0,0 +1,317 @@
+// Type definitions for Chroma.js v0.5.6
+// Project: https://github.com/gka/chroma.js
+// Definitions by: Sebastian Brückner
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+/**
+ * Chroma.js is a tiny library for all kinds of color conversions and color scales.
+ */
+declare namespace Chroma {
+
+ export interface ChromaStatic {
+ /**
+ * Creates a color from a string representation (as supported in CSS).
+ *
+ * @param color The string to convert to a color.
+ * @return the color object.
+ */
+ (color: string): Color;
+
+ /**
+ * Create a color in the specified color space using a, b and c as values.
+ *
+ * @param a
+ * @param b
+ * @param c
+ * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
+ * @return the color object.
+ */
+ (a: number, b: number, c: number, colorSpace?: string): Color;
+
+ /**
+ * Create a color in the specified color space using values.
+ *
+ * @param values An array of values (e.g. [r, g, b, a?]).
+ * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
+ * @return the color object.
+ */
+ (values: number[], colorSpace?: string): Color;
+
+ /**
+ * Create a color in the specified color space using a, b and c as values.
+ *
+ * @param a
+ * @param b
+ * @param c
+ * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
+ * @return the color object.
+ */
+ color(a: number, b: number, c: number, colorSpace?: string): Color;
+
+ /**
+ * Calculate the contrast ratio of two colors.
+ *
+ * @param color1 The first color.
+ * @param color2 The second color.
+ * @return the contrast ratio.
+ */
+ contrast(color1: Color, color2: Color): number;
+ /**
+ * Calculate the contrast ratio of two colors.
+ *
+ * @param color1 The first color.
+ * @param color2 The second color.
+ * @return the contrast ratio.
+ */
+ contrast(color1: Color, color2: string): number;
+ /**
+ * Calculate the contrast ratio of two colors.
+ *
+ * @param color1 The first color.
+ * @param color2 The second color.
+ * @return the contrast ratio.
+ */
+ contrast(color1: string, color2: Color): number;
+ /**
+ * Calculate the contrast ratio of two colors.
+ *
+ * @param color1 The first color.
+ * @param color2 The second color.
+ * @return the contrast ratio.
+ */
+ contrast(color1: string, color2: string): number;
+
+ /**
+ * Create a color from a hex or string representation (as supported in CSS).
+ *
+ * This is an alias of chroma.hex().
+ *
+ * @param color The string to convert to a color.
+ * @return the color object.
+ */
+ css(color: string): Color;
+
+ /**
+ * Create a color from a hex or string representation (as supported in CSS).
+ *
+ * This is an alias of chroma.css().
+ *
+ * @param color The string to convert to a color.
+ * @return the color object.
+ */
+ hex(color: string): Color;
+
+ rgb(red: number, green: number, blue: number, alpha?: number): Color;
+ hsl(hue: number, saturation: number, lightness: number, alpha?: number): Color;
+ hsv(hue: number, saturation: number, value: number, alpha?: number): Color;
+ lab(lightness: number, a: number, b: number, alpha?: number): Color;
+ lch(lightness: number, chroma: number, hue: number, alpha?: number): Color;
+ gl(red: number, green: number, blue: number, alpha?: number): Color;
+
+ interpolate: InterpolateFunction;
+ mix: InterpolateFunction;
+
+ luminance(color: Color): number;
+ luminance(color: string): number;
+
+ /**
+ * Creates a color scale using a pre-defined color scale.
+ *
+ * @param name The name of the color scale.
+ * @return the resulting color scale.
+ */
+ scale(name: string): Scale;
+
+ /**
+ * Creates a color scale function from the given set of colors.
+ *
+ * @param colors An Array of at least two color names or hex values.
+ * @return the resulting color scale.
+ */
+ scale(colors?: string[]): Scale;
+
+ scales: PredefinedScales;
+ }
+
+ interface InterpolateFunction {
+ (color1: Color, color2: Color, f: number, mode?: string): Color;
+ (color1: Color, color2: string, f: number, mode?: string): Color;
+ (color1: string, color2: Color, f: number, mode?: string): Color;
+ (color1: string, color2: string, f: number, mode?: string): Color;
+
+ bezier(colors: any[]): (t: number) => Color;
+ }
+
+ interface PredefinedScales {
+ [key: string]: Scale;
+
+ cool: Scale;
+ hot: Scale;
+ }
+
+ export interface Color {
+ /**
+ * Creates a color from a string representation (as supported in CSS).
+ *
+ * @param color The string to convert to a color.
+ */
+ new(color: string): Color;
+
+ /**
+ * Create a color in the specified color space using a, b and c as values.
+ *
+ * @param a
+ * @param b
+ * @param c
+ * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
+ */
+ new(a: number, b: number, c: number, colorSpace?: string): Color;
+
+ /**
+ * Create a color in the specified color space using a, b and c as color values and alpha as the alpha value.
+ *
+ * @param a
+ * @param b
+ * @param c
+ * @param alpha The alpha value of the color.
+ * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
+ */
+ new(a: number, b: number, c: number, alpha: number, colorSpace?: string): Color;
+
+ /**
+ * Create a color in the specified color space using values.
+ *
+ * @param values An array of values (e.g. [r, g, b, a?]).
+ * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
+ */
+ new(values: number[], colorSpace: string): Color;
+
+ /**
+ * Convert this color to CSS hex representation.
+ *
+ * @return this color's hex representation.
+ */
+ hex(): string;
+
+ /**
+ * @return the relative luminance of the color, which is a value between 0 (black) and 1 (white).
+ */
+ luminance(): number;
+
+ /**
+ * @return the X11 name of this color or its hex value if it does not have a name.
+ */
+ name(): string;
+
+ /**
+ * @return the alpha value of the color.
+ */
+ alpha(): number;
+
+ /**
+ * Set the alpha value.
+ *
+ * @param alpha The alpha value.
+ * @return this
+ */
+ alpha(alpha: number): Color;
+
+ css(mode?: string): string;
+
+ interpolate(color: Color, f: number, mode?: string): Color;
+ interpolate(color: string, f: number, mode?: string): Color;
+
+ premultiply(): Color;
+
+ rgb(): number[];
+ rgba(): number[];
+ hsl(): number[];
+ hsv(): number[];
+ lab(): number[];
+ lch(): number[];
+ hsi(): number[];
+ gl(): number[];
+
+ darken(amount?: number): Color;
+ darker(amount: number): Color;
+ brighten(amount?: number): Color;
+ brighter(amount: number): Color;
+ saturate(amount?: number): Color;
+ desaturate(amount?: number): Color;
+
+ toString(): string;
+ }
+
+ export interface Scale {
+ /**
+ * Interpolate a color using the currently set range and domain.
+ *
+ * @param value The value to use for interpolation.
+ * @return the interpolated hex color OR a Color object (depending on the mode set on this Scale).
+ */
+ (value: number): any;
+
+ /**
+ * Retreive all possible colors generated by this scale if it has distinct classes.
+ *
+ * @param mode The output mode to use. Must be one of Color's getters. Defaults to "hex".
+ * @return an array of colors in the type specified by mode.
+ */
+ colors(mode?: string): any[];
+
+ correctLightness(): boolean;
+
+ /**
+ * Enable or disable automatic lightness correction of this scale.
+ *
+ * @param Whether to enable or disable automatic lightness correction.
+ * @return this
+ */
+ correctLightness(enable: boolean): Scale;
+
+ /**
+ * Get the current domain.
+ *
+ * @return The current domain.
+ */
+ domain(): number[];
+
+ /**
+ * Set the domain.
+ *
+ * @param domain An Array of at least two numbers (min and max).
+ * @param classes The number of fixed classes to create between min and max.
+ * @param mode The scale to use. Examples: log, quantiles, k-means.
+ * @return this
+ */
+ domain(domain: number[], classes?: number, mode?: string): Scale;
+
+ /**
+ * Specify in which color space the colors should be interpolated. Defaults to "rgb".
+ * You can use any of the following spaces: rgb, hsv, hsl, lab, lch
+ *
+ * @param colorSpace The color space to use for interpolation.
+ * @return this
+ */
+ mode(colorSpace: string): Scale;
+
+ /**
+ * Set the output mode of this Scale.
+ *
+ * @param mode The output mode to use. Must be one of Color's getters.
+ * @return this
+ */
+ out(mode: string): Scale;
+
+ /**
+ * Set the color range after initialization.
+ *
+ * @param colors An Array of at least two color names or hex values.
+ * @return this
+ */
+ range(colors: string[]): Scale;
+ }
+
+}
+
+declare var chroma: Chroma.ChromaStatic;
diff --git a/chroma-js/chroma-js-tests.ts b/chroma-js/chroma-js-tests.ts
index 3240ac11f8..ccc9d5a1a7 100644
--- a/chroma-js/chroma-js-tests.ts
+++ b/chroma-js/chroma-js-tests.ts
@@ -1,120 +1,166 @@
///
function test_chroma() {
- chroma("red");
- chroma("#ff0000");
- chroma("#f00");
- chroma("FF0000");
- chroma(255, 0, 0);
- chroma([255, 0, 0]);
- chroma(0, 1, 0.5, 'hsl');
- chroma([0, 1, 0.5], 'hsl');
- chroma(0, 1, 1, 'hsv');
- chroma("rgb(255,0,0)");
- chroma("rgb(100%,0%,0%)");
- chroma("hsl(0,100%,50%)");
- chroma(53.24, 80.09, 67.20, 'lab');
- chroma(53.24, 104.55, 40, 'lch');
- chroma(1, 0, 0, 'gl');
-
- chroma.hex("#ff0000");
- chroma.hex("red");
- chroma.hex("rgb(255, 0, 0)");
-
- chroma.rgb(255, 0, 0);
- chroma.hsl(0, 1, 0.5);
- chroma.hsv(120, 0.5, 0.5);
- chroma.lab(53.24, 80.09, 67.20);
- chroma.lch(53.24, 104.55, 40);
- chroma.gl(1, 0, 0);
-
- chroma.interpolate('white', 'black', 0) // #ffffff
- chroma.interpolate('white', 'black', 1) // #000000
- chroma.interpolate('white', 'black', 0.5) // #7f7f7f
- chroma.interpolate('white', 'black', 0.5, 'hsv') // #808080
- chroma.interpolate('white', 'black', 0.5, 'lab') // #777777
-
- chroma.interpolate('rgba(0,0,0,0)', 'rgba(255,0,0,1)', 0.5).css() //"rgba(127.5,0,0,0.5)"
-
- var bezInterpolator = chroma.interpolate.bezier(['white', 'yellow', 'red', 'black']);
- bezInterpolator(0).hex() // #ffffff
- bezInterpolator(0.33).hex() // #ffcc67
- bezInterpolator(0.66).hex() // #b65f1a
- bezInterpolator(1).hex() // #000000
-
- chroma.luminance('black') // 0
- chroma.luminance('white') // 1
- chroma.luminance('#ff0000') // 0.2126
-
- chroma.contrast('white', 'navy') // 16.00 – ok
- chroma.contrast('white', 'yellow') // 1.07 – not ok!
+ chroma('hotpink');
+ chroma('#ff3399');
+ chroma('F39');
+ chroma.hex("#fff");
+
+ chroma(0xff3399);
+ chroma(0xff, 0x33, 0x99);
+ chroma(255, 51, 153);
+ chroma([255, 51, 153]);
+ chroma(330, 1, 0.6, 'hsl');
+ chroma.hsl(330, 1, 0.6);
+ chroma.lch(80, 40, 130);
+ chroma(80, 40, 130, 'lch');
+ chroma.cmyk(0.2, 0.8, 0, 0);
+ chroma(0.2, 0.8, 0, 0, 'cmyk');
+ chroma.gl(0.6, 0, 0.8);
+ chroma.gl(0.6, 0, 0.8, 0.5);
+ chroma(0.6, 0, 0.8, 'gl');
+ chroma.temperature(2000);
+ chroma.temperature(3500);
+ chroma.temperature(6000);
+ chroma.mix('red', 'blue');
+ chroma.mix('red', 'blue', 0.25);
+ chroma.mix('red', 'blue', 0.5, 'rgb');
+ chroma.mix('red', 'blue', 0.5, 'hsl');
+ chroma.mix('red', 'blue', 0.5, 'lab');
+ chroma.mix('red', 'blue', 0.5, 'lch');
+ chroma.blend('4CBBFC', 'EEEE22', 'multiply');
+ chroma.blend('4CBBFC', 'EEEE22', 'darken');
+ chroma.blend('4CBBFC', 'EEEE22', 'lighten');
+ chroma.random();
+ chroma.contrast('pink', 'hotpink');
+ chroma.contrast('pink', 'purple');
+ chroma.brewer.OrRd;
+ var data = [3.0, 3.5, 3.6, 3.8, 3.8, 4.1, 4.3, 4.4,
+ 4.6, 4.9, 5.2, 5.3, 5.4, 5.7, 5.8, 5.9,
+ 6.2, 6.5, 6.8, 7.2, 9];
+ chroma.limits(data, 'e', 5);
+ chroma.limits(data, 'q', 5);
+ chroma.limits(data, 'k', 5);
}
function test_color() {
- chroma('red').hex() // "#FF0000""
- chroma('red').rgb() // [255, 0, 0]
- chroma('red').hsv() // [0, 1, 1]
- chroma('red').hsl() // [0, 1, 0.5]
- chroma('red').lab() // [53.2407, 80.0924, 67.2031]
- chroma('red').lch() // [53.2407, 104.5517, 39.9990]
- chroma('red').rgba() // [255, 0, 0, 1]
- chroma('red').css() // "rgb(255,0,0)"
- chroma('red').alpha(0.7).css() // "rgba(255,0,0,0.7)"
- chroma('red').css('hsl') // "hsl(0,100%,50%)"
- chroma('red').alpha(0.7).css('hsl') // "hsla(0,100%,50%,0.7)"
- chroma('blue').css('hsla') // "hsla(240,100%,50%,1)"
-
- var red = chroma('red');
- red.alpha(0.5);
- red.css(); // rgba(255,0,0,0.5);
-
- chroma('red').darken().hex() // #BC0000
- chroma('red').brighten().hex() // #FF603B
- chroma('#eecc99').saturate().hex() // #fcc973
- chroma('red').desaturate().hex() // #ec3d23
-
- chroma('black').luminance() // 0
- chroma('white').luminance() // 1
- chroma('red').luminance() // 0.2126
+ chroma('red').alpha(0.5);
+ chroma('rgba(255,0,0,0.35)').alpha();
+ chroma('hotpink').darken();
+ chroma('hotpink').darken(2);
+ chroma('hotpink').brighten();
+ chroma('slategray').saturate();
+ chroma('slategray').saturate(2);
+ chroma('hotpink').desaturate();
+ chroma('hotpink').desaturate(2);
+ chroma('hotpink').desaturate(3);
+ // change hue to 0 deg (=red)
+ chroma('skyblue').set('hsl.h', 0);
+ // set chromacity to 30
+ chroma('hotpink').set('lch.c', 30);
+ // half Lab lightness
+ chroma('orangered').set('lab.l', '*0.5');
+ // double Lch saturation
+ chroma('darkseagreen').set('lch.c', '*2');
+ chroma('orangered').get('lab.l');
+ chroma('orangered').get('hsl.l');
+ chroma('orangered').get('rgb.g');
+ chroma('white').luminance();
+ chroma('aquamarine').luminance();
+ chroma('hotpink').luminance();
+ chroma('darkslateblue').luminance();
+ chroma('black').luminance();
+ chroma('white').luminance(0.5);
+ chroma('aquamarine').luminance(0.5);
+ chroma('hotpink').luminance(0.5);
+ chroma('darkslateblue').luminance(0.5);
+ chroma('aquamarine').luminance(0.5);
+ chroma('aquamarine').luminance(0.5, 'lab');
+ chroma('aquamarine').luminance(0.5, 'hsl');
+ chroma('orange').hex();
+ chroma('#ffa500').name();
+ chroma('#ffa505').name();
+ chroma('teal').css();
+ chroma('teal').alpha(0.5).css();
+ chroma('teal').css('hsl');
+ chroma('orange').rgb();
+ chroma('orange').hsl();
+ chroma('white').hsl();
+ chroma('orange').hsv();
+ chroma('white').hsv();
+ chroma('orange').hsi();
+ chroma('white').hsi();
+ chroma('orange').lab();
+ chroma('skyblue').lch();
+ chroma('skyblue').hcl();
+ chroma('#ff3300').temperature();
+ chroma('#ff8a13').temperature();
+ chroma('#ffe3cd').temperature();
+ chroma('#cbdbff').temperature();
+ chroma('#b3ccff').temperature();
+ chroma('33cc00').gl();
}
function test_scale() {
- var scale = chroma.scale(['lightyellow', 'navy']);
- scale(0.5); // #7F7FB0
+ var f = chroma.scale();
+ f(0.25);
+ f(0.5);
+ f(0.75);
+ chroma.scale(['yellow', '008ae5']);
+ chroma.scale(['yellow', 'red', 'black']);
+ // default domain is [0,1]
+ chroma.scale(['yellow', '008ae5']);
+ // set domain to [0,100]
+ chroma.scale(['yellow', '008ae5']).domain([0, 100]);
+ // default domain is [0,1]
+ chroma.scale(['yellow', 'lightgreen', '008ae5'])
+ .domain([0, 0.25, 1]);
+ chroma.scale(['yellow', '008ae5']);
+ chroma.scale(['yellow', 'navy']);
+ chroma.scale(['yellow', 'navy']).mode('lab');
+ chroma.scale(['yellow', 'navy']).mode('lab');
+ chroma.scale(['yellow', 'navy']).mode('hsl');
+ chroma.scale(['yellow', 'navy']).mode('lch');
+ chroma.scale('YlGnBu');
+ chroma.scale('Spectral');
+ chroma.scale('Spectral').domain([1, 0]);
+ chroma.brewer.OrRd;
+ chroma.scale(['yellow', '008ae5']).mode('lch');
+
+ chroma.scale(['yellow', '008ae5'])
+ .mode('lch')
+ .correctLightness();
+ // linear interpolation
+ chroma.scale(['yellow', 'red', 'black']);
+ // bezier interpolation
+ chroma.bezier(['yellow', 'red', 'black']);
+ // convert bezier interpolator into chroma.scale
+ chroma.bezier(['yellow', 'red', 'black'])
+ .scale().colors(5);
+ // use the default helix...
+ chroma.cubehelix();
+ // or customize it
+ chroma.cubehelix()
+ .start(200)
+ .rotations(-0.5)
+ .gamma(0.8)
+ .lightness([0.3, 0.8]);
+
+ chroma.cubehelix()
+ .start(200)
+ .rotations(-0.35)
+ .gamma(0.7)
+ .lightness([0.3, 0.8])
+ .scale() // convert to chroma.scale
+ .correctLightness()
+ .colors(5);
chroma.scale('RdYlBu');
+ chroma.scale('RdYlBu').padding(0.15);
- var col = scale(0.5);
- col.hex(); // #7F7FB0
- col.rgb(); // [127.5, 127.5, 176]
+ chroma.scale('OrRd');
+ chroma.scale('OrRd').padding([0.2, 0]);
- scale = chroma.scale(['lightyellow', 'navy']).out('hex');
- scale(0.5); // "#7F7FB0"
-
- var scale = chroma.scale(['lightyellow', 'navy']);
- scale.mode('hsv')(0.5); // #54C08A
- scale.mode('hsl')(0.5); // #31FF98
- scale.mode('lab')(0.5); // #967CB2
- scale.mode('lch')(0.5); // #D26662
-
- var scale = chroma.scale(['lightyellow', 'navy']).domain([0, 400]);
- scale(200); // #7F7FB0
-
- var scale = chroma.scale(['lightyellow', 'navy']).domain([0, 100, 200, 300, 400]);
- scale(98); // #7F7FB0
- scale(99); // #7F7FB0
- scale(100); // #AAAAC0
- scale(101); // #AAAAC0
-
- chroma.scale(['#eee', '#900']).domain([0, 400], 7);
- chroma.scale(['#eee', '#900']).domain([1, 1000000], 7, 'log');
- chroma.scale(['#eee', '#900']).domain([1, 1000000], 5, 'quantiles');
- chroma.scale(['#eee', '#900']).domain([1, 1000000], 5, 'k-means');
- chroma.scale(['white', 'red']).domain([0, 100], 4).domain() // [0, 25, 50, 75, 100]
-
- chroma.scale().range(['lightyellow', 'navy']);
-
- chroma.scale(['lightyellow', 'navy']).correctLightness(true);
-
- chroma.scale('RdYlGn').domain([0,1], 5).colors()
-}
+ chroma.scale('OrRd').classes(5);
+ chroma.scale('OrRd').classes(8);
+}
\ No newline at end of file
diff --git a/chroma-js/chroma-js.d.ts b/chroma-js/chroma-js.d.ts
index 5d785eda27..654c4d8cef 100644
--- a/chroma-js/chroma-js.d.ts
+++ b/chroma-js/chroma-js.d.ts
@@ -1,14 +1,14 @@
-// Type definitions for Chroma.js v0.5.6
+// Type definitions for Chroma.js v1.1.1
// Project: https://github.com/gka/chroma.js
-// Definitions by: Sebastian Brückner
+// Definitions by: Sebastian Brückner , Marcin Pacholec
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Chroma.js is a tiny library for all kinds of color conversions and color scales.
*/
declare namespace Chroma {
-
export interface ChromaStatic {
+
/**
* Creates a color from a string representation (as supported in CSS).
*
@@ -17,6 +17,14 @@ declare namespace Chroma {
*/
(color: string): Color;
+ /**
+ * Creates a color from a number representation [0; 16777215]
+ *
+ * @param color The number to convert to a color.
+ * @return the color object.
+ */
+ (number: number): Color;
+
/**
* Create a color in the specified color space using a, b and c as values.
*
@@ -25,72 +33,20 @@ declare namespace Chroma {
* @param c
* @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
* @return the color object.
- */
+ */
(a: number, b: number, c: number, colorSpace?: string): Color;
+ (a: number, b: number, c: number, d: number, colorSpace?: string): Color;
+
/**
- * Create a color in the specified color space using values.
- *
- * @param values An array of values (e.g. [r, g, b, a?]).
- * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
- * @return the color object.
- */
+ * Create a color in the specified color space using values.
+ *
+ * @param values An array of values (e.g. [r, g, b, a?]).
+ * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
+ * @return the color object.
+ */
(values: number[], colorSpace?: string): Color;
- /**
- * Create a color in the specified color space using a, b and c as values.
- *
- * @param a
- * @param b
- * @param c
- * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
- * @return the color object.
- */
- color(a: number, b: number, c: number, colorSpace?: string): Color;
-
- /**
- * Calculate the contrast ratio of two colors.
- *
- * @param color1 The first color.
- * @param color2 The second color.
- * @return the contrast ratio.
- */
- contrast(color1: Color, color2: Color): number;
- /**
- * Calculate the contrast ratio of two colors.
- *
- * @param color1 The first color.
- * @param color2 The second color.
- * @return the contrast ratio.
- */
- contrast(color1: Color, color2: string): number;
- /**
- * Calculate the contrast ratio of two colors.
- *
- * @param color1 The first color.
- * @param color2 The second color.
- * @return the contrast ratio.
- */
- contrast(color1: string, color2: Color): number;
- /**
- * Calculate the contrast ratio of two colors.
- *
- * @param color1 The first color.
- * @param color2 The second color.
- * @return the contrast ratio.
- */
- contrast(color1: string, color2: string): number;
-
- /**
- * Create a color from a hex or string representation (as supported in CSS).
- *
- * This is an alias of chroma.hex().
- *
- * @param color The string to convert to a color.
- * @return the color object.
- */
- css(color: string): Color;
-
/**
* Create a color from a hex or string representation (as supported in CSS).
*
@@ -101,217 +57,209 @@ declare namespace Chroma {
*/
hex(color: string): Color;
- rgb(red: number, green: number, blue: number, alpha?: number): Color;
- hsl(hue: number, saturation: number, lightness: number, alpha?: number): Color;
- hsv(hue: number, saturation: number, value: number, alpha?: number): Color;
+ hsl(h: number, s: number, l: number): Color;
+
+ hsv(h: number, s: number, v: number): Color;
+
lab(lightness: number, a: number, b: number, alpha?: number): Color;
- lch(lightness: number, chroma: number, hue: number, alpha?: number): Color;
+
+ lch(l: number, c: number, h: number): Color;
+
+ rgb(r: number, g: number, b: number): Color;
+
+ /**
+ * GL is a variant of RGB(A), with the only difference that the components are normalized to the range of 0..1.
+ */
gl(red: number, green: number, blue: number, alpha?: number): Color;
- interpolate: InterpolateFunction;
- mix: InterpolateFunction;
+ /**
+ * light 2000K, bright sunlight 6000K. Based on Neil Bartlett's implementation.
+ * https://github.com/neilbartlett/color-temperature
+ */
+ temperature(t: number): Color;
- luminance(color: Color): number;
- luminance(color: string): number;
+ mix(col1: string | Color, col2: string | Color, f?: number, colorSpace?: string): Color;
+
+ interpolate(col1: string | Color, col2: string | Color, f?: number, colorSpace?: string): Color;
/**
- * Creates a color scale using a pre-defined color scale.
- *
- * @param name The name of the color scale.
- * @return the resulting color scale.
+ * Blends two colors using RGB channel-wise blend functions. Valid blend modes are multiply, darken, lighten, screen, overlay, burn, and dogde.
*/
+ blend(col1: string, col2: string, blendMode: string): Color;
+
+ /**
+ * Returns a random color.
+ */
+ random(): Color;
+
+ /**
+ * Computes the WCAG contrast ratio between two colors.
+ * A minimum contrast of 4.5:1 is recommended to ensure that text is still readable against a background color.
+ *
+ * @param color1 The first color.
+ * @param color2 The second color.
+ * @return the contrast ratio.
+ */
+ contrast(col1: string | Color, col2: string | Color): number;
+
+ bezier(colors: string[]): Scale;
+
+ /**
+ * chroma.brewer is an map of ColorBrewer scales that are included in chroma.js for convenience.
+ * chroma.scale uses the colors to construct.
+ */
+ brewer: {
+ OrRd: string[];
+ PuBu: string[];
+ BuPu: string[];
+ Oranges: string[];
+ BuGn: string[];
+ YlOrBr: string[];
+ YlGn: string[];
+ Reds: string[];
+ RdPu: string[];
+ Greens: string[];
+ YlGnBu: string[];
+ Purples: string[];
+ GnBu: string[];
+ Greys: string[];
+ YlOrRd: string[];
+ PuRd: string[];
+ Blues: string[];
+ PuBuGn: string[];
+ Spectral: string[];
+ RdYlGn: string[];
+ RdBu: string[];
+ PiYG: string[];
+ PRGn: string[];
+ RdYlBu: string[];
+ BrBG: string[];
+ RdGy: string[];
+ PuOr: string[];
+ Set2: string[];
+ Accent: string[];
+ Set1: string[];
+ Set3: string[];
+ Dark2: string[];
+ Paired: string[];
+ Pastel2: string[];
+ Pastel1: string[];
+ };
+
+ /**
+ * Helper function that computes class breaks for you, based on actual data.
+ * Supports three different modes: equidistant breaks, quantiles breaks and breaks based on k-means clusting.
+ */
+ limits(data: number[], mode: string, c: number): number[];
+
scale(name: string): Scale;
- /**
- * Creates a color scale function from the given set of colors.
- *
- * @param colors An Array of at least two color names or hex values.
- * @return the resulting color scale.
- */
scale(colors?: string[]): Scale;
- scales: PredefinedScales;
- }
+ cubehelix(): Cubehelix;
- interface InterpolateFunction {
- (color1: Color, color2: Color, f: number, mode?: string): Color;
- (color1: Color, color2: string, f: number, mode?: string): Color;
- (color1: string, color2: Color, f: number, mode?: string): Color;
- (color1: string, color2: string, f: number, mode?: string): Color;
-
- bezier(colors: any[]): (t: number) => Color;
- }
-
- interface PredefinedScales {
- [key: string]: Scale;
-
- cool: Scale;
- hot: Scale;
+ cmyk(c: number, m: number, y: number, k: number): Color;
+
+ /**
+ * Create a color from a hex or string representation (as supported in CSS).
+ *
+ * This is an alias of chroma.hex().
+ *
+ * @param color The string to convert to a color.
+ * @return the color object.
+ */
+ css(col: string, mode?: string): string;
}
export interface Color {
- /**
- * Creates a color from a string representation (as supported in CSS).
- *
- * @param color The string to convert to a color.
- */
- new(color: string): Color;
+ alpha(a?: number): Color;
- /**
- * Create a color in the specified color space using a, b and c as values.
- *
- * @param a
- * @param b
- * @param c
- * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
- */
- new(a: number, b: number, c: number, colorSpace?: string): Color;
+ darken(f?: number): Color;
- /**
- * Create a color in the specified color space using a, b and c as color values and alpha as the alpha value.
- *
- * @param a
- * @param b
- * @param c
- * @param alpha The alpha value of the color.
- * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
- */
- new(a: number, b: number, c: number, alpha: number, colorSpace?: string): Color;
+ brighten(f?: number): Color;
- /**
- * Create a color in the specified color space using values.
- *
- * @param values An array of values (e.g. [r, g, b, a?]).
- * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb".
- */
- new(values: number[], colorSpace: string): Color;
+ saturate(s?: number): Color;
- /**
- * Convert this color to CSS hex representation.
- *
- * @return this color's hex representation.
- */
- hex(): string;
+ desaturate(s?: number): Color;
+
+ set(modechan: string, v: number | string): Color;
+
+ get(modechan: string): number;
- /**
- * @return the relative luminance of the color, which is a value between 0 (black) and 1 (white).
- */
luminance(): number;
- /**
- * @return the X11 name of this color or its hex value if it does not have a name.
- */
+ luminance(l: number, mode?: string): Color;
+
+ hex(): string;
+
name(): string;
/**
- * @return the alpha value of the color.
- */
- alpha(): number;
-
- /**
- * Set the alpha value.
+ * Create a color from a hex or string representation (as supported in CSS).
*
- * @param alpha The alpha value.
- * @return this
+ * This is an alias of chroma.hex().
+ *
+ * @param color The string to convert to a color.
+ * @return the color object.
*/
- alpha(alpha: number): Color;
-
css(mode?: string): string;
- interpolate(color: Color, f: number, mode?: string): Color;
- interpolate(color: string, f: number, mode?: string): Color;
-
- premultiply(): Color;
-
rgb(): number[];
+
rgba(): number[];
+
hsl(): number[];
+
hsv(): number[];
- lab(): number[];
- lch(): number[];
+
hsi(): number[];
+
+ lab(): number[];
+
+ lch(): number[];
+
+ hcl(): number[];
+
+ temperature(): number;
+
gl(): number[];
-
- darken(amount?: number): Color;
- darker(amount: number): Color;
- brighten(amount?: number): Color;
- brighter(amount: number): Color;
- saturate(amount?: number): Color;
- desaturate(amount?: number): Color;
-
- toString(): string;
}
export interface Scale {
- /**
- * Interpolate a color using the currently set range and domain.
- *
- * @param value The value to use for interpolation.
- * @return the interpolated hex color OR a Color object (depending on the mode set on this Scale).
- */
+ (c: string[]): Scale;
+
(value: number): any;
- /**
- * Retreive all possible colors generated by this scale if it has distinct classes.
- *
- * @param mode The output mode to use. Must be one of Color's getters. Defaults to "hex".
- * @return an array of colors in the type specified by mode.
- */
- colors(mode?: string): any[];
+ domain(d?: number[], n?: number, mode?: string): Scale;
- correctLightness(): boolean;
+ mode(mode: string): Scale;
- /**
- * Enable or disable automatic lightness correction of this scale.
- *
- * @param Whether to enable or disable automatic lightness correction.
- * @return this
- */
- correctLightness(enable: boolean): Scale;
+ correctLightness(enable?: boolean): Scale;
- /**
- * Get the current domain.
- *
- * @return The current domain.
- */
- domain(): number[];
+ bezier(colors: string[]): Scale;
- /**
- * Set the domain.
- *
- * @param domain An Array of at least two numbers (min and max).
- * @param classes The number of fixed classes to create between min and max.
- * @param mode The scale to use. Examples: log, quantiles, k-means.
- * @return this
- */
- domain(domain: number[], classes?: number, mode?: string): Scale;
+ padding(p: number | number[]): Scale;
- /**
- * Specify in which color space the colors should be interpolated. Defaults to "rgb".
- * You can use any of the following spaces: rgb, hsv, hsl, lab, lch
- *
- * @param colorSpace The color space to use for interpolation.
- * @return this
- */
- mode(colorSpace: string): Scale;
+ colors(c?: number): string[];
+
+ classes(c: number | number[]): (t: number) => Color;
+
+ range(arg: string[]): Scale;
+
+ scale(): Scale;
- /**
- * Set the output mode of this Scale.
- *
- * @param mode The output mode to use. Must be one of Color's getters.
- * @return this
- */
out(mode: string): Scale;
-
- /**
- * Set the color range after initialization.
- *
- * @param colors An Array of at least two color names or hex values.
- * @return this
- */
- range(colors: string[]): Scale;
}
+ export interface Cubehelix extends Scale {
+ start(s: number): Cubehelix;
+
+ rotations(r: number): Cubehelix;
+
+ gamma(g: number): Cubehelix;
+
+ lightness(l: number[]): Cubehelix;
+ }
}
declare var chroma: Chroma.ChromaStatic;
diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts
index bdd0271fca..dbf6a12446 100644
--- a/chrome/chrome.d.ts
+++ b/chrome/chrome.d.ts
@@ -7219,7 +7219,7 @@ declare namespace chrome.webRequest {
* Optional.
* If the request method is POST and the body is a sequence of key-value pairs encoded in UTF8, encoded as either multipart/form-data, or application/x-www-form-urlencoded, this dictionary is present and for each key contains the list of all values for that key. If the data is of another media type, or if it is malformed, the dictionary is not present. An example value of this dictionary is {'key': ['value1', 'value2']}.
*/
- formData?: Object;
+ formData?: { [key: string]: string[] };
/**
* Optional.
* If the request method is PUT or POST, and the body is not already parsed in formData, then the unparsed request body elements are contained in this array.
@@ -7233,6 +7233,7 @@ declare namespace chrome.webRequest {
}
interface ResourceRequest {
+ url: string;
/** The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request. */
requestId: string;
/** The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (type is main_frame or sub_frame), frameId indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab. */
@@ -7251,7 +7252,6 @@ declare namespace chrome.webRequest {
}
interface WebRequestDetails extends ResourceRequest {
- url: string;
/** Standard HTTP method. */
method: string;
}
@@ -7304,7 +7304,7 @@ declare namespace chrome.webRequest {
interface WebAuthenticationChallengeDetails extends WebResponseHeadersDetails {
/** The authentication scheme, e.g. Basic or Digest. */
- schema: string;
+ scheme: string;
/** The authentication realm provided by the server, if there is one. */
realm?: string;
/** The server requesting authentication. */
@@ -7336,7 +7336,9 @@ declare namespace chrome.webRequest {
interface WebRedirectionResponseEvent extends _WebResponseHeadersEvent {}
- interface WebAuthenticationChallengeEvent extends chrome.events.Event<(details: WebAuthenticationChallengeDetails, callback?: (response: BlockingResponse) => void) => void> {}
+ interface WebAuthenticationChallengeEvent extends chrome.events.Event<(details: WebAuthenticationChallengeDetails, callback?: (response: BlockingResponse) => void) => void> {
+ addListener(callback: (details: WebAuthenticationChallengeDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
+ }
interface WebResponseErrorEvent extends _WebResponseHeadersEvent {}
diff --git a/countdown/countdown-tests.ts b/countdown/countdown-tests.ts
new file mode 100644
index 0000000000..c803f1acc2
--- /dev/null
+++ b/countdown/countdown-tests.ts
@@ -0,0 +1,42 @@
+///
+
+import { countdown, Timespan, CountdownStatic, Format } from 'countdown';
+
+let ts: Timespan;
+let interval: number;
+
+ts = countdown(new Date());
+ts = countdown(150);
+
+interval = countdown(new Date(),
+ function (ts: Timespan) {
+ document.getElementById('pageTimer').innerHTML = ts.toHTML('strong');
+ },
+ countdown.HOURS | countdown.MINUTES | countdown.SECONDS,
+ 2,
+ 2
+);
+
+clearInterval(interval);
+
+ts.toString('foo');
+ts.toHTML('em', 'foo');
+
+countdown.resetFormat();
+countdown.setLabels('a', 'b', 'c', 'd', 'e');
+
+countdown.setLabels('a', 'b', 'c', 'd', 'e', function (value: number): string {
+ return 'ok';
+}, function (value: number, unit: number): string {
+ return 'ok';
+});
+
+countdown.setLabels(null, null, null, null, 'Now.');
+
+countdown.setLabels(
+ ' millisecond| second| minute| hour| day| week| month| year| decade| century| millennium',
+ ' milliseconds| seconds| minutes| hours| days| weeks| months| years| decades| centuries| millennia',
+ ' and ',
+ ', ',
+ '',
+ n => n.toString());
diff --git a/countdown/countdown.d.ts b/countdown/countdown.d.ts
new file mode 100644
index 0000000000..5b40541dd0
--- /dev/null
+++ b/countdown/countdown.d.ts
@@ -0,0 +1,69 @@
+// Type definitions for countdown.js
+// Project: http://countdownjs.org/
+// Definitions by: Gabriel Juchault
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare module 'countdown' {
+ export type DateFunction = (timespan: Timespan) => void;
+ export type DateTime = number | Date | DateFunction;
+
+ export interface Timespan {
+ start?: Date;
+ end?: Date;
+ units?: number;
+ value?: number;
+ millennia?: number;
+ centuries?: number;
+ decades?: number;
+ years?: number;
+ months?: number;
+ days?: number;
+ hours?: number;
+ minutes?: number;
+ seconds?: number;
+ milliseconds?: number;
+ toString(label?: string): string;
+ toHTML(tagName?: string, label?: string): string;
+ }
+
+ export interface Format {
+ singular?: string | Array;
+ plural?: string | Array;
+ last?: string;
+ delim?: string;
+ empty?: string;
+ formatNumber?(value: number): string;
+ formatter?(value: number, unit: number): string;
+ }
+
+ export interface CountdownStatic {
+ (start: DateTime, end?: DateTime, units?: number, max?: number, digits?: number): Timespan | number;
+ MILLENNIA: number;
+ CENTURIES: number;
+ DECADES: number;
+ YEARS: number;
+ MONTHS: number;
+ WEEKS: number;
+ DAYS: number;
+ HOURS: number;
+ MINUTES: number;
+ SECONDS: number;
+ MILLISECONDS: number;
+ ALL: number;
+ DEFAULTS: number;
+ resetLabels(): void;
+ setLabels(
+ singular?: string,
+ plural?: string,
+ last?: string,
+ delim?: string,
+ empty?: string,
+ formatNumber?: (value: number) => string,
+ formatter?: (value: number, unit: number) => string
+ ): void;
+ resetFormat(): void;
+ setFormat(format: Format): void;
+ }
+
+ export let countdown: CountdownStatic;
+}
diff --git a/cropperjs/cropperjs-tests.ts b/cropperjs/cropperjs-tests.ts
index d328a12b4a..82232c268a 100644
--- a/cropperjs/cropperjs-tests.ts
+++ b/cropperjs/cropperjs-tests.ts
@@ -1,2 +1,16 @@
///
import * as Cropper from 'cropperjs';
+
+var image = document.getElementById('image');
+var cropper = new Cropper(image, {
+ aspectRatio: 16 / 9,
+ crop: function(e) {
+ console.log(e.detail.x);
+ console.log(e.detail.y);
+ console.log(e.detail.width);
+ console.log(e.detail.height);
+ console.log(e.detail.rotate);
+ console.log(e.detail.scaleX);
+ console.log(e.detail.scaleY);
+ }
+});
diff --git a/cropperjs/cropperjs.d.ts b/cropperjs/cropperjs.d.ts
index f2f8e861e5..c76b4c7766 100644
--- a/cropperjs/cropperjs.d.ts
+++ b/cropperjs/cropperjs.d.ts
@@ -11,7 +11,26 @@ declare module cropperjs {
CanvasShouldNotBeWithInTheContainer = 2,
ContainerSshouldBeWithInTheCanvas = 3
}
+ export interface CropperCustomEvent extends CustomEvent {
+ detail: Data;
+ }
export interface CropperOptions {
+ /**
+ * Function called when crop box is moved or resized
+ */
+ crop?: (event: CropperCustomEvent) => void;
+ /**
+ * Function called at start of crop box being moved or resized
+ */
+ cropstart?: (event: CropperCustomEvent) => void;
+ /**
+ * Function called when crop box is moved
+ */
+ cropmove?: (event: CropperCustomEvent) => void;
+ /**
+ * Function called when crop box is finished being moved or resized
+ */
+ cropend?: (event: CropperCustomEvent) => void;
/**
* Define the view mode of the cropper.
* @default 0
diff --git a/dojo/dijit.d.ts b/dojo/dijit.d.ts
index 8d3e99b6b5..29abf02211 100644
--- a/dojo/dijit.d.ts
+++ b/dojo/dijit.d.ts
@@ -1606,7 +1606,7 @@ declare module dijit {
* already removed/destroyed manually.
*
*/
- own(): any;
+ own(...args: any[]): any[];
/**
* Place this widget somewhere in the DOM based
* on standard domConstruct.place() conventions.
diff --git a/dojo/dojo.d.ts b/dojo/dojo.d.ts
index 8a566a46f5..bca5721240 100644
--- a/dojo/dojo.d.ts
+++ b/dojo/dojo.d.ts
@@ -5686,7 +5686,7 @@ declare namespace dojo {
* @param dest The object to which to copy/add all properties contained in source. If dest is falsy, thena new object is manufactured before copying/adding properties begins.
* @param sources One of more objects from which to draw all properties to copy into dest. sources are processedleft-to-right and if more than one of these objects contain the same property name, the right-mostvalue "wins".
*/
- mixin(dest: Object, sources: Object[]): Object;
+ mixin(dest: Object, source: Object, sources?: Object[]): Object;
/**
* similar to hitch() except that the scope object is left to be
* whatever the execution context eventually becomes.
diff --git a/fetch-mock/fetch-mock-tests.ts b/fetch-mock/fetch-mock-tests.ts
index d22bf6d8b8..defefa25a1 100644
--- a/fetch-mock/fetch-mock-tests.ts
+++ b/fetch-mock/fetch-mock-tests.ts
@@ -18,17 +18,15 @@ fetchMock.mock(/test/, {
}
});
-fetchMock.reMock();
-
fetchMock.restore().reset();
-fetchMock.calls().matched[0][1].body;
+(fetchMock.calls().matched[0][1] as RequestInit).body;
fetchMock.calls().unmatched[0][0].toUpperCase();
fetchMock.calls("http://test.com")[0][0].toUpperCase();
-fetchMock.calls("http://test.com")[0][1].body;
+(fetchMock.calls("http://test.com")[0][1] as RequestInit).body;
fetchMock.called("http://test.com");
-fetchMock.lastCall()[1].body;
+(fetchMock.lastCall()[1] as RequestInit).body;
fetchMock.lastUrl();
fetchMock.lastOptions();
diff --git a/fetch-mock/fetch-mock.d.ts b/fetch-mock/fetch-mock.d.ts
index 23fa1cd808..490b4c7dfd 100644
--- a/fetch-mock/fetch-mock.d.ts
+++ b/fetch-mock/fetch-mock.d.ts
@@ -1,40 +1,32 @@
-// Type definitions for fetch-mock 4.6.0
+// Type definitions for fetch-mock 5.0.0
// Project: https://github.com/wheresrhys/fetch-mock
// Definitions by: Alexey Svetliakov , Tamir Duberstein
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///
-
declare module "fetch-mock" {
+ type MockRequest = Request | RequestInit;
+
/**
* Mock matcher function
* @param url
* @param opts
*/
- type MockMatcherFunction = (url: string, opts: any) => boolean;
+ type MockMatcherFunction = (url: string, opts: MockRequest) => boolean
/**
* Mock matcher. Can be one of following:
- * string: Either an exact url to match e.g. 'http://www.site.com/page.html' or, if the string begins with a ^, the string following the ^ must begin the url
- * e.g. '^http://www.site.com' would match 'http://www.site.com' or 'http://www.site.com/page.html'
+ * string: Either
+ * an exact url to match e.g. 'http://www.site.com/page.html'
+ * if the string begins with a `^`, the string following the `^` must
+ begin the url e.g. '^http://www.site.com' would match
+ 'http://www.site.com' or 'http://www.site.com/page.html'
+ * '*' to match any url
* RegExp: A regular expression to test the url against
- * Function(url, opts): A function (returning a Boolean) that is passed the url and opts fetch() is called with (or, if fetch() was called with one, the Request instance)
+ * Function(url, opts): A function (returning a Boolean) that is passed the
+ url and opts fetch() is called with (or, if fetch() was called with one,
+ the Request instance)
*/
- type MockMatcher = string | RegExp | Function | MockMatcherFunction;
-
- /**
- * Mock response function
- * @param url
- * @param opts
- */
- type MockResponseFunction = (url: string, opts: any) => MockResponse;
- /**
- * number: Creates a response with this status
- * string: Creates a 200 response with the string as the response body
- * object: As long as the object does not contain any of the properties below it is converted into a json string and returned as the body of a 200 response.
- * If MockResponseObject was given then it's used to configure response
- */
- type MockResponse = number | string | MockResponseObject | {};
-
+ type MockMatcher = string | RegExp | MockMatcherFunction;
/**
* Mock response object
@@ -52,93 +44,164 @@ declare module "fetch-mock" {
/**
* Set the response headers.
*/
- headers?: { [key: string]: any };
+ headers?: { [key: string]: string };
/**
- * If this property is present then a Promise rejected with the value of throws is returned
+ * If this property is present then a Promise rejected with the value
+ of throws is returned
*/
throws?: boolean;
/**
- * This property determines whether or not the request body should be JSON.stringified before being sent
+ * This property determines whether or not the request body should be
+ JSON.stringified before being sent
* @default true
*/
sendAsJson?: boolean;
}
+ /**
+ * Response: A Response instance - will be used unaltered
+ * number: Creates a response with this status
+ * string: Creates a 200 response with the string as the response body
+ * object: As long as the object is not a MockResponseObject it is
+ converted into a json string and returned as the body of a 200 response
+ * If MockResponseObject was given then it's used to configure response
+ * Function(url, opts): A function that is passed the url and opts fetch()
+ is called with and that returns any of the responses listed above
+ */
+ type MockResponse = Response | Promise
+ | number | Promise
+ | string | Promise
+ | Object | Promise