Merge branch 'master' into leafletjs-marker-icon-types

This commit is contained in:
Christopher Currens
2017-02-22 12:19:39 -08:00
committed by GitHub
65 changed files with 2788 additions and 248 deletions
+1 -1
View File
@@ -208,7 +208,7 @@ declare namespace cucumber {
}
export interface SupportCodeConsumer {
(stepDefinitions:StepDefinitions | Hooks):void;
(stepDefinitions:StepDefinitions & Hooks):void;
}
export function defineSupportCode(consumer:SupportCodeConsumer): void;
+79
View File
@@ -0,0 +1,79 @@
// Type definitions for history 3.2
// Project: https://github.com/mjackson/history
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Nathan Brown <https://github.com/ngbrown>, Karol Janyst <https://github.com/LKay>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace History;
export type Action = "POP" | "PUSH" | "REPLACE";
export type BeforeUnloadHook = () => string | boolean;
export type CreateHistory<O, H> = (options?: HistoryOptions & O) => History & H;
export type CreateHistoryEnhancer<O, H, E> = (createHistory: CreateHistory<O, H>) => CreateHistory<O, H & E>;
export interface History {
listenBefore(hook: TransitionHook): () => void;
listen(listener: LocationListener): () => void;
transitionTo(location: Location): void;
push(path: LocationDescriptor): void;
replace(path: LocationDescriptor): void;
go(n: number): void;
goBack(): void;
goForward(): void;
createKey(): LocationKey;
createPath(path: LocationDescriptor): Path;
createHref(path: LocationDescriptor): Href;
createLocation(path?: LocationDescriptor, action?: Action, key?: LocationKey): Location;
getCurrentLocation(): Location;
}
export interface HistoryOptions {
getUserConfirmation?: (message: string, callback: (result: boolean) => void) => void;
keyLength?: number;
}
export type Hash = string;
export type Href = string;
export interface Location {
pathname: Pathname;
search: Search;
query: Query;
state: LocationState;
action: Action;
key: LocationKey;
}
export interface LocationDescriptorObject {
pathname?: Pathname;
search?: Search;
query?: Query;
state?: LocationState;
}
export type LocationDescriptor = LocationDescriptorObject | Path;
export type LocationKey = string;
export type LocationListener = (location: Location) => void;
export type LocationState = any;
export type Path = string; // Pathname + Search;
export type Pathname = string;
export type Query = any;
export type Search = string;
export type TransitionHook = (location: Location, callback: (result: any) => void) => any;
export { default as createHistory } from "history/lib/createBrowserHistory";
export { default as createHashHistory } from "history/lib/createHashHistory";
export { default as createMemoryHistory, MemoryHistory, MemoryHistoryOptions } from "history/lib/createMemoryHistory";
export { default as useBasename, Basename, HistoryBasename, HistoryBasenameOptions } from "history/lib/useBasename";
export { default as useBeforeUnload, HistoryBeforeUnload } from "history/lib/useBeforeUnload";
export { default as useQueries, HistoryQueries } from "history/lib/useQueries";
import * as Actions from "history/lib/actions";
export { Actions };
export { locationsAreEqual } from "history/lib/LocationUtils";
+3
View File
@@ -0,0 +1,3 @@
import { Location } from "history";
export function locationsAreEqual(a: Location, b: Location): boolean;
+9
View File
@@ -0,0 +1,9 @@
export const PUSH: string;
export const REPLACE: string;
export const POP: string;
export default {
PUSH,
REPLACE,
POP
};
+5
View File
@@ -0,0 +1,5 @@
import { CreateHistory } from "history";
declare const createBrowserHistory: CreateHistory<any, any>;
export default createBrowserHistory;
+5
View File
@@ -0,0 +1,5 @@
import { CreateHistory } from "history";
declare const createHashHistory: CreateHistory<any, any>;
export default createHashHistory;
+2
View File
@@ -0,0 +1,2 @@
import { Path, LocationState, Action, LocationKey, Location } from "history";
export default function createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location;
+14
View File
@@ -0,0 +1,14 @@
import { CreateHistory, History } from "history";
export interface MemoryHistoryOptions {
entries?: string | [string];
current?: string;
}
export interface MemoryHistory {
canGo(n: number): boolean;
}
declare const createMemoryHistory: CreateHistory<MemoryHistoryOptions, MemoryHistory>;
export default createMemoryHistory;
+13
View File
@@ -0,0 +1,13 @@
import { CreateHistory, HistoryOptions } from "history";
export type Basename = string;
export interface HistoryBasenameOptions {
basename?: Basename;
}
export interface HistoryBasename {
basename?: Basename;
}
export default function useBasename<O, H>(createHistory: CreateHistory<O, H>): CreateHistory<O & HistoryBasenameOptions, H & HistoryBasename>;
+7
View File
@@ -0,0 +1,7 @@
import { BeforeUnloadHook, CreateHistory } from "history";
export interface HistoryBeforeUnload {
listenBeforeUnload(hook: BeforeUnloadHook): () => void;
}
export default function useBeforeUnload<O, H>(createHistory: CreateHistory<O, H>): CreateHistory<O, H & HistoryBeforeUnload>;
+10
View File
@@ -0,0 +1,10 @@
import { CreateHistory, Href, LocationState, Path, Pathname, Query } from "history";
export interface HistoryQueries {
pushState(state: LocationState, pathname: Pathname, query?: Query): void;
replaceState(state: LocationState, pathname: Pathname, query?: Query): void;
createPath(path: Path, query?: Query): Path;
createHref(path: Path, query?: Query): Href;
}
export default function useQueries<O, H>(createHistory: CreateHistory<O, H>): CreateHistory<O, H & HistoryQueries>;
+35
View File
@@ -0,0 +1,35 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"types": [],
"paths": {
"history": ["history/v3"],
"history/*": ["history/v3/*"]
},
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"lib/actions.d.ts",
"lib/createBrowserHistory.d.ts",
"lib/createHashHistory.d.ts",
"lib/createLocation.d.ts",
"lib/createMemoryHistory.d.ts",
"lib/LocationUtils.d.ts",
"lib/useBasename.d.ts",
"lib/useBeforeUnload.d.ts",
"lib/useQueries.d.ts"
]
}
+7
View File
@@ -0,0 +1,7 @@
// Type definitions for is-array 1.0
// Project: https://github.com/retrofox/is-array
// Definitions by: Pine Mizune <https://github.com/pine>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = isArray;
declare function isArray(val?: any): val is any[];
+13
View File
@@ -0,0 +1,13 @@
import isArray = require('is-array');
isArray();
isArray(null);
isArray(1);
isArray(true);
isArray([]);
isArray({});
var x = {}
if (isArray(x)) {
x.push(0);
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"is-array-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+207
View File
@@ -0,0 +1,207 @@
// Type definitions for jimp 0.2
// Project: https://github.com/oliver-moran/jimp#readme
// Definitions by: Jack Works <https://github.com/Jack-Works>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare namespace jimp {
type Callback<T> = (this: JimpImage, err: Error, data: T) => void;
type ResizeMode = string;
type PresetFont = string;
type FileMINE = string;
type AlignMode = number;
type FilterType = number;
// Used in font info provided by parse-bmfont-ascii
type FontBoolean = 0 | 1;
interface FontChar {
id: number;
x: number;
y: number;
weight: number;
height: number;
xoffset: number;
yoffset: number;
xadvance: number;
page: number;
chnl: number;
}
type Font = {
common: {lineHeight: number, base: number, scaleW: number, scaleH: number, pages: number, packed: number},
info: {
face: string,
size: number,
bold: FontBoolean,
italic: FontBoolean,
charset: string,
unicode: FontBoolean,
stretchH: number,
smooth: FontBoolean,
aa: number,
padding: [number, number, number, number],
spacing: [number, number]
},
kernings: any,
pages: JIMP[],
chars: {
[char: number]: FontChar,
[char: string]: FontChar
}
} | PresetFont;
class JimpImage {
constructor(width: number, height: number, callback?: Callback<JimpImage>);
constructor(width: number, height: number, initialColor: number, callback?: Callback<JimpImage>);
/* Get/set meta data */
hash(n?: number): string;
getExtension(): string;
getMIME(): FileMINE;
getPixelColor(x: number, y: number): number;
setPixelColor(hex: number, x: number, y: number): void;
/* Save */
write(path: string, callback?: Callback<undefined>): void;
getBase64(mine: FileMINE, callback?: Callback<string>): void;
getBuffer(mine: FileMINE, callback?: Callback<Buffer>): void;
/* Parameter */
quality(n: number): JimpImage;
rgba(is: boolean): JimpImage;
filterType(type: FilterType): JimpImage;
deflateLevel(level: number): JimpImage;
/* Operation */
clone(): JimpImage;
print(font: Font, x: number, y: number, text: string, width?: number): JimpImage;
/* Adv */
color(
params: Array<{
apply: 'lighten' | 'brighten' | 'darken' | 'desaturate' | 'saturate' | 'greyscale' | 'spin' | 'hue' | 'tint' | 'shade' | 'red' | 'green' | 'blue',
params: [number]
} | {
apply: 'mix',
params: [string, number]
} | {
apply: 'xor',
params: [string]
}>): JimpImage;
convolution(matrix: number[][]): JimpImage;
scan(x: number, y: number, width: number, height: number, callback?: (this: JimpImage, x: number, y: number, idx: number) => void): JimpImage;
/* Low level data */
bitmap: {data: Buffer, readonly width: number, readonly height: number};
readonly _originalMime: string;
/* Resize */
contain(width: number, height: number, callback?: Callback<JimpImage>): JimpImage;
contain(width: number, height: number, alignBitsOrMode?: number | ResizeMode, callback?: Callback<JimpImage>): JimpImage;
contain(width: number, height: number, alignBits: number, mode?: ResizeMode, callback?: Callback<JimpImage>): JimpImage;
cover(width: number, height: number, callback?: Callback<JimpImage>): JimpImage;
cover(width: number, height: number, alignBitsOrmode?: ResizeMode | number, callback?: Callback<JimpImage>): JimpImage;
cover(width: number, height: number, alignBits: number, mode?: ResizeMode, callback?: Callback<JimpImage>): JimpImage;
resize(width: number, height: number, callback?: Callback<JimpImage>): JimpImage;
resize(width: number, height: number, mode?: ResizeMode, callback?: Callback<JimpImage>): JimpImage;
scale(factor: any, callback?: Callback<JimpImage>): JimpImage;
scale(factor: any, mode?: ResizeMode, callback?: Callback<JimpImage>): JimpImage;
scaleToFit(width: number, height: number, callback?: Callback<JimpImage>): JimpImage;
scaleToFit(width: number, height: number, mode?: ResizeMode, callback?: Callback<JimpImage>): JimpImage;
/* Crop */
autocrop(callback?: Callback<JimpImage>): JimpImage;
crop(x: number, y: number, width: number, height: number, callback?: Callback<JimpImage>): JimpImage;
/* Composing */
blit(scr: string, x: number, y: number, callback?: Callback<JimpImage>): JimpImage;
blit(scr: string, x: number, y: number, srcx?: number, srcy?: number, callback?: Callback<JimpImage>): JimpImage;
blit(scr: string, x: number, y: number, srcx?: number, srcy?: number, srcw?: number, srch?: number, callback?: Callback<JimpImage>): JimpImage;
composite(scr: string, x: number, y: number, callback?: Callback<JimpImage>): JimpImage;
mask(scr: string, x: number, y: number, callback?: Callback<JimpImage>): JimpImage;
/* Flip and rotate */
flip(horz: any, vert: any, callback?: Callback<JimpImage>): JimpImage;
mirror(horz: any, vert: any, callback?: Callback<JimpImage>): JimpImage;
rotate(deg: number, callback?: Callback<JimpImage>): JimpImage;
rotate(deg: number, mode?: any, callback?: Callback<JimpImage>): JimpImage;
/* Colour */
brightness(val: number, callback?: Callback<JimpImage>): JimpImage;
contrast(val: number, callback?: Callback<JimpImage>): JimpImage;
dither565(callback?: Callback<JimpImage>): JimpImage;
greyscale(callback?: Callback<JimpImage>): JimpImage;
invert(callback?: Callback<JimpImage>): JimpImage;
normalize(callback?: Callback<JimpImage>): JimpImage;
/* Alpha channel */
fade(val: number, callback?: Callback<JimpImage>): JimpImage;
opacity(val: number, callback?: Callback<JimpImage>): JimpImage;
opaque(callback?: Callback<JimpImage>): JimpImage;
background(hex: number, callback?: Callback<JimpImage>): JimpImage;
/* Blurs */
gaussian(pixel: number, callback?: Callback<JimpImage>): JimpImage;
blur(pixel: number, callback?: Callback<JimpImage>): JimpImage;
/* Effects */
posterize(level: number, callback?: Callback<JimpImage>): JimpImage;
sepia(callback?: Callback<JimpImage>): JimpImage;
}
class JIMP extends JimpImage {
static read(path: string | Buffer, callback?: Callback<JimpImage>): Promise<JimpImage>;
static loadFont(path: string | PresetFont, callback?: Callback<Font>): Promise<Font>;
static rgbaToInt(r: number, g: number, b: number, alpha: number): number;
static intToRGBA(hex: number): {r: number, g: number, b: number, a: number};
static distance(image: JimpImage, image2: JimpImage): number;
static diff(image1: JimpImage, image2: JimpImage, threshold?: number): {image: JimpImage, percent: number};
static deflateStrategy(deflate: number): void;
static readonly RESIZE_NEAREST_NEIGHBOR: ResizeMode;
static readonly RESIZE_BILINEAR: ResizeMode;
static readonly RESIZE_BICUBIC: ResizeMode;
static readonly RESIZE_HERMITE: ResizeMode;
static readonly RESIZE_BEZIER: ResizeMode;
static readonly FONT_SANS_8_BLACK: PresetFont;
static readonly FONT_SANS_16_BLACK: PresetFont;
static readonly FONT_SANS_32_BLACK: PresetFont;
static readonly FONT_SANS_64_BLACK: PresetFont;
static readonly FONT_SANS_128_BLACK: PresetFont;
static readonly FONT_SANS_8_WHITE: PresetFont;
static readonly FONT_SANS_16_WHITE: PresetFont;
static readonly FONT_SANS_32_WHITE: PresetFont;
static readonly FONT_SANS_64_WHITE: PresetFont;
static readonly FONT_SANS_128_WHITE: PresetFont;
static readonly MIME_PNG: FileMINE;
static readonly MIME_JPEG: FileMINE;
static readonly MIME_BMP: FileMINE;
static readonly AUTO: number;
static readonly HORIZONTAL_ALIGN_LEFT: AlignMode;
static readonly HORIZONTAL_ALIGN_CENTER: AlignMode;
static readonly HORIZONTAL_ALIGN_RIGHT: AlignMode;
static readonly VERTICAL_ALIGN_TOP: AlignMode;
static readonly VERTICAL_ALIGN_MIDDLE: AlignMode;
static readonly VERTICAL_ALIGN_BOTTOM: AlignMode;
static readonly PNG_FILTER_AUTO: FilterType;
static readonly PNG_FILTER_NONE: FilterType;
static readonly PNG_FILTER_SUB: FilterType;
static readonly PNG_FILTER_UP: FilterType;
static readonly PNG_FILTER_AVERAGE: FilterType;
static readonly PNG_FILTER_PAETH: FilterType;
}
}
export = jimp.JIMP;
+215
View File
@@ -0,0 +1,215 @@
import Jimp = require('jimp')
// All code below is from node-jimp document
Jimp.read("lenna.png", function (err, data) {
if (err) throw err;
data.resize(256, 256) // resize
.quality(60) // set JPEG quality
.greyscale() // set greyscale
.write("lena-small-bw.jpg"); // save
});
Jimp.read("lenna.png").then(function (lenna) {
lenna.resize(256, 256) // resize
.quality(60) // set JPEG quality
.greyscale() // set greyscale
.write("lena-small-bw.jpg"); // save
}).catch(function (err) {
console.error(err);
});
Jimp.read("./path/to/image.jpg", function (err, image) {
// do stuff with the image (if no exception)
});
Jimp.read("./path/to/image.jpg").then(function (image) {
// do stuff with the image
}).catch(function (err) {
// handle an exception
});
Jimp.read(new Buffer(''), function (err, image) {
// do stuff with the image (if no exception)
});
Jimp.read("http://www.example.com/path/to/lenna.jpg", function (err, image) {
// do stuff with the image (if no exception)
});
var image = new Jimp(1, 2)
var w = 0
var h = 0
var x = 0
var y = 0
var f = 0
var src = ''
var horz = Jimp.HORIZONTAL_ALIGN_CENTER
var vert = Jimp.VERTICAL_ALIGN_BOTTOM
var deg = 90
var val = 0.5
var hex = 0xFFFFFFFF
var r = 0
var n = 1
/* Resize */
image.contain( w, h); // scale the image to the given width and height, some parts of the image may be letter boxed
image.cover( w, h); // scale the image to the given width and height, some parts of the image may be clipped
image.resize( w, h); // resize the image. Jimp.AUTO can be passed as one of the values.
image.scale(f ); // scale the image by the factor f
image.scaleToFit( w, h ); // scale the image to the largest size that fits inside the given width and height
// An optional resize mode can be passed with all resize methods.
/* Crop */
image.autocrop(); // automatically crop same-color borders from image (if any)
image.crop( x, y, w, h ); // crop to the given region
/* Composing */
image.blit( src, x, y );
// blit the image with another Jimp image at x, y, optionally cropped.
image.composite( src, x, y ); // composites another Jimp image over this image at x, y
image.mask( src, x, y ); // masks the image with another Jimp image at x, y using average pixel value
/* Flip and rotate */
image.flip( horz, vert ); // flip the image horizontally or vertically
image.mirror( horz, vert ); // an alias for flip
image.rotate( deg ); // rotate the image clockwise by a number of degrees. Optionally, a resize mode can be passed. If `false` is passed as the second parameter, the image width and height will not be resized.
// JPEG images with EXIF orientation data will be automatically re-orientated as appropriate.
/* Colour */
image.brightness( val ); // adjust the brighness by a value -1 to +1
image.contrast( val ); // adjust the contrast by a value -1 to +1
image.dither565(); // ordered dithering of the image and reduce color space to 16-bits (RGB565)
image.greyscale(); // remove colour from the image
image.invert(); // invert the image colours
image.normalize(); // normalize the channels in an image
/* Alpha channel */
image.fade( f ); // an alternative to opacity, fades the image by a factor 0 - 1. 0 will haven no effect. 1 will turn the image
image.opacity( f ); // multiply the alpha channel by each pixel by the factor f, 0 - 1
image.opaque(); // set the alpha channel on every pixel to fully opaque
image.background( hex ); // set the default new pixel colour (e.g. 0xFFFFFFFF or 0x00000000) for by some operations (e.g. image.contain and
/* Blurs */
image.gaussian( r ); // Gaussian blur the image by r pixels (VERY slow)
image.blur( r ); // fast blur the image by r pixels
/* Effects */
image.posterize( n ); // apply a posterization effect with n level
image.sepia(); // apply a sepia wash to the image
image.clone(); // returns a clone of the image
image.resize(250, 250); // resize the image to 250 x 250
image.resize(Jimp.AUTO, 250); // resize the height to 250 and scale the width accordingly
image.resize(250, Jimp.AUTO); // resize the width to 250 and scale the height accordingly
image.resize(250, 250, Jimp.RESIZE_BEZIER);
image.contain(250, 250, Jimp.HORIZONTAL_ALIGN_LEFT | Jimp.VERTICAL_ALIGN_TOP);
var path = ''
var str = ''
var width = 0
Jimp.loadFont( path ).then(function (font) { // load font from .fnt file
image.print(font, x, y, str); // print a message on an image
image.print(font, x, y, str, width); // print a message on an image with text wrapped at width
});
var cb = (err: Error, data: any) => {}
Jimp.loadFont( path, cb ); // using a callback pattern
Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then(function (font) {
image.print(font, 10, 10, "Hello world!");
});
image.write( path, cb ); // Node-style callback will be fired when write is successful
var file = "new_name." + image.getExtension();
image.write(file)
var mime = 'image/png'
image.getBuffer( mime, cb ); // Node-style callback will be fired with result
image.getBase64( mime, cb ); // Node-style callback will be fired with result
image.quality( n ); // set the quality of saved JPEG, 0 - 100
var bool = true
var number = 0
image.rgba( bool ); // set whether PNGs are saved as RGBA (true, default) or RGB (false)
image.filterType( number ); // set the filter type for the saved PNG
image.deflateLevel( number ); // set the deflate level for the saved PNG
Jimp.deflateStrategy( number ); // set the deflate for the saved PNG (0-3)
image.color([
{ apply: 'hue', params: [ -90 ] },
{ apply: 'lighten', params: [ 50 ] },
{ apply: 'xor', params: [ '#06D' ] }
]);
image.convolution([
[-2,-1, 0],
[-1, 1, 1],
[ 0, 1, 2]
])
image.scan(0, 0, image.bitmap.width, image.bitmap.height, function (x, y, idx) {
// x, y is the position of this pixel on the image
// idx is the position start position of this rgba tuple in the bitmap Buffer
// this is the image
var red = this.bitmap.data[ idx + 0 ];
var green = this.bitmap.data[ idx + 1 ];
var blue = this.bitmap.data[ idx + 2 ];
var alpha = this.bitmap.data[ idx + 3 ];
// rgba values run from 0 - 255
// e.g. this.bitmap.data[idx] = 0; // removes red from this pixel
});
image.getPixelColor(x, y); // returns the colour of that pixel e.g. 0xFFFFFFFF
image.setPixelColor(hex, x, y); // sets the colour of that pixel
var g = 0
var b = 0
var a = 0
Jimp.rgbaToInt(r, g, b, a); // e.g. converts 255, 255, 255, 255 to 0xFFFFFFFF
Jimp.intToRGBA(hex); // e.g. converts 0xFFFFFFFF to {r: 255, g: 255, b: 255, a:255}
var image = new Jimp(256, 256, function (err, image) {
// this image is 256 x 256, every pixel is set to 0x00000000
});
var image = new Jimp(256, 256, 0xFF0000FF, function (err, image) {
// this image is 256 x 256, every pixel is set to 0xFF0000FF
});
image.hash(); // aHgG4GgoFjA
image.hash(2); // 1010101011010000101010000100101010010000011001001001010011100100
var image1 = new Jimp(0, 1)
var image2 = new Jimp(0, 1)
Jimp.distance(image1, image2); // returns a number 0-1, where 0 means the two images are perceived to be identical
var threshold = 0
var diff = Jimp.diff(image1, image2, threshold); // threshold ranges 0-1 (default: 0.1)
diff.image; // a Jimp image showing differences
diff.percent; // the proportion of different pixels (0-1), where 0 means the images are pixel identical
var distance = Jimp.distance(image, image2); // perceived distance
var diff = Jimp.diff(image, image2); // pixel difference
if (distance < 0.15 || diff.percent < 0.15) {
// images match
} else {
// not a match
}
Jimp.read("lenna.png", function (err, image) {
this.greyscale().scale(0.5).write("lena-half-bw.png");
});
Jimp.read("lenna.png", function (err, image) {
image.greyscale(function(err, image) {
image.scale(0.5, function (err, image) {
image.write("lena-half-bw.png");
});
});
});
+20
View File
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"jimp-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+292 -11
View File
@@ -1,6 +1,6 @@
// Type definitions for Joint JS 1.0.1
// Project: http://www.jointjs.com/
// Definitions by: Aidan Reel <http://github.com/areel>, David Durman <http://github.com/DavidDurman>, Ewout Van Gossum <https://github.com/DenEwout>, Federico Caselli <https://github.com/CaselIT>
// Definitions by: Aidan Reel <http://github.com/areel>, David Durman <http://github.com/DavidDurman>, Ewout Van Gossum <https://github.com/DenEwout>, Federico Caselli <https://github.com/CaselIT>, Chris Moran <https://github.com/ChrisMoran>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// typings: https://github.com/CaselIT/typings-jointjs
@@ -188,6 +188,7 @@ declare namespace joint {
vertices?: Point[];
smooth?: boolean;
attrs?: TextAttrs;
z?: number;
}
class Link extends Cell {
@@ -249,6 +250,7 @@ declare namespace joint {
cellViewNamespace?: Object;
/** useful undocumented option */
clickThreshold?: number;
highlighting?: any;
}
interface ScaleContentOptions {
@@ -466,40 +468,319 @@ declare namespace joint {
cy?: string | number;
height?: string | number;
width?: string | number;
transform?: string;
points?: string;
'stroke-width'?: string | number;
'ref-x'?: string | number;
'ref-y'?: string | number;
ref?: string
}
namespace basic {
class Generic extends dia.Element {
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object)
constructor(attributes?: GenericAttributes<dia.SVGAttributes>, options?: Object);
}
interface RectAttrs extends dia.TextAttrs {
rect?: ShapeAttrs;
}
class Rect extends Generic {
constructor(attributes?: GenericAttributes<RectAttrs>, options?: Object)
constructor(attributes?: GenericAttributes<RectAttrs>, options?: Object);
}
class Text extends Generic {
constructor(attributes?: GenericAttributes<dia.TextAttrs>, options?: Object)
constructor(attributes?: GenericAttributes<dia.TextAttrs>, options?: Object);
}
interface CircleAttrs extends dia.TextAttrs {
circle?: ShapeAttrs;
}
class Circle extends Generic {
constructor(attributes?: GenericAttributes<CircleAttrs>, options?: Object)
constructor(attributes?: GenericAttributes<CircleAttrs>, options?: Object);
}
interface EllipseAttrs extends dia.TextAttrs {
ellipse?: ShapeAttrs;
}
class Ellipse extends Generic {
constructor(attributes?: GenericAttributes<EllipseAttrs>, options?: Object)
constructor(attributes?: GenericAttributes<EllipseAttrs>, options?: Object);
}
class Image extends Generic {
}
class Path extends Generic {
interface PolygonAttrs extends dia.TextAttrs {
polygon?: ShapeAttrs;
}
class Polygon extends Generic {
constructor(attributes?: GenericAttributes<PolygonAttrs>, options?: Object);
}
interface PolylineAttrs extends dia.TextAttrs {
polyline?: ShapeAttrs;
}
class Polyline extends Generic {
}
class Image extends Generic {
constructor(attributes?: GenericAttributes<dia.TextAttrs>, options?: Object);
}
interface PathAttrs extends dia.TextAttrs {
path?: ShapeAttrs;
}
class Path extends Generic {
constructor(attributes?: GenericAttributes<PathAttrs>, options?: Object);
}
interface RhombusAttrs extends dia.TextAttrs {
path?: ShapeAttrs;
}
class Rhombus extends Generic {
constructor(attributes?: GenericAttributes<RhombusAttrs>, options?: Object);
}
interface TextBlockAttrs extends dia.TextAttrs {
rect?: ShapeAttrs;
}
class TextBlock extends Generic {
constructor(attributes?: GenericAttributes<TextBlockAttrs>, options?: Object);
updateSize(cell: dia.Cell, size: dia.Size): void;
updateContent(cell: dia.Cell, content: string): void;
}
}
namespace chess {
class KingWhite extends basic.Generic {
}
class KingBlack extends basic.Generic {
}
class QueenWhite extends basic.Generic {
}
class QueenBlack extends basic.Generic {
}
class RookWhite extends basic.Generic {
}
class RookBlack extends basic.Generic {
}
class BishopWhite extends basic.Generic {
}
class BishopBlack extends basic.Generic {
}
class KnightWhite extends basic.Generic {
}
class KnightBlack extends basic.Generic {
}
class PawnWhite extends basic.Generic {
}
class PawnBlack extends basic.Generic {
}
}
namespace devs {
interface ModelAttributes extends GenericAttributes<dia.SVGAttributes> {
inPorts?: string[];
outPorts?: string[];
ports?: Object;
}
class Model extends basic.Generic {
constructor(attributes?: ModelAttributes, options?: Object);
changeInGroup(properties: any, opt?: any): boolean;
changeOutGroup(properties: any, opt?: any): boolean;
createPortItem(group: string, port: string): any;
createPortItems(group: string, ports: string[]): any[];
addOutPort(port: string, opt?: any): this;
addInPort(port: string, opt?: any): this;
removeOutPort(port: string, opt?: any): this;
removeInPort(port: string, opt?: any): this;
}
class Coupled extends Model {
}
class Atomic extends Model {
}
class Link extends dia.Link {
}
}
namespace erd {
class Entity extends basic.Generic {
constructor(attributes?: GenericAttributes<dia.TextAttrs>, options?: Object);
}
class WeakEntity extends Entity {
}
class Relationship extends dia.Element {
constructor(attributes?: GenericAttributes<dia.TextAttrs>, options?: Object);
}
class IdentifyingRelationship extends Relationship {
}
interface AttributeAttrs extends dia.TextAttrs {
ellipse?: ShapeAttrs;
}
class Attribute extends dia.Element {
constructor(attributes?: GenericAttributes<AttributeAttrs>, options?: Object);
}
class Multivalued extends Attribute {
}
class Derived extends Attribute {
}
class Key extends Attribute {
}
class Normal extends Attribute {
}
interface ISAAttrs extends dia.Element {
polygon?: ShapeAttrs;
}
class ISA extends dia.Element {
constructor(attributes?: GenericAttributes<ISAAttrs>, options?: Object);
}
class Line extends dia.Link {
cardinality(value: string | number): void;
}
}
namespace fsa {
class State extends basic.Circle {
}
class StartState extends dia.Element {
constructor(attributes?: GenericAttributes<basic.CircleAttrs>, options?: Object);
}
class EndState extends dia.Element {
}
class Arrow extends dia.Link {
}
}
namespace logic {
interface LogicAttrs extends ShapeAttrs {
ref?: string;
'ref-x'?: number | string;
'ref-dx'?: number | string;
'ref-y'?: number | string;
'ref-dy'?: number | string;
magnet?: boolean;
'class'?: string;
port?: string;
}
interface IOAttrs extends dia.TextAttrs {
circle?: LogicAttrs;
}
class Gate extends basic.Generic {
constructor(attributes?: GenericAttributes<IOAttrs>, options?: Object);
}
class IO extends Gate {
}
class Input extends IO {
}
class Output extends IO {
}
class Gate11 extends Gate {
}
class Gate21 extends Gate {
}
interface Image {
'xlink:href'?: string;
}
interface ImageAttrs extends LogicAttrs {
image?: Image;
}
class Repeater extends Gate11 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input: any): any;
}
class Note extends Gate11 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input: any): boolean;
}
class Or extends Gate21 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input1: any, input2: any): boolean;
}
class And extends Gate21 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input1: any, input2: any): boolean;
}
class Nor extends Gate21 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input1: any, input2: any): boolean;
}
class Nand extends Gate21 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input1: any, input2: any): boolean;
}
class Xor extends Gate21 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input1: any, input2: any): boolean;
}
class Xnor extends Gate21 {
constructor(attributes?: GenericAttributes<ImageAttrs>, options?: Object);
operation(input1: any, input2: any): boolean;
}
interface WireArgs extends dia.LinkAttributes {
router?: Object;
connector?: Object;
}
class Wire extends dia.Link {
constructor(attributes?: WireArgs, options?: Object);
}
}
namespace org {
interface MemberAttrs {
rect?: ShapeAttrs;
image?: ShapeAttrs;
}
class Member extends dia.Element {
constructor(attributes?: GenericAttributes<MemberAttrs>, options?: Object);
}
class Arrow extends dia.Link {
}
}
namespace pn {
class Place extends basic.Generic {
}
class PlaceView extends dia.ElementView {
renderTokens(): void;
}
class Transition extends basic.Generic {
constructor(attributes?: GenericAttributes<basic.RectAttrs>, options?: Object);
}
class Link extends dia.Link {
}
}
namespace uml {
interface ClassAttributes extends GenericAttributes<basic.RectAttrs> {
name: string[];
attributes: string[];
methods: string[];
}
class Class extends basic.Generic {
constructor(attributes?: ClassAttributes, options?: Object);
getClassName(): string[];
updateRectangles(): void;
}
class ClassView extends dia.ElementView {
}
class Abstract extends Class {
}
class AbstractView extends ClassView {
}
class Interface extends Class {
}
class InterfaceView extends ClassView {
}
class Generalization extends dia.Link {
}
class Implementation extends dia.Link {
}
class Aggregation extends dia.Link {
}
class Composition extends dia.Link {
}
class Association extends dia.Link {
}
interface StateAttributes extends GenericAttributes<ShapeAttrs> {
events?: string[];
}
class State extends basic.Generic {
updateName(): void;
updateEvents(): void;
updatePath(): void;
}
class StartState extends basic.Circle {
}
class EndState extends basic.Generic {
}
class Transition extends dia.Link {
}
}
}
@@ -553,7 +834,7 @@ declare namespace joint {
}
class DirectedGraph {
static layout(graph: dia.Graph, options?: LayoutOptions): dia.BBox;
static layout(graph: dia.Graph | dia.Cell[], options?: LayoutOptions): dia.BBox;
}
}
}
}
+2 -2
View File
@@ -37,7 +37,7 @@ declare namespace Hbs {
layoutsPath?: string,
contentHelperName?: string,
blockHelperName?: string,
disableCache?: boolean
disableCache?: boolean
}
}
@@ -50,7 +50,7 @@ declare const hbs: Hbs;
export = hbs;
declare module "koa" {
export interface Context extends Request, Response {
export interface Context {
render(tpl: string, locals?: {[key: string]: any}): Promise<void>;
}
}
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/koajs/json-error
// Definitions by: Mudkip <https://github.com/mudkipme>
// Definitions: https://github.com/mudkipme/DefinitelyTyped
// TypeScript Version: 2.1
import * as Koa from "koa";
+1 -1
View File
@@ -13,7 +13,7 @@
import * as Koa from "koa";
declare module "koa" {
interface Request {
interface Context {
authInfo?: any;
user?: any;
+1 -1
View File
@@ -17,7 +17,7 @@ import * as Koa from "koa";
import * as cookies from "cookies";
declare module "koa" {
interface Request {
interface Context {
session: any;
sessionHandler: { regenerateId: () => void };
}
+615 -142
View File
@@ -1,6 +1,6 @@
// Type definitions for Koa 2.x
// Project: http://koajs.com
// Definitions by: DavidCai1993 <https://github.com/DavidCai1993>
// Definitions by: DavidCai1993 <https://github.com/DavidCai1993>, jKey Lu <https://github.com/jkeylu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* =================== USAGE ===================
@@ -14,172 +14,645 @@
=============================================== */
/// <reference types="node" />
import { EventEmitter } from "events";
import * as cookies from "cookies";
import * as http from "http";
import * as net from "net";
import { EventEmitter } from 'events';
import { IncomingMessage, ServerResponse, Server } from 'http';
import { Socket, ListenOptions } from 'net';
import * as compose from 'koa-compose';
import * as Keygrip from 'keygrip';
import * as httpAssert from 'http-assert';
import * as Cookies from 'cookies';
import * as accepts from 'accepts';
declare interface ContextDelegatedRequest {
/**
* Return request header.
*/
header: any;
/**
* Return request header, alias as request.header
*/
headers: any;
/**
* Get/Set request URL.
*/
url: string;
/**
* Get origin of URL.
*/
origin: string;
/**
* Get full request URL.
*/
href: string;
/**
* Get/Set request method.
*/
method: string;
/**
* Get request pathname.
* Set pathname, retaining the query-string when present.
*/
path: string;
/**
* Get parsed query-string.
* Set query-string as an object.
*/
query: any;
/**
* Get/Set query string.
*/
querystring: string;
/**
* Get the search string. Same as the querystring
* except it includes the leading ?.
*
* Set the search string. Same as
* response.querystring= but included for ubiquity.
*/
search: string;
export = Koa;
/**
* Parse the "Host" header field host
* and support X-Forwarded-Host when a
* proxy is enabled.
*/
host: string;
declare namespace Koa {
export interface Context extends Request, Response {
app: Koa;
req: http.IncomingMessage;
res: http.ServerResponse;
request: Request;
response: Response;
/**
* Parse the "Host" header field hostname
* and support X-Forwarded-Host when a
* proxy is enabled.
*/
hostname: string;
cookies: cookies.ICookies;
originalUrl: string;
state: any;
/**
* Check if the request is fresh, aka
* Last-Modified and/or the ETag
* still match.
*/
fresh: boolean;
name?: string;
respond?: boolean;
/**
* Check if the request is stale, aka
* "Last-Modified" and / or the "ETag" for the
* resource has changed.
*/
stale: boolean;
assert(test: any, ...args: any[]): void;
onerror(err?: any): void;
throw(...args: any[]): void;
/**
* Check if the request is idempotent.
*/
idempotent: boolean;
toJSON(): any;
inspect(): any;
/**
* Return the request socket.
*/
socket: Socket;
[key: string]: any;
}
/**
* Return the protocol string "http" or "https"
* when requested with TLS. When the proxy setting
* is enabled the "X-Forwarded-Proto" header
* field will be trusted. If you're running behind
* a reverse proxy that supplies https for you this
* may be enabled.
*/
protocol: string;
export interface Request {
app: Koa;
req: http.IncomingMessage;
res: http.ServerResponse;
ctx: Context;
response: Response;
/**
* Short-hand for:
*
* this.protocol == 'https'
*/
secure: boolean;
fresh: boolean;
header: any;
headers: any;
host: string;
hostname: string;
href: string;
idempotent: boolean;
ip: string;
ips: string[];
method: string;
origin: string;
originalUrl: string;
path: string;
protocol: string;
query: any;
querystring: string;
search: string;
secure: boolean;
socket: net.Socket;
stale: boolean;
subdomains: string[];
type: string;
url: string;
/**
* When `app.proxy` is `true`, parse
* the "X-Forwarded-For" ip address list.
*
* For example if the value were "client, proxy1, proxy2"
* you would receive the array `["client", "proxy1", "proxy2"]`
* where "proxy2" is the furthest down-stream.
*/
ips: string[];
charset?: string;
length?: number;
/**
* Return subdomains as an array.
*
* Subdomains are the dot-separated parts of the host before the main domain
* of the app. By default, the domain of the app is assumed to be the last two
* parts of the host. This can be changed by setting `app.subdomainOffset`.
*
* For example, if the domain is "tobi.ferrets.example.com":
* If `app.subdomainOffset` is not set, this.subdomains is
* `["ferrets", "tobi"]`.
* If `app.subdomainOffset` is 3, this.subdomains is `["tobi"]`.
*/
subdomains: string[];
accepts(): string[];
accepts(arg: string): void | string;
accepts(arg: string[]): void | string;
accepts(...args: string[]): void | string;
acceptsCharsets(): string[];
acceptsCharsets(arg: string): void | string;
acceptsCharsets(arg: string[]): void | string;
acceptsCharsets(...args: string[]): void | string;
acceptsEncodings(): string[];
acceptsEncodings(arg: string): void | string;
acceptsEncodings(arg: string[]): void | string;
acceptsEncodings(...args: string[]): void | string;
acceptsLanguages(): string[];
acceptsLanguages(arg: string): void | string;
acceptsLanguages(arg: string[]): void | string;
acceptsLanguages(...args: string[]): void | string;
get(field: string): string;
is(): string[];
is(arg: string): void | string;
is(arg: string[]): void | string;
is(...args: string[]): void | string;
/**
* Check if the given `type(s)` is acceptable, returning
* the best match when true, otherwise `undefined`, in which
* case you should respond with 406 "Not Acceptable".
*
* The `type` value may be a single mime type string
* such as "application/json", the extension name
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
* or array is given the _best_ match, if any is returned.
*
* Examples:
*
* // Accept: text/html
* this.accepts('html');
* // => "html"
*
* // Accept: text/*, application/json
* this.accepts('html');
* // => "html"
* this.accepts('text/html');
* // => "text/html"
* this.accepts('json', 'text');
* // => "json"
* this.accepts('application/json');
* // => "application/json"
*
* // Accept: text/*, application/json
* this.accepts('image/png');
* this.accepts('png');
* // => undefined
*
* // Accept: text/*;q=.5, application/json
* this.accepts(['html', 'json']);
* this.accepts('html', 'json');
* // => "json"
*/
accepts(): string[] | boolean;
accepts(...types: string[]): string | boolean;
accepts(types: string[]): string | boolean;
toJSON(): any;
inspect(): any;
}
/**
* Return accepted encodings or best fit based on `encodings`.
*
* Given `Accept-Encoding: gzip, deflate`
* an array sorted by quality is returned:
*
* ['gzip', 'deflate']
*/
acceptsEncodings(): string[] | boolean;
acceptsEncodings(...encodings: string[]): string | boolean;
acceptsEncodings(encodings: string[]): string | boolean;
export interface Response {
app: Koa;
req: http.IncomingMessage;
res: http.ServerResponse;
ctx: Context;
request: Request;
/**
* Return accepted charsets or best fit based on `charsets`.
*
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
* an array sorted by quality is returned:
*
* ['utf-8', 'utf-7', 'iso-8859-1']
*/
acceptsCharsets(): string[] | boolean;
acceptsCharsets(...charsets: string[]): string | boolean;
acceptsCharsets(charsets: string[]): string | boolean;
body: any;
etag: string;
header: any;
headers: any;
headerSent: boolean;
lastModified: Date;
message: string;
socket: net.Socket;
status: number;
type: string;
writable: boolean;
/**
* Return accepted languages or best fit based on `langs`.
*
* Given `Accept-Language: en;q=0.8, es, pt`
* an array sorted by quality is returned:
*
* ['es', 'pt', 'en']
*/
acceptsLanguages(): string[] | boolean;
acceptsLanguages(...langs: string[]): string | boolean;
acceptsLanguages(langs: string[]): string | boolean;
charset?: string;
length?: number;
/**
* Check if the incoming request contains the "Content-Type"
* header field, and it contains any of the give mime `type`s.
* If there is no request body, `null` is returned.
* If there is no content type, `false` is returned.
* Otherwise, it returns the first `type` that matches.
*
* Examples:
*
* // With Content-Type: text/html; charset=utf-8
* this.is('html'); // => 'html'
* this.is('text/html'); // => 'text/html'
* this.is('text/*', 'application/json'); // => 'text/html'
*
* // When Content-Type is application/json
* this.is('json', 'urlencoded'); // => 'json'
* this.is('application/json'); // => 'application/json'
* this.is('html', 'application/*'); // => 'application/json'
*
* this.is('html'); // => false
*/
// is(): string | boolean;
is(...types: string[]): string | boolean;
is(types: string[]): string | boolean;
append(field: string, val: string | string[]): void;
attachment(filename?: string): void;
get(field: string): string;
is(): string[];
is(arg: string): void | string;
is(arg: string[]): void | string;
is(...args: string[]): void | string;
redirect(url: string, alt?: string): void;
remove(field: string): void;
set(field: string, val: string | string[]): void;
set(field: any): void;
vary(field: string): void;
toJSON(): any;
inspect(): any;
}
export type Middleware = (ctx: Koa.Context, next: () => Promise<any>) => any;
/**
* Return request header.
*
* The `Referrer` header field is special-cased,
* both `Referrer` and `Referer` are interchangeable.
*
* Examples:
*
* this.get('Content-Type');
* // => "text/plain"
*
* this.get('content-type');
* // => "text/plain"
*
* this.get('Something');
* // => undefined
*/
get(field: string): string;
}
declare class Koa extends EventEmitter {
subdomainOffset: number;
server: http.Server;
env: string;
context: Koa.Context;
keys: string[];
declare interface BaseRequest extends ContextDelegatedRequest {
/**
* Get the charset when present or undefined.
*/
charset: string;
/**
* Return parsed Content-Length when present.
*/
length: number;
/**
* Return the request mime type void of
* parameters such as "charset".
*/
type: string;
/**
* Inspect implementation.
*/
inspect(): any;
/**
* Return JSON representation.
*/
toJSON(): any;
}
declare interface ContextDelegatedResponse {
/**
* Get/Set response status code.
*/
status: number;
/**
* Get response status message
*/
message: string;
/**
* Get/Set response body.
*/
body: any;
/**
* Return parsed response Content-Length when present.
* Set Content-Length field to `n`.
*/
length: number;
/**
* Check if a header has been written to the socket.
*/
headerSent: boolean;
/**
* Vary on `field`.
*/
vary(field: string): void;
/**
* Perform a 302 redirect to `url`.
*
* The string "back" is special-cased
* to provide Referrer support, when Referrer
* is not present `alt` or "/" is used.
*
* Examples:
*
* this.redirect('back');
* this.redirect('back', '/index.html');
* this.redirect('/login');
* this.redirect('http://google.com');
*/
redirect(url: string, alt?: string): void;
/**
* Set Content-Disposition header to "attachment" with optional `filename`.
*/
attachment(filename: string): void;
/**
* Return the response mime type void of
* parameters such as "charset".
*
* Set Content-Type response header with `type` through `mime.lookup()`
* when it does not contain a charset.
*
* Examples:
*
* this.type = '.html';
* this.type = 'html';
* this.type = 'json';
* this.type = 'application/json';
* this.type = 'png';
*/
type: string;
/**
* Get the Last-Modified date in Date form, if it exists.
* Set the Last-Modified date using a string or a Date.
*
* this.response.lastModified = new Date();
* this.response.lastModified = '2013-09-13';
*/
lastModified: Date;
/**
* Get/Set the ETag of a response.
* This will normalize the quotes if necessary.
*
* this.response.etag = 'md5hashsum';
* this.response.etag = '"md5hashsum"';
* this.response.etag = 'W/"123456789"';
*
* @param {String} etag
* @api public
*/
etag: string;
/**
* Set header `field` to `val`, or pass
* an object of header fields.
*
* Examples:
*
* this.set('Foo', ['bar', 'baz']);
* this.set('Accept', 'application/json');
* this.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
*/
set(field: { [key: string]: string; }): void;
set(field: string, val: string | string[]): void;
/**
* Append additional header `field` with value `val`.
*
* Examples:
*
* ```
* this.append('Link', ['<http://localhost/>', '<http://localhost:3000/>']);
* this.append('Set-Cookie', 'foo=bar; Path=/; HttpOnly');
* this.append('Warning', '199 Miscellaneous warning');
* ```
*/
append(field: string, val: string | string[]): void;
/**
* Remove header `field`.
*/
remove(field: string): void;
/**
* Checks if the request is writable.
* Tests for the existence of the socket
* as node sometimes does not set it.
*/
writable: boolean;
/**
* Flush any set headers, and begin the body
*/
flushHeaders(): void;
}
declare interface BaseResponse extends ContextDelegatedResponse {
/**
* Return the request socket.
*
* @return {Connection}
* @api public
*/
socket: Socket;
/**
* Return response header.
*/
header: any;
/**
* Return response header, alias as response.header
*/
headers: any;
/**
* Check whether the response is one of the listed types.
* Pretty much the same as `this.request.is()`.
*
* @param {String|Array} types...
* @return {String|false}
* @api public
*/
// is(): string;
is(...types: string[]): string;
is(types: string[]): string;
/**
* Return response header.
*
* Examples:
*
* this.get('Content-Type');
* // => "text/plain"
*
* this.get('content-type');
* // => "text/plain"
*/
get(field: string): string;
/**
* Inspect implementation.
*/
inspect(): any;
/**
* Return JSON representation.
*/
toJSON(): any;
}
declare interface BaseContext extends ContextDelegatedRequest, ContextDelegatedResponse {
/**
* util.inspect() implementation, which
* just returns the JSON output.
*/
inspect(): any;
/**
* Return JSON representation.
*
* Here we explicitly invoke .toJSON() on each
* object, as iteration will otherwise fail due
* to the getters and cause utilities such as
* clone() to fail.
*/
toJSON(): any;
/**
* Similar to .throw(), adds assertion.
*
* this.assert(this.user, 401, 'Please login!');
*
* See: https://github.com/jshttp/http-assert
*/
assert: typeof httpAssert;
/**
* Throw an error with `msg` and optional `status`
* defaulting to 500. Note that these are user-level
* errors, and the message may be exposed to the client.
*
* this.throw(403)
* this.throw('name required', 400)
* this.throw(400, 'name required')
* this.throw('something exploded')
* this.throw(new Error('invalid'), 400);
* this.throw(400, new Error('invalid'));
*
* See: https://github.com/jshttp/http-errors
*/
throw(message: string, code?: number, properties?: {}): never;
throw(status: number): never;
throw(...properties: Array<number | string | {}>): never;
/**
* Default error handling.
*/
onerror(err: Error): void;
}
declare class Application extends EventEmitter {
proxy: boolean;
request: Koa.Request;
response: Koa.Response;
middleware: Application.Middleware[];
subdomainOffset: number;
env: string;
context: BaseContext;
request: BaseRequest;
response: BaseResponse;
silent: boolean;
keys: Keygrip | string[];
constructor();
// From node.d.ts
listen(): http.Server;
listen(port: number, hostname?: string, backlog?: number, listeningListener?: Function): http.Server;
listen(port: number, hostname?: string, listeningListener?: Function): http.Server;
listen(port: number, backlog?: number, listeningListener?: Function): http.Server;
listen(port: number, listeningListener?: Function): http.Server;
listen(path: string, backlog?: number, listeningListener?: Function): http.Server;
listen(path: string, listeningListener?: Function): http.Server;
listen(handle: any, backlog?: number, listeningListener?: Function): http.Server;
listen(handle: any, listeningListener?: Function): http.Server;
listen(options: net.ListenOptions, listeningListener?: Function): http.Server;
/**
* Shorthand for:
*
* http.createServer(app.callback()).listen(...)
*/
listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): Server;
listen(port: number, hostname?: string, listeningListener?: () => void): Server;
/* tslint:disable:unified-signatures */
listen(port: number, backlog?: number, listeningListener?: () => void): Server;
listen(port: number, listeningListener?: () => void): Server;
listen(path: string, backlog?: number, listeningListener?: () => void): Server;
listen(path: string, listeningListener?: () => void): Server;
listen(options: ListenOptions, listeningListener?: () => void): Server;
listen(handle: any, backlog?: number, listeningListener?: () => void): Server;
listen(handle: any, listeningListener?: () => void): Server;
/* tslint:enable:unified-signatures*/
callback(): (req: http.IncomingMessage, res: http.ServerResponse) => void;
onerror(err: any): void;
use(middleware: Koa.Middleware): Koa;
toJSON(): any;
/**
* Return JSON representation.
* We only bother showing settings.
*/
inspect(): any;
onerror(err: any): void;
/**
* Return JSON representation.
* We only bother showing settings.
*/
toJSON(): any;
/**
* Use the given middleware `fn`.
*
* Old-style middleware will be converted.
*/
use(middleware: Application.Middleware): this;
/**
* Return a request handler callback
* for node's native http server.
*/
callback(): (req: IncomingMessage, res: ServerResponse) => void;
/**
* Initialize a new context.
*
* @api private
*/
createContext(req: IncomingMessage, res: ServerResponse): Application.Context;
/**
* Default error handler.
*
* @api private
*/
onerror(err: Error): void;
}
declare namespace Application {
type Middleware = compose.Middleware<Context>;
interface Request extends BaseRequest {
app: Application;
req: IncomingMessage;
res: ServerResponse;
ctx: Context;
response: Response;
originalUrl: string;
ip: string;
accept: accepts.Accepts;
}
interface Response extends BaseResponse {
app: Application;
req: IncomingMessage;
res: ServerResponse;
ctx: Context;
request: Request;
}
interface Context extends BaseContext {
app: Application;
request: Request;
response: Response;
req: IncomingMessage;
res: ServerResponse;
originalUrl: string;
cookies: Cookies;
accept: accepts.Accepts;
state: any;
}
}
export = Application;
+21
View File
@@ -1524,6 +1524,27 @@ declare namespace L {
export const svg: boolean;
}
export namespace Util {
export function extend(dest: any, src?: any): any;
export function create(proto: any, properties?: any): any;
export function bind(fn: () => void, ...obj: any[]): () => void;
export function stamp(obj: any): number;
export function throttle(fn: () => void, time: number, context: any): () => void;
export function wrapNum(num: number, range: number[], includeMax?: boolean): number;
export function falseFn(): () => false;
export function formatNum(num: number, digits?: number): number;
export function trim(str: string): string;
export function splitWords(str: string): string[];
export function setOptions(obj: any, options: any): any;
export function getParamString(obj: any, existingUrl?: string, uppercase?: boolean): string;
export function template(str: string, data: any): string;
export function isArray(obj: any): boolean;
export function indexOf(array: any[], el: any): number;
export function requestAnimFrame(fn: () => void, context?: any, immediate?: boolean): number;
export function cancelAnimFrame(id: number): void;
export let lastId: string;
export let emptyImageUrl: string;
}
}
declare module 'leaflet' {
+21
View File
@@ -457,3 +457,24 @@ L.marker([1, 2], {
})).setIcon(L.divIcon({
className: 'my-div-icon'
}));;
L.Util.extend({});
L.Util.create({});
L.Util.bind(() => {}, {});
L.Util.stamp({});
L.Util.throttle(() => {}, 123, {});
L.Util.wrapNum(123, []);
L.Util.falseFn();
L.Util.formatNum(123);
L.Util.trim('word ');
L.Util.splitWords('word word');
L.Util.setOptions({}, {});
L.Util.getParamString({});
L.Util.template('template', {});
L.Util.isArray({});
L.Util.indexOf([], {});
L.Util.requestAnimFrame(() => {});
L.Util.cancelAnimFrame(1);
L.Util.emptyImageUrl;
+1
View File
@@ -428,6 +428,7 @@ declare namespace Accounts {
function onCreateUser(func: Function): void;
function validateLoginAttempt(cb: (params: Accounts.IValidateLoginAttemptCbOpts) => boolean): { stop: () => void };
function validateNewUser(func: Function): boolean;
function _hashPassword(password: string): { digest: string; algorithm: string; };
}
declare namespace App {
+203
View File
@@ -0,0 +1,203 @@
// Type definitions for phonon 1.4
// Project: https://github.com/quark-dev/Phonon-Framework
// Definitions by: Kévin SERIN <https://github.com/kserin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="awesomplete"/>
declare namespace Phonon {
/*** Main object ***/
interface Phonon {
device: PhononDeviceObject;
browser: PhononBrowserObject;
event: PhononEventObject;
options(options: PhononOptions): void;
navigator(): PhononNavigator;
i18n(): PhononI18n;
updateLocale(language: string): void;
ajax(request: PhononAjaxObject): PhononAjaxReturnObject;
onReady(callback: () => void): void;
panel(id: string): PhononPanelComponent;
sidePanel(id: string): PhononSidePanelComponent;
alert(text: string, title?: string, cancelable?: boolean, textOk?: string): PhononDialogComponent;
confirm(text: string, title?: string, cancelable?: boolean, textOk?: string, textCancel?: string): PhononDialogComponent;
prompt(text: string, title?: string, cancelable?: boolean, textOk?: string, textCancel?: string): PhononDialogComponent;
indicator(title: string, cancelable?: boolean): PhononIndicatorComponent;
dialog(id: string): PhononCustomDialogComponent;
notif(textOrId: string, timeout?: number, showButton?: boolean, textButton?: string): PhononNotifComponent;
popover(id?: string): PhononPopoverComponent;
preloader(element: string | Element): PhononPreloaderComponent;
tab(): PhononTabComponent;
autocomplete(input: Element | HTMLElement | string, o?: AwesompleteOptions): Awesomplete;
}
interface PhononDeviceObject {
os: string;
osVersion: string;
ANDROID: string;
IOS: string;
}
interface PhononBrowserObject {
name: string;
version: string;
}
interface PhononEventObject {
animationEnd: string;
transitionEnd: string;
}
interface PhononCustomWindowEvent extends Event {
detail: PhononDetail;
}
interface PhononDetail {
page: string;
req: string[];
}
/*** Options ***/
interface PhononOptions {
navigator?: PhononNavigatorOptions;
i18n?: PhononI18nOptions | null;
}
interface PhononNavigatorOptions {
defaultPage?: string;
hashPrefix?: string;
animatePages?: boolean;
enableBrowserBackButton?: boolean;
templateRootDirectory?: string;
defaultTemplateExtension?: string;
useHash?: boolean;
}
interface PhononI18nOptions {
directory?: string;
localeFallback?: string;
localePreferred?: string;
}
/*** Navigation ***/
interface PhononNavigator {
currentPage: string;
previousPage: string;
changePage(pageName: string, parameter?: string): void;
on(page: PhononPageObject, callback?: (activity: PhononActivity) => void): void;
onPage(page: string): PhononPageEventObject;
start(): void;
}
interface PhononActivity {
onCreate(callback?: () => void): void;
onReady(callback?: () => void): void;
onClose(callback?: (self: PhononOnCloseObject) => void): void;
onHidden(callback?: () => void): void;
onTransitionEnd(callback?: () => void): void;
onHashChanged(callback?: (...hash: string[]) => void): void;
onTabChanged(callback?: (tabNumber: number) => void): void;
}
interface PhononPageObject {
page: string;
content?: string | null;
preventClose?: boolean;
readyDelay?: number;
}
interface PhononOnCloseObject {
close(): void;
}
interface PhononPageEventObject {
addEvent(event: string, callback: (parameter?: any) => void): void;
}
/*** Internationalization ***/
interface PhononI18n {
bind(element?: Element, callback?: () => void): void;
bind(callback?: () => void): void;
getAll(callback: (json: any) => void): void;
get(key: string, callback: (value: any) => void): void;
get(key: string[], callback: (values: any) => void): void;
getPreference(): string;
setPreference(newLanguage: string): void;
getLocale(): string;
}
/*** Ajax ***/
type PhononAjaxErrorFlag = "NO_INTERNET_ACCESS" | "TIMEOUT_EXCEEDED" | "XMLHTTPREQUEST_UNAVAILABLE" | "JSON_MALFORMED" | "REQUEST_CANCELED";
interface PhononAjaxObject {
method: string;
url: string;
crossDomain?: boolean;
dataType: string;
contentType?: string;
data?: any;
timeout?: number;
headers?: any;
success(res: any, xhr: XMLHttpRequest): void;
error?(res: any, flagError: PhononAjaxErrorFlag, xhr: XMLHttpRequest): void;
}
interface PhononAjaxReturnObject {
cancel(): void;
}
/*** Components ***/
type PhononColor = "positive" | "negative";
type PhononPopoverDirection = "left" | "title-left" | "right" | "title";
interface PhononPanelComponent {
open(): void;
close(): void;
}
interface PhononSidePanelComponent {
open(): void;
close(): void;
}
interface PhononDialogComponent {
on(event: string, callback: (value?: any) => void): PhononDialogComponent;
}
interface PhononCustomDialogComponent extends PhononDialogComponent {
open(): void;
close(): void;
}
interface PhononIndicatorComponent extends PhononDialogComponent {
open(): void;
close(): void;
}
interface PhononNotifComponent {
setColor(color: PhononColor): PhononNotifComponent;
show(): PhononNotifComponent;
hide(): PhononNotifComponent;
}
interface PhononPopoverItem {
text: string;
value: string;
}
interface PhononPopoverComponent {
setList(list: string[] | PhononPopoverItem[]): PhononPopoverComponent;
setList(list: any[], itemBuilder?: (item: any) => void): PhononPopoverComponent;
attachButton(element: string|Element, autoBind?: boolean): PhononPopoverComponent;
open(direction: PhononPopoverDirection): PhononPopoverComponent;
openFrom(element: string|Element): PhononPopoverComponent;
close(): void;
onItemChanged(callback: (data: PhononPopoverItem) => void): PhononPopoverComponent;
}
interface PhononPreloaderComponent {
show(): void;
hide(): void;
}
interface PhononTabComponent {
setCurrentTab(pageName: string, tabNumber: number): void;
init(page?: string): void;
}
}
interface Document {
on(event: string, callback: (event: Phonon.PhononCustomWindowEvent) => void, useCapture?: boolean): void;
off(event: string, callback: (event: Phonon.PhononCustomWindowEvent) => void, useCapture?: boolean): void;
}
interface Window {
on(event: string, callback: (event: Phonon.PhononCustomWindowEvent) => void, useCapture?: boolean): void;
off(event: string, callback: (event: Phonon.PhononCustomWindowEvent) => void, useCapture?: boolean): void;
}
interface Element {
on(event: string, callback: (event: any) => void, useCapture?: boolean): void;
off(event: string, callback: (event: any) => void, useCapture?: boolean): void;
}
interface NodeList {
on(event: string, callback: (event: any) => void, useCapture?: boolean): void;
off(event: string, callback: (event: any) => void, useCapture?: boolean): void;
}
declare const phonon: Phonon.Phonon;
+562
View File
@@ -0,0 +1,562 @@
///<reference path="index.d.ts"/>
// Code examples from http://phonon.quarkdev.com/docs/navigator
phonon.options({
navigator: {
defaultPage: 'home',
hashPrefix: '!',
animatePages: true,
enableBrowserBackButton: true,
templateRootDirectory: '',
defaultTemplateExtension: 'html',
useHash: true
},
i18n: {
directory: 'res/lang/',
localeFallback: 'en',
localePreferred: 'en-US'
}
});
phonon.navigator().on({
page: 'pagename',
content: 'content.html',
preventClose: false,
readyDelay: 1
}, function(activity) {
activity.onCreate(function() {});
activity.onReady(function() {});
activity.onTransitionEnd(function() {});
activity.onClose(function(self) {});
activity.onHidden(function() {});
activity.onHashChanged(function(req1, req2) {});
activity.onTabChanged(function() {})
});
phonon.navigator().onPage('home').addEvent('create', function () {
});
phonon.navigator().onPage('home').addEvent('close', function (api) {
api.close();
});
phonon.navigator().start();
phonon.navigator().changePage('page-name', 'optional-parameter');
let page: string = phonon.navigator().currentPage;
page = phonon.navigator().previousPage;
let ev = document.createEvent('');
document.on('pagecreated', function(event) {
console.log('global state pagecreated: ' + event.detail.page)
});
document.on('pagehash', function(event) {
console.log('global state pagehash: ' + event.detail.page)
console.log(event.detail.req[0]);
console.log(event.detail.req[1]);
console.log(event.detail.req[2]);
});
// Code examples from http://phonon.quarkdev.com/docs/i18n
let element = document.createElement('<element>');
phonon.i18n().bind();
phonon.i18n().bind(function() {});
phonon.i18n().bind(element);
phonon.i18n().bind(element, function() {});
phonon.i18n().getAll(function(json) {});
phonon.i18n().get('my_key', function(value) {});
phonon.i18n().get(['my_key_1', 'my_key_two'], function(values) {});
phonon.updateLocale('new-language');
phonon.i18n().setPreference("fr");
phonon.i18n().getPreference();
phonon.i18n().getLocale();
// Code examples from http://phonon.quarkdev.com/docs/ajax
var req = phonon.ajax({
method: 'GET',
url: 'http://mysite.com/api/',
crossDomain: true,
dataType: 'json',
contentType: 'application/json',
data: {key1: 'val1', key2: 'val2'},
timeout: 5000,
headers: {
'header-name1': 'value1',
'header-name2': 'value2'
},
success: function(res, xhr) {
console.log(res);
},
error: function(res, flagError, xhr) {
console.error(flagError);
console.log(res);
}
});
req.cancel();
// Code examples from http://phonon.quarkdev.com/docs/device
let os: string = phonon.device.os;
let osVersion: string = phonon.device.osVersion;
let browsername: string = phonon.browser.name;
let browserVersion: string = phonon.browser.version;
// Code examples from http://phonon.quarkdev.com/docs/events
element.on('tap', function() {});
phonon.onReady(function() {});
document.querySelectorAll('.elements').on('tap', function() {});
element.off('tap', function() {});
document.querySelectorAll('.elements').off('tap', function() {});
document.on('pageopened', function(evt) {
console.log(evt.detail.page + ' is opened');
});
let animationEnd: string = phonon.event.animationEnd;
let transitionEnd: string = phonon.event.transitionEnd;
// Code examples from http://phonon.quarkdev.com/docs/panels
phonon.panel('#my-panel-id').open();
phonon.panel('#my-panel-id').close();
// Code examples from http://phonon.quarkdev.com/docs/side-panels
phonon.sidePanel('#side-panel-id').open();
phonon.sidePanel('#side-panel-id').close();
// Code examples from http://phonon.quarkdev.com/docs/dialogs
let pAlert = phonon.alert("text", "title", true, "textOk");
pAlert.on('confirm', function() {});
var pconfirm = phonon.confirm("text", "title", true, "textOk", "textCancel");
pconfirm.on('confirm', function() {})
pconfirm.on('cancel', function() {});
let pPrompt = phonon.prompt("text", "title", true, "textOk", "textCancel");
pPrompt.on('confirm', function(inputValue) {})
pPrompt.on('cancel', function() {});
phonon.indicator("title", true);
let myDialog = phonon.dialog('#my-dialog');
myDialog.open();
myDialog.close();
myDialog.on('confirm', function() {});
// Code examples from http://phonon.quarkdev.com/docs/notifications
let notif = phonon.notif('Hello', 3000, true, 'CANCEL');
notif.setColor('positive');
notif = phonon.notif("#id");
notif.show();
notif.hide();
// Code examples from http://phonon.quarkdev.com/docs/popovers
let popover = phonon.popover();
popover = phonon.popover('#popover-id');
popover.setList(['a', 'b', 'c']);
popover.setList([
{
text: 'a',
value: 'a'
},
{
text: 'b',
value: 'tg'
}
]);
popover.setList(['a', 'b', 'c'], function (item) {
var text = typeof item === 'string' ? item : item.text;
var value = typeof item === 'string' ? item : item.value;
return '<li><a class="padded-list" data-value="' + value + '">' + text + '</a></li>';
});
popover.attachButton('.button-trigger-popover', true);
popover.attachButton(element, true);
popover.openFrom('.button-for-popover');
popover.openFrom(element);
popover.onItemChanged(function (data) {
console.log('onItemChanged')
console.error(data)
});
element.on('itemchanged', function(event) {
console.log(event.detail);
});
popover = phonon.popover()
.setList(['a', 'b', 'c'])
.attachButton('.my-button', true)
.onItemChanged(function (data) {
console.log(data);
}).openFrom('.my-button');
// Code examples from http://phonon.quarkdev.com/docs/preloaders
phonon.preloader('#my-preloader').show();
phonon.preloader('#my-preloader').hide();
// Code examples from http://phonon.quarkdev.com/docs/tabs
let tabNumber = 2;
phonon.tab().setCurrentTab('pageName', tabNumber);
phonon.tab().init();
phonon.tab().init('pagename');
// Example from
phonon.options({
navigator: {
defaultPage: 'home',
animatePages: true,
enableBrowserBackButton: true,
templateRootDirectory: './tpl'
},
i18n: null
});
let app = phonon.navigator();
app.on({page: 'home', preventClose: false, content: null});
app.on({page: 'pagetwo', preventClose: true, content: 'pagetwo.html', readyDelay: 1}, function(activity) {
let action: string | null = null;
var onAction = function(evt: any) {
var target = evt.target;
action = 'ok';
if(target.getAttribute('data-order') === 'order') {
phonon.alert('Thank you for your order!', 'Dear customer');
} else {
phonon.alert('Your order has been canceled.', 'Dear customer');
}
};
activity.onCreate(function() {
let order = document.querySelector('.order');
if (order != null) {
order.on('tap', onAction);
}
let cancel = document.querySelector('.cancel');
if (cancel != null) {
cancel.on('tap', onAction);
}
});
activity.onClose(function(self) {
if(action !== null) {
self.close();
} else {
phonon.alert('Before leaving this page, you must perform an action.', 'Action required');
}
});
activity.onHidden(function() {
action = null;
});
activity.onHashChanged(function(pizza) {
let pizzaElt = document.querySelector('.pizza');
if (pizzaElt != null) {
pizzaElt.textContent = pizza;
}
});
});
app.start();
// Code example from http://phonon.quarkdev.com/App/public/phonon/kitchen-sink/index.html
phonon.options({
navigator: {
defaultPage: 'home',
animatePages: true,
templateRootDirectory: 'contents/',
enableBrowserBackButton: true // should be disabled on Cordova
},
i18n: {
directory: 'lang/',
localeFallback: 'en',
localePreferred: 'en-US'
}
});
var app2 = phonon.navigator();
app2.on({page: 'home', content: 'home.html'});
app2.on({page: 'pagedialog', content: 'pagedialog.html'}, function(activity) {
activity.onCreate(function() {
let showAlert = document.querySelector('#show-alert');
if (showAlert) {
showAlert.on('tap', function() {
phonon.alert('Example', 'Hello');
});
}
let showConfirm = document.querySelector('#show-confirm');
if (showConfirm) {
showConfirm.on('tap', function() {
let confirm = phonon.confirm('Example', 'Hello');
confirm.on('confirm', function() {
phonon.alert('Confirmed!');
});
confirm.on('cancel', function(value) {
phonon.alert('Canceled!');
});
});
}
let showPrompt = document.querySelector('#show-prompt');
if (showPrompt) {
showPrompt.on('tap', function() {
var prompt = phonon.prompt('Example', 'Hello');
prompt.on('confirm', function(value) {
phonon.alert(value, 'Inserted Value');
});
prompt.on('cancel', function() {
phonon.alert('Prompt Canceled');
});
});
}
let showIndicator = document.querySelector('#show-indicator');
if (showIndicator) {
showIndicator.on('tap', function() {
let indicator = phonon.indicator('Please wait 3 seconds', false);
window.setTimeout(function() {
indicator.close();
}, 3000);
});
}
});
});
app2.on({page: 'pageform', content: 'pageform.html'});
app2.on({page: 'pagefla', content: 'pagefla.html'});
app2.on({page: 'pagegrid', content: 'pagegrid.html'});
app2.on({page: 'pagelist', content: 'pagelist.html'});
app2.on({page: 'pageaccordion', content: 'pageaccordion.html'});
app2.on({page: 'pagenotif', content: 'pagenotif.html', readyDelay: 500}, function(activity) {
activity.onCreate(function() {
let showAutoNotif = document.querySelector('#show-auto-notif');
if (showAutoNotif) {
showAutoNotif.on('tap', function() {
phonon.notif('HELLO', 3000, false);
});
}
let showNotif = document.querySelector('#show-notif');
if (showNotif) {
showNotif.on('tap', function() {
phonon.notif('#notif-example').show();
});
}
let showNotifButton = document.querySelector('#show-notif-button');
if (showNotifButton) {
showNotifButton.on('tap', function() {
phonon.notif('HELLO', 3000, true, 'Bye');
});
}
});
activity.onReady(function() {
phonon.notif('Welcome!', 3000, true);
});
});
app2.on({page: 'pagepanel', content: 'pagepanel.html'});
app2.on({page: 'pagepopover', content: 'pagepopover.html'});
app2.on({page: 'pagepreloader', content: 'pagepreloader.html'}, function(activity) {
activity.onReady(function() {
let myCircle = document.querySelector('#my-circle');
if (myCircle) {
phonon.preloader(myCircle).show();
}
let myDeterminate = document.querySelector('#my-determinate');
if (myDeterminate) {
phonon.preloader(myDeterminate).show();
}
});
activity.onHidden(function() {
let myCircle = document.querySelector('#my-circle');
if (myCircle) {
phonon.preloader(myCircle).hide();
}
let myDeterminate = document.querySelector('#my-determinate');
if (myDeterminate) {
phonon.preloader(myDeterminate).hide();
}
});
});
app2.on({page: 'pagesidepanel', content: 'pagesidepanel.html'});
app2.on({page: 'pagetable', content: 'pagetable.html'});
app2.on({page: 'pagetabs', content: 'pagetabs.html'}, function(activity) {
activity.onTabChanged(function(tabNumber) {
let tab = document.querySelector('.tab-number');
if (tab) {
tab.innerHTML = tabNumber + "";
}
});
});
app2.start();
// Example from http://phonon.quarkdev.com/App/public/phonon/examples/components/accordion-example/#!home
phonon.options({
navigator: {
defaultPage: 'home'
},
i18n: null
});
phonon.navigator().start();
// Example from http://phonon.quarkdev.com/App/public/phonon/examples/components/autocomplete-example/#!home
phonon.options({
navigator: {
defaultPage: 'home'
},
i18n: null
});
phonon.navigator().on({ page: 'home' }, function(activity) {
activity.onReady(function(){
// input where user typed words to query
let input = document.querySelector( '#searchJS' );
let list = '';
// external autocomplete
var req = phonon.ajax({
method: "GET",
url: 'https://restcountries.eu/rest/v1/lang/en',
dataType: "json",
success: function( res, xhr ){
list = res.map( function(i: any){
return i.name;
});
// initialize autocomplete
if (input) {
phonon.autocomplete( input, {list:list} );
}
},
error: function( res, flagError, xhr ){
console.error(flagError);
console.log(res);
}
});
});
});
phonon.navigator().start();
// Example from http://phonon.quarkdev.com/App/public/phonon/examples/components/dialogs-example/#!home
phonon.options({
navigator: {
defaultPage: 'home',
animatePages: true,
templateRootDirectory: 'contents/',
enableBrowserBackButton: true // should be disabled on Cordova
},
i18n: null
});
let app3 = phonon.navigator();
app3.on({page: 'home', content: null}, function(activity) {
activity.onCreate(function() {
let element = document.querySelector('#show-alert');
if (element) {
element.on('tap', function() {
phonon.alert('Example', 'Hello');
});
}
element = document.querySelector('#show-confirm');
if (element) {
element.on('tap', function() {
var confirm = phonon.confirm('Example', 'Hello');
confirm.on('confirm', function() {
phonon.alert('Confirmed!');
});
confirm.on('cancel', function(value) {
phonon.alert('Canceled!');
});
});
}
element = document.querySelector('#show-prompt');
if (element) {
element.on('tap', function() {
var prompt = phonon.prompt('Example', 'Hello');
prompt.on('confirm', function(value) {
phonon.alert(value, 'Inserted Value');
});
prompt.on('cancel', function() {
phonon.alert('Prompt Canceled');
});
});
}
element = document.querySelector('#show-indicator');
if (element) {
element.on('tap', function() {
var indicator = phonon.indicator('Please wait 3 seconds', false);
window.setTimeout(function() {
indicator.close();
},3000);
});
}
});
});
app3.start();
// Example from http://phonon.quarkdev.com/App/public/phonon/examples/components/i18n-example/#!home
let elPrefLang = document.querySelector('.pref-lang');
let elLang = document.querySelector('.locale-lang');
let elDefault = document.querySelector('.default-lang');
let elSetFr = document.querySelector('.set-fr');
let elSetEnGlobal = document.querySelector('.set-en-global');
let elSetEnUs = document.querySelector('.set-en-us');
let defaultLocale = 'fr';
function setupHTML() {
let pref = (phonon.i18n().getPreference() ? phonon.i18n().getPreference() : 'not used');
if (elPrefLang) {
elPrefLang.textContent = 'Preferred language : ' + pref;
}
if (elLang) {
elLang.textContent = 'Locale language : ' + phonon.i18n().getLocale();
}
if (elDefault) {
elDefault.textContent = 'Default language : ' + defaultLocale;
}
// The parameter is optional, if you pass nothing, i18n will bind all the document
phonon.i18n().bind();
}
var setPreference = function (evt: any) {
var target = evt.target;
var lang = target.getAttribute('data-l');
if(lang) {
phonon.updateLocale(lang);
}
};
if (elSetFr) {
elSetFr.on('click', setPreference);
}
if (elSetEnGlobal) {
elSetEnGlobal.on('click', setPreference);
}
if (elSetEnUs) {
elSetEnUs.on('click', setPreference);
}
phonon.options({
navigator: {
defaultPage: 'home',
},
i18n: {
directory: 'res/lang/',
localeFallback: defaultLocale,
localePreferred: 'en'
}
});
setupHTML();
phonon.navigator().start();
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"phonon-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for promised-temp 0.1
// Project: https://www.npmjs.com/package/promised-temp, https://github.com/mikaturunen/promised-temp
// Definitions by: Saqib Rokadia <https://github.com/rokadias>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import * as fs from 'fs';
import { AffixOptions, OpenFile, Stats } from "temp";
export { AffixOptions, OpenFile, Stats } from "temp";
interface TempStatic {
dir: string;
track(value?: boolean): TempStatic;
path(affixes?: string | AffixOptions, defaultPrefix?: string): string;
mkdir(affixes?: string | AffixOptions): Promise<string>;
open(affixes?: string | AffixOptions): Promise<OpenFile>;
cleanup(): Promise<boolean | Stats>;
createWriteStream(affixes?: string | AffixOptions): Promise<fs.WriteStream>;
}
declare var PromisedTemp: TempStatic;
export default PromisedTemp;
+6
View File
@@ -0,0 +1,6 @@
{
"dependencies": {
"@types/temp": "latest",
"@types/node": "latest"
}
}
+59
View File
@@ -0,0 +1,59 @@
/// <reference types="node" />
import * as fs from "fs";
import temp from 'promised-temp';
import { AffixOptions, OpenFile, Stats } from "promised-temp";
function testCleanup() {
temp.cleanup().then((result: boolean | Stats) => {
if (typeof result === "boolean") {
const x = result === true;
}
else {
const { files, dirs } = result;
files.toPrecision(4);
}
});
}
function testOpen() {
temp.open({ dir: "tempDir", prefix: "pref", suffix: "suff" }).then((result: OpenFile) => {
const { path, fd } = result;
path.length;
fd.toPrecision(5);
});
temp.open("strPrefix").then((result: OpenFile) => {
const { path, fd } = result;
path.length;
fd.toPrecision(5);
});
}
function testCreateWriteStream() {
const stream =
temp.createWriteStream("HelloStreamAffix")
.then((stream: fs.WriteStream) => stream.write("data"));
const stream2 = temp.createWriteStream();
}
function testMkdir() {
temp.mkdir("prefix").then((dirPath: string) => {
dirPath.length;
});
}
function testPath() {
const p = temp.path({ suffix: "justSuffix" }, "defaultPrefix");
p.length;
const p2: string = temp.path("prefix");
const p3: string = temp.path({ prefix: "prefix" });
}
function testTrack() {
const tempChained = temp.track().track(true).track(false);
tempChained.dir;
tempChained.cleanup();
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"promised-temp-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "../tslint.json"
}
+32
View File
@@ -0,0 +1,32 @@
// Type definitions for protractor-browser-logs 1.0
// Project: https://www.npmjs.com/package/protractor-browser-logs, https://github.com/wix/protractor-browser-logs
// Definitions by: Saqib Rokadia <https://github.com/rokadias>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as webdriver from 'selenium-webdriver';
import Entry = webdriver.logging.Entry;
import { ProtractorBrowser } from 'protractor/built';
interface BrowserLogOptions {
reporters?: Array<(entries: Entry[]) => void>;
}
type matchPredicateFunction = (entry: Entry) => boolean;
type matchPredicate = string | RegExp | matchPredicateFunction;
interface BrowserLogs {
ERROR: matchPredicateFunction;
WARNING: matchPredicateFunction;
DEBUG: matchPredicateFunction;
INFO: matchPredicateFunction;
LOG: matchPredicateFunction;
or(a: matchPredicateFunction, b: matchPredicateFunction): matchPredicateFunction;
and(a: matchPredicateFunction, b: matchPredicateFunction): matchPredicateFunction;
reset(): void;
logs(): Entry[];
verify(): void;
ignore(... matches: matchPredicate[]): matchPredicateFunction[];
expect(... matches: matchPredicate[]): matchPredicateFunction[];
}
export default function browserLogs(browser: ProtractorBrowser, options?: BrowserLogOptions): BrowserLogs;
+6
View File
@@ -0,0 +1,6 @@
{
"dependencies": {
"protractor": "latest",
"@types/selenium-webdriver": "latest"
}
}
@@ -0,0 +1,74 @@
import { browser } from 'protractor/built';
import browserLogs from 'protractor-browser-logs';
import * as webdriver from 'selenium-webdriver';
import Entry = webdriver.logging.Entry;
function colored(entries: Entry[]) {
let colors: any = { INFO: 35 /* magenta */, WARNING: 33 /* yellow */, SEVERE: 31 /* red */};
entries.forEach(function (entry: Entry) {
console.log('\u001b[' + (colors[entry.level.name] || 37) + 'm' + [entry.level.name, entry.message].join(': ') + '\u001b[39m');
});
}
function testCreateFunction() {
let logs = browserLogs(browser);
logs = browserLogs(browser, { reporters: [] });
logs = browserLogs(browser, { reporters: [ colored ] });
}
function testLogLevels() {
let logs = browserLogs(browser);
logs.ignore(logs.ERROR);
logs.expect(logs.WARNING);
logs.ignore(logs.DEBUG);
logs.expect(logs.INFO);
logs.ignore(logs.LOG);
}
function testPredicateFunctions() {
let logs = browserLogs(browser);
logs.ignore(logs.or(logs.ERROR, logs.WARNING));
logs.expect(logs.and(logs.DEBUG, logs.INFO));
}
function testRegExp() {
let logs = browserLogs(browser);
logs.ignore(/foo/i);
logs.expect(new RegExp('/foo/i'));
}
function testString() {
let logs = browserLogs(browser);
logs.ignore('foo');
logs.expect('foo');
}
function testMatchFunction() {
let logs = browserLogs(browser);
let filter = (entry: Entry) => entry.message === "foo";
logs.ignore(filter);
logs.expect(filter);
}
function testReset() {
let logs = browserLogs(browser);
logs.reset();
}
function testLogs() {
let logs = browserLogs(browser);
let entries: Entry[] = logs.logs();
}
function testVerify() {
let logs = browserLogs(browser);
logs.verify();
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"protractor-browser-logs-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "../tslint.json"
}
+9 -1
View File
@@ -5533,7 +5533,15 @@ declare module "react" {
* is false.
*/
keyboardShouldPersistTaps?: boolean
/**
* Called when scrollable content view of the ScrollView changes.
* Handler function is passed the content width and content height as parameters: (contentWidth, contentHeight)
* It's implemented using onLayout handler attached to the content container which this ScrollView renders.
*
*/
onContentSizeChange?: (w: number, h: number) => void
/**
* Fires at most once per frame during scrolling.
* The frequency of the events can be contolled using the scrollEventThrottle prop.
+4
View File
@@ -13,6 +13,10 @@
"typeRoots": [
"../"
],
"paths": {
"history": ["history/v3"],
"history/*": ["history/v3/*"]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
+2 -3
View File
@@ -5,8 +5,7 @@
// TypeScript Version: 2.1
import { Action, Middleware, Store } from "redux";
import { History } from "history";
import { Location, LocationDescriptor } from "react-router";
import { History, Location, LocationDescriptor } from "history";
export const CALL_HISTORY_METHOD: string;
export const LOCATION_CHANGE: string;
@@ -52,7 +51,7 @@ export interface SyncHistoryWithStoreOptions {
}
export interface HistoryUnsubscribe {
unsubscribe(): void;
unsubscribe(): undefined;
}
export function routerReducer(state?: RouterState, action?: Action): RouterState;
@@ -1,5 +1,5 @@
import { createStore, combineReducers, applyMiddleware } from 'redux';
import { createBrowserHistory } from 'history';
import { createHistory } from 'history';
import {
syncHistoryWithStore,
routerReducer,
@@ -15,7 +15,7 @@ import {
const reducer = combineReducers({ routing: routerReducer });
// Apply the middleware to the store
const browserHistory = createBrowserHistory()
const browserHistory = createHistory()
const middleware = routerMiddleware(browserHistory);
const store = createStore(
reducer,
+4
View File
@@ -12,6 +12,10 @@
"typeRoots": [
"../"
],
"paths": {
"history": ["history/v3"],
"history/*": ["history/v3/*"]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
+7 -9
View File
@@ -19,11 +19,11 @@ export const goForward: GoBackAction;
export const routeActions: RouteActions;
export type LocationDescriptor = History.LocationDescriptor;
export type PushAction = (nextLocation: LocationDescriptor) => void;
export type ReplaceAction = (nextLocation: LocationDescriptor) => void;
export type GoAction = (n: number) => void;
export type GoForwardAction = () => void;
export type GoBackAction = () => void;
export type PushAction = (nextLocation: LocationDescriptor) => any;
export type ReplaceAction = (nextLocation: LocationDescriptor) => any;
export type GoAction = (n: number) => any;
export type GoForwardAction = () => any;
export type GoBackAction = () => any;
export interface RouteActions {
push: PushAction;
@@ -34,11 +34,9 @@ export interface RouteActions {
}
export interface HistoryMiddleware extends Redux.Middleware {
listenForReplays(store: Redux.Store<any>, selectLocationState?: Function): void;
unsubscribe(): void;
listenForReplays(store: Redux.Store<any>, selectLocationState?: Function): undefined;
unsubscribe(): undefined;
}
export function routeReducer(state?: any, options?: any): Redux.Reducer<any>;
export function syncHistory(history: History.History): HistoryMiddleware;
@@ -1,11 +1,11 @@
import { createStore, combineReducers, applyMiddleware } from 'redux';
import { createBrowserHistory } from 'history';
import { createHistory } from 'history';
import { syncHistory, routeReducer } from 'react-router-redux';
const reducer = combineReducers({ routing: routeReducer });
// Sync dispatched route actions to the history
const browserHistory = createBrowserHistory()
const browserHistory = createHistory()
const reduxRouterMiddleware = syncHistory(browserHistory);
const createStoreWithMiddleware = applyMiddleware(reduxRouterMiddleware)(createStore);
+2 -1
View File
@@ -13,7 +13,8 @@
"../../"
],
"paths": {
"history": ["history/v2"],
"history": ["history/v3"],
"history/*": ["history/v3/*"],
"react-router-redux": ["react-router-redux/v3"]
},
"types": [],
+1 -18
View File
@@ -4,27 +4,11 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/* Replacement from old history definitions */
export interface HistoryOptions {
getCurrentLocation?(): Location;
getUserConfirmation?(message: string, callback: (result: boolean) => void): void;
pushLocation?(nextLocation: Location): void;
replaceLocation?(nextLocation: Location): void;
go?(n: number): void;
keyLength?: number;
}
export type CreateHistory<T> = (options?: HistoryOptions) => T;
export type CreateHistoryEnhancer<T> = (createHistory: CreateHistory<T>) => CreateHistory<T>;
export {
Basename,
ChangeHook,
EnterHook,
InjectedRouter,
LeaveHook,
Location,
LocationDescriptor,
ParseQueryString,
RouteComponent,
RouteComponents,
@@ -34,8 +18,7 @@ export {
RouterProps,
RouterState,
RedirectFunction,
StringifyQuery,
Query
StringifyQuery
} from "react-router/lib/Router";
export { LinkProps } from "react-router/lib/Link";
export { IndexLinkProps } from "react-router/lib/IndexLink";
+1 -1
View File
@@ -1,5 +1,5 @@
import { ComponentClass, CSSProperties, HTMLProps } from "react";
import { Location, LocationDescriptor } from "react-router/lib/Router";
import { Location, LocationDescriptor } from "history";
type ToLocationFunction = (location: Location) => LocationDescriptor;
+2 -1
View File
@@ -1,5 +1,6 @@
import { ComponentClass, ClassAttributes } from "react";
import { RoutePattern, Query } from "react-router";
import { RoutePattern } from "react-router";
import { Query } from "history";
export interface IndexRedirectProps extends ClassAttributes<any> {
to: RoutePattern;
+4 -4
View File
@@ -9,14 +9,14 @@ import {
RouterState
} from "react-router";
type ComponentCallback = (err: any, component: RouteComponent) => void;
type ComponentsCallback = (err: any, components: RouteComponents) => void;
type ComponentCallback = (err: any, component: RouteComponent) => any;
type ComponentsCallback = (err: any, components: RouteComponents) => any;
export interface IndexRouteProps {
component?: RouteComponent;
components?: RouteComponents;
getComponent?(nextState: RouterState, callback: ComponentCallback): void;
getComponents?(nextState: RouterState, callback: ComponentsCallback): void;
getComponent?(nextState: RouterState, callback: ComponentCallback): undefined;
getComponents?(nextState: RouterState, callback: ComponentsCallback): undefined;
onEnter?: EnterHook;
onChange?: ChangeHook;
onLeave?: LeaveHook;
+2 -1
View File
@@ -1,6 +1,7 @@
import { ComponentClass, ClassAttributes } from "react";
import { RoutePattern, Query } from "react-router";
import { RoutePattern } from "react-router";
import { IndexRedirectProps } from "react-router/lib/IndexRedirect";
import { Query } from "history";
export interface RedirectProps extends IndexRedirectProps {
from: RoutePattern;
+4 -4
View File
@@ -20,12 +20,12 @@ declare const Route: Route;
export default Route;
type RouteCallback = (err: any, route: PlainRoute) => void;
type RoutesCallback = (err: any, routesArray: PlainRoute[]) => void;
type RouteCallback = (err: any, route: PlainRoute) => any;
type RoutesCallback = (err: any, routesArray: PlainRoute[]) => any;
export interface PlainRoute extends RouteProps {
childRoutes?: PlainRoute[];
getChildRoutes?(partialNextState: LocationState, callback: RoutesCallback): void;
getChildRoutes?(partialNextState: LocationState, callback: RoutesCallback): undefined;
indexRoute?: PlainRoute;
getIndexRoute?(partialNextState: LocationState, callback: RouteCallback): void;
getIndexRoute?(partialNextState: LocationState, callback: RouteCallback): undefined;
}
+9 -28
View File
@@ -1,20 +1,19 @@
import { Component, ComponentClass, ClassAttributes, ReactNode, StatelessComponent } from "react";
import {
Action,
Hash,
History,
Href,
Location,
LocationDescriptor,
LocationKey,
LocationState,
Path,
Pathname,
Query,
Search
} from "history";
import { PlainRoute } from "react-router";
/* Replacement from old history definitions */
export type Basename = string;
export type Query = any;
export interface Params {
[key: string]: string;
}
@@ -36,27 +35,9 @@ export type LeaveHook = (prevState: RouterState) => any;
export type ChangeHook = (prevState: RouterState, nextState: RouterState, replace: RedirectFunction, callback?: AnyFunction) => any;
export type RouteHook = (nextLocation?: Location) => any;
export interface Location {
pathname: Pathname;
search: Search;
query: Query;
state: LocationState;
action: Action;
key: LocationKey;
}
export interface LocationDescriptorObject {
pathname?: Pathname;
query?: Query;
hash?: Hash;
state?: LocationState;
}
export type LocationDescriptor = Path | LocationDescriptorObject;
export interface RedirectFunction {
(location: LocationDescriptor): void;
(state: LocationState, pathname: Pathname | Path, query?: Query): void;
(location: LocationDescriptor): undefined;
(state: LocationState, pathname: Pathname | Path, query?: Query): undefined;
}
export interface RouterState {
@@ -66,11 +47,11 @@ export interface RouterState {
components: RouteComponent[];
}
type LocationFunction = (location: LocationDescriptor) => void;
type GoFunction = (n: number) => void;
type NavigateFunction = () => void;
type LocationFunction = (location: LocationDescriptor) => any;
type GoFunction = (n: number) => any;
type NavigateFunction = () => any;
type ActiveFunction = (location: LocationDescriptor, indexOnly?: boolean) => boolean;
type LeaveHookFunction = (route: any, callback: RouteHook) => void;
type LeaveHookFunction = (route: any, callback: RouteHook) => any;
type CreatePartFunction<Part> = (path: Path, query?: any) => Part;
export interface InjectedRouter {
+1 -5
View File
@@ -1,6 +1,2 @@
import { History } from "history";
import { CreateHistory } from "react-router";
declare const createMemoryHistory: CreateHistory<History>;
import { default as createMemoryHistory } from "history/lib/createMemoryHistory";
export default createMemoryHistory;
+4 -5
View File
@@ -1,5 +1,5 @@
import { History } from "history";
import { Basename, LocationDescriptor, ParseQueryString, RouteConfig, StringifyQuery } from "react-router";
import { Basename, History, LocationDescriptor } from "history";
import { ParseQueryString, RouteConfig, StringifyQuery } from "react-router";
interface MatchArgs {
routes: RouteConfig;
@@ -18,7 +18,6 @@ interface MatchHistoryArgs extends MatchArgs {
history: History;
}
export type MatchCallback = (error: any, redirectLocation: Location, renderProps: any) => void;
export default function match(args: MatchLocationArgs | MatchHistoryArgs, cb: MatchCallback): void;
export type MatchCallback = (error: any, redirectLocation: Location, renderProps: any) => any;
export default function match(args: MatchLocationArgs | MatchHistoryArgs, cb: MatchCallback): undefined;
+2 -5
View File
@@ -1,6 +1,3 @@
import { History } from "history";
import { CreateHistoryEnhancer } from "react-router";
import { CreateHistory, HistoryBasename, HistoryBasenameOptions, HistoryQueries } from "history";
declare const useRouterHistory: CreateHistoryEnhancer<History>;
export default useRouterHistory;
export default function useRouterHistory<O, H>(createHistory: CreateHistory<O, H>): CreateHistory<O & HistoryBasenameOptions, H & HistoryBasename & HistoryQueries>;
+31
View File
@@ -9,6 +9,7 @@ import {
hashHistory,
match,
createMemoryHistory,
useRouterHistory,
withRouter,
routerShape,
Router,
@@ -21,6 +22,24 @@ import {
RedirectFunction,
RouteComponentProps
} from "react-router";
import { createHistory, History } from "history";
const routerHistory = useRouterHistory(createHistory)({ basename: "/test" })
interface CustomHistory {
test(): undefined;
}
type CombinedHistory = History & CustomHistory
function createCustomHistory(history: History): CombinedHistory {
return {
...history,
test() {}
} as CombinedHistory
}
const customHistory = createCustomHistory(browserHistory)
const NavLink = (props: LinkProps) => (
<Link {...props} activeClassName="active" />
@@ -118,6 +137,18 @@ ReactDOM.render((
</Router>
), document.body)
ReactDOM.render((
<Router history={ routerHistory }>
<Route path="/" component={Master} />
</Router>
), document.body)
ReactDOM.render((
<Router history={ customHistory }>
<Route path="/" component={Master} />
</Router>
), document.body)
const history = createMemoryHistory("baseurl");
const routes = (
+4
View File
@@ -11,6 +11,10 @@
"jsx": "react",
"baseUrl": "../",
"typeRoots": ["../"],
"paths": {
"history": ["history/v3"],
"history/*": ["history/v3/*"]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
+1
View File
@@ -22,6 +22,7 @@
/// <reference path="three-vreffect.d.ts" />
/// <reference path="three-ctmloader.d.ts" />
/// <reference path="three-octree.d.ts" />
/// <reference path="three-colladaLoader.d.ts" />
declare namespace THREE {
export const REVISION: string;
+23
View File
@@ -0,0 +1,23 @@
// Type definitions for three.js (ColladaLoader2.js)
// NOTE : These typings are for the loader named ColladaLoader2.js
// supplied by the npm package @types/three 0.81.
// Definitions by: Brandon Roberge
declare namespace THREE {
export interface ColladaLoaderReturnType {
}
export class ColladaModel {
animations: any[];
kinematics: any;
scene: THREE.Scene;
library: any;
}
export class ColladaLoader {
constructor();
load(url: string, onLoad: (model: ColladaModel) => void, onProgress?: (request: ProgressEvent) => void, onError?:(event: ErrorEvent) => void): void;
setCrossOrigin(value: any): void;
parse(text: string): ColladaModel;
}
}