mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-10 11:40:16 +08:00
Merge branch 'master' of github.com:DefinitelyTyped/DefinitelyTyped
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
/// <reference path="./abs.d.ts" />
|
||||
|
||||
import Abs from 'abs';
|
||||
|
||||
const x: string = Abs('/foo');
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Type definitions for abs 1.1.0
|
||||
// Project: https://github.com/IonicaBizau/node-abs
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "abs" {
|
||||
/**
|
||||
* Compute the absolute path of an input.
|
||||
* @param input The input path.
|
||||
*/
|
||||
function Abs(input: string): string;
|
||||
|
||||
export default Abs;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/// <reference path="./absolute.d.ts" />
|
||||
|
||||
import absolute from 'absolute';
|
||||
|
||||
const x: boolean = absolute('/home/foo');
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// Type definitions for absolute 0.0.1
|
||||
// Project: https://github.com/bahamas10/node-absolute
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "absolute" {
|
||||
/**
|
||||
* Test if a path is absolute
|
||||
*/
|
||||
function absolute(path: string): boolean;
|
||||
|
||||
export default absolute;
|
||||
}
|
||||
@@ -0,0 +1,723 @@
|
||||
/// <reference path="cal-heatmap.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="../d3/d3.d.ts" />
|
||||
|
||||
var cal = new CalHeatMap();
|
||||
cal.init();
|
||||
cal.init({});
|
||||
|
||||
cal.init({ itemSelector: "div" });
|
||||
cal.init({ itemSelector: "#id" });
|
||||
cal.init({ itemSelector: ".class" });
|
||||
cal.init({ itemSelector: "[title=hi]" });
|
||||
cal.init({ itemSelector: "div > span + b" });
|
||||
|
||||
cal.init({ itemSelector: document.getElementById("myId") });
|
||||
cal.init({ itemSelector: document.getElementsByClassName(".class")[0] });
|
||||
cal.init({ itemSelector: document.querySelector(".class") });
|
||||
cal.init({ itemSelector: $(".class")[0] });
|
||||
cal.init({ itemSelector: d3.select(".class")[0][0] });
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#domain-a",
|
||||
domain: "month",
|
||||
subDomain: "day",
|
||||
cellSize: 20,
|
||||
subDomainTextFormat: "%d",
|
||||
range: 1,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#domain-b",
|
||||
domain: "month",
|
||||
subDomain: "x_day",
|
||||
cellSize: 20, subDomainTextFormat: "%d",
|
||||
range: 1,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#cellSize-a",
|
||||
domain: "day",
|
||||
range: 1,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#cellSize-b",
|
||||
domain: "day",
|
||||
range: 1,
|
||||
cellSize: 15,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#cellPadding-a",
|
||||
domain: "day",
|
||||
range: 1,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#cellPadding-b",
|
||||
domain: "day",
|
||||
range: 1,
|
||||
cellPadding: 5,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#cellRadius-a",
|
||||
cellSize: 15,
|
||||
domain: "day",
|
||||
range: 1,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#cellRadius-b",
|
||||
cellSize: 15,
|
||||
domain: "day",
|
||||
range: 1,
|
||||
cellRadius: 10,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#domainGutter-a",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#domainGutter-b",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
domainGutter: 10,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#domainMargin-a",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#domainMargin-b",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false,
|
||||
domainMargin: 10
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#domainDynamicDimension-a",
|
||||
domain: "month",
|
||||
range: 5,
|
||||
cellSize: 8,
|
||||
displayLegend: false,
|
||||
nextSelector: "#domainDynamicDimension-next",
|
||||
previousSelector: "#domainDynamicDimension-previous"
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#domainDynamicDimension-b",
|
||||
domain: "month",
|
||||
range: 5,
|
||||
cellSize: 8,
|
||||
displayLegend: false,
|
||||
domainDynamicDimension: false,
|
||||
nextSelector: "#domainDynamicDimension-next",
|
||||
previousSelector: "#domainDynamicDimension-previous",
|
||||
itemNamespace: "domainDynamicDimension"
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#verticalOrientation-a",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#verticalOrientation-b",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false,
|
||||
verticalOrientation: true
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#label-a",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#label-b",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false,
|
||||
label: {
|
||||
position: "top"
|
||||
}
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#label-c",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false,
|
||||
label: {
|
||||
position: "left",
|
||||
width: 46
|
||||
}
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#label-d",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false,
|
||||
label: {
|
||||
position: "right",
|
||||
width: 46,
|
||||
offset: { x: 10, y: 30 }
|
||||
}
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#label-e",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false,
|
||||
label: {
|
||||
position: "left",
|
||||
width: 46,
|
||||
rotate: "left"
|
||||
}
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#label-f",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false,
|
||||
label: {
|
||||
position: "right",
|
||||
width: 150,
|
||||
rotate: "left"
|
||||
}
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#label-g",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false,
|
||||
label: {
|
||||
position: "right",
|
||||
width: 46,
|
||||
rotate: "left"
|
||||
}
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#label-h",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false,
|
||||
label: {
|
||||
position: "right",
|
||||
width: 46,
|
||||
rotate: "right",
|
||||
align: "right"
|
||||
}
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#colLimit-a",
|
||||
domain: "day",
|
||||
range: 1,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#colLimit-b",
|
||||
domain: "day",
|
||||
colLimit: 24,
|
||||
range: 1,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#rowLimit-a",
|
||||
domain: "month",
|
||||
range: 1,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#rowLimit-b",
|
||||
domain: "month",
|
||||
rowLimit: 10,
|
||||
range: 1,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#tooltip-a",
|
||||
domain: "month",
|
||||
range: 1,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#tooltip-b",
|
||||
domain: "month",
|
||||
range: 1,
|
||||
displayLegend: false,
|
||||
tooltip: true
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#start-a",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#start-b",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
start: new Date(2000, 0, 15),
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
start: new Date(2000, 0), // January, 1st 2000
|
||||
range: 12,
|
||||
domain: "year",
|
||||
subDomain: "month",
|
||||
data: "http://localhost/api?start={{d:start}}&stop={{d:end}}"
|
||||
});
|
||||
|
||||
cal.init({
|
||||
data: "http://localhost/datas.csv",
|
||||
dataType: "csv"
|
||||
});
|
||||
|
||||
var dt = new Date();
|
||||
dt.setDate(dt.getDate() + 1);
|
||||
cal.init({
|
||||
itemSelector: "#highlight-a",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false,
|
||||
highlight: ["now", dt]
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#weekStartOnMonday-a",
|
||||
domain: "month",
|
||||
subDomain: "x_day",
|
||||
cellSize: 20,
|
||||
subDomainTextFormat: "%d",
|
||||
range: 1,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#weekStartOnMonday-b",
|
||||
domain: "month",
|
||||
subDomain: "x_day",
|
||||
cellSize: 20,
|
||||
subDomainTextFormat: "%d",
|
||||
range: 1,
|
||||
weekStartOnMonday: false,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#minDate-a",
|
||||
domain: "month",
|
||||
start: new Date(2000, 4),
|
||||
minDate: new Date(2000, 1),
|
||||
maxDate: new Date(2000, 8),
|
||||
subDomain: "day",
|
||||
range: 4,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legend-a",
|
||||
domain: "day",
|
||||
range: 2
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legend-b",
|
||||
domain: "day",
|
||||
range: 2, legend: [-2.5, 0, 2.5]
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#displayLegend-a",
|
||||
domain: "day",
|
||||
range: 2
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#displayLegend-b",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendCellSize-a",
|
||||
domain: "day",
|
||||
range: 2
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendCellSize-b",
|
||||
domain: "day",
|
||||
range: 2, legendCellSize: 5
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendCellPadding-a",
|
||||
domain: "day",
|
||||
range: 3
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendCellPadding-b",
|
||||
domain: "day",
|
||||
range: 3, legendCellPadding: 5
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendMargin-a",
|
||||
domain: "day",
|
||||
range: 3
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendMargin-b",
|
||||
domain: "day",
|
||||
range: 3,
|
||||
legendMargin: [50, 0, 0, 50]
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendVerticalPosition-a",
|
||||
domain: "day",
|
||||
range: 2
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendVerticalPosition-b",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
legendVerticalPosition: "top",
|
||||
legendMargin: [0, 0, 10, 0]
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendVerticalPosition-c",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
legendVerticalPosition: "center",
|
||||
legendMargin: [0, 10, 0, 0]
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendVerticalPosition-d",
|
||||
domain: "day",
|
||||
range: 2,
|
||||
legendVerticalPosition: "center",
|
||||
legendHorizontalPosition: "right",
|
||||
legendMargin: [0, 0, 0, 10]
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendHorizontalPosition-a",
|
||||
domain: "day",
|
||||
range: 3
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendHorizontalPosition-b",
|
||||
domain: "day",
|
||||
range: 3,
|
||||
legendHorizontalPosition: "right"
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendOrientation-a",
|
||||
domain: "day",
|
||||
range: 3,
|
||||
legendVerticalPosition: "center",
|
||||
legendOrientation: "vertical",
|
||||
legendMargin: [0, 10, 0, 0]
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendOrientation-b",
|
||||
domain: "month",
|
||||
subDomain: "x_day",
|
||||
range: 3,
|
||||
verticalOrientation: true,
|
||||
legendVerticalPosition: "center",
|
||||
legendHorizontalPosition: "right",
|
||||
legendOrientation: "vertical",
|
||||
legendMargin: [0, 0, 0, 20]
|
||||
});
|
||||
|
||||
cal.init({
|
||||
legendColors: {
|
||||
min: "#efefef",
|
||||
max: "steelblue",
|
||||
empty: "white"
|
||||
// Will use the CSS for the missing keys
|
||||
}
|
||||
});
|
||||
|
||||
cal.init({
|
||||
legendColors: ["#efefef", "steelblue"]
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemName: ["cat", "cats"]
|
||||
});
|
||||
cal.init({
|
||||
itemName: "cat"
|
||||
});
|
||||
cal.init({
|
||||
itemName: ["cat"]
|
||||
});
|
||||
|
||||
cal.init({
|
||||
subDomainDateFormat: function(date: Date): string
|
||||
{
|
||||
return date.toString();
|
||||
}
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#subDomainTextFormat-a",
|
||||
start: new Date(2000, 0, 1, 1),
|
||||
domain: "month",
|
||||
subDomain: "x_day",
|
||||
cellSize: 20,
|
||||
range: 1,
|
||||
displayLegend: false,
|
||||
subDomainTextFormat: "%d"
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#subDomainTextFormat-b",
|
||||
start: new Date(2000, 0, 1, 1),
|
||||
data: "datas-years.json",
|
||||
domain: "month",
|
||||
subDomain: "x_day",
|
||||
cellSize: 20,
|
||||
range: 1,
|
||||
displayLegend: false,
|
||||
subDomainTextFormat: function(date: Date, value: number): number
|
||||
{
|
||||
return value;
|
||||
}
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#domainLabelFormat-a",
|
||||
domain: "month",
|
||||
subDomain: "day",
|
||||
range: 1,
|
||||
displayLegend: false
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#domainLabelFormat-b",
|
||||
domain: "month",
|
||||
subDomain: "day",
|
||||
range: 1,
|
||||
displayLegend: false,
|
||||
domainLabelFormat: "%m-%Y"
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#legendTitleFormat-a",
|
||||
domain: "day",
|
||||
range: 3
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#animationDuration-a",
|
||||
domain: "day",
|
||||
range: 4,
|
||||
previousSelector: "#animationDuration-previous",
|
||||
nextSelector: "#animationDuration-next",
|
||||
itemNamespace: "animationDuration-a"
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#animationDuration-b",
|
||||
domain: "day",
|
||||
range: 4, animationDuration: 1500,
|
||||
previousSelector: "#animationDuration-previous",
|
||||
nextSelector: "#animationDuration-next",
|
||||
itemNamespace: "animationDuration-b"
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#previousSelector-a",
|
||||
domain: "day",
|
||||
range: 4,
|
||||
previousSelector: "#previousSelector-a-previous",
|
||||
nextSelector: "#previousSelector-a-next"
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#previousSelector-b",
|
||||
domain: "day",
|
||||
range: 4,
|
||||
previousSelector: "#example-previousSelector ul + p > em",
|
||||
nextSelector: "#example-previousSelector [title=next] li"
|
||||
});
|
||||
|
||||
cal.init({
|
||||
nextSelector: "#next" // Attach #next onClick event to cal.next()
|
||||
});
|
||||
|
||||
cal.init({
|
||||
nextSelector: "#next",
|
||||
// Attach #next.cal onClick event to cal.next()
|
||||
itemNamespace: "cal"
|
||||
});
|
||||
|
||||
|
||||
cal.previous();
|
||||
cal.previous(5);
|
||||
|
||||
cal.next();
|
||||
cal.next(5);
|
||||
|
||||
cal.jumpTo(new Date(2000, 4));
|
||||
cal.jumpTo(new Date(2000, 4), true);
|
||||
|
||||
cal.rewind();
|
||||
|
||||
var randomData = {};
|
||||
cal.update(randomData);
|
||||
cal.update(randomData, () => { }, cal.RESET_ALL_ON_UPDATE);
|
||||
cal.update(randomData, false, cal.APPEND_ON_UPDATE);
|
||||
cal.update(randomData, false, cal.RESET_SINGLE_ON_UPDATE);
|
||||
|
||||
cal.highlight(new Date(2000, 0, 2));
|
||||
|
||||
// Add January 5th to already highlighted dates
|
||||
cal.options.highlight.push(new Date(2000, 0, 5));
|
||||
cal.highlight(cal.options.highlight);
|
||||
|
||||
var svg: string = cal.getSVG();
|
||||
|
||||
|
||||
cal.options.legendVerticalPosition = "center";
|
||||
cal.options.legendHorizontalPosition = "right";
|
||||
cal.options.legendOrientation = "vertical";
|
||||
|
||||
|
||||
cal.setLegend();
|
||||
|
||||
cal.removeLegend();
|
||||
|
||||
cal.showLegend();
|
||||
|
||||
cal = cal.destroy();
|
||||
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#onClick-a",
|
||||
domain: "day",
|
||||
range: 5, data: "datas-years.json",
|
||||
start: new Date(2000, 0),
|
||||
onClick: function(date: Date, nb: number)
|
||||
{
|
||||
$("#onClick-placeholder").html("You just clicked <br/>on <b>" +
|
||||
date + "</b> <br/>with <b>" +
|
||||
(nb === null ? "unknown" : nb) + "</b> items"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#afterLoad-a",
|
||||
domain: "day",
|
||||
range: 5,
|
||||
afterLoad: function() { },
|
||||
onComplete: function() { }
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#afterLoadPreviousDomain-a",
|
||||
domain: "day",
|
||||
range: 5, afterLoadPreviousDomain: function(date: Date) { },
|
||||
previousSelector: "#afterLoadPreviousDomain-selector"
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#afterLoadNextDomain-a",
|
||||
domain: "day",
|
||||
range: 5, afterLoadNextDomain: function(date: Date) { },
|
||||
nextSelector: "#afterLoadNextDomain-selector"
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#onComplete-a",
|
||||
domain: "day",
|
||||
range: 5,
|
||||
onComplete: function() { }
|
||||
});
|
||||
|
||||
var datas = [
|
||||
{ date: 946702811, value: 15 },
|
||||
{ date: 946702812, value: 25 },
|
||||
{ date: 946702813, value: 10 }
|
||||
]
|
||||
|
||||
cal.init({
|
||||
data: datas,
|
||||
afterLoadData: (data: any) =>
|
||||
{
|
||||
var stats: CalHeatMap.DataFormat = {};
|
||||
for (var d in data)
|
||||
{
|
||||
stats[data[d].date] = data[d].value;
|
||||
}
|
||||
return stats;
|
||||
}
|
||||
});
|
||||
|
||||
cal.init({
|
||||
itemSelector: "#onMinDomainReached-a",
|
||||
domain: "month",
|
||||
range: 5,
|
||||
start: new Date(2000, 4),
|
||||
minDate: new Date(2000, 3),
|
||||
maxDate: new Date(2000, 11),
|
||||
onMinDomainReached: function(hit: boolean) { },
|
||||
onMaxDomainReached: function(hit: boolean) { },
|
||||
nextSelector: "#onMinDomainReached-next",
|
||||
previousSelector: "#onMinDomainReached-previous",
|
||||
displayLegend: false
|
||||
});
|
||||
Vendored
+514
@@ -0,0 +1,514 @@
|
||||
// Type definitions for cal-heatmap v3.5.4
|
||||
// Project: https://github.com/wa0x6e/cal-heatmap
|
||||
// Definitions by: Chris Baker <https://github.com/RetroChrisB/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../d3/d3.d.ts" />
|
||||
|
||||
declare module CalHeatMap
|
||||
{
|
||||
interface CalHeatMapStatic
|
||||
{
|
||||
new (): CalHeatMap;
|
||||
}
|
||||
|
||||
interface CalHeatMap
|
||||
{
|
||||
/**
|
||||
* Initialise the CalHeatMap with the specified options
|
||||
* @param {InitOptions} options The CalHeatMap options
|
||||
*/
|
||||
init(options?: InitOptions): void;
|
||||
|
||||
options: RuntimeOptions;
|
||||
|
||||
// Various update mode when using the update() API
|
||||
/** Reset the whole calendar data before inserting the new data. */
|
||||
RESET_ALL_ON_UPDATE: number;
|
||||
/**
|
||||
* Update only the dates (subDomain) you pass in the data argument, replace their value by the new ones.
|
||||
* All other dates are leaved untouched.
|
||||
*/
|
||||
RESET_SINGLE_ON_UPDATE: number;
|
||||
/**
|
||||
* Instead of replacing a date's value by a new one, increment it by the new value. All other dates are leaved untouched.
|
||||
* That's the one you want to use of you're populating the calendar in realtime!
|
||||
*/
|
||||
APPEND_ON_UPDATE: number;
|
||||
|
||||
/**
|
||||
* Shift the calendar n domains back
|
||||
* @param {number} n The number of domains to shift back. The default is 1.
|
||||
*/
|
||||
previous(n?: number): void;
|
||||
/**
|
||||
* Shift the calendar n domains forward
|
||||
* @param {number} n The number of domains to shift forward. The default is 1.
|
||||
*/
|
||||
next(n?: number): void;
|
||||
/**
|
||||
* Jump the calendar to the specified date
|
||||
* This method will shift the calendar backward or forward, until the domain containing the specified date is visible.
|
||||
* @param {Date} date The date to jump to.
|
||||
* @param {boolean} reset Whether to set the domain with the specified as the calendar's first domain.
|
||||
*/
|
||||
jumpTo(date: Date, reset?: boolean): void;
|
||||
/** Reset the calendar back to the start date */
|
||||
rewind(): void;
|
||||
/**
|
||||
* Update the calendar with new data
|
||||
* Use update() when you want to refresh the calendar with a new set of data.
|
||||
* Particularly useful if you're filling the calendar in realtime, or if you want to display a subset of the current data.
|
||||
* @param {string|Object} data Accept the same format as the data option.
|
||||
* @param {} afterLoad Whether to execute the afterLoad() callback to convert your data into the json object, expected by cal-heatmap.
|
||||
* It can also directly takes a function, in case your data can not be converted with the afterLoad() function you defined.
|
||||
* @param {} updateMode Define how to insert the new data into the calendar.
|
||||
* Accepted values are:
|
||||
* Instance.RESET_ALL_ON_UPDATE (default) Reset the whole calendar data before inserting the new data.
|
||||
* Instance.RESET_SINGLE_ON_UPDATE Update only the dates (subDomain) you pass in the data argument,
|
||||
* replace their value by the new ones. All other dates are leaved untouched.
|
||||
* Instance.APPEND_ON_UPDATE Instead of replacing a date's value by a new one, increment it by the new value.
|
||||
* All other dates are leaved untouched. That's the one you want to use of you're
|
||||
* populating the calendar in realtime!
|
||||
*/
|
||||
update(data: string | Object, afterLoad?: boolean | Function, updateMode?: number): void;
|
||||
/**
|
||||
* Change the highlighted dates.
|
||||
* Takes an array of Date object. Can also accepts the now string, equivalent to Date.now().
|
||||
* @param {string|Date|Date[]} dates The date or dates to highlight.
|
||||
*/
|
||||
highlight(dates: string | Date | Date[]): void;
|
||||
/**
|
||||
* Return the SVG source code with the appropriate CSS
|
||||
* The returned string code is valid and ready to be placed in a .svg file.
|
||||
* @returns SVG source code with the appropriate CSS.
|
||||
*/
|
||||
getSVG(): string;
|
||||
/**
|
||||
* Change the legend settings and/or threshold
|
||||
* When called without arguments, setLegend() will just redraw the legend.
|
||||
* @param {} legend Same as legend : an array of thresholds
|
||||
* @param {} legendColor Same as legendColors : an object with the heatmap's colors, or an array of 2 colors
|
||||
*/
|
||||
setLegend(legend?: number[], legendColors?: LegendColor | string[]): void;
|
||||
/**
|
||||
* Remove the legend from the calendar
|
||||
* Settings are kept and you can re-add the legend with the same settings using showLegend().
|
||||
*/
|
||||
removeLegend(): void;
|
||||
/** Display the legend, if not already shown. */
|
||||
showLegend(): void;
|
||||
/**
|
||||
* Remove the calendar from the DOM
|
||||
* Remember to self-assign the result of destroy() to your calendar instance, or it'll lead to a memory leak.
|
||||
* @param {Function} callback function that will be executed when the calendar is removed from the DOM, at the end of the animation.
|
||||
* @returns always returns null.
|
||||
*/
|
||||
destroy(callback?: Function): CalHeatMap;
|
||||
}
|
||||
|
||||
interface LegendColor
|
||||
{
|
||||
/** Color of the smallest value on the legend */
|
||||
min: string;
|
||||
/** Color of the highest value on the legend */
|
||||
max: string;
|
||||
/** Color for the dates with value == 0 */
|
||||
empty?: string;
|
||||
/** Base color of the date cells */
|
||||
base?: string;
|
||||
/** Color for the special value */
|
||||
overflow?: string;
|
||||
}
|
||||
|
||||
interface InitOptions
|
||||
{
|
||||
// ================================================
|
||||
// Presentation
|
||||
// ================================================
|
||||
|
||||
/** DOM node to insert the calendar in. Default: "#cal-heatmap" */
|
||||
itemSelector?: string | HTMLElement | Element | EventTarget;
|
||||
|
||||
/**
|
||||
* Type of domain. Default: "hour"
|
||||
* Valid domains: {"hour", "day", "week", "month", "year"}
|
||||
*/
|
||||
domain?: string;
|
||||
|
||||
/**
|
||||
* Type of subDomain. Default: "min"
|
||||
* Valid subDomains: {"min", "x_min", "hour", "x_hour", "day", "x_day", "week", "x_week", "month", "x_month"}
|
||||
*/
|
||||
subDomain?: string;
|
||||
|
||||
/** Number of domain to display. Default: 12 */
|
||||
range?: number;
|
||||
|
||||
/** Size of each subDomain cell, in pixels. Default: 10 */
|
||||
cellSize?: number;
|
||||
|
||||
/** Space between each subDomain cell, in pixel. Default: 2 */
|
||||
cellPadding?: number;
|
||||
|
||||
/** subDomain cell's border radius, for rounder corner, in pixel. Default: 0 */
|
||||
cellRadius?: number;
|
||||
|
||||
/** Space between each domain, in pixel. Default: 2 */
|
||||
domainGutter?: number;
|
||||
|
||||
/**
|
||||
* Margin around each domain, in pixel. Default: [0,0,0,0]
|
||||
* Ordered like in CSS (top, right, bottom, left), it also accepts CSS like values
|
||||
*/
|
||||
domainMargin?: number | number[];
|
||||
|
||||
/**
|
||||
* Whether to enable domain dynamic width and height. Default: true
|
||||
* Some domain>subdomain couple, like month>days, doesn't always have the same number of
|
||||
* subDomain cells. Some months have 6 weeks, some only 4.
|
||||
* With dynamic dimension enabled, the domain width and height will be adjusted to fit the
|
||||
* domain content, whereas when it's disabled, all domains will have the same dimension : the biggest.
|
||||
*/
|
||||
domainDynamicDimension?: boolean;
|
||||
|
||||
/** To display the calendar vertically, with each domain one under the other. Default: false */
|
||||
verticalOrientation?: boolean;
|
||||
|
||||
/** Position and alignment of the domain label. */
|
||||
label?: Label;
|
||||
|
||||
/**
|
||||
* Control the number of columns to split the domain dates into. Default: null
|
||||
* Each domain is split into an arbitrary number of columns (or rows depending on the
|
||||
* reading direction). You can overwrite that number with colLimit, and force all dates on the
|
||||
* same line, or split them into more columns.
|
||||
* That setting limit the maximum number of columns, and doesn't necessary means that each rows will
|
||||
* contains that number of columns.
|
||||
*/
|
||||
colLimit?: number;
|
||||
|
||||
/** Control the number of rows to split the domain dates into. Default: null
|
||||
* If rowLimit and colLimit are both used, rowLimit will be ignored. */
|
||||
rowLimit?: number;
|
||||
|
||||
/** Whether to display a tooltip when hovering over a date. Default: false */
|
||||
tooltip?: boolean;
|
||||
|
||||
// ================================================
|
||||
// Data
|
||||
// ================================================
|
||||
|
||||
/**
|
||||
* Starting date of the calendar. Default: new Date()
|
||||
* It doesn't have to be precise, the calendar will not start at that date, but at the first domain containing that date.
|
||||
*/
|
||||
start?: Date;
|
||||
/**
|
||||
* Data used to fill the calendar. Default: ""
|
||||
* String is interpreted as a URL to an API, which should be returning the data used to fill the calendar.
|
||||
*/
|
||||
|
||||
data?: string | Object;
|
||||
|
||||
/**
|
||||
* Engine used to parse the data. Default: json
|
||||
* Valid values:
|
||||
* "json" - Interpret the data as json.
|
||||
* "csv" - Interpret the data as csv.
|
||||
* "tsv" - Interpret the data exactly like csv, but are delimited with a tab character, instead of comma.
|
||||
* "txt" - Just return the data as a string.
|
||||
*/
|
||||
dataType?: string;
|
||||
|
||||
/**
|
||||
* Highlight selected subDomain cells. Default: false
|
||||
* Takes an array of Date object. Can also accepts the now string, equivalent to Date.now().
|
||||
*/
|
||||
highlight?: string | string[] | Date[] | any[];
|
||||
|
||||
/** Whether to start the week on Monday, instead of Sunday. Default: true */
|
||||
weekStartOnMonday?: boolean;
|
||||
|
||||
/**
|
||||
* Lower limit of the domain navigation, preventing navigating beyond a certain date. Default: null
|
||||
* When set, calling previous() will only work only until the leftmost domain containing minDate.
|
||||
* Like with start, minDate does not have to be precise, and just have to be a date inside the domain.
|
||||
* previous() will always return true, unless the domain containing minDate is reached, in which case, it'll return false.
|
||||
*/
|
||||
minDate?: Date;
|
||||
|
||||
/** Upper limit of the domain navigation, preventing navigating beyond a certain date. Default: null */
|
||||
maxDate?: Date;
|
||||
|
||||
/**
|
||||
* Whether to consider missing date:value couple in the data source as equal to 0. Default: false
|
||||
* By default, when the a date is not associated to a value, it's considered as null, and rendered as a no value cell.
|
||||
* You should ask yourself, if the API is not returning result for a date, is it because there is really no value
|
||||
* associated to this date, or because it's supposed to be equal to 0, and it's skipped in order to save bandwidth ?
|
||||
*/
|
||||
considerMissingDataAsZero?: boolean;
|
||||
|
||||
// ================================================
|
||||
// Legend
|
||||
// ================================================
|
||||
|
||||
/** Assign each range of values to a color. Default: [10, 20, 30, 40] */
|
||||
legend?: number[];
|
||||
|
||||
/** Whether to display the legend. Default: true */
|
||||
displayLegend?: boolean;
|
||||
|
||||
/** Size of the legend cells, in pixels. Default: 10 */
|
||||
legendCellSize?: number;
|
||||
|
||||
/** Padding between each legend cell, in pixels. Default: 2 */
|
||||
legendCellPadding?: number;
|
||||
|
||||
/** Margin around the legend, in pixels. Default: [10, 0, 0, 0] */
|
||||
legendMargin?: number | number[];
|
||||
|
||||
/**
|
||||
* Vertical position of the legend. Default: "bottom"
|
||||
* Valid values:
|
||||
* "top" - Place the legend above the calendar
|
||||
* "center" - Place the legend on the calendar's side
|
||||
* Use with legendHorizontalPosition, to position the legend on the left (default) or on the right.
|
||||
* "bottom" - Place the legend on below the calendar
|
||||
*/
|
||||
legendVerticalPosition?: string;
|
||||
|
||||
/**
|
||||
* Horizontal position of the legend. Default: "left"
|
||||
* Valid values:
|
||||
* "left" - Align the legend to the left
|
||||
* "center" - Center the legend
|
||||
* "right" - Align the legend to the right
|
||||
*/
|
||||
legendHorizontalPosition?: string;
|
||||
|
||||
/**
|
||||
* Orientation of the legend. Default: "horizontal"
|
||||
* legendOrientation is best used together with legendHorizontalPosition when the legend is positioned on the side.
|
||||
* Valid values:
|
||||
* "horizontal" - Legend is displayed horizontally, from left to right
|
||||
* "vertical" - Legend is displayed vertically, from top to bottom
|
||||
*/
|
||||
legendOrientation?: string;
|
||||
|
||||
/**
|
||||
* Set of colors to automagically compute the heatmap colors.
|
||||
* Instead of relying on the CSS for your heatmap's colors, you can also set the heatmap's colors directly with
|
||||
* cal-heatmap on initialization, or even dynamically change them after.
|
||||
* All legend settings can be changed dynamically after calendar initialisation, with setLegend().
|
||||
*/
|
||||
legendColors?: LegendColor | string[];
|
||||
|
||||
// ================================================
|
||||
// i18n
|
||||
// ================================================
|
||||
|
||||
/**
|
||||
* Name of the entity you're representing on the calendar.
|
||||
* Takes an array of string, with the first index as the singular form, and the second index the plural form.
|
||||
* For the lazy, you can also pass a simple string, ar a single element array, and it'll automatically guess
|
||||
* the plural form, as long as it's the singular form plus the "s" suffix.
|
||||
*/
|
||||
itemName?: string | string[];
|
||||
/**
|
||||
* Format of the title displayed when hovering a subDomain.
|
||||
* Some template strings are available, and enclosed in braces.
|
||||
* {name} Name of the entity represented in the calendar (see itemName)
|
||||
* {count} The value associated to the date.
|
||||
* {date} The date of the cell. It's automatically formatted according to the type of subDomain.
|
||||
* See subDomainDateFormat to further customize that date formatting.
|
||||
* {connector} An English preposition placed before a datetime (on Monday, at 15:00, etc.). Each subDomain
|
||||
* have their own default connector, corresponding to the default date format.
|
||||
*/
|
||||
subDomainTitleFormat?: SubDomainFormatTemplates;
|
||||
/**
|
||||
* Format of the {date} template string inside subDomainTitleFormat.
|
||||
* {date} is by default formatted according to the subDomain type.
|
||||
* subDomainFormat can accept any string with directive accepted by d3.time.format(), like "%Y-%m-%d".
|
||||
* As d3.time.format() will only output English dates, subDomainDateFormat can also accept a function,
|
||||
* with the subDomain date as the argument.
|
||||
*/
|
||||
subDomainDateFormat?: string | Function;
|
||||
/**
|
||||
* Format of the text inside a subDomain cell.
|
||||
* Disabled by default, you can display a text inside each subDomain cell.
|
||||
* Works exactly like subDomainDateFormat, except that the function takes the cell value as second argument.
|
||||
*/
|
||||
subDomainTextFormat?: string | Function;
|
||||
/**
|
||||
* Format of the domain label.
|
||||
* Works exactly like subDomainDateFormat, and will format the domain label with any string accepted by d3.time.format(), or a function.
|
||||
* To not display the domain label, set domainLabelFormat to "" (empty string).
|
||||
*/
|
||||
domainLabelFormat?: string | Function;
|
||||
/**
|
||||
* Formatting of the legend title, displayed when hovering a legend cell.
|
||||
* Some template strings are available, and enclosed in braces.
|
||||
* {name} Name of the entity represented in the calendar (see itemName)
|
||||
* {min} The first value of the legend array.
|
||||
* {max} The last value of the legend array.
|
||||
* {down} The lower bound of a color
|
||||
* {up} The upper bound of a color
|
||||
*/
|
||||
legendTitleFormat?: LegendTitleTemplates;
|
||||
|
||||
// ================================================
|
||||
// Other
|
||||
// ================================================
|
||||
|
||||
/** Animation duration, in milliseconds. Default value: 500 */
|
||||
animationDuration?: number;
|
||||
/**
|
||||
* Will attach the previous() event to the specified element, on a mouse click, shifting the calendar one domain back. Default value: false
|
||||
* If you want to shift by more than one domain, see the previous() method.
|
||||
*/
|
||||
previousSelector?: string | HTMLElement;
|
||||
/**
|
||||
* Will attach the next() event to the specified element, on a mouse click, shifting the calendar one domain forward. Default value: false
|
||||
* If you want to shift by more than one domain, see the next() method.
|
||||
*/
|
||||
nextSelector?: string | HTMLElement;
|
||||
/**
|
||||
* The calendar instance namespace.
|
||||
* If you have more than one instance of Cal-Heatmap, you should assign each instance its own namespace, in order to isolate each instance event handler.
|
||||
*/
|
||||
itemNamespace?: string;
|
||||
|
||||
// ================================================
|
||||
// Events
|
||||
// ================================================
|
||||
|
||||
/** Called after a mouse click event on a subDomain cell. */
|
||||
onClick?: (date: Date, value: number) => void;
|
||||
/** Called after drawing the empty calendar, and before filling it with data. */
|
||||
afterLoad?: () => void;
|
||||
/**
|
||||
* Called after shifting the calendar one domain back.
|
||||
* The date argument is the start date of the domain that was added.
|
||||
*/
|
||||
afterLoadPreviousDomain?: (date: Date) => void;
|
||||
/**
|
||||
* Called after shifting the calendar one domain forward.
|
||||
* The date argument is the start date of the domain that was added.
|
||||
*/
|
||||
afterLoadNextDomain?: (date: Date) => void;
|
||||
/**
|
||||
* Called after drawing and filling the calendar.
|
||||
* Useful in case you're loading data via ajax, as it's loading data asynchronously. This event will wait for the ajax
|
||||
* request to complete before triggering.
|
||||
* This event will only trigger once, on the initial setup. See afterLoadPreviousDomain and afterLoadNextDomain for
|
||||
* callback events after a domain navigation.
|
||||
*/
|
||||
onComplete?: () => void;
|
||||
/**
|
||||
* Called after getting the data from source, but before filling the calendar.
|
||||
* This callback must return a json object formatted in the expected data format.
|
||||
* afterLoadData() is used to do some works on the data, especially when the data source is not returning data in the expected format.
|
||||
*/
|
||||
afterLoadData?: (data: any) => DataFormat;
|
||||
/**
|
||||
* Triggered after previous(), when the incoming domain is containing minDate.
|
||||
* When the leftmost domain set by minDate is loaded into the calendar, onMinDomainReached() will be triggered with true as argument.
|
||||
* This event is useful if you want to disable your previous button, since there is no more previous domains to load.
|
||||
* In order to reverse the action, onMinDomainReached() will be called with false as argument afer next(), only once, and only if the
|
||||
* leftmost domain is not the lower limit domain anymore.
|
||||
*/
|
||||
onMinDomainReached?: (reached: boolean) => void;
|
||||
/**
|
||||
* Triggered after next(), when the incoming domain is containing maxDate.
|
||||
* See onMinDomainReached().
|
||||
*/
|
||||
onMaxDomainReached?: (reached: boolean) => void;
|
||||
}
|
||||
|
||||
interface RuntimeOptions extends InitOptions
|
||||
{
|
||||
/** Margin around each domain, in pixels. Ordered like in CSS (top, right, bottom, left) */
|
||||
domainMargin: number[];
|
||||
/** Margin around the legend, in pixels. Ordered like in CSS (top, right, bottom, left) */
|
||||
legendMargin: number[];
|
||||
/** List of dates to highlight */
|
||||
highlight: Date[];
|
||||
/**
|
||||
* Name of the items to represent in the calendar.
|
||||
* First index is singular form, and the second index, the plural form.
|
||||
*/
|
||||
itemName: string[];
|
||||
}
|
||||
|
||||
interface LegendTitleTemplates
|
||||
{
|
||||
/** Formatting of the smallest (leftmost) value of the legend. Default value: "less than {min} {name}" */
|
||||
lower?: string;
|
||||
/** Formatting of all the value but the first and the last. Default value: "between {down} and {up} {name}" */
|
||||
inner?: string;
|
||||
/** Formatting of the biggest (rightmost) value of the legend. Default value: "more than {max} {name}" */
|
||||
upper?: string;
|
||||
}
|
||||
|
||||
interface SubDomainFormatTemplates
|
||||
{
|
||||
/** Format of the title when there is no value associated to the date. Default value: "{date}" */
|
||||
empty?: string;
|
||||
/** Format of the title when it's associated to a value. Default value: "{count} {name} {connector} {date}" */
|
||||
filled?: string;
|
||||
}
|
||||
|
||||
interface DataFormat
|
||||
{
|
||||
/** timestamp are in seconds, value can be any number (integer or float) */
|
||||
[timestamp: string]: number;
|
||||
}
|
||||
|
||||
interface LabelOffset
|
||||
{
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
/** Position and alignment of the domain label. */
|
||||
interface Label
|
||||
{
|
||||
/**
|
||||
* Position of the label, relative to the domain. Default: "bottom"
|
||||
* Valid values: {"top", "right", "bottom", "left"}
|
||||
*/
|
||||
position?: string;
|
||||
|
||||
/**
|
||||
* Horizontal align of the domain. Default: "center"
|
||||
* Valid values: {"left", "center", "right"}
|
||||
*/
|
||||
align?: string;
|
||||
/**
|
||||
* Rotation for a vertical label. Default: null
|
||||
* Valid values: {null, "left", "right"}
|
||||
*/
|
||||
rotate?: string;
|
||||
/**
|
||||
* Only used when label is rotated, defines the width of the label. Default: 100
|
||||
* Valid values: any intger
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* More control about label positioning, if the default value does not fit your need,
|
||||
* especially when label is rotated, or when using a big font-size. Default: {x:0, y:0}
|
||||
*/
|
||||
offset?: LabelOffset;
|
||||
/**
|
||||
* Height of the domain label in pixels.
|
||||
* By leaving it to null, the label will be set to 2 times the height of the subDomain cell.
|
||||
* If you want to remove the label, set domainLabelFormat to "" (empty string), instead
|
||||
* of setting the label height to 0. Default: null
|
||||
* Valid values: any integer
|
||||
*/
|
||||
height?: number;
|
||||
}
|
||||
}
|
||||
|
||||
declare var CalHeatMap: CalHeatMap.CalHeatMapStatic;
|
||||
@@ -0,0 +1,44 @@
|
||||
/// <reference path="./complex.d.ts" />
|
||||
|
||||
import Complex from 'complex';
|
||||
|
||||
var z: Complex = new Complex(2, 3);
|
||||
var z: Complex = Complex.from(2, 3);
|
||||
var z: Complex = Complex.from(2, 4);
|
||||
var z: Complex = Complex.from(5);
|
||||
var z: Complex = Complex.from('2+5i');
|
||||
var z: Complex = Complex.fromPolar(3, Math.PI);
|
||||
var z: Complex = Complex.i;
|
||||
var z: Complex = Complex.one;
|
||||
var z: Complex = z.fromRect(2, 3);
|
||||
var z: Complex = z.fromPolar(3, Math.PI);
|
||||
var z: Complex = z.toPrecision(3);
|
||||
var z: Complex = z.toFixed(3);
|
||||
var z: Complex = z.finalize();
|
||||
var x: number = z.magnitude();
|
||||
var x: number = z.abs();
|
||||
var x: number = z.angle();
|
||||
var x: number = z.arg();
|
||||
var x: number = z.phase();
|
||||
var z: Complex = z.conjugate();
|
||||
var z: Complex = z.negate();
|
||||
var z: Complex = z.multiply(z);
|
||||
var z: Complex = z.mult(3);
|
||||
var z: Complex = z.divide(z);
|
||||
var z: Complex = z.div(3);
|
||||
var z: Complex = z.add(z);
|
||||
var z: Complex = z.subtract(z);
|
||||
var z: Complex = z.sub(3);
|
||||
var z: Complex = z.pow(z);
|
||||
var z: Complex = z.sqrt();
|
||||
var z: Complex = z.log(2);
|
||||
var z: Complex = z.exp();
|
||||
var z: Complex = z.sin();
|
||||
var z: Complex = z.cos();
|
||||
var z: Complex = z.tan();
|
||||
var z: Complex = z.sinh();
|
||||
var z: Complex = z.cosh();
|
||||
var z: Complex = z.tanh();
|
||||
var z: Complex = z.clone();
|
||||
var s: string = z.toString();
|
||||
var b: boolean = z.equals(z);
|
||||
Vendored
+238
@@ -0,0 +1,238 @@
|
||||
// Type definitions for Complex 3.0.1
|
||||
// Project: https://github.com/arian/Complex
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'complex' {
|
||||
export default class Complex {
|
||||
/**
|
||||
* @param real The real part of the number
|
||||
* @param im The imaginary part of the number
|
||||
*/
|
||||
constructor(real: number, im: number);
|
||||
|
||||
/**
|
||||
* A in line function like Number.from.
|
||||
*
|
||||
* Examples:
|
||||
* var z = Complex.from(2, 4);
|
||||
* var z = Complex.from(5);
|
||||
* var z = Complex.from('2+5i');
|
||||
*
|
||||
* @param real A string representation of the number, for example 1+4i
|
||||
*/
|
||||
static from(real: string): Complex;
|
||||
|
||||
/**
|
||||
* A in line function like Number.from.
|
||||
* @param real The real part of the number
|
||||
* @param im The imaginary part of the number
|
||||
*/
|
||||
static from(real: number, im?: number): Complex;
|
||||
|
||||
/**
|
||||
* Creates a complex instance from a polar representation
|
||||
* @param r The radius/magnitude of the number
|
||||
* @param phi The angle/phase of the number
|
||||
*/
|
||||
static fromPolar(r: number, phi: number): Complex;
|
||||
|
||||
/**
|
||||
* A instance of the imaginary unit
|
||||
*/
|
||||
static i: Complex;
|
||||
|
||||
/**
|
||||
* A instance for the real number
|
||||
*/
|
||||
static one: Complex;
|
||||
|
||||
/**
|
||||
* Set the real and imaginary properties a and b from a + bi.
|
||||
* @param real The real part of the number
|
||||
* @param im The imaginary part of the number
|
||||
*/
|
||||
fromRect(real: number, im: number): Complex;
|
||||
|
||||
/**
|
||||
* Set the a and b in a + bi from a polar representation.
|
||||
* @param r The radius/magnitude of the number
|
||||
* @param phi The angle/phase of the number
|
||||
*/
|
||||
fromPolar(r: number, phi: number): Complex;
|
||||
|
||||
/**
|
||||
* Set the precision of the numbers. Similar to Number.prototype.toPrecision. Useful before printing the number with the toString method.
|
||||
* @param k An integer specifying the number of significant digits
|
||||
*/
|
||||
toPrecision(k: number): Complex;
|
||||
|
||||
/**
|
||||
* Format a number using fixed-point notation. Similar to Number.prototype.toFixed. Useful before printing the number with the toString method.
|
||||
* @param k The number of digits to appear after the decimal point; this may be a value between 0 and 20, inclusive, and implementations may optionally support a larger range of values. If this argument is omitted, it is treated as 0.
|
||||
*/
|
||||
toFixed(k: number): Complex;
|
||||
|
||||
/**
|
||||
* Finalize the instance. The number will not change and any other method call will return a new instance. Very useful when a complex instance should stay constant. For example the Complex.i variable is a finalized instance.
|
||||
*/
|
||||
finalize(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the magnitude of the complex number
|
||||
*/
|
||||
magnitude(): number;
|
||||
|
||||
/**
|
||||
* Alias for magnitude(). Calculate the magnitude of the complex number.
|
||||
*/
|
||||
abs(): number;
|
||||
|
||||
/**
|
||||
* Calculate the angle with respect to the real axis, in radians.
|
||||
*/
|
||||
angle(): number;
|
||||
|
||||
/**
|
||||
* Alias for angle(). Calculate the angle with respect to the real axis, in radians.
|
||||
*/
|
||||
arg(): number;
|
||||
|
||||
/**
|
||||
* Alias for angle(). Calculate the angle with respect to the real axis, in radians.
|
||||
*/
|
||||
phase(): number;
|
||||
|
||||
/**
|
||||
* Calculate the conjugate of the complex number (multiplies the imaginary part with -1)
|
||||
*/
|
||||
conjugate(): Complex;
|
||||
|
||||
/**
|
||||
* Negate the number (multiplies both the real and imaginary part with -1)
|
||||
*/
|
||||
negate(): Complex;
|
||||
|
||||
/**
|
||||
* Multiply the number with a real or complex number
|
||||
* @param z The number to multiply with
|
||||
*/
|
||||
multiply(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Alias for multiply(). Multiply the number with a real or complex number
|
||||
* @param z The number to multiply with
|
||||
*/
|
||||
mult(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Divide the number by a real or complex number
|
||||
* @param z The number to divide by
|
||||
*/
|
||||
divide(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Alias for divide(). Divide the number by a real or complex number
|
||||
* @param z The number to divide by
|
||||
*/
|
||||
div(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Add a real or complex number
|
||||
* @param z The number to add
|
||||
*/
|
||||
add(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Subtract a real or complex number
|
||||
* @param z The number to subtract
|
||||
*/
|
||||
subtract(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Alias for subtract(). Subtract a real or complex number
|
||||
* @param z The number to subtract
|
||||
*/
|
||||
sub(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Return the base to the exponent
|
||||
* @param z The exponent
|
||||
*/
|
||||
pow(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Return the square root
|
||||
*/
|
||||
sqrt(): Complex;
|
||||
|
||||
/**
|
||||
* Return the natural logarithm (base E)
|
||||
* @param k The actual answer has a multiplicity (ln(z) = ln|z| + arg(z)) where arg(z) can return the same for different angles (every 2*pi), with this argument you can define which answer is required
|
||||
*/
|
||||
log(k?: number): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the e^z where the base is E and the exponential the complex number.
|
||||
*/
|
||||
exp(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the sine of the complex number
|
||||
*/
|
||||
sin(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the cosine of the complex number
|
||||
*/
|
||||
cos(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the tangent of the complex number
|
||||
*/
|
||||
tan(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the hyperbolic sine of the complex number
|
||||
*/
|
||||
sinh(): Complex
|
||||
|
||||
/**
|
||||
* Calculate the hyperbolic cosine of the complex number
|
||||
*/
|
||||
cosh(): Complex
|
||||
|
||||
/**
|
||||
* Calculate the hyperbolic tangent of the complex number
|
||||
*/
|
||||
tanh(): Complex
|
||||
|
||||
/**
|
||||
* Return a new Complex instance with the same real and imaginary properties
|
||||
*/
|
||||
clone(): Complex;
|
||||
|
||||
/**
|
||||
* Return a string representation of the complex number
|
||||
*
|
||||
* Examples:
|
||||
* new Complex(1, 2).toString(); // 1+2i
|
||||
* new Complex(0, 1).toString(); // i
|
||||
* new Complex(4, 0).toString(); // 4
|
||||
* new Complex(1, 1).toString(); // 1+i
|
||||
* 'my Complex Number is: ' + (new Complex(3, 5)); // 'my Complex Number is: 3+5i
|
||||
*/
|
||||
toString(): string;
|
||||
|
||||
/**
|
||||
* Check if the real and imaginary components are equal to the passed in compelex components.
|
||||
*
|
||||
* Examples:
|
||||
* new Complex(1, 4).equals(new Complex(1, 4)); // true
|
||||
* new Complex(1, 4).equals(new Complex(1, 3)); // false
|
||||
*
|
||||
* @param z The complex number to compare with
|
||||
*/
|
||||
equals(z: number | Complex): boolean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
///<reference path="email-templates.d.ts"/>
|
||||
|
||||
import EmailTemplates = require('email-templates');
|
||||
|
||||
var EmailTemplate = EmailTemplates.EmailTemplate;
|
||||
var template = new EmailTemplate("./");
|
||||
var users = [
|
||||
{
|
||||
email: 'pappa.pizza@spaghetti.com',
|
||||
name: {
|
||||
first: 'Pappa',
|
||||
last: 'Pizza'
|
||||
}
|
||||
},
|
||||
{
|
||||
email: 'mister.geppetto@spaghetti.com',
|
||||
name: {
|
||||
first: 'Mister',
|
||||
last: 'Geppetto'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
var templates = users.map(function(user) {
|
||||
return template.render(user);
|
||||
})
|
||||
Vendored
+54
@@ -0,0 +1,54 @@
|
||||
// Type definitions for node-email-templates
|
||||
// Project: https://github.com/niftylettuce/node-email-templates
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* @summary Interface for result of email template.
|
||||
* @interface
|
||||
*/
|
||||
interface EmailTemplateResults {
|
||||
/**
|
||||
* @summary HTML result.
|
||||
* @type {string}
|
||||
*/
|
||||
html: string;
|
||||
|
||||
/**
|
||||
* @summary Text result.
|
||||
* @type {string}
|
||||
*/
|
||||
text: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Interface for callback of email callback.
|
||||
* @interface
|
||||
*/
|
||||
interface EmailTemplateCallback {
|
||||
/**
|
||||
* @summary Callback signature.
|
||||
*/
|
||||
(err: Object, results: EmailTemplateResults): void;
|
||||
}
|
||||
|
||||
declare module "email-templates" {
|
||||
/**
|
||||
* @summary Email template class.
|
||||
* @class
|
||||
*/
|
||||
export class EmailTemplate {
|
||||
/**
|
||||
* @summary Constructor.
|
||||
* @param {string} templateDir The template directory.
|
||||
*/
|
||||
constructor(templateDir: string);
|
||||
|
||||
/**
|
||||
* @summary Render a single template.
|
||||
* @param {EmailTemplateCallback|Object} locals The variables or callback function.
|
||||
* @param {EmailTemplateCallback} callback The callback function.
|
||||
*/
|
||||
render(locals: EmailTemplateCallback|Object, callback?: EmailTemplateCallback): void;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@ interface ExphbsOptions {
|
||||
handlebars?: any;
|
||||
extname?: string;
|
||||
layoutsDir?: string;
|
||||
partialsDir?: string;
|
||||
partialsDir?: any;
|
||||
defaultLayout?: string;
|
||||
helpers?: any;
|
||||
compilerOptions?: any;
|
||||
|
||||
+14
-11
@@ -1,59 +1,62 @@
|
||||
/// <reference path="helmet.d.ts" />
|
||||
|
||||
import express = require("express")
|
||||
import helmet = require("helmet");
|
||||
|
||||
var app = express();
|
||||
|
||||
/**
|
||||
* @summary Test for {@see helmet}.
|
||||
*/
|
||||
function helmetTest() {
|
||||
helmet();
|
||||
app.use(helmet());
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Test for {@see helmet#xssFilter} function.
|
||||
*/
|
||||
function contentSecurityPolicyTest() {
|
||||
helmet.xssFilter();
|
||||
helmet.xssFilter({ setOnOldIE: true });
|
||||
app.use(helmet.xssFilter());
|
||||
app.use(helmet.xssFilter({ setOnOldIE: true }));
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Test for {@see helmet#frameguard} function.
|
||||
*/
|
||||
function frameguardTest() {
|
||||
helmet.frameguard();
|
||||
helmet.frameguard("sameorigin");
|
||||
app.use(helmet.frameguard());
|
||||
app.use(helmet.frameguard("sameorigin"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Test for {@see helmet#hsts} function.
|
||||
*/
|
||||
function hstsTest() {
|
||||
helmet.hsts();
|
||||
helmet.hsts({ maxAge: 7776000000 });
|
||||
app.use(helmet.hsts());
|
||||
app.use(helmet.hsts({ maxAge: 7776000000 }));
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Test for {@see helmet#ieNoOpen} function.
|
||||
*/
|
||||
function ieNoOpenTest() {
|
||||
helmet.ieNoOpen();
|
||||
app.use(helmet.ieNoOpen());
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Test for {@see helmet#noSniff} function.
|
||||
*/
|
||||
function noSniffTest() {
|
||||
helmet.noSniff();
|
||||
app.use(helmet.noSniff());
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Test for {@see helmet#publicKeyPins} function.
|
||||
*/
|
||||
function publicKeyPinsTest() {
|
||||
helmet.publicKeyPins({
|
||||
app.use(helmet.publicKeyPins({
|
||||
sha256s: ["AbCdEf123=", "ZyXwVu456="],
|
||||
includeSubdomains: true,
|
||||
reportUri: "http://example.com"
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
Vendored
+67
-47
@@ -3,55 +3,75 @@
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface Helmet {
|
||||
(): void;
|
||||
|
||||
/**
|
||||
* @summary Prevent clickjacking.
|
||||
* @param {string} header The header.
|
||||
*/
|
||||
frameguard(header ?: string): void;
|
||||
|
||||
/**
|
||||
* @summary Hide "X-Powered-By" header.
|
||||
* @param {Object} options The options.
|
||||
*/
|
||||
hidePoweredBy(options ?: Object): void;
|
||||
|
||||
/**
|
||||
* @summary Adds the "Strict-Transport-Security" header.
|
||||
* @param {Object} options The options.
|
||||
*/
|
||||
hsts(options ?: Object): void;
|
||||
|
||||
/**
|
||||
* @summary Add the "X-Download-Options" header.
|
||||
*/
|
||||
ieNoOpen(): void;
|
||||
|
||||
/**
|
||||
* @summary Add the "Cache-Control" and "Pragma" headers to stop caching.
|
||||
*/
|
||||
nocache(options ?: Object): void;
|
||||
|
||||
/**
|
||||
* @summary Adds the "X-Content-Type-Options" header.
|
||||
*/
|
||||
noSniff(): void;
|
||||
|
||||
/**
|
||||
* @summary Adds the "Public-Key-Pins" header.
|
||||
*/
|
||||
publicKeyPins(options ?: Object): void;
|
||||
|
||||
/**
|
||||
* @summary Prevent Cross-site scripting attacks.
|
||||
* @param {Object} options The options.
|
||||
*/
|
||||
xssFilter(options ?: Object): void;
|
||||
}
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module "helmet" {
|
||||
import express = require("express");
|
||||
|
||||
/**
|
||||
* @summary Interface for helmet class.
|
||||
* @interface
|
||||
*/
|
||||
interface Helmet {
|
||||
/**
|
||||
* @summary Constructor.
|
||||
* @return {RequestHandler} The Request handler.
|
||||
*/
|
||||
():express.RequestHandler;
|
||||
|
||||
/**
|
||||
* @summary Prevent clickjacking.
|
||||
* @param {string} header The header.
|
||||
* @return {RequestHandler} The Request handler.
|
||||
*/
|
||||
frameguard(header ?: string):express.RequestHandler;
|
||||
|
||||
/**
|
||||
* @summary Hide "X-Powered-By" header.
|
||||
* @param {Object} options The options.
|
||||
* @return {RequestHandler} The Request handler.
|
||||
*/
|
||||
hidePoweredBy(options ?: Object):express.RequestHandler;
|
||||
|
||||
/**
|
||||
* @summary Adds the "Strict-Transport-Security" header.
|
||||
* @param {Object} options The options.
|
||||
* @return {RequestHandler} The Request handler.
|
||||
*/
|
||||
hsts(options ?: Object):express.RequestHandler;
|
||||
|
||||
/**
|
||||
* @summary Add the "X-Download-Options" header.
|
||||
* @return {RequestHandler} The Request handler.
|
||||
*/
|
||||
ieNoOpen():express.RequestHandler;
|
||||
|
||||
/**
|
||||
* @summary Add the "Cache-Control" and "Pragma" headers to stop caching.
|
||||
* @return {RequestHandler} The Request handler.
|
||||
*/
|
||||
noCache(options ?: Object):express.RequestHandler;
|
||||
|
||||
/**
|
||||
* @summary Adds the "X-Content-Type-Options" header.
|
||||
* @return {RequestHandler} The Request handler.
|
||||
*/
|
||||
noSniff():express.RequestHandler;
|
||||
|
||||
/**
|
||||
* @summary Adds the "Public-Key-Pins" header.
|
||||
* @return {RequestHandler} The Request handler.
|
||||
*/
|
||||
publicKeyPins(options ?: Object):express.RequestHandler;
|
||||
|
||||
/**
|
||||
* @summary Prevent Cross-site scripting attacks.
|
||||
* @return {RequestHandler} The Request handler.
|
||||
* @param {Object} options The options.
|
||||
*/
|
||||
xssFilter(options ?: Object):express.RequestHandler;
|
||||
}
|
||||
|
||||
var helmet: Helmet;
|
||||
export = helmet;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/// <reference path="./inherits.d.ts" />
|
||||
|
||||
import inherits = require('inherits');
|
||||
|
||||
let any: any;
|
||||
|
||||
inherits(any, any);
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// Type definitions for inherits
|
||||
// Project: https://github.com/isaacs/inherits
|
||||
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "inherits" {
|
||||
import {inherits} from "util";
|
||||
export = inherits;
|
||||
}
|
||||
Vendored
+1
@@ -590,6 +590,7 @@ declare module JQueryUI {
|
||||
resize?: ResizableEvent;
|
||||
start?: ResizableEvent;
|
||||
stop?: ResizableEvent;
|
||||
create?: ResizableEvents;
|
||||
}
|
||||
|
||||
interface Resizable extends Widget, ResizableOptions {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path="keytar.d.ts" />
|
||||
|
||||
import keytar = require('keytar');
|
||||
|
||||
keytar.addPassword('keytar-tests', 'username', 'password');
|
||||
keytar.deletePassword('keytar-tests', 'username');
|
||||
keytar.findPassword('keytar-tests');
|
||||
keytar.getPassword('keytar-tests', 'username');
|
||||
keytar.replacePassword('keytar-tests', 'username', 'password');
|
||||
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
// Type definitions for keytar 3.0.0
|
||||
// Project: http://atom.github.io/node-keytar/
|
||||
// Definitions by: Milan Burda <https://github.com/miniak/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'keytar' {
|
||||
/**
|
||||
* Get the stored password for the service and account.
|
||||
*
|
||||
* @param service The string service name.
|
||||
* @param account The string account name.
|
||||
*
|
||||
* @returns the string password or null on failures.
|
||||
*/
|
||||
export function getPassword(service: string, account: string): string;
|
||||
|
||||
/**
|
||||
* Add the password for the service and account to the keychain.
|
||||
*
|
||||
* @param service The string service name.
|
||||
* @param account The string account name.
|
||||
* @param password The string password.
|
||||
*
|
||||
* @returns true on success, false on failure.
|
||||
*/
|
||||
export function addPassword(service: string, account: string, password: string): boolean;
|
||||
|
||||
/**
|
||||
* Delete the stored password for the service and account.
|
||||
*
|
||||
* @param service The string service name.
|
||||
* @param account The string account name.
|
||||
*
|
||||
* @returns the string password or null on failures.
|
||||
*/
|
||||
export function deletePassword(service: string, account: string): string;
|
||||
|
||||
/**
|
||||
* Replace the password for the service and account in the keychain.
|
||||
*
|
||||
* This is a simple convenience function that internally calls deletePassword(service, account)
|
||||
* followed by addPassword(service, account, password).
|
||||
*
|
||||
* @param service The string service name.
|
||||
* @param account The string account name.
|
||||
* @param password The string password.
|
||||
*
|
||||
* @returns true on success, false on failure.
|
||||
*/
|
||||
export function replacePassword(service: string, account: string, password: string): boolean;
|
||||
|
||||
/**
|
||||
* Find a password for the service in the keychain.
|
||||
*
|
||||
* @param service The string service name.
|
||||
*
|
||||
* @returns the string password or null on failures.
|
||||
*/
|
||||
export function findPassword(service: string): string;
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
///<reference path='../../react/react.d.ts' />
|
||||
///<reference path='../../react/react-addons-linked-state-mixin.d.ts' />
|
||||
///<reference path='../../react/react-0.13.3.d.ts' />
|
||||
///<reference path='material-ui-0.11.1.d.ts' />
|
||||
|
||||
import * as React from "react";
|
||||
import * as LinkedStateMixin from "react-addons-linked-state-mixin";
|
||||
import * as React from "react/addons";
|
||||
|
||||
import mui = require("material-ui");
|
||||
import Colors = require("material-ui/lib/styles/colors");
|
||||
import AppBar = require("material-ui/lib/app-bar");
|
||||
@@ -475,4 +474,4 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
|
||||
|
||||
return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Nathan Brown <https://github.com/ngbrown>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path='../../react/react.d.ts' />
|
||||
///<reference path='../../react/react-0.13.3.d.ts' />
|
||||
|
||||
declare module "material-ui" {
|
||||
// The reason for exporting the namespace types (__MaterialUI.*) is to also export the type for casting variable.
|
||||
@@ -233,7 +233,7 @@ declare namespace __MaterialUI {
|
||||
}
|
||||
|
||||
// what's not commonly overridden by Checkbox, RadioButton, or Toggle
|
||||
interface CommonEnhancedSwitchProps<T> extends React.HTMLAttributes, React.Props<T> {
|
||||
interface CommonEnhancedSwitchProps<T> extends React.HTMLAttributesBase<T> {
|
||||
// <input/> is root element
|
||||
id?: string;
|
||||
iconStyle?: React.CSSProperties;
|
||||
@@ -412,7 +412,7 @@ declare namespace __MaterialUI {
|
||||
}
|
||||
|
||||
// non generally overridden elements of EnhancedButton
|
||||
interface SharedEnhancedButtonProps<T> extends React.HTMLAttributes, React.Props<T> {
|
||||
interface SharedEnhancedButtonProps<T> extends React.HTMLAttributesBase<T> {
|
||||
centerRipple?: boolean;
|
||||
containerElement?: string | React.ReactElement<any>;
|
||||
disabled?: boolean;
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
///<reference path='../../react/react.d.ts' />
|
||||
///<reference path='../../react/react-0.13.3.d.ts' />
|
||||
///<reference path='material-ui-0.12.1.d.ts' />
|
||||
|
||||
import * as React from "react/addons";
|
||||
@@ -465,4 +465,4 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
|
||||
|
||||
return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Nathan Brown <https://github.com/ngbrown>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path='../../react/react.d.ts' />
|
||||
///<reference path='../../react/react-0.13.3.d.ts' />
|
||||
|
||||
declare module "material-ui" {
|
||||
export import AppBar = __MaterialUI.AppBar; // require('material-ui/lib/app-bar');
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference path="../mongoose/mongoose.d.ts" />
|
||||
/// <reference path="./mongoose-auto-increment.d.ts" />
|
||||
|
||||
import * as autoIncrement from 'mongoose-auto-increment';
|
||||
import * as mongoose from 'mongoose';
|
||||
import { Schema } from 'mongoose';
|
||||
|
||||
var connection = mongoose.createConnection("mongodb://localhost/myDatabase");
|
||||
|
||||
autoIncrement.initialize(connection);
|
||||
|
||||
var bookSchema = new Schema({
|
||||
author: { type: Schema.Types.ObjectId, ref: 'Author' },
|
||||
title: String,
|
||||
genre: String,
|
||||
publishDate: Date
|
||||
});
|
||||
|
||||
bookSchema.plugin(autoIncrement.plugin, 'Book');
|
||||
var Book = connection.model('Book', bookSchema);
|
||||
@@ -0,0 +1,20 @@
|
||||
// Type definitions for mongoose-auto-increment 5.0.1
|
||||
// Project: https://github.com/codetunnel/mongoose-auto-increment
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../mongoose/mongoose.d.ts" />
|
||||
|
||||
declare module 'mongoose-auto-increment' {
|
||||
import { Connection, Schema, Mongoose } from 'mongoose';
|
||||
|
||||
/**
|
||||
* Initialize plugin by creating counter collection in database.
|
||||
*/
|
||||
function initialize(connection: Connection): void;
|
||||
|
||||
/**
|
||||
* The function to use when invoking the plugin on a custom schema.
|
||||
*/
|
||||
function plugin(schema: Schema, options: Object): void;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path="../mongoose/mongoose.d.ts" />
|
||||
/// <reference path="./mongoose-deep-populate.d.ts" />
|
||||
|
||||
import mongooseDeepPopulate from 'mongoose-deep-populate';
|
||||
import * as mongoose from 'mongoose';
|
||||
import { Schema } from 'mongoose';
|
||||
|
||||
var connection = mongoose.connect("mongodb://localhost/myDatabase");
|
||||
|
||||
var deepPopulate = mongooseDeepPopulate(connection);
|
||||
|
||||
var bookSchema = new Schema({
|
||||
author: { type: Schema.Types.ObjectId, ref: 'Author' },
|
||||
title: String,
|
||||
genre: String,
|
||||
publishDate: Date
|
||||
});
|
||||
|
||||
bookSchema.plugin(deepPopulate, {});
|
||||
@@ -0,0 +1,12 @@
|
||||
// Type definitions for mongoose-deep-populate 2.0.3
|
||||
// Project: https://github.com/buunguyen/mongoose-deep-populate
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../mongoose/mongoose.d.ts" />
|
||||
|
||||
declare module "mongoose-deep-populate" {
|
||||
import { Mongoose, Schema } from 'mongoose';
|
||||
|
||||
export default function(mognoose: Mongoose): (schema: Schema, options: Object) => void;
|
||||
}
|
||||
Vendored
+4
-4
@@ -212,7 +212,7 @@ declare namespace __React {
|
||||
displayName?: string;
|
||||
propTypes?: ValidationMap<any>;
|
||||
contextTypes?: ValidationMap<any>;
|
||||
childContextTypes?: ValidationMap<any>
|
||||
childContextTypes?: ValidationMap<any>;
|
||||
|
||||
getDefaultProps?(): P;
|
||||
getInitialState?(): S;
|
||||
@@ -591,7 +591,7 @@ declare namespace __React {
|
||||
x2?: number | string;
|
||||
x?: number | string;
|
||||
y1?: number | string;
|
||||
y2?: number | string
|
||||
y2?: number | string;
|
||||
y?: number | string;
|
||||
}
|
||||
|
||||
@@ -1021,7 +1021,7 @@ declare module "react/addons" {
|
||||
displayName?: string;
|
||||
propTypes?: ValidationMap<any>;
|
||||
contextTypes?: ValidationMap<any>;
|
||||
childContextTypes?: ValidationMap<any>
|
||||
childContextTypes?: ValidationMap<any>;
|
||||
|
||||
getDefaultProps?(): P;
|
||||
getInitialState?(): S;
|
||||
@@ -1399,7 +1399,7 @@ declare module "react/addons" {
|
||||
x2?: number | string;
|
||||
x?: number | string;
|
||||
y1?: number | string;
|
||||
y2?: number | string
|
||||
y2?: number | string;
|
||||
y?: number | string;
|
||||
}
|
||||
|
||||
|
||||
+6
-4
@@ -7,7 +7,6 @@
|
||||
/// <reference path="react-addons-transition-group.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
|
||||
interface CSSTransitionGroupTransitionName {
|
||||
enter: string;
|
||||
enterActive?: string;
|
||||
@@ -16,16 +15,19 @@ declare namespace __React {
|
||||
appear?: string;
|
||||
appearActive?: string;
|
||||
}
|
||||
|
||||
|
||||
interface CSSTransitionGroupProps extends TransitionGroupProps {
|
||||
transitionName: string | CSSTransitionGroupTransitionName;
|
||||
transitionAppear?: boolean;
|
||||
transitionAppearTimeout?: number;
|
||||
transitionEnter?: boolean;
|
||||
transitionEnterTimeout?: number;
|
||||
transitionLeave?: boolean;
|
||||
transitionLeaveTimeout?: number;
|
||||
}
|
||||
|
||||
|
||||
type CSSTransitionGroup = ComponentClass<CSSTransitionGroupProps>;
|
||||
|
||||
|
||||
namespace __Addons {
|
||||
export var CSSTransitionGroup: __React.CSSTransitionGroup;
|
||||
}
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ declare namespace __React {
|
||||
value: T;
|
||||
requestChange(newValue: T): void;
|
||||
}
|
||||
|
||||
|
||||
interface LinkedStateMixin extends Mixin<any, any> {
|
||||
linkState<T>(key: string): ReactLink<T>;
|
||||
}
|
||||
@@ -19,7 +19,7 @@ declare namespace __React {
|
||||
checkedLink?: ReactLink<boolean>;
|
||||
valueLink?: ReactLink<boolean | string | number>;
|
||||
}
|
||||
|
||||
|
||||
namespace __Addons {
|
||||
export var LinkedStateMixin: LinkedStateMixin;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -26,7 +26,7 @@ declare namespace __React {
|
||||
};
|
||||
totalTime: number;
|
||||
}
|
||||
|
||||
|
||||
namespace __Addons {
|
||||
namespace Perf {
|
||||
export function start(): void;
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
declare namespace __React {
|
||||
interface PureRenderMixin extends Mixin<any, any> {}
|
||||
|
||||
|
||||
namespace __Addons {
|
||||
export var PureRenderMixin: PureRenderMixin;
|
||||
}
|
||||
|
||||
Vendored
+12
-12
@@ -44,18 +44,18 @@ declare namespace __React {
|
||||
(element: Element, eventData?: SyntheticEventData): void;
|
||||
(component: Component<any, any>, eventData?: SyntheticEventData): void;
|
||||
}
|
||||
|
||||
|
||||
interface MockedComponentClass {
|
||||
new(): any;
|
||||
}
|
||||
|
||||
|
||||
class ShallowRenderer {
|
||||
getRenderOutput<E extends ReactElement<any>>(): E;
|
||||
getRenderOutput(): ReactElement<any>;
|
||||
render(element: ReactElement<any>, context?: any): void;
|
||||
unmount(): void;
|
||||
}
|
||||
|
||||
|
||||
namespace __Addons {
|
||||
namespace TestUtils {
|
||||
namespace Simulate {
|
||||
@@ -93,17 +93,17 @@ declare namespace __React {
|
||||
export var touchStart: EventSimulator;
|
||||
export var wheel: EventSimulator;
|
||||
}
|
||||
|
||||
|
||||
export function renderIntoDocument(
|
||||
element: DOMElement<any>): Element;
|
||||
export function renderIntoDocument<P>(
|
||||
element: ReactElement<P>): Component<P, any>;
|
||||
export function renderIntoDocument<C extends Component<any, any>>(
|
||||
element: ReactElement<any>): C;
|
||||
|
||||
|
||||
export function mockComponent(
|
||||
mocked: MockedComponentClass, mockTagName?: string): typeof TestUtils;
|
||||
|
||||
|
||||
export function isElementOfType(
|
||||
element: ReactElement<any>, type: ReactType): boolean;
|
||||
export function isDOMComponent(instance: ReactInstance): boolean;
|
||||
@@ -111,39 +111,39 @@ declare namespace __React {
|
||||
export function isCompositeComponentWithType(
|
||||
instance: ReactInstance,
|
||||
type: ComponentClass<any>): boolean;
|
||||
|
||||
|
||||
export function findAllInRenderedTree(
|
||||
root: Component<any, any>,
|
||||
fn: (i: ReactInstance) => boolean): ReactInstance[];
|
||||
|
||||
|
||||
export function scryRenderedDOMComponentsWithClass(
|
||||
root: Component<any, any>,
|
||||
className: string): Element[];
|
||||
export function findRenderedDOMComponentWithClass(
|
||||
root: Component<any, any>,
|
||||
className: string): Element;
|
||||
|
||||
|
||||
export function scryRenderedDOMComponentsWithTag(
|
||||
root: Component<any, any>,
|
||||
tagName: string): Element[];
|
||||
export function findRenderedDOMComponentWithTag(
|
||||
root: Component<any, any>,
|
||||
tagName: string): Element;
|
||||
|
||||
|
||||
export function scryRenderedComponentsWithType<P>(
|
||||
root: Component<any, any>,
|
||||
type: ComponentClass<P>): Component<P, {}>[];
|
||||
export function scryRenderedComponentsWithType<C extends Component<any, any>>(
|
||||
root: Component<any, any>,
|
||||
type: ComponentClass<any>): C[];
|
||||
|
||||
|
||||
export function findRenderedComponentWithType<P>(
|
||||
root: Component<any, any>,
|
||||
type: ComponentClass<P>): Component<P, {}>;
|
||||
export function findRenderedComponentWithType<C extends Component<any, any>>(
|
||||
root: Component<any, any>,
|
||||
type: ComponentClass<any>): C;
|
||||
|
||||
|
||||
export function createRenderer(): ShallowRenderer;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -23,7 +23,7 @@ declare namespace __React {
|
||||
$unshift?: any[];
|
||||
$splice?: any[][];
|
||||
}
|
||||
|
||||
|
||||
namespace __Addons {
|
||||
export function update(value: any[], spec: UpdateArraySpec): any[];
|
||||
export function update(value: {}, spec: UpdateSpec): any;
|
||||
|
||||
Vendored
+6
-7
@@ -6,11 +6,10 @@
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
|
||||
namespace __DOM {
|
||||
function findDOMNode<E extends Element>(instance: ReactInstance): E;
|
||||
function findDOMNode(instance: ReactInstance): Element;
|
||||
|
||||
|
||||
function render<P>(
|
||||
element: DOMElement<P>,
|
||||
container: Element,
|
||||
@@ -23,15 +22,15 @@ declare namespace __React {
|
||||
element: ReactElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
||||
|
||||
|
||||
function unmountComponentAtNode(container: Element): boolean;
|
||||
|
||||
|
||||
var version: string;
|
||||
|
||||
|
||||
function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
|
||||
function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
||||
function unstable_batchedUpdates(callback: () => any): void;
|
||||
|
||||
|
||||
function unstable_renderSubtreeIntoContainer<P>(
|
||||
parentComponent: Component<any, any>,
|
||||
nextElement: DOMElement<P>,
|
||||
@@ -48,7 +47,7 @@ declare namespace __React {
|
||||
container: Element,
|
||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
||||
}
|
||||
|
||||
|
||||
namespace __DOMServer {
|
||||
function renderToString(element: ReactElement<any>): string;
|
||||
function renderToStaticMarkup(element: ReactElement<any>): string;
|
||||
|
||||
+20
-20
@@ -68,34 +68,34 @@ var ClassicComponent: React.ClassicComponentClass<Props> =
|
||||
|
||||
class ModernComponent extends React.Component<Props, State>
|
||||
implements React.ChildContextProvider<ChildContext> {
|
||||
|
||||
|
||||
static propTypes: React.ValidationMap<Props> = {
|
||||
foo: React.PropTypes.number
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
static contextTypes: React.ValidationMap<Context> = {
|
||||
someValue: React.PropTypes.string
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
static childContextTypes: React.ValidationMap<ChildContext> = {
|
||||
someOtherValue: React.PropTypes.string
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
static defaultProps: Props;
|
||||
|
||||
|
||||
context: Context;
|
||||
|
||||
|
||||
getChildContext() {
|
||||
return {
|
||||
someOtherValue: 'foo'
|
||||
}
|
||||
someOtherValue: "foo"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
state = {
|
||||
inputValue: this.context.someValue,
|
||||
seconds: this.props.foo
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
reset() {
|
||||
this.setState({
|
||||
inputValue: this.context.someValue,
|
||||
@@ -104,7 +104,7 @@ class ModernComponent extends React.Component<Props, State>
|
||||
}
|
||||
|
||||
private _input: HTMLInputElement;
|
||||
|
||||
|
||||
render() {
|
||||
return React.DOM.div(null,
|
||||
React.DOM.input({
|
||||
@@ -342,7 +342,7 @@ interface TimerState {
|
||||
class Timer extends React.Component<{}, TimerState> {
|
||||
state = {
|
||||
secondsElapsed: 0
|
||||
}
|
||||
};
|
||||
private _interval: number;
|
||||
tick() {
|
||||
this.setState((prevState, props) => ({
|
||||
@@ -392,7 +392,7 @@ React.createFactory(React.addons.CSSTransitionGroup)({
|
||||
// --------------------------------------------------------------------------
|
||||
React.createClass({
|
||||
mixins: [React.addons.LinkedStateMixin],
|
||||
render: function() { return React.DOM.div(null) }
|
||||
render: function() { return React.DOM.div(null); }
|
||||
});
|
||||
|
||||
//
|
||||
@@ -411,7 +411,7 @@ React.addons.Perf.printDOM(measurements);
|
||||
// --------------------------------------------------------------------------
|
||||
React.createClass({
|
||||
mixins: [React.addons.PureRenderMixin],
|
||||
render: function() { return React.DOM.div(null) }
|
||||
render: function() { return React.DOM.div(null); }
|
||||
});
|
||||
|
||||
//
|
||||
@@ -427,7 +427,7 @@ var renderer: React.ShallowRenderer =
|
||||
renderer.render(React.createElement(Timer));
|
||||
var output: React.ReactElement<React.Props<Timer>> =
|
||||
renderer.getRenderOutput();
|
||||
|
||||
|
||||
//
|
||||
// TransitionGroup addon
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -437,7 +437,7 @@ React.createFactory(React.addons.TransitionGroup)({ component: "div" });
|
||||
// update addon
|
||||
// --------------------------------------------------------------------------
|
||||
{
|
||||
// These are copied from https://facebook.github.io/react/docs/update.html
|
||||
// These are copied from https://facebook.github.io/react/docs/update.html
|
||||
let initialArray = [1, 2, 3];
|
||||
let newArray = React.addons.update(initialArray, {$push: [4]}); // => [1, 2, 3, 4]
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
/// <reference path="react-addons-test-utils.d.ts" />
|
||||
/// <reference path="react-addons-transition-group.d.ts" />
|
||||
/// <reference path="react-addons-update.d.ts" />
|
||||
|
||||
import React = require("react");
|
||||
import ReactDOM = require("react-dom");
|
||||
import ReactDOMServer = require("react-dom/server");
|
||||
@@ -90,28 +91,28 @@ class ModernComponent extends React.Component<Props, State>
|
||||
|
||||
static propTypes: React.ValidationMap<Props> = {
|
||||
foo: React.PropTypes.number
|
||||
}
|
||||
};
|
||||
|
||||
static contextTypes: React.ValidationMap<Context> = {
|
||||
someValue: React.PropTypes.string
|
||||
}
|
||||
};
|
||||
|
||||
static childContextTypes: React.ValidationMap<ChildContext> = {
|
||||
someOtherValue: React.PropTypes.string
|
||||
}
|
||||
};
|
||||
|
||||
context: Context;
|
||||
|
||||
getChildContext() {
|
||||
return {
|
||||
someOtherValue: 'foo'
|
||||
}
|
||||
someOtherValue: "foo"
|
||||
};
|
||||
}
|
||||
|
||||
state = {
|
||||
inputValue: this.context.someValue,
|
||||
seconds: this.props.foo
|
||||
}
|
||||
};
|
||||
|
||||
reset() {
|
||||
this._myComponent.reset();
|
||||
@@ -417,7 +418,7 @@ interface TimerState {
|
||||
class Timer extends React.Component<{}, TimerState> {
|
||||
state = {
|
||||
secondsElapsed: 0
|
||||
}
|
||||
};
|
||||
private _interval: number;
|
||||
tick() {
|
||||
this.setState((prevState, props) => ({
|
||||
@@ -514,7 +515,7 @@ Perf.printDOM(measurements);
|
||||
// --------------------------------------------------------------------------
|
||||
React.createClass({
|
||||
mixins: [PureRenderMixin],
|
||||
render: function() { return React.DOM.div(null) }
|
||||
render: function() { return React.DOM.div(null); }
|
||||
});
|
||||
|
||||
//
|
||||
|
||||
Vendored
+2
-2
@@ -187,7 +187,7 @@ declare namespace __React {
|
||||
displayName?: string;
|
||||
propTypes?: ValidationMap<any>;
|
||||
contextTypes?: ValidationMap<any>;
|
||||
childContextTypes?: ValidationMap<any>
|
||||
childContextTypes?: ValidationMap<any>;
|
||||
|
||||
getDefaultProps?(): P;
|
||||
getInitialState?(): S;
|
||||
@@ -1884,7 +1884,7 @@ declare namespace __React {
|
||||
xmlLang?: string;
|
||||
xmlSpace?: string;
|
||||
y1?: number | string;
|
||||
y2?: number | string
|
||||
y2?: number | string;
|
||||
y?: number | string;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -60,7 +60,7 @@ interface SignalR {
|
||||
|
||||
starting(handler: () => void ): SignalR;
|
||||
received(handler: (data: any) => void ): SignalR;
|
||||
error(handler: (error: string) => void ): SignalR;
|
||||
error(handler: (error: Error) => void ): SignalR;
|
||||
stateChanged(handler: (change: SignalRStateChange) => void ): SignalR;
|
||||
disconnected(handler: () => void ): SignalR;
|
||||
connectionSlow(handler: () => void ): SignalR;
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/// <reference path="supertest-as-promised.d.ts" />
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="../jasmine/jasmine.d.ts" />
|
||||
|
||||
import * as request from 'supertest-as-promised';
|
||||
import * as express from 'express';
|
||||
|
||||
var app = express();
|
||||
|
||||
// chain your requests like you were promised:
|
||||
request(app)
|
||||
.get("/user")
|
||||
.expect(200)
|
||||
.then(function (res) {
|
||||
return request(app)
|
||||
.post("/kittens")
|
||||
.send({ userId: res})
|
||||
.expect(201);
|
||||
})
|
||||
.then(function (res) {
|
||||
// ...
|
||||
});
|
||||
|
||||
|
||||
// Usage
|
||||
request(app)
|
||||
.get("/kittens")
|
||||
.expect(200)
|
||||
.then(function (res) {
|
||||
// ...
|
||||
});
|
||||
|
||||
describe("GET /kittens", function () {
|
||||
it("should work", function () {
|
||||
return request(app).get("/kittens").expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Agents
|
||||
var agent = request.agent(app);
|
||||
agent
|
||||
.get("/ugly-kitteh")
|
||||
.expect(404)
|
||||
.then(function () {
|
||||
// ...
|
||||
})
|
||||
|
||||
|
||||
// Promisey goodness
|
||||
request(app)
|
||||
.get("/kittens")
|
||||
.expect(201)
|
||||
.then(function (res) { /* ... */ })
|
||||
// I'm a real promise now!
|
||||
.catch(function (err) { /* ... */ })
|
||||
|
||||
request(app)
|
||||
.get("/kittens")
|
||||
.expect(201)
|
||||
.toPromise()
|
||||
// I'm a real promise now!
|
||||
.delay(10)
|
||||
.then(function (res) { /* ... */ })
|
||||
@@ -0,0 +1,45 @@
|
||||
// Type definitions for SuperTest as Promised v2.0.2
|
||||
// Project: https://github.com/WhoopInc/supertest-as-promised
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path='../superagent/superagent.d.ts' />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
|
||||
declare module "supertest-as-promised" {
|
||||
// Mostly copy-pasted from supertest.d.ts
|
||||
|
||||
import * as superagent from 'superagent';
|
||||
import * as PromiseBluebird from 'bluebird';
|
||||
|
||||
function supertest(app: any): supertest.SuperTest;
|
||||
|
||||
module supertest {
|
||||
function agent(app?: any): supertest.SuperTest;
|
||||
|
||||
interface SuperTest extends superagent.SuperAgent<Test> {
|
||||
}
|
||||
|
||||
interface Promise<T> extends PromiseBluebird<T> {
|
||||
toPromise(): PromiseBluebird<T>;
|
||||
}
|
||||
|
||||
interface Test extends superagent.Request<Test> {
|
||||
url: string;
|
||||
serverAddress(app: any, path: string): string;
|
||||
expect(status: number): Promise<supertest.Response>;
|
||||
expect(status: number, body: string): Promise<supertest.Response>;
|
||||
expect(body: string): Promise<supertest.Response>;
|
||||
expect(body: RegExp): Promise<supertest.Response>;
|
||||
expect(body: Object): Promise<supertest.Response>;
|
||||
expect(field: string, val: string): Promise<supertest.Response>;
|
||||
expect(field: string, val: RegExp): Promise<supertest.Response>;
|
||||
expect(checker: (res: Response) => any): Promise<supertest.Response>;
|
||||
}
|
||||
|
||||
interface Response extends superagent.Response {
|
||||
}
|
||||
}
|
||||
|
||||
export = supertest;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/// <reference path="wake_on_lan.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import wol = require('wake_on_lan');
|
||||
|
||||
wol.wake("20:DE:20:DE:20:DE");
|
||||
|
||||
let errFunc:wol.ErrorCallback = function(error:any) {
|
||||
if (error) {
|
||||
// handle error
|
||||
} else {
|
||||
// done sending packets
|
||||
}
|
||||
};
|
||||
|
||||
var opts:wol.WakeOptions = { address: "192.168.1.1" };
|
||||
var opts1:wol.WakeOptions = { address: "192.168.1.1", num_packets: 3 };
|
||||
var opts2:wol.WakeOptions = { address: "192.168.1.1", num_packets: 3, interval: 4 };
|
||||
var opts3:wol.WakeOptions = { address: "192.168.1.1", num_packets: 3, interval: 4, port: 5 };
|
||||
var opts4:wol.WakeOptions = { address: "192.168.1.1" };
|
||||
var opts5:wol.WakeOptions = { address: "192.168.1.1", interval: 4 };
|
||||
var opts6:wol.WakeOptions = { address: "192.168.1.1", port: 5 };
|
||||
var opts7:wol.WakeOptions = { address: "192.168.1.1", interval: 4, port: 5 };
|
||||
var opts8:wol.WakeOptions = { num_packets: 3 };
|
||||
var opts9:wol.WakeOptions = { num_packets: 3, interval: 4 };
|
||||
var opts10:wol.WakeOptions = { num_packets: 3, port: 5 };
|
||||
var opts11:wol.WakeOptions = { num_packets: 3, interval: 4, port: 5 };
|
||||
var opts12:wol.WakeOptions = { interval: 4 };
|
||||
var opts13:wol.WakeOptions = { interval: 4, port: 5 };
|
||||
var opts14:wol.WakeOptions = { port: 5 };
|
||||
var opts15:wol.WakeOptions = { };
|
||||
|
||||
wol.wake('20:DE:20:DE:20:DE');
|
||||
wol.wake('20:DE:20:DE:20:DE', opts);
|
||||
wol.wake('20:DE:20:DE:20:DE', errFunc);
|
||||
wol.wake('20:DE:20:DE:20:DE', opts, errFunc);
|
||||
|
||||
|
||||
var magic_packet:Buffer = wol.createMagicPacket('20:DE:20:DE:20:DE');
|
||||
Vendored
+73
@@ -0,0 +1,73 @@
|
||||
// Type definitions for wake_on_lan
|
||||
// Project: https://github.com/agnat/node_wake_on_lan
|
||||
// Definitions by: Tobias Kahlert <https://github.com/SrTobi>
|
||||
// Definitions: https://github.com/SrTobi/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module wol {
|
||||
|
||||
export interface WakeOptions {
|
||||
|
||||
/**
|
||||
* The ip address to which the packet is send (default: 255.255.255.255)
|
||||
*/
|
||||
address?:string;
|
||||
|
||||
/**
|
||||
* Number of packets to send (default: 3)
|
||||
*/
|
||||
num_packets?:number;
|
||||
|
||||
/**
|
||||
* The interval between packets (default: 100ms)
|
||||
*/
|
||||
interval?:number;
|
||||
|
||||
/**
|
||||
* The port to send to (default: 9)
|
||||
*/
|
||||
port?:number;
|
||||
}
|
||||
|
||||
type ErrorCallback = (Error:any) => void;
|
||||
|
||||
export interface Wol {
|
||||
/**
|
||||
* Send a sequence of Wake-on-LAN magic packets to the given MAC address.
|
||||
*
|
||||
* @param {string} macAddress the mac address of the target device
|
||||
*/
|
||||
wake(macAddress:string):void;
|
||||
|
||||
/**
|
||||
* Send a sequence of Wake-on-LAN magic packets to the given MAC address.
|
||||
*
|
||||
* @param {string} macAddress the mac address of the target device
|
||||
* @param {ErrorCallback} callback is called when all packets have been sent or an error occurs.
|
||||
*/
|
||||
wake(macAddress:string, callback:ErrorCallback):void;
|
||||
|
||||
/**
|
||||
* Send a sequence of Wake-on-LAN magic packets to the given MAC address.
|
||||
*
|
||||
* @param {string} macAddress the mac address of the target device
|
||||
* @param {WakeOptions} opts additional options to send the packet
|
||||
* @param {ErrorCallback} callback is called when all packets have been sent or an error occurs.
|
||||
*/
|
||||
wake(macAddress:string, opts:WakeOptions, callback?:Function):void;
|
||||
|
||||
/**
|
||||
* Creates a buffer with a magic packet for the given MAC address.
|
||||
*
|
||||
* @param {string} macAddress mac address of the target device
|
||||
* @return {Buffer} the magic packet
|
||||
*/
|
||||
createMagicPacket(macAddress:string):Buffer;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'wake_on_lan' {
|
||||
var wol: wol.Wol;
|
||||
export = wol;
|
||||
}
|
||||
Reference in New Issue
Block a user