Merge remote-tracking branch 'master/master'

This commit is contained in:
Bogdan I. Bursuc
2015-06-01 17:15:55 +03:00
35 changed files with 4514 additions and 4092 deletions
+3
View File
@@ -201,6 +201,9 @@ mod.constant(My.Namespace);
mod.value('name', 23);
mod.value('name', "23");
mod.value(My.Namespace);
mod.decorator('name', function($scope:ng.IScope){ });
mod.decorator('name', ['$scope', <any>function($scope: ng.IScope){ }]);
class TestProvider implements ng.IServiceProvider {
constructor(private $scope: ng.IScope) {
+10 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for Angular JS 1.3+
// Type definitions for Angular JS 1.4+
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -384,6 +384,14 @@ declare module angular {
value(name: string, value: any): IModule;
value(object: Object): IModule;
/**
* Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service.
* @param name The name of the service to decorate
* @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to.
*/
decorator(name:string, decoratorConstructor: Function): IModule;
decorator(name:string, inlineAnnotatedConstructor: any[]): IModule;
// Properties
name: string;
requires: string[];
@@ -1570,7 +1578,7 @@ declare module angular {
compile?: IDirectiveCompileFn;
controller?: any;
controllerAs?: string;
bindToController?: boolean;
bindToController?: boolean|Object;
link?: IDirectiveLinkFn | IDirectivePrePost;
name?: string;
priority?: number;
+19 -3
View File
@@ -1,6 +1,6 @@
// Type definitions for bunyan-prettystream
// Type definitions for bunyan-prettystream 0.1.3
// Project: https://www.npmjs.com/package/bunyan-prettystream
// Definitions by: Jason Swearingen <https://github.com/jasonswearingen/>
// Definitions by: Jason Swearingen <https://github.com/jasonswearingen/>, Vadim Macagon <https://github.com/enlight/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
@@ -8,7 +8,23 @@
declare module "bunyan-prettystream" {
import stream = require("stream");
class PrettyStream extends stream.Writable {
public pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
/**
* @param options.mode Output format, can be either `long`, `short`, or `dev`,
* defaults to `long`.
* @param options.useColor Indicates whether or not output should be colored,
* defaults to `true`.
*/
constructor(options?: { mode?: string; useColor?: boolean });
/**
* Pipes data from this stream to another.
*
* @param destination Stream to write data to.
* @param options.end Indicates whether `end()` should be called on the `destination`
* stream when this stream emits `end`, defaults to `true`.
* @return The `destination` stream.
*/
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
}
export = PrettyStream;
}
+31
View File
@@ -43,6 +43,37 @@ declare module chrome.alarms {
var onAlarm: AlarmEvent;
}
/**
* Use the chrome.browser API to interact with the Chrome browser associated with
* the current application and Chrome profile.
*/
declare module chrome.browser {
interface Options {
/**
* The URL to navigate to when the new tab is initially opened.
*/
url:string;
}
/**
* Opens a new tab in a browser window associated with the current application
* and Chrome profile. If no browser window for the Chrome profile is opened,
* a new one is opened prior to creating the new tab.
* @param options Configures how the tab should be opened.
* @param callback Called when the tab was successfully
* created, or failed to be created. If failed, runtime.lastError will be set.
*/
export function openTab (options: Options, callback: () => void): void;
/**
* Opens a new tab in a browser window associated with the current application
* and Chrome profile. If no browser window for the Chrome profile is opened,
* a new one is opened prior to creating the new tab. Since Chrome 42 only.
* @param options Configures how the tab should be opened.
*/
export function openTab (options: Options): void;
}
////////////////////
// Bookmarks
////////////////////
+2 -2
View File
@@ -10,7 +10,7 @@
}
var fill = d3.scale.category20();
var fill = d3.scale.category20<number>();
d3.layout.cloud().size([300, 300])
.words([
"Hello", "world", "normally", "you", "want", "more", "words",
@@ -40,4 +40,4 @@
return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")";
})
.text(function(d:ICompTextSize) { return d.text; });
}
}
+69 -33
View File
@@ -5,41 +5,77 @@
/// <reference path="../d3/d3.d.ts" />
declare module D3 {
export module Layout {
export interface IRotate {
(number:number) : CloudLayout;
(number:()=>number) : CloudLayout;
declare module d3 {
module layout {
export function cloud(): Cloud<cloud.Word>;
export function cloud<T extends cloud.Word>(): Cloud<T>;
module cloud {
interface Word {
text?: string;
font?: string;
style?: string;
weight?: string | number;
rotate?: number;
size?: number;
padding?: number;
x?: number;
y?: number;
}
}
interface Cloud<T extends cloud.Word> {
start(): Cloud<T>;
stop(): Cloud<T>;
timeInterval(): number;
timeInterval(interval: number): Cloud<T>;
export interface CloudLayout {
(layers: any[], index?: number): any[];
values(accessor?: (d: any) => any): CloudLayout;
offset(offset: string): CloudLayout;
size: {
/**
* Gets the available layout size
*/
(): Array<number>;
/**
* Sets the available layout size
*/
(size: Array<number>): CloudLayout;
};
words: (inputArray: Array<any>) => CloudLayout;
rotate:IRotate;
padding: (number:number) => CloudLayout;
font: (string:string) => CloudLayout;
fontSize(fctn: (d: any) => number): CloudLayout;
on: (eventname: string, callee: (words: any[]) => void) => CloudLayout;
start: () => CloudLayout;
words(): T[];
words(words: T[]): Cloud<T>;
size(): [number, number];
size(size: [number, number]): Cloud<T>;
font(): (datum: T, index: number) => string;
font(font: string): Cloud<T>;
font(font: (datum: T, index: number) => string): Cloud<T>;
fontStyle(): (datum: T, index: number) => string;
fontStyle(style: string): Cloud<T>;
fontStyle(style: (datum: T, index: number) => string): Cloud<T>;
fontWeight(): (datum: T, index: number) => string | number;
fontWeight(weight: string | number): Cloud<T>;
fontWeight(weight: (datum: T, index: number) => string | number): Cloud<T>;
rotate(): (datum: T, index: number) => number;
rotate(rotate: number): Cloud<T>;
rotate(rotate: (datum: T, index: number) => number): Cloud<T>;
text(): (datum: T, index: number) => string;
text(text: string): Cloud<T>;
text(text: (datum: T, index: number) => string): Cloud<T>;
spiral(): (size: number) => (t: number) => [number, number];
spiral(name: string): Cloud<T>;
spiral(spiral: (size: number) => (t: number) => [number, number]): Cloud<T>;
fontSize(): (datum: T, index: number) => number;
fontSize(size: number): Cloud<T>;
fontSize(size: (datum: T, index: number) => number): Cloud<T>;
padding(): (datum: T, index: number) => number;
padding(padding: number): Cloud<T>;
padding(padding: (datum: T, index: number) => number): Cloud<T>;
on(type: "word", listener: (word: T) => void): Cloud<T>;
on(type: "end", listener: (tags: T[], bounds: { x: number; y: number }[]) => void): Cloud<T>;
on(type: string, listener: (...args: any[]) => void): Cloud<T>;
on(type: "word"): (word: T) => void;
on(type: "end"): (tags: T[], bounds: { x: number; y: number }[]) => void;
on(type: string): (...args: any[]) => void;
}
}
export interface Layout {
cloud(): CloudLayout;
}
}
}
}
+386 -392
View File
File diff suppressed because it is too large Load Diff
Vendored
+3173 -3398
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -12,7 +12,7 @@ function superformula() {
.attr("width", 960)
.attr("height", 500);
var small = d3.superformula()
var small = d3.superformula<string>()
.type(function (d) { return d; } )
.size(size);
@@ -37,4 +37,4 @@ function superformula() {
.attr("class", "big")
.attr("transform", "translate(450,250)")
.attr("d", big);
}
}
+28 -29
View File
@@ -1,38 +1,37 @@
/// <reference path="../d3.d.ts" />
declare module d3 {
export function superformula<T>(): Superformula<T>;
declare module D3 {
interface SuperformulaPath
{
superformulaPath(params: number[], n: number, diameter: number): Superformula;
module superformula {
interface Type {
m: number;
n1: number;
n2: number;
n3: number;
a: number;
b: number;
}
}
interface Superformula<T> {
(datum: T, index: number): string;
interface SuperformulaType
{
(any: any): any;//hans
m: number;
n1: number;
n2: number;
n3: number;
a: number;
b: number;
type(): (datum: T, index: number) => string;
type(type: string): Superformula<T>;
type(type: (datum: T, index: number) => string): Superformula<T>;
size(): (datum: T, index: number) => number;
size(size: number): Superformula<T>;
size(size: (datum: T, index: number) => number): Superformula<T>;
segments(): (datum: T, index: number) => number;
segments(segments: number): Superformula<T>;
segments(segments: (datum: T, index: number) => number): Superformula<T>;
param(name: string): number;
param(name: string, value: number): Superformula<T>;
}
interface Superformula
{
(): any;
type(any: any): any;
param(name: string, value: number): Superformula;
size(x: number): Superformula;
segments(x: number): Superformula;
}
interface Base extends Selectors
{
superformula: Superformula;
superformulaPath: SuperformulaPath;
superformulaTypes: SuperformulaType[];
}
export var superformulaTypes: string[];
}
+1 -1
View File
@@ -24,7 +24,7 @@ declare module Dagre {
interface Render {
new (): Render;
(selection: D3.Selection, g: Dagre.Graph): void;
(selection: d3.Selection<any>, g: Dagre.Graph): void;
}
}
+16
View File
@@ -157,3 +157,19 @@ var FizzyText = function () {
update();
}
// ------------ 11. Object Literal Tests
() => {
var obj = {a:1,b:1};
var gui = new dat.GUI();
var controller = gui.add(obj, 'maxSize', 0, 10);
controller.onChange(function (value) {
// Fires on every change, drag, keypress, etc.
});
controller.onFinishChange(function (value) {
// Fires when a controller loses focus.
alert("The new value is " + value);
});
}
+4 -4
View File
@@ -47,8 +47,8 @@ export interface ILegendwidget {
legend: (l:ILegendwidget) => T;
chartID: () => number;
options: (o:Object)=>void ;
select: (selector: D3.Selection) => D3.Selection;
selectAll: (selector: D3.Selection) => D3.Selection;
select: (selector: d3.Selection<any>) => d3.Selection<any>;
selectAll: (selector: d3.Selection<any>) => d3.Selection<any>;
}
export interface IEvents {
@@ -85,8 +85,8 @@ export interface ILegendwidget {
x: IGetSet<any, T>;
y: IGetSet<any, T>;
elasticY: IGetSet<boolean, T>;
xAxis: IGetSet<D3.Svg.Axis, T>;
yAxis: IGetSet<D3.Svg.Axis, T>;
xAxis: IGetSet<d3.svg.Axis, T>;
yAxis: IGetSet<d3.svg.Axis, T>;
yAxisPadding: IGetSet<number, T>;
xAxisPadding: IGetSet<number, T>;
renderHorizontalGridLines: IGetSet<boolean, T>;
+33 -23
View File
@@ -20,6 +20,16 @@ declare module DC {
(t: T, r?: R): V;
}
export interface Scale<T> {
(x: any): T;
domain(values: any[]): Scale<T>;
domain(): any[];
range(values: T[]): Scale<T>;
range(): T[];
}
export interface Accessor<T, V> {
(datum: T, index?: number): V;
}
@@ -86,7 +96,7 @@ declare module DC {
clamp(n: number, min: number, max: number): number;
uniqueId(): number;
nameToId(name: string): string;
appendOrSelect(parent: D3.Selection, selector: string, tag: any): D3.Selection;
appendOrSelect(parent: d3.Selection<any>, selector: string, tag: any): d3.Selection<any>;
safeNumber(n: any): number;
}
@@ -112,11 +122,11 @@ declare module DC {
group: IGetSet<any, T>;
ordering: IGetSet<Accessor<any, any>, T>;
filterAll(): void;
select(selector: D3.Selection|string): D3.Selection;
selectAll(selector: D3.Selection|string): D3.Selection;
anchor(anchor: BaseMixin<any>|D3.Selection|string, chartGroup?: string): D3.Selection;
select(selector: d3.Selection<any>|string): d3.Selection<any>;
selectAll(selector: d3.Selection<any>|string): d3.Selection<any>;
anchor(anchor: BaseMixin<any>|d3.Selection<any>|string, chartGroup?: string): d3.Selection<any>;
anchorName(): string;
svg: IGetSet<D3.Selection, D3.Selection>;
svg: IGetSet<d3.Selection<any>, d3.Selection<any>>;
resetSvg(): void;
filterPrinter: IGetSet<(filters: Array<any>) => string, T>;
turnOnControls(): void;
@@ -160,9 +170,9 @@ declare module DC {
}
export interface ColorMixin<T> {
colors: IGetSet<D3.Scale.GenericScale<any>|Array<string>, T>;
colors: IGetSet<Array<string> | Scale<string | d3.Color>, T>;
ordinalColors(r: Array<string>): void;
linearColors(r: Array<number>): void;
linearColors(r: Array<string>): void;
colorAccessor: IGetSet<Accessor<any, string>, T>;
colorDomain: IGetSet<Array<any>, T>;
calculateColorDomain(): void;
@@ -174,12 +184,12 @@ declare module DC {
rangeChart: IGetSet<BaseMixin<any>, T>;
zoomScale: IGetSet<Array<any>, T>;
zoomOutRestrict: IGetSet<boolean, T>;
g: IGetSet<D3.Selection, T>;
g: IGetSet<d3.Selection<any>, T>;
mouseZoomable: IGetSet<boolean, T>;
chartBodyG(): D3.Selection;
x: IGetSet<D3.Scale.GenericScale<any>, T>;
chartBodyG(): d3.Selection<any>;
x: IGetSet<(n: any) => any, T>;
xUnits: IGetSet<UnitFunction, T>;
xAxis: IGetSet<D3.Svg.Axis, T>;
xAxis: IGetSet<d3.svg.Axis, T>;
elasticX: IGetSet<boolean, T>;
xAxisPadding: IGetSet<number, T>;
xUnitCount(): number;
@@ -187,8 +197,8 @@ declare module DC {
isOrdinal(): boolean;
xAxisLabel: IBiGetSet<string, number, T>;
yAxisLabel: IBiGetSet<string, number, T>;
y: IGetSet<D3.Scale.GenericQuantitativeScale<any>, T>;
yAxis: IGetSet<D3.Svg.Axis, T>;
y: IGetSet<Scale<number>, T>;
yAxis: IGetSet<d3.svg.Axis, T>;
elasticY: IGetSet<boolean, T>;
renderHorizontalGridLines: IGetSet<boolean, T>;
renderVerticalGridLines: IGetSet<boolean, T>;
@@ -209,7 +219,7 @@ declare module DC {
hideStack(name: string): void;
showStack(name: string): void;
// title(stackName: string, titleFn: Accessor<any, T>);
stackLayout: IGetSet<D3.Layout.StackLayout, T>;
stackLayout: IGetSet<d3.layout.Stack<any[], any>, T>;
}
export interface CapMixin<T> {
@@ -219,7 +229,7 @@ declare module DC {
}
export interface BubbleMixin<T> extends ColorMixin<T> {
r: IGetSet<D3.Scale.GenericQuantitativeScale<any>, T>;
r: IGetSet<Scale<number>, T>;
radiusValueAccessor: IGetSet<Accessor<any, number>, T>;
minRadiusWithLabel: IGetSet<number, T>;
maxBubbleRelativeSize: IGetSet<number, T>;
@@ -295,8 +305,8 @@ declare module DC {
children(): Array<BaseMixin<any>>;
shareColors: IGetSet<boolean, CompositeChart>;
shareTitle: IGetSet<boolean, CompositeChart>;
rightY: IGetSet<D3.Scale.GenericQuantitativeScale<any>, CompositeChart>;
rightYAxis: IGetSet<D3.Svg.Axis, CompositeChart>;
rightY: IGetSet<(n: any) => any, CompositeChart>;
rightYAxis: IGetSet<d3.svg.Axis, CompositeChart>;
}
export interface SeriesChart extends CompositeChart {
@@ -314,9 +324,9 @@ declare module DC {
export interface GeoChoroplethChart extends ColorMixin<GeoChoroplethChart>, BaseMixin<GeoChoroplethChart> {
overlayGeoJson(json: any, name: string, keyAccessor: Accessor<any, any>): void;
projection: IGetSet<D3.Geo.Projection, GeoChoroplethChart>;
projection: IGetSet<d3.geo.Projection, GeoChoroplethChart>;
geoJsons(): Array<GeoChoroplethLayer>;
geoPath(): D3.Geo.Path;
geoPath(): d3.geo.Path;
removeGeoJson(name: string): void;
}
@@ -325,9 +335,9 @@ declare module DC {
}
export interface RowChart extends CapMixin<RowChart>, MarginMixin<RowChart>, ColorMixin<RowChart>, BaseMixin<RowChart> {
x: IGetSet<D3.Scale.GenericQuantitativeScale<any>, RowChart>;
x: IGetSet<Scale<number>, RowChart>;
renderTitleLabel: IGetSet<boolean, RowChart>;
xAxis: IGetSet<D3.Svg.Axis, RowChart>;
xAxis: IGetSet<d3.svg.Axis, RowChart>;
fixedBarHeight: IGetSet<number, RowChart>;
gap: IGetSet<number, RowChart>;
elasticX: IGetSet<boolean, RowChart>;
@@ -338,7 +348,7 @@ declare module DC {
export interface ScatterPlot extends CoordinateGridMixin<ScatterPlot> {
existenceAccessor: IGetSet<Accessor<any, boolean>, ScatterPlot>;
symbol: IGetSet<D3.Svg.Symbol, ScatterPlot>;
symbol: IGetSet<d3.svg.Symbol<any>, ScatterPlot>;
symbolSize: IGetSet<number, ScatterPlot>;
highlightedSize: IGetSet<number, ScatterPlot>;
hiddenSize: IGetSet<number, ScatterPlot>;
@@ -392,7 +402,7 @@ declare module DC {
renderAll(group?: string): void;
redrawAll(group?: string): void;
disableTransitions: boolean;
transition(selections: D3.Selection, duration: number, callback: (s: D3.Selection) => void): void;
transition(selections: d3.Selection<any>, duration: number, callback: (s: d3.Selection<any>) => void): void;
units: Units;
events: Events;
+12 -12
View File
@@ -4873,7 +4873,7 @@ declare module dojo {
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
* @param thisObject Optionalmay be used to scope the call to callback
*/
every(arr: any[], callback: Function, thisObject: Object): boolean;
every(arr: any[], callback: Function, thisObject?: Object): boolean;
/**
* Determines whether or not every item in arr satisfies the
* condition implemented by callback.
@@ -4887,7 +4887,7 @@ declare module dojo {
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
* @param thisObject Optionalmay be used to scope the call to callback
*/
every(arr: String, callback: Function, thisObject: Object): boolean;
every(arr: String, callback: Function, thisObject?: Object): boolean;
/**
* Determines whether or not every item in arr satisfies the
* condition implemented by callback.
@@ -4901,7 +4901,7 @@ declare module dojo {
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
* @param thisObject Optionalmay be used to scope the call to callback
*/
every(arr: any[], callback: String, thisObject: Object): boolean;
every(arr: any[], callback: String, thisObject?: Object): boolean;
/**
* Determines whether or not every item in arr satisfies the
* condition implemented by callback.
@@ -4915,7 +4915,7 @@ declare module dojo {
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
* @param thisObject Optionalmay be used to scope the call to callback
*/
every(arr: String, callback: String, thisObject: Object): boolean;
every(arr: String, callback: String, thisObject?: Object): boolean;
/**
* Returns a new Array with those items from arr that match the
* condition implemented by callback.
@@ -4929,7 +4929,7 @@ declare module dojo {
* @param callback a function that is invoked with three arguments (item,index, array). The return of this function is expected tobe a boolean which determines whether the passed-in itemwill be included in the returned array.
* @param thisObject Optionalmay be used to scope the call to callback
*/
filter(arr: any[], callback: Function, thisObject: Object): any[];
filter(arr: any[], callback: Function, thisObject?: Object): any[];
/**
* Returns a new Array with those items from arr that match the
* condition implemented by callback.
@@ -4943,7 +4943,7 @@ declare module dojo {
* @param callback a function that is invoked with three arguments (item,index, array). The return of this function is expected tobe a boolean which determines whether the passed-in itemwill be included in the returned array.
* @param thisObject Optionalmay be used to scope the call to callback
*/
filter(arr: any[], callback: String, thisObject: Object): any[];
filter(arr: any[], callback: String, thisObject?: Object): any[];
/**
* for every item in arr, callback is invoked. Return values are ignored.
* If you want to break out of the loop, consider using array.every() or array.some().
@@ -5020,7 +5020,7 @@ declare module dojo {
* @param fromIndex Optional
* @param findLast OptionalMakes indexOf() work like lastIndexOf(). Used internally; not meant for external usage.
*/
indexOf(arr: any[], value: Object, fromIndex: number, findLast: boolean): number;
indexOf(arr: any[], value: Object, fromIndex?: number, findLast?: boolean): number;
/**
* locates the last index of the provided value in the passed
* array. If the value is not found, -1 is returned.
@@ -5036,7 +5036,7 @@ declare module dojo {
* @param value
* @param fromIndex Optional
*/
lastIndexOf(arr: any, value: any, fromIndex: number): number;
lastIndexOf(arr: any, value: any, fromIndex?: number): number;
/**
* applies callback to each element of arr and returns
* an Array with the results
@@ -5110,7 +5110,7 @@ declare module dojo {
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
* @param thisObject Optionalmay be used to scope the call to callback
*/
some(arr: any[], callback: Function, thisObject: Object): boolean;
some(arr: any[], callback: Function, thisObject?: Object): boolean;
/**
* Determines whether or not any item in arr satisfies the
* condition implemented by callback.
@@ -5124,7 +5124,7 @@ declare module dojo {
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
* @param thisObject Optionalmay be used to scope the call to callback
*/
some(arr: String, callback: Function, thisObject: Object): boolean;
some(arr: String, callback: Function, thisObject?: Object): boolean;
/**
* Determines whether or not any item in arr satisfies the
* condition implemented by callback.
@@ -5138,7 +5138,7 @@ declare module dojo {
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
* @param thisObject Optionalmay be used to scope the call to callback
*/
some(arr: any[], callback: String, thisObject: Object): boolean;
some(arr: any[], callback: String, thisObject?: Object): boolean;
/**
* Determines whether or not any item in arr satisfies the
* condition implemented by callback.
@@ -5152,7 +5152,7 @@ declare module dojo {
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
* @param thisObject Optionalmay be used to scope the call to callback
*/
some(arr: String, callback: String, thisObject: Object): boolean;
some(arr: String, callback: String, thisObject?: Object): boolean;
}
/**
* Permalink: http://dojotoolkit.org/api/1.9/dojo/_base/connect.html
+19
View File
@@ -0,0 +1,19 @@
/// <reference path="hashids.d.ts" />
/* require hashids */
import Hashids = require("hashids");
/* creating class object */
var hashids = new Hashids("this is my salt");
/* encoding several numbers into one id */
var id = hashids.encode(1337, 5, 77, 12345678);
id = hashids.encode(1337);
id = hashids.encode(45, 434, 1313, 99);
/* decoding that id */
var numbers = hashids.decode(id);
numbers.length > 0 ? true : false;
hashids = new Hashids("this is my salt", 0, "abcdefgh123456789");
hashids = new Hashids("this is my salt", 8);
+36
View File
@@ -0,0 +1,36 @@
// Type definitions for Hashids.js 1.x
// Project: https://github.com/ivanakimov/hashids.node.js
// Definitions by: Paulo Cesar <https://github.com/pocesar/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module Hashids {
export interface IHashids {
new(salt: string, minHashLength?: number, alphabet?: string): IHashids;
version: string;
minAlphabetLength: number;
sepDiv: number;
guardDiv: number;
errorAlphabetLength: string;
errorAlphabetSpace: string;
alphabet: string[];
seps: string;
minHashLength: number;
salt: string;
decode(hash: string): number[];
encode(arg: number): string;
encode(arg: number[]): string;
encode(...args: number[]): string;
encodeHex(str: string): string;
decodeHex(hash: string): string;
hash(input: number, alphabet: string): string;
unhash(input: string[], alphabet: string): number;
}
}
declare module 'hashids' {
var hashids: Hashids.IHashids;
export = hashids;
}
@@ -0,0 +1,132 @@
/// <reference path="imagemagick-native.d.ts" />
/// <reference path="../node/node.d.ts" />
import imagemagick = require('imagemagick-native');
import fs = require('fs');
// Examples
// * Convert formats
// Convert from one format to another with quality control:
fs.writeFileSync('after.png', imagemagick.convert({
srcData: fs.readFileSync('before.jpg'),
format: 'PNG',
quality: 100 // (best) to 1 (worst)
}));
// * Blur
// Blur image:
fs.writeFileSync('after.jpg', imagemagick.convert({
srcData: fs.readFileSync('before.jpg'),
blur: 5
}));
// * Resize
// Resized images by specifying width and height. There are three resizing styles:
// - aspectfill: Default. The resulting image will be exactly the specified size, and may be cropped.
// - aspectfit: Scales the image so that it will not have to be cropped.
// - fill: Squishes or stretches the image so that it fills exactly the specified size.
fs.writeFileSync('after_resize.jpg', imagemagick.convert({
srcData: fs.readFileSync('before_resize.jpg'),
width: 100,
height: 100,
resizeStyle: 'aspectfill', // is the default, or 'aspectfit' or 'fill'
gravity: 'Center' // optional: position crop area when using 'aspectfill'
}));
// * Rotate, flip, and mirror
// Rotate and flip images, and combine the two to mirror:
fs.writeFileSync('after_rotateflip.jpg', imagemagick.convert({
srcData: fs.readFileSync('before_rotateflip.jpg'),
rotate: 180,
flip: true
}));
// API Reference
// * convert(options, [callback])
// Convert a buffer provided as options.srcData and return a Buffer.
var options = {
srcData: fs.readFileSync('source.jpg'),
srcFormat: 'jpeg',
quality: 90,
trim: true,
trimFuzz: 0.25,
width: 100,
height: 100,
density: 96,
resizeStyle: 'aspectfill',
gravity: 'NorthWest',
format: 'png',
filter: 'Lnaczos',
blur: 3,
strip: true,
rotate: 30,
flip: true,
debug: true,
ignoreWarnings: false
};
imagemagick.convert(options, (err: any, buffer: Buffer) => {
// check err, use buffer
});
fs.createReadStream('input.png')
.pipe(imagemagick.streams.convert({
quality: 75,
width: 160,
height: 160
}))
.pipe(fs.createWriteStream('output.png'));
// * identify(options, [callback])
// Identify a buffer provided as srcData and return an object.
imagemagick.identify({
srcData: fs.readFileSync('target.jpg'),
debug: true,
ignoreWarnings: false
}, (err: any, result: imagemagick.IIdentifyResult) => {
// check err, use result
});
// * quantizeColors(options)
// Quantize the image to a specified amount of colors from a buffer provided as srcData and return an array.
var colors = imagemagick.quantizeColors({
srcData: fs.readFileSync('target.jpg'),
colors: 3,
debug: true,
ignoreWarnings: false
});
// * composite(options, [callback])
// Composite a buffer provided as options.compositeData on a buffer provided as options.srcData with gravity specified by options.gravity and return a Buffer
imagemagick.composite({
srcData: fs.readFileSync('target.jpg'),
compositeData: fs.readFileSync('composite.jpg'),
gravity: 'NorthWestGravity',
debug: true,
ignoreWarnings: false
}, (err: any, buffer: Buffer) => {
// check err, use buffer
});
// * getConstPixels(options)
// Get pixels of provided rectangular region.
var pixels = imagemagick.getConstPixels({
srcData: fs.readFileSync('target.jpg'),
x: 0,
y: 0,
columns: 1,
rows: 1
});
// * quantumDepth
// Return ImageMagick's QuantumDepth, which is defined in compile time.
var depth: number = imagemagick.quantumDepth();
// * version
// Return ImageMagick's version as string.
var version: string = imagemagick.version();
+117
View File
@@ -0,0 +1,117 @@
// Type definitions for imagemagick-native 1.7.0
// Project: https://www.npmjs.org/package/imagemagick-native
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "imagemagick-native" {
import stream = require('stream');
export module streams {
export function convert(options: IStreamConvertOptions): stream.Transform;
}
function convert(options: IConvertOptions): Buffer;
function convert(options: IConvertOptions, callback: (err: any, result: Buffer) => void): void;
function identify(options: IIdentifyOptions): IIdentifyResult;
function identify(options: IIdentifyOptions, callback: (err: any, result: IIdentifyResult) => void): void;
function quantizeColors(options: IQuantizeColorsOptions): IQuantizeColorsItem[];
function composite(options: ICompositeOptions): Buffer;
function composite(options: ICompositeOptions, callback: (err: any, result: Buffer) => void): void;
function getConstPixels(options: IConstPixelsOptions): IConstPixelsItem[];
function quantumDepth(): number;
function version(): string;
export interface IStreamConvertOptions {
srcFormat?: string;
quality?: number;
trim?: boolean;
trimFuzz?: number;
width?: number;
height?: number;
density?: number;
resizeStyle?: string;
gravity?: string;
format?: string;
filter?: string;
blur?: number;
strip?: boolean;
rotate?: number;
flip?: boolean;
debug?: boolean;
ignoreWarnings?: boolean;
}
export interface IConvertOptions {
srcData: Buffer;
srcFormat?: string;
quality?: number;
trim?: boolean;
trimFuzz?: number;
width?: number;
height?: number;
density?: number;
resizeStyle?: string;
gravity?: string;
format?: string;
filter?: string;
blur?: number;
strip?: boolean;
rotate?: number;
flip?: boolean;
debug?: boolean;
ignoreWarnings?: boolean;
}
export interface IIdentifyOptions {
srcData: Buffer;
debug?: boolean;
ignoreWarnings?: boolean;
}
export interface IIdentifyResult {
format: string;
width: number;
height: number;
depth: number;
density : {
width : number;
height : number;
};
exif: {
orientation: number; // 0 if none exists or e.g. 3 (portrait iPad pictures)
};
}
export interface IQuantizeColorsOptions {
srcData: Buffer;
colors: number;
debug?: boolean;
ignoreWarnings?: boolean;
}
export interface IQuantizeColorsItem {
r: number;
g: number;
b: number;
hex: string;
}
export interface ICompositeOptions {
srcData: Buffer;
compositeData: Buffer;
gravity?: string;
debug?: boolean;
ignoreWarnings?: boolean;
}
export interface IConstPixelsOptions {
srcData: Buffer;
x: number;
y: number;
columns: number;
rows: number;
}
export interface IConstPixelsItem {
red: number;
green: number;
blue: number;
opacity: number;
}
}
+2
View File
@@ -922,6 +922,8 @@ result = <string[]>_.methods(_);
result = <_.LoDashArrayWrapper<string>>_(_).functions();
result = <_.LoDashArrayWrapper<string>>_(_).methods();
result = <number>_.get({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
result = <boolean>_.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
interface FirstSecond {
+16
View File
@@ -5836,6 +5836,22 @@ declare module _ {
methods(): _.LoDashArrayWrapper<string>;
}
//_.get
interface LoDashStatic {
/**
* Gets the property value at path of object. If the resolved
* value is undefined the defaultValue is used in its place.
* @param object The object to query.
* @param path The path of the property to get.
* @param defaultValue The value returned if the resolved value is undefined.
* @return Returns the resolved value.
**/
get<T>(object : Object,
path:string|string[],
defaultValue?:T
): T;
}
//_.has
interface LoDashStatic {
/**
+3 -3
View File
@@ -6,7 +6,7 @@
///<reference path="../jquery/jquery.d.ts" />
///<reference path="maskedinput.d.ts" />
$("#test").inputmask("9:000");
$("#test").inputmask("9:000", { numeric: true });
$("#test").mask("9:000");
$("#test").mask("9:000", { numeric: true });
var alies = $.inputmask.defaults.aliases;
var alies = $.mask.defaults.aliases;
+3 -3
View File
@@ -47,9 +47,9 @@ interface MaskedInputDefaults {
}
interface JQueryStatic {
inputmask: MaskedInputStatic;
mask: MaskedInputStatic;
}
interface JQuery {
inputmask(mask: string, options?: JQueryMaskedInputOptions): JQuery;
}
mask(mask: string, options?: JQueryMaskedInputOptions): JQuery;
}
+1 -1
View File
@@ -19,7 +19,7 @@ function test3() {
var sock = zmq.socket('push');
sock.bindSync('tcp://127.0.0.1:3000');
sock.send(['hello', 'world']);
sock.on('message', function (buffer: Buffer) {
sock.on('message', function (buffer1: Buffer, buffer2: Buffer) {
//
});
}
+1 -1
View File
@@ -182,7 +182,7 @@ declare module 'zmq' {
* @param eventName {string}
* @param callback {Function}
*/
on(eventName: string, callback: (buffer: Buffer) => void): void;
on(eventName: string, callback: (...buffer: Buffer[]) => void): void;
// Socket Options
_fd: any;
+1 -1
View File
@@ -173,7 +173,7 @@ interface ResourceResponse {
interface ResourceRequest {
id: number;
method: string;
ur: string;
url: string;
time: Date;
headers: { [name: string]: string; };
}
+21
View File
@@ -0,0 +1,21 @@
/// <reference path="pty.js.d.ts" />
import pty = require('pty.js');
var term: pty.Terminal = pty.spawn('bash', [], {
name: 'xterm-color',
cols: 80,
rows: 30,
cwd: process.env.HOME,
env: process.env
});
term.on('data', function(data: any) {
console.log(data);
});
term.write('ls\r');
term.resize(100, 40);
term.write('ls /\r');
console.log(term.process);
+133
View File
@@ -0,0 +1,133 @@
// Type definitions for pty.js 0.2.7-1
// Project: https://github.com/chjj/pty.js
// Definitions by: Vadim Macagon <https://github.com/enlight/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module 'pty.js' {
/** Options that can be used when creating a new pseudo-terminal. */
interface TerminalOptions {
name?: string;
cols?: number;
rows?: number;
cwd?: string;
env?: any;
uid?: number;
gid?: number;
}
import stream = require('stream');
import net = require('net');
export class Terminal implements stream.Stream {
/** Read-only name of the terminal. */
name: string;
/** Read-only number of columns in the terminal. */
cols: number;
/** Read-only number of rows in the terminal. */
rows: number;
/**
* Read-only identifier of the spawned process associated with the slave end of the
* pseudo-terminal. This will be null if the terminal was created via [[Terminal.open]].
*/
pid: number;
/** Read-only file descriptor of the master end of the pseudo-terminal. */
fd: number;
/** Read-only name of the slave end of the pseudo-terminal. */
pty: string;
/** Read-only filename of the executable associated with the slave end of the pseudo-terminal. */
file: string;
/** Read-only name of the process associated with the slave end of the pseudo-terminal. */
process: string;
stdout: Terminal;
/** Note that an exception will be thrown if an attempt is made to access this property. */
stderr: Terminal;
stdin: Terminal;
socket: net.Socket;
/**
* Creates a new pseudo-terminal, spawns a child process, and associates it with the slave
* end of the pseudo-terminal.
*/
constructor(file?: string, args?: string[], opt?: TerminalOptions);
resize(cols?: number, rows?: number): void;
/**
* Sends a signal to the spawned process associated with the slave end of the
* pseudo-terminal (this only works if [[pid]] is not null).
*/
kill(signal?: string): void;
redraw(): void;
// NodeJS Socket-like interface (wrappers for this.socket)
write(data: any): boolean;
end(data: any): void;
pause(): void;
resume(): void;
setEncoding(encoding: string): void;
/**
* Closes the master end of the pseudo-terminal, and attempts to kill the spawned process
* associated with the slave end of the pseudo-terminal (but only if [[pid]] is not null).
*/
destroy(): void;
// NodeJS Stream interface
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
// NodeJS EventEmitter interface
addListener(event: string, listener: Function): NodeJS.EventEmitter;
on(event: string, listener: Function): NodeJS.EventEmitter;
once(event: string, listener: Function): NodeJS.EventEmitter;
removeListener(event: string, listener: Function): NodeJS.EventEmitter;
removeAllListeners(event?: string): NodeJS.EventEmitter;
// NOTE: this method is not actually defined in pty.js
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
}
/**
* Creates a new pseudo-terminal, spawns a child process, and associates it with the slave
* end of the pseudo-terminal.
*/
export function createTerminal(file?: string, args?: string[], opt?: TerminalOptions): Terminal;
/** Alias for [[createTerminal]]. */
export function fork(file?: string, args?: string[], opt?: TerminalOptions): Terminal;
/** Alias for [[createTerminal]]. */
export function spawn(file?: string, args?: string[], opt?: TerminalOptions): Terminal;
/**
* Creates a new pseudo-terminal.
* This function is not available on Windows, use [[fork]] there instead.
*/
export function open(opt?: { cols?: number; rows?: number }): Terminal;
// Internal stuff that probably isn't very useful but is exported by pty.js
export module native {
/** Unix-only. */
export function fork(
file: string, args: string[], env: any, cwd: string, cols: number, rows: number,
uid?: number, gid?: number
): { fd: number; pid: number; pty: string };
/** Unix-only. */
export function open(
cols: number, rows: number
): { master: number; slave: number; pty: string };
/** Unix-only. */
export function process(fd: number, tty: string): string;
/** Windows-only. */
export function open(
dataPipe: string, cols: number, rows: number, debug: boolean
): { pid: number; pty: number; fd: number };
/** Windows-only. */
export function startProcess(
pid: number, file: string, cmdline: string, env: string[], cwd: string
): void;
/** Windows-only. */
export function kill(pid: number): void;
export function resize(fd: number, cols: number, rows: number): void;
}
}
+7 -6
View File
@@ -1,10 +1,11 @@
# React v0.13.0 Type Definitions
# React v0.13.3 Type Definitions
This folder contains the following `.d.ts` files:
* `react-0.13.0.d.ts` declares the external module `"react"`
* `react-addons-0.13.0.d.ts` declares the external module `"react/addons"`
* `react-global-0.13.0.d.ts` declares the internal module `React` in the global namespace
* `react-addons-global-0.13.0.d.ts` extends the global `React` module with `addons`
* `react.d.ts` declares the external module `"react"`
* `react-addons.d.ts` declares the external module `"react/addons"`
* `react-global.d.ts` declares the internal module `React` in the global namespace
* `react-addons-global.d.ts` extends the global `React` module with `addons`
Interfaces are duplicated between these files; please take care to keep them in sync when making changes. See [#3615](https://github.com/borisyankov/DefinitelyTyped/pull/3615) for relevant discussion.
Interfaces are duplicated between these files; please take care to keep them in sync when making changes.
See [#3615](https://github.com/borisyankov/DefinitelyTyped/pull/3615) for relevant discussion.
+93 -82
View File
@@ -9,33 +9,39 @@ declare module React {
// React.addons
// ----------------------------------------------------------------------
export var addons: {
CSSTransitionGroup: CSSTransitionGroup;
LinkedStateMixin: LinkedStateMixin;
PureRenderMixin: PureRenderMixin;
TransitionGroup: TransitionGroup;
export module addons {
export var CSSTransitionGroup: CSSTransitionGroup;
export var TransitionGroup: TransitionGroup;
batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
batchedUpdates<A>(callback: (a: A) => any, a: A): void;
batchedUpdates(callback: () => any): void;
export var LinkedStateMixin: LinkedStateMixin;
export var PureRenderMixin: PureRenderMixin;
export function batchedUpdates<A, B>(
callback: (a: A, b: B) => any, a: A, b: B): void;
export function batchedUpdates<A>(callback: (a: A) => any, a: A): void;
export function batchedUpdates(callback: () => any): void;
// deprecated: use petehunt/react-classset or JedWatson/classnames
classSet(cx: { [key: string]: boolean }): string;
classSet(...classList: string[]): string;
export function classSet(cx: { [key: string]: boolean }): string;
export function classSet(...classList: string[]): string;
cloneWithProps<P>(element: DOMElement<P>, props: P): DOMElement<P>;
cloneWithProps<P>(element: ClassicElement<P>, props: P): ClassicElement<P>;
cloneWithProps<P>(element: ReactElement<P>, props: P): ReactElement<P>;
export function cloneWithProps<P>(
element: DOMElement<P>, props: P): DOMElement<P>;
export function cloneWithProps<P>(
element: ClassicElement<P>, props: P): ClassicElement<P>;
export function cloneWithProps<P>(
element: ReactElement<P>, props: P): ReactElement<P>;
createFragment(object: { [key: string]: ReactNode }): ReactFragment;
export function createFragment(
object: { [key: string]: ReactNode }): ReactFragment;
update(value: any[], spec: UpdateArraySpec): any[];
update(value: {}, spec: UpdateSpec): any;
export function update(value: any[], spec: UpdateArraySpec): any[];
export function update(value: {}, spec: UpdateSpec): any;
// Development tools
Perf: ReactPerf;
TestUtils: ReactTestUtils;
};
export import Perf = ReactPerf;
export import TestUtils = ReactTestUtils;
}
//
// React.addons (Transitions)
@@ -114,14 +120,14 @@ declare module React {
totalTime: number;
}
interface ReactPerf {
start(): void;
stop(): void;
printInclusive(measurements: Measurements[]): void;
printExclusive(measurements: Measurements[]): void;
printWasted(measurements: Measurements[]): void;
printDOM(measurements: Measurements[]): void;
getLastMeasurements(): Measurements[];
module ReactPerf {
export function start(): void;
export function stop(): void;
export function printInclusive(measurements: Measurements[]): void;
export function printExclusive(measurements: Measurements[]): void;
export function printWasted(measurements: Measurements[]): void;
export function printDOM(measurements: Measurements[]): void;
export function getLastMeasurements(): Measurements[];
}
//
@@ -132,55 +138,59 @@ declare module React {
new(): any;
}
interface ReactTestUtils {
Simulate: Simulate;
module ReactTestUtils {
export import Simulate = ReactSimulate;
renderIntoDocument<P>(element: ReactElement<P>): Component<P, any>;
renderIntoDocument<C extends Component<any, any>>(element: ReactElement<any>): C;
export function renderIntoDocument<P>(
element: ReactElement<P>): Component<P, any>;
export function renderIntoDocument<C extends Component<any, any>>(
element: ReactElement<any>): C;
mockComponent(mocked: MockedComponentClass, mockTagName?: string): ReactTestUtils;
export function mockComponent(
mocked: MockedComponentClass, mockTagName?: string): typeof ReactTestUtils;
isElementOfType(element: ReactElement<any>, type: ReactType): boolean;
isTextComponent(instance: Component<any, any>): boolean;
isDOMComponent(instance: Component<any, any>): boolean;
isCompositeComponent(instance: Component<any, any>): boolean;
isCompositeComponentWithType(
export function isElementOfType(
element: ReactElement<any>, type: ReactType): boolean;
export function isTextComponent(instance: Component<any, any>): boolean;
export function isDOMComponent(instance: Component<any, any>): boolean;
export function isCompositeComponent(instance: Component<any, any>): boolean;
export function isCompositeComponentWithType(
instance: Component<any, any>,
type: ComponentClass<any>): boolean;
findAllInRenderedTree(
export function findAllInRenderedTree(
tree: Component<any, any>,
fn: (i: Component<any, any>) => boolean): Component<any, any>;
scryRenderedDOMComponentsWithClass(
export function scryRenderedDOMComponentsWithClass(
tree: Component<any, any>,
className: string): DOMComponent<any>[];
findRenderedDOMComponentWithClass(
export function findRenderedDOMComponentWithClass(
tree: Component<any, any>,
className: string): DOMComponent<any>;
scryRenderedDOMComponentsWithTag(
export function scryRenderedDOMComponentsWithTag(
tree: Component<any, any>,
tagName: string): DOMComponent<any>[];
findRenderedDOMComponentWithTag(
export function findRenderedDOMComponentWithTag(
tree: Component<any, any>,
tagName: string): DOMComponent<any>;
scryRenderedComponentsWithType<P>(
export function scryRenderedComponentsWithType<P>(
tree: Component<any, any>,
type: ComponentClass<P>): Component<P, {}>[];
scryRenderedComponentsWithType<C extends Component<any, any>>(
export function scryRenderedComponentsWithType<C extends Component<any, any>>(
tree: Component<any, any>,
type: ComponentClass<any>): C[];
findRenderedComponentWithType<P>(
export function findRenderedComponentWithType<P>(
tree: Component<any, any>,
type: ComponentClass<P>): Component<P, {}>;
findRenderedComponentWithType<C extends Component<any, any>>(
export function findRenderedComponentWithType<C extends Component<any, any>>(
tree: Component<any, any>,
type: ComponentClass<any>): C;
createRenderer(): ShallowRenderer;
export function createRenderer(): ShallowRenderer;
}
interface SyntheticEventData {
@@ -222,44 +232,45 @@ declare module React {
(component: Component<any, any>, eventData?: SyntheticEventData): void;
}
interface Simulate {
blur: EventSimulator;
change: EventSimulator;
click: EventSimulator;
cut: EventSimulator;
doubleClick: EventSimulator;
drag: EventSimulator;
dragEnd: EventSimulator;
dragEnter: EventSimulator;
dragExit: EventSimulator;
dragLeave: EventSimulator;
dragOver: EventSimulator;
dragStart: EventSimulator;
drop: EventSimulator;
focus: EventSimulator;
input: EventSimulator;
keyDown: EventSimulator;
keyPress: EventSimulator;
keyUp: EventSimulator;
mouseDown: EventSimulator;
mouseEnter: EventSimulator;
mouseLeave: EventSimulator;
mouseMove: EventSimulator;
mouseOut: EventSimulator;
mouseOver: EventSimulator;
mouseUp: EventSimulator;
paste: EventSimulator;
scroll: EventSimulator;
submit: EventSimulator;
touchCancel: EventSimulator;
touchEnd: EventSimulator;
touchMove: EventSimulator;
touchStart: EventSimulator;
wheel: EventSimulator;
module ReactSimulate {
export var blur: EventSimulator;
export var change: EventSimulator;
export var click: EventSimulator;
export var cut: EventSimulator;
export var doubleClick: EventSimulator;
export var drag: EventSimulator;
export var dragEnd: EventSimulator;
export var dragEnter: EventSimulator;
export var dragExit: EventSimulator;
export var dragLeave: EventSimulator;
export var dragOver: EventSimulator;
export var dragStart: EventSimulator;
export var drop: EventSimulator;
export var focus: EventSimulator;
export var input: EventSimulator;
export var keyDown: EventSimulator;
export var keyPress: EventSimulator;
export var keyUp: EventSimulator;
export var mouseDown: EventSimulator;
export var mouseEnter: EventSimulator;
export var mouseLeave: EventSimulator;
export var mouseMove: EventSimulator;
export var mouseOut: EventSimulator;
export var mouseOver: EventSimulator;
export var mouseUp: EventSimulator;
export var paste: EventSimulator;
export var scroll: EventSimulator;
export var submit: EventSimulator;
export var touchCancel: EventSimulator;
export var touchEnd: EventSimulator;
export var touchMove: EventSimulator;
export var touchStart: EventSimulator;
export var wheel: EventSimulator;
}
class ShallowRenderer {
getRenderOutput<C extends Component<any, any>>(): C;
getRenderOutput<E extends ReactElement<any>>(): E;
getRenderOutput(): ReactElement<any>;
render(element: ReactElement<any>, context?: any): void;
unmount(): void;
}
+8 -6
View File
@@ -1,6 +1,8 @@
/// <reference path="react-addons.d.ts" />
import React = require("react/addons");
import TestUtils = React.addons.TestUtils;
interface Props extends React.Props<MyComponent> {
hello: string;
world?: string;
@@ -397,12 +399,12 @@ React.createFactory(React.addons.CSSTransitionGroup)({
// --------------------------------------------------------------------------
var node: Element;
React.addons.TestUtils.Simulate.click(node);
React.addons.TestUtils.Simulate.change(node);
React.addons.TestUtils.Simulate.keyDown(node, { key: "Enter" });
TestUtils.Simulate.click(node);
TestUtils.Simulate.change(node);
TestUtils.Simulate.keyDown(node, { key: "Enter" });
var renderer: React.ShallowRenderer =
React.addons.TestUtils.createRenderer();
TestUtils.createRenderer();
renderer.render(React.createElement(Timer));
var output: Timer = renderer.getRenderOutput<Timer>();
var output: React.ReactElement<React.Props<Timer>> =
renderer.getRenderOutput();
+105 -84
View File
@@ -435,10 +435,16 @@ declare module "react/addons" {
draggable?: boolean;
encType?: string;
form?: string;
formAction?: string;
formEncType?: string;
formMethod?: string;
formNoValidate?: boolean;
formTarget?: string;
frameBorder?: number | string;
headers?: string;
height?: number | string;
hidden?: boolean;
high?: number;
href?: string;
hrefLang?: string;
htmlFor?: string;
@@ -449,7 +455,10 @@ declare module "react/addons" {
lang?: string;
list?: string;
loop?: boolean;
low?: number;
manifest?: string;
marginHeight?: number;
marginWidth?: number;
max?: number | string;
maxLength?: number;
media?: string;
@@ -461,6 +470,7 @@ declare module "react/addons" {
name?: string;
noValidate?: boolean;
open?: boolean;
optimum?: number;
pattern?: string;
placeholder?: string;
poster?: string;
@@ -474,9 +484,8 @@ declare module "react/addons" {
rowSpan?: number;
sandbox?: string;
scope?: string;
scrollLeft?: number;
scoped?: boolean;
scrolling?: string;
scrollTop?: number;
seamless?: boolean;
selected?: boolean;
shape?: string;
@@ -506,6 +515,7 @@ declare module "react/addons" {
itemProp?: string;
itemScope?: boolean;
itemType?: string;
unselectable?: boolean;
}
interface SVGAttributes extends DOMAttributes {
@@ -744,33 +754,39 @@ declare module "react/addons" {
// React.addons
// ----------------------------------------------------------------------
export var addons: {
CSSTransitionGroup: CSSTransitionGroup;
LinkedStateMixin: LinkedStateMixin;
PureRenderMixin: PureRenderMixin;
TransitionGroup: TransitionGroup;
export module addons {
export var CSSTransitionGroup: CSSTransitionGroup;
export var TransitionGroup: TransitionGroup;
batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
batchedUpdates<A>(callback: (a: A) => any, a: A): void;
batchedUpdates(callback: () => any): void;
export var LinkedStateMixin: LinkedStateMixin;
export var PureRenderMixin: PureRenderMixin;
export function batchedUpdates<A, B>(
callback: (a: A, b: B) => any, a: A, b: B): void;
export function batchedUpdates<A>(callback: (a: A) => any, a: A): void;
export function batchedUpdates(callback: () => any): void;
// deprecated: use petehunt/react-classset or JedWatson/classnames
classSet(cx: { [key: string]: boolean }): string;
classSet(...classList: string[]): string;
export function classSet(cx: { [key: string]: boolean }): string;
export function classSet(...classList: string[]): string;
cloneWithProps<P>(element: DOMElement<P>, props: P): DOMElement<P>;
cloneWithProps<P>(element: ClassicElement<P>, props: P): ClassicElement<P>;
cloneWithProps<P>(element: ReactElement<P>, props: P): ReactElement<P>;
export function cloneWithProps<P>(
element: DOMElement<P>, props: P): DOMElement<P>;
export function cloneWithProps<P>(
element: ClassicElement<P>, props: P): ClassicElement<P>;
export function cloneWithProps<P>(
element: ReactElement<P>, props: P): ReactElement<P>;
createFragment(object: { [key: string]: ReactNode }): ReactFragment;
export function createFragment(
object: { [key: string]: ReactNode }): ReactFragment;
update(value: any[], spec: UpdateArraySpec): any[];
update(value: {}, spec: UpdateSpec): any;
export function update(value: any[], spec: UpdateArraySpec): any[];
export function update(value: {}, spec: UpdateSpec): any;
// Development tools
Perf: ReactPerf;
TestUtils: ReactTestUtils;
};
export import Perf = ReactPerf;
export import TestUtils = ReactTestUtils;
}
//
// React.addons (Transitions)
@@ -849,14 +865,14 @@ declare module "react/addons" {
totalTime: number;
}
interface ReactPerf {
start(): void;
stop(): void;
printInclusive(measurements: Measurements[]): void;
printExclusive(measurements: Measurements[]): void;
printWasted(measurements: Measurements[]): void;
printDOM(measurements: Measurements[]): void;
getLastMeasurements(): Measurements[];
module ReactPerf {
export function start(): void;
export function stop(): void;
export function printInclusive(measurements: Measurements[]): void;
export function printExclusive(measurements: Measurements[]): void;
export function printWasted(measurements: Measurements[]): void;
export function printDOM(measurements: Measurements[]): void;
export function getLastMeasurements(): Measurements[];
}
//
@@ -867,55 +883,59 @@ declare module "react/addons" {
new(): any;
}
interface ReactTestUtils {
Simulate: Simulate;
module ReactTestUtils {
export import Simulate = ReactSimulate;
renderIntoDocument<P>(element: ReactElement<P>): Component<P, any>;
renderIntoDocument<C extends Component<any, any>>(element: ReactElement<any>): C;
export function renderIntoDocument<P>(
element: ReactElement<P>): Component<P, any>;
export function renderIntoDocument<C extends Component<any, any>>(
element: ReactElement<any>): C;
mockComponent(mocked: MockedComponentClass, mockTagName?: string): ReactTestUtils;
export function mockComponent(
mocked: MockedComponentClass, mockTagName?: string): typeof ReactTestUtils;
isElementOfType(element: ReactElement<any>, type: ReactType): boolean;
isTextComponent(instance: Component<any, any>): boolean;
isDOMComponent(instance: Component<any, any>): boolean;
isCompositeComponent(instance: Component<any, any>): boolean;
isCompositeComponentWithType(
export function isElementOfType(
element: ReactElement<any>, type: ReactType): boolean;
export function isTextComponent(instance: Component<any, any>): boolean;
export function isDOMComponent(instance: Component<any, any>): boolean;
export function isCompositeComponent(instance: Component<any, any>): boolean;
export function isCompositeComponentWithType(
instance: Component<any, any>,
type: ComponentClass<any>): boolean;
findAllInRenderedTree(
export function findAllInRenderedTree(
tree: Component<any, any>,
fn: (i: Component<any, any>) => boolean): Component<any, any>;
scryRenderedDOMComponentsWithClass(
export function scryRenderedDOMComponentsWithClass(
tree: Component<any, any>,
className: string): DOMComponent<any>[];
findRenderedDOMComponentWithClass(
export function findRenderedDOMComponentWithClass(
tree: Component<any, any>,
className: string): DOMComponent<any>;
scryRenderedDOMComponentsWithTag(
export function scryRenderedDOMComponentsWithTag(
tree: Component<any, any>,
tagName: string): DOMComponent<any>[];
findRenderedDOMComponentWithTag(
export function findRenderedDOMComponentWithTag(
tree: Component<any, any>,
tagName: string): DOMComponent<any>;
scryRenderedComponentsWithType<P>(
export function scryRenderedComponentsWithType<P>(
tree: Component<any, any>,
type: ComponentClass<P>): Component<P, {}>[];
scryRenderedComponentsWithType<C extends Component<any, any>>(
export function scryRenderedComponentsWithType<C extends Component<any, any>>(
tree: Component<any, any>,
type: ComponentClass<any>): C[];
findRenderedComponentWithType<P>(
export function findRenderedComponentWithType<P>(
tree: Component<any, any>,
type: ComponentClass<P>): Component<P, {}>;
findRenderedComponentWithType<C extends Component<any, any>>(
export function findRenderedComponentWithType<C extends Component<any, any>>(
tree: Component<any, any>,
type: ComponentClass<any>): C;
createRenderer(): ShallowRenderer;
export function createRenderer(): ShallowRenderer;
}
interface SyntheticEventData {
@@ -957,44 +977,45 @@ declare module "react/addons" {
(component: Component<any, any>, eventData?: SyntheticEventData): void;
}
interface Simulate {
blur: EventSimulator;
change: EventSimulator;
click: EventSimulator;
cut: EventSimulator;
doubleClick: EventSimulator;
drag: EventSimulator;
dragEnd: EventSimulator;
dragEnter: EventSimulator;
dragExit: EventSimulator;
dragLeave: EventSimulator;
dragOver: EventSimulator;
dragStart: EventSimulator;
drop: EventSimulator;
focus: EventSimulator;
input: EventSimulator;
keyDown: EventSimulator;
keyPress: EventSimulator;
keyUp: EventSimulator;
mouseDown: EventSimulator;
mouseEnter: EventSimulator;
mouseLeave: EventSimulator;
mouseMove: EventSimulator;
mouseOut: EventSimulator;
mouseOver: EventSimulator;
mouseUp: EventSimulator;
paste: EventSimulator;
scroll: EventSimulator;
submit: EventSimulator;
touchCancel: EventSimulator;
touchEnd: EventSimulator;
touchMove: EventSimulator;
touchStart: EventSimulator;
wheel: EventSimulator;
module ReactSimulate {
export var blur: EventSimulator;
export var change: EventSimulator;
export var click: EventSimulator;
export var cut: EventSimulator;
export var doubleClick: EventSimulator;
export var drag: EventSimulator;
export var dragEnd: EventSimulator;
export var dragEnter: EventSimulator;
export var dragExit: EventSimulator;
export var dragLeave: EventSimulator;
export var dragOver: EventSimulator;
export var dragStart: EventSimulator;
export var drop: EventSimulator;
export var focus: EventSimulator;
export var input: EventSimulator;
export var keyDown: EventSimulator;
export var keyPress: EventSimulator;
export var keyUp: EventSimulator;
export var mouseDown: EventSimulator;
export var mouseEnter: EventSimulator;
export var mouseLeave: EventSimulator;
export var mouseMove: EventSimulator;
export var mouseOut: EventSimulator;
export var mouseOver: EventSimulator;
export var mouseUp: EventSimulator;
export var paste: EventSimulator;
export var scroll: EventSimulator;
export var submit: EventSimulator;
export var touchCancel: EventSimulator;
export var touchEnd: EventSimulator;
export var touchMove: EventSimulator;
export var touchStart: EventSimulator;
export var wheel: EventSimulator;
}
class ShallowRenderer {
getRenderOutput<C extends Component<any, any>>(): C;
getRenderOutput<E extends ReactElement<any>>(): E;
getRenderOutput(): ReactElement<any>;
render(element: ReactElement<any>, context?: any): void;
unmount(): void;
}
+12 -2
View File
@@ -435,10 +435,16 @@ declare module React {
draggable?: boolean;
encType?: string;
form?: string;
formAction?: string;
formEncType?: string;
formMethod?: string;
formNoValidate?: boolean;
formTarget?: string;
frameBorder?: number | string;
headers?: string;
height?: number | string;
hidden?: boolean;
high?: number;
href?: string;
hrefLang?: string;
htmlFor?: string;
@@ -449,7 +455,10 @@ declare module React {
lang?: string;
list?: string;
loop?: boolean;
low?: number;
manifest?: string;
marginHeight?: number;
marginWidth?: number;
max?: number | string;
maxLength?: number;
media?: string;
@@ -461,6 +470,7 @@ declare module React {
name?: string;
noValidate?: boolean;
open?: boolean;
optimum?: number;
pattern?: string;
placeholder?: string;
poster?: string;
@@ -474,9 +484,8 @@ declare module React {
rowSpan?: number;
sandbox?: string;
scope?: string;
scrollLeft?: number;
scoped?: boolean;
scrolling?: string;
scrollTop?: number;
seamless?: boolean;
selected?: boolean;
shape?: string;
@@ -506,6 +515,7 @@ declare module React {
itemProp?: string;
itemScope?: boolean;
itemType?: string;
unselectable?: boolean;
}
interface SVGAttributes extends DOMAttributes {
+12 -2
View File
@@ -435,10 +435,16 @@ declare module "react" {
draggable?: boolean;
encType?: string;
form?: string;
formAction?: string;
formEncType?: string;
formMethod?: string;
formNoValidate?: boolean;
formTarget?: string;
frameBorder?: number | string;
headers?: string;
height?: number | string;
hidden?: boolean;
high?: number;
href?: string;
hrefLang?: string;
htmlFor?: string;
@@ -449,7 +455,10 @@ declare module "react" {
lang?: string;
list?: string;
loop?: boolean;
low?: number;
manifest?: string;
marginHeight?: number;
marginWidth?: number;
max?: number | string;
maxLength?: number;
media?: string;
@@ -461,6 +470,7 @@ declare module "react" {
name?: string;
noValidate?: boolean;
open?: boolean;
optimum?: number;
pattern?: string;
placeholder?: string;
poster?: string;
@@ -474,9 +484,8 @@ declare module "react" {
rowSpan?: number;
sandbox?: string;
scope?: string;
scrollLeft?: number;
scoped?: boolean;
scrolling?: string;
scrollTop?: number;
seamless?: boolean;
selected?: boolean;
shape?: string;
@@ -506,6 +515,7 @@ declare module "react" {
itemProp?: string;
itemScope?: boolean;
itemType?: string;
unselectable?: boolean;
}
interface SVGAttributes extends DOMAttributes {
+3
View File
@@ -197,3 +197,6 @@ interface Toastr {
}
declare var toastr: Toastr;
declare module "toastr" {
export = toastr;
}