mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge branch 'master' into feature/extend-merge-stream
This commit is contained in:
+12
-17
@@ -1,13 +1,13 @@
|
||||
import acorn = require('acorn');
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
declare var token: acorn.Token;
|
||||
declare var tokens: acorn.Token[];
|
||||
declare var comment: acorn.Comment;
|
||||
declare var comments: acorn.Comment[];
|
||||
declare var program: ESTree.Program;
|
||||
var any: any;
|
||||
var string: string;
|
||||
declare let token: acorn.Token;
|
||||
declare let tokens: acorn.Token[];
|
||||
declare let comment: acorn.Comment;
|
||||
declare let comments: acorn.Comment[];
|
||||
declare let program: ESTree.Program;
|
||||
let any: any;
|
||||
let string: string;
|
||||
|
||||
// acorn
|
||||
string = acorn.version;
|
||||
@@ -32,16 +32,12 @@ const parser = new acorn.Parser({}, 'export default ""', 0);
|
||||
const node = new acorn.Node(parser, 1, 1);
|
||||
|
||||
class LooseParser {
|
||||
constructor(input: string, options = {}) {
|
||||
|
||||
}
|
||||
constructor(input: string, options = {}) {}
|
||||
|
||||
// this means you can extend LooseParser
|
||||
test() {
|
||||
|
||||
}
|
||||
test() {}
|
||||
}
|
||||
acorn.addLooseExports(function () {
|
||||
acorn.addLooseExports(() => {
|
||||
return {
|
||||
type: 'Program',
|
||||
sourceType: 'script',
|
||||
@@ -50,7 +46,7 @@ acorn.addLooseExports(function () {
|
||||
type: 'EmptyStatement'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
}, LooseParser, {});
|
||||
|
||||
acorn.parseExpressionAt('string', 2);
|
||||
@@ -63,8 +59,7 @@ acorn.isIdentifierChar(56);
|
||||
|
||||
acorn.getLineInfo('string', 56);
|
||||
|
||||
acorn.plugins['test'] = function (p: acorn.Parser, config: any) {
|
||||
}
|
||||
acorn.plugins['test'] = (p: acorn.Parser, config: any) => {};
|
||||
|
||||
acorn.tokenizer('console.log("hello world)', {locations: true}).getToken();
|
||||
acorn.tokenizer('console.log("hello world)', {locations: true})[Symbol.iterator]().next();
|
||||
|
||||
Vendored
+9
-14
@@ -1,10 +1,8 @@
|
||||
// Type definitions for Acorn v4.0.3
|
||||
// Type definitions for Acorn 4.0
|
||||
// Project: https://github.com/marijnh/acorn
|
||||
// Definitions by: RReverser <https://github.com/RReverser>, e-cloud <https://github.com/e-cloud>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="estree" />
|
||||
|
||||
export as namespace acorn;
|
||||
export = acorn;
|
||||
import * as ESTree from 'estree';
|
||||
@@ -181,7 +179,7 @@ declare namespace acorn {
|
||||
_typeof: TokenType;
|
||||
_void: TokenType;
|
||||
_delete: TokenType;
|
||||
}
|
||||
};
|
||||
|
||||
class TokContext {
|
||||
constructor(token: string, isExpr: boolean, preserveSpace: boolean, override: (p: Parser) => void);
|
||||
@@ -230,19 +228,18 @@ declare namespace acorn {
|
||||
|
||||
const version: string;
|
||||
|
||||
interface IParse {
|
||||
(input: string, options?: Options): ESTree.Program;
|
||||
}
|
||||
// TODO: rename type.
|
||||
type IParse = (input: string, options?: Options) => ESTree.Program;
|
||||
|
||||
const parse: IParse;
|
||||
|
||||
function parseExpressionAt(input: string, pos?: number, options?: Options): ESTree.Expression;
|
||||
|
||||
interface ITokenizer {
|
||||
getToken() : Token,
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
getToken(): Token;
|
||||
[Symbol.iterator](): Iterator<Token>;
|
||||
}
|
||||
|
||||
|
||||
function tokenizer(input: string, options: Options): ITokenizer;
|
||||
|
||||
let parse_dammit: IParse | undefined;
|
||||
@@ -250,12 +247,10 @@ declare namespace acorn {
|
||||
let pluginsLoose: PluginsObject | undefined;
|
||||
|
||||
interface ILooseParserClass {
|
||||
new (input: string, options?: Options): ILooseParser
|
||||
new (input: string, options?: Options): ILooseParser;
|
||||
}
|
||||
|
||||
interface ILooseParser {
|
||||
|
||||
}
|
||||
interface ILooseParser {}
|
||||
|
||||
function addLooseExports(parse: IParse, parser: ILooseParserClass, plugins: PluginsObject): void;
|
||||
}
|
||||
|
||||
+1
-71
@@ -1,79 +1,9 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"no-unnecessary-class": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-2
@@ -1,7 +1,6 @@
|
||||
// Type definitions for Angulartics 1.4
|
||||
// Project: http://luisfarzati.github.io/angulartics/
|
||||
// Definitions by: Steven Fan <https://github.com/stevenfan>
|
||||
// Bateast2 <https://github.com/bateast2>
|
||||
// Definitions by: Bateast2 <https://github.com/bateast2>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -978,7 +978,7 @@ declare namespace cytoscape {
|
||||
* An analogue to run a layout on a subset of the graph exists as eles.layout().
|
||||
* http://js.cytoscape.org/#cy.layout
|
||||
*/
|
||||
layout(layout: LayoutOptions): void;
|
||||
layout(layout: LayoutOptions): LayoutManipulation;
|
||||
/**
|
||||
* Get a new layout, which can be used to algorithmically
|
||||
* position the nodes in the graph.
|
||||
@@ -991,7 +991,7 @@ declare namespace cytoscape {
|
||||
* Note that you must call layout.run() in order for it to affect the graph.
|
||||
* An analogue to make a layout on a subset of the graph exists as eles.makeLayout().
|
||||
*/
|
||||
makeLayout(options: LayoutOptions): void;
|
||||
makeLayout(options: LayoutOptions): LayoutManipulation;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,9 @@ import {
|
||||
Dms,
|
||||
Vector3d,
|
||||
OsGridRef,
|
||||
LatLonEllipsoidal as LatLon, LatLonSpherical } from 'geodesy';
|
||||
LatLonEllipsoidal as LatLon, LatLonSpherical,
|
||||
LatLonVectors
|
||||
} from 'geodesy';
|
||||
|
||||
/**
|
||||
* Mgrs
|
||||
@@ -165,3 +167,38 @@ LatLonSpherical.crossingParallels(point1, point2, 30);
|
||||
const polygon = [new LatLonSpherical(0, 0), new LatLonSpherical(1, 0), new LatLonSpherical(0, 1)];
|
||||
LatLonSpherical.areaOf(polygon); // 6.18e9 m²
|
||||
LatLonSpherical.areaOf(polygon, 6371e3); // 6.18e9 m²
|
||||
|
||||
/**
|
||||
* LatLonVectors
|
||||
*/
|
||||
const point3 = new LatLonVectors(49.78846, -97.44306);
|
||||
const point4 = new LatLonVectors(49.79822, -97.4592);
|
||||
const point5 = new LatLonVectors(49.7981, -97.41371);
|
||||
const point6 = new LatLonVectors(49.76851, -97.41371);
|
||||
const point7 = new LatLonVectors(49.76873, -97.45954);
|
||||
const point8 = new LatLonVectors(49.78846, -97.44306);
|
||||
point3.toVector(); // Vector3d { x: -0.08363305717526297, y: -0.6401716454146233, z: 0.7636660108677438 }
|
||||
point3.greatCircle(45); // Vector3d { x: -0.6311975610221534, y: 0.6270426835846277, z: 0.45651627782881243 }
|
||||
point3.distanceTo(point4, 6371e3); // 1587.463492544562 m
|
||||
point3.bearingTo(point4); // 313.1353494923952 deg
|
||||
point3.midpointTo(point4); // LatLon { lat: 49.79334028019261, lon: -97.45112918683637 }
|
||||
point3.intermediatePointTo(point4, 0.25); // LatLon { lat: 49.79090021013134, lon: -97.44709439015365 }
|
||||
point3.intermediatePointOnChordTo(point4, 0.5); // LatLon { lat: 49.7933402801926, lon: -97.45112918683637 }
|
||||
point3.destinationPoint(100, 0, 6371e3); // LatLon { lat: 49.78935932160593, lon: -97.44306000000003 }
|
||||
point3.crossTrackDistanceTo(point4, point5, 6371e3); // 1080.7461902301488 m
|
||||
point3.crossTrackDistanceTo(point4, 60, 6371e3); // 1519.091945034438 m
|
||||
point3.alongTrackDistanceTo(point4, point5, 6371e3); // 1162.7673995854138 m
|
||||
point3.alongTrackDistanceTo(point4, 60, 6371e3); // 460.86875216457025 m
|
||||
point3.nearestPointOnSegment(point4, point5); // LatLon { lat: 49.79817930627353, lon: -97.44299978937423 }
|
||||
point3.isBetween(point4, point5); // true
|
||||
|
||||
const boundary = [point4, point5, point6, point7];
|
||||
point3.enclosedBy(boundary); // true
|
||||
point3.equals(point4); // false
|
||||
point3.equals(point8); // true
|
||||
point3.toString('dms', 3); // 49°47′18.456″N, 097°26′35.016″W
|
||||
|
||||
// Static functions
|
||||
LatLonVectors.intersection(point4, point5, point3, 1); // LatLon { lat: 49.7981787830497, lon: -97.44279718554108 }
|
||||
LatLonVectors.areaOf(boundary, 6371e3); // 10768180.94129682 m^2
|
||||
LatLonVectors.meanOf(boundary); // LatLon { lat: 49.783392242641824, lon: -97.43653998581752 }
|
||||
|
||||
Vendored
+26
-1
@@ -1,7 +1,8 @@
|
||||
// Type definitions for geodesy 1.1
|
||||
// Type definitions for geodesy 1.2
|
||||
// Project: https://github.com/chrisveness/geodesy
|
||||
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
|
||||
// Gilbert Handy <https://github.com/HandyG52>
|
||||
// Harry Nicholls <https://github.com/excelulous>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export type format = 'd' | 'dm' | 'dms';
|
||||
@@ -168,3 +169,27 @@ export class LatLonSpherical {
|
||||
static areaOf(polygon: LatLonSpherical[], radius?: number): number;
|
||||
toString(format?: string, dp?: number): string;
|
||||
}
|
||||
|
||||
export class LatLonVectors {
|
||||
lat: number;
|
||||
lon: number;
|
||||
constructor(lat: number, lon: number);
|
||||
toVector(): Vector3d;
|
||||
greatCircle(bearing: number): Vector3d;
|
||||
distanceTo(point: LatLonVectors, radius?: number): number;
|
||||
bearingTo(point: LatLonVectors): number;
|
||||
midpointTo(point: LatLonVectors): number;
|
||||
intermediatePointTo(point: LatLonVectors, fraction: number): LatLonVectors;
|
||||
intermediatePointOnChordTo(point: LatLonVectors, fraction: number): LatLonVectors;
|
||||
destinationPoint(distance: number, bearing: number, radius?: number): LatLonVectors;
|
||||
static intersection(path1start: LatLonVectors, path1brngEnd: LatLonVectors | number, path2start: LatLonVectors, path2brngEnd: LatLonVectors | number): LatLonVectors;
|
||||
crossTrackDistanceTo(pathStart: LatLonVectors, pathBrngEnd: LatLonVectors | number, radius?: number): number;
|
||||
alongTrackDistanceTo(pathStart: LatLonVectors, pathBrngEnd: LatLonVectors | number, radius?: number): number;
|
||||
nearestPointOnSegment(point1: LatLonVectors, point2: LatLonVectors): LatLonVectors;
|
||||
isBetween(point1: LatLonVectors, point2: LatLonVectors): boolean;
|
||||
enclosedBy(polygon: LatLonVectors[]): boolean;
|
||||
static areaOf(polygon: LatLonVectors[], radius?: number): number;
|
||||
static meanOf(points: ReadonlyArray<LatLonVectors>): LatLonVectors;
|
||||
equals(point: LatLonVectors): boolean;
|
||||
toString(format?: string, dp?: number): string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import guid = require('guid');
|
||||
|
||||
// $ExpectType object
|
||||
guid.create();
|
||||
|
||||
// $ExpectType string
|
||||
guid.raw();
|
||||
|
||||
const newRawGuid = guid.raw();
|
||||
|
||||
// $ExpectType boolean
|
||||
guid.isGuid(newRawGuid);
|
||||
|
||||
// $ExpectType string
|
||||
guid.EMPTY;
|
||||
|
||||
// $ExpectType object
|
||||
guid(guid.create());
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// Type definitions for guid 1.0
|
||||
// Project: https://github.com/dandean/guid
|
||||
// Definitions by: Marc-Andre Roy <https://github.com/maroy1986>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export = guid;
|
||||
|
||||
declare function guid(guid: object): object;
|
||||
|
||||
declare namespace guid {
|
||||
const EMPTY: string;
|
||||
|
||||
const prototype: {
|
||||
};
|
||||
|
||||
function create(): object;
|
||||
|
||||
function isGuid(value: string): boolean;
|
||||
|
||||
function raw(): string;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"guid-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+486
@@ -0,0 +1,486 @@
|
||||
// Type definitions for iota.lib.js 0.4
|
||||
// Project: https://github.com/iotaledger/iota.lib.js
|
||||
// Definitions by: Fogsh <https://github.com/fogsh>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class IotaClass {
|
||||
constructor(settings: {
|
||||
provider: string;
|
||||
sandbox?: boolean;
|
||||
token?: boolean;
|
||||
} | {
|
||||
host: string;
|
||||
port: number;
|
||||
sandbox?: boolean;
|
||||
token?: boolean;
|
||||
});
|
||||
|
||||
api: IotaApi;
|
||||
utils: IotaUtils;
|
||||
multisig: IotaMultisig;
|
||||
valid: IotaValid;
|
||||
|
||||
version: string;
|
||||
}
|
||||
|
||||
export = IotaClass;
|
||||
|
||||
//
|
||||
// Types
|
||||
//
|
||||
|
||||
type Security = 1 | 2 | 3;
|
||||
type IOTAUnit = "i" | "Ki" | "Mi" | "Gi" | "Ti" | "Pi";
|
||||
|
||||
//
|
||||
// Objects
|
||||
//
|
||||
|
||||
interface TransactionObject {
|
||||
hash: string;
|
||||
signatureMessageFragment: string;
|
||||
address: string;
|
||||
value: number;
|
||||
tag: string;
|
||||
timestamp: number;
|
||||
currentIndex: number;
|
||||
lastIndex: number;
|
||||
bundle: number;
|
||||
trunkTransaction: string;
|
||||
branchTransaction: string;
|
||||
attachmentTimestamp: number;
|
||||
attachmentTimestampLowerBound: number;
|
||||
attachmentTimestampUpperBound: number;
|
||||
nonce: string;
|
||||
}
|
||||
|
||||
interface InputObject {
|
||||
address: string;
|
||||
balance: number;
|
||||
keyIndex: number;
|
||||
security: Security;
|
||||
}
|
||||
|
||||
interface TransferObject {
|
||||
address: string;
|
||||
value: number;
|
||||
message: string;
|
||||
tag: string;
|
||||
}
|
||||
|
||||
interface NodeInfo {
|
||||
appName: string;
|
||||
appVersion: string;
|
||||
duration: number;
|
||||
jreAvailableProcessors: number;
|
||||
jreFreeMemory: number;
|
||||
jreVersion: string;
|
||||
jreMaxMemory: number;
|
||||
jreTotalMemory: number;
|
||||
latestMilestone: string;
|
||||
latestMilestoneIndex: number;
|
||||
latestSolidSubtangleMilestone: string;
|
||||
latestSolidSubtangleMilestoneIndex: number;
|
||||
neighbors: number;
|
||||
packetsQueueSize: number;
|
||||
time: number;
|
||||
tips: number;
|
||||
transactionsToRequest: number;
|
||||
}
|
||||
|
||||
interface Neighbor {
|
||||
address: string;
|
||||
numberOfAllTransactions: number;
|
||||
numberOfRandomTransactionRequests: number;
|
||||
numberOfInvalidTransactions: number;
|
||||
numberOfSentTransactions: number;
|
||||
numberOfNewTransactions: number;
|
||||
connectionType: "udp" | "tcp";
|
||||
}
|
||||
|
||||
//
|
||||
// iota.api
|
||||
//
|
||||
|
||||
interface IriApi {
|
||||
getNodeInfo(
|
||||
callback: (error: Error, info: NodeInfo) => void
|
||||
): void;
|
||||
|
||||
getNeighbors(
|
||||
callback: (error: Error, neighbors: Neighbor[]) => void
|
||||
): void;
|
||||
|
||||
addNeighbors(
|
||||
uris: string[],
|
||||
callback: (error: Error, addedNeighbors: number) => void
|
||||
): void;
|
||||
|
||||
removeNeighbors(
|
||||
uris: string[],
|
||||
callback: (error: Error, removedNeighbors: number[]) => void
|
||||
): void;
|
||||
|
||||
getTips(
|
||||
callback: (error: Error, hashes: string[]) => void
|
||||
): void;
|
||||
|
||||
findTransactions(
|
||||
searchValues: {
|
||||
addresses?: string[]
|
||||
bundles?: string[]
|
||||
tags?: string[]
|
||||
approvees?: string[]
|
||||
},
|
||||
callback: (error: Error, hashes: string[]) => void
|
||||
): void;
|
||||
|
||||
getTrytes(
|
||||
hashes: string[],
|
||||
callback: (error: Error, trytes: string[]) => void
|
||||
): void;
|
||||
|
||||
getInclusionStates(
|
||||
transactions: string[],
|
||||
tips: string[],
|
||||
callback: (error: Error, states: boolean[]) => void
|
||||
): void;
|
||||
|
||||
getBalances(
|
||||
addresses: string[],
|
||||
treshold: number,
|
||||
callback: (error: Error, response: {
|
||||
balances: number[]
|
||||
milestone: string;
|
||||
milestoneIndex: number;
|
||||
duration: number;
|
||||
}) => void
|
||||
): void;
|
||||
|
||||
getTransactionsToApprove(
|
||||
depth: number,
|
||||
callback: (error: Error, response: {
|
||||
trunkTransaction: string;
|
||||
branchTransaction: string;
|
||||
duration: number;
|
||||
}) => void
|
||||
): void;
|
||||
|
||||
attachToTangle(
|
||||
trunkTransaction: string,
|
||||
branchTransaction: string,
|
||||
minWeightMagnitude: number,
|
||||
trytes: string[],
|
||||
callback: (error: Error, trytes: string[]) => void
|
||||
): void;
|
||||
|
||||
interruptAttachingToTangle(
|
||||
callback: (error: Error, response: {}) => void
|
||||
): void;
|
||||
|
||||
broadcastTransactions(
|
||||
trytes: string[],
|
||||
callback: (error: Error, response: {}) => void
|
||||
): void;
|
||||
|
||||
storeTransactions(
|
||||
trytes: string[],
|
||||
callback: (error: Error, response: {}) => void
|
||||
): void;
|
||||
}
|
||||
|
||||
//
|
||||
// iota.api
|
||||
//
|
||||
|
||||
interface IotaApi extends IriApi {
|
||||
getTransactionsObjects(
|
||||
hashes: string[],
|
||||
callback?: (error: Error, transactions: TransactionObject[]) => void
|
||||
): void;
|
||||
|
||||
findTransactionObjects(
|
||||
searchValues: {
|
||||
addresses?: string[]
|
||||
bundles?: string[]
|
||||
tags?: string[]
|
||||
approvees?: string[]
|
||||
},
|
||||
callback?: (error: Error, transactions: TransactionObject[]) => void
|
||||
): void;
|
||||
|
||||
getLatestInclusion(
|
||||
hashes: string[],
|
||||
callback?: (error: Error, states: boolean[]) => void
|
||||
): void;
|
||||
|
||||
broadcastAndStore(
|
||||
trytes: string[],
|
||||
callback?: (error: Error, response: {}) => void
|
||||
): void;
|
||||
|
||||
getNewAddress(
|
||||
seed: string,
|
||||
options?: {
|
||||
index?: number;
|
||||
checksum?: boolean;
|
||||
total?: number;
|
||||
security?: Security
|
||||
returnAll?: boolean;
|
||||
},
|
||||
callback?: (error: Error, response: string | string[]) => void
|
||||
): void;
|
||||
|
||||
getInputs(
|
||||
seed: string,
|
||||
options?: {
|
||||
start?: number;
|
||||
end?: number;
|
||||
security?: Security
|
||||
threshold?: boolean;
|
||||
},
|
||||
callback?: (error: Error, response: {
|
||||
inputs: InputObject[]
|
||||
}) => void
|
||||
): void;
|
||||
|
||||
prepareTransfers(
|
||||
seed: string,
|
||||
transfers: TransferObject[],
|
||||
options?: {
|
||||
inputs?: string[],
|
||||
address?: string,
|
||||
security?: Security
|
||||
},
|
||||
callback?: (error: Error, response: {
|
||||
trytes: string[]
|
||||
}) => void
|
||||
): void;
|
||||
|
||||
sendTrytes(
|
||||
trytes: string[],
|
||||
depth: number,
|
||||
minWeightMagnitude: number,
|
||||
callback?: (error: Error, response: {
|
||||
inputs: TransactionObject[]
|
||||
}) => void
|
||||
): void;
|
||||
|
||||
sendTransfer(
|
||||
seed: string,
|
||||
depth: number,
|
||||
minWeightMagnitude: number,
|
||||
transfers: TransferObject[],
|
||||
options?: {
|
||||
inputs: string[],
|
||||
address: string;
|
||||
},
|
||||
callback?: (error: Error, response: {
|
||||
inputs: TransactionObject[]
|
||||
}) => void
|
||||
): void;
|
||||
|
||||
replayBundle(
|
||||
transactionHash: string,
|
||||
depth: number,
|
||||
minWeightMagnitude: number,
|
||||
callback?: (error: Error, response: {}) => void
|
||||
): void;
|
||||
|
||||
broadcastBundle(
|
||||
transactionHash: string,
|
||||
callback?: (error: Error, response: {}) => void
|
||||
): void;
|
||||
|
||||
getBundle(
|
||||
transactionHash: string,
|
||||
callback?: (error: Error, bundle: TransactionObject[]) => void
|
||||
): void;
|
||||
|
||||
getTransfers(
|
||||
seed: string,
|
||||
options?: {
|
||||
start?: number;
|
||||
end?: number;
|
||||
security?: Security
|
||||
inclusionStates?: boolean;
|
||||
},
|
||||
callback?: (error: Error, transfers: TransactionObject[][]) => void
|
||||
): void;
|
||||
|
||||
getAccountData(
|
||||
seed: string,
|
||||
options?: {
|
||||
start: number;
|
||||
end: number;
|
||||
security?: Security
|
||||
},
|
||||
callback?: (error: Error, response: {
|
||||
latestAddress: string;
|
||||
addresses: string[]
|
||||
transfers: string[]
|
||||
inputs: InputObject[]
|
||||
balance: number;
|
||||
}) => void
|
||||
): void;
|
||||
|
||||
isReattachable(
|
||||
address: string | string[],
|
||||
callback?: (error: Error, response: boolean | boolean[]) => void
|
||||
): void;
|
||||
}
|
||||
|
||||
//
|
||||
// iota.utils
|
||||
//
|
||||
|
||||
interface IotaUtils {
|
||||
convertUnits(
|
||||
value: number,
|
||||
fromUnit: IOTAUnit,
|
||||
toUnit: IOTAUnit
|
||||
): number;
|
||||
|
||||
addChecksum(
|
||||
inputValue: string,
|
||||
checksumLength?: number,
|
||||
isAddress?: boolean
|
||||
): string;
|
||||
|
||||
addChecksum(
|
||||
inputValue: string[],
|
||||
checksumLength?: number,
|
||||
isAddress?: boolean
|
||||
): string[];
|
||||
|
||||
noChecksum(
|
||||
address: string
|
||||
): string;
|
||||
|
||||
isValidChecksum(
|
||||
addressWithChecksum: string
|
||||
): boolean;
|
||||
|
||||
transactionObject(
|
||||
trytes: string
|
||||
): TransactionObject;
|
||||
|
||||
transactionTrytes(
|
||||
transaction: TransactionObject
|
||||
): string;
|
||||
|
||||
categorizeTransfers(
|
||||
transfers: TransactionObject[],
|
||||
addresses: string[]
|
||||
): {
|
||||
sent: TransactionObject[]
|
||||
received: TransactionObject[]
|
||||
};
|
||||
|
||||
toTrytes(
|
||||
input: string
|
||||
): string;
|
||||
|
||||
fromTrytes(
|
||||
trytes: string
|
||||
): string;
|
||||
|
||||
extractJson(
|
||||
bundle: TransactionObject[]
|
||||
): string;
|
||||
|
||||
validateSignatures(
|
||||
signedBundle: string[],
|
||||
inputAddress: string
|
||||
): boolean;
|
||||
|
||||
isBundle(
|
||||
bundle: TransactionObject[]
|
||||
): boolean;
|
||||
}
|
||||
|
||||
//
|
||||
// iota.multisig
|
||||
//
|
||||
|
||||
interface IotaMultisig {
|
||||
getKey(
|
||||
seed: string,
|
||||
index: number,
|
||||
security: Security
|
||||
): string;
|
||||
|
||||
getDigest(
|
||||
seed: string,
|
||||
index: number,
|
||||
security: Security
|
||||
): string;
|
||||
|
||||
address(
|
||||
digestTrytes: string | string[]
|
||||
): MultisigAddress;
|
||||
|
||||
validateAddress(
|
||||
multisigAddress: string,
|
||||
digests: string[]
|
||||
): boolean;
|
||||
|
||||
initiateTransfer(
|
||||
securitySum: number,
|
||||
inputAddress: string,
|
||||
remainderAddress: string,
|
||||
transfers: TransferObject[],
|
||||
callback?: (error: Error, bundle: TransactionObject[]) => void
|
||||
): void;
|
||||
|
||||
addSignature(
|
||||
bundleToSign: TransactionObject[],
|
||||
inputAddress: string,
|
||||
key: string,
|
||||
callback?: (error: Error, bundle: TransactionObject[]) => void
|
||||
): void;
|
||||
}
|
||||
|
||||
interface MultisigAddress {
|
||||
absorb(
|
||||
digest: string | string[]
|
||||
): MultisigAddress;
|
||||
|
||||
finalize(): string;
|
||||
}
|
||||
|
||||
//
|
||||
// iota.valid
|
||||
//
|
||||
|
||||
interface IotaValid {
|
||||
isAddress(address: string): boolean;
|
||||
|
||||
isTrytes(trytes: string, length?: number): boolean;
|
||||
|
||||
isValue(value: any): boolean;
|
||||
|
||||
isNum(value: any): boolean;
|
||||
|
||||
isHash(hash: any): boolean;
|
||||
|
||||
isTransfersArray(transfers: any): boolean;
|
||||
|
||||
isArrayOfHashes(hashes: any): boolean;
|
||||
|
||||
isArrayOfTrytes(trytes: any): boolean;
|
||||
|
||||
isArrayOfAttachedTrytes(trytes: any): boolean;
|
||||
|
||||
isArrayOfTxObjects(transactions: any): boolean;
|
||||
|
||||
isInputs(inputs: any): boolean;
|
||||
|
||||
isString(string: any): boolean;
|
||||
|
||||
isArray(array: any): boolean;
|
||||
|
||||
isObject(object: any): boolean;
|
||||
|
||||
isUri(uri: any): boolean;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import IOTA = require("iota.lib.js");
|
||||
|
||||
const config = {
|
||||
node: "https://localhost:14265",
|
||||
address: "999999999999999999999999999999999999999999999999999999999999999999999999999999999",
|
||||
transaction: "999999999999999999999999999999999999999999999999999999999999999999999999999999999"
|
||||
};
|
||||
|
||||
const iota = new IOTA({
|
||||
provider: config.node
|
||||
});
|
||||
|
||||
//
|
||||
// iota.api
|
||||
//
|
||||
|
||||
iota.api.getNodeInfo((error, info) => {
|
||||
});
|
||||
|
||||
iota.api.getNeighbors((error, info) => {
|
||||
});
|
||||
|
||||
iota.api.addNeighbors(["udp://127.0.0.2:14600"], (error, count) => {
|
||||
});
|
||||
|
||||
iota.api.removeNeighbors(["udp://127.0.0.2:14600"], (error, count) => {
|
||||
});
|
||||
|
||||
iota.api.findTransactions({
|
||||
addresses: [config.address]
|
||||
}, (error, hashes) => {
|
||||
});
|
||||
|
||||
iota.api.getTrytes([config.address], (error, trytes) => {
|
||||
});
|
||||
|
||||
iota.api.getInclusionStates([config.address], [config.transaction], (error, states) => {
|
||||
});
|
||||
|
||||
iota.api.getBalances([config.address], 1, (error, states) => {
|
||||
});
|
||||
|
||||
iota.api.getTransactionsToApprove(1, (error, transactions) => {
|
||||
});
|
||||
|
||||
iota.api.getTransactionsObjects([config.transaction], (err, response) => {
|
||||
});
|
||||
|
||||
iota.api.findTransactionObjects({
|
||||
addresses: [config.address]
|
||||
}, (err, response) => {
|
||||
});
|
||||
|
||||
iota.api.getLatestInclusion([config.address], (err, response) => {
|
||||
});
|
||||
|
||||
//
|
||||
// iota.utils
|
||||
//
|
||||
|
||||
iota.utils.convertUnits(1000, "i", "Mi");
|
||||
|
||||
const checksum = iota.utils.addChecksum(config.address);
|
||||
iota.utils.noChecksum(checksum);
|
||||
iota.utils.isValidChecksum(checksum);
|
||||
|
||||
const transactionObj = iota.utils.transactionObject(new Array(2674).join("9"));
|
||||
iota.utils.transactionTrytes(transactionObj);
|
||||
|
||||
const trytes = iota.utils.toTrytes("HELLO TANGLE");
|
||||
iota.utils.fromTrytes(trytes);
|
||||
|
||||
//
|
||||
// iota.valid
|
||||
//
|
||||
|
||||
iota.valid.isAddress(config.address);
|
||||
|
||||
iota.valid.isTrytes(trytes);
|
||||
|
||||
iota.valid.isValue(0);
|
||||
|
||||
iota.valid.isNum(0);
|
||||
|
||||
iota.valid.isHash(config.address);
|
||||
|
||||
const transferObj = {
|
||||
address: config.address,
|
||||
message: "",
|
||||
value: 0,
|
||||
tag: ""
|
||||
};
|
||||
|
||||
iota.valid.isTransfersArray([transferObj]);
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"iota.lib.js-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+58
@@ -0,0 +1,58 @@
|
||||
// Type definitions for json-query 2.2
|
||||
// Project: http://github.com/mmckegg/json-query#readme
|
||||
// Definitions by: Matt Traynham <https://github.com/mtraynham>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = JsonQuery;
|
||||
|
||||
declare function JsonQuery(
|
||||
selector: JsonQuery.Selector | JsonQuery.SelectorWithQueryParams,
|
||||
options: JsonQuery.Options
|
||||
): JsonQuery.Result;
|
||||
|
||||
declare namespace JsonQuery {
|
||||
type Selector = string;
|
||||
|
||||
type QueryParam = any;
|
||||
// No way to support [Selector, ...QueryParam[]]?
|
||||
// 10 params should be more than enough, hopefully.
|
||||
type SelectorWithQueryParams =
|
||||
[Selector, QueryParam]
|
||||
| [Selector, QueryParam]
|
||||
| [Selector, QueryParam]
|
||||
| [Selector, QueryParam, QueryParam]
|
||||
| [Selector, QueryParam, QueryParam, QueryParam]
|
||||
| [Selector, QueryParam, QueryParam, QueryParam, QueryParam]
|
||||
| [Selector, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam]
|
||||
| [Selector, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam]
|
||||
| [Selector, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam]
|
||||
| [Selector, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam]
|
||||
| [Selector, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam]
|
||||
| [Selector, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam];
|
||||
|
||||
type Context = any;
|
||||
|
||||
type Filter = (input: Context, ...args: any[]) => Context;
|
||||
interface Locals {
|
||||
[filterName: string]: Filter;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
data?: Context;
|
||||
rootContext?: Context;
|
||||
source?: Context;
|
||||
context?: Context;
|
||||
parent?: Context;
|
||||
locals?: Locals;
|
||||
globals?: boolean;
|
||||
force?: boolean;
|
||||
allowRegexp?: boolean;
|
||||
}
|
||||
|
||||
interface Result {
|
||||
value: any;
|
||||
key: string;
|
||||
references: any[];
|
||||
parents: string[];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
import jsonQuery = require('json-query');
|
||||
|
||||
// API
|
||||
let data: jsonQuery.Context = {
|
||||
people: [
|
||||
{name: 'Matt', country: 'NZ'},
|
||||
{name: 'Pete', country: 'AU'},
|
||||
{name: 'Mikey', country: 'NZ'}
|
||||
]
|
||||
};
|
||||
jsonQuery('people[country=NZ].name', {data}); // => {value: 'Matt', parents: [...], key: 0} ... etc
|
||||
|
||||
// Deep Queries
|
||||
data = {
|
||||
grouped_people: {
|
||||
friends: [
|
||||
{name: 'Steve', country: 'NZ'},
|
||||
{name: 'Jane', country: 'US'},
|
||||
{name: 'Mike', country: 'AU'},
|
||||
{name: 'Mary', country: 'NZ'}
|
||||
],
|
||||
enemies: [
|
||||
{name: 'Evil Steve', country: 'AU'},
|
||||
{name: 'Betty', country: 'NZ'}
|
||||
]
|
||||
}
|
||||
};
|
||||
const result: any = jsonQuery('grouped_people[**][*country=NZ]', {data}).value;
|
||||
|
||||
// Inner Queries
|
||||
data = {
|
||||
page: {
|
||||
id: 'page_1',
|
||||
title: 'Test'
|
||||
},
|
||||
comments_lookup: {
|
||||
page_1: [
|
||||
{id: 'comment_1', parent_id: 'page_1', content: "I am a comment"}
|
||||
]
|
||||
}
|
||||
};
|
||||
jsonQuery('comments_lookup[{page.id}]', {data});
|
||||
|
||||
// Local functions (helpers)
|
||||
const locals: jsonQuery.Locals = {
|
||||
greetingName: (input: jsonQuery.Context) => {
|
||||
if (input.known_as) {
|
||||
return input.known_as;
|
||||
} else {
|
||||
return input.name;
|
||||
}
|
||||
},
|
||||
and: (inputA: jsonQuery.Context, inputB: boolean) => {
|
||||
return inputA && inputB;
|
||||
},
|
||||
text: (input: jsonQuery.Context, text: string) => {
|
||||
return text;
|
||||
},
|
||||
then: (input: jsonQuery.Context, thenValue: string, elseValue: string) => {
|
||||
if (input) {
|
||||
return thenValue;
|
||||
} else {
|
||||
return elseValue;
|
||||
}
|
||||
}
|
||||
};
|
||||
data = {
|
||||
is_fullscreen: true,
|
||||
is_playing: false,
|
||||
user: {
|
||||
name: "Matthew McKegg",
|
||||
known_as: "Matt"
|
||||
}
|
||||
};
|
||||
jsonQuery('user:greetingName', {data, locals}).value; // => "Matt"
|
||||
jsonQuery(['is_fullscreen:and({is_playing}):then(?, ?)', "Playing big!", "Not so much"], {data, locals}).value; // => "Not so much"
|
||||
jsonQuery(':text(This displays text cos we made it so)', {locals}).value; // => "This displays text cos we made it so"
|
||||
jsonQuery('people:select(name, country)', {
|
||||
data,
|
||||
locals: {
|
||||
select: (input: jsonQuery.Context, ...keys: string[]) => {
|
||||
if (Array.isArray(input)) {
|
||||
return input.map((item: any) => {
|
||||
return Object.keys(item).reduce((result: {[p: string]: any}, key: string) => {
|
||||
if (~keys.indexOf(key)) {
|
||||
result[key] = item[key];
|
||||
}
|
||||
return result;
|
||||
}, {});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
jsonQuery('people[*:recentlyUpdated]', {
|
||||
data,
|
||||
locals: {
|
||||
recentlyUpdated: (item: {updatedAt: number}) => {
|
||||
return item.updatedAt < Date.now() - (30 * 24 * 60 * 60 * 1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Context
|
||||
data = {
|
||||
styles: {
|
||||
bold: 'font-weight:strong',
|
||||
red: 'color: red'
|
||||
},
|
||||
paragraphs: [
|
||||
{content: "I am a red paragraph", style: 'red'},
|
||||
{content: "I am a bold paragraph", style: 'bold'},
|
||||
],
|
||||
};
|
||||
let pageHtml = '';
|
||||
data.paragraphs.forEach((paragraph: {content: string, style: string}) => {
|
||||
const style = jsonQuery('styles[{.style}]', {data, source: paragraph}).value;
|
||||
const content = jsonQuery('.content', {data, source: paragraph}).value; // pretty pointless :)
|
||||
pageHtml += `<p style='${style}'>${content}</p>`;
|
||||
});
|
||||
|
||||
// Query Params
|
||||
jsonQuery(['people[country=?]', 'NZ'], {data});
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"json-query-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for lil-uuid 0.1
|
||||
// Project: https://github.com/lil-js/uuid
|
||||
// Definitions by: Pr1st0n <https://github.com/Pr1st0n>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Generate a random UUID
|
||||
*
|
||||
* @returns UUID string.
|
||||
*/
|
||||
export function uuid(): string;
|
||||
|
||||
/**
|
||||
* Check if a given string has a valid UUID format. It supports multiple version (3, 4 and 5).
|
||||
*
|
||||
* @param uuid UUID string.
|
||||
* @returns True if string is valid UUID, false otherwise.
|
||||
*/
|
||||
export function isUUID(uuid: string): boolean;
|
||||
@@ -0,0 +1,4 @@
|
||||
import * as lil from 'lil-uuid';
|
||||
|
||||
lil.uuid();
|
||||
lil.isUUID('f47ac10b-58cc-4372-a567-0e02b2c3d479');
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"lil-uuid-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+1
@@ -947,6 +947,7 @@ declare namespace __MaterialUI {
|
||||
export interface ChipProps {
|
||||
backgroundColor?: string;
|
||||
className?: string;
|
||||
containerElement?: React.ReactNode | string;
|
||||
labelColor?: string;
|
||||
labelStyle?: React.CSSProperties;
|
||||
onRequestDelete?: React.TouchEventHandler<Chip>;
|
||||
|
||||
@@ -3030,6 +3030,8 @@ const ChipExampleSimple = () => (
|
||||
<Chip labelColor={blue500}>Blue Label Color</Chip>
|
||||
<Chip><Avatar size={32} color={blue300} backgroundColor={indigo900}>UI</Avatar> Avatar</Chip>
|
||||
<Chip style={styles.chip}>Styled</Chip>
|
||||
<Chip containerElement="span">String Container</Chip>
|
||||
<Chip containerElement={() => {}}>ReactNode Container</Chip>
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
Vendored
+79
@@ -0,0 +1,79 @@
|
||||
// Type definitions for mock-knex 0.3
|
||||
// Project: https://github.com/colonyamerican/mock-knex
|
||||
// Definitions by: Jesse Zhang <https://github.com/jessezhang91>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as Knex from "knex";
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
/**
|
||||
* Attaches mocked client to knex instance
|
||||
*
|
||||
* @param knex initialized knex client
|
||||
*/
|
||||
export function mock(knex: Knex): void;
|
||||
|
||||
/**
|
||||
* Detaches mocked client from knex instance
|
||||
*
|
||||
* @param knex initialized knex client
|
||||
*/
|
||||
export function unmock(knex: Knex): void;
|
||||
|
||||
/**
|
||||
* Returns query Tracker instance
|
||||
*/
|
||||
export function getTracker(): Tracker;
|
||||
|
||||
/**
|
||||
* The tracker enables you to catch and respond to queries that occur during testing, see Test for more examples.
|
||||
*/
|
||||
export interface Tracker extends EventEmitter {
|
||||
/**
|
||||
* Enables query tracking mock on mocked knex client
|
||||
*/
|
||||
install(): void;
|
||||
|
||||
/**
|
||||
* Disables query tracking mock on mocked knex client. Also resets 'step' counter.
|
||||
*/
|
||||
uninstall(): void;
|
||||
|
||||
/**
|
||||
* Add event listener for 'query' event. It gets esecuted for each query that should end up in database.
|
||||
* Instead of this callback gets executed and its up to you to assert queries and mock database responses.
|
||||
*
|
||||
* @param callback A function that gets executed on 'query' event.
|
||||
*/
|
||||
on(event: 'query', callback: (query: QueryDetails, step: number) => void): this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The object containing query details that is being sent to knex database dialect on query execution.
|
||||
* Object properties signature matches with knex toSQL() output with additional method returns(values).
|
||||
*/
|
||||
export interface QueryDetails extends Knex.Sql {
|
||||
/**
|
||||
* Function that needs to be called to mock database query result for knex.
|
||||
*
|
||||
* @param error The Error, string or instance of Error, which represents why the result was rejected
|
||||
*/
|
||||
reject(error: Error | string): void;
|
||||
|
||||
/**
|
||||
* Function that needs to be called to mock database query result for knex.
|
||||
*
|
||||
* @param values An array of mock data to be returned by database. For Bookshelf this is mostly array of objects. Knex could return any type of data.
|
||||
*/
|
||||
response(values: any[], options?: QueryDetailsResponseOption): void;
|
||||
}
|
||||
|
||||
export interface QueryDetailsResponseOption {
|
||||
/**
|
||||
* Is this a stream response, defaults to false
|
||||
*/
|
||||
stream: boolean;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import * as knex from "knex";
|
||||
import * as mockDb from "mock-knex";
|
||||
|
||||
const db = knex({
|
||||
client: 'sqlite'
|
||||
});
|
||||
|
||||
mockDb.mock(db);
|
||||
|
||||
const tracker = mockDb.getTracker();
|
||||
tracker.install();
|
||||
tracker.on('query', (query, step) => {
|
||||
if (query.method === "first" || step === 1) {
|
||||
query.response([{
|
||||
a: 1
|
||||
}, {
|
||||
a: 2
|
||||
}, {
|
||||
a: 3
|
||||
}], {
|
||||
stream: false
|
||||
});
|
||||
} else {
|
||||
query.reject(new Error("bad query"));
|
||||
}
|
||||
});
|
||||
tracker.uninstall();
|
||||
|
||||
mockDb.unmock(db);
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mock-knex-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+71
@@ -0,0 +1,71 @@
|
||||
// Type definitions for moment-holiday 1.5
|
||||
// Project: https://github.com/kodie/moment-holiday
|
||||
// Definitions by: Robert Winslow Dalpe <https://github.com/rwdalpe>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as moment from 'moment';
|
||||
|
||||
declare module 'moment' {
|
||||
interface Moment extends Object {
|
||||
holiday(
|
||||
holidays?: string[] | string,
|
||||
adjust?: boolean): Moment | false | { [holidayName: string]: Moment };
|
||||
|
||||
holidays(
|
||||
holidays?: string[] | string,
|
||||
adjust?: boolean): Moment | false | { [holidayName: string]: Moment };
|
||||
|
||||
isHoliday(
|
||||
holidays?: string[] | string | null,
|
||||
adjust?: boolean): boolean | string | string[];
|
||||
|
||||
previousHoliday(count?: number, adjust?: boolean): Moment[] | Moment;
|
||||
|
||||
previousHolidays(count?: number, adjust?: boolean): Moment[] | Moment;
|
||||
|
||||
nextHoliday(count?: number, adjust?: boolean): Moment[] | Moment;
|
||||
|
||||
nextHolidays(count?: number, adjust?: boolean): Moment[] | Moment;
|
||||
|
||||
holidaysBetween(m: Moment, adjust?: boolean): Moment[] | false;
|
||||
}
|
||||
|
||||
interface HolidayDefinition {
|
||||
date: string;
|
||||
keywords?: string[];
|
||||
keywords_y?: string[];
|
||||
keywords_n?: string[];
|
||||
regions?: string[];
|
||||
regions_n?: string[];
|
||||
}
|
||||
|
||||
interface HolidaysMapping {
|
||||
[holidayName: string]: HolidayDefinition;
|
||||
}
|
||||
|
||||
interface Holidays {
|
||||
active: HolidaysMapping;
|
||||
active_last: HolidaysMapping;
|
||||
}
|
||||
|
||||
interface HolidayModifier {
|
||||
set(
|
||||
holidays: HolidaysMapping | string | string[],
|
||||
specifics?: any): HolidayModifier;
|
||||
|
||||
add(
|
||||
holidays: HolidaysMapping | string,
|
||||
specifics?: any): HolidayModifier;
|
||||
|
||||
remove(holidays: string | string[]): HolidayModifier;
|
||||
|
||||
undo(): HolidayModifier;
|
||||
|
||||
load(locales: string | string[]): HolidayModifier;
|
||||
|
||||
extendParser(parserFunc: (m: Moment, date: string) => Moment | Moment[] | false | void): HolidayModifier;
|
||||
}
|
||||
|
||||
let holidays: Holidays;
|
||||
let modifyHolidays: HolidayModifier;
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
import moment = require('moment');
|
||||
import 'moment-holiday';
|
||||
|
||||
let holidayResult: moment.Moment | false | { [holidayName: string]: moment.Moment };
|
||||
holidayResult = moment().holiday([]);
|
||||
holidayResult = moment().holiday([], false);
|
||||
holidayResult = moment().holiday([], true);
|
||||
holidayResult = moment().holiday('string');
|
||||
holidayResult = moment().holiday('string', false);
|
||||
holidayResult = moment().holiday('string', true);
|
||||
holidayResult = moment().holiday(['array', 'of', 'strings']);
|
||||
holidayResult = moment().holiday(['array', 'of', 'strings'], false);
|
||||
holidayResult = moment().holiday(['array', 'of', 'strings'], true);
|
||||
|
||||
holidayResult = moment().holidays([]);
|
||||
holidayResult = moment().holidays([], false);
|
||||
holidayResult = moment().holidays([], true);
|
||||
holidayResult = moment().holidays('string');
|
||||
holidayResult = moment().holidays('string', false);
|
||||
holidayResult = moment().holidays('string', true);
|
||||
holidayResult = moment().holidays(['array', 'of', 'strings']);
|
||||
holidayResult = moment().holidays(['array', 'of', 'strings'], false);
|
||||
holidayResult = moment().holidays(['array', 'of', 'strings'], true);
|
||||
|
||||
let isHolidayResult: boolean | string | string[];
|
||||
isHolidayResult = moment().isHoliday();
|
||||
isHolidayResult = moment().isHoliday([]);
|
||||
isHolidayResult = moment().isHoliday([], false);
|
||||
isHolidayResult = moment().isHoliday([], true);
|
||||
isHolidayResult = moment().isHoliday(['array', 'of', 'strings']);
|
||||
isHolidayResult = moment().isHoliday(['array', 'of', 'strings'], false);
|
||||
isHolidayResult = moment().isHoliday(['array', 'of', 'strings'], true);
|
||||
isHolidayResult = moment().isHoliday('string');
|
||||
isHolidayResult = moment().isHoliday('string', false);
|
||||
isHolidayResult = moment().isHoliday('string', true);
|
||||
isHolidayResult = moment().isHoliday(null);
|
||||
isHolidayResult = moment().isHoliday(null, false);
|
||||
isHolidayResult = moment().isHoliday(null, true);
|
||||
|
||||
let previousHolidayResult: moment.Moment[] | moment.Moment;
|
||||
previousHolidayResult = moment().previousHoliday();
|
||||
previousHolidayResult = moment().previousHoliday(1);
|
||||
previousHolidayResult = moment().previousHoliday(1, false);
|
||||
previousHolidayResult = moment().previousHoliday(1, true);
|
||||
previousHolidayResult = moment().previousHolidays();
|
||||
previousHolidayResult = moment().previousHolidays(1);
|
||||
previousHolidayResult = moment().previousHolidays(1, false);
|
||||
previousHolidayResult = moment().previousHolidays(1, true);
|
||||
|
||||
let nextHolidayResult: moment.Moment[] | moment.Moment;
|
||||
nextHolidayResult = moment().nextHoliday();
|
||||
nextHolidayResult = moment().nextHoliday(1);
|
||||
nextHolidayResult = moment().nextHoliday(1, false);
|
||||
nextHolidayResult = moment().nextHoliday(1, true);
|
||||
nextHolidayResult = moment().nextHolidays();
|
||||
nextHolidayResult = moment().nextHolidays(1);
|
||||
nextHolidayResult = moment().nextHolidays(1, false);
|
||||
nextHolidayResult = moment().nextHolidays(1, true);
|
||||
|
||||
let holidaysBetweenResult: moment.Moment[] | false;
|
||||
holidaysBetweenResult = moment().holidaysBetween(moment());
|
||||
holidaysBetweenResult = moment().holidaysBetween(moment(), false);
|
||||
holidaysBetweenResult = moment().holidaysBetween(moment(), true);
|
||||
|
||||
let holidayDefinition: moment.HolidayDefinition = {
|
||||
date: 'string'
|
||||
};
|
||||
holidayDefinition = {
|
||||
date: 'string',
|
||||
keywords: ['array'],
|
||||
};
|
||||
holidayDefinition = {
|
||||
date: 'string',
|
||||
keywords: ['array'],
|
||||
keywords_n: ['array'],
|
||||
};
|
||||
holidayDefinition = {
|
||||
date: 'string',
|
||||
keywords: ['array'],
|
||||
keywords_n: ['array'],
|
||||
keywords_y: ['array'],
|
||||
};
|
||||
holidayDefinition = {
|
||||
date: 'string',
|
||||
keywords: ['array'],
|
||||
keywords_n: ['array'],
|
||||
keywords_y: ['array'],
|
||||
regions: ['array'],
|
||||
};
|
||||
holidayDefinition = {
|
||||
date: 'string',
|
||||
keywords: ['array'],
|
||||
keywords_n: ['array'],
|
||||
keywords_y: ['array'],
|
||||
regions: ['array'],
|
||||
regions_n: ['array']
|
||||
};
|
||||
|
||||
const holidays: moment.Holidays = moment.holidays;
|
||||
let activeHolidays: moment.HolidaysMapping = moment.holidays.active;
|
||||
activeHolidays = {
|
||||
'Some holiday name': holidayDefinition
|
||||
};
|
||||
|
||||
let lastActiveHolidays: moment.HolidaysMapping = moment.holidays.active_last;
|
||||
lastActiveHolidays = {
|
||||
'Some holiday name': holidayDefinition
|
||||
};
|
||||
|
||||
let holidayModifier: moment.HolidayModifier = moment.modifyHolidays;
|
||||
holidayModifier = holidayModifier.set('string');
|
||||
holidayModifier = holidayModifier.set(['array']);
|
||||
holidayModifier = holidayModifier.set(activeHolidays);
|
||||
holidayModifier = holidayModifier.set('string', {});
|
||||
holidayModifier = holidayModifier.set(['array'], {});
|
||||
holidayModifier = holidayModifier.set(activeHolidays, {});
|
||||
holidayModifier = holidayModifier.add(activeHolidays);
|
||||
holidayModifier = holidayModifier.add('string');
|
||||
holidayModifier = holidayModifier.add(activeHolidays, {});
|
||||
holidayModifier = holidayModifier.add('string', {});
|
||||
holidayModifier = holidayModifier.remove('string');
|
||||
holidayModifier = holidayModifier.remove(['array']);
|
||||
holidayModifier = holidayModifier.undo();
|
||||
holidayModifier = holidayModifier.load('string');
|
||||
holidayModifier = holidayModifier.load(['string']);
|
||||
holidayModifier = holidayModifier.extendParser((m: moment.Moment, d: string): moment.Moment | moment.Moment[] | false | void => {
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"moment": ">=2.0.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"moment-holiday-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
-1
@@ -14,7 +14,6 @@
|
||||
// Kelvin Jin <https://github.com/kjin>
|
||||
// Alvis HT Tang <https://github.com/alvis>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/************************************************
|
||||
* *
|
||||
|
||||
+16
-23
@@ -1620,19 +1620,7 @@ namespace path_tests {
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
|
||||
console.log(process.env.PATH);
|
||||
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
|
||||
|
||||
process.env.PATH.split(path.delimiter);
|
||||
// returns
|
||||
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
|
||||
|
||||
console.log(process.env.PATH);
|
||||
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
|
||||
|
||||
process.env.PATH.split(path.delimiter);
|
||||
// returns
|
||||
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
|
||||
process.env["PATH"]; // $ExpectType string
|
||||
|
||||
path.parse('/home/user/dir/file.txt');
|
||||
// returns
|
||||
@@ -3075,11 +3063,11 @@ client.listbreakpoints((err, body, packet) => { });
|
||||
////////////////////////////////////////////////////
|
||||
namespace async_hooks_tests {
|
||||
const hooks: async_hooks.HookCallbacks = {
|
||||
init: (asyncId: number, type: string, triggerAsyncId: number, resource: object) => void {},
|
||||
before: (asyncId: number) => void {},
|
||||
after: (asyncId: number) => void {},
|
||||
destroy: (asyncId: number) => void {},
|
||||
promiseResolve: (asyncId: number) => void {}
|
||||
init() {},
|
||||
before() {},
|
||||
after() {},
|
||||
destroy() {},
|
||||
promiseResolve() {},
|
||||
};
|
||||
|
||||
const asyncHook = async_hooks.createHook(hooks);
|
||||
@@ -3346,7 +3334,8 @@ namespace http2_tests {
|
||||
settings,
|
||||
allowHTTP1: true
|
||||
};
|
||||
let secureServerOptions: http2.SecureServerOptions = { ...serverOptions };
|
||||
// tslint:disable-next-line prefer-object-spread (ts2.1 feature)
|
||||
let secureServerOptions: http2.SecureServerOptions = Object.assign({}, serverOptions);
|
||||
secureServerOptions.ca = '';
|
||||
let onRequestHandler = (request: http2.Http2ServerRequest, response: http2.Http2ServerResponse) => {
|
||||
// Http2ServerRequest
|
||||
@@ -3443,7 +3432,8 @@ namespace http2_tests {
|
||||
selectPadding: (frameLen: number, maxFrameLen: number) => 0,
|
||||
settings
|
||||
};
|
||||
let secureClientSessionOptions: http2.SecureClientSessionOptions = { ...clientSessionOptions };
|
||||
// tslint:disable-next-line prefer-object-spread (ts2.1 feature)
|
||||
let secureClientSessionOptions: http2.SecureClientSessionOptions = Object.assign({}, clientSessionOptions);
|
||||
secureClientSessionOptions.ca = '';
|
||||
let onConnectHandler = (session: http2.Http2Session, socket: net.Socket) => {};
|
||||
|
||||
@@ -3696,8 +3686,9 @@ namespace inspector_tests {
|
||||
session.disconnect();
|
||||
|
||||
// Unknown post method
|
||||
session.post('A.b', { key: 'value' }, (err: Error, params: object) => {});
|
||||
session.post('A.b', (err: Error, params: object) => {});
|
||||
session.post('A.b', { key: 'value' }, (err, params) => {});
|
||||
// TODO: parameters are implicitly 'any' and need type annotation
|
||||
session.post('A.b', (err: Error | null, params?: {}) => {});
|
||||
session.post('A.b');
|
||||
// Known post method
|
||||
const parameter: inspector.Runtime.EvaluateParameterType = { expression: '2 + 2' };
|
||||
@@ -3710,7 +3701,9 @@ namespace inspector_tests {
|
||||
session.post('Runtime.evaluate');
|
||||
|
||||
// General event
|
||||
session.on('inspectorNotification', (message: inspector.InspectorNotification<object>) => {});
|
||||
session.on('inspectorNotification', message => {
|
||||
message; // $ExpectType InspectorNotification<{}>
|
||||
});
|
||||
// Known events
|
||||
session.on('Debugger.paused', (message: inspector.InspectorNotification<inspector.Debugger.PausedEventDataType>) => {
|
||||
const method: string = message.method;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
|
||||
Vendored
+89
-80
@@ -8,102 +8,102 @@ export = noUiSlider;
|
||||
export as namespace noUiSlider;
|
||||
|
||||
declare namespace noUiSlider {
|
||||
/**
|
||||
/**
|
||||
* To create a slider, call noUiSlider.create() with an element and your options.
|
||||
*/
|
||||
function create(target: HTMLElement, options: Options): void;
|
||||
function create(target: HTMLElement, options: Options): void;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
interface Options {
|
||||
/**
|
||||
* The start option sets the number of handles and their start positions, relative to range.
|
||||
*/
|
||||
start: number | number[] | number[][];
|
||||
/**
|
||||
start: number | number[] | number[][];
|
||||
/**
|
||||
* All values on the slider are part of a range. The range has a minimum and maximum value.
|
||||
* The minimum value cannot be equal to the maximum value.
|
||||
*/
|
||||
range: Object;
|
||||
/**
|
||||
range: { [key: string]: number | number[] };
|
||||
/**
|
||||
* The connect setting can be used to control the (green) bar between the handles, or the edges of the slider.
|
||||
* Pass an array with a boolean for every connecting element, including the edges of the slider.
|
||||
* Pass an array with a boolean for every connecting element, including the edges of the slider.
|
||||
* The length of this array must match the handle count + 1.
|
||||
* Setting true sets the bars between the handles, but not between the handles and the sliders edges.
|
||||
*/
|
||||
connect?: boolean | boolean[];
|
||||
/**
|
||||
connect?: boolean | boolean[];
|
||||
/**
|
||||
* When using two handles, the minimum distance between the handles can be set using the margin option.
|
||||
* The margin value is relative to the value set in 'range'.
|
||||
* This option is only available on standard linear sliders.
|
||||
*/
|
||||
margin?: number;
|
||||
/**
|
||||
margin?: number;
|
||||
/**
|
||||
* The limit option is the opposite of the margin option,
|
||||
* limiting the maximum distance between two handles.
|
||||
* As with the margin option, the limit option can only be used on linear sliders.
|
||||
*/
|
||||
limit?: number;
|
||||
/**
|
||||
limit?: number;
|
||||
/**
|
||||
* Padding limits how close to the slider edges handles can be.
|
||||
*/
|
||||
padding?: number;
|
||||
/**
|
||||
padding?: number;
|
||||
/**
|
||||
* By default, the slider slides fluently.
|
||||
* In order to make the handles jump between intervals, you can use this option.
|
||||
* The step option is relative to the values provided to range.
|
||||
*/
|
||||
step?: number;
|
||||
/**
|
||||
step?: number;
|
||||
/**
|
||||
* The orientation setting can be used to set the slider to "vertical" or "horizontal".
|
||||
* Set dimensions! Vertical sliders don't assume a default height, so you'll need to set one.
|
||||
* You can use any unit you want, including % or px.
|
||||
*/
|
||||
orientation?: "vertical" | "horizontal";
|
||||
/**
|
||||
orientation?: 'vertical' | 'horizontal';
|
||||
/**
|
||||
* By default the sliders are top-to-bottom and left-to-right,
|
||||
* but you can change this using the direction option,
|
||||
* which decides where the upper side of the slider is.
|
||||
*/
|
||||
direction?: "ltr" | "rtl";
|
||||
/**
|
||||
* noUiSlider can provide a basic tooltip without using its events system.
|
||||
* Set the tooltips option to true to enable.
|
||||
* This option can also accept formatting options to format the tooltips content.
|
||||
direction?: 'ltr' | 'rtl';
|
||||
/**
|
||||
* noUiSlider can provide a basic tooltip without using its events system.
|
||||
* Set the tooltips option to true to enable.
|
||||
* This option can also accept formatting options to format the tooltips content.
|
||||
* In that case, pass an array with a formatter for each handle, true to use the default or false to display no tooltip.
|
||||
*/
|
||||
tooltips?: boolean | Object | ((...args:any[]) => any);
|
||||
/**
|
||||
tooltips?: boolean | Object | ((...args: any[]) => any);
|
||||
/**
|
||||
* Set the animate option to false to prevent the slider from animating to a new value with when calling .val().
|
||||
*/
|
||||
animate?: boolean;
|
||||
/**
|
||||
animate?: boolean;
|
||||
/**
|
||||
* The animationDuration option can be used to set the animation speed assumed by the slider library.
|
||||
* In addition to this, you must manually set the CSS (-webkit-)transition property for the .noUi-state-tap .noUi-origin selector.
|
||||
*/
|
||||
animationDuration?: number;
|
||||
/**
|
||||
animationDuration?: number;
|
||||
/**
|
||||
* When a non-linear slider has been configured, the snap option can be set to true to force the slider to jump
|
||||
* between the specified values.
|
||||
*/
|
||||
snap?: boolean;
|
||||
/**
|
||||
snap?: boolean;
|
||||
/**
|
||||
* All values on the slider are part of a range. The range has a minimum and maximum value.
|
||||
*/
|
||||
behaviour?: string;
|
||||
/**
|
||||
behaviour?: string;
|
||||
/**
|
||||
* To format the slider output, noUiSlider offers a format option.
|
||||
* Simply specify to and from functions to encode and decode the values.
|
||||
* See manual formatting to the right for usage information.
|
||||
* By default, noUiSlider will format output with 2 decimals.
|
||||
*/
|
||||
format?: Object | ((...args:any[]) => any);
|
||||
/**
|
||||
format?: Object | ((...args: any[]) => any);
|
||||
/**
|
||||
* Allows you to generate points along the slider.
|
||||
*/
|
||||
pips?: PipsOptions;
|
||||
}
|
||||
pips?: PipsOptions;
|
||||
}
|
||||
|
||||
interface PipsOptions {
|
||||
/**
|
||||
interface PipsOptions {
|
||||
/**
|
||||
* The 'range' mode uses the slider range to determine where the pips should be. A pip is generated for every percentage specified.
|
||||
*
|
||||
* The 'steps', like 'range', uses the slider range. In steps mode, a pip is generated for every step.
|
||||
@@ -118,83 +118,92 @@ declare namespace noUiSlider {
|
||||
* The 'values' mode is similar to positions, but it accepts values instead of percentages. The stepped option can be used for this mode.
|
||||
*
|
||||
*/
|
||||
mode: "range" | "steps" | "positions" | "count" | "values";
|
||||
/**
|
||||
mode: 'range' | 'steps' | 'positions' | 'count' | 'values';
|
||||
/**
|
||||
* Range Mode: percentage for range mode
|
||||
* Step Mode: step number for steps
|
||||
* Positions Mode: percentage-based positions on the slider
|
||||
* Count Mode: positions between pips
|
||||
*/
|
||||
density?: number;
|
||||
/**
|
||||
density?: number;
|
||||
/**
|
||||
* Step Mode: The filter option can be used to filter the generated pips.
|
||||
* The filter function must return 0 (no value), 1 (large value) or 2 (small value).
|
||||
*/
|
||||
filter?: (...args: any[]) => PipFilterResult;
|
||||
/**
|
||||
filter?: (...args: any[]) => PipFilterResult;
|
||||
/**
|
||||
* format for step mode
|
||||
* see noUiSlider format
|
||||
*/
|
||||
format?: Object | ((...args:any[]) => any);
|
||||
/**
|
||||
format?: Object | ((...args: any[]) => any);
|
||||
/**
|
||||
*
|
||||
* values for positions and values mode
|
||||
* number pips for count mode
|
||||
*/
|
||||
values?: number | number[];
|
||||
/**
|
||||
values?: number | number[];
|
||||
/**
|
||||
* stepped option for positions, values and count mode
|
||||
*/
|
||||
stepped?: boolean;
|
||||
}
|
||||
stepped?: boolean;
|
||||
}
|
||||
|
||||
const enum PipFilterResult {
|
||||
NoValue,
|
||||
LargeValue,
|
||||
SmallValue,
|
||||
}
|
||||
const enum PipFilterResult {
|
||||
NoValue,
|
||||
LargeValue,
|
||||
SmallValue,
|
||||
}
|
||||
|
||||
interface Callback {
|
||||
/**
|
||||
interface Callback {
|
||||
/**
|
||||
* Array for both one-handle and two-handle sliders. It contains the current slider values,
|
||||
* with formatting applied.
|
||||
*/
|
||||
(values: any[], handle: number, unencodedValues: number[]): void;
|
||||
}
|
||||
(values: any[], handle: number, unencodedValues: number[]): void;
|
||||
}
|
||||
|
||||
interface noUiSlider {
|
||||
/**
|
||||
interface noUiSlider {
|
||||
/**
|
||||
* Bind event to the slider.
|
||||
*/
|
||||
on(eventName: string, callback: Callback): void;
|
||||
/**
|
||||
on(eventName: string, callback: Callback): void;
|
||||
/**
|
||||
* Unbind event to the slider.
|
||||
*/
|
||||
off(eventName: string): void;
|
||||
/**
|
||||
off(eventName: string): void;
|
||||
/**
|
||||
* Destroy's the slider.
|
||||
*/
|
||||
destroy(): void;
|
||||
/**
|
||||
destroy(): void;
|
||||
/**
|
||||
* To get the current slider value. For one-handle sliders, calling .get() will return the value.
|
||||
* For two-handle sliders, an array[value, value] will be returned.
|
||||
*/
|
||||
get(): number | number[];
|
||||
/**
|
||||
get(): number | number[];
|
||||
/**
|
||||
* noUiSlider will keep your values within the slider range, which saves you a bunch of validation.
|
||||
* If you have configured the slider to use one handle, you can change the current value by passing
|
||||
* a number to the .set() method. If you have two handles, pass an array. One-handled sliders
|
||||
* will also accept arrays. Within an array, you can set one position to null
|
||||
* if you want to leave a handle unchanged.
|
||||
*/
|
||||
set(value: number | (number | null)[]): void;
|
||||
/**
|
||||
set(value: number | (number | null)[]): void;
|
||||
/**
|
||||
* To return to the initial slider values, you can use the .reset() method. This will only reset the slider values.
|
||||
*/
|
||||
reset(): void;
|
||||
}
|
||||
reset(): void;
|
||||
/**
|
||||
* Exposes the options used to create the noUiSlider instance
|
||||
*/
|
||||
options: Options;
|
||||
/**
|
||||
* method that can change the 'margin', 'limit', 'step', 'range', 'animate' and 'snap' options.
|
||||
* All other options require changes to the slider's HTML or event bindings.
|
||||
*/
|
||||
updateOptions(newOptions: Options, fireSetEvent?: boolean): void;
|
||||
}
|
||||
|
||||
interface Instance extends HTMLElement {
|
||||
noUiSlider: noUiSlider;
|
||||
}
|
||||
interface Instance extends HTMLElement {
|
||||
noUiSlider: noUiSlider;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+129
-138
@@ -1,148 +1,139 @@
|
||||
// Type definitions for nunjucks
|
||||
// Type definitions for nunjucks 3.0
|
||||
// Project: http://mozilla.github.io/nunjucks/
|
||||
// Definitions by: Ruben Slabbert <https://github.com/RubenSlabbert>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export function render(name: string, context?: object): string;
|
||||
export function render(name: string, context?: object, callback?: (err: any, res: string) => any): void;
|
||||
|
||||
declare namespace Nunjucks {
|
||||
function render(name: string, context?: Object): string;
|
||||
function render(name: string, context?: Object, callback?: (err: any, res: string) => any): void;
|
||||
export function renderString(src: string, context: object): string;
|
||||
export function renderString(src: string, context: object, callback?: (err: any, res: string) => any): void;
|
||||
|
||||
function renderString(src: string, context: Object): string;
|
||||
function renderString(src: string, context: Object, callback?: (err: any, res: string) => any): void;
|
||||
export function compile(src: string, env?: Environment, callback?: (err: any, res: Template) => any): Template;
|
||||
|
||||
function compile(src: string, env?: Environment): Template;
|
||||
function compile(src: string, env?: Environment, callback?: (err: any, res: Template) => any): Template;
|
||||
export function precompile(path: string, opts?: PrecompileOptions): string;
|
||||
export function precompileString(src: string, opts?: PrecompileOptions): string;
|
||||
|
||||
function precompile(path: string, opts?: PrecompileOptions): string;
|
||||
function precompileString(src: string, opts?: PrecompileOptions): string;
|
||||
|
||||
interface PrecompileOptions {
|
||||
name?: string;
|
||||
asFunction?: boolean;
|
||||
force?: boolean;
|
||||
env?: Environment;
|
||||
include?: string[];
|
||||
exclude?: string[];
|
||||
wrapper?(templates: { name: string, template: string }, opts: PrecompileOptions): string;
|
||||
}
|
||||
|
||||
class Template {
|
||||
constructor(src: string, env?: Environment, eagerCompile?: boolean);
|
||||
render(context?: Object): string;
|
||||
render(context?: Object, callback?: (err: any, res: string) => any): void;
|
||||
}
|
||||
|
||||
function configure(options: ConfigureOptions): Environment;
|
||||
function configure(path: string, options?: ConfigureOptions): Environment;
|
||||
function configure(path: string[], options?: ConfigureOptions): Environment;
|
||||
|
||||
interface ConfigureOptions {
|
||||
autoescape?: boolean;
|
||||
throwOnUndefined?: boolean;
|
||||
trimBlocks?: boolean;
|
||||
lstripBlocks?: boolean;
|
||||
watch?: boolean;
|
||||
noCache?: boolean;
|
||||
web?: {
|
||||
useCache?: boolean,
|
||||
async?: boolean
|
||||
};
|
||||
express?: Object;
|
||||
tags?: {
|
||||
blockStart?: string,
|
||||
blockEnd?: string,
|
||||
variableStart?: string,
|
||||
variableEnd?: string,
|
||||
commentStart?: string,
|
||||
commentEnd?: string
|
||||
};
|
||||
}
|
||||
|
||||
class Environment {
|
||||
options: {
|
||||
autoescape: boolean;
|
||||
};
|
||||
|
||||
constructor();
|
||||
constructor(loader: ILoader, opts?: ConfigureOptions);
|
||||
constructor(loaders: ILoader[], opts?: ConfigureOptions);
|
||||
|
||||
render(name: string, context?: Object): string;
|
||||
render(name: string, context?: Object, callback?: (err: any, res: string) => any): void;
|
||||
|
||||
renderString(name: string, context: Object): string;
|
||||
renderString(name: string, context: Object, callback?: (err: any, res: string) => any): void;
|
||||
|
||||
addFilter(name: string, func: (...args: any[]) => any, async?: boolean): void;
|
||||
getFilter(name: string): void;
|
||||
|
||||
addExtension(name: string, ext: Extension): void;
|
||||
removeExtension(name: string): void;
|
||||
getExtension(name: string): Extension;
|
||||
hasExtension(name: string): void;
|
||||
|
||||
addGlobal(name: string, value: any): void;
|
||||
|
||||
getTemplate(name: string, eagerCompile?: boolean): Template;
|
||||
getTemplate(name: string, eagerCompile?: boolean, callback?: (err: any, templ: Template) => Template): void;
|
||||
|
||||
express(app: Object): void;
|
||||
}
|
||||
|
||||
interface Extension {
|
||||
tags: string[];
|
||||
// Parser API is undocumented it is suggested to check the source: https://github.com/mozilla/nunjucks/blob/master/src/parser.js
|
||||
parse(parser: any, nodes: any, lexer: any): any;
|
||||
}
|
||||
|
||||
function installJinjaCompat(): void;
|
||||
|
||||
interface ILoader {
|
||||
async?: boolean;
|
||||
getSource(name: string): LoaderSource;
|
||||
extend?(extender: ILoader): ILoader;
|
||||
}
|
||||
|
||||
// Needs both Loader and ILoader since nunjucks uses a custom object system
|
||||
// Object system is also responsible for the extend methods
|
||||
class Loader {
|
||||
on(name: string, func: (...args: any[]) => any): void;
|
||||
emit(name: string, ...args: any[]): void;
|
||||
resolve(from: string, to: string): string;
|
||||
isRelative(filename: string): boolean;
|
||||
extend(toExtend: ILoader): ILoader;
|
||||
}
|
||||
|
||||
interface LoaderSource {
|
||||
src: string;
|
||||
path: string;
|
||||
noCache: boolean;
|
||||
}
|
||||
|
||||
interface FileSystemLoaderOptions {
|
||||
/** if true, the system will automatically update templates when they are changed on the filesystem */
|
||||
watch?: boolean;
|
||||
|
||||
/** if true, the system will avoid using a cache and templates will be recompiled every single time */
|
||||
noCache?: boolean;
|
||||
}
|
||||
|
||||
class FileSystemLoader extends Loader implements ILoader {
|
||||
init(searchPaths: string[], opts: any): void;
|
||||
getSource(name: string): LoaderSource;
|
||||
constructor(searchPaths?: string | string[], opts?: FileSystemLoaderOptions);
|
||||
}
|
||||
|
||||
export class WebLoader implements ILoader {
|
||||
constructor(baseUrl: string, opts?: any);
|
||||
getSource(name: string): LoaderSource;
|
||||
}
|
||||
|
||||
class PrecompiledLoader extends Loader implements ILoader {
|
||||
init(searchPaths: string[], opts: any): void;
|
||||
getSource(name: string): LoaderSource;
|
||||
}
|
||||
export interface PrecompileOptions {
|
||||
name?: string;
|
||||
asFunction?: boolean;
|
||||
force?: boolean;
|
||||
env?: Environment;
|
||||
include?: string[];
|
||||
exclude?: string[];
|
||||
wrapper?(templates: { name: string, template: string }, opts: PrecompileOptions): string;
|
||||
}
|
||||
|
||||
export = Nunjucks;
|
||||
export class Template {
|
||||
constructor(src: string, env?: Environment, eagerCompile?: boolean);
|
||||
render(context?: object): string;
|
||||
render(context?: object, callback?: (err: any, res: string) => any): void;
|
||||
}
|
||||
|
||||
export function configure(options: ConfigureOptions): Environment;
|
||||
export function configure(path: string | string[], options?: ConfigureOptions): Environment;
|
||||
|
||||
export interface ConfigureOptions {
|
||||
autoescape?: boolean;
|
||||
throwOnUndefined?: boolean;
|
||||
trimBlocks?: boolean;
|
||||
lstripBlocks?: boolean;
|
||||
watch?: boolean;
|
||||
noCache?: boolean;
|
||||
web?: {
|
||||
useCache?: boolean,
|
||||
async?: boolean
|
||||
};
|
||||
express?: object;
|
||||
tags?: {
|
||||
blockStart?: string,
|
||||
blockEnd?: string,
|
||||
variableStart?: string,
|
||||
variableEnd?: string,
|
||||
commentStart?: string,
|
||||
commentEnd?: string
|
||||
};
|
||||
}
|
||||
|
||||
export class Environment {
|
||||
options: {
|
||||
autoescape: boolean;
|
||||
};
|
||||
|
||||
constructor(loader?: ILoader | ILoader[] | null, opts?: ConfigureOptions);
|
||||
render(name: string, context?: object): string;
|
||||
render(name: string, context?: object, callback?: (err: any, res: string) => any): void;
|
||||
|
||||
renderString(name: string, context: object): string;
|
||||
renderString(name: string, context: object, callback?: (err: any, res: string) => any): void;
|
||||
|
||||
addFilter(name: string, func: (...args: any[]) => any, async?: boolean): void;
|
||||
getFilter(name: string): void;
|
||||
|
||||
addExtension(name: string, ext: Extension): void;
|
||||
removeExtension(name: string): void;
|
||||
getExtension(name: string): Extension;
|
||||
hasExtension(name: string): void;
|
||||
|
||||
addGlobal(name: string, value: any): void;
|
||||
|
||||
getTemplate(name: string, eagerCompile?: boolean): Template;
|
||||
getTemplate(name: string, eagerCompile?: boolean, callback?: (err: any, templ: Template) => Template): void;
|
||||
|
||||
express(app: object): void;
|
||||
}
|
||||
|
||||
export interface Extension {
|
||||
tags: string[];
|
||||
// Parser API is undocumented it is suggested to check the source: https://github.com/mozilla/nunjucks/blob/master/src/parser.js
|
||||
parse(parser: any, nodes: any, lexer: any): any;
|
||||
}
|
||||
|
||||
export function installJinjaCompat(): void;
|
||||
|
||||
export interface ILoader {
|
||||
async?: boolean;
|
||||
getSource(name: string): LoaderSource;
|
||||
extend?(extender: ILoader): ILoader;
|
||||
}
|
||||
|
||||
// Needs both Loader and ILoader since nunjucks uses a custom object system
|
||||
// Object system is also responsible for the extend methods
|
||||
export class Loader {
|
||||
on(name: string, func: (...args: any[]) => any): void;
|
||||
emit(name: string, ...args: any[]): void;
|
||||
resolve(from: string, to: string): string;
|
||||
isRelative(filename: string): boolean;
|
||||
extend(toExtend: ILoader): ILoader;
|
||||
}
|
||||
|
||||
export interface LoaderSource {
|
||||
src: string;
|
||||
path: string;
|
||||
noCache: boolean;
|
||||
}
|
||||
|
||||
export interface FileSystemLoaderOptions {
|
||||
/** if true, the system will automatically update templates when they are changed on the filesystem */
|
||||
watch?: boolean;
|
||||
|
||||
/** if true, the system will avoid using a cache and templates will be recompiled every single time */
|
||||
noCache?: boolean;
|
||||
}
|
||||
|
||||
export class FileSystemLoader extends Loader implements ILoader {
|
||||
init(searchPaths: string[], opts: any): void;
|
||||
getSource(name: string): LoaderSource;
|
||||
constructor(searchPaths?: string | string[], opts?: FileSystemLoaderOptions);
|
||||
}
|
||||
|
||||
export class WebLoader implements ILoader {
|
||||
constructor(baseUrl: string, opts?: any);
|
||||
getSource(name: string): LoaderSource;
|
||||
}
|
||||
|
||||
export class PrecompiledLoader extends Loader implements ILoader {
|
||||
init(searchPaths: string[], opts: any): void;
|
||||
getSource(name: string): LoaderSource;
|
||||
}
|
||||
|
||||
@@ -1,27 +1,35 @@
|
||||
|
||||
import nunjucks = require("nunjucks");
|
||||
|
||||
|
||||
nunjucks.configure({ autoescape: false });
|
||||
|
||||
let rendered = nunjucks.render("./noexists.html");
|
||||
|
||||
let ctx = { items: ["Hello", "this", "is", "for", "testing"] };
|
||||
let src = "{% for item in items %}{{item}}{% endfor %}";
|
||||
nunjucks.render('foo.html', { username: 'James' });
|
||||
nunjucks.render('async.html', (err: any, res: string) => {});
|
||||
|
||||
const ctx = { items: ["Hello", "this", "is", "for", "testing"] };
|
||||
const src = "{% for item in items %}{{item}}{% endfor %}";
|
||||
|
||||
rendered = nunjucks.renderString(src, ctx);
|
||||
nunjucks.renderString('Hello {{ username }}', { username: 'James' });
|
||||
|
||||
let compiled = nunjucks.compile(src);
|
||||
const compiled = nunjucks.compile(src);
|
||||
rendered = compiled.render(ctx);
|
||||
nunjucks.compile('Hello {{ username }}').render({ username: 'James' });
|
||||
|
||||
rendered = nunjucks.precompileString(src, {
|
||||
name: "TestyWesty"
|
||||
});
|
||||
|
||||
let template = new nunjucks.Template(src);
|
||||
const template = new nunjucks.Template(src);
|
||||
rendered = template.render(ctx);
|
||||
|
||||
let env = nunjucks.configure({ autoescape: false });
|
||||
nunjucks.configure('/views');
|
||||
nunjucks.configure('views', {
|
||||
autoescape: true,
|
||||
watch: true
|
||||
});
|
||||
rendered = env.renderString(src, ctx);
|
||||
|
||||
env.addExtension("SpawnGlitter", {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"nunjucks-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,79 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"interface-name": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import PLazy = require('p-lazy');
|
||||
|
||||
const lazyPromise = new PLazy<string>((resolve, reject) => {
|
||||
if (typeof resolve === 'object') {
|
||||
if (!true) {
|
||||
resolve('foo');
|
||||
} else {
|
||||
reject(new Error());
|
||||
|
||||
Vendored
+9
-9
@@ -10,6 +10,7 @@
|
||||
// Simon Højberg <https://github.com/hojberg>
|
||||
// Charles-Philippe Clermont <https://github.com/charlespwd>
|
||||
// Samson Keung <https://github.com/samsonkeung>
|
||||
// Angelo Ocana <https://github.com/angeloocana>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@@ -1196,19 +1197,18 @@ declare namespace R {
|
||||
pair<F, S>(fst: F, snd: S): [F, S];
|
||||
|
||||
/**
|
||||
* Accepts as its arguments a function and any number of values and returns a function that,
|
||||
* when invoked, calls the original function with all of the values prepended to the
|
||||
* original function's arguments list. In some libraries this function is named `applyLeft`.
|
||||
* Takes a function `f` and a list of arguments, and returns a function `g`.
|
||||
* When applied, `g` returns the result of applying `f` to the arguments
|
||||
* provided initially followed by the arguments provided to `g`.
|
||||
*/
|
||||
partial(fn: (...a: any[]) => any, ...args: any[]): (...a: any[]) => any;
|
||||
partial<T>(fn: (...a: any[]) => T, ...args: any[]): (...a: any[]) => T;
|
||||
partial<T>(fn: (...a: any[]) => T, args: any[]): (...a: any[]) => T;
|
||||
|
||||
/**
|
||||
* Accepts as its arguments a function and any number of values and returns a function that,
|
||||
* when invoked, calls the original function with all of the values appended to the original
|
||||
* function's arguments list.
|
||||
* Takes a function `f` and a list of arguments, and returns a function `g`.
|
||||
* When applied, `g` returns the result of applying `f` to the arguments
|
||||
* provided to `g` followed by the arguments provided initially.
|
||||
*/
|
||||
partialRight(fn: (...a: any[]) => any, ...args: any[]): (...a: any[]) => any;
|
||||
partialRight<T>(fn: (...a: any[]) => T, args: any[]): (...a: any[]) => T;
|
||||
|
||||
/**
|
||||
* Takes a predicate and a list and returns the pair of lists of elements
|
||||
|
||||
@@ -266,18 +266,18 @@ R.times(i, 5);
|
||||
return a * b;
|
||||
}
|
||||
|
||||
const double = R.partial<number>(multiply, 2);
|
||||
const double = R.partial<number>(multiply, [2]);
|
||||
double(2); // => 4
|
||||
|
||||
function greet(salutation: string, title: string, firstName: string, lastName: string) {
|
||||
return `${salutation}, ${title} ${firstName} ${lastName}!`;
|
||||
}
|
||||
|
||||
const sayHello = R.partial(greet, "Hello");
|
||||
const sayHelloToMs = R.partial(sayHello, "Ms.");
|
||||
const sayHello = R.partial(greet, ["Hello"]);
|
||||
const sayHelloToMs = R.partial(sayHello, ["Ms."]);
|
||||
sayHelloToMs("Jane", "Jones"); // => 'Hello, Ms. Jane Jones!'
|
||||
|
||||
const greetMsJaneJones = R.partialRight(greet, "Ms.", "Jane", "Jones");
|
||||
const greetMsJaneJones = R.partialRight(greet, ["Ms.", "Jane", "Jones"]);
|
||||
greetMsJaneJones("Hello"); // => 'Hello, Ms. Jane Jones!'
|
||||
})();
|
||||
|
||||
|
||||
Vendored
+10
@@ -64,6 +64,11 @@ declare namespace ReactGridLayout {
|
||||
*/
|
||||
maxH?: number;
|
||||
|
||||
/**
|
||||
* set by DragEvents (onDragStart, onDrag, onDragStop) and ResizeEvents (onResizeStart, onResize, onResizeStop)
|
||||
*/
|
||||
moved?: boolean;
|
||||
|
||||
/**
|
||||
* If true, equal to `isDraggable: false` and `isResizable: false`.
|
||||
*/
|
||||
@@ -168,6 +173,11 @@ declare namespace ReactGridLayout {
|
||||
*/
|
||||
isResizable?: boolean;
|
||||
|
||||
/**
|
||||
* Enable or disable grid rearrangement when dragging/resizing an element.
|
||||
*/
|
||||
isRearrangeable?: boolean;
|
||||
|
||||
/**
|
||||
* Uses CSS3 `translate()` instead of position top/left.
|
||||
* This makes about 6x faster paint performance.
|
||||
|
||||
Vendored
+1
-1
@@ -6966,7 +6966,7 @@ export interface PanResponderGestureState {
|
||||
*/
|
||||
export interface PanResponderCallbacks {
|
||||
onMoveShouldSetPanResponder?: (e: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean
|
||||
onStartShouldSetPanResponder?: (e: GestureResponderEvent, gestureState: PanResponderGestureState) => void
|
||||
onStartShouldSetPanResponder?: (e: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean
|
||||
onPanResponderGrant?: (e: GestureResponderEvent, gestureState: PanResponderGestureState) => void
|
||||
onPanResponderMove?: (e: GestureResponderEvent, gestureState: PanResponderGestureState) => void
|
||||
onPanResponderRelease?: (e: GestureResponderEvent, gestureState: PanResponderGestureState) => void
|
||||
|
||||
Vendored
+84
-59
@@ -1,65 +1,90 @@
|
||||
// Type definitions for react-responsive 1.1.3
|
||||
// Type definitions for react-responsive 3.0
|
||||
// Project: https://github.com/contra/react-responsive
|
||||
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>
|
||||
// Alec Hill <https://github.com/alechill>
|
||||
// Javier Gonzalez <https://github.com/xaviergonz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
declare module "react-responsive" {
|
||||
import * as React from "react";
|
||||
|
||||
namespace MediaQuery {
|
||||
export interface MediaQueryProps {
|
||||
query?: string;
|
||||
// matchers
|
||||
orientation?: "portrait" | "landscape";
|
||||
scan?: "progressive" | "interlace";
|
||||
aspectRatio?: string;
|
||||
deviceAspectRatio?: string;
|
||||
height?: number | string;
|
||||
deviceHeight?: number | string;
|
||||
width?: number | string;
|
||||
deviceWidth?: number | string;
|
||||
color?: boolean;
|
||||
colorIndex?: boolean;
|
||||
monochrome?: boolean;
|
||||
resolution?: number | string;
|
||||
// types
|
||||
minAspectRatio?: string;
|
||||
maxAspectRatio?: string;
|
||||
minDeviceAspectRatio?: string;
|
||||
maxDeviceAspectRatio?: string;
|
||||
minHeight?: number | string;
|
||||
maxHeight?: number | string;
|
||||
minDeviceHeight?: number | string;
|
||||
maxDeviceHeight?: number | string;
|
||||
minDeviceWidth?: number | string;
|
||||
maxDeviceWidth?: number | string;
|
||||
minWidth?: number | string;
|
||||
maxWidth?: number | string;
|
||||
minColor?: number;
|
||||
maxColor?: number;
|
||||
minColorIndex?: number;
|
||||
maxColorIndex?: number;
|
||||
minMonochrome?: number;
|
||||
maxMonochrome?: number;
|
||||
minResolution?: number | string;
|
||||
maxResolution?: number | string;
|
||||
// types
|
||||
all?: boolean;
|
||||
grid?: boolean;
|
||||
aural?: boolean;
|
||||
braille?: boolean;
|
||||
handheld?: boolean;
|
||||
print?: boolean;
|
||||
projection?: boolean;
|
||||
screen?: boolean;
|
||||
tty?: boolean;
|
||||
tv?: boolean;
|
||||
embossed?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
class MediaQuery extends React.Component<MediaQuery.MediaQueryProps, any> { }
|
||||
export = MediaQuery;
|
||||
import * as React from "react";
|
||||
|
||||
export interface MediaQueryTypes {
|
||||
all?: boolean;
|
||||
grid?: boolean;
|
||||
aural?: boolean;
|
||||
braille?: boolean;
|
||||
handheld?: boolean;
|
||||
print?: boolean;
|
||||
projection?: boolean;
|
||||
screen?: boolean;
|
||||
tty?: boolean;
|
||||
tv?: boolean;
|
||||
embossed?: boolean;
|
||||
}
|
||||
|
||||
export type MediaQueryType = keyof MediaQueryTypes;
|
||||
|
||||
export interface MediaQueryMatchers {
|
||||
aspectRatio?: string;
|
||||
deviceAspectRatio?: string;
|
||||
height?: number | string;
|
||||
deviceHeight?: number | string;
|
||||
width?: number | string;
|
||||
deviceWidth?: number | string;
|
||||
color?: boolean;
|
||||
colorIndex?: boolean;
|
||||
monochrome?: boolean;
|
||||
resolution?: number | string;
|
||||
orientation?: 'portrait' | 'landscape';
|
||||
scan?: 'progressive' | 'interlace';
|
||||
type?: MediaQueryType;
|
||||
}
|
||||
|
||||
export interface MediaQueryFeatures extends MediaQueryMatchers {
|
||||
minAspectRatio?: string;
|
||||
maxAspectRatio?: string;
|
||||
|
||||
minDeviceAspectRatio?: string;
|
||||
maxDeviceAspectRatio?: string;
|
||||
|
||||
minHeight?: number | string;
|
||||
maxHeight?: number | string;
|
||||
|
||||
minDeviceHeight?: number | string;
|
||||
maxDeviceHeight?: number | string;
|
||||
|
||||
minWidth?: number | string;
|
||||
maxWidth?: number | string;
|
||||
|
||||
minDeviceWidth?: number | string;
|
||||
maxDeviceWidth?: number | string;
|
||||
|
||||
minColor?: number;
|
||||
maxColor?: number;
|
||||
|
||||
minColorIndex?: number;
|
||||
maxColorIndex?: number;
|
||||
|
||||
minMonochrome?: number;
|
||||
maxMonochrome?: number;
|
||||
|
||||
minResolution?: number | string;
|
||||
maxResolution?: number | string;
|
||||
}
|
||||
|
||||
export interface MediaQueryAllQueryable extends MediaQueryFeatures, MediaQueryTypes {}
|
||||
|
||||
export interface MediaQueryProps extends MediaQueryAllQueryable {
|
||||
component?: string | React.SFC<any> | React.ClassType<any, any, any> | React.ComponentClass<any>;
|
||||
query?: string;
|
||||
style?: React.CSSProperties;
|
||||
className?: string;
|
||||
children?: React.ReactNode | ((matches: boolean) => React.ReactNode);
|
||||
values?: Partial<MediaQueryMatchers>;
|
||||
onBeforeChange?: (matches: boolean) => void;
|
||||
onChange?: (matches: boolean) => void;
|
||||
}
|
||||
|
||||
declare class MediaQuery extends React.Component<MediaQueryProps> { }
|
||||
export function toQuery(matchers: Partial<MediaQueryAllQueryable>): string;
|
||||
export default MediaQuery;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import * as React from "react";
|
||||
import * as MediaQuery from "react-responsive";
|
||||
import MediaQuery, {
|
||||
toQuery
|
||||
} from "react-responsive";
|
||||
|
||||
class Test extends React.Component {
|
||||
class QueryTests extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
@@ -37,6 +39,99 @@ class Test extends React.Component {
|
||||
</MediaQuery>
|
||||
</MediaQuery>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const ChildrenPropTest: React.SFC = ({ children }) => <MediaQuery minWidth={992} children={children} />;
|
||||
|
||||
class PropsTests extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<MediaQuery minDeviceWidth={700} component="ul">
|
||||
<li>Item 1</li>
|
||||
<li>Item 2</li>
|
||||
</MediaQuery>
|
||||
<MediaQuery minDeviceWidth={700} component={ChildrenPropTest}>
|
||||
<li>Item 1</li>
|
||||
<li>Item 2</li>
|
||||
</MediaQuery>
|
||||
<MediaQuery minDeviceWidth={700} component={QueryTests}>
|
||||
<li>Item 1</li>
|
||||
<li>Item 2</li>
|
||||
</MediaQuery>
|
||||
<MediaQuery minDeviceWidth={1200} className="some-class">
|
||||
<div>Wrapped</div>
|
||||
<div>Content</div>
|
||||
</MediaQuery>
|
||||
<MediaQuery style={{textTransform: 'uppercase'}} all={true}>
|
||||
uppercase me!
|
||||
</MediaQuery>
|
||||
<MediaQuery minDeviceWidth={1224}
|
||||
values={{ aspectRatio: '4/3',
|
||||
deviceAspectRatio: '4/3',
|
||||
height: '1600px',
|
||||
deviceHeight: 1600,
|
||||
width: 1600,
|
||||
deviceWidth: '1600px',
|
||||
color: true,
|
||||
colorIndex: true,
|
||||
monochrome: false,
|
||||
resolution: 1,
|
||||
orientation: 'portrait',
|
||||
scan: 'progressive',
|
||||
type: 'print'
|
||||
}}>
|
||||
Values supplied for SSR
|
||||
</MediaQuery>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class FunctionChildrenTest extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<MediaQuery minDeviceWidth={700}>
|
||||
{(matches: boolean) => {
|
||||
if (matches) {
|
||||
return <div>Media query matches!</div>;
|
||||
} else {
|
||||
return <div>Media query does not match!</div>;
|
||||
}
|
||||
}}
|
||||
</MediaQuery>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CallbackTest extends React.Component {
|
||||
onBeforeChange = (matches: boolean): void => {
|
||||
if (matches) {
|
||||
// do something
|
||||
}
|
||||
}
|
||||
|
||||
onChange = (matches: boolean): void => {
|
||||
if (matches) {
|
||||
// do something else
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<MediaQuery minDeviceWidth={700}
|
||||
onBeforeChange={this.onBeforeChange}
|
||||
onChange={this.onChange}>
|
||||
Media query matches!
|
||||
</MediaQuery>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const queryStrTest: string = toQuery({
|
||||
type: 'print',
|
||||
screen: true,
|
||||
minHeight: 666
|
||||
});
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
@@ -22,4 +21,4 @@
|
||||
"index.d.ts",
|
||||
"react-responsive-tests.tsx"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,79 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
|
||||
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
// Type definitions for react-responsive 1.1.3
|
||||
// Project: https://github.com/contra/react-responsive
|
||||
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
declare module "react-responsive" {
|
||||
import * as React from "react";
|
||||
|
||||
namespace MediaQuery {
|
||||
export interface MediaQueryProps {
|
||||
query?: string;
|
||||
// matchers
|
||||
orientation?: "portrait" | "landscape";
|
||||
scan?: "progressive" | "interlace";
|
||||
aspectRatio?: string;
|
||||
deviceAspectRatio?: string;
|
||||
height?: number | string;
|
||||
deviceHeight?: number | string;
|
||||
width?: number | string;
|
||||
deviceWidth?: number | string;
|
||||
color?: boolean;
|
||||
colorIndex?: boolean;
|
||||
monochrome?: boolean;
|
||||
resolution?: number | string;
|
||||
// types
|
||||
minAspectRatio?: string;
|
||||
maxAspectRatio?: string;
|
||||
minDeviceAspectRatio?: string;
|
||||
maxDeviceAspectRatio?: string;
|
||||
minHeight?: number | string;
|
||||
maxHeight?: number | string;
|
||||
minDeviceHeight?: number | string;
|
||||
maxDeviceHeight?: number | string;
|
||||
minDeviceWidth?: number | string;
|
||||
maxDeviceWidth?: number | string;
|
||||
minWidth?: number | string;
|
||||
maxWidth?: number | string;
|
||||
minColor?: number;
|
||||
maxColor?: number;
|
||||
minColorIndex?: number;
|
||||
maxColorIndex?: number;
|
||||
minMonochrome?: number;
|
||||
maxMonochrome?: number;
|
||||
minResolution?: number | string;
|
||||
maxResolution?: number | string;
|
||||
// types
|
||||
all?: boolean;
|
||||
grid?: boolean;
|
||||
aural?: boolean;
|
||||
braille?: boolean;
|
||||
handheld?: boolean;
|
||||
print?: boolean;
|
||||
projection?: boolean;
|
||||
screen?: boolean;
|
||||
tty?: boolean;
|
||||
tv?: boolean;
|
||||
embossed?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
class MediaQuery extends React.Component<MediaQuery.MediaQueryProps, any> { }
|
||||
export = MediaQuery;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import * as React from "react";
|
||||
import * as MediaQuery from "react-responsive";
|
||||
|
||||
class Test extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<div>Device Test!</div>
|
||||
<MediaQuery minDeviceWidth={1224}>
|
||||
<div>You are a desktop or laptop</div>
|
||||
<MediaQuery minDeviceWidth={1824}>
|
||||
<div>You also have a huge screen</div>
|
||||
</MediaQuery>
|
||||
<MediaQuery maxWidth={1224}>
|
||||
<div>You are sized like a tablet or mobile phone though</div>
|
||||
</MediaQuery>
|
||||
</MediaQuery>
|
||||
<MediaQuery maxDeviceWidth={1224}>
|
||||
<div>You are a tablet or mobile phone</div>
|
||||
</MediaQuery>
|
||||
<MediaQuery orientation="portrait">
|
||||
<div>You are portrait</div>
|
||||
</MediaQuery>
|
||||
<MediaQuery orientation="landscape">
|
||||
<div>You are landscape</div>
|
||||
</MediaQuery>
|
||||
<MediaQuery minResolution="2dppx">
|
||||
<div>You are retina</div>
|
||||
</MediaQuery>
|
||||
<MediaQuery query="(min-device-width: 1224px)">
|
||||
<div>You are a desktop or laptop</div>
|
||||
<MediaQuery query="(min-device-width: 1824px)">
|
||||
<div>You also have a huge screen</div>
|
||||
</MediaQuery>
|
||||
<MediaQuery query="(max-width: 1224px)">
|
||||
<div>You are sized like a tablet or mobile phone though</div>
|
||||
</MediaQuery>
|
||||
</MediaQuery>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"types": [],
|
||||
"paths": {
|
||||
"react-responsive": [
|
||||
"react-responsive/v1"
|
||||
],
|
||||
"react-responsive/*": [
|
||||
"react-responsive/v1/*"
|
||||
]
|
||||
},
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-responsive-tests.tsx"
|
||||
]
|
||||
}
|
||||
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
// Type definitions for react-s-alert 1.3
|
||||
// Project: https://github.com/juliancwirko/react-s-alert
|
||||
// Definitions by: mitsuruog <https://github.com/mitsuruog>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
declare class SAlert extends React.Component<SAlert.SAlertProps> {}
|
||||
|
||||
declare namespace SAlert {
|
||||
interface SAlertConfigProps {
|
||||
position?: string;
|
||||
offset?: number;
|
||||
stack?: boolean | SAlertStackProps;
|
||||
effect?: string;
|
||||
beep?: string | boolean | SAlertBeepProps;
|
||||
timeout?: string | number;
|
||||
html?: boolean;
|
||||
onClose?: () => void;
|
||||
onShow?: () => void;
|
||||
customFields?: object;
|
||||
contentTemplate?: (...args: any[]) => any;
|
||||
}
|
||||
|
||||
interface SAlertProps extends SAlertConfigProps {
|
||||
message?: string;
|
||||
}
|
||||
|
||||
interface SAlertStackProps {
|
||||
limit?: number;
|
||||
spacing?: number;
|
||||
}
|
||||
|
||||
interface SAlertBeepProps {
|
||||
info?: string;
|
||||
error?: string;
|
||||
warning?: string;
|
||||
success?: string;
|
||||
}
|
||||
|
||||
function info(msg?: string, data?: SAlertConfigProps): number;
|
||||
|
||||
function error(msg?: string, data?: SAlertConfigProps): number;
|
||||
|
||||
function warning(msg?: string, data?: SAlertConfigProps): number;
|
||||
|
||||
function success(msg?: string, data?: SAlertConfigProps): number;
|
||||
|
||||
function close(id: number): void;
|
||||
|
||||
function closeAll(): void;
|
||||
}
|
||||
|
||||
export default SAlert;
|
||||
@@ -0,0 +1,46 @@
|
||||
import * as React from "react";
|
||||
import Alert from "react-s-alert";
|
||||
|
||||
const config = {
|
||||
position: "top",
|
||||
offset: 100,
|
||||
stack: {
|
||||
limit: 3,
|
||||
spacing: 50,
|
||||
},
|
||||
effect: "genie",
|
||||
beep: {
|
||||
info: "beep.mp3",
|
||||
error: "beep.mp3",
|
||||
warning: "beep.mp3",
|
||||
success: "beep.mp3",
|
||||
},
|
||||
timeout: 1000,
|
||||
html: true,
|
||||
onClose: () => {},
|
||||
onShow: () => {},
|
||||
customFields: {},
|
||||
};
|
||||
|
||||
class Test extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<Alert />
|
||||
<Alert
|
||||
{...config}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Alert.info("I am a info message.", config);
|
||||
Alert.error("I am an error message.", config);
|
||||
Alert.warning("I am a warning message.", config);
|
||||
Alert.success("I am a success message", config);
|
||||
|
||||
const index = Alert.info("Hello");
|
||||
Alert.close(index);
|
||||
|
||||
Alert.closeAll();
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-s-alert-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: http://semantic-ui.com/
|
||||
// Definitions by: Leonard Thieu <https://github.com/leonard-thieu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery" />
|
||||
|
||||
|
||||
Vendored
+21
@@ -33,6 +33,27 @@ export interface Options {
|
||||
* Whether timing info should be logged.
|
||||
*/
|
||||
log?: boolean;
|
||||
/**
|
||||
* a reduce function for calculating custom cluster properties
|
||||
*
|
||||
* @example
|
||||
* function (accumulated, props) { accumulated.sum += props.sum; }
|
||||
*/
|
||||
reduce?: (accumulated: any, props: any) => void;
|
||||
/**
|
||||
* initial properties of a cluster (before running the reducer)
|
||||
*
|
||||
* @example
|
||||
* function () { return {sum: 0}; }
|
||||
*/
|
||||
initial?: () => any;
|
||||
/**
|
||||
* properties to use for individual points when running the reducer
|
||||
*
|
||||
* @example
|
||||
* function (props) { return {sum: props.my_value}; }
|
||||
*/
|
||||
map?: (props: any) => any;
|
||||
}
|
||||
|
||||
export class Supercluster {
|
||||
|
||||
@@ -2,21 +2,36 @@ import supercluster, { Point } from 'supercluster';
|
||||
|
||||
const point1: Point = {
|
||||
type: 'Feature',
|
||||
properties: {},
|
||||
properties: {my_value: 2},
|
||||
geometry: { type: 'Point', coordinates: [10, 20] }
|
||||
};
|
||||
const point2: Point = {
|
||||
type: 'Feature',
|
||||
properties: {},
|
||||
properties: {my_value: 3},
|
||||
geometry: { type: 'Point', coordinates: [20, 30] }
|
||||
};
|
||||
const points = [point1, point2];
|
||||
|
||||
const initialFunction = () => {
|
||||
return {sum: 0};
|
||||
};
|
||||
|
||||
const mapFunction = (props: any) => {
|
||||
return {sum: props.my_value};
|
||||
};
|
||||
|
||||
const reduceFunction = (accumulated: any, props: any) => {
|
||||
accumulated.sum += props.sum;
|
||||
};
|
||||
|
||||
const index = supercluster({
|
||||
radius: 40,
|
||||
maxZoom: 16,
|
||||
extent: 256,
|
||||
log: true
|
||||
log: true,
|
||||
initial: initialFunction,
|
||||
map: mapFunction,
|
||||
reduce: reduceFunction,
|
||||
});
|
||||
index.load(points);
|
||||
const clusters = index.getClusters([-180, -85, 180, 85], 2);
|
||||
|
||||
Vendored
+7
@@ -91,6 +91,13 @@ declare module 'underscore' {
|
||||
*/
|
||||
clean(str: string): string;
|
||||
|
||||
/**
|
||||
* Replace diacritic characters with closest ASCII equivalents.
|
||||
* cleanDiacritics('ääkkönen') => 'aakkonen'
|
||||
* @param str
|
||||
*/
|
||||
cleanDiacritics(str: string): string;
|
||||
|
||||
/**
|
||||
* Count occurences of a sub string.
|
||||
* ('Hello world', 'l') => 3
|
||||
|
||||
@@ -13,6 +13,8 @@ _.chop('whitespace', 3);
|
||||
|
||||
_.clean(' foo bar ');
|
||||
|
||||
_.cleanDiacritics('ääkkönen');
|
||||
|
||||
_.chars('Hello');
|
||||
|
||||
_.swapCase('hELLO');
|
||||
|
||||
Reference in New Issue
Block a user