This commit is contained in:
Damian Connolly
2015-07-21 00:07:51 +02:00
93 changed files with 12200 additions and 6951 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "0.10"
- "iojs-v2"
sudo: false
+1 -2
View File
@@ -1,4 +1,4 @@
/// <reference path='acl-mongodbBackend.d.ts'/>
/// <reference path='acl.d.ts'/>
// https://github.com/OptimalBits/node_acl/blob/master/Readme.md
import Acl = require('acl');
@@ -14,4 +14,3 @@ acl.allow('guest', 'blogs', 'view');
// allow function accepts arrays as any parameter
acl.allow('member', 'blogs', ['edit','view', 'delete']);
-22
View File
@@ -1,22 +0,0 @@
// Type definitions for node_acl 0.4.7
// Project: https://github.com/optimalbits/node_acl
// Definitions by: Qubo <https://github.com/tkQubo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="acl.d.ts" />
/// <reference path="../mongodb/mongodb.d.ts" />
declare module "acl" {
import mongo = require('mongodb');
interface AclStatic {
mongodbBackend: MongodbBackendStatic;
}
interface MongodbBackend extends Backend<Callback> { }
interface MongodbBackendStatic {
new(db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend;
new(db: mongo.Db, prefix: string): MongodbBackend;
new(db: mongo.Db): MongodbBackend;
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
/// <reference path='acl-redisBackend.d.ts'/>
/// <reference path='acl.d.ts'/>
// https://github.com/OptimalBits/node_acl/blob/master/Readme.md
import Acl = require('acl');
-21
View File
@@ -1,21 +0,0 @@
// Type definitions for node_acl 0.4.7
// Project: https://github.com/optimalbits/node_acl
// Definitions by: Qubo <https://github.com/tkQubo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="acl.d.ts" />
/// <reference path='../redis/redis.d.ts'/>
declare module "acl" {
import redis = require('redis');
interface AclStatic {
redisBackend: RedisBackendStatic;
}
interface RedisBackend extends Backend<redis.RedisClient> { }
interface RedisBackendStatic {
new(redis: redis.RedisClient, prefix: string): RedisBackend;
new(redis: redis.RedisClient): RedisBackend;
}
}
+30
View File
@@ -6,6 +6,9 @@
/// <reference path="../bluebird/bluebird.d.ts" />
/// <reference path='../node/node.d.ts'/>
/// <reference path='../redis/redis.d.ts'/>
/// <reference path="../mongodb/mongodb.d.ts" />
declare module "acl" {
import http = require('http');
import Promise = require("bluebird");
@@ -115,6 +118,33 @@ declare module "acl" {
end: () => void;
}
// for redis backend
import redis = require('redis');
interface AclStatic {
redisBackend: RedisBackendStatic;
}
interface RedisBackend extends Backend<redis.RedisClient> { }
interface RedisBackendStatic {
new(redis: redis.RedisClient, prefix: string): RedisBackend;
new(redis: redis.RedisClient): RedisBackend;
}
// for mongodb backend
import mongo = require('mongodb');
interface AclStatic {
mongodbBackend: MongodbBackendStatic;
}
interface MongodbBackend extends Backend<Callback> { }
interface MongodbBackendStatic {
new(db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend;
new(db: mongo.Db, prefix: string): MongodbBackend;
new(db: mongo.Db): MongodbBackend;
}
var _: AclStatic;
export = _;
}
-4
View File
@@ -9,10 +9,6 @@ interface Window {
token: string;
}
interface Location {
origin: string;
}
/** This is the interface for the main Auth0 client. */
interface Auth0Static {
+386
View File
@@ -0,0 +1,386 @@
/// <reference path="./baconjs.d.ts" />
function CreatingStreams() {
$("#my-div").asEventStream("click");
$("#my-div").asEventStream("click", ".more-specific-selector");
$("#my-div").asEventStream("click", (event, args) => args[0]);
$("#my-div").asEventStream("click", ".more-specific-selector", (event, args) => args[0]);
Bacon.fromPromise($.ajax("https://baconjs.github.io/"));
Bacon.fromPromise(Promise.resolve(1));
Bacon.fromPromise($.ajax("https://baconjs.github.io/"), true);
Bacon.fromPromise(Promise.resolve(1), false);
Bacon.fromPromise($.ajax("https://baconjs.github.io/"), true, (n:string) => {
return [new Bacon.Next(n), new Bacon.Next(() => n), new Bacon.End()];
});
Bacon.fromPromise(Promise.resolve(1), false, n => {
return [new Bacon.Next(n), new Bacon.Next(() => n), new Bacon.End()];
});
Bacon.fromEvent(document.body, "click").onValue(() => {
alert("Bacon!");
});
Bacon.fromEvent(document.body, "click", (event:MouseEvent) => event.clientX).onValue(clientX => {
alert("Bacon!");
});
Bacon.fromEvent(process.stdin, "readable", () => {
alert("Bacon!");
});
// This would create a stream that outputs a single value "Bacon!" and ends after that. The use of setTimeout causes the value to be delayed by 1 second.
Bacon.fromCallback(callback => {
setTimeout(() => {
callback("Bacon!");
}, 1000);
});
// You can also give any number of arguments to `fromCallback`, which will be passed to the function. These arguments can be simple variables, Bacon EventStreams or Properties. For example the following will output "Bacon rules":
Bacon.fromCallback((a, b, callback) => {
callback(a + " " + b);
}, Bacon.constant("bacon"), "rules").log();
{
var fs = require("fs"),
read = Bacon.fromNodeCallback(fs.readFile, "input.txt");
read.onError(error => {
console.log("Reading failed: " + error);
});
read.onValue(value => {
console.log("Read contents: " + value);
});
}
Bacon.once(new Bacon.Error("fail"));
// The following would lead to `1,2,3,1,2,3...` to be repeated indefinitely:
Bacon.fromArray([1, new Bacon.Error("")]);
Bacon.repeatedly(10, [1, 2, 3]);
// The following will produce values `0,1,2`.
Bacon.repeat(i => {
if (i < 3) {
return Bacon.once(i);
} else {
return false;
}
}).log();
{
var stream = Bacon.fromBinder(sink => {
sink("first value");
sink([new Bacon.Next("2nd"), new Bacon.Next("3rd")]);
sink(new Bacon.Next(() => {
return "This one will be evaluated lazily"
}));
sink(new Bacon.Error("oops, an error"));
sink(new Bacon.End());
return () => {
// unsub functionality here, this one's a no-op
};
});
stream.log();
}
new Bacon.Next("value");
new Bacon.Next(() => "value");
}
function CommonMethodsInEventStreamsAndProperties() {
// Converting strings to integers, skipping empty values:
Bacon.once("").flatMap(text => {
return text != "" ? parseInt(text) : Bacon.never();
});
Bacon.sequentially(1, [1, 2, 3]).scan(0, (a, b) => a + b);
Bacon.sequentially(1, [1, 2, 3]).diff(0, (a, b) => Math.abs(b - a));
// If you have a EventStream `s` with a value sequence `1,2,3,4,5`, the respective values in `s.slidingWindow(2)` would be `[],[1],[1,2],[2,3],[3,4],[4,5]`:
Bacon.fromArray([1, 2, 3, 4, 5]).slidingWindow(2);
// The values of `s.slidingWindow(2,2)`would be `[1,2],[2,3],[3,4],[4,5]`:
Bacon.fromArray([1, 2, 3, 4, 5]).slidingWindow(2, 2);
{
var x = Bacon.fromArray([1, 2]), y = Bacon.fromArray([3, 4]);
x.zip(y, (x, y) => x + y);
}
{
var stream = Bacon.fromArray([1, 2]);
stream.log("New event in myStream");
stream.log();
}
Bacon.fromArray([1, 2, 3]).withStateMachine(0, (sum, event) => {
if (event.hasValue()) {
// had to cast to `number` because event:Bacon.Next<number>|Bacon.Error<{}>
return [sum + <number>event.value(), []];
}
else if (event.isEnd()) {
return [undefined, [new Bacon.Next(sum), event]];
}
else {
return [sum, [event]];
}
});
{
var property = Bacon.fromArray([1, 2, 3]).toProperty(),
who = Bacon.fromArray(["A", "B", "C"]).toProperty();
property.decode({1: "mike", 2: who});
property.decode({1: {type: "mike"}, 2: {type: "other", whoThen: who}});
}
{
// This is handy for keeping track whether we are currently awaiting an AJAX response:
var ajaxRequest = <Bacon.Observable<Error, JQueryXHR>>{},
ajaxResponse = <Bacon.Observable<Error, JQueryXHR>>{},
showAjaxIndicator = ajaxRequest.awaiting(ajaxResponse);
}
Bacon.fromArray([1, 2, -3, 3]).withHandler(function (event) {
if (event.hasValue() && event.value() < 0) {
this.push(new Bacon.Error("Value below zero"));
return this.push(new Bacon.End());
} else {
return this.push(event);
}
});
{
var src = Bacon.once(1),
obs = src.map(x => -x);
console.log(obs.toString()); // > "Bacon.once(1).map(function)"
obs.withDescription(src, "times", -1);
console.log(obs.toString()); // > "Bacon.once(1).times(-1)"
}
{
// Calculator for grouped consecutive values until group is cancelled:
var events = [
{id: 1, type: "add", val: 3},
{id: 2, type: "add", val: -1},
{id: 1, type: "add", val: 2},
{id: 2, type: "cancel"},
{id: 3, type: "add", val: 2},
{id: 3, type: "cancel"},
{id: 1, type: "add", val: 1},
{id: 1, type: "add", val: 2},
{id: 1, type: "cancel"}
],
keyF = (event:{id:number}) => event.id,
limitF = (groupedStream:Bacon.EventStream<string, {id:number; type:string; val?:number}>) => {
var cancel = groupedStream.filter(x => x.type === "cancel").take(1),
adds = groupedStream.filter(x => x.type === "add");
return adds.takeUntil(cancel).map(x => x.val);
};
Bacon.sequentially(2, events)
.groupBy(keyF, limitF)
.flatMap(groupedStream => groupedStream.fold(0, (acc, x) => acc + x))
.onValue(sum => {
console.log(sum); // returns [-1, 2, 8] in an order
});
}
}
function EventStream() {
// This creates the stream which doesn't produce any events and never ends:
Bacon.interval(1e1, 0).last();
Bacon.fromArray([1, 2, 2, 1])
.skipDuplicates().log(); // > returns [1, 2, 1] in an order
// You might get two events containing [1,2,3,4] and [5,6,7] respectively, given that the flush occurs between numbers 4 and 5:
Bacon.fromArray([1, 2, 3, 4, 5, 6, 7]).bufferWithTime(0);
// Here's an equivalent to `stream.bufferWithTime(10)`:
{
var stream = Bacon.fromArray([1, 2, 3, 4, 5, 6, 7]);
stream.bufferWithTime(f => {
setTimeout(f, 10);
});
}
// You will get output events with values `[1, 2]`, `[3, 4]` and `[5]`.
Bacon.fromArray([1, 2, 3, 4, 5]).bufferWithCount(2);
}
function Property() {
// This creates the property which doesn't produce any events and never ends:
Bacon.interval(1e1, 0).toProperty().last();
{
var property = Bacon.fromArray([1, 2, 3, 4, 5]).toProperty();
// If you want to assign your Property to the "disabled" attribute of a JQuery object, you can do this:
property.assign($("#my-button"), "attr", "disabled");
// A simpler example would be to toggle the visibility of an element based on a Property:
property.assign($("#my-button"), "toggle");
}
Bacon.fromArray([1, 2, 2, 1]).toProperty()
.skipDuplicates().log(); // > returns [1, 2, 1] in an order
}
function CombiningMultipleStreamsAndProperties() {
{
var property = Bacon.constant(1),
stream = Bacon.once(2),
constant = 3;
Bacon.combineAsArray(property, stream, constant)
.log(); // > returns [1, 2, 3]
}
{
// To calculate the current sum of three numeric Properties, you can do:
var property = Bacon.constant(1),
stream = Bacon.once(2),
constant = 3;
// NOTE: had to explicitly specify the typing for `x:number, y:number, z:number`
Bacon.combineWith((x:number, y:number, z:number) => x + y + z, property, stream, constant);
}
{
// Assuming you've got streams or properties named `password`, `username`, `firstname` and `lastname`, you can do:
var password = Bacon.constant("easy"),
username = Bacon.constant("juha"),
firstname = Bacon.constant("juha"),
lastname = Bacon.constant("paananen"),
// NOTE: you should provide `combineTemplate` typing explicitly!
loginInfo = Bacon.combineTemplate<string, {
magicNumber:number; userid:string; passwd:string;
name:{first:string; last:string}
}>({
magicNumber: 3,
userid: username,
passwd: password,
name: {first: firstname, last: lastname}
}).onValue(loginInfo => {
// and your new `loginInfo` property will combine values from all these streams using that template, whenever any of the streams/properties get a new value. It would yield a value:
console.log("`loginInfo` expected", {
magicNumber: 3,
userid: "juha",
passwd: "easy",
name: {first: "juha", last: "paananen"}
});
console.log("`loginInfo` actual", loginInfo);
});
// Note that all Bacon.combine* methods produce a `Property` instead of an `EventStream`. If you need the result as an `EventStream` you might want to use `property.changes()`:
Bacon.combineWith((firstname, lastname) => `${firstname} ${lastname}`, firstname, lastname).changes();
}
{
var x = Bacon.fromArray([1, 2, 3]),
y = Bacon.fromArray([10, 20, 30]),
z = Bacon.fromArray([100, 200, 300]);
Bacon.zipAsArray(x, y, z)
.log(); // > returns values `[1, 10, 100]`, `[2, 20, 200]` and `[3, 30, 300]`
}
// The following example would log the number 3.
// NOTE: had to explicitly specify the typing for `a:number, b:number`
Bacon.onValues(Bacon.constant(1), Bacon.constant(2), (a:number, b:number) => {
console.log(a + b);
});
}
function $Event() {
new Bacon.Next("value");
new Bacon.Next(() => "value");
}
function Errors() {
// In case you want to convert (some) value events into Error events, you may use `flatMap` like this:
// NOTE: had to explicitly specify the typing for `flatMap`
Bacon.fromArray([1, 2, 3, 4]).flatMap<number>(x => {
return x > 2 ? new Bacon.Error("too big") : x;
});
// Conversely, if you want to convert some Error events into value events, you may use `flatMapError`:
Bacon.fromArray<string, number>([1, 2, 3, 4]).flatMapError<number>(error => {
var isNonCriticalError = (error:string) => Math.random() < .5,
handleNonCriticalError = (error:string) => 42;
return isNonCriticalError(error) ? handleNonCriticalError(error) : new Bacon.Error(error);
});
// Note also that Bacon.js combinators do not catch errors that are thrown. Especially `map` doesn't do so. If you want to map things and wrap caught errors into Error events, you can do the following:
Bacon.fromArray([1, 2, 3, 4]).flatMap(x => {
var dangerousFunction = (x:number) => {
throw new Error("dangerous function!");
};
try {
return dangerousFunction(x);
} catch (e) {
return new Bacon.Error(e);
}
});
Bacon.once("https://baconjs.github.io/").flatMap(url => {
// `ajaxCall` gives `Error`s on network or server `Error`s.
var ajaxCall = (url:string) => {
return Bacon.fromPromise<JQueryXHR, JQueryXHR>($.ajax(url));
};
return Bacon.retry({
source: () => ajaxCall(url),
retries: 5,
isRetryable: (error:JQueryXHR) => error.status !== 404,
delay: context => 100 // Just use the same delay always
});
});
}
function JoinPatterns() {
{
// Consider implementing a game with discrete time ticks. We want to handle key-events synchronized on tick-events, with at most one key event handled per tick. If there are no key events, we want to just process a tick:
var tick = Bacon.interval(1e2, 0),
keyEvent = Bacon.fromEvent(document.body, "click", _ => Date.now()),
handleTick = (_:number) => `timestamp: NONE`,
handleKeyEvent = (timestamp:number) => `timestamp: ${timestamp}`;
Bacon.when(
[tick, keyEvent], (_:number, timestamp:number) => handleKeyEvent(timestamp),
[tick], handleTick
);
// Order is important here. If the [tick] patterns had been written first, this would have been tried first, and preferred at each tick.
}
{
// Join patterns are indeed a generalization of `zip`, and `zip` is equivalent to a single-rule join pattern. The following `Observable`s have the same output:
var a = Bacon.once("a"),
b = Bacon.once("b"),
c = Bacon.once("c"),
f = (a:string, b:string, c:string) => `a = ${a}; b = ${b}; c = ${c}.`;
Bacon.zipWith(f, a, b, c);
Bacon.when([a, b, c], f);
}
{
// The inputs to `Bacon.update` are defined like this:
var initial = 0,
x = Bacon.interval(1e3, 1),
y = Bacon.interval(2e3, 1),
z = Bacon.interval(1.5e3, 1);
// NOTE: had to explicitly specify the typing for `previous:number`
Bacon.update(initial,
[x, y, z], (previous:number, x:number, y:number, z:number) => previous + x + y + z,
[x, y], (previous:number, x:number, y:number) => previous + x + y
);
// As input, each function above will get the previous value of the `result` Property, along with values from the listed Observables. The value returned by the function will be used as the next value of `result`. Just like in `Bacon.when`, only EventStreams will trigger an update, while Properties will be just sampled. So, if you list a single EventStream and several Properties, the value will be updated only when an event occurs in the EventStream.
}
{
// Here's a simple gaming example:
var scoreMultiplier = Bacon.constant(1),
hitUfo = new Bacon.Bus(),
hitMotherShip = new Bacon.Bus(),
score = Bacon.update(0,
[hitUfo, scoreMultiplier], (score:number, _:number, multiplier:number) => score + 100 * multiplier,
[hitMotherShip], (score:number, _:number) => score + 2000
);
// In the example, the `score` property is updated when either `hitUfo` or `hitMotherShip` occur. The `scoreMultiplier` Property is sampled to take multiplier into account when `hitUfo` occurs.
}
}
+2746
View File
File diff suppressed because it is too large Load Diff
+10
View File
@@ -0,0 +1,10 @@
/// <reference path="camel-case.d.ts" />
import camelCase = require('camel-case');
console.log(camelCase('string')); // => "string"
console.log(camelCase('dot.case')); // => "dotCase"
console.log(camelCase('PascalCase')); // => "pascalCase"
console.log(camelCase('version 1.2.10')); // => "version1_2_10"
console.log(camelCase('STRING 1.2', 'tr')); // => "strıng1_2"
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for camel-case
// Project: https://github.com/blakeembrey/camel-case
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "camel-case" {
function camelCase(string: string, locale?: string): string;
export = camelCase;
}
+1
View File
@@ -44,6 +44,7 @@ interface Cheerio {
// Traversing
find(selector: string): Cheerio;
find(element: Cheerio): Cheerio;
parent(selector?: string): Cheerio;
parents(selector?: string): Cheerio;
+1 -1
View File
@@ -161,7 +161,7 @@ function test_dom_element() {
}
function test_dom_event() {
var event = new CKEDITOR.dom.event(new Event());
var event = new CKEDITOR.dom.event(new Event(""));
alert(event.getKey());
alert(event.getKeystroke() == 65);
alert(event.getKeystroke() == CKEDITOR.CTRL + 65);
@@ -0,0 +1,13 @@
/// <reference path='./connect-modrewrite.d.ts' />
/// <reference path='../express/express.d.ts' />
import modRewrite = require('connect-modrewrite');
import express = require('express');
var app = express();
app.use(modRewrite([
'^/test$ /index.html',
'^/test/\\d*$ /index.html [L]',
'^/test/\\d*/\\d*$ /flag.html [L]',
]));
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for connect-modrewrite
// Project: https://github.com/tinganho/connect-modrewrite
// Definitions by: Tingan Ho <https://github.com/tinganho/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../express/express.d.ts" />
declare module 'connect-modrewrite' {
import express = require('express');
function modrewrite(rewrites: string[]): express.RequestHandler;
export = modrewrite;
}
+502
View File
@@ -0,0 +1,502 @@
/// <reference path="core-js.d.ts" />
interface Point { x: number; y: number; }
interface Point3D extends Point { z: number; }
let a: any;
let s: string;
let i: number;
let b: boolean;
let f: () => void;
let o: Object;
let r: RegExp;
let sym: symbol;
let e: Error;
let date: Date;
let key: PropertyKey;
let point: Point;
let point3d: Point3D;
let arrayOfPoint: Point[];
let arrayOfPoint3D: Point3D[];
let arrayOfSymbol: symbol[];
let arrayOfPropertyKey: PropertyKey[];
let arrayOfAny: any[];
let arrayOfStringAny: [string, any][];
let arrayLikeOfAny: ArrayLike<any>;
let iterableOfPoint: Iterable<Point>;
let iterableOfStringPoint: Iterable<[string, Point]>;
let iterableOfPointPoint3D: Iterable<[Point, Point3D]>;
let iterableIteratorOfPoint: IterableIterator<Point>;
let iterableIteratorOfNumberPoint: IterableIterator<[number, Point]>;
let iterableIteratorOfNumber: IterableIterator<number>;
let iterableIteratorOfString: IterableIterator<string>;
let iterableIteratorOfPointPoint: IterableIterator<[Point, Point]>;
let iterableIteratorOfNode: IterableIterator<Node>;
let iterableIteratorOfStringPoint: IterableIterator<[string, Point]>;
let iterableIteratorOfAny: IterableIterator<any>;
let iterableIteratorOfPropertyKey: IterableIterator<PropertyKey>;
let iterableIteratorOfPropertyKeyPoint: IterableIterator<[PropertyKey, Point]>;
let nodeList: NodeList;
let pd: PropertyDescriptor;
let pdm: PropertyDescriptorMap;
let map: Map<string, Point>;
let set: Set<Point>;
let weakMap: WeakMap<Point, Point3D>;
let weakSet: WeakSet<Point>;
let $forOfPoint: $for<Point>;
let $forOfPoint3D: $for<Point3D>;
let promiseLikeOfPoint: PromiseLike<Point>;
let promiseLikeOfPoint3D: PromiseLike<Point3D>;
let promiseOfPoint: Promise<Point>;
let promiseOfPoint3D: Promise<Point3D>;
let promiseOfArrayOfPoint: Promise<Point[]>;
let promiseOfVoid: Promise<void>;
let dictOfPoint: Dict<Point>;
let dictOfPoint3D: Dict<Point3D>;
let dictOfAny: Dict<any>;
// #############################################################################################
// ECMAScript 6: Object & Function
// Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of,
// es6.object.to-string, es6.function.name and es6.function.has-instance.
// #############################################################################################
point = Object.assign(point, point);
b = Object.is(point, point);
Object.setPrototypeOf(point, point);
s = f.name;
b = f[Symbol.hasInstance](point);
// #############################################################################################
// ECMAScript 6: Array
// Modules: es6.array.from, es6.array.of, es6.array.copy-within, es6.array.fill, es6.array.find,
// and es6.array.find-index
// #############################################################################################
point = arrayOfPoint.find(p => b);
i = arrayOfPoint.findIndex(p => b);
arrayOfPoint = arrayOfPoint.fill(point, i, arrayOfPoint.length);
arrayOfPoint = arrayOfPoint.copyWithin(i, i, i);
a = arrayOfPoint[Symbol.unscopables];
arrayOfPoint = Array.from(arrayOfPoint);
arrayOfPoint = Array.from(iterableOfPoint);
arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d);
arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d, a);
arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d);
arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d, a);
arrayOfPoint = Array.of(point, point);
// #############################################################################################
// ECMAScript 6: String & RegExp
// Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at,
// es6.string.ends-with, es6.string.includes, es6.string.repeat,
// es6.string.starts-with, and es6.regexp
// #############################################################################################
i = s.codePointAt(i);
b = s.includes(s, i);
b = s.endsWith(s, i);
s = s.repeat(i);
b = s.startsWith(s, i);
s = String.fromCodePoint(i, i);
s = String.raw`abc`;
s = r.flags;
// #############################################################################################
// ECMAScript 6: Number & Math
// Modules: es6.number.constructor, es6.number.statics, and es6.math
// #############################################################################################
i = Number.EPSILON;
b = Number.isFinite(i);
b = Number.isInteger(i);
b = Number.isNaN(i);
b = Number.isSafeInteger(i);
i = Number.MAX_SAFE_INTEGER;
i = Number.MIN_SAFE_INTEGER;
i = Number.parseFloat(s);
i = Number.parseInt(s);
i = Number.parseInt(s, i);
i = Math.clz32(i);
i = Math.imul(i, i);
i = Math.sign(i);
i = Math.log10(i);
i = Math.log2(i);
i = Math.log1p(i);
i = Math.expm1(i);
i = Math.cosh(i);
i = Math.sinh(i);
i = Math.tanh(i);
i = Math.acosh(i);
i = Math.asinh(i);
i = Math.atanh(i);
i = Math.hypot(i, i);
i = Math.trunc(i);
i = Math.fround(i);
i = Math.cbrt(i);
// #############################################################################################
// ECMAScript 6: Symbols
// Modules: es6.symbol
// #############################################################################################
sym = Symbol();
sym = Symbol(s);
sym = Symbol.for(s);
s = Symbol.keyFor(sym);
sym = Symbol.hasInstance;
sym = Symbol.isConcatSpreadable;
sym = Symbol.iterator;
sym = Symbol.match;
sym = Symbol.replace;
sym = Symbol.search;
sym = Symbol.species;
sym = Symbol.split;
sym = Symbol.toPrimitive;
sym = Symbol.toStringTag;
sym = Symbol.unscopables;
b = o.hasOwnProperty(sym);
b = o.hasOwnProperty(i);
b = o.propertyIsEnumerable(sym);
b = o.propertyIsEnumerable(i);
arrayOfSymbol = Object.getOwnPropertySymbols(a);
pd = Object.getOwnPropertyDescriptor(a, sym);
pd = Object.getOwnPropertyDescriptor(a, i);
Object.defineProperty(a, sym, pd);
Object.defineProperty(a, i, pd);
s = Math[Symbol.toStringTag];
s = JSON[Symbol.toStringTag];
// Non-standard
Symbol.useSimple();
Symbol.userSetter();
// #############################################################################################
// ECMAScript 6: Collections
// Modules: es6.map, es6.set, es6.weak-map, and es6.weak-set
// #############################################################################################
map.clear();
map.delete(s);
map.forEach((value: Point, key: string) => { });
point = map.get(s);
b = map.has(s);
map = map.set(s, point);
i = map.size;
map = new Map<string, Point>();
map = new Map(iterableOfStringPoint);
set.clear();
set.delete(point);
set.forEach((value: Point, key: Point) => { });
b = set.has(point);
set = set.add(point);
i = set.size;
set = new Set<Point>();
set = new Set(iterableOfPoint);
weakMap.delete(point);
point3d = weakMap.get(point);
b = weakMap.has(point);
weakMap = weakMap.set(point, point3d);
weakMap = new WeakMap<Point, Point3D>();
weakMap = new WeakMap(iterableOfPointPoint3D);
weakSet.delete(point);
weakSet = weakSet.add(point);
b = weakSet.has(point);
weakSet = new WeakSet<Point>();
weakSet = new WeakSet(iterableOfPoint);
// #############################################################################################
// ECMAScript 6: Iterators
// Modules: es6.string.iterator, es6.array.iterator, es6.map, es6.set, web.dom.iterable
// #############################################################################################
iterableIteratorOfPoint = arrayOfPoint[Symbol.iterator]();
iterableIteratorOfNumberPoint = arrayOfPoint.entries();
iterableIteratorOfNumber = arrayOfPoint.keys();
iterableIteratorOfPoint = arrayOfPoint.values();
iterableIteratorOfStringPoint = map.entries();
iterableIteratorOfString = map.keys();
iterableIteratorOfPoint = map.values();
iterableIteratorOfStringPoint = map[Symbol.iterator]();
iterableIteratorOfPointPoint = set.entries();
iterableIteratorOfPoint = set.keys();
iterableIteratorOfPoint = set.values();
iterableIteratorOfPoint = set[Symbol.iterator]();
iterableIteratorOfNode = nodeList[Symbol.iterator]();
$for(iterableOfPoint).of((value: Point) => { });
arrayOfPoint = $for(iterableOfPoint).array();
arrayOfPoint3D = $for(iterableOfPoint).array(p => point3d);
$forOfPoint = $for(iterableOfPoint).filter(p => b);
$forOfPoint3D = $for(iterableOfPoint).map(p => point3d);
// #############################################################################################
// ECMAScript 6: Promises
// Modules: es6.promise
// #############################################################################################
promiseLikeOfPoint.then((point: Point) => { });
promiseLikeOfPoint = promiseLikeOfPoint.then();
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point);
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint);
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => point);
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => point);
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => promiseLikeOfPoint);
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => { });
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => { });
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => point3d);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => point3d);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => promiseLikeOfPoint3D);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => { });
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => { });
promiseOfPoint.then((point: Point) => { });
promiseOfPoint = promiseOfPoint.then();
promiseOfPoint = promiseOfPoint.then(p => point);
promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint);
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint);
promiseOfPoint = promiseOfPoint.then(p => point, e => point);
promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => point);
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => point);
promiseOfPoint = promiseOfPoint.then(p => point, e => promiseOfPoint);
promiseOfPoint = promiseOfPoint.then(p => point, e => promiseLikeOfPoint);
promiseOfPoint = promiseOfPoint.then(p => point, e => { });
promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => { });
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => { });
promiseOfPoint3D = promiseOfPoint.then(p => point3d);
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D);
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D);
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => point3d);
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => point3d);
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => point3d);
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseOfPoint3D);
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseLikeOfPoint3D);
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => { });
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => { });
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => { });
promiseOfPoint = promiseOfPoint.catch(e => point);
promiseOfPoint = promiseOfPoint.catch(e => promiseOfPoint);
promiseOfPoint = promiseOfPoint.catch(e => promiseLikeOfPoint);
promiseOfPoint = promiseOfPoint.catch(e => { });
promiseOfPoint3D = promiseOfPoint.catch(e => point3d);
promiseOfPoint3D = promiseOfPoint.catch(e => promiseOfPoint3D);
promiseOfPoint3D = promiseOfPoint.catch(e => promiseLikeOfPoint3D);
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(point));
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(promiseOfPoint));
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(promiseLikeOfPoint));
promiseOfPoint = new Promise<Point>((resolve, reject) => reject(e));
promiseOfArrayOfPoint = Promise.all(arrayOfPoint);
promiseOfArrayOfPoint = Promise.all(iterableOfPoint);
promiseOfPoint = Promise.race(arrayOfPoint);
promiseOfPoint = Promise.race(iterableOfPoint);
promiseOfVoid = Promise.resolve();
promiseOfPoint = Promise.resolve(point3d);
promiseOfPoint = Promise.resolve(promiseOfPoint);
promiseOfPoint = Promise.resolve(promiseLikeOfPoint);
promiseOfVoid = Promise.reject(e);
promiseOfPoint = Promise.reject<Point>(e);
// #############################################################################################
// ECMAScript 6: Reflect
// Modules: es6.reflect
// #############################################################################################
a = Reflect.apply(f, a, arrayLikeOfAny);
a = Reflect.construct(f, arrayLikeOfAny, a);
b = Reflect.defineProperty(a, s, pd);
b = Reflect.defineProperty(a, i, pd);
b = Reflect.defineProperty(a, sym, pd);
b = Reflect.deleteProperty(a, s);
b = Reflect.deleteProperty(a, i);
b = Reflect.deleteProperty(a, sym);
iterableIteratorOfAny = Reflect.enumerate(a);
a = Reflect.get(a, s, a);
a = Reflect.get(a, i, a);
a = Reflect.get(a, sym, a);
pd = Reflect.getOwnPropertyDescriptor(a, s);
pd = Reflect.getOwnPropertyDescriptor(a, i);
pd = Reflect.getOwnPropertyDescriptor(a, sym);
a = Reflect.getPrototypeOf(a);
b = Reflect.has(a, s);
b = Reflect.has(a, i);
b = Reflect.has(a, sym);
b = Reflect.isExtensible(a);
arrayOfPropertyKey = Reflect.ownKeys(a);
b = Reflect.preventExtensions(a);
b = Reflect.set(a, s, a, a);
b = Reflect.set(a, i, a, a);
b = Reflect.set(a, sym, a, a);
b = Reflect.setPrototypeOf(a, a);
// #############################################################################################
// ECMAScript 7
// Modules: es7.array.includes, es7.string.at, es7.string.lpad, es7.string.rpad,
// es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape,
// es7.map.to-json, and es7.set.to-json
// #############################################################################################
b = arrayOfPoint.includes(point, i);
s = s.at(i);
s = s.lpad(i, s);
s = s.rpad(i, s);
arrayOfAny = Object.values(a);
arrayOfStringAny = Object.entries(a);
pdm = Object.getOwnPropertyDescriptors(a);
s = RegExp.escape(s);
a = map.toJSON();
a = set.toJSON();
// #############################################################################################
// Mozilla JavaScript: Array generics
// Modules: js.array.statics
// #############################################################################################
i = Array.push(arrayOfPoint, point, point);
point = Array.pop(arrayOfPoint);
arrayOfPoint = Array.concat(arrayOfPoint, arrayOfPoint);
s = Array.join(arrayOfPoint, s);
arrayOfPoint = Array.reverse(arrayOfPoint);
point = Array.shift(arrayOfPoint);
arrayOfPoint = Array.slice(arrayOfPoint, i, i);
arrayOfPoint = Array.sort(arrayOfPoint, (a: Point, b: Point) => i);
arrayOfPoint = Array.splice(arrayOfPoint, i);
arrayOfPoint = Array.splice(arrayOfPoint, i, i, point, point);
i = Array.unshift(arrayOfPoint, point, point);
i = Array.indexOf(arrayOfPoint, point, i);
i = Array.lastIndexOf(arrayOfPoint, point, i);
b = Array.every(arrayOfPoint, (value: Point, index: number, array: Point[]) => b, a);
b = Array.some(arrayOfPoint, (value: Point, index: number, array: Point[]) => b, a);
Array.forEach(arrayOfPoint, (value: Point, index: number, array: Point[]) => { }, a);
arrayOfPoint3D = Array.map(arrayOfPoint, (value: Point, index: number, array: Point[]) => point3d, a);
arrayOfPoint = Array.filter(arrayOfPoint, (value: Point, index: number, array: Point[]) => b, a);
point = Array.reduce(arrayOfPoint, (prev: Point, value: Point, index: number, array: Point[]) => point, point);
point3d = Array.reduce(arrayOfPoint, (prev: Point3D, value: Point, index: number, array: Point[]) => point3d, point3d);
point = Array.reduceRight(arrayOfPoint, (prev: Point, value: Point, index: number, array: Point[]) => point, point);
point3d = Array.reduceRight(arrayOfPoint, (prev: Point3D, value: Point, index: number, array: Point[]) => point3d, point3d);
iterableIteratorOfNumberPoint = Array.entries(arrayOfPoint);
iterableIteratorOfNumber = Array.keys(arrayOfPoint);
iterableIteratorOfPoint = Array.values(arrayOfPoint);
point = Array.find(arrayOfPoint, p => b);
i = Array.findIndex(arrayOfPoint, p => b);
arrayOfPoint = Array.fill(arrayOfPoint, point, i, arrayOfPoint.length);
arrayOfPoint = Array.copyWithin(arrayOfPoint, i, i, i);
b = Array.includes(arrayOfPoint, point, i);
arrayOfPoint = Array.turn(arrayOfPoint, (memo: Point[], value: Point, index: number, array: Point[]) => arrayOfPoint, arrayOfPoint);
arrayOfPoint3D = Array.turn(arrayOfPoint, (memo: Point3D[], value: Point, index: number, array: Point[]) => arrayOfPoint3D, arrayOfPoint3D);
// #############################################################################################
// Object - https://github.com/zloirock/core-js/#object
// Modules: core.object
// #############################################################################################
// Non-standard
b = Object.isObject(a);
s = Object.classof(a);
point = Object.define(point, a);
point = Object.make(point, a);
// #############################################################################################
// Console - https://github.com/zloirock/core-js/#console
// Modules: core.log
// #############################################################################################
// Non-standard
log(a, a, a);
log.log(a, a, a);
log.enable();
log.disable();
// #############################################################################################
// Dict - https://github.com/zloirock/core-js/#dict
// Modules: core.dict
// #############################################################################################
// Non-standard
point = dictOfPoint[s];
point = dictOfPoint[i];
point = dictOfPoint[sym];
dictOfPoint = new Dict(dictOfPoint);
dictOfAny = new Dict(point);
dictOfPoint = Dict(dictOfPoint);
dictOfAny = Dict(point);
b = Dict.isDict(a);
iterableIteratorOfPoint = Dict.values(dictOfPoint);
iterableIteratorOfPropertyKey = Dict.keys(dictOfPoint);
iterableIteratorOfPropertyKeyPoint = Dict.entries(dictOfPoint);
b = Dict.has(dictOfPoint, s);
b = Dict.has(dictOfPoint, i);
b = Dict.has(dictOfPoint, sym);
point = Dict.get(dictOfPoint, s);
point = Dict.get(dictOfPoint, i);
point = Dict.get(dictOfPoint, sym);
dictOfPoint = Dict.set(dictOfPoint, s, point);
dictOfPoint = Dict.set(dictOfPoint, i, point);
dictOfPoint = Dict.set(dictOfPoint, sym, point);
Dict.forEach(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => { }, a);
dictOfPoint3D = Dict.map(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => point3d, a);
dictOfPoint3D = Dict.mapPairs(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => [s, point3d], a);
dictOfPoint3D = Dict.mapPairs(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => [i, point3d], a);
dictOfPoint3D = Dict.mapPairs(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => [sym, point3d], a);
dictOfPoint = Dict.filter(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => b, a);
b = Dict.some(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => b, a);
b = Dict.every(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => b, a);
point = Dict.find(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => b, a);
key = Dict.findKey(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => b, a);
key = Dict.keyOf(dictOfPoint, point);
b = Dict.includes(dictOfPoint, point);
point = Dict.reduce(dictOfPoint, (prev: Point, value: Point, key: PropertyKey, dict: Dict<Point>) => point, point);
point3d = Dict.reduce(dictOfPoint, (prev: Point3D, value: Point, key: PropertyKey, dict: Dict<Point>) => point3d, point3d);
dictOfPoint = Dict.turn(dictOfPoint, (memo: Dict<Point>, value: Point, key: PropertyKey, dict: Dict<Point>) => { }, dictOfPoint);
dictOfPoint3D = Dict.turn(dictOfPoint, (memo: Dict<Point3D>, value: Point, key: PropertyKey, dict: Dict<Point>) => { }, dictOfPoint3D);
// #############################################################################################
// Partial application - https://github.com/zloirock/core-js/#partial-application
// Modules: core.function.part
// #############################################################################################
// Non-standard
a = f.part(a, a);
// #############################################################################################
// Date formatting - https://github.com/zloirock/core-js/#date-formatting
// Modules: core.date
// #############################################################################################
// Non-standard
s = date.format(s, s);
s = date.formatUTC(s, s);
// #############################################################################################
// Array - https://github.com/zloirock/core-js/#array
// Modules: core.array.turn
// #############################################################################################
// Non-standard
arrayOfPoint = arrayOfPoint.turn((memo: Point[], value: Point, key: PropertyKey, array: Point[]) => { }, arrayOfPoint);
arrayOfPoint3D = arrayOfPoint.turn((memo: Point3D[], value: Point, key: PropertyKey, array: Point[]) => { }, arrayOfPoint3D);
// #############################################################################################
// Number - https://github.com/zloirock/core-js/#number
// Modules: core.number.iterator
// #############################################################################################
iterableIteratorOfNumber = i[Symbol.iterator]();
// #############################################################################################
// Escaping characters - https://github.com/zloirock/core-js/#escaping-characters
// Modules: core.string.escape-html
// #############################################################################################
s = s.escapeHTML();
s = s.unescapeHTML();
// #############################################################################################
// delay - https://github.com/zloirock/core-js/#delay
// Modules: core.delay
// #############################################################################################
promiseOfVoid = delay(i);
Binary file not shown.
+3037
View File
File diff suppressed because it is too large Load Diff
Vendored
+1 -1
View File
@@ -2810,7 +2810,7 @@ declare module d3 {
nodes(root: T): T[];
links(nodes: T[]): cluster.Link<T>;
links(nodes: T[]): cluster.Link<T>[];
children(): (node: T) => T[];
children(accessor: (node: T) => T[]): Cluster<T>;
+1 -1
View File
@@ -23018,7 +23018,7 @@ declare module dojox {
*/
class PortletSettings extends dijit._Container implements dijit.layout.ContentPane {
constructor(params?: Object, srcNodeRef?: HTMLElement);
inherited: { (arguments: IArguments): any };
inherited: { (args: IArguments): any };
/**
* Custom press, release, and click synthetic events
* which trigger on a left mouse click, touch, or space/enter keyup.
+4 -4
View File
@@ -25,10 +25,10 @@ d.destroy();
d.element.appendChild(document.createElement("div"));
d.tether.position();
d.on("open", () => null);
d.on("close", () => null);
d.once("close", () => null);
d.off("close", () => null);
d.on("open", () => false);
d.on("close", () => false);
d.once("close", () => false);
d.off("close", () => false);
d.off("open");
var e = new Drop({
+1 -1
View File
@@ -1420,7 +1420,7 @@ declare module Ember {
Creates an instance of the class.
@param arguments A hash containing values with which to initialize the newly instantiated object.
**/
static create<T extends Mixin>(...arguments: CoreObjectArguments[]): T;
static create<T extends Mixin>(...args: CoreObjectArguments[]): T;
detect(obj: any): boolean;
reopen<T extends Mixin>(args?: {}): T;
}
+1 -1
View File
@@ -50,7 +50,7 @@ function FSTest(): void {
FS.symlink('file', 'link');
FS.writeFile('forbidden', 'can\'t touch this');
FS.chmod('forbidden', 0000);
FS.chmod('forbidden', parseInt("0000", 8));
FS.writeFile('file', 'foobar');
FS.truncate('file', 3);
+59
View File
@@ -0,0 +1,59 @@
/// <reference path="es6-collections.d.ts" />
interface Point { x: number; y: number; }
let a: any;
let s: string;
let b: boolean;
let i: number;
let pt: Point;
let arrayOfPoint: Point[];
let arrayOfStringPoint: [string, Point][];
let arrayOfPointString: [Point, string][];
let map: Map<string, Point>;
let set: Set<Point>;
let weakMap: WeakMap<Point, string>;
let weakSet: WeakSet<Point>;
let iteratorOfString: Iterator<String>;
let iteratorOfStringPoint: Iterator<[String, Point]>;
let iteratorOfPoint: Iterator<Point>;
let iteratorOfPointPoint: Iterator<[Point, Point]>;
map = new Map<string, Point>();
map = new Map(arrayOfStringPoint);
map.clear();
b = map.delete(s);
map.forEach((value: Point, key: string, map: Map<string, Point>) => { }, a);
pt = map.get(s);
b = map.has(s);
map = map.set(s, pt);
iteratorOfStringPoint = map.entries();
iteratorOfString = map.keys();
iteratorOfPoint = map.values();
i = map.size;
set = new Set<Point>();
set = new Set(arrayOfPoint);
set.clear();
b = set.delete(pt);
set.forEach((value: Point, key: Point, set: Set<Point>) => { }, a);
b = set.has(pt);
set = set.add(pt);
iteratorOfPointPoint = set.entries();
iteratorOfPoint = set.keys();
iteratorOfPoint = set.values();
i = set.size;
weakMap = new WeakMap<Point, string>();
weakMap = new WeakMap(arrayOfPointString);
weakMap.clear();
b = weakMap.delete(pt);
s = weakMap.get(pt);
b = weakMap.has(pt);
weakMap = weakMap.set(pt, s);
weakSet = new WeakSet<Point>();
weakSet = new WeakSet(arrayOfPoint);
weakSet.clear();
b = weakSet.delete(pt);
b = weakSet.has(pt);
weakSet = weakSet.add(pt);
@@ -0,0 +1 @@
--noImplicitAny --module commonjs --target es5
+113
View File
@@ -0,0 +1,113 @@
// Type definitions for es6-collections v0.5.1
// Project: https://github.com/WebReflection/es6-collections/
// Definitions by: Ron Buckton <http://github.com/rbuckton>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/* *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
interface IteratorResult<T> {
done: boolean;
value?: T;
}
interface Iterator<T> {
next(value?: any): IteratorResult<T>;
return?(value?: any): IteratorResult<T>;
throw?(e?: any): IteratorResult<T>;
}
interface ForEachable<T> {
forEach(callbackfn: (value: T) => void): void;
}
interface Map<K, V> {
clear(): void;
delete(key: K): boolean;
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
get(key: K): V;
has(key: K): boolean;
set(key: K, value?: V): Map<K, V>;
entries(): Iterator<[K, V]>;
keys(): Iterator<K>;
values(): Iterator<V>;
size: number;
}
interface MapConstructor {
new <K, V>(): Map<K, V>;
new <K, V>(iterable: ForEachable<[K, V]>): Map<K, V>;
prototype: Map<any, any>;
}
declare var Map: MapConstructor;
interface Set<T> {
add(value: T): Set<T>;
clear(): void;
delete(value: T): boolean;
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
has(value: T): boolean;
entries(): Iterator<[T, T]>;
keys(): Iterator<T>;
values(): Iterator<T>;
size: number;
}
interface SetConstructor {
new <T>(): Set<T>;
new <T>(iterable: ForEachable<T>): Set<T>;
prototype: Set<any>;
}
declare var Set: SetConstructor;
interface WeakMap<K, V> {
delete(key: K): boolean;
clear(): void;
get(key: K): V;
has(key: K): boolean;
set(key: K, value?: V): WeakMap<K, V>;
}
interface WeakMapConstructor {
new <K, V>(): WeakMap<K, V>;
new <K, V>(iterable: ForEachable<[K, V]>): WeakMap<K, V>;
prototype: WeakMap<any, any>;
}
declare var WeakMap: WeakMapConstructor;
interface WeakSet<T> {
delete(value: T): boolean;
clear(): void;
add(value: T): WeakSet<T>;
has(value: T): boolean;
}
interface WeakSetConstructor {
new <T>(): WeakSet<T>;
new <T>(iterable: ForEachable<T>): WeakSet<T>;
prototype: WeakSet<any>;
}
declare var WeakSet: WeakSetConstructor;
declare module "es6-collections" {
var Map: MapConstructor;
var Set: SetConstructor;
var WeakMap: WeakMapConstructor;
var WeakSet: WeakSetConstructor;
}
+222
View File
@@ -0,0 +1,222 @@
/// <reference path="es6-shim.d.ts" />
interface Point { x: number; y: number; }
interface Point3D extends Point { z: number; }
let a: any;
let s: string;
let i: number;
let b: boolean;
let f: () => void;
let o: Object;
let r: RegExp;
let sym: symbol;
let e: Error;
let date: Date;
let key: PropertyKey;
let point: Point;
let point3d: Point3D;
let arrayOfPoint: Point[];
let arrayOfPoint3D: Point3D[];
let arrayOfSymbol: symbol[];
let arrayOfPropertyKey: PropertyKey[];
let arrayOfAny: any[];
let arrayOfStringAny: [string, any][];
let arrayLikeOfAny: ArrayLike<any>;
let iterableOfPoint: IterableShim<Point>;
let iterableOfStringPoint: IterableShim<[string, Point]>;
let iterableOfPointPoint3D: IterableShim<[Point, Point3D]>;
let iterableIteratorOfPoint: IterableIteratorShim<Point>;
let iterableIteratorOfNumberPoint: IterableIteratorShim<[number, Point]>;
let iterableIteratorOfNumber: IterableIteratorShim<number>;
let iterableIteratorOfString: IterableIteratorShim<string>;
let iterableIteratorOfPointPoint: IterableIteratorShim<[Point, Point]>;
let iterableIteratorOfNode: IterableIteratorShim<Node>;
let iterableIteratorOfStringPoint: IterableIteratorShim<[string, Point]>;
let iterableIteratorOfAny: IterableIteratorShim<any>;
let iterableIteratorOfPropertyKey: IterableIteratorShim<PropertyKey>;
let iterableIteratorOfPropertyKeyPoint: IterableIteratorShim<[PropertyKey, Point]>;
let nodeList: NodeList;
let pd: PropertyDescriptor;
let pdm: PropertyDescriptorMap;
let map: Map<string, Point>;
let set: Set<Point>;
let weakMap: WeakMap<Point, Point3D>;
let weakSet: WeakSet<Point>;
let promiseLikeOfPoint: PromiseLike<Point>;
let promiseLikeOfPoint3D: PromiseLike<Point3D>;
let promiseOfPoint: Promise<Point>;
let promiseOfPoint3D: Promise<Point3D>;
let promiseOfArrayOfPoint: Promise<Point[]>;
let promiseOfVoid: Promise<void>;
point = Object.assign(point, point);
b = Object.is(point, point);
Object.setPrototypeOf(point, point);
point = arrayOfPoint.find(p => b);
i = arrayOfPoint.findIndex(p => b);
arrayOfPoint = arrayOfPoint.fill(point, i, arrayOfPoint.length);
arrayOfPoint = arrayOfPoint.copyWithin(i, i, i);
arrayOfPoint = Array.from(arrayOfPoint);
arrayOfPoint = Array.from(iterableOfPoint);
arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d);
arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d, a);
arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d);
arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d, a);
arrayOfPoint = Array.of(point, point);
i = s.codePointAt(i);
b = s.includes(s, i);
b = s.endsWith(s, i);
s = s.repeat(i);
b = s.startsWith(s, i);
s = String.fromCodePoint(i, i);
s = String.raw`abc`;
s = r.flags;
i = Number.EPSILON;
b = Number.isFinite(i);
b = Number.isInteger(i);
b = Number.isNaN(i);
b = Number.isSafeInteger(i);
i = Number.MAX_SAFE_INTEGER;
i = Number.MIN_SAFE_INTEGER;
i = Number.parseFloat(s);
i = Number.parseInt(s);
i = Number.parseInt(s, i);
i = Math.clz32(i);
i = Math.imul(i, i);
i = Math.sign(i);
i = Math.log10(i);
i = Math.log2(i);
i = Math.log1p(i);
i = Math.expm1(i);
i = Math.cosh(i);
i = Math.sinh(i);
i = Math.tanh(i);
i = Math.acosh(i);
i = Math.asinh(i);
i = Math.atanh(i);
i = Math.hypot(i, i);
i = Math.trunc(i);
i = Math.fround(i);
i = Math.cbrt(i);
map.clear();
map.delete(s);
map.forEach((value: Point, key: string) => { });
point = map.get(s);
b = map.has(s);
map = map.set(s, point);
i = map.size;
map = new Map<string, Point>();
map = new Map(iterableOfStringPoint);
set.clear();
set.delete(point);
set.forEach((value: Point, key: Point) => { });
b = set.has(point);
set = set.add(point);
i = set.size;
set = new Set<Point>();
set = new Set(iterableOfPoint);
weakMap.delete(point);
point3d = weakMap.get(point);
b = weakMap.has(point);
weakMap = weakMap.set(point, point3d);
weakMap = new WeakMap<Point, Point3D>();
weakMap = new WeakMap(iterableOfPointPoint3D);
weakSet.delete(point);
weakSet = weakSet.add(point);
b = weakSet.has(point);
weakSet = new WeakSet<Point>();
weakSet = new WeakSet(iterableOfPoint);
iterableIteratorOfNumberPoint = arrayOfPoint.entries();
iterableIteratorOfNumber = arrayOfPoint.keys();
iterableIteratorOfPoint = arrayOfPoint.values();
iterableIteratorOfPointPoint = set.entries();
iterableIteratorOfPoint = set.keys();
iterableIteratorOfPoint = set.values();
promiseLikeOfPoint.then((point: Point) => { });
promiseLikeOfPoint = promiseLikeOfPoint.then();
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point);
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint);
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => point);
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => point);
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => promiseLikeOfPoint);
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => { });
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => { });
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => point3d);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => point3d);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => promiseLikeOfPoint3D);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => { });
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => { });
promiseOfPoint.then((point: Point) => { });
promiseOfPoint = promiseOfPoint.then();
promiseOfPoint = promiseOfPoint.then(p => point);
promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint);
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint);
promiseOfPoint = promiseOfPoint.then(p => point, e => point);
promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => point);
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => point);
promiseOfPoint = promiseOfPoint.then(p => point, e => promiseOfPoint);
promiseOfPoint = promiseOfPoint.then(p => point, e => promiseLikeOfPoint);
promiseOfPoint = promiseOfPoint.then(p => point, e => { });
promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => { });
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => { });
promiseOfPoint3D = promiseOfPoint.then(p => point3d);
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D);
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D);
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => point3d);
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => point3d);
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => point3d);
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseOfPoint3D);
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseLikeOfPoint3D);
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => { });
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => { });
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => { });
promiseOfPoint = promiseOfPoint.catch(e => point);
promiseOfPoint = promiseOfPoint.catch(e => promiseOfPoint);
promiseOfPoint = promiseOfPoint.catch(e => promiseLikeOfPoint);
promiseOfPoint = promiseOfPoint.catch(e => { });
promiseOfPoint3D = promiseOfPoint.catch(e => point3d);
promiseOfPoint3D = promiseOfPoint.catch(e => promiseOfPoint3D);
promiseOfPoint3D = promiseOfPoint.catch(e => promiseLikeOfPoint3D);
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(point));
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(promiseOfPoint));
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(promiseLikeOfPoint));
promiseOfPoint = new Promise<Point>((resolve, reject) => reject(e));
promiseOfArrayOfPoint = Promise.all(arrayOfPoint);
promiseOfArrayOfPoint = Promise.all(iterableOfPoint);
promiseOfPoint = Promise.race(arrayOfPoint);
promiseOfPoint = Promise.race(iterableOfPoint);
promiseOfVoid = Promise.resolve();
promiseOfPoint = Promise.resolve(point3d);
promiseOfPoint = Promise.resolve(promiseOfPoint);
promiseOfPoint = Promise.resolve(promiseLikeOfPoint);
promiseOfVoid = Promise.reject(e);
promiseOfPoint = Promise.reject<Point>(e);
a = Reflect.apply(f, a, arrayLikeOfAny);
a = Reflect.construct(f, arrayLikeOfAny);
b = Reflect.defineProperty(a, s, pd);
b = Reflect.defineProperty(a, i, pd);
b = Reflect.defineProperty(a, sym, pd);
b = Reflect.deleteProperty(a, s);
b = Reflect.deleteProperty(a, i);
b = Reflect.deleteProperty(a, sym);
iterableIteratorOfAny = Reflect.enumerate(a);
a = Reflect.get(a, s, a);
a = Reflect.get(a, i, a);
a = Reflect.get(a, sym, a);
pd = Reflect.getOwnPropertyDescriptor(a, s);
pd = Reflect.getOwnPropertyDescriptor(a, i);
pd = Reflect.getOwnPropertyDescriptor(a, sym);
a = Reflect.getPrototypeOf(a);
b = Reflect.has(a, s);
b = Reflect.has(a, i);
b = Reflect.has(a, sym);
b = Reflect.isExtensible(a);
arrayOfPropertyKey = Reflect.ownKeys(a);
b = Reflect.preventExtensions(a);
b = Reflect.set(a, s, a, a);
b = Reflect.set(a, i, a, a);
b = Reflect.set(a, sym, a, a);
b = Reflect.setPrototypeOf(a, a);
+1
View File
@@ -0,0 +1 @@
--noImplicitAny --module commonjs --target es5
+673
View File
@@ -0,0 +1,673 @@
// Type definitions for es6-shim v0.31.2
// Project: https://github.com/paulmillr/es6-shim
// Definitions by: Ron Buckton <http://github.com/rbuckton>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare type PropertyKey = string | number | symbol;
interface IteratorResult<T> {
done: boolean;
value?: T;
}
interface IterableShim<T> {
/**
* Shim for an ES6 iterable. Not intended for direct use by user code.
*/
"_es6-shim iterator_"(): Iterator<T>;
}
interface Iterator<T> {
next(value?: any): IteratorResult<T>;
return?(value?: any): IteratorResult<T>;
throw?(e?: any): IteratorResult<T>;
}
interface IterableIteratorShim<T> extends IterableShim<T>, Iterator<T> {
/**
* Shim for an ES6 iterable iterator. Not intended for direct use by user code.
*/
"_es6-shim iterator_"(): IterableIteratorShim<T>;
}
interface StringConstructor {
/**
* Return the String value whose elements are, in order, the elements in the List elements.
* If length is 0, the empty string is returned.
*/
fromCodePoint(...codePoints: number[]): string;
/**
* String.raw is intended for use as a tag function of a Tagged Template String. When called
* as such the first argument will be a well formed template call site object and the rest
* parameter will contain the substitution values.
* @param template A well-formed template string call site representation.
* @param substitutions A set of substitution values.
*/
raw(template: TemplateStringsArray, ...substitutions: any[]): string;
}
interface String {
/**
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
* value of the UTF-16 encoded code point starting at the string element at position pos in
* the String resulting from converting this object to a String.
* If there is no element at that position, the result is undefined.
* If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
*/
codePointAt(pos: number): number;
/**
* Returns true if searchString appears as a substring of the result of converting this
* object to a String, at one or more positions that are
* greater than or equal to position; otherwise, returns false.
* @param searchString search string
* @param position If position is undefined, 0 is assumed, so as to search all of the String.
*/
includes(searchString: string, position?: number): boolean;
/**
* Returns true if the sequence of elements of searchString converted to a String is the
* same as the corresponding elements of this object (converted to a String) starting at
* endPosition length(this). Otherwise returns false.
*/
endsWith(searchString: string, endPosition?: number): boolean;
/**
* Returns a String value that is made from count copies appended together. If count is 0,
* T is the empty String is returned.
* @param count number of copies to append
*/
repeat(count: number): string;
/**
* Returns true if the sequence of elements of searchString converted to a String is the
* same as the corresponding elements of this object (converted to a String) starting at
* position. Otherwise returns false.
*/
startsWith(searchString: string, position?: number): boolean;
/**
* Returns an <a> HTML anchor element and sets the name attribute to the text value
* @param name
*/
anchor(name: string): string;
/** Returns a <big> HTML element */
big(): string;
/** Returns a <blink> HTML element */
blink(): string;
/** Returns a <b> HTML element */
bold(): string;
/** Returns a <tt> HTML element */
fixed(): string
/** Returns a <font> HTML element and sets the color attribute value */
fontcolor(color: string): string
/** Returns a <font> HTML element and sets the size attribute value */
fontsize(size: number): string;
/** Returns a <font> HTML element and sets the size attribute value */
fontsize(size: string): string;
/** Returns an <i> HTML element */
italics(): string;
/** Returns an <a> HTML element and sets the href attribute value */
link(url: string): string;
/** Returns a <small> HTML element */
small(): string;
/** Returns a <strike> HTML element */
strike(): string;
/** Returns a <sub> HTML element */
sub(): string;
/** Returns a <sup> HTML element */
sup(): string;
/**
* Shim for an ES6 iterable. Not intended for direct use by user code.
*/
"_es6-shim iterator_"(): IterableIteratorShim<string>;
}
interface ArrayLike<T> {
length: number;
[n: number]: T;
}
interface ArrayConstructor {
/**
* Creates an array from an array-like object.
* @param arrayLike An array-like object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>;
/**
* Creates an array from an iterable object.
* @param iterable An iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T, U>(iterable: IterableShim<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>;
/**
* Creates an array from an array-like object.
* @param arrayLike An array-like object to convert to an array.
*/
from<T>(arrayLike: ArrayLike<T>): Array<T>;
/**
* Creates an array from an iterable object.
* @param iterable An iterable object to convert to an array.
*/
from<T>(iterable: IterableShim<T>): Array<T>;
/**
* Returns a new array from a set of elements.
* @param items A set of elements to include in the new array object.
*/
of<T>(...items: T[]): Array<T>;
}
interface Array<T> {
/**
* Returns the value of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T;
/**
* Returns the index of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndex(predicate: (value: T) => boolean, thisArg?: any): number;
/**
* Returns the this object after filling the section identified by start and end with value
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: T, start?: number, end?: number): T[];
/**
* Returns the this object after copying a section of the array identified by start and end
* to the same array starting at position target
* @param target If target is negative, it is treated as length+target where length is the
* length of the array.
* @param start If start is negative, it is treated as length+start. If end is negative, it
* is treated as length+end.
* @param end If not specified, length of the this object is used as its default value.
*/
copyWithin(target: number, start: number, end?: number): T[];
/**
* Returns an array of key, value pairs for every entry in the array
*/
entries(): IterableIteratorShim<[number, T]>;
/**
* Returns an list of keys in the array
*/
keys(): IterableIteratorShim<number>;
/**
* Returns an list of values in the array
*/
values(): IterableIteratorShim<T>;
/**
* Shim for an ES6 iterable. Not intended for direct use by user code.
*/
"_es6-shim iterator_"(): IterableIteratorShim<T>;
}
interface NumberConstructor {
/**
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
* that is representable as a Number value, which is approximately:
* 2.2204460492503130808472633361816 x 10‍‍16.
*/
EPSILON: number;
/**
* Returns true if passed value is finite.
* Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
* number. Only finite values of the type number, result in true.
* @param number A numeric value.
*/
isFinite(number: number): boolean;
/**
* Returns true if the value passed is an integer, false otherwise.
* @param number A numeric value.
*/
isInteger(number: number): boolean;
/**
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
* number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter
* to a number. Only values of the type number, that are also NaN, result in true.
* @param number A numeric value.
*/
isNaN(number: number): boolean;
/**
* Returns true if the value passed is a safe integer.
* @param number A numeric value.
*/
isSafeInteger(number: number): boolean;
/**
* The value of the largest integer n such that n and n + 1 are both exactly representable as
* a Number value.
* The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 1.
*/
MAX_SAFE_INTEGER: number;
/**
* The value of the smallest integer n such that n and n 1 are both exactly representable as
* a Number value.
* The value of Number.MIN_SAFE_INTEGER is 9007199254740991 ((2^53 1)).
*/
MIN_SAFE_INTEGER: number;
/**
* Converts a string to a floating-point number.
* @param string A string that contains a floating-point number.
*/
parseFloat(string: string): number;
/**
* Converts A string to an integer.
* @param s A string to convert into a number.
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
* All other strings are considered decimal.
*/
parseInt(string: string, radix?: number): number;
}
interface ObjectConstructor {
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param sources One or more source objects to copy properties from.
*/
assign(target: any, ...sources: any[]): any;
/**
* Returns true if the values are the same value, false otherwise.
* @param value1 The first value.
* @param value2 The second value.
*/
is(value1: any, value2: any): boolean;
/**
* Sets the prototype of a specified object o to object proto or null. Returns the object o.
* @param o The object to change its prototype.
* @param proto The value of the new prototype or null.
* @remarks Requires `__proto__` support.
*/
setPrototypeOf(o: any, proto: any): any;
}
interface RegExp {
/**
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
* The characters in this string are sequenced and concatenated in the following order:
*
* - "g" for global
* - "i" for ignoreCase
* - "m" for multiline
* - "u" for unicode
* - "y" for sticky
*
* If no flags are set, the value is the empty string.
*/
flags: string;
}
interface Math {
/**
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
* @param x A numeric expression.
*/
clz32(x: number): number;
/**
* Returns the result of 32-bit multiplication of two numbers.
* @param x First number
* @param y Second number
*/
imul(x: number, y: number): number;
/**
* Returns the sign of the x, indicating whether x is positive, negative or zero.
* @param x The numeric expression to test
*/
sign(x: number): number;
/**
* Returns the base 10 logarithm of a number.
* @param x A numeric expression.
*/
log10(x: number): number;
/**
* Returns the base 2 logarithm of a number.
* @param x A numeric expression.
*/
log2(x: number): number;
/**
* Returns the natural logarithm of 1 + x.
* @param x A numeric expression.
*/
log1p(x: number): number;
/**
* Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
* the natural logarithms).
* @param x A numeric expression.
*/
expm1(x: number): number;
/**
* Returns the hyperbolic cosine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
cosh(x: number): number;
/**
* Returns the hyperbolic sine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
sinh(x: number): number;
/**
* Returns the hyperbolic tangent of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
tanh(x: number): number;
/**
* Returns the inverse hyperbolic cosine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
acosh(x: number): number;
/**
* Returns the inverse hyperbolic sine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
asinh(x: number): number;
/**
* Returns the inverse hyperbolic tangent of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
atanh(x: number): number;
/**
* Returns the square root of the sum of squares of its arguments.
* @param values Values to compute the square root for.
* If no arguments are passed, the result is +0.
* If there is only one argument, the result is the absolute value.
* If any argument is +Infinity or -Infinity, the result is +Infinity.
* If any argument is NaN, the result is NaN.
* If all arguments are either +0 or 0, the result is +0.
*/
hypot(...values: number[]): number;
/**
* Returns the integral part of the a numeric expression, x, removing any fractional digits.
* If x is already an integer, the result is x.
* @param x A numeric expression.
*/
trunc(x: number): number;
/**
* Returns the nearest single precision float representation of a number.
* @param x A numeric expression.
*/
fround(x: number): number;
/**
* Returns an implementation-dependent approximation to the cube root of number.
* @param x A numeric expression.
*/
cbrt(x: number): number;
}
interface PromiseLike<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
}
/**
* Represents the completion of an asynchronous operation
*/
interface Promise<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
/**
* Attaches a callback for only the rejection of the Promise.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of the callback.
*/
catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>;
catch(onrejected?: (reason: any) => void): Promise<T>;
}
interface PromiseConstructor {
/**
* A reference to the prototype.
*/
prototype: Promise<any>;
/**
* Creates a new Promise.
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
* a resolve callback used resolve the promise with a value or the result of another promise,
* and a reject callback used to reject the promise with a provided reason or error.
*/
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T>(values: IterableShim<T | PromiseLike<T>>): Promise<T[]>;
/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T>(values: IterableShim<T | PromiseLike<T>>): Promise<T>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject(reason: any): Promise<void>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject<T>(reason: any): Promise<T>;
/**
* Creates a new resolved promise for the provided value.
* @param value A promise.
* @returns A promise whose internal state matches the provided promise.
*/
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
/**
* Creates a new resolved promise .
* @returns A resolved promise.
*/
resolve(): Promise<void>;
}
declare var Promise: PromiseConstructor;
interface Map<K, V> {
clear(): void;
delete(key: K): boolean;
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
get(key: K): V;
has(key: K): boolean;
set(key: K, value?: V): Map<K, V>;
size: number;
entries(): IterableIteratorShim<[K, V]>;
keys(): IterableIteratorShim<K>;
values(): IterableIteratorShim<V>;
}
interface MapConstructor {
new <K, V>(): Map<K, V>;
new <K, V>(iterable: IterableShim<[K, V]>): Map<K, V>;
prototype: Map<any, any>;
}
declare var Map: MapConstructor;
interface Set<T> {
add(value: T): Set<T>;
clear(): void;
delete(value: T): boolean;
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
has(value: T): boolean;
size: number;
entries(): IterableIteratorShim<[T, T]>;
keys(): IterableIteratorShim<T>;
values(): IterableIteratorShim<T>;
}
interface SetConstructor {
new <T>(): Set<T>;
new <T>(iterable: IterableShim<T>): Set<T>;
prototype: Set<any>;
}
declare var Set: SetConstructor;
interface WeakMap<K, V> {
delete(key: K): boolean;
get(key: K): V;
has(key: K): boolean;
set(key: K, value?: V): WeakMap<K, V>;
}
interface WeakMapConstructor {
new <K, V>(): WeakMap<K, V>;
new <K, V>(iterable: IterableShim<[K, V]>): WeakMap<K, V>;
prototype: WeakMap<any, any>;
}
declare var WeakMap: WeakMapConstructor;
interface WeakSet<T> {
add(value: T): WeakSet<T>;
delete(value: T): boolean;
has(value: T): boolean;
}
interface WeakSetConstructor {
new <T>(): WeakSet<T>;
new <T>(iterable: IterableShim<T>): WeakSet<T>;
prototype: WeakSet<any>;
}
declare var WeakSet: WeakSetConstructor;
declare module Reflect {
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
function construct(target: Function, argumentsList: ArrayLike<any>): any;
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
function deleteProperty(target: any, propertyKey: PropertyKey): boolean;
function enumerate(target: any): IterableIteratorShim<any>;
function get(target: any, propertyKey: PropertyKey, receiver?: any): any;
function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
function getPrototypeOf(target: any): any;
function has(target: any, propertyKey: PropertyKey): boolean;
function isExtensible(target: any): boolean;
function ownKeys(target: any): Array<PropertyKey>;
function preventExtensions(target: any): boolean;
function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
function setPrototypeOf(target: any, proto: any): boolean;
}
declare module "es6-shim" {
var String: StringConstructor;
var Array: ArrayConstructor;
var Number: NumberConstructor;
var Math: Math;
var Object: ObjectConstructor;
var Map: MapConstructor;
var Set: SetConstructor;
var WeakMap: WeakMapConstructor;
var WeakSet: WeakSetConstructor;
var Promise: PromiseConstructor;
module Reflect {
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
function construct(target: Function, argumentsList: ArrayLike<any>): any;
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
function deleteProperty(target: any, propertyKey: PropertyKey): boolean;
function enumerate(target: any): Iterator<any>;
function get(target: any, propertyKey: PropertyKey, receiver?: any): any;
function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
function getPrototypeOf(target: any): any;
function has(target: any, propertyKey: PropertyKey): boolean;
function isExtensible(target: any): boolean;
function ownKeys(target: any): Array<PropertyKey>;
function preventExtensions(target: any): boolean;
function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
function setPrototypeOf(target: any, proto: any): boolean;
}
}
+3 -11
View File
@@ -740,7 +740,7 @@ function sample8() {
}
for (var i = activeObjectButtons.length; i--;) {
activeObjectButtons[i].disabled = true;
activeObjectButtons[i];
}
canvas.on('object:selected', onObjectSelected);
@@ -750,7 +750,7 @@ function sample8() {
var selectedObject = e.target;
for (var i = activeObjectButtons.length; i--;) {
activeObjectButtons[i].disabled = false;
activeObjectButtons[i];
}
lockHorizontallyEl.innerHTML = (selectedObject.lockMovementX ? 'Unlock horizontal movement' : 'Lock horizontal movement');
@@ -762,7 +762,7 @@ function sample8() {
canvas.on('selection:cleared', function(e) {
for (var i = activeObjectButtons.length; i--;) {
activeObjectButtons[i].disabled = true;
activeObjectButtons[i];
}
});
@@ -889,7 +889,6 @@ function sample8() {
var cmdUnderlineBtn = document.getElementById('text-cmd-underline');
if (cmdUnderlineBtn) {
activeObjectButtons.push(cmdUnderlineBtn);
cmdUnderlineBtn.disabled = true;
cmdUnderlineBtn.onclick = function() {
var activeObject = <fabric.IText>canvas.getActiveObject();
if (activeObject && activeObject.type === 'text') {
@@ -903,7 +902,6 @@ function sample8() {
var cmdLinethroughBtn = document.getElementById('text-cmd-linethrough');
if (cmdLinethroughBtn) {
activeObjectButtons.push(cmdLinethroughBtn);
cmdLinethroughBtn.disabled = true;
cmdLinethroughBtn.onclick = function() {
var activeObject = <fabric.IText>canvas.getActiveObject();
if (activeObject && activeObject.type === 'text') {
@@ -917,7 +915,6 @@ function sample8() {
var cmdOverlineBtn = document.getElementById('text-cmd-overline');
if (cmdOverlineBtn) {
activeObjectButtons.push(cmdOverlineBtn);
cmdOverlineBtn.disabled = true;
cmdOverlineBtn.onclick = function() {
var activeObject = <fabric.IText>canvas.getActiveObject();
if (activeObject && activeObject.type === 'text') {
@@ -931,7 +928,6 @@ function sample8() {
var cmdBoldBtn = document.getElementById('text-cmd-bold');
if (cmdBoldBtn) {
activeObjectButtons.push(cmdBoldBtn);
cmdBoldBtn.disabled = true;
cmdBoldBtn.onclick = function() {
var activeObject = <fabric.IText>canvas.getActiveObject();
if (activeObject && activeObject.type === 'text') {
@@ -945,7 +941,6 @@ function sample8() {
var cmdItalicBtn = document.getElementById('text-cmd-italic');
if (cmdItalicBtn) {
activeObjectButtons.push(cmdItalicBtn);
cmdItalicBtn.disabled = true;
cmdItalicBtn.onclick = function() {
var activeObject = <fabric.IText>canvas.getActiveObject();
if (activeObject && activeObject.type === 'text') {
@@ -959,7 +954,6 @@ function sample8() {
var cmdShadowBtn = document.getElementById('text-cmd-shadow');
if (cmdShadowBtn) {
activeObjectButtons.push(cmdShadowBtn);
cmdShadowBtn.disabled = true;
cmdShadowBtn.onclick = function() {
var activeObject = <fabric.IText>canvas.getActiveObject();
if (activeObject && activeObject.type === 'text') {
@@ -973,7 +967,6 @@ function sample8() {
var textAlignSwitch = document.getElementById('text-align');
if (textAlignSwitch) {
activeObjectButtons.push(textAlignSwitch);
textAlignSwitch.disabled = true;
textAlignSwitch.onchange = function() {
var activeObject = <fabric.IText>canvas.getActiveObject();
if (activeObject && activeObject.type === 'text') {
@@ -986,7 +979,6 @@ function sample8() {
var fontFamilySwitch = document.getElementById('font-family');
if (fontFamilySwitch) {
activeObjectButtons.push(fontFamilySwitch);
fontFamilySwitch.disabled = true;
fontFamilySwitch.onchange = function() {
var activeObject = <fabric.IText>canvas.getActiveObject();
if (activeObject && activeObject.type === 'text') {
+12 -12
View File
@@ -3,7 +3,7 @@
// Definitions by: Yuichi Murata <https://github.com/mrk21>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path='../react/legacy/react-0.12.d.ts' />
///<reference path='../react/react.d.ts' />
///<reference path='../eventemitter3/eventemitter3.d.ts' />
declare module Fluxxor {
@@ -14,7 +14,7 @@ declare module Fluxxor {
doDispatchLoop(action: Function): void;
waitForStores(store: Store, stores: string[], fn: Function): void;
}
class Flux extends EventEmitter3.EventEmitter {
constructor(stores: any, actions: any);
addActions(actions: any): void;
@@ -26,40 +26,40 @@ declare module Fluxxor {
stores: any;
actions: any;
}
interface Store extends EventEmitter3.EventEmitter {
bindActions(...args: Array<string|Function>): void;
bindActions(args: Array<string|Function>): void;
waitFor(stores: string[], fn: Function): void;
}
interface StoreSpec {
initialize?(instance?: any, options?: {}): void;
actions?: any;
}
interface StoreClass {
new (options?: {}): any;
}
interface Context {
flux: Flux;
}
interface FluxMixin {
getFlux(): Flux;
}
interface FluxChildMixin {
getFlux(): Flux;
}
interface StoreWatchMixin<StoreState> {
getStateFromFlux(): StoreState;
}
function FluxMixin(React: React.Exports): FluxMixin;
function FluxChildMixin(React: React.Exports): FluxChildMixin;
function FluxMixin(React: typeof __React): FluxMixin;
function FluxChildMixin(React: typeof __React): FluxChildMixin;
function StoreWatchMixin<StoreState>(...storeNames: string[]): StoreWatchMixin<StoreState>;
function createStore(spec: StoreSpec): StoreClass;
var version: string;
+9
View File
@@ -0,0 +1,9 @@
/// <reference path="git-config.d.ts" />
import gitConfig = require('git-config');
var config: Object = gitConfig.sync();
console.log(JSON.stringify(config));
config = gitConfig.sync('gitconfig');
console.log(JSON.stringify(config));
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for git-config
// Project: https://github.com/eugeneware/git-config
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "git-config" {
export function sync(gitFile?: string): Object; // Synchronous version.
}
+5
View File
@@ -0,0 +1,5 @@
[user]
name = A Git User
email = git.user@domain.xyz
[push]
default = simple
+2121 -2122
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -18,6 +18,6 @@ gulp.task("concat:newLine", () => {
gulp.task("concat:vinyl", () => {
gulp.src(["file*.txt"])
.pipe(concat({ path: "file.txt", stat: { mode: 0666 } }))
.pipe(concat({ path: "file.txt", stat: { mode: parseInt("0666", 8) } }))
.pipe(gulp.dest("build"));
});
+2 -2
View File
@@ -11,11 +11,11 @@ function tests() {
hello: 'world'
};
hooker.hook(objectToHook, 'hello', () => { });
hooker.hook(objectToHook, 'hello', () => {
hooker.hook(objectToHook, 'hello', (): any => {
return null;
});
hooker.hook(objectToHook, ['hello', 'foo'], () => { });
hooker.hook(objectToHook, ['hello', 'bar'], () => {
hooker.hook(objectToHook, ['hello', 'bar'], (): any => {
return null;
});
hooker.hook(objectToHook, 'bar', () => {
+5 -5
View File
@@ -85,8 +85,8 @@ interface I18nextStatic {
toLanguages(language: string): string[];
regexEscape(str: string): string;
};
init(callback?: (t: (key: string, options?: any) => string) => void ): JQueryDeferred<any>;
init(options?: I18nextOptions, callback?: (t: (key: string, options?: any) => string) => void ): JQueryDeferred<any>;
init(callback?: (err: any, t: (key: string, options?: any) => string) => void ): JQueryDeferred<any>;
init(options?: I18nextOptions, callback?: (err: any, t: (key: string, options?: any) => string) => void ): JQueryDeferred<any>;
lng(): string;
loadNamespace(namespace: string, callback?: () => void ): void;
loadNamespaces(namespaces: string[], callback?: () => void ): void;
@@ -100,10 +100,10 @@ interface I18nextStatic {
rules: any;
setCurrentLng: (language: string) => void;
};
preload(language: string, callback?: (t: (key: string, options?: any) => string) => void ): void;
preload(languages: string[], callback?: (t: (key: string, options?: any) => string) => void ): void;
preload(language: string, callback?: (err: any, t: (key: string, options?: any) => string) => void ): void;
preload(languages: string[], callback?: (err: any, t: (key: string, options?: any) => string) => void ): void;
setDefaultNamespace(namespace: string): void;
setLng(language: string, callback?: (t: (key: string, options?: any) => string) => void ): void;
setLng(language: string, callback?: (err: any, t: (key: string, options?: any) => string) => void ): void;
sync: {
load: (languages: string[], options: I18nextOptions, callback: (err: Error, store: IResourceStore) => void ) => void;
postMissing: (language: string, namespace: string, key: string, defaultValue: any, languages: string[]) => void;
+37
View File
@@ -0,0 +1,37 @@
/// <reference path="jquery-knob.d.ts"/>
// create from html attrs
$('<input type="text" name="knob" value="50" data-min="0" data-max="100">').knob();
// create with object
$('<input type="text" name="knob-2">').knob({
min: 0,
max: 100,
angleArc: 270
});
// hooks
var hookKnob = $('<input type="text" name="knob-2">').knob({
release: function(value) {
console.log(value);
},
change: function(value) {
console.log(value);
},
draw: function() {
console.log(this);
},
cancel: function() {
console.log(this);
},
format: function(value) {
console.log(value);
}
});
// trigger
hookKnob.trigger('release');
hookKnob.trigger('change');
hookKnob.trigger('draw');
hookKnob.trigger('cancel');
hookKnob.trigger('format');
+116
View File
@@ -0,0 +1,116 @@
// Type definitions for jQuery Knob 1.2.11
// Project: http://anthonyterrien.com/knob/
// Definitions by: Iain Buchanan <https://github.com/iain8/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
declare module JQueryKnob {
export interface JQueryKnobOptions {
/**
* min value | default=0
*/
min?: number;
/**
* max value | default=100
*/
max?: number;
/**
* step size | default=1
*/
step?: number;
/**
* starting angle in degrees | default=0
*/
angleOffset?: number;
/**
* arc size in degrees | default=360
*/
angleArc?: number;
/**
* stop at min & max on keydown/mousewheel | default=true
*/
stopper?: boolean;
/**
* disable input and events | default=false
*/
readOnly?: boolean;
/**
* direction of progression | default=clockwise
*/
rotation?: string;
/**
* display mode "cursor", cursor size could be changed passing a
* numeric value to the option, default width is used when passing
* boolean value "true" | default=gauge
*/
cursor?: string | boolean;
/**
* gauge thickness
*/
thickness?: number;
/**
* gauge stroke endings | default=butt, round=rounded line endings
*/
lineCap?: string;
/**
* dial width
*/
width?: number;
/**
* default=true | false=hide input
*/
displayInput?: boolean;
/**
* default=false | true=displays the previous value with transparency
*/
displayPrevious?: boolean;
/**
* foreground color
*/
fgColor?: string;
/**
* input value (number) color
*/
inputColor?: string;
/**
* font family
*/
font?: string;
/**
* font weight
*/
fontWeight?: string;
/**
* background color
*/
bgColor?: string;
/**
* executed on release
*/
release?: (value: number) => void;
/**
* executed at each change of the value
*/
change?: (value: number) => void;
/**
* when drawing the canvas
*/
draw?: () => void;
/**
* triggered on [esc] keydown
*/
cancel?: () => void;
/**
* allows to format output (add unit %, ms...)
*/
format?: (value: number) => void;
}
}
interface JQuery {
/**
* Create a knob for the given input field, with optional options
*/
knob(options?: JQueryKnob.JQueryKnobOptions): JQuery;
}
+2 -2
View File
@@ -1618,7 +1618,7 @@ function test_spinner() {
},
_parse: function (value) {
if (typeof value === "string") {
if (Number(value) == value) {
if (Number(value) == <any>value) {
return Number(value);
}
return 123;
@@ -1822,4 +1822,4 @@ function test_widget() {
var isDisabled = $(".selector").jQuery.Widget("option", "disabled");
$(".selector").jQuery.Widget("option", "disabled", true);
$(".selector").jQuery.Widget("option", { disabled: true });
}
}
+1 -2
View File
@@ -47,5 +47,4 @@ jsdom.env({
}
});
var window: Window = jsdom.jsdom("<div>foobar</div>").parentWindow;
var document: Document = jsdom.jsdom("<html></html>");
var document: Document = jsdom.jsdom("<html></html>");
+23 -1
View File
@@ -1092,7 +1092,29 @@ result = <{ a: number; b: number; c: number; }>_.transform(<{ [index: string]: n
r[key] = num * 3;
});
result = <number[]>_.values({ 'one': 1, 'two': 2, 'three': 3 });
// _.values
class TestValues {
public a = 1;
public b = 2;
public c: string;
}
TestValues.prototype.c = 'a';
result = <number[]>_.values<number>(new TestValues());
// → [1, 2] (iteration order is not guaranteed)
result = <number[]>_(new TestValues()).values<number>().value();
// → [1, 2] (iteration order is not guaranteed)
// _.valueIn
class TestValueIn {
public a = 1;
public b = 2;
public c: number;
}
TestValueIn.prototype.c = 3;
result = <number[]>_.valuesIn<number>(new TestValueIn());
// → [1, 2, 3]
result = <number[]>_(new TestValueIn()).valuesIn<number>().value();
// → [1, 2, 3]
/**********
* Utilities *
+27 -3
View File
@@ -6301,11 +6301,35 @@ declare module _ {
//_.values
interface LoDashStatic {
/**
* Creates an array composed of the own enumerable property values of object.
* @param object The object to inspect.
* Creates an array of the own enumerable property values of object.
* @param object The object to query.
* @return Returns an array of property values.
**/
values(object?: any): any[];
values<T>(object?: any): T[];
}
interface LoDashObjectWrapper<T> {
/**
* @see _.values
**/
values<TResult>(): LoDashObjectWrapper<TResult[]>;
}
//_.valuesIn
interface LoDashStatic {
/**
* Creates an array of the own and inherited enumerable property values of object.
* @param object The object to query.
* @return Returns the array of property values.
**/
valuesIn<T>(object?: any): T[];
}
interface LoDashObjectWrapper<T> {
/**
* @see _.valuesIn
**/
valuesIn<TResult>(): LoDashObjectWrapper<TResult[]>;
}
/**********
+2 -1
View File
@@ -75,7 +75,8 @@ function test() {
];
}
function testPath() {
function testPath() {
makerjs.path.breakAtPoint(paths.arc, [0,0]).type;
makerjs.path.intersection(paths.circle, paths.arc).intersectionPoints;
makerjs.path.mirror(paths.arc, true, true);
makerjs.path.moveRelative(paths.circle, [0,0]);
+13 -5
View File
@@ -94,10 +94,6 @@ declare module MakerJs {
* The main point of reference for this path.
*/
origin: IPoint;
/**
* Optional CSS style properties to be emitted into SVG. Useful for creating guidelines and debugging your model.
*/
cssStyle?: string;
}
/**
* Test to see if an object implements the required properties of a path.
@@ -425,6 +421,18 @@ declare module MakerJs.path {
*/
function scale(pathToScale: IPath, scaleValue: number): IPath;
}
declare module MakerJs.path {
/**
* Breaks a path in two. The supplied path will end at the supplied pointOfBreak,
* a new path is returned which begins at the pointOfBreak and ends at the supplied path's initial end point.
* For Circle, the original path will be converted in place to an Arc, and null is returned.
*
* @param pathToBreak The path to break.
* @param pointOfBreak The point at which to break the path.
* @returns A new path of the same type, when path type is line or arc. Returns null for circle.
*/
function breakAtPoint(pathToBreak: IPath, pointOfBreak: IPoint): IPath;
}
declare module MakerJs.paths {
/**
* Class for arc path.
@@ -661,7 +669,7 @@ declare module MakerJs.path {
*
* @param path1 First path to find intersection.
* @param path2 Second path to find intersection.
* @result IPathIntersection object, with points(s) of intersection (and angles, when a path is an arc or circle); or null if the paths did not intersect.
* @returns IPathIntersection object, with points(s) of intersection (and angles, when a path is an arc or circle); or null if the paths did not intersect.
*/
function intersection(path1: IPath, path2: IPath): IPathIntersection;
}
+9 -9
View File
@@ -54,14 +54,14 @@ function BaseClassExtensions_Error_Tests() {
}
else if (isNaN(input)) {
var msg = "A number was not entered. ";
msg += (<MicrosoftAjaxBaseTypeExtensions.String>String).format("Please enter a number between {0} and {1}.", min, max);
msg += (<MicrosoftAjaxBaseTypeExtensions.String><any>String).format("Please enter a number between {0} and {1}.", min, max);
var err = (<MicrosoftAjaxBaseTypeExtensions.Error>Error).create(msg);
throw err;
}
else if (input < min || input > max) {
msg = "The number entered was outside the acceptable range. ";
msg += (<MicrosoftAjaxBaseTypeExtensions.String>String).format("Please enter a number between {0} and {1}.", min, max);
msg += (<MicrosoftAjaxBaseTypeExtensions.String><any>String).format("Please enter a number between {0} and {1}.", min, max);
var err = (<MicrosoftAjaxBaseTypeExtensions.Error>Error).create(msg);
@@ -82,12 +82,12 @@ function BaseClassExtensions_Error_Tests() {
function BaseClassExtensions_String_Tests() {
(<MicrosoftAjaxBaseTypeExtensions.String>String).format("Please enter a number between {0} and {1}.", 1, 2);
(<MicrosoftAjaxBaseTypeExtensions.String>String).endsWith("test");
(<MicrosoftAjaxBaseTypeExtensions.String>String).localeFormat("Please enter a number between {0} and {1}", 1, 2);
(<MicrosoftAjaxBaseTypeExtensions.String>String).trim();
(<MicrosoftAjaxBaseTypeExtensions.String>String).trimEnd();
(<MicrosoftAjaxBaseTypeExtensions.String>String).trimStart();
(<MicrosoftAjaxBaseTypeExtensions.String><any>String).format("Please enter a number between {0} and {1}.", 1, 2);
(<MicrosoftAjaxBaseTypeExtensions.String><any>String).endsWith("test");
(<MicrosoftAjaxBaseTypeExtensions.String><any>String).localeFormat("Please enter a number between {0} and {1}", 1, 2);
(<MicrosoftAjaxBaseTypeExtensions.String><any>String).trim();
(<MicrosoftAjaxBaseTypeExtensions.String><any>String).trimEnd();
(<MicrosoftAjaxBaseTypeExtensions.String><any>String).trimStart();
}
function BaseClassExtensions_Function_Tests() {
@@ -150,7 +150,7 @@ function BaseClassExtensions_Date_Tests() {
function BaseClassExtensions_Boolean_Tests() {
(<MicrosoftAjaxBaseTypeExtensions.Boolean>Boolean).parse("false");
(<MicrosoftAjaxBaseTypeExtensions.Boolean><any>Boolean).parse("false");
}
function BaseClassExtensions_Number_Tests() {
+1 -1
View File
@@ -50,7 +50,7 @@ function d() {
function e() {
mock({
'some/dir': mock.directory({
mode: 0755,
mode: parseInt("0755", 8),
items: {
file1: 'file one content',
file2: new Buffer([8, 6, 7, 5, 3, 0, 9])
+7
View File
@@ -196,10 +196,17 @@ moment.isMoment();
moment.isMoment(new Date());
moment.isMoment(moment());
moment.isDate(new Date());
moment.isDate(/regexp/);
moment.isDuration();
moment.isDuration(new Date());
moment.isDuration(moment.duration());
moment().isBetween(moment(), moment());
moment().isBetween(new Date(), new Date());
moment().isBetween([1,1,2000], [1,1,2001], "year");
moment.localeData('fr');
moment(1316116057189).fromNow();
+10 -45
View File
@@ -69,6 +69,7 @@ declare module moment {
subtract(d: Duration): Duration;
toISOString(): string;
toJSON(): string;
}
@@ -215,11 +216,8 @@ declare module moment {
dayOfYear(): number;
dayOfYear(d: number): Moment;
from(f: Moment): string;
from(f: Moment, suffix: boolean): string;
from(d: Date): string;
from(s: string): string;
from(date: number[]): string;
from(f: Moment|string|number|Date|number[], suffix?: boolean): string;
to(f: Moment|string|number|Date|number[], suffix?: boolean): string;
diff(b: Moment): number;
diff(b: Moment, unitOfTime: string): number;
@@ -242,39 +240,13 @@ declare module moment {
isDST(): boolean;
isBefore(): boolean;
isBefore(b: Moment): boolean;
isBefore(b: string): boolean;
isBefore(b: Number): boolean;
isBefore(b: Date): boolean;
isBefore(b: number[]): boolean;
isBefore(b: Moment, granularity: string): boolean;
isBefore(b: String, granularity: string): boolean;
isBefore(b: Number, granularity: string): boolean;
isBefore(b: Date, granularity: string): boolean;
isBefore(b: number[], granularity: string): boolean;
isBefore(b: Moment|string|number|Date|number[], granularity?: string): boolean;
isAfter(): boolean;
isAfter(b: Moment): boolean;
isAfter(b: string): boolean;
isAfter(b: Number): boolean;
isAfter(b: Date): boolean;
isAfter(b: number[]): boolean;
isAfter(b: Moment, granularity: string): boolean;
isAfter(b: String, granularity: string): boolean;
isAfter(b: Number, granularity: string): boolean;
isAfter(b: Date, granularity: string): boolean;
isAfter(b: number[], granularity: string): boolean;
isAfter(b: Moment|string|number|Date|number[], granularity?: string): boolean;
isSame(b: Moment): boolean;
isSame(b: string): boolean;
isSame(b: Number): boolean;
isSame(b: Date): boolean;
isSame(b: number[]): boolean;
isSame(b: Moment, granularity: string): boolean;
isSame(b: String, granularity: string): boolean;
isSame(b: Number, granularity: string): boolean;
isSame(b: Date, granularity: string): boolean;
isSame(b: number[], granularity: string): boolean;
isSame(b: Moment|string|number|Date|number[], granularity?: string): boolean;
isBetween(a: Moment|string|number|Date|number[], b: Moment|string|number|Date|number[], granularity?: string): boolean;
// Deprecated as of 2.8.0.
lang(language: string): Moment;
@@ -290,20 +262,12 @@ declare module moment {
localeData(): MomentLanguage;
// Deprecated as of 2.7.0.
max(date: Date): Moment;
max(date: number): Moment;
max(date: any[]): Moment;
max(date: string): Moment;
max(date: Moment|string|number|Date|any[]): Moment;
max(date: string, format: string): Moment;
max(clone: Moment): Moment;
// Deprecated as of 2.7.0.
min(date: Date): Moment;
min(date: number): Moment;
min(date: any[]): Moment;
min(date: string): Moment;
min(date: Moment|string|number|Date|any[]): Moment;
min(date: string, format: string): Moment;
min(clone: Moment): Moment;
get(unit: string): number;
set(unit: string, value: number): Moment;
@@ -412,6 +376,7 @@ declare module moment {
invalid(parsingFlags?: Object): Moment;
isMoment(): boolean;
isMoment(m: any): boolean;
isDate(m: any): boolean;
isDuration(): boolean;
isDuration(d: any): boolean;
+9
View File
@@ -196,10 +196,17 @@ moment.isMoment();
moment.isMoment(new Date());
moment.isMoment(moment());
moment.isDate(new Date());
moment.isDate(/regexp/);
moment.isDuration();
moment.isDuration(new Date());
moment.isDuration(moment.duration());
moment().isBetween(moment(), moment());
moment().isBetween(new Date(), new Date());
moment().isBetween([1,1,2000], [1,1,2001], "year");
moment.localeData('fr');
moment(1316116057189).fromNow();
@@ -228,6 +235,8 @@ moment.duration(500).seconds();
moment.duration(500).asSeconds();
moment.duration().minutes();
moment.duration().asMinutes();
moment.duration().toISOString();
moment.duration().toJSON();
var adur = moment.duration(3, 'd');
var bdur = moment.duration(2, 'd');
+30 -26
View File
@@ -5,31 +5,34 @@
/// <reference path="../express/express.d.ts" />
declare module Express {
export interface Request {
files: {
[fieldname: string]: {
/** Field name specified in the form */
fieldname: string;
/** Name of the file on the user's computer */
originalname: string;
/** Renamed file name */
name: string;
/** Encoding type of the file */
encoding: string;
/** Mime type of the file */
mimetype: string;
/** Location of the uploaded file */
path: string;
/** Extension of the file */
extension: string;
/** Size of the file in bytes */
size: number;
/** If the file was truncated due to size limitation */
truncated: boolean;
/** Raw data (is null unless the inMemory option is true) */
buffer: Buffer;
}
[fieldname: string]: Multer.File
}
}
module Multer {
export interface File {
/** Field name specified in the form */
fieldname: string;
/** Name of the file on the user's computer */
originalname: string;
/** Encoding type of the file */
encoding: string;
/** Mime type of the file */
mimetype: string;
/** Size of the file in bytes */
size: number;
/** The folder to which the file has been saved (DiskStorage) */
destination: string;
/** The name of the file within the destination (DiskStorage) */
filename: string;
/** Location of the uploaded file (DiskStorage) */
path: string;
/** A Buffer of the entire file (MemoryStorage) */
buffer: Buffer;
}
}
}
@@ -40,6 +43,7 @@ declare module "multer" {
function multer(options?: multer.Options): express.RequestHandler;
module multer {
type Options = {
/** The destination directory for the uploaded files. */
dest?: string;
@@ -69,11 +73,11 @@ declare module "multer" {
/** Function to rename the directory in which to place uploaded files. The dest parameter is the default value originally assigned or passed into multer. The req and res parameters are also passed into the function because they may contain information (eg session data) needed to create the path (eg get userid from the session). */
changeDest?: (dest: string, req: Express.Request, res: Express.Response) => string;
/** Event handler triggered when a file starts to be uploaded. A file object, with the following properties, is available to this function: fieldname, originalname, name, encoding, mimetype, path, and extension. */
onFileUploadStart?: (file: string, req: Express.Request, res: Express.Response) => void;
onFileUploadStart?: (file: Express.Multer.File, req: Express.Request, res: Express.Response) => void;
/** Event handler triggered when a chunk of buffer is received. A buffer object along with a file object is available to the function. */
onFileUploadData?: (file: string, data: Buffer, req: Express.Request, res: Express.Response) => void;
onFileUploadData?: (file: Express.Multer.File, data: Buffer, req: Express.Request, res: Express.Response) => void;
/** Event handler trigger when a file is completely uploaded. A file object is available to the function. */
onFileUploadComplete?: (file: string, req: Express.Request, res: Express.Response) => void;
onFileUploadComplete?: (file: Express.Multer.File, req: Express.Request, res: Express.Response) => void;
/** Event handler triggered when the form parsing starts. */
onParseStart?: () => void;
/** Event handler triggered when the form parsing completes. The request object and the next objects are are passed to the function. */
@@ -81,7 +85,7 @@ declare module "multer" {
/** Event handler for any errors encountering while processing the form. The error object and the next object is available to the function. If you are handling errors yourself, make sure to terminate the request or call the next() function, else the request will be left hanging. */
onError?: () => void;
/** Event handler triggered when a file size exceeds the specification in the limit object. No more files will be parsed after the limit is reached. */
onFileSizeLimit?: (file: string) => void;
onFileSizeLimit?: (file: Express.Multer.File) => void;
/** Event handler triggered when the number of files exceed the specification in the limit object. No more files will be parsed after the limit is reached. */
onFilesLimit?: () => void;
/** Event handler triggered when the number of fields exceed the specification in the limit object. No more fields will be parsed after the limit is reached. */
+136 -115
View File
@@ -1,117 +1,138 @@
/// <reference path="navigation.d.ts" />
// History Manager
class LogHistoryManager extends Navigation.HashHistoryManager {
addHistory(state: Navigation.State, url: string) {
console.log('add history');
super.addHistory(state, url);
}
}
// State Router
class LogStateRouter extends Navigation.StateRouter {
getData(route: string): { state: Navigation.State; data: any } {
console.log('get data');
return super.getData(route);
}
}
// Settings
Navigation.settings.router = new LogStateRouter();
Navigation.settings.historyManager = new LogHistoryManager();
Navigation.settings.stateIdKey = 'state';
// Configuration
Navigation.StateInfoConfig.build([
{ key: 'home', initial: 'page', states: [
{ key: 'page', route: '' }
]},
{ key: 'person', initial: 'list', states: [
{ key: 'list', route: 'people/{page}', transitions: [
{ key: 'select', to: 'details' }
], defaults: { page: 1 }, trackCrumbTrail: false },
{ key: 'details', route: 'person/{id}', defaultTypes: { id: 'number' } }
]}
]);
// StateInfo
var dialogs = Navigation.StateInfoConfig.dialogs;
var home = dialogs['home'];
var homePage = home.states['page'];
var homeKey = home.key;
var homePageKey = homePage.key;
homePage = home.initial;
var person = dialogs['person'];
var personList = person.states['list'];
var personDetails = person.states['details'];
var personListSelect = personList.transitions['select'];
personList = personListSelect.parent;
personDetails = personListSelect.to;
var pageDefault = personList.defaults.page;
var idDefaultType = personDetails.defaultTypes.id;
// StateNavigator
personList.dispose = () => {};
personList.navigating = (data, url, navigate) => {
navigate();
};
personList.navigated = (data) => {};
// State Handler
class LogStateHandler extends Navigation.StateHandler {
getNavigationData(state: Navigation.State, url: string): any {
console.log('get navigation data');
super.getNavigationData(state, url);
}
}
homePage.stateHandler = new LogStateHandler();
personList.stateHandler = new LogStateHandler();
personDetails.stateHandler = new LogStateHandler();
// Navigation Event
var navigationListener =
(oldState: Navigation.State, state: Navigation.State, data: any) => {
Navigation.StateController.offNavigate(navigationListener);
};
Navigation.StateController.onNavigate(navigationListener);
// Navigation
Navigation.start('home');
Navigation.StateController.navigate('person');
Navigation.StateController.refresh();
Navigation.StateController.refresh({ page: 2 });
Navigation.StateController.navigate('select', { id: 10 });
var canGoBack: boolean = Navigation.StateController.canNavigateBack(1);
Navigation.StateController.navigateBack(1);
// Navigation Link
var link = Navigation.StateController.getNavigationLink('person');
link = Navigation.StateController.getRefreshLink();
link = Navigation.StateController.getRefreshLink({ page: 2 });
link = Navigation.StateController.getNavigationLink('select', { id: 10 });
var nextDialog = Navigation.StateController.getNextState('select').parent;
person = nextDialog;
Navigation.StateController.navigateLink(link);
link = Navigation.StateController.getNavigationBackLink(1);
var crumb = Navigation.StateController.crumbs[0];
link = crumb.navigationLink;
// StateContext
Navigation.StateController.navigate('home');
Navigation.StateController.navigate('person');
home = Navigation.StateContext.previousDialog;
homePage = Navigation.StateContext.previousState;
person === Navigation.StateContext.dialog;
personList === Navigation.StateContext.state;
var url: string = Navigation.StateContext.url;
var page: number = Navigation.StateContext.data.page;
// Navigation Data
Navigation.StateController.refresh({ page: 2 });
var data = Navigation.StateContext.includeCurrentData({ sort: 'name' }, ['page']);
Navigation.StateController.refresh(data);
Navigation.StateContext.clear('sort');
var data = Navigation.StateContext.includeCurrentData({ pageSize: 10 });
Navigation.StateController.refresh(data);
Navigation.StateContext.clear();
Navigation.StateController.refresh();
module NavigationTests {
// History Manager
class LogHistoryManager extends Navigation.HashHistoryManager {
addHistory(state: Navigation.State, url: string) {
console.log('add history');
super.addHistory(state, url);
}
}
// Crumb Trail Persister
class LogCrumbTrailPersister extends Navigation.CrumbTrailPersister {
load(crumbTrail: string): string {
console.log('load');
return crumbTrail;
}
save(crumbTrail: string): string {
console.log('save');
return crumbTrail;
}
}
// State Router
class LogStateRouter extends Navigation.StateRouter {
getData(route: string): { state: Navigation.State; data: any } {
console.log('get data');
return super.getData(route);
}
}
// Settings
Navigation.settings.router = new LogStateRouter();
Navigation.settings.historyManager = new LogHistoryManager();
Navigation.settings.crumbTrailPersister = new LogCrumbTrailPersister();
Navigation.settings.stateIdKey = 'state';
// Configuration
Navigation.StateInfoConfig.build([
{ key: 'home', initial: 'page', states: [
{ key: 'page', route: '' }
]},
{ key: 'person', initial: 'list', states: [
{ key: 'list', route: ['people/{page}', 'people/{page}/sort/{sort}'], transitions: [
{ key: 'select', to: 'details' }
], defaults: { page: 1 }, trackCrumbTrail: false },
{ key: 'details', route: 'person/{id}', trackTypes: false, defaultTypes: { id: 'number' } }
]}
]);
// StateInfo
var dialogs = Navigation.StateInfoConfig.dialogs;
var home = dialogs['home'];
var homePage = home.states['page'];
var homeKey = home.key;
var homePageKey = homePage.key;
homePage = home.initial;
var person = dialogs['person'];
var personList = person.states['list'];
var personDetails = person.states['details'];
var personListSelect = personList.transitions['select'];
personList = personListSelect.parent;
personDetails = personListSelect.to;
var pageDefault = personList.defaults.page;
var idDefaultType = personDetails.defaultTypes.id;
// StateNavigator
personList.dispose = () => {};
personList.navigating = (data, url, navigate) => {
navigate([]);
};
personList.navigated = (data, asyncData) => {};
personDetails.navigating = (data, url, navigate) => {
navigate();
};
personDetails.navigated = (data) => {};
// State Handler
class LogStateHandler extends Navigation.StateHandler {
getNavigationData(state: Navigation.State, url: string): any {
console.log('get navigation data');
super.getNavigationData(state, url);
}
}
homePage.stateHandler = new LogStateHandler();
personList.stateHandler = new LogStateHandler();
personDetails.stateHandler = new LogStateHandler();
// Navigation Event
var navigationListener =
(oldState: Navigation.State, state: Navigation.State, data: any) => {
Navigation.StateController.offNavigate(navigationListener);
};
Navigation.StateController.onNavigate(navigationListener);
// Navigation
Navigation.start('home');
Navigation.StateController.navigate('person');
Navigation.StateController.refresh();
Navigation.StateController.refresh({ page: 2 });
Navigation.StateController.navigate('select', { id: 10 });
var canGoBack: boolean = Navigation.StateController.canNavigateBack(1);
Navigation.StateController.navigateBack(1);
// Navigation Link
var link = Navigation.StateController.getNavigationLink('person');
link = Navigation.StateController.getRefreshLink();
link = Navigation.StateController.getRefreshLink({ page: 2 });
link = Navigation.StateController.getNavigationLink('select', { id: 10 });
var nextDialog = Navigation.StateController.getNextState('select').parent;
person = nextDialog;
Navigation.StateController.navigateLink(link);
link = Navigation.StateController.getNavigationBackLink(1);
var crumb = Navigation.StateController.crumbs[0];
link = crumb.navigationLink;
Navigation.StateController.navigateLink(link, true);
// StateContext
Navigation.StateController.navigate('home');
Navigation.StateController.navigate('person');
home = Navigation.StateContext.previousDialog;
homePage = Navigation.StateContext.previousState;
person === Navigation.StateContext.dialog;
personList === Navigation.StateContext.state;
var url: string = Navigation.StateContext.url;
var page: number = Navigation.StateContext.data.page;
// Navigation Data
Navigation.StateController.refresh({ page: 2 });
var data = Navigation.StateContext.includeCurrentData({ sort: 'name' }, ['page']);
Navigation.StateController.refresh(data);
Navigation.StateContext.clear('sort');
var data = Navigation.StateContext.includeCurrentData({ pageSize: 10 });
Navigation.StateController.refresh(data);
Navigation.StateContext.clear();
Navigation.StateController.refresh();
}
+143 -9
View File
@@ -1,4 +1,4 @@
// Type definitions for Navigation 1.0
// Type definitions for Navigation 1.1.0
// Project: http://grahammendick.github.io/navigation/
// Definitions by: Graham Mendick <https://github.com/grahammendick>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -61,15 +61,20 @@ declare module Navigation {
*/
title?: string;
/**
* Gets the route Url pattern
* Gets the route Url patterns
*/
route: string;
route: string | string[];
/**
* Gets a value that indicates whether to maintain crumb trail
* information e.g PreviousState. This can be used together with Route
* to produce user friendly Urls
*/
trackCrumbTrail?: boolean;
/**
* Gets a value that indicates whether NavigationData Types are
* preserved when navigating
*/
trackTypes?: boolean;
}
/**
@@ -175,20 +180,35 @@ declare module Navigation {
*/
title: string;
/**
* Gets the route Url pattern
* Gets the route Url patterns
*/
route: string;
route: string | string[];
/**
* Gets a value that indicates whether to maintain crumb trail
* information e.g PreviousState. This can be used together with Route
* to produce user friendly Urls
*/
trackCrumbTrail: boolean;
/**
* Gets a value that indicates whether NavigationData Types are
* preserved when navigating
*/
trackTypes: boolean;
/**
* Gets or sets the IStateHandler responsible for building and parsing
* avigation links to this State
* navigation links to this State
*/
stateHandler: IStateHandler;
/**
* Called on the old State (this is not the same as the previous
* State) before navigating to a different State
* @param state The new State
* @param data The new NavigationData
* @param url The new target location
* @param unload The function to call to continue to navigate
* @param history A value indicating whether browser history was used
*/
unloading: (state: State, data: any, url: string, unload: () => void, history?: boolean) => void;
/**
* Called on the old State (this is not the same as the previous
* State) after navigating to a different State
@@ -197,15 +217,17 @@ declare module Navigation {
/**
* Called on the current State after navigating to it
* @param data The current NavigationData
* @param asyncData The data passed asynchronously while navigating
*/
navigated: (data: any) => void;
navigated: (data: any, asyncData?: any) => void;
/**
* Called on the new State before navigating to it
* @param data The new NavigationData
* @param url The new target location
* @param navigate The function to call to continue to navigate
* @param navigate The function to call to continue to navigate
* @param history A value indicating whether browser history was used
*/
navigating: (data: any, url: string, navigate: () => void) => void;
navigating: (data: any, url: string, navigate: (asyncData?: any) => void, history?: boolean) => void;
}
/**
@@ -366,6 +388,84 @@ declare module Navigation {
*/
getUrl(anchor: HTMLAnchorElement): string;
}
/**
* Provides the base functionality for crumb trail persistence mechanisms
*/
class CrumbTrailPersister {
/**
* Overridden by derived classes to return the persisted crumb trail
* @param crumbTrail The key, returned from the save function, to
* identify the persisted crumb trail
* @returns The crumb trail holding navigation and data information
*/
load(crumbTrail: string): string;
/**
* Overridden by derived classes to persist the crumb trail
* @param crumbTrail The crumb trail holding navigation and data
* information
* @returns The key to be passed to load function for crumb trail
* retrieval
*/
save(crumbTrail: string): string;
}
/**
* Persists crumb trails, over a specified length, in localStorage.
* Prevents the creation of unmanageably long Urls. If used in a browser
* without localStorage or outside of a browser environment, then in memory
* storage is used
*/
class StorageCrumbTrailPersister extends CrumbTrailPersister {
/**
* Initializes a new instance of the StorageCrumbTrailPersister class
* with a maxLength of 500, historySize of 100 and localStorage as the
* storage mechanism
*/
constructor();
/**
* Initializes a new instance of the StorageCrumbTrailPersister class
* with a historySize of 100 and localStorage as the storage mechanism
* @param maxLength The length above which any crumb trail will be
* stored in localStorage
*/
constructor(maxLength: number);
/**
* Initializes a new instance of the StorageCrumbTrailPersister class
* with localStorage as the storage mechanism
* @param maxLength The length above which any crumb trail will be
* stored in localStorage
* @param historySize The maximum number of crumb trails that will be
* held at any one time in localStorage
*/
constructor(maxLength: number, historySize: number);
/**
* Initializes a new instance of the StorageCrumbTrailPersister class
* @param maxLength The length above which any crumb trail will be
* stored in the storage
* @param historySize The maximum number of crumb trails that will be
* held at any one time in the storage
* @param storage The storage mechanism
*/
constructor(maxLength: number, historySize: number, storage: Storage);
/**
* Uses the crumbTrail parameter to determine whether to retrieve the
* crumb trail from storage. If retrieved from storage it may be null
* @param Key generated by the save function
* @returns Either the crumbTrail or the one retrieved value from
* storage; can be null if retrieved from storage
*/
load(crumbTrail: string): string;
/**
* If the crumbTrail is not over the maxLength it is returned.
* Otherwise the crumbTrail is stored in storage using a short key,
* unique within a given storage session. Also expunges old items from
* storage, if the historySize is breached when a new item is added
* @param crumbTrail The crumb trail to persist
* @returns crumbTrail or short, generated key pointing at crumbTrail
*/
save(crumbTrail: string): string;
}
/**
* Defines a contract a class must implement in order to build and parse
@@ -434,6 +534,14 @@ declare module Navigation {
navigationLink: string;
/**
* Initializes a new instance of the Crumb class
* @param data The Context Data held at the time of navigating away
* from this State
* @param state The configuration information associated with this
* navigation
* @param link The hyperlink navigation to return to the State and pass
* the associated Data
* @param last A value indicating whether the Crumb is the last in the
* crumb trail
*/
constructor(data: any, state: State, link: string, last: boolean);
}
@@ -442,8 +550,18 @@ declare module Navigation {
* Provides access to the Navigation Settings configuration
*/
class NavigationSettings {
/**
* Gets or sets the builder and parser of State routes
*/
router: IRouter;
/**
* Gets or sets the manager of the browser Url
*/
historyManager: IHistoryManager;
/**
* Gets or sets the crumb trail persistence mechanism
*/
crumbTrailPersister: CrumbTrailPersister;
/**
* Gets or sets the key that identifies the StateId
*/
@@ -464,6 +582,11 @@ declare module Navigation {
* Gets or sets the application path
*/
applicationPath: string;
/**
* Gets or sets a value indicating whether the PreviousStateId and
* ReturnData should be part of the CrumbTrail
*/
combineCrumbTrail: boolean;
}
/**
@@ -650,6 +773,12 @@ declare module Navigation {
* @param url The target location
*/
static navigateLink(url: string): void;
/**
* Navigates to the url
* @param url The target location
* @param history A value indicating whether browser history was used
*/
static navigateLink(url: string, history: boolean): void;
/**
* Gets the next State. Depending on the action will either return the
* 'to' State of a Transition or the 'initial' State of a Dialog
@@ -831,6 +960,11 @@ declare module Navigation {
* @returns The matched route and data
*/
match(path: string): { route: Route; data: any; };
/**
* Sorts the routes by the comparer
* @param compare The route comparer function
*/
sort(compare: (routeA: Route, routeB: Route) => number): void;
}
/**
+12 -4
View File
@@ -9,6 +9,14 @@
* *
************************************************/
// compat for TypeScript 1.5.3
// if you use with --target es3 or --target es5 and use below definitions,
// use the lib.es6.d.ts that is bundled with TypeScript 1.5.3.
interface MapConstructor {}
interface WeakMapConstructor {}
interface SetConstructor {}
interface WeakSetConstructor {}
/************************************************
* *
* GLOBAL *
@@ -271,7 +279,7 @@ declare module NodeJS {
Int8Array: typeof Int8Array;
Intl: typeof Intl;
JSON: typeof JSON;
Map: typeof Map;
Map: MapConstructor;
Math: typeof Math;
NaN: typeof NaN;
Number: typeof Number;
@@ -280,7 +288,7 @@ declare module NodeJS {
RangeError: typeof RangeError;
ReferenceError: typeof ReferenceError;
RegExp: typeof RegExp;
Set: typeof Set;
Set: SetConstructor;
String: typeof String;
Symbol: Function;
SyntaxError: typeof SyntaxError;
@@ -290,8 +298,8 @@ declare module NodeJS {
Uint32Array: typeof Uint32Array;
Uint8Array: typeof Uint8Array;
Uint8ClampedArray: Function;
WeakMap: typeof WeakMap;
WeakSet: Function;
WeakMap: WeakMapConstructor;
WeakSet: WeakSetConstructor;
clearImmediate: (immediateId: any) => void;
clearInterval: (intervalId: NodeJS.Timer) => void;
clearTimeout: (timeoutId: NodeJS.Timer) => void;
+121 -59
View File
@@ -8,39 +8,39 @@
"resolved": "https://registry.npmjs.org/definition-tester/-/definition-tester-0.2.0.tgz",
"dependencies": {
"bluebird": {
"version": "2.7.1",
"from": "bluebird@^2.5.3",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.7.1.tgz"
"version": "2.9.34",
"from": "bluebird@>=2.5.3 <3.0.0",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.9.34.tgz"
},
"definition-header": {
"version": "0.1.0",
"from": "definition-header@^0.1.0",
"from": "definition-header@>=0.1.0 <0.2.0",
"resolved": "https://registry.npmjs.org/definition-header/-/definition-header-0.1.0.tgz",
"dependencies": {
"joi": {
"version": "4.9.0",
"from": "joi@^4.0.0",
"from": "joi@>=4.0.0 <5.0.0",
"resolved": "https://registry.npmjs.org/joi/-/joi-4.9.0.tgz",
"dependencies": {
"hoek": {
"version": "2.11.0",
"from": "hoek@^2.2.x",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.11.0.tgz"
"version": "2.14.0",
"from": "hoek@>=2.2.0 <3.0.0",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.14.0.tgz"
},
"topo": {
"version": "1.0.2",
"from": "topo@1.x.x",
"from": "topo@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/topo/-/topo-1.0.2.tgz"
},
"isemail": {
"version": "1.1.1",
"from": "isemail@1.x.x",
"from": "isemail@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/isemail/-/isemail-1.1.1.tgz"
},
"moment": {
"version": "2.9.0",
"from": "moment@2.x.x",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.9.0.tgz"
"version": "2.10.3",
"from": "moment@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.10.3.tgz"
}
}
},
@@ -50,76 +50,138 @@
"resolved": "https://registry.npmjs.org/joi-assert/-/joi-assert-0.0.3.tgz",
"dependencies": {
"assertion-error": {
"version": "1.0.0",
"from": "assertion-error@^1.0.0",
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.0.tgz"
"version": "1.0.1",
"from": "assertion-error@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.1.tgz"
}
}
},
"parsimmon": {
"version": "0.5.1",
"from": "parsimmon@^0.5.0",
"from": "parsimmon@>=0.5.0 <0.6.0",
"resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-0.5.1.tgz",
"dependencies": {
"pjs": {
"version": "5.1.1",
"from": "pjs@5.x",
"from": "pjs@>=5.0.0 <6.0.0",
"resolved": "https://registry.npmjs.org/pjs/-/pjs-5.1.1.tgz"
}
}
},
"xregexp": {
"version": "2.0.0",
"from": "xregexp@~2.0.0",
"from": "xregexp@>=2.0.0 <2.1.0",
"resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz"
}
}
},
"findup-sync": {
"version": "0.2.1",
"from": "findup-sync@~0.2.1",
"resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.2.1.tgz"
"from": "findup-sync@>=0.2.1 <0.3.0",
"resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.2.1.tgz",
"dependencies": {
"glob": {
"version": "4.3.5",
"from": "glob@>=4.3.0 <4.4.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-4.3.5.tgz",
"dependencies": {
"inflight": {
"version": "1.0.4",
"from": "inflight@>=1.0.4 <2.0.0",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz",
"dependencies": {
"wrappy": {
"version": "1.0.1",
"from": "wrappy@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
}
}
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
},
"minimatch": {
"version": "2.0.9",
"from": "minimatch@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.9.tgz",
"dependencies": {
"brace-expansion": {
"version": "1.1.0",
"from": "brace-expansion@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz",
"dependencies": {
"balanced-match": {
"version": "0.2.0",
"from": "balanced-match@>=0.2.0 <0.3.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz"
},
"concat-map": {
"version": "0.0.1",
"from": "concat-map@0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
}
}
}
}
},
"once": {
"version": "1.3.2",
"from": "once@>=1.3.0 <2.0.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz",
"dependencies": {
"wrappy": {
"version": "1.0.1",
"from": "wrappy@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
}
}
}
}
}
}
},
"git-wrapper": {
"version": "0.1.1",
"from": "git-wrapper@~0.1.1",
"from": "git-wrapper@>=0.1.1 <0.2.0",
"resolved": "https://registry.npmjs.org/git-wrapper/-/git-wrapper-0.1.1.tgz"
},
"glob": {
"version": "4.3.5",
"from": "glob@^4.3.2",
"resolved": "https://registry.npmjs.org/glob/-/glob-4.3.5.tgz",
"version": "4.5.3",
"from": "glob@>=4.3.2 <5.0.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-4.5.3.tgz",
"dependencies": {
"inflight": {
"version": "1.0.4",
"from": "inflight@^1.0.4",
"from": "inflight@>=1.0.4 <2.0.0",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz",
"dependencies": {
"wrappy": {
"version": "1.0.1",
"from": "wrappy@1",
"from": "wrappy@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
}
}
},
"inherits": {
"version": "2.0.1",
"from": "inherits@2",
"from": "inherits@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
},
"minimatch": {
"version": "2.0.1",
"from": "minimatch@^2.0.1",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.1.tgz",
"version": "2.0.9",
"from": "minimatch@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.9.tgz",
"dependencies": {
"brace-expansion": {
"version": "1.1.0",
"from": "brace-expansion@^1.0.0",
"from": "brace-expansion@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz",
"dependencies": {
"balanced-match": {
"version": "0.2.0",
"from": "balanced-match@^0.2.0",
"from": "balanced-match@>=0.2.0 <0.3.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz"
},
"concat-map": {
@@ -132,13 +194,13 @@
}
},
"once": {
"version": "1.3.1",
"from": "once@^1.3.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.3.1.tgz",
"version": "1.3.2",
"from": "once@>=1.3.0 <2.0.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz",
"dependencies": {
"wrappy": {
"version": "1.0.1",
"from": "wrappy@1",
"from": "wrappy@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
}
}
@@ -147,17 +209,17 @@
},
"lazy.js": {
"version": "0.4.0",
"from": "lazy.js@~0.4.0",
"from": "lazy.js@>=0.4.0 <0.5.0",
"resolved": "https://registry.npmjs.org/lazy.js/-/lazy.js-0.4.0.tgz"
},
"manticore": {
"version": "0.2.4",
"from": "manticore@^0.2.4",
"from": "manticore@>=0.2.4 <0.3.0",
"resolved": "https://registry.npmjs.org/manticore/-/manticore-0.2.4.tgz",
"dependencies": {
"JSONStream": {
"version": "0.8.4",
"from": "JSONStream@^0.8.4",
"from": "JSONStream@>=0.8.4 <0.9.0",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz",
"dependencies": {
"jsonparse": {
@@ -166,30 +228,30 @@
"resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz"
},
"through": {
"version": "2.3.6",
"from": "through@>=2.2.7 <3",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.6.tgz"
"version": "2.3.8",
"from": "through@>=2.2.7 <3.0.0",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz"
}
}
},
"bluebird": {
"version": "1.2.4",
"from": "bluebird@^1.2.4",
"from": "bluebird@>=1.2.4 <2.0.0",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-1.2.4.tgz"
},
"through2": {
"version": "0.5.1",
"from": "through2@^0.5.1",
"from": "through2@>=0.5.1 <0.6.0",
"resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz",
"dependencies": {
"readable-stream": {
"version": "1.0.33",
"from": "readable-stream@~1.0.17",
"from": "readable-stream@>=1.0.17 <1.1.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz",
"dependencies": {
"core-util-is": {
"version": "1.0.1",
"from": "core-util-is@~1.0.0",
"from": "core-util-is@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
},
"isarray": {
@@ -199,43 +261,43 @@
},
"string_decoder": {
"version": "0.10.31",
"from": "string_decoder@~0.10.x",
"from": "string_decoder@>=0.10.0 <0.11.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@~2.0.1",
"from": "inherits@>=2.0.1 <2.1.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
},
"xtend": {
"version": "3.0.0",
"from": "xtend@~3.0.0",
"from": "xtend@>=3.0.0 <3.1.0",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz"
}
}
},
"type-detect": {
"version": "0.1.2",
"from": "type-detect@^0.1.2",
"from": "type-detect@>=0.1.2 <0.2.0",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.2.tgz"
}
}
},
"optimist": {
"version": "0.6.1",
"from": "optimist@~0.6.1",
"from": "optimist@>=0.6.1 <0.7.0",
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
"dependencies": {
"wordwrap": {
"version": "0.0.2",
"from": "wordwrap@~0.0.2",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz"
"version": "0.0.3",
"from": "wordwrap@>=0.0.2 <0.1.0",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz"
},
"minimist": {
"version": "0.0.10",
"from": "minimist@~0.0.1",
"from": "minimist@>=0.0.1 <0.1.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz"
}
}
@@ -243,9 +305,9 @@
}
},
"typescript": {
"version": "1.4.1",
"from": "typescript@1.4.1",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-1.4.1.tgz"
"version": "1.5.3",
"from": "typescript@1.5.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-1.5.3.tgz"
}
}
}
+1 -1
View File
@@ -36,6 +36,6 @@
},
"devDependencies": {
"definition-tester": "0.2.0",
"typescript": "1.4.1"
"typescript": "1.5.3"
}
}
+1 -1
View File
@@ -26,7 +26,7 @@ class User implements IUser {
//#endregion
// Sample from https://github.com/jaredhanson/passport-local#configure-strategy
passport.use(new local.Strategy(function (username, password, done) {
passport.use(new local.Strategy((username: any, password: any, done: any) => {
User.findOne({ username: username }, function (err, user) {
if (err) {
return done(err);
+8
View File
@@ -0,0 +1,8 @@
/// <reference path="path-exists.d.ts" />
import pathExists = require("path-exists");
pathExists("test/path-exists.d.ts", (error, exists) => {
console.log(exists);
});
console.log(pathExists.sync("test/__path-exists.d.ts"));
+14
View File
@@ -0,0 +1,14 @@
// Type definitions for path-exists 1.0.0
// Project: https://github.com/sindresorhus/path-exists
// Definitions by: Shogo Iwano <https://github.com/shiwano>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "path-exists" {
interface PathExists {
(path: string, callback: (error: Error, exists: boolean) => void): void;
sync(path: string): boolean;
}
var pathExists: PathExists;
export = pathExists;
}
+2 -2
View File
@@ -556,7 +556,7 @@ function test_globalization() {
function test_inAppBrowser() {
var ref = window.open('http://apache.org', '_blank', 'location=yes');
ref.addEventListener('loadstart', function () { alert(event.url); });
ref.addEventListener('loadstart', function () { alert(event); });
ref.removeEventListener('loadstart', null);
ref.close();
}
@@ -716,4 +716,4 @@ function test_storage() {
var value = window.localStorage.getItem("key");
window.localStorage.removeItem("key");
window.localStorage.clear();
}
}
+908
View File
@@ -0,0 +1,908 @@
/// <reference path="./photonui.d.ts" />
// All exemple scripts from PhotonUI documentation:
// Accel Manager
// We add a field to test accels
var field = new photonui.TextField({
value: "Text Field"
});
photonui.domInsert(field, "demo");
// ... And a label to display things
var label = new photonui.Label({text: ""});
photonui.domInsert(label, "demo");
// We create the accel
var accel = new photonui.AccelManager();
// "Ctrl+A" / "Command+A" accelerator that is disabled if
// a field is focused
accel.addAccel("accel1", "ctrl + a", function() {
label.text += "'Ctrl + A' accelerator\n";
});
accel.addAccel("accel1-mac", "command + a", function() {
label.text += "'Command + A' accelerator\n";
});
// "Ctrl+R" accelerator that works even if the field is focused
accel.addAccel("accel3", "ctrl + r", function() {
label.text += "'Ctrl + R' accelerator\n";
}, false);
// A more complexe sequence (hold "Ctrl+X", and then press "C")
accel.addAccel("accel4", "ctrl + x > c", function() {
label.text += "'Ctrl + X > C' accelerator\n";
});
// BoxLayout
var box = new photonui.BoxLayout({
orientation: "vertical", // "vertical" or "horizontal"
spacing: 5, // spacing between widgets
children: [
new photonui.Button(),
new photonui.Button(),
new photonui.Button()
]
});
photonui.domInsert(box, "demo");
// Button
var btn = new photonui.Button({
text: "My Button",
leftIcon: new photonui.FAIcon("fa-send"),
callbacks: {
click: function(widget: any, event: any) {
alert("Someone clicked on " + widget.text);
}
}
});
photonui.domInsert(btn, "demo");
// canvas
var canvas = new photonui.Canvas({
width: 200,
height: 150
});
photonui.domInsert(canvas, "demo");
var ctx = canvas.getContext("2d");
ctx.lineWidth = 3;
ctx.strokeStyle = "#DB624F";
ctx.beginPath();
ctx.moveTo(10, 10);
ctx.lineTo(40, 140);
ctx.lineTo(50, 30);
ctx.lineTo(190, 100);
ctx.stroke();
// Checkbox
var check = new photonui.CheckBox({
value: true
});
photonui.domInsert(check, "demo");
// Color
var color = new photonui.Color("red");
console.log(color.hexString);
// "#FF0000"
var color = new photonui.Color("red");
console.log(color.hexString);
// "#FF0000"
console.log(color.rgbString);
// "rgb(255, 0, 0)"
console.log(color.rgbaString);
// "rgb(255, 0, 0, 1)"
console.log(color.getRGB());
// Array [ 255, 0, 0 ]
console.log(color.getRGBA());
// Array [ 255, 0, 0, 255 ]
console.log(color.red, color.green, color.blue);
// 255 0 0
console.log(color.hue, color.saturation, color.brightness);
// 0 100 100
color.brightness = 50;
console.log(color.hexString);
// "#7F0000"
color.hue = 204;
console.log(color.hexString);
// #004C7F
// ColorButton
var btn2 = new photonui.ColorButton({
value: "#4EC8DB",
callbacks: {
"value-changed": function(widget: any, value: any) {
var header = document.getElementsByTagName("header")[0];
header.style.backgroundColor = value;
}
}
});
photonui.domInsert(btn2, "demo");
// colorpalette
var palette = new photonui.ColorPalette({
callbacks: {
"value-changed": function(widget: any, value: any) {
var header = document.getElementsByTagName("header")[0];
header.style.backgroundColor = value;
}
}
});
photonui.domInsert(palette, "demo");
var palette = new photonui.ColorPalette({
palette: [
["#D32F2F", "#F44336", "#E91E63", "#9C27B0", "#673AB7"],
["#3F51B5", "#2196F3", "#03A9F4", "#00BCD4", "#009688"],
["#4CAF50", "#8BC34A", "#CDDC39", "#FFEB3B", "#FFC107"],
["#FF9800", "#FF5722", "#795548", "#9E9E9E", "#607D8B"]
],
callbacks: {
"value-changed": function(widget: any, value: any) {
var header = document.getElementsByTagName("header")[0];
header.style.backgroundColor = value;
}
}
});
photonui.domInsert(palette, "demo");
// ColorPicker
var colorPicker = new photonui.ColorPicker({
value: "#4EC8DB",
callbacks: {
"value-changed": function(widget: any, value: any) {
var header = document.getElementsByTagName("header")[0];
header.style.backgroundColor = value;
}
}
});
photonui.domInsert(colorPicker, "demo");
// ColorPickerDialog
var dlg = new photonui.ColorPickerDialog({
value: "#4EC8DB",
callbacks: {
"value-changed": function(widget: any, value: any) {
var header = document.getElementsByTagName("header")[0];
header.style.backgroundColor = value;
}
}
});
// Add a button to show up the dialog
var btn = new photonui.Button({
text: "Display the dialog",
callbacks: {
click: dlg.show.bind(dlg)
}
});
photonui.domInsert(btn, "demo");
// Dialog
var pos = photonui.Helpers.getAbsolutePosition("demo");
new photonui.Dialog({
title: "My Dialog",
visible: true,
x: pos.x, y: pos.y,
child: new photonui.Label("Hello, I'm a dialog"),
padding: 10,
buttons: [
new photonui.Button()
],
callbacks: {
"close-button-clicked": function(widget: any) {
widget.destroy();
}
}
});
// FAIcon
var icon = new photonui.FAIcon({
iconName: "fa-camera",
size: "fa-3x", // "", "fa-lg", "fa-2x", "fa-3x", "fa-4x", "fa5x"
color: "#DB624F"
});
photonui.domInsert(icon, "demo");
// FileManager
// File manager that accepts PNG, JPEG, BMP and SVG files
var fm = new photonui.FileManager({
acceptedMimes: ["image/png", "image/jpeg"],
acceptedExts: ["bmp", "svg"],
dropZone: document, // Enable file d&d
multiselect: true, // Allow to select more than one file
callbacks: {
"file-open": function(widget: any, file: any, x: number, y: number) {
// x and y are defined only with d&d
if (x !== undefined) {
alert(file.name + " dropped at ("+x+", "+y+")");
}
else {
alert(file.name + " opened");
}
}
}
});
// Button to show the "file open" dialog
var btn = new photonui.Button({
text: "Open",
callbacks: {
click: function(widget: any, event: any) {
fm.open();
}
}
});
photonui.domInsert(btn, "demo");
// FluidLayout
var fl = new photonui.FluidLayout({
children: [
new photonui.Button(),
new photonui.Button(),
new photonui.Button(),
new photonui.Button(),
new photonui.Button(),
new photonui.Button(),
new photonui.Button()
]
});
photonui.domInsert(fl, "demo");
// FontSelect
var select = new photonui.FontSelect({
value: "item1",
fonts: [
"Arial",
"Arial Black",
"Cantarell",
"Courier New",
"Impact",
"Time New Roman",
"Titillium Web",
"Verdana"
],
callbacks: {
"value-changed": function(widget: any, value: any) {
alert("Value changed: " + value);
}
}
});
photonui.domInsert(select, "demo");
// GridLayout
var grid = new photonui.GridLayout({
horizontalPadding: 0,
verticalPadding: 0,
horizontalSpacing: 5,
verticalSpacing: 5,
children: [
new photonui.Button({
text: "Widget 1",
layoutOptions: {
x: 0, y: 0,
cols: 1, rows: 1
}
}),
new photonui.Button({
text: "Widget 2",
layoutOptions: {
x: 1, y: 0,
cols: 1, rows: 1
}
}),
new photonui.Button({
text: "Widget 3",
layoutOptions: {
x: 2, y: 0,
cols: 1, rows: 2
}
}),
new photonui.Button({
text: "Widget 4",
layoutOptions: {
x: 0, y: 1,
cols: 2, rows: 1
}
})
]
});
photonui.domInsert(grid, "demo");
// Image
var img = new photonui.Image({
url: "../../images/favicon.png"
});
photonui.domInsert(img, "demo");
// Label
var label = new photonui.Label({
text: "My Label",
textAlign: "left"
});
photonui.domInsert(label, "demo");
// Menu
var menu = new photonui.Menu({
iconVisible: true,
children: [
new photonui.MenuItem({
text: "Menu Item 1",
icon: new photonui.FAIcon("fa-paper-plane")
}),
new photonui.MenuItem({
text: "Menu Item 2",
icon: new photonui.FAIcon("fa-gears")
}),
new photonui.MenuItem({
text: "Menu Item 3",
icon: new photonui.FAIcon("fa-paw")
})
]
});
photonui.domInsert(menu, "demo");
// MenuItem
var menu = new photonui.Menu({
iconVisible: true,
children: [
new photonui.MenuItem({
text: "Menu Item 1",
icon: new photonui.FAIcon("fa-paper-plane"),
callbacks: {
click: function(widget: any, event: any) {
alert("You clicked on me!");
}
}
}),
new photonui.MenuItem({
text: "Menu Item 2",
icon: new photonui.FAIcon("fa-gears")
}),
new photonui.MenuItem({
text: "Menu Item 3",
icon: new photonui.FAIcon("fa-paw")
})
]
});
photonui.domInsert(menu, "demo");
// Mouse Manager
var img = new photonui.Image({
url: "../../images/favicon.png"
});
var mouse = new photonui.MouseManager({
element: img,
callbacks: {
"click": function(manager: any, mstate: any) {
alert("You clicked on the image at " +
mstate.x + ", " + mstate.y);
}
}
});
photonui.domInsert(img, "demo");
// Numeric Filed
var field2 = new photonui.NumericField({
placeholder: "placeholder",
decimalDigits: 2,
min: -10, max: 10,
step: 0.5, // When scrolling over the field
decimalSymbol: ".", // "." or ","
value: 5.5
});
photonui.domInsert(field2, "demo");
// PopupMenu
var pos = photonui.Helpers.getAbsolutePosition("demo");
var popup = new photonui.PopupMenu({
children: [
new photonui.MenuItem({
text: "Menu Item 1",
icon: new photonui.FAIcon("fa-paper-plane"),
callbacks: {
click: function(widget: any, event: any) {
alert("You clicked on me!");
}
}
}),
new photonui.MenuItem({
text: "Menu Item 2",
icon: new photonui.FAIcon("fa-gears")
}),
new photonui.MenuItem({
text: "Menu Item 3",
icon: new photonui.FAIcon("fa-paw")
})
]
});
popup.popupXY(pos.x, pos.y);
// PopupWindow
var pos = photonui.Helpers.getAbsolutePosition("demo");
var popup = new photonui.PopupWindow({
padding: 10,
width: 200,
height: 200,
child: new photonui.Label({
text: "Click anywhere to close"
})
});
popup.popupXY(pos.x, pos.y);
// ProgressBar
var pb = new photonui.ProgressBar({
textVisible: true,
value: 0.42
});
photonui.domInsert(pb, "demo");
// Select
var select2 = new photonui.Select({
value: "item1",
children: [
new photonui.MenuItem({value: "item1", text: "Item 1"}),
new photonui.MenuItem({value: "item2", text: "Item 2"}),
new photonui.MenuItem({value: "item3", text: "Item 3"})
],
callbacks: {
"value-changed": function(widget: any, value: any) {
alert("Value changed: " + value);
}
}
});
photonui.domInsert(select2, "demo");
// Separator
var separator = new photonui.Separator();
photonui.domInsert(separator, "demo");
// Slider
var box = new photonui.BoxLayout({
children: [
new photonui.Slider({
fieldVisible: false,
min: 0, max: 100,
step: 5,
value: 50
}),
new photonui.Slider({
fieldVisible: true,
min: -100, max: 100,
step: 10,
value: -50
}),
new photonui.Slider({
fieldVisible: true,
min: 0, max: 1,
decimalDigits: 2,
decimalSymbol: ".",
step: 0.05,
value: 0.5
})
]
});
photonui.domInsert(box, "demo");
// SpriteIcon
// Create the spritesheet
var spriteSheet = new photonui.SpriteSheet({
name: "default",
imageUrl: "./spritesheet.png",
size: 16,
icons: {
"remove": [ 0, 0],
"add": [16, 0],
"grayHeart": [32, 0],
"redHeart": [48, 0],
"battery1": [ 0, 16],
"battery2": [16, 16],
"battery3": [32, 16],
"battery4": [48, 16]
}
});
// Create an icon from the spritesheet
var icon2 = new photonui.SpriteIcon("default/redHeart");
photonui.domInsert(icon2, "demo");
// SubMenuItem
var menu = new photonui.Menu({
iconVisible: true,
children: [
new photonui.SubMenuItem({
text: "Submenu Item",
menuName: "submenu1",
icon: new photonui.FAIcon("fa-paw")
}),
new photonui.Menu({
visible: true, // false to hide it by default
name: "submenu1",
iconVisible: true,
children: [
new photonui.MenuItem({
text: "Submenu Item 1",
icon: new photonui.FAIcon("fa-gamepad")
}),
new photonui.MenuItem({
text: "Sumbenu Item 2",
icon: new photonui.FAIcon("fa-flask")
})
]
})
]
});
photonui.domInsert(menu, "demo");
// Switch
var sw = new photonui.Switch({
value: true
});
photonui.domInsert(sw, "demo");
// TabItem
var tabs = new photonui.TabLayout({
tabsPosition: "top", // "top", "bottom", "left" or "right"
children: [
new photonui.TabItem({
title: "Tab 1",
child: new photonui.Label("Widget inside the first tab")
}),
new photonui.TabItem({
title: "Tab 2",
child: new photonui.Button()
}),
new photonui.TabItem({
title: "Tab 3"
})
]
});
photonui.domInsert(tabs, "demo");
document.getElementById("demo")
.className += " photonui-container-expand-child";
// TabLayout
var tabs = new photonui.TabLayout({
tabsPosition: "top", // "top", "bottom", "left" or "right"
children: [
new photonui.TabItem({
title: "Tab 1",
child: new photonui.Label("Widget inside the first tab")
}),
new photonui.TabItem({
title: "Tab 2",
child: new photonui.Button()
}),
new photonui.TabItem({
title: "Tab 3"
})
]
});
photonui.domInsert(tabs, "demo");
document.getElementById("demo")
.className += " photonui-container-expand-child";
// Text
var text = new photonui.Text({
rawHtml: "<strong>Lorem ipsum</strong> dolor sit amet..."
});
photonui.domInsert(text, "demo");
// TextAreaField
var field3 = new photonui.TextAreaField({
placeholder: "placeholder",
value: "This is a\nTextArea"
});
photonui.domInsert(field3, "demo");
// TextField
var field = new photonui.TextField({
placeholder: "placeholder",
value: "Text"
});
photonui.domInsert(field, "demo");
var grid = new photonui.GridLayout({
verticalSpacing: 5,
horizontalSpacing: 5,
children: [
new photonui.Label({
text: "Username:",
forInputName: "username-field",
layoutOptions: {
gridX: 0,
gridY: 0
}
}),
new photonui.TextField({
name: "username-field",
placeholder: "Username",
value: "Anakin",
layoutOptions: {
gridX: 1,
gridY: 0
}
}),
new photonui.Label({
text: "Password:",
forInputName: "password-field",
layoutOptions: {
gridX: 0,
gridY: 1
}
}),
new photonui.TextField({
name: "password-field",
type: "password",
placeholder: "password",
value: "D4RK51D3",
layoutOptions: {
gridX: 1,
gridY: 1
}
}),
new photonui.Button({
text: "Login",
leftIcon: new photonui.FAIcon("fa-sign-in"),
callbacks: {
click: function(widget: any, event: any) {
var usernameField = photonui.getWidget("username-field");
var passwordField = photonui.getWidget("password-field");
alert(
"Username: " + (<photonui.TextField>usernameField).value +
", Password: " + (<photonui.TextField>passwordField).value
);
}
},
layoutOptions: {
gridX: 0,
gridY: 2,
gridWidth: 2
}
})
]
});
photonui.domInsert(grid, "demo");
// ToggleButton
var toggle = new photonui.ToggleButton({
value: false,
text: "Toggle Button"
});
photonui.domInsert(toggle, "demo");
var toggle2 = new photonui.ToggleButton({
value: false,
text: "Value: off",
buttonColor: "red",
callbacks: {
"value-changed": function(widget: any, value: any) {
widget.text = "Value: " + ((value) ? "on" : "off");
widget.buttonColor = (value) ? "green" : "red";
}
}
});
photonui.domInsert(toggle2, "demo");
// Translation
var translation = new photonui.Translation();
translation.addCatalogs({
"fr": {
"messages": {
"Hello World": ["Bonjour le monde"]
}
}
});
translation.locale = "fr"; // Change the locale to test
var label = new photonui.Label({
text: _("Hello World"),
text2: translation.lazyGettext("Hello World")
});
photonui.domInsert(label, "demo");
var tr = new photonui.Translation();
tr.addCatalogs({
"fr": {
"plural-forms": "nplurals=2; plural=(n > 1);",
"messages": {
"Hello World": ["Bonjour le monde"],
'Browser language is "{lang}".': ["La langue du navigateur est « {lang} »."],
"Close": ["Fermer"]
}
},
"it": {
"plural-forms": "nplurals=2; plural=(n != 1);",
"messages": {
"Hello World": ["Buongiorno il mondo"],
'Browser language is "{lang}".': ['La lingua del browser è "{lang}".'],
"Close": ["Chiudere"]
}
}
});
tr.locale = tr.guessUserLanguage(); // Browser language
// Language selector
var layout = new photonui.BoxLayout({
orientation: "vertical",
children: [
new photonui.Label({
text: _('Browser language is "{lang}".', {
lang: tr.guessUserLanguage()
})
}),
new photonui.Select({
name: "lang",
placeholder: "Choose a language...",
value: tr.locale,
children: [
new photonui.MenuItem({value: "en", text: "English"}),
new photonui.MenuItem({value: "fr", text: "Français"}),
new photonui.MenuItem({value: "it", text: "Italiano"}),
],
callbacks: {
"value-changed": function(widget: any, value: any) {
tr.locale = value;
}
}
})
]
});
photonui.domInsert(layout, "demo");
// A window
var pos = photonui.Helpers.getAbsolutePosition("demo");
var win = new photonui.Window({
visible: true,
title: _("Hello World"),
x: pos.x, y: pos.y + 100,
width: 250,
padding: 20,
child: new photonui.Button({
text: _("Close"),
callbacks: {
"click": function() { win.hide(); }
}
}),
callbacks: {
"close-button-clicked": function(widget: any) { widget.hide(); }
}
});
// Viewport
var viewport = new photonui.Viewport({
width: 300,
height: 200,
padding: 5,
horizontalScrollbar: false, // true, false or null (= auto)
verticalScrollbar: null, // true, false or null (= auto)
child: new photonui.BoxLayout({
children: [
new photonui.Button(),
new photonui.Button(),
new photonui.Button(),
new photonui.Button(),
new photonui.Button(),
new photonui.Button(),
new photonui.Button(),
new photonui.Button(),
new photonui.Button(),
new photonui.Button()
]
})
});
photonui.domInsert(viewport, "demo");
// Window
var pos = photonui.Helpers.getAbsolutePosition("demo");
new photonui.Window({
title: "My Window",
visible: true,
x: pos.x, y: pos.y,
width: 300, height: 100,
callbacks: {
"close-button-clicked": function(widget: any) {
widget.destroy();
},
"position-changed": function(widget: any, x: number, y: number) {
widget.title = "My Window (x: " + x + ", y: " + y + ")";
}
}
});
// Get the position of the #demo area to display windows
// in the right place
var pos = photonui.Helpers.getAbsolutePosition("demo");
// Create a window with a button to center it (x axis) on the page
var win1 = new photonui.Window({
title: "Window 1",
visible: true,
padding: 10,
x: pos.x + 20, y: pos.y + 50,
child: new photonui.Button({
text: "Center Me",
callbacks: {
click: function(widget: any, event: any) {
win1.center();
win1.y = pos.y;
}
}
}),
callbacks: {
"close-button-clicked": function(widget: any) {
widget.destroy();
}
}
});
// Create a second window without "close" button
var win2 = new photonui.Window({
title: "Window 2",
visible: true,
height: 100,
closeButtonVisible: false,
x: pos.x, y: pos.y
});
// Focus the first window
win1.show();
+435
View File
@@ -0,0 +1,435 @@
// Type definitions for PhotonUI v1.0.0
// Project: https://github.com/wanadev/PhotonUI
// Definitions by: Florent Poujol <https://github.com/florentpoujol/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module photonui {
// Base
module Helpers {
function escapeHtml(string: string): void;
function uuid4(): string;
function cleanNode(node: HTMLElement): void;
function getAbsolutePosition(element: HTMLElement|string): { x: number; y: number };
function numberToCssSize(value: number, defaultValue?: number, nullValue?: string): string;
}
class Base {
constructor(params?: { [key: string]: any });
destroy(): void;
registerCallback(id: string, wEvent: string, callback: Function, thisArg: any): void;
removeCallback(id: string): void;
}
class Widget extends Base {
absolutePosition: { x: number; y: number; }; // readonly
contextMenu: PopupWindow;
contextMenuName: string;
html: HTMLElement; // readonly
layoutOptions: { [key: string]: any };
name: string;
offsetWidth: number; // readonly
offsetHeight: number; // readonly
parent: Widget;
parentName: string;
tooltip: string;
visible: boolean;
show(): void;
hide(): void;
unparent(): void;
addClass(className: string): void;
removeClass(className: string): void;
static getWidget(name: string): Widget;
static domInsert(widget: Widget, element?: HTMLElement|string): void;
}
// Methods
function domInsert(widget: Widget, element?: HTMLElement|string): void;
function getWidget(name: string): Widget;
//Widgets
class FileManager extends Base {
acceptedExts: string[];
acceptedMimes: string[];
dropZone: HTMLElement;
multiselect: boolean;
open(): void;
}
class Translation extends Base {
locale: string;
addCatalogs(catalogs: { [key: string]: any }): void;
guessUserLanguage(): string;
gettext(string: string, replacements?: { [key: string]: string }): string;
lazyGettext(string: string, replacements?: { [key: string]: string }): string;
enableDomScan(enable: boolean): void;
updateDomTranslation(): void;
}
class AccelManager extends Base {
addAccel(id: string, keys: string, callback: Function, safe?: boolean): void;
removeAccel(id: string): void;
}
class MouseManager extends Base {
constructor(params?: { [key: string]: any });
constructor(element?: Widget|HTMLElement, params?: { [key: string]: any });
element: HTMLElement;
threshold: number;
action: string; // readonly
btnLeft: boolean; // readonly
btnMiddle: boolean; // readonly
btnRight: boolean; // readonly
button: string; // readonly
pageX: number; // readonly
pageY: number; // readonly
x: number; // readonly
y: number; // readonly
deltaX: number; // readonly
deltaY: number; // readonly
}
// -----------------------------------
class BaseIcon extends Widget {}
class FAIcon extends BaseIcon {
constructor(params?: { [key: string]: any });
constructor(name: string, params?: { [key: string]: any });
color: string;
iconName: string;
size: string;
}
class SpriteIcon extends BaseIcon {
constructor(params?: { [key: string]: any });
constructor(name: string, params?: { [key: string]: any });
icon: string;
iconName: string;
spriteSheetName: string;
}
// -----------------------------------
class Image extends Widget {
width: number;
height: number;
url: string;
}
class SpriteSheet extends Base {
name: string;
imageUrl: string;
size: string;
icons: { [iconName: string]: number[] };
addIcon(iconName: string, x: number, y: number): void;
removeIcon(iconName: string): void;
getIconPosition(iconName: string): { x: number; y: number; };
getIconCSS(iconName: string): string;
static getSpriteSheet(name: string): SpriteSheet;
}
class Canvas extends Widget {
canvas: HTMLElement;
interactiveMode: HTMLElement;
width: number;
height: number;
getContext(contextId: string): any;
setContext(contextId: string): void;
supportsContext(contextId: string): boolean;
toBlod(imageFormat: string): any; // returns Blob
toBlodHD(imageFormat: string): any; // returns Blob
toDataUrl(imageFormat: string): string;
toDataUrlHD(imageFormat: string): string;
transferControlToProxy(): void;
}
class Label extends Widget {
constructor(params?: { [key: string]: any });
constructor(name: string, params?: { [key: string]: any });
forInput: Field|CheckBox;
forInputName: string;
text: string;
textAlign: string;
}
class Text extends Widget {
rawHtml: string;
text: string;
}
class ProgressBar extends Widget {
orientation: string;
pulsate: boolean;
textVisible: boolean;
value: number;
}
class Separator extends Widget {
orientation: string;
}
class Button extends Widget {
appearance: string; // normal | flat
buttonColor: string;
leftIconName: string;
leftIcon: BaseIcon;
leftIconVisible: boolean;
rightIconName: string;
rightIcon: BaseIcon;
rightIconVisible: boolean;
text: string;
textVisible: boolean;
}
class ColorButton extends Widget {
color: Color;
dialogOnly: boolean;
value: string;
}
class CheckBox extends Widget {
value: boolean;
}
class Switch extends CheckBox {}
class ToggleButton extends CheckBox {}
// -----------------------------------
class Color extends Base {
constructor(color: string);
constructor(params?: { [key: string]: any });
hexString: string;
rgbString: string; // readonly
rgbaString: string; // readonly
red: number;
green: number;
blue: number;
alpha: number;
hue: number;
saturation: number;
brightness: number;
setRGB(red: number, green: number, blue: number): void;
getRGB(): number[];
setRGBA(red: number, green: number, blue: number, alpha: number): void;
getRGBA(): number[];
setHSB(hue: number, saturation: number, brightness: number): void;
}
class ColorPalette extends Widget {
color: Color;
palette: Array<string[]>;
value: string;
static palette: Array<string[]>;
}
class ColorPicker extends Widget {
color: Color;
value: string;
}
// -----------------------------------
class Field extends Widget {
placeholder: string;
value: boolean;
}
class NumericField extends Field {
min: number;
max: number;
step: number;
decimalDigits: number;
decimalSymbol: string;
}
class Slider extends NumericField {
fieldVisible: boolean;
}
class TextAreaField extends Field {
cols: number;
rows: number;
}
class TextField extends Field {
type: string; // text, password, email, search, tel, url
}
// -----------------------------------
class Select extends Widget {
children: Widget[];
childrenNames: string[];
iconVisible: boolean;
placeholder: string;
popupWidth: number;
popupHeight: number;
popupMaxWidth: number;
popupMinWidth: number;
popupMaxHeight: number;
popupMinHeight: number;
popupOffsetWidth: number; // readonly
popupOffsetHeight: number; // readonly
popupPadding: number;
value: any; // string (maybe)
addChild(widget: Widget, layoutOptions?: any): void;
}
class FontSelect extends Select {
fonts: string[];
addFont(fontName: string): void;
}
// -----------------------------------
class Container extends Widget {
child: Widget;
childName: string;
containerNode: HTMLElement; // readonly
horizontalChildExpansion: boolean;
verticalChildExpansion: boolean;
removeChild(widget: Widget): void;
}
class Layout extends Container {
children: Widget[];
childrenNames: string[];
addChild(widget: Widget, layoutOptions?: { [key: string]: any }): void;
empty(): void;
}
class BoxLayout extends Layout {
horizontalPadding: number;
verticalPadding: number;
orientation: string;
spacing: number;
}
class FluidLayout extends Layout {
horizontalPadding: number;
verticalPadding: number;
}
class GridLayout extends Layout {
horizontalPadding: number;
verticalPadding: number;
horizontalSpacing: number;
verticalSpacing: number;
}
class Menu extends Layout {
iconVisible: boolean;
}
class MenuItem extends Menu {
active: boolean;
icon: BaseIcon;
iconName: string;
text: string;
value: any; // string (maybe)
}
class SubMenuItem extends MenuItem {
menu: Menu;
menuName: string;
}
// -----------------------------------
class Viewport extends Container {
width: number;
minWidth: number;
maxWidth: number;
height: number;
minHeight: number;
maxHeight: number;
padding: number;
horizontalScrollbar: boolean;
verticalScrollbar: boolean;
}
// -----------------------------------
class BaseWindow extends Container {
width: number;
minWidth: number;
maxWidth: number;
height: number;
minHeight: number;
maxHeight: number;
padding: number;
position: { x: number; y: number };
x: number;
y: number;
center(): void;
}
class PopupWindow extends BaseWindow {
popupXY(x: number, y: number): void;
popupWidget(widget: Widget): void;
}
class PopupMenu extends PopupWindow {}
class Window extends BaseWindow {
closeButtonVisible: boolean;
modal: boolean;
movable: boolean;
title: string;
moveToFront(): void;
moveToBack(): void;
}
class Dialog extends Window {
buttons: Widget[];
buttonNames: string[];
addButton(widget: Widget, layoutOptions: any): void;
removeButton(widget: Widget): void;
}
class ColorPickerDialog extends Dialog {
color: Color;
}
// -----------------------------------
class TabItem extends Container {
tabHtml: HTMLElement; // readonly
title: string;
}
class TabLayout extends Layout {
activeTab: Widget;
activeTabName: string;
padding: number;
tabsPosition: string; // top, bottom, left, right
}
}
declare function _(string: string, replacements?: { [key: string]: string }): string; // alias of Translation.lazyGettext()
+3 -3
View File
@@ -69,9 +69,9 @@ var customizedAssert2 = assert.customize({
circular: '#@Circular#',
lineSeparator: '\n',
ambiguousEastAsianCharWidth: 2,
widthOf: () => null,
stringify: () => null,
diff: () => null,
widthOf: () => false,
stringify: () => false,
diff: () => false,
writerClass: null,
renderers: [
'./built-in/file',
-6
View File
@@ -1,6 +0,0 @@
///<reference path='../../react/legacy/react-0.12.d.ts' />
declare module 'react-0.12' {
var exports: React.Exports;
export = exports;
}
@@ -1,347 +0,0 @@
///<reference path='react-router-0.12-test.d.ts' />
///<reference path="react-router-0.12.d.ts" />
"use strict";
import React = require('react-0.12');
import Router = ReactRouter;
// Mixin
class NavigationTest<T extends Router.Navigation> {
v: T;
makePath() {
var v1: string = this.v.makePath('to');
var v2: string = this.v.makePath('to', {id: 1});
var v3: string = this.v.makePath('to', {id: 1}, {type: 'json'});
}
makeHref() {
var v1: string = this.v.makeHref('to');
var v2: string = this.v.makeHref('to', {id: 1});
var v3: string = this.v.makeHref('to', {id: 1}, {type: 'json'});
}
transitionTo() {
var v1: void = this.v.transitionTo('to');
var v2: void = this.v.transitionTo('to', {id: 1});
var v3: void = this.v.transitionTo('to', {id: 1}, {type: 'json'});
}
replaceWith() {
var v1: void = this.v.replaceWith('to');
var v2: void = this.v.replaceWith('to', {id: 1});
var v3: void = this.v.replaceWith('to', {id: 1}, {type: 'json'});
}
goBack() {
var v1: void = this.v.goBack();
}
}
class StateTest<T extends Router.State> {
v: T;
getPath() {
var v1: string = this.v.getPath();
}
getRoutes() {
var v1: Router.Route[] = this.v.getRoutes();
}
getPathname() {
var v1: string = this.v.getPathname();
}
getParams() {
var v1: {} = this.v.getParams();
}
getQuery() {
var v1: {} = this.v.getQuery();
}
isActive() {
var v1: boolean = this.v.isActive('to');
var v2: boolean = this.v.isActive('to', {id: 1});
var v3: boolean = this.v.isActive('to', {id: 1}, {type: 'json'});
}
}
class RouteHandlerMixinTest<T extends Router.RouteHandlerMixin> {
v: T;
getRouteDepth() {
var v1: number = this.v.getRouteDepth();
}
createChildRouteHandler() {
var v1: Router.RouteHandler = this.v.createChildRouteHandler({ref: 'hoge'});
}
}
// Location
class LocationTest<T extends Router.LocationBase> {
v: T;
push() {
var v1: void = this.v.push('path/to/hoge');
}
replace() {
var v1: void = this.v.replace('path/to/hoge');
}
pop() {
var v1: void = this.v.pop();
}
getCurrentPath() {
var v1: void = this.v.getCurrentPath();
}
}
new LocationTest<Router.HashLocation>();
new LocationTest<Router.HistoryLocation>();
new LocationTest<Router.RefreshLocation>();
class LocationListenerTest<T extends Router.LocationListener> {
v: T;
addChangeListener() {
var v1: void = this.v.addChangeListener(() => console.log(1));
}
removeChangeListener() {
var v1: void = this.v.removeChangeListener(() => console.log(1));
}
}
new LocationListenerTest<Router.HashLocation>();
new LocationListenerTest<Router.HistoryLocation>();
// Behavior
class ScrollBehaviorTest<T extends Router.ScrollBehaviorBase> {
v: T;
updateScrollPosition() {
var v1: void = this.v.updateScrollPosition({x: 33, y: 102}, 'scrollTop');
}
}
new ScrollBehaviorTest<Router.ImitateBrowserBehavior>();
new ScrollBehaviorTest<Router.ScrollToTopBehavior>();
// Component
class DefaultRouteTest {
v: Router.DefaultRoute;
props() {
var name: string = this.v.props.name;
var handler: React.ComponentClass<any> = this.v.props.handler;
}
createElement() {
var Handler: React.ComponentClass<any>;
React.createElement(Router.DefaultRoute, null);
React.createElement(Router.DefaultRoute, {name: 'name', handler: Handler});
}
}
class LinkTest {
v: Router.Link;
constructor() {
new NavigationTest<Router.Link>();
new StateTest<Router.Link>();
}
props() {
var activeClassName: string = this.v.props.activeClassName;
var to: string = this.v.props.to;
var params: {} = this.v.props.params;
var query: {} = this.v.props.query;
var onClick: Function = this.v.props.onClick;
}
getHref() {
var v1: string = this.v.getHref();
}
getClassName() {
var v1: string = this.v.getClassName();
}
createElement() {
React.createElement(Router.Link, null);
React.createElement(Router.Link, {to: 'home'});
React.createElement(Router.Link, {
activeClassName: 'name',
to: 'home',
params: {},
query: {},
onClick: () => console.log(1)
});
}
}
class NotFoundRouteTest {
v: Router.NotFoundRoute;
props() {
var name: string = this.v.props.name;
var handler: React.ComponentClass<any> = this.v.props.handler;
}
createElement() {
var Handler: React.ComponentClass<any>;
React.createElement(Router.NotFoundRoute, null);
React.createElement(Router.NotFoundRoute, {handler: Handler});
React.createElement(Router.NotFoundRoute, {handler: Handler, name: "home"});
}
}
class RedirectTest {
v: Router.Redirect;
props() {
var path: string = this.v.props.path;
var from: string = this.v.props.from;
var to: string = this.v.props.to;
}
createElement() {
React.createElement(Router.Redirect, null);
React.createElement(Router.Redirect, {});
React.createElement(Router.Redirect, {path: 'a', from: 'a', to: 'b'});
}
}
class RouteTest {
v: Router.Route;
props() {
var name: string = this.v.props.name;
var path: string = this.v.props.path;
var handler: React.ComponentClass<any> = this.v.props.handler;
var ignoreScrollBehavior: boolean = this.v.props.ignoreScrollBehavior;
}
createElement() {
var Handler: React.ComponentClass<any>;
React.createElement(Router.Route, null);
React.createElement(Router.Route, {});
React.createElement(Router.Route, {name: "home", path: "/", handler: Handler, ignoreScrollBehavior: true});
}
}
class RouteHandlerTest {
v: Router.RouteHandler;
constructor() {
new RouteHandlerMixinTest<Router.RouteHandler>();
}
createElement() {
React.createElement(Router.RouteHandler, null);
React.createElement(Router.RouteHandler, {});
}
}
// History
class HistoryTest {
v: Router.History;
length() {
var v1: number = this.v.length;
}
back() {
var v1: void = this.v.back();
}
}
// Router
class CreateTest {
v: Router.Router;
constructor() {
// React.createElement() version
this.v = Router.create({
routes: React.createElement(Router.Route, null)
});
this.v = Router.create({
routes: React.createElement(Router.Route, null),
location: Router.HistoryLocation,
scrollBehavior: Router.ImitateBrowserBehavior
});
// React.createFactory() version
this.v = Router.create({
routes: React.createFactory(Router.Route)()
});
this.v = Router.create({
routes: React.createFactory(Router.Route)(),
location: Router.HistoryLocation,
scrollBehavior: Router.ImitateBrowserBehavior
});
}
run() {
this.v.run((Handler) => console.log(Handler));
this.v.run((Handler, state) => console.log(Handler, state));
}
}
class RunTest {
constructor() {
// React.createElement() version
var v1: Router.Router = Router.run(React.createElement(Router.Route, null), (Handler) => {
React.render(React.createElement(Handler, null), document.body);
});
var v2: Router.Router = Router.run(React.createElement(Router.Route, null), Router.HistoryLocation, (Handler, state) => {
React.render(React.createElement(Handler, null), document.body);
});
// React.createFactory() version
var v3: Router.Router = Router.run(React.createFactory(Router.Route)(), (Handler) => {
React.render(React.createElement(Handler, null), document.body);
});
var v4: Router.Router = Router.run(React.createFactory(Router.Route)(), Router.HistoryLocation, (Handler, state) => {
React.render(React.createElement(Handler, null), document.body);
});
}
}
// Transition
class TransitionTest {
constructor() {
var v1: Router.TransitionStaticLifecycle = {
willTransitionTo: (transition, params, query, callback) => {
transition.abort();
transition.redirect('to');
transition.redirect('to', {id: 1});
transition.redirect('to', {id: 1}, {type: 'json'});
transition.retry();
},
willTransitionFrom: (transition, component, callback) => {}
};
var v2: Router.TransitionStaticLifecycle = {
willTransitionTo: (transition, params, query) => {},
willTransitionFrom: (transition, component) => {}
};
var v3: Router.TransitionStaticLifecycle = {
willTransitionTo: (transition, params) => {},
willTransitionFrom: (transition) => {}
};
var v4: Router.TransitionStaticLifecycle = {
willTransitionTo: (transition) => {},
willTransitionFrom: () => {}
};
var v5: Router.TransitionStaticLifecycle = {
willTransitionTo: () => {}
};
var v6: Router.TransitionStaticLifecycle = {
willTransitionFrom: () => {}
};
}
}
-277
View File
@@ -1,277 +0,0 @@
// Type definitions for React Router 0.12.0
// Project: https://github.com/rackt/react-router
// Definitions by: Yuichi Murata <https://github.com/mrk21>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path='../../react/legacy/react-0.12.d.ts' />
declare module ReactRouter {
//
// Mixin
// ----------------------------------------------------------------------
interface Navigation {
makePath(to: string, params?: {}, query?: {}): string;
makeHref(to: string, params?: {}, query?: {}): string;
transitionTo(to: string, params?: {}, query?: {}): void;
replaceWith(to: string, params?: {}, query?: {}): void;
goBack(): void;
}
interface RouteHandlerMixin {
getRouteDepth(): number;
createChildRouteHandler(props: {}): RouteHandler;
}
interface State {
getPath(): string;
getRoutes(): Route[];
getPathname(): string;
getParams(): {};
getQuery(): {};
isActive(to: string, params?: {}, query?: {}): boolean;
}
var Navigation: Navigation;
var State: State;
var RouteHandlerMixin: RouteHandlerMixin;
//
// Component
// ----------------------------------------------------------------------
// DefaultRoute
interface DefaultRouteProp {
name?: string;
handler: React.ComponentClass<any>;
}
interface DefaultRoute extends React.ReactElement<DefaultRouteProp> {
__react_router_default_route__: any; // dummy
}
interface DefaultRouteClass extends React.ComponentClass<DefaultRouteProp> {
__react_router_default_route__: any; // dummy
}
// Link
interface LinkProp {
activeClassName?: string;
to: string;
params?: {};
query?: {};
onClick?: Function;
}
interface Link extends React.ReactElement<LinkProp>, Navigation, State {
__react_router_link__: any; // dummy
getHref(): string;
getClassName(): string;
}
interface LinkClass extends React.ComponentClass<LinkProp> {
__react_router_link__: any; // dummy
}
// NotFoundRoute
interface NotFoundRouteProp {
name?: string;
handler: React.ComponentClass<any>;
}
interface NotFoundRoute extends React.ReactElement<NotFoundRouteProp> {
__react_router_not_found_route__: any; // dummy
}
interface NotFoundRouteClass extends React.ComponentClass<NotFoundRouteProp> {
__react_router_not_found_route__: any; // dummy
}
// Redirect
interface RedirectProp {
path?: string;
from?: string;
to?: string;
}
interface Redirect extends React.ReactElement<RedirectProp> {
__react_router_redirect__: any; // dummy
}
interface RedirectClass extends React.ComponentClass<RedirectProp> {
__react_router_redirect__: any; // dummy
}
// Route
interface RouteProp {
name?: string;
path?: string;
handler?: React.ComponentClass<any>;
ignoreScrollBehavior?: boolean;
}
interface Route extends React.ReactElement<RouteProp> {
__react_router_route__: any; // dummy
}
interface RouteClass extends React.ComponentClass<RouteProp> {
__react_router_route__: any; // dummy
}
// RouteHandler
interface RouteHandlerProp {}
interface RouteHandler extends React.ReactElement<RouteHandlerProp>, RouteHandlerMixin {
__react_router_route_handler__: any; // dummy
}
interface RouteHandlerClass extends React.ReactElement<RouteHandlerProp> {
__react_router_route_handler__: any; // dummy
}
var DefaultRoute: DefaultRouteClass;
var Link: LinkClass;
var NotFoundRoute: NotFoundRouteClass;
var Redirect: RedirectClass;
var Route: RouteClass;
var RouteHandler: RouteHandlerClass;
//
// Location
// ----------------------------------------------------------------------
interface LocationBase {
push(path: string): void;
replace(path: string): void;
pop(): void;
getCurrentPath(): void;
}
interface LocationListener {
addChangeListener(listener: Function): void;
removeChangeListener(listener: Function): void;
}
interface HashLocation extends LocationBase, LocationListener {}
interface HistoryLocation extends LocationBase, LocationListener {}
interface RefreshLocation extends LocationBase {}
var HashLocation: HashLocation;
var HistoryLocation: HistoryLocation;
var RefreshLocation: RefreshLocation;
//
// Behavior
// ----------------------------------------------------------------------
interface ScrollBehaviorBase {
updateScrollPosition(position: {x: number; y: number;}, actionType: string): void;
}
interface ImitateBrowserBehavior extends ScrollBehaviorBase {}
interface ScrollToTopBehavior extends ScrollBehaviorBase {}
var ImitateBrowserBehavior: ImitateBrowserBehavior;
var ScrollToTopBehavior: ScrollToTopBehavior;
//
// Router
// ----------------------------------------------------------------------
interface Router extends React.ReactElement<any> {
run(callback: RouterRunCallback): void;
}
interface RouterState {
path: string;
action: string;
pathname: string;
params: {};
query: {};
routes : Route[];
}
interface RouterCreateOption {
routes: React.ReactElement<RouteProp>;
location?: LocationBase;
scrollBehavior?: ScrollBehaviorBase;
}
type RouterRunCallback = (Handler: Router, state: RouterState) => void;
function create(options: RouterCreateOption): Router;
function run(routes: React.ReactElement<RouteProp>, callback: RouterRunCallback): Router;
function run(routes: React.ReactElement<RouteProp>, location: LocationBase, callback: RouterRunCallback): Router;
//
// History
// ----------------------------------------------------------------------
interface History {
back(): void;
length: number;
}
var History: History;
//
// Transition
// ----------------------------------------------------------------------
interface Transition {
abort(): void;
redirect(to: string, params?: {}, query?: {}): void;
retry(): void;
}
interface TransitionStaticLifecycle {
willTransitionTo?(
transition: Transition,
params: {},
query: {},
callback: Function
): void;
willTransitionFrom?(
transition: Transition,
component: React.ReactElement<any>,
callback: Function
): void;
}
}
declare module 'react-router' {
export = ReactRouter;
}
declare module React {
interface TopLevelAPI {
// for DefaultRoute
createElement(
type: ReactRouter.DefaultRouteClass,
props: ReactRouter.DefaultRouteProp,
...children: ReactNode[]
): ReactRouter.DefaultRoute;
// for Link
createElement(
type: ReactRouter.LinkClass,
props: ReactRouter.LinkProp,
...children: ReactNode[]
): ReactRouter.Link;
// for NotFoundRoute
createElement(
type: ReactRouter.NotFoundRouteClass,
props: ReactRouter.NotFoundRouteProp,
...children: ReactNode[]
): ReactRouter.NotFoundRoute;
// for Redirect
createElement(
type: ReactRouter.RedirectClass,
props: ReactRouter.RedirectProp,
...children: ReactNode[]
): ReactRouter.Redirect;
// for Route
createElement(
type: ReactRouter.RouteClass,
props: ReactRouter.RouteProp,
...children: ReactNode[]
): ReactRouter.Route;
// for RouteHandler
createElement(
type: ReactRouter.RouteHandlerClass,
props: ReactRouter.RouteHandlerProp,
...children: ReactNode[]
): ReactRouter.RouteHandler;
}
}
+16 -13
View File
@@ -7,6 +7,8 @@
///<reference path='../react/react-addons.d.ts' />
declare module ReactRouter {
import React = __React;
//
// Transition
// ----------------------------------------------------------------------
@@ -276,42 +278,43 @@ declare module "react-router" {
export = ReactRouter;
}
declare module React {
declare module __React {
// for DefaultRoute
function createElement(
type: ReactRouter.DefaultRouteClass,
props: ReactRouter.DefaultRouteProp,
...children: React.ReactNode[]): ReactRouter.DefaultRoute;
...children: __React.ReactNode[]): ReactRouter.DefaultRoute;
// for Link
function createElement(
type: ReactRouter.LinkClass,
props: ReactRouter.LinkProp,
...children: React.ReactNode[]): ReactRouter.Link;
...children: __React.ReactNode[]): ReactRouter.Link;
// for NotFoundRoute
function createElement(
type: ReactRouter.NotFoundRouteClass,
props: ReactRouter.NotFoundRouteProp,
...children: React.ReactNode[]): ReactRouter.NotFoundRoute;
...children: __React.ReactNode[]): ReactRouter.NotFoundRoute;
// for Redirect
function createElement(
type: ReactRouter.RedirectClass,
props: ReactRouter.RedirectProp,
...children: React.ReactNode[]): ReactRouter.Redirect;
...children: __React.ReactNode[]): ReactRouter.Redirect;
// for Route
function createElement(
type: ReactRouter.RouteClass,
props: ReactRouter.RouteProp,
...children: React.ReactNode[]): ReactRouter.Route;
...children: __React.ReactNode[]): ReactRouter.Route;
// for RouteHandler
function createElement(
type: ReactRouter.RouteHandlerClass,
props: ReactRouter.RouteHandlerProp,
...children: React.ReactNode[]): ReactRouter.RouteHandler;
...children: __React.ReactNode[]): ReactRouter.RouteHandler;
}
declare module "react/addons" {
@@ -319,35 +322,35 @@ declare module "react/addons" {
function createElement(
type: ReactRouter.DefaultRouteClass,
props: ReactRouter.DefaultRouteProp,
...children: React.ReactNode[]): ReactRouter.DefaultRoute;
...children: __React.ReactNode[]): ReactRouter.DefaultRoute;
// for Link
function createElement(
type: ReactRouter.LinkClass,
props: ReactRouter.LinkProp,
...children: React.ReactNode[]): ReactRouter.Link;
...children: __React.ReactNode[]): ReactRouter.Link;
// for NotFoundRoute
function createElement(
type: ReactRouter.NotFoundRouteClass,
props: ReactRouter.NotFoundRouteProp,
...children: React.ReactNode[]): ReactRouter.NotFoundRoute;
...children: __React.ReactNode[]): ReactRouter.NotFoundRoute;
// for Redirect
function createElement(
type: ReactRouter.RedirectClass,
props: ReactRouter.RedirectProp,
...children: React.ReactNode[]): ReactRouter.Redirect;
...children: __React.ReactNode[]): ReactRouter.Redirect;
// for Route
function createElement(
type: ReactRouter.RouteClass,
props: ReactRouter.RouteProp,
...children: React.ReactNode[]): ReactRouter.Route;
...children: __React.ReactNode[]): ReactRouter.Route;
// for RouteHandler
function createElement(
type: ReactRouter.RouteHandlerClass,
props: ReactRouter.RouteHandlerProp,
...children: React.ReactNode[]): ReactRouter.RouteHandler;
...children: __React.ReactNode[]): ReactRouter.RouteHandler;
}
-108
View File
@@ -1,108 +0,0 @@
/// <reference path="react-0.11.d.ts" />
import React = require("react-0.11");
var PropTypesSpecification: React.Specification<any, any> = {
propTypes: {
// You can declare that a prop is a specific JS primitive. By default, these
// are all optional.
optionalArray: React.PropTypes.array,
optionalBool: React.PropTypes.bool,
optionalFunc: React.PropTypes.func,
optionalNumber: React.PropTypes.number,
optionalObject: React.PropTypes.object,
optionalString: React.PropTypes.string,
// Anything that can be rendered: numbers, strings, components or an array
// containing these types.
optionalRenderable: React.PropTypes.renderable,
// A React component.
optionalComponent: React.PropTypes.component,
// You can also declare that a prop is an instance of a class. This uses
// JS's instanceof operator.
optionalMessage: React.PropTypes.instanceOf(Date),
// You can ensure that your prop is limited to specific values by treating
// it as an enum.
optionalEnum: React.PropTypes.oneOf(['News', 'Photos']),
// An object that could be one of many types
optionalUnion: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.number,
React.PropTypes.instanceOf(Date)
]),
// An array of a certain type
optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number),
// An object with property values of a certain type
optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number),
// An object taking on a particular shape
optionalObjectWithShape: React.PropTypes.shape({
color: React.PropTypes.string,
fontSize: React.PropTypes.number
}),
// You can chain any of the above with `isRequired` to make sure a warning
// is shown if the prop isn't provided.
requiredFunc: React.PropTypes.func.isRequired,
// A value of any data type
requiredAny: React.PropTypes.any.isRequired,
// You can also specify a custom validator. It should return an Error
// object if the validation fails. Don't `console.warn` or throw, as this
// won't work inside `oneOfType`.
customProp: function(props, propName, componentName) {
if (!/matchme/.test(props[propName])) {
return new Error('Validation failed!');
}
return null;
}
},
render: (): React.Descriptor<any> => {
return null;
}
};
React.createClass(PropTypesSpecification);
var mountNode: Element;
var HelloMessage = React.createClass({displayName: 'HelloMessage',
render: function() {
return React.DOM.div(null, "Hello ", (<React.Component<{name: string}, any>>this).props.name);
}
});
React.renderComponent(HelloMessage({name: "John"}), mountNode);
var Timer = React.createClass({displayName: 'Timer',
getInitialState: function() {
return {secondsElapsed: 0};
},
tick: function() {
(<React.Component<any, {secondsElapsed: number}>>this).setState({
secondsElapsed: (<React.Component<any, {secondsElapsed: number}>>this).state.secondsElapsed + 1
});
},
componentDidMount: function() {
this.interval = setInterval(this.tick, 1000);
},
componentWillUnmount: function() {
clearInterval(this.interval);
},
render: function() {
return React.DOM.div(
null,
"Seconds Elapsed: ",
(<React.Component<any, {secondsElapsed: number}>>this).state.secondsElapsed
);
}
});
React.renderComponent(Timer(null), mountNode);
-553
View File
@@ -1,553 +0,0 @@
// Type definitions for React 0.11.2
// Project: http://facebook.github.io/react/
// Definitions by: Asana <https://asana.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "react-0.11" {
export = React;
}
declare module React {
export function createClass<P, S>(specification: Specification<P, S>): Factory<P>;
export function renderComponent<P>(component: Descriptor<P>, container: Element, callback?: () => void): Descriptor<P>;
export function unmountComponentAtNode(container: Element): boolean;
export function renderComponentToString(component: Descriptor<any>): string;
export function renderComponentToStaticMarkup(component: Descriptor<any>): string;
export function isValidClass(factory: Factory<any>): boolean;
export function isValidComponent(component: Descriptor<any>): boolean;
export function initializeTouchEvents(shouldUseTouch: boolean): void;
export interface Descriptor<P> {
props: P;
}
export interface Factory<P> {
(properties?: P, ...children: any[]): Descriptor<P>;
}
export interface Mixin<P, S> {
componentWillMount?(): void;
componentDidMount?(): void;
componentWillReceiveProps?(nextProps: P): void;
shouldComponentUpdate?(nextProps: P, nextState: S): boolean;
componentWillUpdate?(nextProps: P, nextState: S): void;
componentDidUpdate?(prevProps: P, prevState: S): void;
componentWillUnmount?(): void;
}
export interface Specification<P, S> extends Mixin<P, S> {
displayName?: string;
mixins?: Mixin<P, S>[];
statics?: {
[key: string]: Function;
};
propTypes?: ValidationMap<P>;
getDefaultProps?(): P;
getInitialState?(): S;
render(): Descriptor<any>;
}
export interface DomReferencer {
getDOMNode(): Element;
}
export interface Component<P, S> extends DomReferencer {
refs: {
[key: string]: DomReferencer
};
props: P;
state: S;
setState(nextState: S, callback?: () => void): void;
replaceState(nextState: S, callback?: () => void): void;
forceUpdate(callback?: () => void): void;
isMounted(): boolean;
transferPropsTo(target: Factory<P>): Descriptor<P>;
setProps(nextProps: P, callback?: () => void): void;
replaceProps(nextProps: P, callback?: () => void): void;
}
export interface Constructable {
new(): any;
}
export interface Validator<P> {
(props: P, propName: string, componentName: string): Error;
}
export interface Requireable<P> extends Validator<P> {
isRequired: Validator<P>;
}
export interface ValidationMap<P> {
[key: string]: Validator<P>;
}
export var PropTypes: {
any: Requireable<any>;
array: Requireable<any>;
bool: Requireable<any>;
func: Requireable<any>;
number: Requireable<any>;
object: Requireable<any>;
string: Requireable<any>;
renderable: Requireable<any>;
component: Requireable<any>;
instanceOf: (clazz: Constructable) => Requireable<any>;
oneOf: (types: any[]) => Requireable<any>
oneOfType: (types: Validator<any>[]) => Requireable<any>;
arrayOf: (type: Validator<any>) => Requireable<any>;
objectOf: (type: Validator<any>) => Requireable<any>;
shape: (type: ValidationMap<any>) => Requireable<any>;
};
export var Children: {
map(children: any[], fn: (child: any) => any): any[];
forEach(children: any[], fn: (child: any) => any): void;
count(children: any[]): number;
only(children: any[]): any;
};
// Browser Interfaces
// Taken from https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts
export interface AbstractView {
styleMedia: StyleMedia;
document: Document;
}
export interface Touch {
identifier: number;
target: EventTarget;
screenX: number;
screenY: number;
clientX: number;
clientY: number;
pageX: number;
pageY: number;
}
export interface TouchList {
[index: number]: Touch;
length: number;
item(index: number): Touch;
identifiedTouch(identifier: number): Touch;
}
// Events
export interface SyntheticEvent {
bubbles: boolean;
cancelable: boolean;
currentTarget: EventTarget;
defaultPrevented: boolean;
eventPhase: number;
nativeEvent: Event;
preventDefault(): void;
stopPropagation(): void;
target: EventTarget;
timeStamp: Date;
type: string;
}
export interface ClipboardEvent extends SyntheticEvent {
clipboardData: DataTransfer;
}
export interface KeyboardEvent extends SyntheticEvent {
altKey: boolean;
charCode: number;
ctrlKey: boolean;
getModifierState(key: string): boolean;
key: string;
keyCode: number;
locale: string;
location: number;
metaKey: boolean;
repeat: boolean;
shiftKey: boolean;
which: number;
}
export interface FocusEvent extends SyntheticEvent {
relatedTarget: EventTarget;
}
export interface MouseEvent extends SyntheticEvent {
altKey: boolean;
button: number;
buttons: number;
clientX: number;
clientY: number;
ctrlKey: boolean;
getModifierState(key: string): boolean;
metaKey: boolean;
pageX: number;
pageY: number;
relatedTarget: EventTarget;
screenX: number;
screenY: number;
shiftKey: boolean;
}
export interface TouchEvent extends SyntheticEvent {
altKey: boolean;
changedTouches: TouchList;
ctrlKey: boolean;
getModifierState(key: string): boolean;
metaKey: boolean;
shiftKey: boolean;
targetTouches: TouchList;
touches: TouchList;
}
export interface UiEvent extends SyntheticEvent {
detail: number;
view: AbstractView;
}
export interface WheelEvent extends SyntheticEvent {
deltaMode: number;
deltaX: number;
deltaY: number;
deltaZ: number;
}
// Attributes
export interface EventAttributes {
onCopy?: (event: ClipboardEvent) => void;
onCut?: (event: ClipboardEvent) => void;
onPaste?: (event: ClipboardEvent) => void;
onKeyDown?: (event: KeyboardEvent) => void;
onKeyPress?: (event: KeyboardEvent) => void;
onKeyUp?: (event: KeyboardEvent) => void;
onFocus?: (event: FocusEvent) => void;
onBlur?: (event: FocusEvent) => void;
onChange?: (event: SyntheticEvent) => void;
onInput?: (event: SyntheticEvent) => void;
onSubmit?: (event: SyntheticEvent) => void;
onClick?: (event: MouseEvent) => void;
onDoubleClick?: (event: MouseEvent) => void;
onDrag?: (event: MouseEvent) => void;
onDragEnd?: (event: MouseEvent) => void;
onDragEnter?: (event: MouseEvent) => void;
onDragExit?: (event: MouseEvent) => void;
onDragLeave?: (event: MouseEvent) => void;
onDragOver?: (event: MouseEvent) => void;
onDragStart?: (event: MouseEvent) => void;
onDrop?: (event: MouseEvent) => void;
onMouseDown?: (event: MouseEvent) => void;
onMouseEnter?: (event: MouseEvent) => void;
onMouseLeave?: (event: MouseEvent) => void;
onMouseMove?: (event: MouseEvent) => void;
onMouseOut?: (event: MouseEvent) => void;
onMouseOver?: (event: MouseEvent) => void;
onMouseUp?: (event: MouseEvent) => void;
onTouchCancel?: (event: TouchEvent) => void;
onTouchEnd?: (event: TouchEvent) => void;
onTouchMove?: (event: TouchEvent) => void;
onTouchStart?: (event: TouchEvent) => void;
onScroll?: (event: UiEvent) => void;
onWheel?: (event: WheelEvent) => void;
}
export interface ReactAttributes {
dangerouslySetInnerHTML?: {
__html: string;
};
children?: any[];
key?: string;
ref?: string;
}
export interface DomAttributes extends EventAttributes, ReactAttributes {
// HTML Attributes
accept?: any;
accessKey?: any;
action?: any;
allowFullScreen?: any;
allowTransparency?: any;
alt?: any;
async?: any;
autoCapitalize?: any;
autoComplete?: any;
autoCorrect?: any;
autoFocus?: any;
autoPlay?: any;
cellPadding?: any;
cellSpacing?: any;
charSet?: any;
checked?: any;
className?: any;
cols?: any;
colSpan?: any;
content?: any;
contentEditable?: any;
contextMenu?: any;
controls?: any;
coords?: any;
crossOrigin?: any;
data?: any;
dateTime?: any;
defer?: any;
dir?: any;
disabled?: any;
download?: any;
draggable?: any;
encType?: any;
form?: any;
formNoValidate?: any;
frameBorder?: any;
height?: any;
hidden?: any;
href?: any;
hrefLang?: any;
htmlFor?: any;
httpEquiv?: any;
icon?: any;
id?: any;
itemProp?: any;
itemScope?: any;
itemType?: any;
label?: any;
lang?: any;
list?: any;
loop?: any;
max?: any;
maxLength?: any;
mediaGroup?: any;
method?: any;
min?: any;
multiple?: any;
muted?: any;
name?: any;
noValidate?: any;
open?: any;
pattern?: any;
placeholder?: any;
poster?: any;
preload?: any;
property?: any;
radioGroup?: any;
readOnly?: any;
rel?: any;
required?: any;
role?: any;
rows?: any;
rowSpan?: any;
sandbox?: any;
scope?: any;
scrollLeft?: any;
scrolling?: any;
scrollTop?: any;
seamless?: any;
selected?: any;
shape?: any;
size?: any;
span?: any;
spellCheck?: any;
src?: any;
srcDoc?: any;
srcSet?: any;
start?: any;
step?: any;
style?: any;
tabIndex?: any;
target?: any;
title?: any;
type?: any;
useMap?: any;
value?: any;
width?: any;
wmode?: any;
}
export interface SvgAttributes extends EventAttributes, ReactAttributes {
cx?: any;
cy?: any;
d?: any;
dx?: any;
dy?: any;
fill?: any;
fillOpacity?: any;
fontFamily?: any;
fontSize?: any;
fx?: any;
fy?: any;
gradientTransform?: any;
gradientUnits?: any;
markerEnd?: any;
markerMid?: any;
markerStart?: any;
offset?: any;
opacity?: any;
patternContentUnits?: any;
patternUnits?: any;
points?: any;
preserveAspectRatio?: any;
r?: any;
rx?: any;
ry?: any;
spreadMethod?: any;
stopColor?: any;
stopOpacity?: any;
stroke?: any;
strokeDasharray?: any;
strokeLinecap?: any;
strokeOpacity?: any;
strokeWidth?: any;
textAnchor?: any;
transform?: any;
version?: any;
viewBox?: any;
x1?: any;
x2?: any;
x?: any;
y1?: any;
y2?: any;
y?: any;
}
export interface DomElement extends Factory<DomAttributes> {
}
export interface SvgElement extends Factory<SvgAttributes> {
}
export var DOM: {
// HTML
a: DomElement;
abbr: DomElement;
address: DomElement;
area: DomElement;
article: DomElement;
aside: DomElement;
audio: DomElement;
b: DomElement;
base: DomElement;
bdi: DomElement;
bdo: DomElement;
big: DomElement;
blockquote: DomElement;
body: DomElement;
br: DomElement;
button: DomElement;
canvas: DomElement;
caption: DomElement;
cite: DomElement;
code: DomElement;
col: DomElement;
colgroup: DomElement;
data: DomElement;
datalist: DomElement;
dd: DomElement;
del: DomElement;
details: DomElement;
dfn: DomElement;
dialog: DomElement;
div: DomElement;
dl: DomElement;
dt: DomElement;
em: DomElement;
embed: DomElement;
fieldset: DomElement;
figcaption: DomElement;
figure: DomElement;
footer: DomElement;
form: DomElement;
h1: DomElement;
h2: DomElement;
h3: DomElement;
h4: DomElement;
h5: DomElement;
h6: DomElement;
head: DomElement;
header: DomElement;
hr: DomElement;
html: DomElement;
i: DomElement;
iframe: DomElement;
img: DomElement;
input: DomElement;
ins: DomElement;
kbd: DomElement;
keygen: DomElement;
label: DomElement;
legend: DomElement;
li: DomElement;
link: DomElement;
main: DomElement;
map: DomElement;
mark: DomElement;
menu: DomElement;
menuitem: DomElement;
meta: DomElement;
meter: DomElement;
nav: DomElement;
noscript: DomElement;
object: DomElement;
ol: DomElement;
optgroup: DomElement;
option: DomElement;
output: DomElement;
p: DomElement;
param: DomElement;
pre: DomElement;
progress: DomElement;
q: DomElement;
rp: DomElement;
rt: DomElement;
ruby: DomElement;
s: DomElement;
samp: DomElement;
script: DomElement;
section: DomElement;
select: DomElement;
small: DomElement;
source: DomElement;
span: DomElement;
strong: DomElement;
style: DomElement;
sub: DomElement;
summary: DomElement;
sup: DomElement;
table: DomElement;
tbody: DomElement;
td: DomElement;
textarea: DomElement;
tfoot: DomElement;
th: DomElement;
thead: DomElement;
time: DomElement;
title: DomElement;
tr: DomElement;
track: DomElement;
u: DomElement;
ul: DomElement;
"var": DomElement;
video: DomElement;
wbr: DomElement;
// SVG
circle: SvgElement;
defs: SvgElement;
ellipse: SvgElement;
g: SvgElement;
line: SvgElement;
linearGradient: SvgElement;
mask: SvgElement;
path: SvgElement;
pattern: SvgElement;
polygon: SvgElement;
polyline: SvgElement;
radialGradient: SvgElement;
rect: SvgElement;
stop: SvgElement;
svg: SvgElement;
text: SvgElement;
tspan: SvgElement;
};
}
-235
View File
@@ -1,235 +0,0 @@
/// <reference path="react-0.12.d.ts" />
import React = require("react");
interface Props {
hello: string;
world?: string;
foo: number;
bar: boolean;
}
interface State {
inputValue?: string;
seconds?: number;
}
interface MyComponent extends React.CompositeComponent<Props, State> {
reset(): void;
}
var props: Props = {
key: 42,
ref: "myComponent42",
hello: "world",
foo: 42,
bar: true
};
var container: Element;
var INPUT_REF: string = "input";
//
// Top-Level API
// --------------------------------------------------------------------------
var reactClass: React.ComponentClass<Props> = React.createClass<Props>({
getDefaultProps: () => {
return <Props>{
hello: undefined,
world: "peace",
foo: undefined,
bar: undefined
};
},
getInitialState: () => {
return {
inputValue: "React.js",
seconds: 0
};
},
reset: () => {
this.replaceState(this.getInitialState());
},
render: () => {
return React.DOM.div(null,
React.DOM.input({
ref: INPUT_REF,
value: this.state.inputValue
}));
}
});
var reactElement: React.ReactElement<Props> =
React.createElement<Props>(reactClass, props);
var reactFactory: React.ComponentFactory<Props> =
React.createFactory<Props>(reactClass);
var component: React.Component<Props> =
React.render<Props>(reactElement, container);
var unmounted: boolean = React.unmountComponentAtNode(container);
var str: string = React.renderToString(reactElement);
var markup: string = React.renderToStaticMarkup(reactElement);
var notValid: boolean = React.isValidElement(props); // false
var isValid = React.isValidElement(reactElement); // true
React.initializeTouchEvents(true);
//
// React Elements
// --------------------------------------------------------------------------
var type = reactElement.type;
var elementProps: Props = reactElement.props;
var key = reactElement.key;
var ref: string = reactElement.ref;
var factoryElement: React.ReactElement<Props> = reactFactory(elementProps);
//
// React Components
// --------------------------------------------------------------------------
var displayName: string = reactClass.displayName;
var defaultProps: Props = reactClass.getDefaultProps();
var propTypes: React.ValidationMap<Props> = reactClass.propTypes;
//
// Component API
// --------------------------------------------------------------------------
var htmlElement: Element = component.getDOMNode();
var divElement: HTMLDivElement = component.getDOMNode<HTMLDivElement>();
var isMounted: boolean = component.isMounted();
component.setProps(elementProps);
component.replaceProps(props);
var compComponent: React.CompositeComponent<Props, State> =
<React.CompositeComponent<Props, State>>component;
var initialState: State = compComponent.state;
compComponent.setState({ inputValue: "!!!" });
compComponent.replaceState({ inputValue: "???", seconds: 60 });
compComponent.forceUpdate();
var inputRef: React.HTMLComponent =
<React.HTMLComponent>compComponent.refs[INPUT_REF];
var value: string = inputRef.getDOMNode<HTMLInputElement>().value;
var myComponent = <MyComponent>compComponent;
myComponent.reset();
//
// Attributes
// --------------------------------------------------------------------------
var children = ["Hello world", [null], React.DOM.span(null)];
var divStyle = { // CSSProperties
flex: "1 1 main-size",
backgroundImage: "url('hello.png')"
};
var htmlAttr: React.HTMLAttributes = {
key: 36,
ref: "htmlComponent",
children: children,
className: "test-attr",
style: divStyle,
onClick: (event: React.MouseEvent) => {
event.preventDefault();
event.stopPropagation();
},
dangerouslySetInnerHTML: {
__html: "<strong>STRONG</strong>"
}
};
React.DOM.div(htmlAttr);
React.DOM.span(htmlAttr);
React.DOM.input(htmlAttr);
//
// React.PropTypes
// --------------------------------------------------------------------------
var PropTypesSpecification: React.ComponentSpec<any, any> = {
propTypes: {
optionalArray: React.PropTypes.array,
optionalBool: React.PropTypes.bool,
optionalFunc: React.PropTypes.func,
optionalNumber: React.PropTypes.number,
optionalObject: React.PropTypes.object,
optionalString: React.PropTypes.string,
optionalNode: React.PropTypes.node,
optionalElement: React.PropTypes.element,
optionalMessage: React.PropTypes.instanceOf(Date),
optionalEnum: React.PropTypes.oneOf(["News", "Photos"]),
optionalUnion: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.number,
React.PropTypes.instanceOf(Date)
]),
optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number),
optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number),
optionalObjectWithShape: React.PropTypes.shape({
color: React.PropTypes.string,
fontSize: React.PropTypes.number
}),
requiredFunc: React.PropTypes.func.isRequired,
requiredAny: React.PropTypes.any.isRequired,
customProp: function(props: any, propName: string, componentName: string) {
if (!/matchme/.test(props[propName])) {
return new Error("Validation failed!");
}
return null;
}
},
render: (): React.ReactHTMLElement => {
return null;
}
};
//
// React.Children
// --------------------------------------------------------------------------
var childMap: { [key: string]: number } =
React.Children.map<number>(children, (child) => { return 42; });
React.Children.forEach(children, (child) => {});
var nChildren: number = React.Children.count(children);
var onlyChild = React.Children.only([null, [[["Hallo"], true]], false]);
//
// Example from http://facebook.github.io/react/
// --------------------------------------------------------------------------
interface TimerState {
secondsElapsed: number;
}
interface Timer extends React.CompositeComponent<{}, TimerState> {
}
var Timer = React.createClass({
displayName: "Timer",
getInitialState: () => {
return { secondsElapsed: 0 };
},
tick: () => {
var me = <Timer>this;
me.setState({
secondsElapsed: me.state.secondsElapsed + 1
});
},
componentDidMount: () => {
this.interval = setInterval(this.tick, 1000);
},
componentWillUnmount: () => {
clearInterval(this.interval);
},
render: () => {
var me = <Timer>this;
return React.DOM.div(
null,
"Seconds Elapsed: ",
me.state.secondsElapsed
);
}
});
var mountNode: Element;
React.render(React.createElement(Timer, null), mountNode);
-934
View File
@@ -1,934 +0,0 @@
// Type definitions for React 0.12.1
// Project: http://facebook.github.io/react/
// Definitions by: Asana <https://asana.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module React {
//
// React Elements
// ----------------------------------------------------------------------
type ReactType = ComponentClass<any> | string;
interface ReactElement<P> {
type: ComponentClass<P> | string;
props: P;
key: number | string;
ref: string;
}
interface ReactHTMLElement extends ReactElement<HTMLAttributes> {}
interface ReactSVGElement extends ReactElement<SVGAttributes> {}
//
// React Nodes
// http://facebook.github.io/react/docs/glossary.html
// ----------------------------------------------------------------------
type ReactText = string | number;
type ReactChild = ReactElement<any> | ReactText;
// Should be Array<ReactNode> but type aliases cannot be recursive
type ReactFragment = Array<ReactChild | any[] | boolean>;
type ReactNode = ReactChild | ReactFragment | boolean;
//
// React Components
// ----------------------------------------------------------------------
interface ComponentStatics<P> {
displayName?: string;
getDefaultProps?(): P;
propTypes?: ValidationMap<P>;
}
interface ComponentClass<P> extends ComponentStatics<P> {
// Deprecated in 0.12. See http://fb.me/react-legacyfactory
// new(props: P): ReactElement<P>;
// (props: P): ReactElement<P>;
}
//
// ReactElement Factories
// ----------------------------------------------------------------------
interface ComponentFactory<P> {
(props?: P, ...children: ReactNode[]): ReactElement<P>;
}
interface HTMLFactory extends ComponentFactory<HTMLAttributes> {}
interface SVGFactory extends ComponentFactory<SVGAttributes> {}
//
// Top-Level API
// ----------------------------------------------------------------------
interface TopLevelAPI {
createClass<P>(spec: ComponentSpec<P, any>): ComponentClass<P>;
createElement<P>(type: ComponentClass<P> | string, props: P, ...children: ReactNode[]): ReactElement<P>;
createFactory<P>(componentClass: ComponentClass<P>): ComponentFactory<P>;
render<P>(element: ReactElement<P>, container: Element, callback?: () => any): Component<P>;
unmountComponentAtNode(container: Element): boolean;
renderToString(element: ReactElement<any>): string;
renderToStaticMarkup(element: ReactElement<any>): string;
isValidElement(object: {}): boolean;
initializeTouchEvents(shouldUseTouch: boolean): void;
}
//
// Component API
// ----------------------------------------------------------------------
interface Component<P> {
// Use this overload to cast the returned element to a more specific type.
// Eg: var name = this.refs['name'].getDOMNode<HTMLInputElement>().value;
getDOMNode<TElement extends Element>(): TElement;
getDOMNode(): Element;
isMounted(): boolean;
props: P;
setProps(nextProps: P, callback?: () => any): void;
replaceProps(nextProps: P, callback?: () => any): void;
}
interface DOMComponent<P> extends Component<P> {
tagName: string;
}
interface HTMLComponent extends DOMComponent<HTMLAttributes> {}
interface SVGComponent extends DOMComponent<SVGAttributes> {}
interface CompositeComponent<P, S> extends Component<P>, ComponentSpec<P, S> {
state: S;
setState(nextState: S, callback?: () => any): void;
replaceState(nextState: S, callback?: () => any): void;
forceUpdate(callback?: () => any): void;
refs: {
[key: string]: Component<any>
};
}
//
// Component Specs and Lifecycle
// ----------------------------------------------------------------------
interface Mixin<P, S> extends ComponentStatics<P> {
mixins?: Mixin<P, S>;
statics?: {
[key: string]: any;
};
// Definition methods
getInitialState?(): S;
// Delegate methods
componentWillMount?(): void;
componentDidMount?(): void;
componentWillReceiveProps?(nextProps: P): void;
shouldComponentUpdate?(nextProps: P, nextState: S): boolean;
componentWillUpdate?(nextProps: P, nextState: S): void;
componentDidUpdate?(prevProps: P, prevState: S): void;
componentWillUnmount?(): void;
}
interface ComponentSpec<P, S> extends Mixin<P, S> {
render(): ReactElement<any>;
}
//
// Event System
// ----------------------------------------------------------------------
interface SyntheticEvent {
bubbles: boolean;
cancelable: boolean;
currentTarget: EventTarget;
defaultPrevented: boolean;
eventPhase: number;
isTrusted: boolean;
nativeEvent: Event;
preventDefault(): void;
stopPropagation(): void;
target: EventTarget;
timeStamp: Date;
type: string;
}
interface ClipboardEvent extends SyntheticEvent {
clipboardData: DataTransfer;
}
interface KeyboardEvent extends SyntheticEvent {
altKey: boolean;
charCode: number;
ctrlKey: boolean;
getModifierState(key: string): boolean;
key: string;
keyCode: number;
locale: string;
location: number;
metaKey: boolean;
repeat: boolean;
shiftKey: boolean;
which: number;
}
interface FocusEvent extends SyntheticEvent {
relatedTarget: EventTarget;
}
interface FormEvent extends SyntheticEvent {
}
interface MouseEvent extends SyntheticEvent {
altKey: boolean;
button: number;
buttons: number;
clientX: number;
clientY: number;
ctrlKey: boolean;
getModifierState(key: string): boolean;
metaKey: boolean;
pageX: number;
pageY: number;
relatedTarget: EventTarget;
screenX: number;
screenY: number;
shiftKey: boolean;
}
interface TouchEvent extends SyntheticEvent {
altKey: boolean;
changedTouches: TouchList;
ctrlKey: boolean;
getModifierState(key: string): boolean;
metaKey: boolean;
shiftKey: boolean;
targetTouches: TouchList;
touches: TouchList;
}
interface UIEvent extends SyntheticEvent {
detail: number;
view: AbstractView;
}
interface WheelEvent extends SyntheticEvent {
deltaMode: number;
deltaX: number;
deltaY: number;
deltaZ: number;
}
//
// Event Handler Types
// ----------------------------------------------------------------------
interface EventHandler<E extends SyntheticEvent> {
(event: E): void;
}
interface ClipboardEventHandler extends EventHandler<ClipboardEvent> {}
interface KeyboardEventHandler extends EventHandler<KeyboardEvent> {}
interface FocusEventHandler extends EventHandler<FocusEvent> {}
interface FormEventHandler extends EventHandler<FormEvent> {}
interface MouseEventHandler extends EventHandler<MouseEvent> {}
interface TouchEventHandler extends EventHandler<TouchEvent> {}
interface UIEventHandler extends EventHandler<UIEvent> {}
interface WheelEventHandler extends EventHandler<WheelEvent> {}
//
// Attributes
// ----------------------------------------------------------------------
export interface ReactAttributes {
children?: ReactNode;
key?: number | string;
ref?: string;
// Event Attributes
onCopy?: ClipboardEventHandler;
onCut?: ClipboardEventHandler;
onPaste?: ClipboardEventHandler;
onKeyDown?: KeyboardEventHandler;
onKeyPress?: KeyboardEventHandler;
onKeyUp?: KeyboardEventHandler;
onFocus?: FocusEventHandler;
onBlur?: FocusEventHandler;
onChange?: FormEventHandler;
onInput?: FormEventHandler;
onSubmit?: FormEventHandler;
onClick?: MouseEventHandler;
onDoubleClick?: MouseEventHandler;
onDrag?: MouseEventHandler;
onDragEnd?: MouseEventHandler;
onDragEnter?: MouseEventHandler;
onDragExit?: MouseEventHandler;
onDragLeave?: MouseEventHandler;
onDragOver?: MouseEventHandler;
onDragStart?: MouseEventHandler;
onDrop?: MouseEventHandler;
onMouseDown?: MouseEventHandler;
onMouseEnter?: MouseEventHandler;
onMouseLeave?: MouseEventHandler;
onMouseMove?: MouseEventHandler;
onMouseOut?: MouseEventHandler;
onMouseOver?: MouseEventHandler;
onMouseUp?: MouseEventHandler;
onTouchCancel?: TouchEventHandler;
onTouchEnd?: TouchEventHandler;
onTouchMove?: TouchEventHandler;
onTouchStart?: TouchEventHandler;
onScroll?: UIEventHandler;
onWheel?: WheelEventHandler;
dangerouslySetInnerHTML?: {
__html: string;
};
}
interface CSSProperties {
columnCount?: number;
flex?: number | string;
flexGrow?: number;
flexShrink?: number;
fontWeight?: number;
lineClamp?: number;
lineHeight?: number;
opacity?: number;
order?: number;
orphans?: number;
widows?: number;
zIndex?: number;
zoom?: number;
// SVG-related properties
fillOpacity?: number;
strokeOpacity?: number;
}
interface HTMLAttributes extends ReactAttributes {
accept?: string;
acceptCharset?: string;
accessKey?: string;
action?: string;
allowFullScreen?: boolean;
allowTransparency?: boolean;
alt?: string;
async?: boolean;
autoComplete?: boolean;
autoFocus?: boolean;
autoPlay?: boolean;
cellPadding?: number | string;
cellSpacing?: number | string;
charSet?: string;
checked?: boolean;
classID?: string;
className?: string;
cols?: number;
colSpan?: number;
content?: string;
contentEditable?: boolean;
contextMenu?: string;
controls?: any;
coords?: string;
crossOrigin?: string;
data?: string;
dateTime?: string;
defer?: boolean;
dir?: string;
disabled?: boolean;
download?: any;
draggable?: boolean;
encType?: string;
form?: string;
formNoValidate?: boolean;
frameBorder?: number | string;
height?: number | string;
hidden?: boolean;
href?: string;
hrefLang?: string;
htmlFor?: string;
httpEquiv?: string;
icon?: string;
id?: string;
label?: string;
lang?: string;
list?: string;
loop?: boolean;
manifest?: string;
max?: number | string;
maxLength?: number;
media?: string;
mediaGroup?: string;
method?: string;
min?: number | string;
multiple?: boolean;
muted?: boolean;
name?: string;
noValidate?: boolean;
open?: boolean;
pattern?: string;
placeholder?: string;
poster?: string;
preload?: string;
radioGroup?: string;
readOnly?: boolean;
rel?: string;
required?: boolean;
role?: string;
rows?: number;
rowSpan?: number;
sandbox?: string;
scope?: string;
scrollLeft?: number;
scrolling?: string;
scrollTop?: number;
seamless?: boolean;
selected?: boolean;
shape?: string;
size?: number;
sizes?: string;
span?: number;
spellCheck?: boolean;
src?: string;
srcDoc?: string;
srcSet?: string;
start?: number;
step?: number | string;
style?: CSSProperties;
tabIndex?: number;
target?: string;
title?: string;
type?: string;
useMap?: string;
value?: string;
width?: number | string;
wmode?: string;
// Non-standard Attributes
autoCapitalize?: boolean;
autoCorrect?: boolean;
property?: string;
itemProp?: string;
itemScope?: boolean;
itemType?: string;
}
interface SVGAttributes extends ReactAttributes {
cx?: SVGLength | SVGAnimatedLength;
cy?: any;
d?: string;
dx?: SVGLength | SVGAnimatedLength;
dy?: SVGLength | SVGAnimatedLength;
fill?: any; // SVGPaint | string
fillOpacity?: number | string;
fontFamily?: string;
fontSize?: number | string;
fx?: SVGLength | SVGAnimatedLength;
fy?: SVGLength | SVGAnimatedLength;
gradientTransform?: SVGTransformList | SVGAnimatedTransformList;
gradientUnits?: string;
markerEnd?: string;
markerMid?: string;
markerStart?: string;
offset?: number | string;
opacity?: number | string;
patternContentUnits?: string;
patternUnits?: string;
points?: string;
preserveAspectRatio?: string;
r?: SVGLength | SVGAnimatedLength;
rx?: SVGLength | SVGAnimatedLength;
ry?: SVGLength | SVGAnimatedLength;
spreadMethod?: string;
stopColor?: any; // SVGColor | string
stopOpacity?: number | string;
stroke?: any; // SVGPaint
strokeDasharray?: string;
strokeLinecap?: string;
strokeOpacity?: number | string;
strokeWidth?: SVGLength | SVGAnimatedLength;
textAnchor?: string;
transform?: SVGTransformList | SVGAnimatedTransformList;
version?: string;
viewBox?: string;
x1?: SVGLength | SVGAnimatedLength;
x2?: SVGLength | SVGAnimatedLength;
x?: SVGLength | SVGAnimatedLength;
y1?: SVGLength | SVGAnimatedLength;
y2?: SVGLength | SVGAnimatedLength
y?: SVGLength | SVGAnimatedLength;
}
//
// React.DOM
// ----------------------------------------------------------------------
interface ReactDOM {
// HTML
a: HTMLFactory;
abbr: HTMLFactory;
address: HTMLFactory;
area: HTMLFactory;
article: HTMLFactory;
aside: HTMLFactory;
audio: HTMLFactory;
b: HTMLFactory;
base: HTMLFactory;
bdi: HTMLFactory;
bdo: HTMLFactory;
big: HTMLFactory;
blockquote: HTMLFactory;
body: HTMLFactory;
br: HTMLFactory;
button: HTMLFactory;
canvas: HTMLFactory;
caption: HTMLFactory;
cite: HTMLFactory;
code: HTMLFactory;
col: HTMLFactory;
colgroup: HTMLFactory;
data: HTMLFactory;
datalist: HTMLFactory;
dd: HTMLFactory;
del: HTMLFactory;
details: HTMLFactory;
dfn: HTMLFactory;
dialog: HTMLFactory;
div: HTMLFactory;
dl: HTMLFactory;
dt: HTMLFactory;
em: HTMLFactory;
embed: HTMLFactory;
fieldset: HTMLFactory;
figcaption: HTMLFactory;
figure: HTMLFactory;
footer: HTMLFactory;
form: HTMLFactory;
h1: HTMLFactory;
h2: HTMLFactory;
h3: HTMLFactory;
h4: HTMLFactory;
h5: HTMLFactory;
h6: HTMLFactory;
head: HTMLFactory;
header: HTMLFactory;
hr: HTMLFactory;
html: HTMLFactory;
i: HTMLFactory;
iframe: HTMLFactory;
img: HTMLFactory;
input: HTMLFactory;
ins: HTMLFactory;
kbd: HTMLFactory;
keygen: HTMLFactory;
label: HTMLFactory;
legend: HTMLFactory;
li: HTMLFactory;
link: HTMLFactory;
main: HTMLFactory;
map: HTMLFactory;
mark: HTMLFactory;
menu: HTMLFactory;
menuitem: HTMLFactory;
meta: HTMLFactory;
meter: HTMLFactory;
nav: HTMLFactory;
noscript: HTMLFactory;
object: HTMLFactory;
ol: HTMLFactory;
optgroup: HTMLFactory;
option: HTMLFactory;
output: HTMLFactory;
p: HTMLFactory;
param: HTMLFactory;
picture: HTMLFactory;
pre: HTMLFactory;
progress: HTMLFactory;
q: HTMLFactory;
rp: HTMLFactory;
rt: HTMLFactory;
ruby: HTMLFactory;
s: HTMLFactory;
samp: HTMLFactory;
script: HTMLFactory;
section: HTMLFactory;
select: HTMLFactory;
small: HTMLFactory;
source: HTMLFactory;
span: HTMLFactory;
strong: HTMLFactory;
style: HTMLFactory;
sub: HTMLFactory;
summary: HTMLFactory;
sup: HTMLFactory;
table: HTMLFactory;
tbody: HTMLFactory;
td: HTMLFactory;
textarea: HTMLFactory;
tfoot: HTMLFactory;
th: HTMLFactory;
thead: HTMLFactory;
time: HTMLFactory;
title: HTMLFactory;
tr: HTMLFactory;
track: HTMLFactory;
u: HTMLFactory;
ul: HTMLFactory;
"var": HTMLFactory;
video: HTMLFactory;
wbr: HTMLFactory;
// SVG
circle: SVGFactory;
defs: SVGFactory;
ellipse: SVGFactory;
g: SVGFactory;
line: SVGFactory;
linearGradient: SVGFactory;
mask: SVGFactory;
path: SVGFactory;
pattern: SVGFactory;
polygon: SVGFactory;
polyline: SVGFactory;
radialGradient: SVGFactory;
rect: SVGFactory;
stop: SVGFactory;
svg: SVGFactory;
text: SVGFactory;
tspan: SVGFactory;
}
//
// React.PropTypes
// ----------------------------------------------------------------------
interface Validator<T> {
(object: T, key: string, componentName: string): Error;
}
interface Requireable<T> extends Validator<T> {
isRequired: Validator<T>;
}
interface ValidationMap<T> {
[key: string]: Validator<T>;
}
interface ReactPropTypes {
any: Requireable<any>;
array: Requireable<any>;
bool: Requireable<any>;
func: Requireable<any>;
number: Requireable<any>;
object: Requireable<any>;
string: Requireable<any>;
node: Requireable<any>;
element: Requireable<any>;
instanceOf(expectedClass: {}): Requireable<any>;
oneOf(types: any[]): Requireable<any>;
oneOfType(types: Validator<any>[]): Requireable<any>;
arrayOf(type: Validator<any>): Requireable<any>;
objectOf(type: Validator<any>): Requireable<any>;
shape(type: ValidationMap<any>): Requireable<any>;
}
//
// React.Children
// ----------------------------------------------------------------------
interface ReactChildren {
map<T>(children: ReactNode, fn: (child: ReactChild) => T): { [key:string]: T };
forEach(children: ReactNode, fn: (child: ReactChild) => any): void;
count(children: ReactNode): number;
only(children: ReactNode): ReactChild;
}
//
// React.addons
// ----------------------------------------------------------------------
interface ClassSet {
[key: string]: boolean;
}
//
// React.addons (Transitions)
// ----------------------------------------------------------------------
interface TransitionGroupProps {
component?: ReactType;
childFactory?: (child: ReactElement<any>) => ReactElement<any>;
}
interface CSSTransitionGroupProps extends TransitionGroupProps {
transitionName: string;
transitionAppear?: boolean;
transitionEnter?: boolean;
transitionLeave?: boolean;
}
interface CSSTransitionGroup extends ComponentClass<CSSTransitionGroupProps> {}
interface TransitionGroup extends ComponentClass<TransitionGroupProps> {}
//
// React.addons (Mixins)
// ----------------------------------------------------------------------
interface ReactLink<T> {
value: T;
requestChange(newValue: T): void;
}
interface LinkedStateMixin extends Mixin<any, any> {
linkState<T>(key: string): ReactLink<T>;
}
interface PureRenderMixin extends Mixin<any, any> {
}
//
// Reat.addons.update
// ----------------------------------------------------------------------
interface UpdateSpec {
$set: any;
$merge: {};
$apply(value: any): any;
// [key: string]: UpdateSpec;
}
interface UpdateArraySpec extends UpdateSpec {
$push?: any[];
$unshift?: any[];
$splice?: any[][];
}
//
// React.addons.Perf
// ----------------------------------------------------------------------
interface ComponentPerfContext {
current: string;
owner: string;
}
interface NumericPerfContext {
[key: string]: number;
}
interface Measurements {
exclusive: NumericPerfContext;
inclusive: NumericPerfContext;
render: NumericPerfContext;
counts: NumericPerfContext;
writes: NumericPerfContext;
displayNames: {
[key: string]: ComponentPerfContext;
};
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[];
}
//
// React.addons.TestUtils
// ----------------------------------------------------------------------
interface MockedComponentClass {
new(): any;
}
interface ReactTestUtils {
Simulate: Simulate;
renderIntoDocument<P>(element: ReactElement<P>): Component<P>;
renderIntoDocument<C extends Component<any>>(element: ReactElement<any>): C;
mockComponent(mocked: MockedComponentClass, mockTagName?: string): ReactTestUtils;
isElementOfType(element: ReactElement<any>, type: ReactType): boolean;
isDOMComponent(instance: Component<any>): boolean;
isCompositeComponent(instance: Component<any>): boolean;
isCompositeComponentWithType(instance: Component<any>, type: ComponentClass<any>): boolean;
isTextComponent(instance: Component<any>): boolean;
findAllInRenderedTree(tree: Component<any>, fn: (i: Component<any>) => boolean): Component<any>;
scryRenderedDOMComponentsWithClass(tree: Component<any>, className: string): DOMComponent<any>[];
findRenderedDOMComponentWithClass(tree: Component<any>, className: string): DOMComponent<any>;
scryRenderedDOMComponentsWithTag(tree: Component<any>, tagName: string): DOMComponent<any>[];
findRenderedDOMComponentWithTag(tree: Component<any>, tagName: string): DOMComponent<any>;
scryRenderedComponentsWithType<P, S>(
tree: Component<any>, type: ComponentClass<P>): CompositeComponent<P, S>[];
scryRenderedComponentsWithType<C extends CompositeComponent<any, any>>(
tree: Component<any>, type: ComponentClass<any>): C[];
findRenderedComponentWithType<P, S>(
tree: Component<any>, type: ComponentClass<P>): CompositeComponent<P, S>;
findRenderedComponentWithType<C extends CompositeComponent<any, any>>(
tree: Component<any>, type: ComponentClass<any>): C;
}
interface SyntheticEventData {
altKey?: boolean;
button?: number;
buttons?: number;
clientX?: number;
clientY?: number;
changedTouches?: TouchList;
charCode?: boolean;
clipboardData?: DataTransfer;
ctrlKey?: boolean;
deltaMode?: number;
deltaX?: number;
deltaY?: number;
deltaZ?: number;
detail?: number;
getModifierState?(key: string): boolean;
key?: string;
keyCode?: number;
locale?: string;
location?: number;
metaKey?: boolean;
pageX?: number;
pageY?: number;
relatedTarget?: EventTarget;
repeat?: boolean;
screenX?: number;
screenY?: number;
shiftKey?: boolean;
targetTouches?: TouchList;
touches?: TouchList;
view?: AbstractView;
which?: number;
}
interface EventSimulator {
(element: Element, eventData?: SyntheticEventData): void;
(descriptor: Component<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;
}
//
// react Exports
// ----------------------------------------------------------------------
interface Exports extends TopLevelAPI {
DOM: ReactDOM;
PropTypes: ReactPropTypes;
Children: ReactChildren;
}
//
// react/addons Exports
// ----------------------------------------------------------------------
interface AddonsExports extends Exports {
addons: {
CSSTransitionGroup: CSSTransitionGroup;
LinkedStateMixin: LinkedStateMixin;
PureRenderMixin: PureRenderMixin;
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;
classSet(cx: ClassSet): string;
cloneWithProps<P>(element: ReactElement<P>, props: P): ReactElement<P>;
update(value: any[], spec: UpdateArraySpec): any[];
update(value: {}, spec: UpdateSpec): any;
// Development tools
Perf: ReactPerf;
TestUtils: ReactTestUtils;
};
}
//
// Browser Interfaces
// https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts
// ----------------------------------------------------------------------
interface AbstractView {
styleMedia: StyleMedia;
document: Document;
}
interface Touch {
identifier: number;
target: EventTarget;
screenX: number;
screenY: number;
clientX: number;
clientY: number;
pageX: number;
pageY: number;
}
interface TouchList {
[index: number]: Touch;
length: number;
item(index: number): Touch;
identifiedTouch(identifier: number): Touch;
}
}
declare module "react" {
var exports: React.Exports;
export = exports;
}
declare module "react/addons" {
var exports: React.AddonsExports;
export = exports;
}
-133
View File
@@ -1,133 +0,0 @@
/// <reference path="react-addons-0.11.d.ts" />
import React = require("react/addons-0.11");
var PropTypesSpecification: React.Specification<any, any> = {
propTypes: {
// You can declare that a prop is a specific JS primitive. By default, these
// are all optional.
optionalArray: React.PropTypes.array,
optionalBool: React.PropTypes.bool,
optionalFunc: React.PropTypes.func,
optionalNumber: React.PropTypes.number,
optionalObject: React.PropTypes.object,
optionalString: React.PropTypes.string,
// Anything that can be rendered: numbers, strings, components or an array
// containing these types.
optionalRenderable: React.PropTypes.renderable,
// A React component.
optionalComponent: React.PropTypes.component,
// You can also declare that a prop is an instance of a class. This uses
// JS's instanceof operator.
optionalMessage: React.PropTypes.instanceOf(Date),
// You can ensure that your prop is limited to specific values by treating
// it as an enum.
optionalEnum: React.PropTypes.oneOf(['News', 'Photos']),
// An object that could be one of many types
optionalUnion: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.number,
React.PropTypes.instanceOf(Date)
]),
// An array of a certain type
optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number),
// An object with property values of a certain type
optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number),
// An object taking on a particular shape
optionalObjectWithShape: React.PropTypes.shape({
color: React.PropTypes.string,
fontSize: React.PropTypes.number
}),
// You can chain any of the above with `isRequired` to make sure a warning
// is shown if the prop isn't provided.
requiredFunc: React.PropTypes.func.isRequired,
// A value of any data type
requiredAny: React.PropTypes.any.isRequired,
// You can also specify a custom validator. It should return an Error
// object if the validation fails. Don't `console.warn` or throw, as this
// won't work inside `oneOfType`.
customProp: function(props, propName, componentName) {
if (!/matchme/.test(props[propName])) {
return new Error('Validation failed!');
}
return null;
}
},
render: (): React.Descriptor<any> => {
return null;
}
};
React.createClass(PropTypesSpecification);
var mountNode: Element;
var HelloMessage = React.createClass({displayName: 'HelloMessage',
render: function() {
return React.DOM.div(null, "Hello ", (<React.Component<{name: string}, any>>this).props.name);
}
});
React.renderComponent(HelloMessage({name: "John"}), mountNode);
var Timer = React.createClass({displayName: 'Timer',
getInitialState: function() {
return {secondsElapsed: 0};
},
tick: function() {
(<React.Component<any, {secondsElapsed: number}>>this).setState({
secondsElapsed: (<React.Component<any, {secondsElapsed: number}>>this).state.secondsElapsed + 1
});
},
componentDidMount: function() {
this.interval = setInterval(this.tick, 1000);
},
componentWillUnmount: function() {
clearInterval(this.interval);
},
render: function() {
return React.DOM.div(
null,
"Seconds Elapsed: ",
(<React.Component<any, {secondsElapsed: number}>>this).state.secondsElapsed
);
}
});
React.renderComponent(Timer(null), mountNode);
// TestUtils
var that: React.Component<any, any>;
var node = that.refs['input'].getDOMNode();
React.addons.TestUtils.Simulate.click(node);
React.addons.TestUtils.Simulate.change(node);
React.addons.TestUtils.Simulate.keyDown(node, {key: "Enter"});
var GoodbyeMessage = React.createClass({displayName: 'GoodbyeMessage',
render: function() {
return React.DOM.div(null, "Goodbye ", (<React.Component<{name: string}, any>>this).props.name);
}
});
React.addons.TestUtils.renderIntoDocument(GoodbyeMessage({name: "John"}));
var isImportant: boolean;
var isRead: boolean;
var cx = React.addons.classSet;
var classes = cx({
'message': true,
'message-important': isImportant,
'message-read': isRead
});
-172
View File
@@ -1,172 +0,0 @@
// Type definitions for React with Addons 0.11.2
// Project: http://facebook.github.io/react/
// Definitions by: Asana <https://asana.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="react-0.11.d.ts" />
declare module "react/addons-0.11" {
export = React;
}
declare module React {
export var addons: {
classSet: (classes: {[key: string]: boolean}) => string;
cloneWithProps: CloneWithProps<any>;
CSSTransitionGroup: Factory<CSSTransitionGroupProps>;
LinkedStateMixin: LinkedStateMixin<any, any>;
Perf: Perf;
PureRenderMixin: Mixin<any, any>;
TestUtils: TestUtils;
TransitionGroup: Factory<any>;
update(object: Object, changes: Object): Object;
};
export interface CloneWithProps<P> {
(instance: Descriptor<P>, extraProps?: P): Descriptor<P>;
}
export interface ReactLink<T> {
value: T;
requestChange(newValue: T): void;
}
export interface LinkedStateMixin<P, S> extends Mixin<P, S> {
linkState<T>(key: string): ReactLink<T>;
}
export interface ComponentPerfContext {
current: string;
owner: string;
}
export interface CSSTransitionGroupProps {
transitionName: string;
}
export interface TransitionsSpecification<P, S> extends Specification<P, S> {
componentWillEnter?(callback: () => void): void;
componentDidEnter?(): void;
componentWillLeave?(callback: () => void): void;
componentDidLeave?(): void;
}
export interface NumericPerfContext {
[key: string]: number;
}
export interface Measurements {
exclusive: NumericPerfContext;
inclusive: NumericPerfContext;
render: NumericPerfContext;
counts: NumericPerfContext;
writes: NumericPerfContext;
displayNames: {
[key: string]: ComponentPerfContext;
};
totalTime: number;
}
export interface Perf {
start(): void;
stop(): void;
printInclusive(measurements: Measurements[]): void;
printExclusive(measurements: Measurements[]): void;
printWasted(measurements: Measurements[]): void;
printDOM(measurements: Measurements[]): void;
getLastMeasurements(): Measurements[];
}
export interface TestUtils {
Simulate: Simulate;
renderIntoDocument(instance: Descriptor<any>): Descriptor<any>;
mockComponent(componentClass: Factory<any>, mockTagName?: string): TestUtils;
isDescriptorOfType(descriptor: Descriptor<any>, componentClass: Factory<any>): boolean;
isDOMComponent(instance: Descriptor<any>): boolean;
isCompositeComponent(instance: Descriptor<any>): boolean;
isCompositeComponentWithType(instance: Descriptor<any>, componentClass: Function): boolean;
isTextComponent(instance: Descriptor<any>): boolean;
findAllInRenderedTree(tree: Descriptor<any>, test: Function): Descriptor<any>[];
scryRenderedDOMComponentsWithClass(tree: Descriptor<any>, className: string): Descriptor<any>[];
findRenderedDOMComponentWithClass(tree: Descriptor<any>, className: string): Descriptor<any>;
scryRenderedDOMComponentsWithTag(tree: Descriptor<any>, className: string): Descriptor<any>[];
findRenderedDOMComponentWithTag(tree: Descriptor<any>, tagName: string): Descriptor<any>;
scryFindRenderedComponentsWithTag(tree: Descriptor<any>, componentClass: Function): Descriptor<any>[];
findRenderedComponentWithType(tree: Descriptor<any>, componentClass: Function): Descriptor<any>;
}
export interface SyntheticEventData {
altKey?: boolean;
button?: number;
buttons?: number;
clientX?: number;
clientY?: number;
changedTouches?: TouchList;
charCode?: boolean;
clipboardData?: DataTransfer;
ctrlKey?: boolean;
deltaMode?: number;
deltaX?: number;
deltaY?: number;
deltaZ?: number;
detail?: number;
getModifierState?(key: string): boolean;
key?: string;
keyCode?: number;
locale?: string;
location?: number;
metaKey?: boolean;
pageX?: number;
pageY?: number;
relatedTarget?: EventTarget;
repeat?: boolean;
screenX?: number;
screenY?: number;
shiftKey?: boolean;
targetTouches?: TouchList;
touches?: TouchList;
view?: AbstractView;
which?: number;
}
export interface EventSimulator {
(element: Element, eventData?: SyntheticEventData): void;
(descriptor: Descriptor<any>, eventData?: SyntheticEventData): void;
}
export 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;
}
}
-68
View File
@@ -1,68 +0,0 @@
/// <reference path="react-0.12.d.ts" />
import React = require("react/addons");
var isImportant: boolean;
var isRead: boolean;
var classSet: React.ClassSet = {
"message": true,
"message-important": isImportant,
"message-read": isRead
};
var cx = React.addons.classSet;
var classes: string = cx(classSet);
//
// React.addons (Transitions)
// --------------------------------------------------------------------------
React.createFactory(React.addons.TransitionGroup)({ component: "div" });
React.createFactory(React.addons.CSSTransitionGroup)({
component: React.createClass({
render: (): React.ReactElement<any> => null
}),
childFactory: (c) => c,
transitionName: "transition",
transitionAppear: false,
transitionEnter: true,
transitionLeave: true
});
//
// React.addons.TestUtils
// --------------------------------------------------------------------------
var that: React.CompositeComponent<any, any>;
var node = that.refs["input"].getDOMNode();
React.addons.TestUtils.Simulate.click(node);
React.addons.TestUtils.Simulate.change(node);
React.addons.TestUtils.Simulate.keyDown(node, {key: "Enter"});
interface GreetingProps {
name: string;
}
interface GreetingState {
morning: boolean;
}
interface Greeting extends React.CompositeComponent<GreetingProps, GreetingState> {
}
var Greeting = React.createClass({
displayName: "Greeting",
getInitialState: function() {
return {morning: true};
},
render: function() {
var me = <Greeting>this;
return React.DOM.div(
null,
me.state.morning ? "Hello " : "Goodbye ",
me.props.name);
}
});
var root = React.addons.TestUtils.renderIntoDocument(
React.createElement(Greeting, {name: "John"}));
var greeting = <Greeting>React.addons.TestUtils
.findRenderedComponentWithType(root, Greeting);
greeting.setState({
morning: false
});
+1 -1
View File
@@ -203,7 +203,7 @@ myComponent.reset();
// Attributes
// --------------------------------------------------------------------------
var children = ["Hello world", [null], React.DOM.span(null)];
var children: any[] = ["Hello world", [null], React.DOM.span(null)];
var divStyle = { // CSSProperties
flex: "1 1 main-size",
backgroundImage: "url('hello.png')"
+1 -1
View File
@@ -201,7 +201,7 @@ myComponent.reset();
// Attributes
// --------------------------------------------------------------------------
var children = ["Hello world", [null], React.DOM.span(null)];
var children: any[] = ["Hello world", [null], React.DOM.span(null)];
var divStyle = { // CSSProperties
flex: "1 1 main-size",
backgroundImage: "url('hello.png')"
+1
View File
@@ -150,6 +150,7 @@ declare module Rx {
immediate: IScheduler;
currentThread: ICurrentThreadScheduler;
default: IScheduler; // alias for Scheduler.timeout
timeout: IScheduler;
}
+2 -2
View File
@@ -49,7 +49,7 @@ declare module "serve-static" {
* By default this module will send "index.html" files in response to a request on a directory.
* To disable this set false or to supply a new index pass a string or an array in preferred order.
*/
index?: boolean;
index?: boolean|string|string[];
/**
* Enable or disable Last-Modified header, defaults to true. Uses the file system's last modified value.
@@ -59,7 +59,7 @@ declare module "serve-static" {
/**
* Provide a max-age in milliseconds for http caching, defaults to 0. This can also be a string accepted by the ms module.
*/
maxAge?: number;
maxAge?: number|string;
/**
* Redirect to trailing "/" when the pathname is a dir. Defaults to true.
@@ -0,0 +1,10 @@
/// <reference path="../node/node.d.ts" />
/// <reference path="to-title-case-gouch.d.ts" />
import fs = require('fs');
fs.readFile('to-title-case.js', 'utf-8', function(err: any, code: string) {
eval(code);
var lowerCase: string = 'this title is in lowercase and will be title case';
console.log(lowerCase.toTitleCase()); // Now in title case.
});
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for to-title-case
// Project: https://github.com/gouch/to-title-case
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface String {
toTitleCase(): string;
}
+1 -26
View File
@@ -3,29 +3,4 @@
// Definitions by: Kevin Barabash <https://github.com/kevinb7>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface TouchEvent extends UIEvent {
touches: TouchList;
targetTouches: TouchList;
changedTouches: TouchList;
altKey: boolean;
metaKey: boolean;
ctrlKey: boolean;
shiftKey: boolean;
}
interface TouchList {
length: number;
item: (index: number) => Touch;
[index: number]: Touch;
}
interface Touch {
identifier: number;
target: EventTarget;
screenX: number;
screenY: number;
clientX: number;
clientY: number;
pageX: number;
pageY: number;
}
// DEPRECATED: use TypeScript 1.5.3
-6
View File
@@ -592,12 +592,6 @@ declare module TypeScript.Collections {
function createHashTable<TKey, TValue>(capacity?: number, hash?: (k: TKey) => number): HashTable<TKey, TValue>;
function identityHashCode(value: any): number;
}
declare class Enumerator {
public atEnd(): boolean;
public moveNext(): boolean;
public item(): any;
constructor(o: any);
}
declare module TypeScript {
var nodeMakeDirectoryTime: number;
var nodeCreateBufferTime: number;
+2 -2
View File
@@ -534,7 +534,7 @@ describe('dest stream', function () {
// This test is from
// This test is from
var chmodSpy = spies.chmodSpy;
@@ -909,4 +909,4 @@ describe('symlink stream', function () {
stream.end();
});
});
});
});
-250
View File
@@ -1,250 +0,0 @@
// Type definitions for Web Audio API
// Project: http://www.w3.org/TR/2012/WD-webaudio-20120802/
// Definitions by: Baruch Berger <https://github.com/bbss>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Conforms to the: http://www.w3.org/TR/2012/WD-webaudio-20120802/ specification
// Currently only implemented in WebKit browsers
interface webkitAudioContext {
destination: AudioDestinationNode;
sampleRate: number;
currentTime: number;
listener: AudioListener;
activeSourceCount: number;
createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer;
createBuffer(buffer: ArrayBuffer, mixToMono: boolean): AudioBuffer;
decodeAudioData(audioData: ArrayBuffer, successCallback: any, errorCallback?: any): void;
createBufferSource(): AudioBufferSourceNode;
createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;
createMediaStreamSource(mediaStream: any): MediaStreamAudioSourceNode;
createAnalyser(): RealtimeAnalyserNode;
createGainNode(): AudioGainNode;
createDelayNode(maxDelayTime?: number): DelayNode;
createBiquadFilter(): BiquadFilterNode;
createPanner():AudioPannerNode;
createConvolver(): ConvolverNode;
createChannelSplitter(numberOfOutputs?: number):AudioChannelSplitter;
createChannelMerger(numberOfInputs?: number): AudioChannelMerger;
createDynamicsCompressor(): DynamicsCompressorNode;
createOscillator(): Oscillator;
createWaveTable(real: any,imag: any): WaveTable;
}
declare var webkitAudioContext: {
new (): webkitAudioContext;
}
interface Oscillator extends AudioSourceNode {
type: number;
playbackState: number;
frequency: AudioParam;
detune: AudioParam;
noteOn(when: number): void;
noteOff(when: number): void;
setWaveTable(waveTable: WaveTable): void;
}
interface AudioDestinationNode extends AudioNode {
maxNumberOfChannels: number;
numberOfChannels: number;
}
interface AudioNode {
connect(destination: AudioNode, output?: number, input?: number): void;
connect(destination: AudioParam, output?: number): void;
disconnect(output?: number): void;
context: webkitAudioContext;
numberOfInputs: number;
numberOfOutputs: number;
}
interface AudioSourceNode extends AudioNode {
}
interface AudioParam {
value: number;
minValue: number;
maxValue: number;
defaultValue: number;
setValueAtTime(value: number, time: number): void;
linearRampToValueAtTime(value: number, time: number): void;
exponentialRampToValueAtTime(value: number, time: number): void;
setTargetValueAtTime(targetValue: number,time: number, timeConstant: number): void;
setValueCurveAtTime(values: number[], time: number, duration: number): void;
cancelScheduledValues(startTime: number): void;
}
interface AudioGain extends AudioParam {
}
interface AudioGainNode extends AudioNode {
gain: AudioGain;
}
interface DelayNode extends AudioNode {
delayTime: AudioParam;
}
interface AudioBuffer {
sampleRate: number;
length: number;
duration: number;
numberOfChannels: number;
getChannelData(channel: number): any;
}
interface AudioBufferSourceNode extends AudioSourceNode {
playbackState: number;
buffer: AudioBuffer;
playbackRate: AudioParam;
loop: boolean;
noteOn(when: number): void;
noteGrainOn(when: number, grainOffset: number, grainDuration: number): void;
noteOff(when: number): void;
}
interface MediaElementAudioSourceNode extends AudioSourceNode {
}
interface JavaScriptAudioNode extends AudioNode {
onaudioprocess: EventListener;
bufferSize: number;
}
interface AudioProcessingEvent extends Event {
node: JavaScriptAudioNode;
playbackTime: number;
inputBuffer: AudioBuffer;
outputBuffer: AudioBuffer;
}
interface AudioPannerNode extends AudioNode {
panningModel: number;
setPosition(x: number, y: number, z: number): void;
setOrientation(x: number, y: number, z: number): void;
setVelocity(x: number, y: number, z: number): void;
distanceModel: number;
refDistance: number;
maxDistance: number;
rolloffFactor: number;
coneInnerAngle: number;
coneOuterAngle: number;
coneOuterGain: number;
distanceGain: AudioGain;
coneGain: AudioGain;
}
interface AudioListener {
dopplerFactor: number;
speedOfSound: number;
setPosition(x: number, y: number, z: number): void;
setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void;
setVelocity(x: number, y: number, z: number): void;
}
interface RealtimeAnalyserNode extends AudioNode {
getFloatFrequencyData(array: any): void;
getByteFrequencyData(array: any): void;
getByteTimeDomainData(array: any): void;
fftSize: number;
frequencyBinCount: number;
minDecibels: number;
maxDecibels: number;
smoothingTimeConstant: number;
}
interface AudioChannelSplitter extends AudioNode {
}
interface AudioChannelMerger extends AudioNode {
}
interface DynamicsCompressorNode extends AudioNode {
threshold: AudioParam;
knee: AudioParam;
ratio: AudioParam;
reduction: AudioParam;
attack: AudioParam;
release: AudioParam;
}
interface BiquadFilterNode extends AudioNode {
type: number;
frequency: AudioParam;
Q: AudioParam;
gain: AudioParam;
getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void;
}
interface WaveShaperNode extends AudioNode {
curve: any;
}
interface MediaStreamAudioSourceNode extends AudioSourceNode {
}
interface ConvolverNode extends AudioNode {
buffer: AudioBuffer;
normalize: boolean;
}
interface WaveTable {
}
-253
View File
@@ -1,253 +0,0 @@
// Type definitions for Web Audio API (nightly)
// Project: http://www.w3.org/TR/2012/WD-webaudio-20120802/
// Definitions by: Baruch Berger <https://github.com/bbss>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Conforms to the: http://www.w3.org/TR/2012/WD-webaudio-20120802/ specification
// Currently only implemented in WebKit browsers (nightly builds)
interface webkitAudioContext {
destination: AudioDestinationNode;
sampleRate: number;
currentTime: number;
listener: AudioListener;
activeSourceCount: number;
createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer;
createBuffer(buffer: ArrayBuffer, mixToMono: boolean): AudioBuffer;
decodeAudioData(audioData: ArrayBuffer, successCallback: any, errorCallback?: any): void;
createBufferSource(): AudioBufferSourceNode;
createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;
createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode;
createScriptProcessor(bufferSize: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;
createAnalyser(): AnalyserNode;
createGain(): GainNode;
createDelay(maxDelayTime?: number): DelayNode;
createBiquadFilter(): BiquadFilterNode;
createWaveShaper(): WaveShaperNode;
createPanner(): PannerNode;
createConvolver(): ConvolverNode;
createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode;
createChannelMerger(numberOfInputs?: number): ChannelMergerNode;
createDynamicsCompressor(): DynamicsCompressorNode;
createOscillator(): OscillatorNode;
createWaveTable(real: any, imag: any): WaveTable;
}
declare var webkitAudioContext: {
new (value?: any): webkitAudioContext;
}
interface AudioNode {
connect(destination: AudioNode, output?: number, input?: number): void;
connect(destination: AudioParam, output?: number): void;
disconnect(output?: number): void;
context: webkitAudioContext;
numberOfInputs: number;
numberOfOutputs: number;
}
interface AudioSourceNode extends AudioNode {
}
interface AudioDestinationNode extends AudioNode {
maxNumberOfChannels: number;
numberOfChannels: number;
}
interface AudioParam {
value: number;
computedValue: number;
minValue: number;
maxValue: number;
defaultValue: number;
setValueAtTime(value: number, startTime: number): void;
linearRampToValueAtTime(value: number, endTime: number): void;
exponentialRampToValueAtTime(value: number, endTime: number): void;
setTargetAtTime(target: number, startTime: number, timeConstant: number): void;
setValueCurveAtTime(values: any, startTime: number, duration: number): void;
cancelScheduledValues(startTime: number): void;
}
interface GainNode extends AudioNode {
gain: AudioParam;
}
interface DelayNode extends AudioNode {
delayTime: AudioParam;
}
interface AudioBuffer {
sampleRate: number;
length: number;
duration: number;
numberOfChannels: number;
getChannelData(channel): any;
}
interface AudioBufferSourceNode extends AudioSourceNode {
//actually enum
playbackState: number;
buffer: AudioBuffer;
playbackRate: AudioParam;
loop: boolean;
loopStart: number;
loopEnd: number;
start(when: number, offset?: number, duration?: number): void;
stop(when: number): void;
}
interface MediaElementAudioSourceNode extends AudioSourceNode {
}
interface ScriptProcessorNode extends AudioNode {
onaudioproces: EventListener;
bufferSize: number;
}
interface AudioProcessingEvent extends Event {
node: ScriptProcessorNode;
playbackTime: number;
inputBuffer: AudioBuffer;
outputBuffer: AudioBuffer;
}
interface PannerNode extends AudioNode {
//actually enum
panningModel: number;
distanceModel: number;
setPosition(x: number, y: number, z: number): void;
setOrientation(x: number, y: number, z: number): void;
setVelocity(x: number, y: number, z: number): void;
refDistance: number;
maxDistance: number;
rolloffFactor: number;
coneInnerAngle: number;
coneOuterAngle: number;
coneOuterGain: number;
}
interface AudioListener {
dopplerFactor: number;
speedOfSound: number;
setPosition(x: number, y: number, z: number): void;
setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void;
setVelocity(x: number, y: number, z: number): void;
}
interface ConvolverNode extends AudioNode {
buffer: AudioBuffer;
normalize: boolean;
}
interface AnalyserNode extends AudioNode {
getFloatFrequencyData(array: any): void;
getByteFrequencyData(array: any): void;
getByteTimeDomainData(array: any): void;
fftSize: number;
frequencyBinCount: number;
minDecibels: number;
maxDecibels: number;
smoothingTimeConstant: number;
}
interface ChannelSplitterNode extends AudioNode {
}
interface ChannelMergerNode extends AudioNode {
}
interface DynamicsCompressorNode extends AudioNode {
threshold: AudioParam;
knee: AudioParam;
ratio: AudioParam;
reduction: AudioParam;
attack: AudioParam;
release: AudioParam;
}
interface BiquadFilterNode extends AudioNode {
//actually enum
type: number;
frequency: AudioParam;
Q: AudioParam;
gain: AudioParam;
getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void;
}
interface WaveShaperNode extends AudioNode {
curve: any;
}
interface OscillatorNode extends AudioSourceNode {
//actually enums
type: number;
playbackState: number;
frequency: AudioParam;
detune: AudioParam;
start(when: number): void;
stop(when: number): void;
setWaveTable(waveTable: WaveTable): void;
}
interface WaveTable {
}
interface MediaStreamAudioSourceNode extends AudioSourceNode {
}
interface MediaStream {
}
-1
View File
@@ -1 +0,0 @@
+2 -1036
View File
File diff suppressed because it is too large Load Diff
+1 -8
View File
@@ -3,11 +3,4 @@
// Definitions by: Lucas Dixon <https://github.com/iislucas/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module crypto {
// A cryptographically strong pseudo-random number generator seeded with
// truly random values. The buffer passed in is modified, and a reference to
// argument is returned for convenience.
function getRandomValues(array: ArrayBufferView) : ArrayBufferView
}
// DEPRECATED: use TypeScript 1.5.3
-17
View File
@@ -1,17 +0,0 @@
# WebCrypto Definition Notes
## The WebCrypto specification
The WebCrypto specification is for performing basic cryptographic operations in
web applications, such as hashing, signature generation and verification, and
encryption and decryption. The API is also for applications to generate and/or
manage the keying material necessary to perform these operations. Uses for this
API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.
The latest version of the specification can be found at: http://www.w3.org/TR/WebCryptoAPI/
## Adding the reference to your project
```
/// <reference path="WebCrypto.d.ts" />
```
+30
View File
@@ -0,0 +1,30 @@
/// <reference path="webfontloader" />
import webfontloader = require("webfontloader");
var config: webfontloader.Config = {
classes: false,
events: false,
loading: function() {},
active: function() {},
inactive: function() {},
fontloading: function(familyName:string, fvd:string) {},
fontactive: function(familyName:string, fvd:string) {},
fontinactive: function(familyName:string, fvd:string) {},
google: {
families: ['Droid Sans', 'Droid Serif:bold'],
text: 'abcdedfghijklmopqrstuvwxyz!'
},
custom: {
families: ['My Font', 'My Other Font:n4,i4,n7'],
urls: ['/fonts.css']
},
fontdeck: {
id: 'xxxx'
},
monotype: {
projectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
version: 12345
},
timeout: 2000
}
webfontloader.load(config);
@@ -0,0 +1 @@
--noImplicitAny --module commonjs --target es5
+60
View File
@@ -0,0 +1,60 @@
// Type definitions for typekit-webfontloader 1.6.4
// Project: https://github.com/typekit/webfontloader
// Definitions by: doskallemaskin <https://github.com/doskallemaskin/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module WebFont {
export function load(config:WebFont.Config):void;
export interface Config {
/** Setting this to false will disable html classes (defaults to true) */
classes?:boolean;
/** Settings this to false will disable callbacks/events (defaults to true) */
events?:boolean;
/** Time (in ms) until the fontinactive callback will be triggered (defaults to 5000) */
timeout?:number;
/** This event is triggered when all fonts have been requested. */
loading?():void;
/** This event is triggered when the fonts have rendered. */
active?():void;
/** This event is triggered when the browser does not support linked fonts or if none of the fonts could be loaded. */
inactive?():void;
/** This event is triggered once for each font that's loaded. */
fontloading?(familyName:string, fvd:string):void;
/** This event is triggered once for each font that renders. */
fontactive?(familyName:string, fvd:string):void;
/** This event is triggered if the font can't be loaded. */
fontinactive?(familyName:string, fvd:string):void;
/** Child window or iframes to manage fonts for */
context?:Array<string>;
custom?:Custom;
google?:Google;
typekit?:Typekit;
fontdeck?:Fontdeck;
monotype?:Monotype;
}
export interface Google {
families?:Array<string>;
text: string;
}
export interface Typekit {
id?:Array<string>;
}
export interface Custom {
families?:Array<string>;
urls?:Array<string>;
testStrings?:{[fontFamily:string]:string};
}
export interface Fontdeck {
id?:string;
}
export interface Monotype {
projectId?:string;
version?:number;
}
}
declare module "webfontloader" {
export = WebFont;
}