Merge pull request #1 from DefinitelyTyped/master

Merge latest commits from base
This commit is contained in:
Christopher Cortes
2016-08-10 12:59:38 +02:00
committed by GitHub
133 changed files with 21428 additions and 3480 deletions
+74
View File
@@ -0,0 +1,74 @@
/// <reference path="ajv.d.ts" />
import * as Ajv from 'ajv';
var ajv = new Ajv(); // options can be passed, e.g. {allErrors: true}
var validate = ajv.compile({});
var valid = validate({});
if (!valid) console.log(validate.errors);
var valid = ajv.validate({}, {});
if (!valid) console.log(ajv.errors);
ajv.addSchema({}, 'mySchema');
var valid = ajv.validate('mySchema', {});
if (!valid) console.log(ajv.errorsText());
ajv.addKeyword('range', {
type: 'number', compile: function (sch, parentSchema) {
var min: any = sch[0];
var max: any = sch[1];
return parentSchema.exclusiveRange === true
? function (data) { return data > min && data < max; }
: function (data) { return data >= min && data <= max; }
}
});
var schema = { "range": [2, 4], "exclusiveRange": true };
var validate = ajv.compile(schema);
console.log(validate(2.01)); // true
console.log(validate(3.99)); // true
console.log(validate(2)); // false
console.log(validate(4)); // false
declare var request: any;
function loadSchema(uri: any, callback: any) {
request.json(uri, function (err: any, res: any, body: any) {
if (err || res.statusCode >= 400)
callback(err || new Error('Loading error: ' + res.statusCode));
else
callback(null, body);
});
}
var ajv = new Ajv({ loadSchema: loadSchema });
ajv.compileAsync(schema, function (err, validate) {
if (err) return;
var valid = validate({});
});
declare var knex: any;
function checkIdExists(schema: any, data: any) {
return knex(schema.table)
.select('id')
.where('id', data)
.then(function (rows: any) {
return true;
});
}
var validate = ajv.compile(schema);
(validate({ userId: 1, postId: 19 }) as PromiseLike<boolean>)
.then(function (valid) {
// "valid" is always true here
console.log('Data is valid');
}, function (err) {
if (!(err instanceof Ajv.ValidationError)) throw err;
// data is invalid
console.log('Validation errors:', err.errors);
});
var ajv = new Ajv({ /* async: 'es7', */ transpile: 'nodent' });
var validate = ajv.compile(schema); // transpiled es7 async function
(validate({}) as PromiseLike<any>).then(() => { }, () => { });
+112
View File
@@ -0,0 +1,112 @@
// Type definitions for ajv
// Project: https://github.com/epoberezkin/ajv
// Definitions by: York Yao <https://github.com/plantain-00/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "ajv" {
class Ajv {
/**
* Create Ajv instance.
*/
constructor(options?: Ajv.AjvOptions);
/**
* Generate validating function and cache the compiled schema for future use.
*/
compile(schema: any): Ajv.AjvValidate;
/**
* Asyncronous version of compile method that loads missing remote schemas using asynchronous function in options.loadSchema.
*/
compileAsync(schema: any, callback: (error: Error, validate: Ajv.AjvValidate) => void): void;
/**
* Validate data using passed schema (it will be compiled and cached).
*/
validate(schema: any, data: any): boolean | PromiseLike<boolean>;
errors: Ajv.ValidationError[];
/**
* Add schema(s) to validator instance.
*/
addSchema(schema: any, key: string): void;
/**
* Adds meta schema(s) that can be used to validate other schemas.
* That function should be used instead of addSchema because there may be instance options that would compile a meta schema incorrectly (at the moment it is removeAdditional option).
*/
addMetaSchema(schema: any, key: string): void;
/**
* Validates schema.
* This method should be used to validate schemas rather than validate due to the inconsistency of uri format in JSON-Schema standard.
*/
validateSchema(schema: any): Boolean;
/**
* Retrieve compiled schema previously added with addSchema by the key passed to addSchema or by its full reference (id).
* Returned validating function has schema property with the reference to the original schema.
*/
getSchema(key: string): Ajv.AjvValidate;
/**
* Remove added/cached schema.
* Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references.
*/
removeSchema(schema: any): void;
/**
* Add custom format to validate strings. It can also be used to replace pre-defined formats for Ajv instance.
*/
addFormat(name: string, format: any): void;
/**
* Add custom validation keyword to Ajv instance.
*/
addKeyword(keyword: string, definition: Ajv.AjxKeywordDefinition): void;
errorsText(): any;
static ValidationError: Function;
}
namespace Ajv {
type AjvOptions = {
v5?: boolean;
allErrors?: boolean;
verbose?: boolean;
jsonPointers?: boolean;
uniqueItems?: boolean;
unicode?: boolean;
format?: string;
formats?: any;
schemas?: any;
missingRefs?: boolean;
loadSchema?(uri: string, callback: (error: Error, body: any) => void): void;
removeAdditional?: boolean;
useDefaults?: boolean;
coerceTypes?: boolean;
async?: any;
transpile?: string;
meta?: boolean;
validateSchema?: boolean;
addUsedSchema?: boolean;
inlineRefs?: boolean;
passContext?: boolean;
loopRequired?: number;
ownProperties?: boolean;
multipleOfPrecision?: boolean;
errorDataPath?: string,
messages?: boolean;
beautify?: boolean;
cache?: any;
}
type AjvValidate = ((data: any) => boolean | PromiseLike<boolean>) & {
errors: ValidationError[];
}
type AjxKeywordDefinition = {
async?: boolean;
type: string;
compile?: (schema: any, parentsSchema: any) => ((data: any) => boolean | PromiseLike<boolean>);
validate?: (schema: any, data: any) => boolean;
}
type ValidationError = {
keyword: string;
dataPath: string;
schemaPath: string;
params: any;
message: string;
schema: any;
parentSchema: any;
data: any;
}
}
export = Ajv;
}
+2 -2
View File
@@ -53,8 +53,8 @@ declare namespace AltJS {
export type Source = {[name:string]: () => SourceModel<any>};
export interface SourceModel<S> {
local(state:any):any;
remote(state:any):Promise<S>;
local(state:any, ...args: any[]):any;
remote(state:any, ...args: any[]):Promise<S>;
shouldFetch?(fetchFn:(...args:Array<any>) => boolean):void;
loading?:(args:any) => void;
success?:(state:S) => void;
+3
View File
@@ -26,6 +26,9 @@ declare namespace AmCharts {
/** Clears all the charts on page, removes listeners and intervals. */
function clear();
/** Create chart by params. */
function makeChart(selector: string, params: any, delay?: number): AmChart;
/** AmPieChart class creates pie/donut chart. In order to display pie chart you need to set at least three properties - dataProvider, titleField and valueField.
@example
+10 -9
View File
@@ -1,10 +1,11 @@
/// <reference path="./angular-permission.d.ts" />
import permission = angular.permission;
import permissionNamespace = angular.permission;
import { permission, ngPermission, uiPermission } from "angular-permission";
angular
.module('fooModule', ['permission', 'user'])
.run(function (PermissionStore: permission.PermissionStore, User: any) {
.module('fooModule', [permission, ngPermission, uiPermission, 'user'])
.run(function (PermissionStore: permissionNamespace.PermissionStore, User: any) {
// Define anonymous permission
PermissionStore
.definePermission('anonymous', function (stateParams) {
@@ -22,8 +23,8 @@ angular
hasPermissionDefinition(permission: string) : angular.IPromise<any>;
}
angular.module('barModule', ['permission', 'user'])
.run(function (PermissionStore: permission.PermissionStore, User: BackendUserService, $q: angular.IQService) {
angular.module('barModule', [permission, 'user'])
.run(function (PermissionStore: permissionNamespace.PermissionStore, User: BackendUserService, $q: angular.IQService) {
PermissionStore
// Define user permission calling back-end
.definePermission('user', function (stateParams) {
@@ -64,14 +65,14 @@ angular
PermissionStore.removePermissionDefinition('user');
let permissions: Array<permission.Permission> = PermissionStore.getStore();
let permissions: Array<permissionNamespace.Permission> = PermissionStore.getStore();
});
angular
.module('fooModule', ['permission', 'user'])
.run(function (RoleStore: permission.RoleStore, User: any) {
.module('fooModule', [permission, 'user'])
.run(function (RoleStore: permissionNamespace.RoleStore, User: any) {
RoleStore
// Permission array validated role
// Library will internally validate if 'user' and 'editor' permissions are valid when checking if role is valid
@@ -88,5 +89,5 @@ angular
RoleStore.removeRoleDefinition('user');
let roles: Array<permission.Role> = RoleStore.getStore();
let roles: Array<permissionNamespace.Role> = RoleStore.getStore();
});
+6
View File
@@ -173,3 +173,9 @@ declare namespace angular.permission {
options?: angular.ui.IStateOptions;
}
}
declare module "angular-permission" {
export var permission: string;
export var ngPermission: string;
export var uiPermission: string;
}
+1
View File
@@ -95,6 +95,7 @@ declare namespace angular.translate {
use(key: string): ITranslateProvider;
storageKey(): string;
storageKey(key: string): void; // JeroMiya - the library should probably return ITranslateProvider but it doesn't here
uniformLanguageTag(options: string | Object): ITranslateProvider;
useUrlLoader(url: string): ITranslateProvider;
useStaticFilesLoader(options: IStaticFilesLoaderOptions | { files: IStaticFilesLoaderOptions[] }): ITranslateProvider;
useLoader(loaderFactory: string, options?: any): ITranslateProvider;
+7 -6
View File
@@ -118,14 +118,14 @@ declare namespace angular {
fromJson(json: string): any;
identity<T>(arg?: T): T;
injector(modules?: any[], strictDi?: boolean): auto.IInjectorService;
isArray(value: any): boolean;
isDate(value: any): boolean;
isArray(value: any): value is Array<any>;
isDate(value: any): value is Date;
isDefined(value: any): boolean;
isElement(value: any): boolean;
isFunction(value: any): boolean;
isNumber(value: any): boolean;
isObject(value: any): boolean;
isString(value: any): boolean;
isFunction(value: any): value is Function;
isNumber(value: any): value is number;
isObject(value: any): value is Object;
isString(value: any): value is string;
isUndefined(value: any): boolean;
lowercase(str: string): string;
@@ -387,6 +387,7 @@ declare namespace angular {
$invalid: boolean;
$submitted: boolean;
$error: any;
$name: string;
$pending: any;
$addControl(control: INgModelController | IFormController): void;
$removeControl(control: INgModelController | IFormController): void;
-7
View File
@@ -392,13 +392,6 @@ function (results) {
]);
});
var sys;
var iterator = async.iterator([
function () { sys.p('one'); },
function () { sys.p('two'); },
function () { sys.p('three'); }
]);
async.parallel([
async.apply(fs.writeFile, 'testfile1', 'test1'),
async.apply(fs.writeFile, 'testfile2', 'test2'),
+46 -6
View File
@@ -1,4 +1,4 @@
// Type definitions for Async 1.4.2
// Type definitions for Async 2.0.1
// Project: https://github.com/caolan/async
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Arseniy Maximov <https://github.com/kern0>, Joe Herman <https://github.com/Penryn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -37,6 +37,13 @@ interface AsyncQueue<T> {
pause(): void
resume(): void;
kill(): void;
workersList(): {
data: T,
callback: Function
}[];
error(error: Error, data: any): void;
unsaturated(): void;
buffer: number;
}
interface AsyncPriorityQueue<T> {
@@ -54,6 +61,14 @@ interface AsyncPriorityQueue<T> {
pause(): void;
resume(): void;
kill(): void;
workersList(): {
data: T,
priority: number,
callback: Function
}[];
error(error: Error, data: any): void;
unsaturated(): void;
buffer: number;
}
interface AsyncCargo {
@@ -85,6 +100,9 @@ interface Async {
map<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
mapSeries<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
mapLimit<T, R>(arr: T[], limit: number, iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
mapValuesLimit<T, R>(obj: {[name: string]: T}, limit: number, iteratee: (value: string, key: T, callback: AsyncResultCallback<R>) => void, callback: AsyncResultCallback<R[]>): void;
mapValues<T, R>(obj: {[name: string]: T}, iteratee: (value: string, key: T, callback: AsyncResultCallback<R>) => void, callback: AsyncResultCallback<R[]>): void;
mapValuesSeries: typeof async.mapValues;
filter<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
select<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
filterSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
@@ -100,11 +118,17 @@ interface Async {
reduceRight<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncResultCallback<R>): any;
foldr<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncResultCallback<R>): any;
detect<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): any;
find: typeof async.detect;
detectSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): any;
findSeries: typeof async.detectSeries;
detectLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): any;
findLimit: typeof async.detectLimit;
sortBy<T, V>(arr: T[], iterator: AsyncResultIterator<T, V>, callback?: AsyncResultArrayCallback<T>): any;
some<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
someLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
anyLimit: typeof async.someLimit;
someSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
anySeries: typeof async.someSeries;
any<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
every<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => any): any;
everyLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => any): any;
@@ -134,18 +158,35 @@ interface Async {
queue<T>(worker: AsyncWorker<T>, concurrency?: number): AsyncQueue<T>;
priorityQueue<T>(worker: AsyncWorker<T>, concurrency: number): AsyncPriorityQueue<T>;
cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo;
auto(tasks: any, callback?: (error: Error, results: any) => void): void;
auto(tasks: any, concurrency?: number, callback?: (error: Error, results: any) => void): void;
autoInject(tasks: any, callback?: (error: Error, results: any) => void): void;
retry<T>(opts: number, task: (callback : AsyncResultCallback<T>, results: any) => void, callback: (error: Error, results: any) => void): void;
retry<T>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T>, results : any) => void, callback: (error: Error, results: any) => void): void;
iterator(tasks: Function[]): Function;
retryable<T>(opts: number | {times: number, interval: number}, task: AsyncFunction<T>): AsyncFunction<T>;
apply(fn: Function, ...arguments: any[]): AsyncFunction<any>;
nextTick(callback: Function): void;
setImmediate(callback: Function): void;
nextTick(callback: Function, ...args: any[]): void;
setImmediate: typeof async.nextTick;
allLimit<T>(arr: T[], limit: number, iteratee: AsyncBooleanIterator<T>, cb?: (result: boolean) => any) : any;
everySeries<T>(arr: T[], iteratee: AsyncBooleanIterator<T>, cb?: (result: boolean) => any) : any
allSeries: typeof async.everySeries;
reflect<T>(fn: AsyncFunction<T>) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void;
reflectAll<T>(tasks: AsyncFunction<T>[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[];
timeout<T>(fn: AsyncFunction<T>, milliseconds: number, info: any): AsyncFunction<T>;
times<T> (n: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): void;
timesSeries<T>(n: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): void;
timesLimit<T>(n: number, limit: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): void;
transform<T, R>(arr: T[], iteratee: (acc: R[], item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: Error) => void) => void): void;
race<T>(tasks: (AsyncFunction<T>)[], callback: AsyncResultCallback<T>) : void;
// Utils
memoize(fn: Function, hasher?: Function): Function;
unmemoize(fn: Function): Function;
@@ -155,7 +196,6 @@ interface Async {
wrapSync(fn: Function): Function;
log(fn: Function, ...arguments: any[]): void;
dir(fn: Function, ...arguments: any[]): void;
noConflict(): Async;
}
declare var async: Async;
+1
View File
@@ -163,6 +163,7 @@ declare namespace autobahn {
}
interface IPublishOptions {
acknowledge?: boolean;
exclude?: number[];
eligible?: number[];
disclose_me?: Boolean;
+49
View File
@@ -0,0 +1,49 @@
/// <reference path="aws-lambda.d.ts" />
import lambda = require('aws-lambda');
var str: string;
var date: Date;
var sns: lambda.SNS;
var kinesis: lambda.Kinesis;
var recordsList: lambda.Record[];
var anyObj: any;
var num: number;
/* Records */
var records: lambda.Records;
recordsList = records.Records;
/* Record */
var record: lambda.Record;
str = record.EventVersion;
str = record.EventSubscriptionArn;
str = record.EnventSource;
sns = record.Sns;
kinesis = record.kinesis;
/* SNS */
str = sns.Type;
str = sns.MessageId;
str = sns.TopicArn;
str = sns.Subject;
str = sns.Message;
date = sns.Timestamp;
/* Kinesis */
var kinesis: lambda.Kinesis;
str = kinesis.data;
/* Context */
var context: lambda.Context;
context.log(str, anyObj);
context.fail(str);
context.succeed(str);
context.succeed(anyObj);
context.succeed(str, anyObj);
str = context.awsRequestId;
num = context.getRemainingTimeInMillis();
+43
View File
@@ -0,0 +1,43 @@
// Type definitions for AWS Lambda
// Project: http://docs.aws.amazon.com/lambda
// Definitions by: Michael Skarum <https://github.com/skarum>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "aws-lambda" {
export interface Records {
Records: Record[];
}
interface Record {
EventVersion: string;
EventSubscriptionArn: string;
EnventSource: string;
Sns: SNS;
kinesis: Kinesis;
}
interface SNS {
Type: string;
MessageId: string;
TopicArn: string;
Subject: string;
Message: string;
Timestamp: Date;
}
interface Kinesis {
data: string;
}
export interface Context {
log(message: string, object: any): void;
fail(message: string): void;
succeed(message: string): void;
succeed(object: any): void;
succeed(message: string, object: any): void;
awsRequestId: string;
getRemainingTimeInMillis(): number;
}
export type Callback = (error?: Error, message?: string) => void;
}
+1684 -1376
View File
File diff suppressed because it is too large Load Diff
+6 -1
View File
@@ -12,6 +12,7 @@
// Updated Jan 20 2015 for Breeze 1.5.2 and merging changes from DefinitelyTyped
// Updated Feb 28 2015 add any/all clause on Predicate
// Updated Jun 27 2016 - Marcel Good (www.ideablade.com)
// Updated Jul 28 2016 - Serkan "coni2k" Holat
declare namespace breeze.core {
@@ -1043,6 +1044,10 @@ declare namespace breeze.config {
@return {an instance of the specified adapter}
**/
export function getAdapterInstance(interfaceName: string, adapterName?: string): Object;
export interface Adapter {
getRoutePrefix: Function
}
/**
Initializes a single adapter implementation. Initialization means either newing a instance of the
specified interface and then calling "initialize" on it or simply calling "initialize" on the instance
@@ -1052,7 +1057,7 @@ declare namespace breeze.config {
@param isDefault=true {Boolean} - Whether to make this the default "adapter" for this interface.
@return {an instance of the specified adapter}
**/
export function initializeAdapterInstance(interfaceName: string, adapterName: string, isDefault?: boolean): void;
export function initializeAdapterInstance(interfaceName: string, adapterName: string, isDefault?: boolean): Adapter;
export interface AdapterInstancesConfig {
/** the name of a previously registered "ajax" adapter */
+3 -3
View File
@@ -480,10 +480,10 @@ declare module "cassandra-driver" {
interface QueryOptions {
autoPage?: boolean;
captureStackTrace?: boolean;
consistency: number;
consistency?: number;
customPayload?: any;
fetchSize?: number;
hints: Array<string> | Array<Array<string>>;
hints?: Array<string> | Array<Array<string>>;
logged?: boolean;
pageState?: Buffer|string;
prepare?: boolean;
@@ -758,4 +758,4 @@ declare module "cassandra-driver" {
replicateOnWrite: boolean;
}
}
}
}
+57 -28
View File
@@ -81,7 +81,7 @@ interface ChartOptions {
}
interface ChartFontOptions {
defaultFontColor?: string;
defaultFontColor?: ChartColor;
defaultFontFamily?: string;
defaultFontSize?: number;
defaultFontStyle?: string;
@@ -93,7 +93,7 @@ interface ChartTitleOptions {
fullWdith?: boolean;
fontSize?: number;
fontFamily?: string;
fontColor?: string;
fontColor?: ChartColor;
fontStyle?: string;
padding?: number;
text?: string;
@@ -111,7 +111,7 @@ interface ChartLegendLabelOptions {
boxWidth?: number;
fontSize?: number;
fontStyle?: number;
fontColor?: string;
fontColor?: ChartColor;
fontFamily?: string;
padding?: number;
generateLabels?: (chart: any) => any;
@@ -121,22 +121,22 @@ interface ChartTooltipOptions {
enabled?: boolean;
custom?: (a: any) => void;
mode?: string;
backgroundColor?: string;
backgroundColor?: ChartColor;
titleFontFamily?: string;
titleFontSize?: number;
titleFontStyle?: string;
titleFontColor?: string;
titleFontColor?: ChartColor;
titleSpacing?: number;
titleMarginBottom?: number;
bodyFontFamily?: string;
bodyFontSize?: number;
bodyFontStyle?: string;
bodyFontColor?: string;
bodyFontColor?: ChartColor;
bodySpacing?: number;
footerFontFamily?: string;
footerFontSize?: number;
footerFontStyle?: string;
footerFontColor?: string;
footerFontColor?: ChartColor;
footerSpacing?: number;
footerMarginTop?: number;
xPadding?: number;
@@ -177,16 +177,16 @@ interface ChartElementsOptions {
}
interface ChartArcOtpions {
backgroundColor?: string;
borderColor?: string;
backgroundColor?: ChartColor;
borderColor?: ChartColor;
borderWidth?: number;
}
interface ChartLineOptions {
tension?: number;
backgroundColor?: string;
backgroundColor?: ChartColor;
borderWidth?: number;
borderColor?: string;
borderColor?: ChartColor;
borderCapStyle?: string;
borderDash?: any[];
borderDashOffset?: number;
@@ -196,37 +196,37 @@ interface ChartLineOptions {
interface ChartPointOptions {
radius?: number;
pointStyle?: string;
backgroundColor?: string;
backgroundColor?: ChartColor;
borderWidth?: number;
borderColor?: string;
borderColor?: ChartColor;
hitRadius?: number;
hoverRadius?: number;
hoverBorderWidth?: number;
}
interface ChartRectangleOptions {
backgroundColor?: string;
backgroundColor?: ChartColor;
borderWidth?: number;
borderColor?: string;
borderColor?: ChartColor;
borderSkipped?: string;
}
interface GridLineOptions {
display?: boolean;
color?: string;
color?: ChartColor;
lineWidth?: number;
drawBorder?: boolean;
drawOnChartArea?: boolean;
drawticks?: boolean;
tickMarkLength?: number;
zeroLineWidth?: number;
zeroLineColor?: string;
zeroLineColor?: ChartColor;
offsetGridLines?: boolean;
}
interface ScaleTitleOptions {
display?: boolean;
labelString?: string;
fontColor?: string;
fontColor?: ChartColor;
fontFamily?: string;
fontSize?: number;
fontStyle?: string;
@@ -236,7 +236,7 @@ interface TickOptions {
autoSkip?: boolean;
callback?: (value: any, index: any, values: any) => string;
display?: boolean;
fontColor?: string;
fontColor?: ChartColor;
fontFamily?: string;
fontSize?: number;
fontStyle?: string;
@@ -251,20 +251,20 @@ interface TickOptions {
}
interface AngleLineOptions {
display?: boolean;
color?: string;
color?: ChartColor;
lineWidth?: number;
}
interface PointLabelOptions {
callback?: (arg: any) => any;
fontColor?: string;
fontColor?: ChartColor;
fontFamily?: string;
fontSize?: number;
fontStyle?: string;
}
interface TickOptions {
backdropColor?: string;
backdropColor?: ChartColor;
backdropPaddingX?: number;
backdropPaddingY?: number;
maxTicksLimit?: number;
@@ -285,10 +285,12 @@ interface LogarithmicTickOptions extends TickOptions {
max?: number;
}
type ChartColor = string | CanvasGradient | CanvasPattern;
interface ChartDataSets {
backgroundColor?: string[];
backgroundColor?: ChartColor;
borderWidth?: number;
borderColor?: string[];
borderColor?: ChartColor;
borderCapStyle?: string;
borderDash?: number[];
borderDashOffset?: number;
@@ -297,14 +299,14 @@ interface ChartDataSets {
fill?: boolean;
label?: string;
lineTension?: number;
pointBorderColor?: string | string[];
pointBackgroundColor?: string | string[];
pointBorderColor?: ChartColor | ChartColor[];
pointBackgroundColor?: ChartColor | ChartColor[];
pointBorderWidth?: number | number[];
pointRadius?: number | number[];
pointHoverRadius?: number | number[];
pointHitRadius?: number | number[];
pointHoverBackgroundColor?: string | string[];
pointHoverBorderColor?: string | string[];
pointHoverBackgroundColor?: ChartColor | ChartColor[];
pointHoverBorderColor?: ChartColor | ChartColor[];
pointHoverBorderWidth?: number | number[];
pointStyle?: string | string[] | HTMLImageElement | HTMLImageElement[];
xAxisID?: string;
@@ -332,6 +334,32 @@ interface ChartScales {
gridLines?: GridLineOptions;
scaleLabel?: ScaleTitleOptions;
ticks?: TickOptions;
xAxes?: ChartXAxe[];
yAxes?: ChartYAxe[];
}
interface ChartXAxe {
type?: string;
display?: boolean;
id?: string;
stacked?: boolean;
categoryPercentage?: number;
barPercentage?: number;
gridLines?: GridLineOptions;
position?: string;
ticks?: TickOptions;
time?: TimeScale;
scaleLabel?: ScaleTitleOptions;
}
interface ChartYAxe {
type?: string;
display?: boolean;
id?: string;
stacked?: boolean;
position?: string;
ticks?: TickOptions;
scaleLabel?: ScaleTitleOptions;
}
interface LinearScale extends ChartScales {
@@ -343,6 +371,7 @@ interface LogarithmicScale extends ChartScales {
}
interface TimeScale extends ChartScales {
format?: string;
displayFormats?: string;
isoWeekday?: boolean;
max?: string;
+39 -3
View File
@@ -57,6 +57,7 @@ declare namespace CKEDITOR {
var basePath: string;
var currentInstance: editor;
var document: dom.document;
var env: environmentConfig;
var instances: editor[];
var loadFullCoreTimeout: number;
var revision: string;
@@ -1029,6 +1030,12 @@ declare namespace CKEDITOR {
}
interface IMenuItemDefinition {
label:string,
command:string,
group:string,
order:number
}
class editor extends event {
activeEnterMode: number;
@@ -1066,13 +1073,14 @@ declare namespace CKEDITOR {
addCommand(commandName: string, commandDefinition: commandDefinition): void;
addFeature(feature: feature): boolean;
addMenuGroup(name: string, order?: number): void;
addMenuItem(name: string, definition?: any): void;
addMenuItems(definitions: any[]): void;
addMenuItem(name: string, definition?: IMenuItemDefinition): void;
addMenuItems(definitions: {[id:string]:IMenuItemDefinition}): void;
addMode(mode: string, exec: () => void): void;
addRemoveFormatFilter(func: Function): void;
applyStyle(style: style): void;
attachStyleStateChange(style: style, callback: Function): void;
checkDirty(): boolean;
commands:any;
createFakeElement(realElement: Object, className: Object, realElementType: Object, isResizable: Object): void;
createFakeParserElement(realElement: Object, className: Object, realElementType: Object, isResizable: Object): void;
createRange(): dom.range;
@@ -1235,6 +1243,11 @@ declare namespace CKEDITOR {
}
interface buttonDefinition {
label : string;
command : string;
toolbar : string;
}
interface template {
@@ -1284,10 +1297,31 @@ declare namespace CKEDITOR {
class ui extends event {
constructor(editor: editor);
add(name: string, type: Object, definition: Object): void;
addButton(name: string, definition: dialog.definition.button): void;
addButton(name: string, definition: buttonDefinition): void;
addHandler(type: Object, handler: Object): void;
}
class environmentConfig {
air : boolean;
chrome : boolean;
cssClass : string;
edge : boolean;
gecko : boolean;
hc : boolean;
hidpi : boolean;
iOS : boolean;
ie : boolean;
isCompatible : boolean;
mac : boolean;
needsBrFiller : boolean;
needsNbspFiller : boolean;
quirks : boolean;
safari : boolean;
version : number;
webkit : boolean;
secure( ) : boolean;
}
namespace ui {
namespace dialog {
class uiElement {
@@ -1761,6 +1795,7 @@ declare namespace CKEDITOR {
namespace tools {
var callFunction: Function;
function enableHtml5Elements(doc: Object, withAppend? : Boolean) : void;
}
@@ -1772,3 +1807,4 @@ declare namespace CKEDITOR {
function detect(defaultLanguage: string, probeLanguage: string): string;
}
}
+28 -1
View File
@@ -31,7 +31,34 @@ interface ObjectConstructor {
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param sources One or more source objects to copy properties from.
* @param source The source object from which to copy properties.
*/
assign<T, U>(target: T, source: U): T & U;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param source1 The first source object from which to copy properties.
* @param source2 The second source object from which to copy properties.
*/
assign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param source1 The first source object from which to copy properties.
* @param source2 The second source object from which to copy properties.
* @param source3 The third source object from which to copy properties.
*/
assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param sources One or more source objects from which to copy properties
*/
assign(target: any, ...sources: any[]): any;
+21 -8
View File
@@ -1,16 +1,29 @@
/// <reference path="credential.d.ts" />
// all from current main repo examples
import * as credential from 'credential';
credential.hash('password', function(err: Error, hash: string) {
if (err) console.error(err);
else console.log(hash);
var pw = credential();
var newPassword = 'I have a really great password.';
pw.hash(newPassword, function (err, hash) {
if (err) { throw err; }
console.log('Store the password hash.', hash);
});
const hash = '{}';
const password = 'test';
var storedHash = {
"hash": "gNofnhlBl36AdRyktwATxKoqWKa6hsIEzwCmW/YXN//7PtiJwCRbepV9fUKu0L9TJELCKoDiBy6rGM8ov7lg2yLY",
"salt": "yyN3KUzlr4KrKWMM2K3d2Ddxf8OTq+vkKG+mtnmQVIibxSJz8drfzkYzqcH0EM+PVKR/1nClRr/CPDuJsq+FOcIw",
"keyLength": 66,
"hashMethod": "pbkdf2",
"iterations": 181019
};
var userInput = 'I have a really great password.';
credential.verify(hash, password, function(err: Error, isValid: boolean) {
if (err) console.error(err);
else console.log(isValid ? 'Password match' : 'Incorrect password');
pw.verify(storedHash, userInput, function (err, isValid) {
var msg: string;
if (err) { throw err; }
msg = isValid ? 'Passwords match!' : 'Wrong password.';
console.log(msg);
});
+25 -7
View File
@@ -4,15 +4,33 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'credential' {
interface defaultOptions {
keyLength: number;
work: number;
hashMethod: string;
}
type HashCallback = (err: Error, hash: string) => void;
type VerifyCallback = (err: Error, isValid: boolean) => void;
interface hashObject {
hash: string;
salt: string;
keyLength: number;
hashMethod: string;
iterations: number;
}
namespace credential {
function hash(password: string, callback: HashCallback): void;
function verify(hash: string, password: string, callback: VerifyCallback): void;
}
type HashCallback = (err: Error, hash: hashObject) => void;
type VerifyCallback = (err: Error, isValid: boolean) => void;
export = credential;
function credential(defaultOptions?: defaultOptions): {
hash(password: string, callback: HashCallback): void;
hash(password: string): Promise<hashObject>;
// iterations(work: number, base): number;
verify(hash: hashObject | string, password: string, callback: VerifyCallback): void;
verify(hash: hashObject | string, password: string): Promise<boolean>;
expired(hash: string, days: number): boolean;
}
namespace credential { }
export = credential;
}
+2 -2
View File
@@ -58,8 +58,8 @@ declare module "csv-stringify" {
interface Stringifier extends NodeJS.ReadWriteStream {
// Stringifier stream takes array of strings
write(line: string[]): boolean;
// Stringifier stream takes array of strings or Object
write(line: string[] | Object): boolean;
// repeat declarations from NodeJS.WritableStream to avoid compile error
write(buffer: Buffer, cb?: Function): boolean;
+8
View File
@@ -36,3 +36,11 @@ var e = new Drop({
content: () => greenBox
});
var Tooltip = Drop.createContext({
classPrefix: 'tooltip'
});
var t = new Tooltip({
target: yellowBox,
content: () => greenBox
});
+1 -2
View File
@@ -27,7 +27,7 @@ declare class Drop {
public once(event: string, handler: Function, context?: any): void;
public off(event: string, handler?: Function): void;
public static createContext(options: Drop.IDropContextOptions): Drop;
public static createContext(options: Drop.IDropContextOptions): typeof Drop;
}
declare namespace Drop {
@@ -59,4 +59,3 @@ declare namespace Drop {
declare module "drop" {
export = Drop;
}
+6
View File
@@ -0,0 +1,6 @@
/// <reference path="elastic.js.d.ts"/>
let body = new elasticjs.Request({})
.query(new elasticjs.MatchQuery('title_field', 'testQuery'))
.facet(new elasticjs.TermsFacet('tags').field('tags'))
.toJSON();
+8972
View File
File diff suppressed because it is too large Load Diff
+36 -2
View File
@@ -23,8 +23,8 @@ declare module Elasticsearch {
ping(params: PingParams, callback: (err: any, response: any, status: any) => void): void;
scroll(params: ScrollParams): PromiseLike<any>;
scroll(params: ScrollParams, callback: (error: any, response: any) => void): void;
search(params: SearchParams): PromiseLike<any>;
search(params: SearchParams, callback: (error: any, response: any) => void): void;
search<T>(params: SearchParams): PromiseLike<SearchResponse<T>>;
search<T>(params: SearchParams, callback: (error: any, response: SearchResponse<T>) => void): void;
suggest(params: SuggestParams): PromiseLike<any>;
suggest(params: SuggestParams, callback: (error: any, response: any) => void): void;
update(params: UpdateDocumentParams): PromiseLike<any>;
@@ -79,6 +79,12 @@ declare module Elasticsearch {
createNodeAgent?: any;
}
export interface Explanation {
value: number,
description: string,
details: Explanation[]
}
export interface GenericParams {
requestTimeout?: number;
maxRetries?: number;
@@ -219,6 +225,34 @@ declare module Elasticsearch {
timeout?: Date | number;
}
export interface SearchResponse<T> {
took: number,
timed_out: boolean,
_scroll_id?: string,
_shards: {
total: number,
successful: number,
failed: number
},
hits: {
total: number,
max_score: number,
hits: {
_index: string,
_type: string,
_id: string,
_score: number,
_source: T,
_version: number,
_explanation?: Explanation,
fields?: any,
highlight?: any,
inner_hits?: any
}[]
},
aggregations?: any
}
export interface MSearchParams extends GenericParams {
index?: string | string[] | Boolean;
type?: string | string[] | Boolean;
+2 -2
View File
@@ -149,8 +149,8 @@ people2.some((person: Em.Object) => {
people2.everyProperty('isHappy', true);
people2.someProperty('isHappy', true);
// Examples taken from http://emberjs.com/api/classes/Ember.RSVP.Promise.html
var promise = new Ember.RSVP.Promise(function(resolve: Function, reject: Function) {
// Examples taken from http://emberjs.com/api/classes/Em.RSVP.Promise.html
var promise = new Em.RSVP.Promise(function(resolve: Function, reject: Function) {
// on success
resolve('ok!');
+94 -298
View File
@@ -1,4 +1,4 @@
// Type definitions for Ember.js 2.0
// Type definitions for Ember.js 2.7
// Project: http://emberjs.com/
// Definitions by: Jed Mao <https://github.com/jedmao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -448,7 +448,6 @@ declare namespace Ember {
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
static initializer(args?: ApplicationInitializerArguments): void;
/**
Call advanceReadiness after any asynchronous setup logic has completed.
Each call to deferReadiness must be matched by a call to advanceReadiness
@@ -530,6 +529,7 @@ declare namespace Ember {
Application's router.
**/
Router: Router;
registry: Registry;
}
/**
This module implements Observer-friendly Array-like behavior. This mixin is picked up by the
@@ -697,7 +697,7 @@ declare namespace Ember {
constructor(toPath: string, fromPath: string);
connect(obj: any): Binding;
copy(): Binding;
disconnect(obj: any): Binding;
disconnect(): Binding;
from(path: string): Binding;
to(path: string): Binding;
to(pathTuple: any[]): Binding;
@@ -790,8 +790,10 @@ declare namespace Ember {
constructor(parent: Container);
parent: Container;
children: any[];
owner: any;
ownerInjection(): any;
resolver: Function;
registry: {};
registry: Registry;
cache: {};
typeInjections: {};
injections: {};
@@ -805,7 +807,7 @@ declare namespace Ember {
describe(fullName: string): string;
makeToString(factory: any, fullName: string): Function;
lookup(fullName: string, options?: {}): any;
lookupFactory(fullName: string): any;
lookupFactory(fullName: string, options?: {}): any;
destroy(): void;
reset(): void;
}
@@ -1014,9 +1016,19 @@ declare namespace Ember {
You generally won't need to create or subclass this directly.
**/
class Descriptor { }
var EMPTY_META: {}; // TODO: define interface
var ENV: {};
var EXTEND_PROTOTYPES: boolean;
namespace ENV {
export var EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES;
export var LOG_BINDINGS: boolean;
export var LOG_STACKTRACE_ON_DEPRECATION: boolean;
export var LOG_VERSION: boolean;
export var MODEL_FACTORY_INJECTIONS: boolean;
export var RAISE_ON_DEPRECATION: boolean;
}
namespace EXTEND_PROTOTYPES {
export var Array: boolean;
export var Function: boolean;
export var String: boolean;
}
/**
This is the object instance returned when you get the @each property on an array. It uses
the unknownProperty handler to automatically create EachArray instances for property names.
@@ -1137,7 +1149,7 @@ declare namespace Ember {
var GUID_KEY: string;
namespace Handlebars {
function compile(string: string): Function;
function precompile(string: string): void;
function precompile(string: string, options: any): void;
class Compiler { }
class JavaScriptCompiler { }
function registerPartial(name: string, str: any): void;
@@ -1581,6 +1593,10 @@ declare namespace Ember {
isEmpty(): boolean;
toArray(): any[];
}
class Registry {
constructor (options: any);
static set: typeof Ember.set;
}
// FYI - RSVP source comes from https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp/promise.js
namespace RSVP {
@@ -2193,25 +2209,11 @@ declare namespace Ember {
resource(name: string, options?: {}, callback?: Function): void;
resource(name: string, callback: Function): void;
route(name: string, options?: {}): void;
explicitIndex: boolean;
router: Router;
options: any;
}
var SHIM_ES5: boolean;
var STRINGS: boolean;
class SelectOption extends Component {
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
/**
Iterate over each computed property for the class, passing its name and any
associated metadata (see metaForProperty) to the callback.
**/
static eachComputedProperty(callback: Function, binding: {}): void;
/**
Returns the original hash that was passed to meta().
@param key property name
**/
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
}
class State extends Object implements Evented {
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
@@ -2294,23 +2296,28 @@ declare namespace Ember {
class TargetActionSupport {
triggerAction(opts: {}): boolean;
}
class Test {
click(selector: string): RSVP.Promise;
fillin(selector: string, text: string): RSVP.Promise;
find(selector: string): JQuery;
findWithAssert(selector: string): JQuery;
injectTestHelpers(): void;
keyEvent(selector: string, type: string, keyCode: number): RSVP.Promise;
static oninjectHelpers(callback: Function): void;
static promise(resolver: Function): RSVP.Promise;
static registerHelper(name: string, helperMethod: Function): void;
removeTestHelpers(): void;
setupForTesting(): void;
static unregisterHelper(name: string): void;
visit(url: string): RSVP.Promise;
wait(value: any): RSVP.Promise;
static adapter: Object;
testHelpers: {};
namespace Test {
class Adapter extends Ember.Object {
constructor ();
}
class Promise extends Ember.RSVP.Promise {
constructor ();
}
function oninjectHelpers(callback: Function): void;
function promise(resolver: Function, label: string): Ember.Test.Promise;
function unregisterHelper(name: string): void;
function registerHelper(name: string, helperMethod: Function): void;
function registerAsyncHelper(name: string, helperMethod: Function): void;
var adapter: Object;
var QUnitAdapter: Object;
function registerWaiter(callback: Function): void;
function registerWaiter(context: any, callback: Function): void;
function unregisterWaiter(callback: Function): void;
function unregisterWaiter(context: any, callback: Function): void;
function resolve(result: any): Ember.Test.Promise;
}
class TextArea extends Component implements TextSupport {
static detect(obj: any): boolean;
@@ -2390,7 +2397,6 @@ declare namespace Ember {
**/
var alias: typeof deprecateFunc;
function aliasMethod(methodName: string): Descriptor;
var anyUnprocessedMixins: boolean;
function assert(desc: string, test: boolean): void;
function beginPropertyChanges(): void;
function bind(obj: any, to: string, from: string): Binding;
@@ -2420,8 +2426,6 @@ declare namespace Ember {
oneWay(dependentKey: string): ComputedProperty;
or(...args: string[]): ComputedProperty;
};
// ReSharper disable DuplicatingLocalDeclaration
var config: {};
// ReSharper restore DuplicatingLocalDeclaration
function controllerFor(container: Container, controllerName: string, lookupOptions?: {}): Controller;
function copy(obj: any, deep: boolean): any;
@@ -2441,10 +2445,7 @@ declare namespace Ember {
// ReSharper disable once DuplicatingLocalDeclaration
var empty: typeof deprecateFunc;
function endPropertyChanges(): void;
// ReSharper disable once DuplicatingLocalDeclaration
var exports: {};
function finishChains(obj: any): void;
function flushPendingChains(): void;
function generateController(container: Container, controllerName: string, context: any): Controller;
function generateGuid(obj: any, prefix?: string): string;
function get(obj: any, keyName: string): any;
@@ -2458,7 +2459,6 @@ declare namespace Ember {
function hasListeners(context: any, name: string): boolean;
function hasOwnProperty(prop: string): boolean;
function immediateObserver(func: Function, ...propertyNames: any[]): Function;
var imports: {};
function inspect(obj: any): string;
function instrument(name: string, payload: any, callback: Function, binding: any): void;
function isArray(obj: any): boolean;
@@ -2477,13 +2477,12 @@ declare namespace Ember {
var lookup: {}; // TODO: define interface
function makeArray(obj: any): any[];
function merge(original: any, updates: any): any;
function meta(obj: any, writable?: boolean): {};
function meta(obj: any): {};
function mixin(obj: any, ...args: any[]): any;
/**
Ember.none is deprecated. Please use Ember.isNone instead.
**/
var none: typeof deprecateFunc;
function normalizeTuple(target: any, path: string): any[];
function observer(...args: any[]): Function;
function observersFor(obj: any, path: string): any[];
function onLoad(name: string, callback: Function): void;
@@ -2560,16 +2559,19 @@ declare namespace Ember {
function watchPath(obj: any, keyPath: string): void;
function watchedEvents(obj: {}): any[];
function wrap(func: Function, superFunc: Function): Function;
var _ContainerProxyMixin : Mixin;
var _RegistryProxyMixin: Mixin;
function getOwner(object: any): any;
function setOwner(object: any, owner: any): void;
var testing : boolean;
var MODEL_FACTORY_INJECTIONS : boolean;
function assign(original: any, ...sources: any[]): any;
}
// ReSharper disable DuplicatingLocalDeclaration
declare namespace Em {
/**
Alias for jQuery.
**/
var $: typeof Ember.$;
var A: typeof Ember.A;
class ActionHandlerMixin extends Ember.ActionHandlerMixin { }
class ActionHandlerMixin extends Ember.ActionHandlerMixin { }
class Application extends Ember.Application { }
class Array extends Ember.Array { }
class ArrayProxy extends Ember.ArrayProxy { }
@@ -2583,13 +2585,12 @@ declare namespace Em {
class Container extends Ember.Container { }
class Controller extends Ember.Controller { }
class ControllerMixin extends Ember.ControllerMixin { }
class Copyable extends Ember.Copyable { }
class Copyable extends Ember.Copyable {}
class CoreObject extends Ember.CoreObject { }
class DAG extends Ember.DAG { }
var DEFAULT_GETTER_FUNCTION: typeof Ember.DEFAULT_GETTER_FUNCTION;
class DefaultResolver extends Ember.DefaultResolver { }
class DAG extends Ember.DAG {}
var DEFAULT_GETTER_FUNCTION : typeof Ember.DEFAULT_GETTER_FUNCTION;
class DefaultResolver extends Ember.DefaultResolver { }
class Descriptor extends Ember.Descriptor { }
var EMPTY_META: typeof Ember.EMPTY_META;
var ENV: typeof Ember.ENV;
var EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES;
class EachProxy extends Ember.EachProxy { }
@@ -2604,7 +2605,7 @@ declare namespace Em {
var compile: typeof Ember.Handlebars.compile;
var precompile: typeof Ember.Handlebars.precompile;
class Compiler extends Ember.Handlebars.Compiler { }
class JavaScriptCompiler extends Ember.Handlebars.JavaScriptCompiler { }
class JavaScriptCompiler extends Ember.Handlebars.JavaScriptCompiler{ }
var registerPartial: typeof Ember.Handlebars.registerPartial;
var K: typeof Ember.Handlebars.K;
var createFrame: typeof Ember.Handlebars.createFrame;
@@ -2623,7 +2624,7 @@ declare namespace Em {
var LOG_BINDINGS: typeof Ember.LOG_BINDINGS;
var LOG_STACKTRACE_ON_DEPRECATION: typeof Ember.LOG_STACKTRACE_ON_DEPRECATION;
var LOG_VERSION: typeof Ember.LOG_VERSION;
class Location extends Ember.Location { }
class Location extends Ember.Location {}
var Logger: typeof Ember.Logger;
var MANDATORY_SETTER_FUNCTION: typeof Ember.MANDATORY_SETTER_FUNCTION;
var META_KEY: typeof Ember.META_KEY;
@@ -2631,7 +2632,7 @@ declare namespace Em {
class MapWithDefault extends Ember.MapWithDefault { }
class Mixin extends Ember.Mixin { }
class MutableArray extends Ember.MutableArray { }
class MutableEnumerable extends Ember.MutableEnumberable { }
class MutableEnumberable extends Ember.MutableEnumberable { }
var NAME_KEY: typeof Ember.NAME_KEY;
class Namespace extends Ember.Namespace { }
class NativeArray extends Ember.NativeArray { }
@@ -2641,35 +2642,36 @@ declare namespace Em {
class ObjectProxy extends Ember.ObjectProxy { }
class Observable extends Ember.Observable { }
class OrderedSet extends Ember.OrderedSet { }
class Registry extends Ember.Registry { }
namespace RSVP {
interface PromiseResolve extends Ember.RSVP.PromiseResolve { }
interface PromiseReject extends Ember.RSVP.PromiseReject { }
interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { }
class Promise extends Ember.RSVP.Promise { }
}
class Route extends Ember.Route { }
class Route extends Ember.Route {}
class Router extends Ember.Router { }
class RouterDSL extends Ember.RouterDSL { }
var SHIM_ES5: typeof Ember.SHIM_ES5;
var STRINGS: typeof Ember.STRINGS;
class SelectOption extends Ember.SelectOption { }
class State extends Ember.State { }
class StateManager extends Ember.StateManager { }
namespace String {
var camelize: typeof Ember.String.camelize;
var capitalize: typeof Ember.String.capitalize;
var classify: typeof Ember.String.classify;
var dasherize: typeof Ember.String.dasherize;
var decamelize: typeof Ember.String.decamelize;
var fmt: typeof Ember.String.fmt;
var htmlSafe: typeof Ember.String.htmlSafe;
var loc: typeof Ember.String.loc;
var underscore: typeof Ember.String.underscore;
var w: typeof Ember.String.w;
}
var String : typeof Ember.String;
var TEMPLATES: typeof Ember.TEMPLATES;
class TargetActionSupport extends Ember.TargetActionSupport { }
class Test extends Ember.Test { }
class TargetActionSupport extends Ember.TargetActionSupport {}
namespace Test {
class Adapter extends Ember.Test.Adapter { }
class Promise extends Ember.Test.Promise { }
var oninjectHelpers: typeof Ember.Test.oninjectHelpers;
var promise: typeof Ember.Test.promise;
var unregisterHelper: typeof Ember.Test.unregisterHelper;
var registerHelper: typeof Ember.Test.registerHelper;
var registerAsyncHelper: typeof Ember.Test.registerAsyncHelper;
var adapter: typeof Ember.Test.adapter;
var QUnitAdapter: typeof Ember.Test.QUnitAdapter;
var registerWaiter: typeof Ember.Test.registerWaiter;
var unregisterWaiter: typeof Ember.Test.unregisterWaiter
var resolve: typeof Ember.Test.resolve;
}
class TextArea extends Ember.TextArea { }
class TextField extends Ember.TextField { }
class TextSupport extends Ember.TextSupport { }
@@ -2680,7 +2682,6 @@ declare namespace Em {
var addObserver: typeof Ember.addObserver;
var alias: typeof Ember.alias;
var aliasMethod: typeof Ember.aliasMethod;
var anyUnprocessedMixins: typeof Ember.anyUnprocessedMixins;
var assert: typeof Ember.assert;
var beginPropertyChanges: typeof Ember.beginPropertyChanges;
var bind: typeof Ember.bind;
@@ -2689,20 +2690,17 @@ declare namespace Em {
var changeProperties: typeof Ember.changeProperties;
var compare: typeof Ember.compare;
var computed: typeof Ember.computed;
var config: typeof Ember.config;
var controllerFor: typeof Ember.controllerFor;
var copy: typeof Ember.copy;
var create: typeof Ember.create;
var debug: typeof Ember.debug;
var defineProperty: typeof Ember.defineProperty;
var deprecate: typeof Ember.deprecate;
var deprecateFunc: typeof Ember.deprecateFunc;
var deprecateFunc: typeof Ember.deprecateFunc
var destroy: typeof Ember.destroy;
var empty: typeof deprecateFunc;
var empty: typeof Ember.empty;
var endPropertyChanges: typeof Ember.endPropertyChanges;
var exports: typeof Ember.exports;
var finishChains: typeof Ember.finishChains;
var flushPendingChains: typeof Ember.flushPendingChains;
var generateController: typeof Ember.generateController;
var generateGuid: typeof Ember.generateGuid;
var get: typeof Ember.get;
@@ -2713,7 +2711,6 @@ declare namespace Em {
var hasListeners: typeof Ember.hasListeners;
var hasOwnProperty: typeof Ember.hasOwnProperty;
var immediateObserver: typeof Ember.immediateObserver;
var imports: typeof Ember.imports;
var inspect: typeof Ember.inspect;
var instrument: typeof Ember.instrument;
var isArray: typeof Ember.isArray;
@@ -2734,7 +2731,6 @@ declare namespace Em {
var meta: typeof Ember.meta;
var mixin: typeof Ember.mixin;
var none: typeof Ember.none;
var normalizeTuple: typeof Ember.normalizeTuple;
var observer: typeof Ember.observer;
var observersFor: typeof Ember.observersFor;
var onLoad: typeof Ember.onLoad;
@@ -2774,6 +2770,13 @@ declare namespace Em {
var watchPath: typeof Ember.watchPath;
var watchedEvents: typeof Ember.watchedEvents;
var wrap: typeof Ember.wrap;
var _ContainerProxyMixin : typeof Ember._ContainerProxyMixin;
var _RegistryProxyMixin: typeof Ember._RegistryProxyMixin;
var getOwner: typeof Ember.getOwner;
var setOwner: typeof Ember.setOwner;
var testing: typeof Ember.testing;
var MODEL_FACTORY_INJECTIONS: typeof Ember.MODEL_FACTORY_INJECTIONS;
var assign: typeof Ember.assign;
}
/**
@@ -2781,212 +2784,5 @@ declare namespace Em {
*/
declare module "Ember" {
var $: typeof Ember.$;
var A: typeof Ember.A;
class ActionHandlerMixin extends Ember.ActionHandlerMixin { }
class Application extends Ember.Application { }
class Array extends Ember.Array { }
class ArrayProxy extends Ember.ArrayProxy { }
var BOOTED: typeof Ember.BOOTED;
class Binding extends Ember.Binding { }
class Button extends Ember.Button { }
class Checkbox extends Ember.Checkbox { }
class Comparable extends Ember.Comparable { }
class Component extends Ember.Component { }
class ComputedProperty extends Ember.ComputedProperty { }
class Container extends Ember.Container { }
class Controller extends Ember.Controller { }
class ControllerMixin extends Ember.ControllerMixin { }
class Copyable extends Ember.Copyable { }
class CoreObject extends Ember.CoreObject { }
class DAG extends Ember.DAG { }
var DEFAULT_GETTER_FUNCTION: typeof Ember.DEFAULT_GETTER_FUNCTION;
class DefaultResolver extends Ember.DefaultResolver { }
class Descriptor extends Ember.Descriptor { }
var EMPTY_META: typeof Ember.EMPTY_META;
var ENV: typeof Ember.ENV;
var EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES;
class EachProxy extends Ember.EachProxy { }
class Enumerable extends Ember.Enumerable { }
var Error: typeof Ember.Error;
class EventDispatcher extends Ember.EventDispatcher { }
class Evented extends Ember.Evented { }
var FROZEN_ERROR: typeof Ember.FROZEN_ERROR;
class Freezable extends Ember.Freezable { }
var GUID_KEY: typeof Ember.GUID_KEY;
namespace Handlebars {
var compile: typeof Ember.Handlebars.compile;
var precompile: typeof Ember.Handlebars.precompile;
class Compiler extends Ember.Handlebars.Compiler { }
class JavaScriptCompiler extends Ember.Handlebars.JavaScriptCompiler { }
var registerPartial: typeof Ember.Handlebars.registerPartial;
var K: typeof Ember.Handlebars.K;
var createFrame: typeof Ember.Handlebars.createFrame;
var Exception: typeof Ember.Handlebars.Exception;
class SafeString extends Ember.Handlebars.SafeString { }
var parse: typeof Ember.Handlebars.parse;
var print: typeof Ember.Handlebars.print;
var logger: typeof Ember.Handlebars.logger;
var log: typeof Ember.Handlebars.log;
}
class HashLocation extends Ember.HashLocation { }
class HistoryLocation extends Ember.HistoryLocation { }
var IS_BINDING: typeof Ember.IS_BINDING;
class Instrumentation extends Ember.Instrumentation { }
var K: typeof Ember.K;
var LOG_BINDINGS: typeof Ember.LOG_BINDINGS;
var LOG_STACKTRACE_ON_DEPRECATION: typeof Ember.LOG_STACKTRACE_ON_DEPRECATION;
var LOG_VERSION: typeof Ember.LOG_VERSION;
class Location extends Ember.Location { }
var Logger: typeof Ember.Logger;
var MANDATORY_SETTER_FUNCTION: typeof Ember.MANDATORY_SETTER_FUNCTION;
var META_KEY: typeof Ember.META_KEY;
class Map extends Ember.Map { }
class MapWithDefault extends Ember.MapWithDefault { }
class Mixin extends Ember.Mixin { }
class MutableArray extends Ember.MutableArray { }
class MutableEnumerable extends Ember.MutableEnumberable { }
var NAME_KEY: typeof Ember.NAME_KEY;
class Namespace extends Ember.Namespace { }
class NativeArray extends Ember.NativeArray { }
class NoneLocation extends Ember.NoneLocation { }
var ORDER_DEFINITION: typeof Ember.ORDER_DEFINITION;
class Object extends Ember.Object { }
class ObjectProxy extends Ember.ObjectProxy { }
class Observable extends Ember.Observable { }
class OrderedSet extends Ember.OrderedSet { }
namespace RSVP {
interface PromiseResolve extends Ember.RSVP.PromiseResolve { }
interface PromiseReject extends Ember.RSVP.PromiseReject { }
interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { }
class Promise extends Ember.RSVP.Promise { }
}
class Route extends Ember.Route { }
class Router extends Ember.Router { }
class RouterDSL extends Ember.RouterDSL { }
var SHIM_ES5: typeof Ember.SHIM_ES5;
var STRINGS: typeof Ember.STRINGS;
class SelectOption extends Ember.SelectOption { }
class State extends Ember.State { }
class StateManager extends Ember.StateManager { }
namespace String {
var camelize: typeof Ember.String.camelize;
var capitalize: typeof Ember.String.capitalize;
var classify: typeof Ember.String.classify;
var dasherize: typeof Ember.String.dasherize;
var decamelize: typeof Ember.String.decamelize;
var fmt: typeof Ember.String.fmt;
var htmlSafe: typeof Ember.String.htmlSafe;
var loc: typeof Ember.String.loc;
var underscore: typeof Ember.String.underscore;
var w: typeof Ember.String.w;
}
var TEMPLATES: typeof Ember.TEMPLATES;
class TargetActionSupport extends Ember.TargetActionSupport { }
class Test extends Ember.Test { }
class TextArea extends Ember.TextArea { }
class TextField extends Ember.TextField { }
class TextSupport extends Ember.TextSupport { }
var VERSION: typeof Ember.VERSION;
class ViewTargetActionSupport extends Ember.ViewTargetActionSupport { }
var ViewUtils: typeof Ember.ViewUtils;
var addListener: typeof Ember.addListener;
var addObserver: typeof Ember.addObserver;
var alias: typeof Ember.alias;
var aliasMethod: typeof Ember.aliasMethod;
var anyUnprocessedMixins: typeof Ember.anyUnprocessedMixins;
var assert: typeof Ember.assert;
var beginPropertyChanges: typeof Ember.beginPropertyChanges;
var bind: typeof Ember.bind;
var cacheFor: typeof Ember.cacheFor;
var canInvoke: typeof Ember.canInvoke;
var changeProperties: typeof Ember.changeProperties;
var compare: typeof Ember.compare;
var computed: typeof Ember.computed;
var config: typeof Ember.config;
var controllerFor: typeof Ember.controllerFor;
var copy: typeof Ember.copy;
var create: typeof Ember.create;
var debug: typeof Ember.debug;
var defineProperty: typeof Ember.defineProperty;
var deprecate: typeof Ember.deprecate;
var deprecateFunc: typeof Ember.deprecateFunc;
var destroy: typeof Ember.destroy;
var empty: typeof Ember.deprecateFunc;
var endPropertyChanges: typeof Ember.endPropertyChanges;
var exports: typeof Ember.exports;
var finishChains: typeof Ember.finishChains;
var flushPendingChains: typeof Ember.flushPendingChains;
var generateController: typeof Ember.generateController;
var generateGuid: typeof Ember.generateGuid;
var get: typeof Ember.get;
var getPath: typeof Ember.getPath;
var getWithDefault: typeof Ember.getWithDefault;
var guidFor: typeof Ember.guidFor;
var handleErrors: typeof Ember.handleErrors;
var hasListeners: typeof Ember.hasListeners;
var hasOwnProperty: typeof Ember.hasOwnProperty;
var immediateObserver: typeof Ember.immediateObserver;
var imports: typeof Ember.imports;
var inspect: typeof Ember.inspect;
var instrument: typeof Ember.instrument;
var isArray: typeof Ember.isArray;
var isEmpty: typeof Ember.isEmpty;
var isEqual: typeof Ember.isEqual;
var isGlobalPath: typeof Ember.isGlobalPath;
var isNamespace: typeof Ember.isNamespace;
var isNone: typeof Ember.isNone;
var isPrototypeOf: typeof Ember.isPrototypeOf;
var isWatching: typeof Ember.isWatching;
var keys: typeof Ember.keys;
var listenersDiff: typeof Ember.listenersDiff;
var listenersFor: typeof Ember.listenersFor;
var listenersUnion: typeof Ember.listenersUnion;
var lookup: typeof Ember.lookup;
var makeArray: typeof Ember.makeArray;
var merge: typeof Ember.merge;
var meta: typeof Ember.meta;
var mixin: typeof Ember.mixin;
var none: typeof Ember.none;
var normalizeTuple: typeof Ember.normalizeTuple;
var observer: typeof Ember.observer;
var observersFor: typeof Ember.observersFor;
var onLoad: typeof Ember.onLoad;
var onError: typeof Ember.onError;
var overrideChains: typeof Ember.overrideChains;
var platform: typeof Ember.platform;
var propertyDidChange: typeof Ember.propertyDidChange;
var propertyIsEnumerable: typeof Ember.propertyIsEnumerable;
var propertyWillChange: typeof Ember.propertyWillChange;
var removeChainWatcher: typeof Ember.removeChainWatcher;
var removeListener: typeof Ember.removeListener;
var removeObserver: typeof Ember.removeObserver;
var required: typeof Ember.required;
var rewatch: typeof Ember.rewatch;
var run: typeof Ember.run;
var runLoadHooks: typeof Ember.runLoadHooks;
var sendEvent: typeof Ember.sendEvent;
var set: typeof Ember.set;
var setPath: typeof Ember.setPath;
var setProperties: typeof Ember.setProperties;
var subscribe: typeof Ember.subscribe;
var toLocaleString: typeof Ember.toLocaleString;
var toString: typeof Ember.toString;
var tryCatchFinally: typeof Ember.tryCatchFinally;
var tryInvoke: typeof Ember.tryInvoke;
var trySet: typeof Ember.trySet;
var trySetPath: typeof Ember.trySetPath;
var typeOf: typeof Ember.typeOf;
var unwatch: typeof Ember.unwatch;
var unwatchKey: typeof Ember.unwatchKey;
var unwatchPath: typeof Ember.unwatchPath;
var uuid: typeof Ember.uuid;
var valueOf: typeof Ember.valueOf;
var warn: typeof Ember.warn;
var watch: typeof Ember.watch;
var watchKey: typeof Ember.watchKey;
var watchPath: typeof Ember.watchPath;
var watchedEvents: typeof Ember.watchedEvents;
var wrap: typeof Ember.wrap;
export = Ember;
}
+10 -10
View File
@@ -49,15 +49,15 @@ declare module "express-brute" {
* @interface
*/
interface ExpressBruteOptions {
freeRetries: number;
proxyDepth: number;
attachResetToRequest: boolean;
refreshTimeoutOnRequest: boolean;
minWait: number;
maxWait: number;
lifetime: number;
failCallback: (req: express.Request, res: express.Response, next: Function, nextValidRequestDate: any) => void;
handleStoreError: any;
freeRetries?: number;
proxyDepth?: number;
attachResetToRequest?: boolean;
refreshTimeoutOnRequest?: boolean;
minWait?: number;
maxWait?: number;
lifetime?: number;
failCallback?: (req: express.Request, res: express.Response, next: Function, nextValidRequestDate: any) => void;
handleStoreError?: any;
}
/**
@@ -70,7 +70,7 @@ class ExpressBrute {
* @constructor
* @param {any} store The store.
*/
constructor(store: any);
constructor(store: any, options?: ExpressBruteOptions);
/**
* @summary Generates middleware that will bounce requests with the same key and IP address that happen faster than the current wait time by calling failCallback.
+43
View File
@@ -0,0 +1,43 @@
/// <reference path="./fast-json-patch.d.ts" />
import * as jsonpatch from 'fast-json-patch'
var myobj:{
firstName:string,
contactDetails: {
phoneNumbers:string[]
}
} = { firstName:"Albert", contactDetails: { phoneNumbers: [ ] } };
var patches = [
{op:"replace", path:"/firstName", value:"Joachim" },
{op:"add", path:"/lastName", value:"Wester" },
{op:"add", path:"/contactDetails/phoneNumbers/0", value:{ number:"555-123" } }
];
jsonpatch.apply( myobj, patches );
var myobj2 = { firstName:"Joachim", lastName:"Wester", contactDetails: { phoneNumbers: [ { number:"555-123" }] } };
var observer = jsonpatch.observe( myobj2 );
myobj2.firstName = "Albert";
myobj2.contactDetails.phoneNumbers[0].number = "123";
myobj2.contactDetails.phoneNumbers.push({number:"456"});
var patches2 = jsonpatch.generate(observer);
var objA = {user: {firstName: "Albert", lastName: "Einstein"}};
var objB = {user: {firstName: "Albert", lastName: "Collins"}};
var diff = jsonpatch.compare(objA, objB);
var obj = {user: {firstName: "Albert"}};
var patches3 = [{op: "replace", path: "/user/firstName", value: "Albert"}, {op: "replace", path: "/user/lastName", value: "Einstein"}];
var errors = jsonpatch.validate(patches, obj);
if (errors.length == 0) {
//there are no errors!
}
else {
for (var i=0; i < errors.length; i++) {
if (!errors[i]) {
console.log("Valid patch at index", i, patches[i]);
}
else {
console.error("Invalid patch at index", i, errors[i], patches[i]);
}
}
}
+67
View File
@@ -0,0 +1,67 @@
// Type definitions for JSON-Patch v1.0.0
// Project: https://github.com/Starcounter-Jack/JSON-Patch/releases
// Definitions by: Francis OBrien <https://github.com/itsFrank>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace fastjsonpatch {
interface JsonPatch {
/**
* Applies an array of patch instructions to an object
*/
apply(object:any, patches:Patch[], validate?:boolean):boolean
/**
* Observes changes made to an object, which can then be retieved using generate
*/
observe<T>(object:T, callback?:()=>void):Observer<T>
/**
* Detach an observer from an object
*/
unobserve<T>(object:T, observer:Observer<T>):void
/**
* Generate an array of patches from an observer
*/
generate<T>(observer:Observer<T>):Patch[]
/**
* Create an array of patches from the differences in two objects
*/
compare(object1:any, object2:any):Patch[]
/**
* Ensure a set of patch instructions is valid
*/
validate(patches:Patch[], tree?:any):JsonPatchError[]
}
interface Observer<T> {
object:T
patches:Patch[]
unobserve():void
}
interface Patch {
op:string
path:string
value?:any
from?:string
}
interface JsonPatchError {
name:string
message:string
index:number
operation:any
tree:any
}
}
declare var jsonpatch: fastjsonpatch.JsonPatch;
declare module "fast-json-patch" {
export = jsonpatch
}
+18 -1
View File
@@ -67,11 +67,28 @@ interface PayDialogParams {
test_currency?: string;
}
interface FeedDialogParams {
method: string; // "feed"
app_id: string;
redirect_uri?: string;
display?: string;
from?: string;
to?: string;
link?: string;
picture?: string;
source?: string;
name: string;
caption?: string;
description?: string;
ref?: any;
}
declare type FBUIParams = ShareDialogParams
| PageTabDialogParams
| RequestsDialogParams
| SendDialogParams
| PayDialogParams;
| PayDialogParams
| FeedDialogParams;
interface FBLoginOptions{
auth_type?: string;
+40 -1
View File
@@ -137,7 +137,7 @@ app.on('ready', () => {
mainWindow.webContents.capturePage(image => {
console.log(image.toDataURL());
});
mainWindow.webContents.capturePage({width: 100, height: 200}, image => {
mainWindow.webContents.capturePage({x: 0, y: 0, width: 100, height: 200}, image => {
console.log(image.toPNG());
});
});
@@ -577,6 +577,42 @@ var template = <Electron.MenuItemOptions[]>[
focusedWindow.webContents.toggleDevTools();
}
}
},
{
type: 'separator'
},
{
label: 'Actual Size',
accelerator: 'CmdOrCtrl+0',
click: (item, focusedWindow) => {
if (focusedWindow) {
focusedWindow.webContents.setZoomLevel(0)
}
}
},
{
label: 'Zoom In',
accelerator: 'CmdOrCtrl+Plus',
click: (item, focusedWindow) => {
if (focusedWindow) {
const { webContents } = focusedWindow;
webContents.getZoomLevel((zoomLevel) => {
webContents.setZoomLevel(zoomLevel + 0.5)
});
}
}
},
{
label: 'Zoom Out',
accelerator: 'CmdOrCtrl+-',
click: (item, focusedWindow) => {
if (focusedWindow) {
const { webContents } = focusedWindow;
webContents.getZoomLevel((zoomLevel) => {
webContents.setZoomLevel(zoomLevel - 0.5)
});
}
}
}
]
},
@@ -827,6 +863,8 @@ shell.openExternal('https://github.com', {
shell.beep();
shell.writeShortcutLink('/home/user/Desktop/shortcut.lnk', 'update', shell.readShortcutLink('/home/user/Desktop/shortcut.lnk'));
// session
// https://github.com/atom/electron/blob/master/docs/api/session.md
@@ -860,6 +898,7 @@ session.defaultSession.cookies.set(cookie, (error) => {
session.defaultSession.on('will-download', (event, item, webContents) => {
// Set the save path, making Electron not to prompt a save dialog.
item.setSavePath('/tmp/save.pdf');
console.log(item.getSavePath());
console.log(item.getMimeType());
console.log(item.getFilename());
console.log(item.getTotalBytes());
+136 -48
View File
@@ -1,4 +1,4 @@
// Type definitions for Electron v1.3.1
// Type definitions for Electron v1.3.2
// Project: http://electron.atom.io/
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -25,6 +25,23 @@ declare namespace Electron {
sender: EventEmitter;
}
type Point = {
x: number;
y: number;
}
type Size = {
width: number;
height: number;
}
type Rectangle = {
x: number;
y: number;
width: number;
height: number;
}
// https://github.com/electron/electron/blob/master/docs/api/app.md
/**
@@ -473,6 +490,13 @@ declare namespace Electron {
* Note: This API is only available on macOS.
*/
show(): void;
/**
* @returns Whether the dock icon is visible.
* The app.dock.show() call is asynchronous so this method might not return true immediately after that call.
*
* Note: This API is only available on macOS.
*/
isVisible(): boolean;
/**
* Sets the application dock menu.
*
@@ -844,7 +868,7 @@ declare namespace Electron {
*
* Note: This API is available only on macOS.
*/
setAspectRatio(aspectRatio: number, extraSize?: Dimension): void;
setAspectRatio(aspectRatio: number, extraSize?: Size): void;
/**
* Resizes and moves the window to width, height, x, y.
*/
@@ -1112,7 +1136,7 @@ declare namespace Electron {
*
* Note: This API is available only on Windows.
*/
setThumbnailClip(region: Bounds): void;
setThumbnailClip(region: Rectangle): void;
/**
* Same as webContents.showDefinitionForSelection().
* Note: This API is available only on macOS.
@@ -1360,7 +1384,7 @@ declare namespace Electron {
backgroundThrottling?: boolean;
}
interface BrowserWindowOptions extends Rectangle {
interface BrowserWindowOptions {
/**
* Window’s width in pixels.
* Default: 800.
@@ -1570,13 +1594,6 @@ declare namespace Electron {
type BrowserWindowTypeMac = 'desktop' | 'textured';
type BrowserWindowTypeWindows = 'toolbar';
interface Rectangle {
x?: number;
y?: number;
width?: number;
height?: number;
}
// https://github.com/electron/electron/blob/master/docs/api/clipboard.md
/**
@@ -1853,7 +1870,7 @@ declare namespace Electron {
* The suggested size that thumbnail should be scaled.
* Default: {width: 150, height: 150}
*/
thumbnailSize?: Dimension;
thumbnailSize?: Size;
}
interface DesktopCapturerSource {
@@ -2039,6 +2056,11 @@ declare namespace Electron {
* routine to determine the save path (Usually prompts a save dialog).
*/
setSavePath(path: string): void;
/**
* @returns The save path of the download item.
* This will be either the path set via downloadItem.setSavePath(path) or the path selected from the shown save dialog.
*/
getSavePath(): string;
/**
* Pauses the download.
*/
@@ -2428,13 +2450,17 @@ declare namespace Electron {
*/
static createFromDataURL(dataURL: string): NativeImage;
/**
* @returns Buffer Contains the image's PNG encoded data.
* @returns Buffer that contains the image's PNG encoded data.
*/
toPNG(): Buffer;
/**
* @returns Buffer Contains the image's JPEG encoded data.
* @returns Buffer that contains the image's JPEG encoded data.
*/
toJPEG(quality: number): Buffer;
/**
* @returns Buffer that contains the image's raw pixel data.
*/
toBitmap(): Buffer;
/**
* @returns string The data URL of the image.
*/
@@ -2452,7 +2478,7 @@ declare namespace Electron {
/**
* @returns {} The size of the image.
*/
getSize(): Dimension;
getSize(): Size;
/**
* Marks the image as template image.
*/
@@ -2675,10 +2701,10 @@ declare namespace Electron {
* Unique identifier associated with the display.
*/
id: number;
bounds: Bounds;
workArea: Bounds;
size: Dimension;
workAreaSize: Dimension;
bounds: Rectangle;
workArea: Rectangle;
size: Size;
workAreaSize: Size;
/**
* Output device’s pixel scale factor.
*/
@@ -2690,23 +2716,6 @@ declare namespace Electron {
touchSupport: 'available' | 'unavailable' | 'unknown';
}
type Bounds = {
x: number;
y: number;
width: number;
height: number;
}
type Dimension = {
width: number;
height: number;
}
type Point = {
x: number;
y: number;
}
type DisplayMetrics = 'bounds' | 'workArea' | 'scaleFactor' | 'rotation';
/**
@@ -2746,7 +2755,7 @@ declare namespace Electron {
/**
* @returns The display that most closely intersects the provided bounds.
*/
getDisplayMatching(rect: Bounds): Display;
getDisplayMatching(rect: Rectangle): Display;
}
// https://github.com/electron/electron/blob/master/docs/api/session.md
@@ -3257,6 +3266,62 @@ declare namespace Electron {
* Play the beep sound.
*/
beep(): void;
/**
* Creates or updates a shortcut link at shortcutPath.
*
* Note: This API is available only on Windows.
*/
writeShortcutLink(shortcutPath: string, options: ShortcutLinkOptions): boolean;
/**
* Creates or updates a shortcut link at shortcutPath.
*
* Note: This API is available only on Windows.
*/
writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutLinkOptions): boolean;
/**
* Resolves the shortcut link at shortcutPath.
* An exception will be thrown when any error happens.
*
* Note: This API is available only on Windows.
*/
readShortcutLink(shortcutPath: string): ShortcutLinkOptions;
}
interface ShortcutLinkOptions {
/**
* The target to launch from this shortcut.
*/
target: string;
/**
* The working directory.
* Default: empty.
*/
cwd?: string;
/**
* The arguments to be applied to target when launching from this shortcut.
* Default: empty.
*/
args?: string;
/**
* The description of the shortcut.
* Default: empty.
*/
description?: string;
/**
* The path to the icon, can be a DLL or EXE. icon and iconIndex have to be set together.
* Default: empty, which uses the target's icon.
*/
icon?: string;
/**
* The resource ID of icon when icon is a DLL or EXE.
* Default: 0.
*/
iconIndex?: number;
/**
* The Application User Model ID.
* Default: empty.
*/
appUserModelId?: string;
}
// https://github.com/electron/electron/blob/master/docs/api/system-preferences.md
@@ -3318,17 +3383,17 @@ declare namespace Electron {
* Emitted when the tray icon is clicked.
* Note: The bounds payload is only implemented on macOS and Windows.
*/
on(event: 'click', listener: (modifiers: Modifiers, bounds: Bounds) => void): this;
on(event: 'click', listener: (modifiers: Modifiers, bounds: Rectangle) => void): this;
/**
* Emitted when the tray icon is right clicked.
* Note: This is only implemented on macOS and Windows.
*/
on(event: 'right-click', listener: (modifiers: Modifiers, bounds: Bounds) => void): this;
on(event: 'right-click', listener: (modifiers: Modifiers, bounds: Rectangle) => void): this;
/**
* Emitted when the tray icon is double clicked.
* Note: This is only implemented on macOS and Windows.
*/
on(event: 'double-click', listener: (modifiers: Modifiers, bounds: Bounds) => void): this;
on(event: 'double-click', listener: (modifiers: Modifiers, bounds: Rectangle) => void): this;
/**
* Emitted when the tray balloon shows.
* Note: This is only implemented on Windows.
@@ -3428,7 +3493,7 @@ declare namespace Electron {
/**
* @returns The bounds of this tray icon.
*/
getBounds(): Bounds;
getBounds(): Rectangle;
}
interface Modifiers {
@@ -3641,9 +3706,9 @@ declare namespace Electron {
/**
* Emitted when the cursor’s type changes.
* If the type parameter is custom, the image parameter will hold the custom cursor image
* in a NativeImage, and the scale will hold scaling information for the image.
* in a NativeImage, and scale, size and hotspot will hold additional information about the custom cursor.
*/
on(event: 'cursor-changed', listener: (event: Event, type: CursorType, image?: NativeImage, scale?: number) => void): this;
on(event: 'cursor-changed', listener: (event: Event, type: CursorType, image?: NativeImage, scale?: number, size?: Size, hotspot?: Point) => void): this;
/**
* Emitted when there is a new context menu that needs to be handled.
*/
@@ -3769,6 +3834,29 @@ declare namespace Electron {
* @returns Whether this page has been muted.
*/
isAudioMuted(): boolean;
/**
* Changes the zoom factor to the specified factor.
* Zoom factor is zoom percent divided by 100, so 300% = 3.0.
*/
setZoomFactor(factor: number): void;
/**
* Sends a request to get current zoom factor.
*/
getZoomFactor(callback: (zoomFactor: number) => void): void;
/**
* Changes the zoom level to the specified level.
* The original size is 0 and each increment above or below represents
* zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively.
*/
setZoomLevel(level: number): void;
/**
* Sends a request to get current zoom level.
*/
getZoomLevel(callback: (zoomLevel: number) => void): void;
/**
* Sets the maximum and minimum zoom level.
*/
setZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
/**
* Executes the editing command undo in web page.
*/
@@ -3985,7 +4073,7 @@ declare namespace Electron {
* The dirtyRect is an object with x, y, width, height properties that describes which part of the page was repainted.
* If onlyDirty is set to true, frameBuffer will only contain the repainted area. onlyDirty defaults to false.
*/
dirtyRect?: Bounds
dirtyRect?: Rectangle
): void
}
@@ -4189,7 +4277,7 @@ declare namespace Electron {
* Specify page size of the generated PDF.
* Default: A4.
*/
pageSize?: 'A3' | 'A4' | 'A5' | 'Legal' | 'Letter' | 'Tabloid' | Dimension;
pageSize?: 'A3' | 'A4' | 'A5' | 'Legal' | 'Letter' | 'Tabloid' | Size;
/**
* Whether to print CSS backgrounds.
* Default: false.
@@ -4294,7 +4382,7 @@ declare namespace Electron {
/**
* Coordinates of first match region.
*/
selectionArea?: Bounds;
selectionArea?: Rectangle;
}
interface DeviceEmulationParameters {
@@ -4306,7 +4394,7 @@ declare namespace Electron {
/**
* Set the emulated screen size (screenPosition == mobile)
*/
screenSize?: Dimension;
screenSize?: Size;
/**
* Position the view on the screen (screenPosition == mobile)
* Default: {x: 0, y: 0}
@@ -4320,7 +4408,7 @@ declare namespace Electron {
/**
* Set the emulated view size (empty means no override).
*/
viewSize?: Dimension;
viewSize?: Size;
/**
* Whether emulated view should be scaled down if necessary to fit into available space
* Default: false
+346
View File
@@ -0,0 +1,346 @@
/// <reference path="gl-matrix-typed.d.ts" />
// common
import {vec2, mat2, mat3, mat4, vec3, vec4, glMatrix, mat2d, quat} from "./gl-matrix-typed";
var result: number = glMatrix.toRadian(180);
var outVal: number;
var outBool: boolean;
var outStr: string;
let vecArray = new Float32Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
let vec2A = vec2.fromValues(1, 2);
let vec2B = vec2.fromValues(3, 4);
let vec3A = vec3.fromValues(1, 2, 3);
let vec3B = vec3.fromValues(3, 4, 5);
let vec4A = vec4.fromValues(1, 2, 3, 4);
let vec4B = vec4.fromValues(3, 4, 5, 6);
let mat2A = mat2.fromValues(1, 2, 3, 4);
let mat2B = mat2.fromValues(1, 2, 3, 4);
let mat2dA = mat2d.fromValues(1, 2, 3, 4, 5, 6);
let mat2dB = mat2d.fromValues(1, 2, 3, 4, 5, 6);
let mat3A = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
let mat3B = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
let mat4A = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
let mat4B = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
let quatA = quat.fromValues(1, 2, 3, 4);
let quatB = quat.fromValues(5, 6, 7, 8);
let outVec2 = vec2.create();
let outVec3 = vec3.create();
let outVec4 = vec4.create();
let outMat2 = mat2.create();
let outMat2d = mat2d.create();
let outMat3 = mat3.create();
let outMat4 = mat4.create();
let outQuat = quat.create();
// vec2
outVec2 = vec2.create();
outVec2 = vec2.clone(vec2A);
outVec2 = vec2.fromValues(1, 2);
outVec2 = vec2.copy(outVec2, vec2A);
outVec2 = vec2.set(outVec2, 1, 2);
outVec2 = vec2.add(outVec2, vec2A, vec2B);
outVec2 = vec2.subtract(outVec2, vec2A, vec2B);
outVec2 = vec2.sub(outVec2, vec2A, vec2B);
outVec2 = vec2.multiply(outVec2, vec2A, vec2B);
outVec2 = vec2.mul(outVec2, vec2A, vec2B);
outVec2 = vec2.divide(outVec2, vec2A, vec2B);
outVec2 = vec2.div(outVec2, vec2A, vec2B);
outVec2 = vec2.ceil(outVec2, vec2A);
outVec2 = vec2.floor(outVec2, vec2A);
outVec2 = vec2.min(outVec2, vec2A, vec2B);
outVec2 = vec2.max(outVec2, vec2A, vec2B);
outVec2 = vec2.round(outVec2, vec2A);
outVec2 = vec2.scale(outVec2, vec2A, 2);
outVec2 = vec2.scaleAndAdd(outVec2, vec2A, vec2B, 0.5);
outVal = vec2.distance(vec2A, vec2B);
outVal = vec2.dist(vec2A, vec2B);
outVal = vec2.squaredDistance(vec2A, vec2B);
outVal = vec2.sqrDist(vec2A, vec2B);
outVal = vec2.length(vec2A);
outVal = vec2.len(vec2A);
outVal = vec2.squaredLength(vec2A);
outVal = vec2.sqrLen(vec2A);
outVec2 = vec2.negate(outVec2, vec2A);
outVec2 = vec2.inverse(outVec2, vec2A);
outVec2 = vec2.normalize(outVec2, vec2A);
outVal = vec2.dot(vec2A, vec2B);
outVec2 = vec2.cross(outVec2, vec2A, vec2B);
outVec2 = vec2.lerp(outVec2, vec2A, vec2B, 0.5);
outVec2 = vec2.random(outVec2);
outVec2 = vec2.random(outVec2, 5.0);
outVec2 = vec2.transformMat2(outVec2, vec2A, mat2A);
outVec2 = vec2.transformMat2d(outVec2, vec2A, mat2dA);
outVec2 = vec2.transformMat3(outVec2, vec2A, mat3A);
outVec2 = vec2.transformMat4(outVec2, vec2A, mat4A);
vecArray = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize);
outStr = vec2.str(vec2A);
outBool = vec2.exactEquals(vec2A, vec2B);
outBool = vec2.equals(vec2A, vec2B);
// vec3
outVec3 = vec3.create();
outVec3 = vec3.clone(vec3A);
outVec3 = vec3.fromValues(1, 2, 3);
outVec3 = vec3.copy(outVec3, vec3A);
outVec3 = vec3.set(outVec3, 1, 2, 3);
outVec3 = vec3.add(outVec3, vec3A, vec3B);
outVec3 = vec3.subtract(outVec3, vec3A, vec3B);
outVec3 = vec3.sub(outVec3, vec3A, vec3B);
outVec3 = vec3.multiply(outVec3, vec3A, vec3B);
outVec3 = vec3.mul(outVec3, vec3A, vec3B);
outVec3 = vec3.divide(outVec3, vec3A, vec3B);
outVec3 = vec3.div(outVec3, vec3A, vec3B);
outVec3 = vec3.ceil(outVec3, vec3A);
outVec3 = vec3.floor(outVec3, vec3A);
outVec3 = vec3.min(outVec3, vec3A, vec3B);
outVec3 = vec3.max(outVec3, vec3A, vec3B);
outVec3 = vec3.round(outVec3, vec3A);
outVec3 = vec3.scale(outVec3, vec3A, 2);
outVec3 = vec3.scaleAndAdd(outVec3, vec3A, vec3B, 0.5);
outVal = vec3.distance(vec3A, vec3B);
outVal = vec3.dist(vec3A, vec3B);
outVal = vec3.squaredDistance(vec3A, vec3B);
outVal = vec3.sqrDist(vec3A, vec3B);
outVal = vec3.length(vec3A);
outVal = vec3.len(vec3A);
outVal = vec3.squaredLength(vec3A);
outVal = vec3.sqrLen(vec3A);
outVec3 = vec3.negate(outVec3, vec3A);
outVec3 = vec3.inverse(outVec3, vec3A);
outVec3 = vec3.normalize(outVec3, vec3A);
outVal = vec3.dot(vec3A, vec3B);
outVec3 = vec3.cross(outVec3, vec3A, vec3B);
outVec3 = vec3.lerp(outVec3, vec3A, vec3B, 0.5);
outVec3 = vec3.hermite(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5);
outVec3 = vec3.bezier(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5);
outVec3 = vec3.random(outVec3);
outVec3 = vec3.random(outVec3, 5.0);
outVec3 = vec3.transformMat3(outVec3, vec3A, mat3A);
outVec3 = vec3.transformMat4(outVec3, vec3A, mat4A);
outVec3 = vec3.transformQuat(outVec3, vec3A, quatA);
outVec3 = vec3.rotateX(outVec3, vec3A, vec3B, Math.PI);
outVec3 = vec3.rotateY(outVec3, vec3A, vec3B, Math.PI);
outVec3 = vec3.rotateZ(outVec3, vec3A, vec3B, Math.PI);
vecArray = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize);
outVal = vec3.angle(vec3A, vec3B);
outStr = vec3.str(vec3A);
outBool = vec3.exactEquals(vec3A, vec3B);
outBool = vec3.equals(vec3A, vec3B);
// vec4
outVec4 = vec4.create();
outVec4 = vec4.clone(vec4A);
outVec4 = vec4.fromValues(1, 2, 3, 4);
outVec4 = vec4.copy(outVec4, vec4A);
outVec4 = vec4.set(outVec4, 1, 2, 3, 4);
outVec4 = vec4.add(outVec4, vec4A, vec4B);
outVec4 = vec4.subtract(outVec4, vec4A, vec4B);
outVec4 = vec4.sub(outVec4, vec4A, vec4B);
outVec4 = vec4.multiply(outVec4, vec4A, vec4B);
outVec4 = vec4.mul(outVec4, vec4A, vec4B);
outVec4 = vec4.divide(outVec4, vec4A, vec4B);
outVec4 = vec4.div(outVec4, vec4A, vec4B);
outVec4 = vec4.ceil(outVec4, vec4A);
outVec4 = vec4.floor(outVec4, vec4A);
outVec4 = vec4.min(outVec4, vec4A, vec4B);
outVec4 = vec4.max(outVec4, vec4A, vec4B);
outVec4 = vec4.scale(outVec4, vec4A, 2);
outVec4 = vec4.scaleAndAdd(outVec4, vec4A, vec4B, 0.5);
outVal = vec4.distance(vec4A, vec4B);
outVal = vec4.dist(vec4A, vec4B);
outVal = vec4.squaredDistance(vec4A, vec4B);
outVal = vec4.sqrDist(vec4A, vec4B);
outVal = vec4.length(vec4A);
outVal = vec4.len(vec4A);
outVal = vec4.squaredLength(vec4A);
outVal = vec4.sqrLen(vec4A);
outVec4 = vec4.negate(outVec4, vec4A);
outVec4 = vec4.inverse(outVec4, vec4A);
outVec4 = vec4.normalize(outVec4, vec4A);
outVal = vec4.dot(vec4A, vec4B);
outVec4 = vec4.lerp(outVec4, vec4A, vec4B, 0.5);
outVec4 = vec4.random(outVec4);
outVec4 = vec4.random(outVec4, 5.0);
outVec4 = vec4.transformMat4(outVec4, vec4A, mat4A);
outVec4 = vec4.transformQuat(outVec4, vec4A, quatA);
vecArray = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize);
outStr = vec4.str(vec4A);
outBool = vec4.exactEquals(vec4A, vec4B);
outBool = vec4.equals(vec4A, vec4B);
// mat2
outMat2 = mat2.create();
outMat2 = mat2.clone(mat2A);
outMat2 = mat2.copy(outMat2, mat2A);
outMat2 = mat2.identity(outMat2);
outMat2 = mat2.fromValues(1, 2, 3, 4);
outMat2 = mat2.set(outMat2, 1, 2, 3, 4);
outMat2 = mat2.transpose(outMat2, mat2A);
outMat2 = mat2.invert(outMat2, mat2A);
outMat2 = mat2.adjoint(outMat2, mat2A);
outVal = mat2.determinant(mat2A);
outMat2 = mat2.multiply(outMat2, mat2A, mat2B);
outMat2 = mat2.mul(outMat2, mat2A, mat2B);
outMat2 = mat2.rotate(outMat2, mat2A, Math.PI * 0.5);
outMat2 = mat2.scale(outMat2, mat2A, vec2A);
outMat2 = mat2.fromRotation(outMat2, 0.5);
outMat2 = mat2.fromScaling(outMat2, vec2A);
outStr = mat2.str(mat2A);
outVal = mat2.frob(mat2A);
var L = mat2.create();
var D = mat2.create();
var U = mat2.create();
outMat2 = mat2.LDU(L, D, U, mat2A);
outMat2 = mat2.add(outMat2, mat2A, mat2B);
outMat2 = mat2.subtract(outMat2, mat2A, mat2B);
outMat2 = mat2.sub(outMat2, mat2A, mat2B);
outBool = mat2.exactEquals(mat2A, mat2B);
outBool = mat2.equals(mat2A, mat2B);
outMat2 = mat2.multiplyScalar (outMat2, mat2A, 2);
outMat2 = mat2.multiplyScalarAndAdd (outMat2, mat2A, mat2B, 2);
// mat2d
outMat2d = mat2d.create();
outMat2d = mat2d.clone(mat2dA);
outMat2d = mat2d.copy(outMat2d, mat2dA);
outMat2d = mat2d.identity(outMat2d);
outMat2d = mat2d.fromValues(1, 2, 3, 4, 5, 6);
outMat2d = mat2d.set(outMat2d, 1, 2, 3, 4, 5, 6);
outMat2d = mat2d.invert(outMat2d, mat2dA);
outVal = mat2d.determinant(mat2dA);
outMat2d = mat2d.multiply(outMat2d, mat2dA, mat2dB);
outMat2d = mat2d.mul(outMat2d, mat2dA, mat2dB);
outMat2d = mat2d.rotate(outMat2d, mat2dA, Math.PI * 0.5);
outMat2d = mat2d.scale(outMat2d, mat2dA, vec2A);
outMat2d = mat2d.translate(outMat2d, mat2dA, vec2A);
outMat2d = mat2d.fromRotation(outMat2d, 0.5);
outMat2d = mat2d.fromScaling(outMat2d, vec2A);
outMat2d = mat2d.fromTranslation(outMat2d, vec2A);
outStr = mat2d.str(mat2dA);
outVal = mat2d.frob(mat2dA);
outMat2d = mat2d.add(outMat2d, mat2dA, mat2dB);
outMat2d = mat2d.subtract(outMat2d, mat2dA, mat2dB);
outMat2d = mat2d.sub(outMat2d, mat2dA, mat2dB);
outMat2d = mat2d.multiplyScalar (outMat2d, mat2dA, 2);
outMat2d = mat2d.multiplyScalarAndAdd (outMat2d, mat2dA, mat2dB, 2);
outBool = mat2d.exactEquals(mat2dA, mat2dB);
outBool = mat2d.equals(mat2dA, mat2dB);
// mat3
outMat3 = mat3.create();
outMat3 = mat3.fromMat4(outMat3, mat4A);
outMat3 = mat3.clone(mat3A);
outMat3 = mat3.copy(outMat3, mat3A);
outMat3 = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
outMat3 = mat3.set(outMat3, 1, 2, 3, 4, 5, 6, 7, 8, 9);
outMat3 = mat3.identity(outMat3);
outMat3 = mat3.transpose(outMat3, mat3A);
outMat3 = mat3.invert(outMat3, mat3A);
outMat3 = mat3.adjoint(outMat3, mat3A);
outVal = mat3.determinant(mat3A);
outMat3 = mat3.multiply(outMat3, mat3A, mat3B);
outMat3 = mat3.mul(outMat3, mat3A, mat3B);
outMat3 = mat3.translate(outMat3, mat3A, vec3A);
outMat3 = mat3.rotate(outMat3, mat3A, Math.PI/2);
outMat3 = mat3.scale(outMat3, mat3A, vec2A);
outMat3 = mat3.fromTranslation(outMat3, vec2A);
outMat3 = mat3.fromRotation(outMat3, Math.PI);
outMat3 = mat3.fromScaling(outMat3, vec2A);
outMat3 = mat3.fromMat2d(outMat3, mat2dA);
outMat3 = mat3.fromQuat(outMat3, quatA);
outMat3 = mat3.normalFromMat4(outMat3, mat4A);
outStr = mat3.str(mat3A);
outVal = mat3.frob(mat3A);
outMat3 = mat3.add(outMat3, mat3A, mat3B);
outMat3 = mat3.subtract(outMat3, mat3A, mat3B);
outMat3 = mat3.sub(outMat3, mat3A, mat3B);
outMat3 = mat3.multiplyScalar (outMat3, mat3A, 2);
outMat3 = mat3.multiplyScalarAndAdd (outMat3, mat3A, mat3B, 2);
outBool = mat3.exactEquals(mat3A, mat3B);
outBool = mat3.equals(mat3A, mat3B);
//mat4
outMat4 = mat4.create();
outMat4 = mat4.clone(mat4A);
outMat4 = mat4.copy(outMat4, mat4A);
outMat4 = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
outMat4 = mat4.set(outMat4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
outMat4 = mat4.identity(outMat4);
outMat4 = mat4.transpose(outMat4, mat4A);
outMat4 = mat4.invert(outMat4, mat4A);
outMat4 = mat4.adjoint(outMat4, mat4A);
outVal = mat4.determinant(mat4A);
outMat4 = mat4.multiply(outMat4, mat4A, mat4B);
outMat4 = mat4.mul(outMat4, mat4A, mat4B);
outMat4 = mat4.translate(outMat4, mat4A, vec3A);
outMat4 = mat4.scale(outMat4, mat4A, vec3A);
outMat4 = mat4.rotate(outMat4, mat4A, Math.PI, vec3A);
outMat4 = mat4.rotateX(outMat4, mat4A, Math.PI);
outMat4 = mat4.rotateY(outMat4, mat4A, Math.PI);
outMat4 = mat4.rotateZ(outMat4, mat4A, Math.PI);
outMat4 = mat4.fromTranslation(outMat4, vec3A);
outMat4 = mat4.fromRotation(outMat4, Math.PI, vec3A);
outMat4 = mat4.fromScaling(outMat4, vec3A);
outMat4 = mat4.fromXRotation(outMat4, Math.PI);
outMat4 = mat4.fromYRotation(outMat4, Math.PI);
outMat4 = mat4.fromZRotation(outMat4, Math.PI);
outMat4 = mat4.fromRotationTranslation(outMat4, quatA, vec3A);
outVec3 = mat4.getTranslation(outVec3, mat4A)
outQuat = mat4.getRotation(outQuat, mat4A)
outMat4 = mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B);
outMat4 = mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A);
outMat4 = mat4.fromQuat(outMat4, quatB);
outMat4 = mat4.frustum(outMat4, -1, 1, -1, 1, -1, 1);
outMat4 = mat4.perspective(outMat4, Math.PI, 1, 0, 1);
outMat4 = mat4.perspectiveFromFieldOfView(outMat4, {upDegrees:Math.PI, downDegrees:-Math.PI, leftDegrees:-Math.PI, rightDegrees:Math.PI}, 1, 0);
outMat4 = mat4.ortho(outMat4, -1, 1, -1, 1, -1, 1);
outMat4 = mat4.lookAt(outMat4, vec3A, vec3B, vec3A);
outStr = mat4.str(mat4A);
outVal = mat4.frob(mat4A);
outMat4 = mat4.add(outMat4, mat4A, mat4B);
outMat4 = mat4.subtract(outMat4, mat4A, mat4B);
outMat4 = mat4.sub(outMat4, mat4A, mat4B);
outMat4 = mat4.multiplyScalar (outMat4, mat4A, 2);
outMat4 = mat4.multiplyScalarAndAdd (outMat4, mat4A, mat4B, 2);
outBool = mat4.exactEquals(mat4A, mat4B);
outBool = mat4.equals(mat4A, mat4B);
// quat
var deg90 = Math.PI / 2;
outQuat = quat.create();
outQuat = quat.clone(quatA);
outQuat = quat.fromValues(1, 2, 3, 4);
outQuat = quat.copy(outQuat, quatA);
outQuat = quat.set(outQuat, 1, 2, 3, 4);
outQuat = quat.identity(outQuat);
outQuat = quat.rotationTo(outQuat, vec3A, vec3B);
outQuat = quat.setAxes(outQuat, vec3A, vec3B, vec3A);
outQuat = quat.setAxisAngle(outQuat, vec3A, Math.PI * 0.5);
outVal = quat.getAxisAngle (outVec3, quatA);
outQuat = quat.add(outQuat, quatA, quatB);
outQuat = quat.multiply(outQuat, quatA, quatB);
outQuat = quat.mul(outQuat, quatA, quatB);
outQuat = quat.scale(outQuat, quatA, 2);
outVal = quat.length(quatA);
outVal = quat.len(quatA);
outVal = quat.squaredLength(quatA);
outVal = quat.sqrLen(quatA);
outQuat = quat.normalize(outQuat, quatA);
outVal = quat.dot(quatA, quatB);
outQuat = quat.lerp(outQuat, quatA, quatB, 0.5);
outQuat = quat.slerp(outQuat, quatA, quatB, 0.5);
outQuat = quat.invert(outQuat, quatA);
outQuat = quat.conjugate(outQuat, quatA);
outStr = quat.str(quatA);
outQuat = quat.rotateX(outQuat, quatA, deg90);
outQuat = quat.rotateY(outQuat, quatA, deg90);
outQuat = quat.rotateZ(outQuat, quatA, deg90);
outQuat = quat.fromMat3(outQuat, mat3A);
outQuat = quat.calculateW(outQuat, quatA);
outBool = quat.exactEquals(quatA, quatB);
outBool = quat.equals(quatA, quatB);
+3054
View File
File diff suppressed because it is too large Load Diff
+5 -4
View File
@@ -1783,21 +1783,22 @@ declare namespace google.maps {
}
export type LatLngLiteral = { lat: number; lng: number }
export type LatLngBoundsLiteral = { east: number; north: number; south: number; west: number }
export class LatLngBounds {
constructor(sw?: LatLng, ne?: LatLng);
constructor(sw?: LatLng|LatLngLiteral, ne?: LatLng|LatLngLiteral);
contains(latLng: LatLng): boolean;
equals(other: LatLngBounds): boolean;
equals(other: LatLngBounds|LatLngBoundsLiteral): boolean;
extend(point: LatLng): LatLngBounds;
getCenter(): LatLng;
getNorthEast(): LatLng;
getSouthWest(): LatLng;
intersects(other: LatLngBounds): boolean;
intersects(other: LatLngBounds|LatLngBoundsLiteral): boolean;
isEmpty(): boolean;
toSpan(): LatLng;
toString(): string;
toUrlValue(precision?: number): string;
union(other: LatLngBounds): LatLngBounds;
union(other: LatLngBounds|LatLngBoundsLiteral): LatLngBounds;
}
export class Point {
+2 -1
View File
@@ -2,8 +2,9 @@
var params: ReCaptchaV2.Parameters = {
"sitekey": "mySuperSecretKey",
"theme": "black", // no type-checking here.
"theme": "light",
"type": "image",
"size": "normal",
"tabindex": 5,
"callback": (response: string) => { },
"expired-callback": () => { },
+16 -3
View File
@@ -29,6 +29,10 @@ declare namespace ReCaptchaV2
getResponse(opt_widget_id?: number): string;
}
type Theme = "light" | "dark";
type Type = "image" | "audio";
type Size = "normal" | "compact";
interface Parameters
{
/**
@@ -39,14 +43,23 @@ declare namespace ReCaptchaV2
* Optional. The color theme of the widget.
* Accepted values: "light", "dark"
* @default "light"
* @type {Theme}
**/
theme?: string;
theme?: Theme;
/**
* Optional. The type of CAPTCHA to serve.
* Accepted values: "audio ", "image"
* Accepted values: "audio", "image"
* @default "image"
* @type {Type}
**/
type?: string;
type?: Type;
/**
* Optional. The size of the widget.
* Accepted values: "compact", "normal"
* @default "compact"
* @type {Size}
*/
size?: Size;
/**
* Optional. The tabindex of the widget and challenge.
* If other elements in your page use tabindex, it should be set to make user navigation easier.
+36 -15
View File
@@ -221,21 +221,7 @@ declare module "hapi" {
defaultExtension?: string;
}
/** Concludes the handler activity by setting a response and returning control over to the framework where:
erran optional error response.
resultan optional response payload.
Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first.
FLOW CONTROL:
When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */
export interface IReply {
<T>(err: Error,
result?: string|number|boolean|Buffer|stream.Stream | Promise<T> | T,
/** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */
credentialData?: any
): IBoom;
/** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */
<T>(result?: string|number|boolean|Buffer|stream.Stream | Promise<T> | T): Response;
interface IReplyMethods {
/** Returns control back to the framework without setting a response. If called in the handler, the response defaults to an empty payload with status code 200.
* The data argument is only used for passing back authentication data and is ignored elsewhere. */
continue(credentialData?: any): void;
@@ -282,8 +268,39 @@ declare module "hapi" {
redirect(uri: string): Response;
}
/** Concludes the handler activity by setting a response and returning control over to the framework where:
erran optional error response.
resultan optional response payload.
Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first.
FLOW CONTROL:
When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */
export interface IReply extends IReplyMethods{
<T>(err: Error,
result?: string|number|boolean|Buffer|stream.Stream | Promise<T> | T,
/** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */
credentialData?: any
): IBoom;
/** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */
<T>(result?: string|number|boolean|Buffer|stream.Stream | Promise<T> | T): Response;
}
/** Concludes the handler activity by setting a response and returning control over to the framework where:
erran optional error response.
result an optional response payload.
Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first.
FLOW CONTROL:
When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */
export interface IStrictReply<T> extends IReplyMethods {
(err: Error,
result?: Promise<T> | T,
/** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */
credentialData?: any): IBoom;
/** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */
(result: Promise<T> | T): Response;
}
export interface ISessionHandler {
(request: Request, reply: IReply): void;
<T>(request: Request, reply: IStrictReply<T>): void;
}
export interface IRequestHandler<T> {
(request: Request): T;
@@ -868,6 +885,7 @@ declare module "hapi" {
};
server.auth.scheme('custom', scheme);*/
authenticate(request: Request, reply: IReply): void;
authenticate<T>(request: Request, reply: IStrictReply<T>): void;
/** payload(request, reply) - optional function called to authenticate the request payload where:
request - the request object.
reply(err, response) - is called if authentication failed where:
@@ -876,6 +894,7 @@ declare module "hapi" {
reply.continue() - is called if payload authentication succeeded.
When the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'.*/
payload? (request: Request, reply: IReply): void;
payload?<T>(request: Request, reply: IStrictReply<T>): void;
/** response(request, reply) - optional function called to decorate the response with authentication headers before the response headers or payload is written where:
request - the request object.
reply(err, response) - is called if an error occurred where:
@@ -883,6 +902,7 @@ declare module "hapi" {
response - any authentication response to send instead of the current response. Ignored if err is present, otherwise required.
reply.continue() - is called if the operation succeeded.*/
response? (request: Request, reply: IReply): void;
response?<T>(request: Request, reply: IStrictReply<T>): void;
/** an optional object */
options?: {
/** if true, requires payload validation as part of the scheme and forbids routes from disabling payload auth validation. Defaults to false.*/
@@ -1830,6 +1850,7 @@ declare module "hapi" {
server.start();
// All requests will get routed to '/test'*/
ext(event: string, method: (request: Request, reply: IReply, bind?: any) => void, options?: { before: string|string[]; after: string|string[]; bind?: any }): void;
ext<T>(event: string, method: (request: Request, reply: IStrictReply<T>, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void;
/** server.handler(name, method)
Registers a new handler type to be used in routes where:
+20
View File
@@ -104,5 +104,25 @@ server.route([{
}
}]);
server.route([{
method: 'GET',
path: '/hello4',
handler: function (request: Hapi.Request, reply: Hapi.IReply) {
reply('hello world2');
}
}]);
interface IHello {
msg: string
}
server.route([{
method: 'GET',
path: '/hello5',
handler: function (request: Hapi.Request, reply: Hapi.IStrictReply<IHello>) {
reply({ msg: 'hello world' })
}
}]);
// Start the server
server.start();
+20
View File
@@ -92,6 +92,26 @@ server.route([{
}
}]);
server.route([{
method: 'GET',
path: '/hello3',
handler: function (request: Hapi.Request, reply: Hapi.IReply) {
reply('hello world2');
}
}]);
interface IHello {
msg: string
}
server.route([{
method: 'GET',
path: '/hello4',
handler: function (request: Hapi.Request, reply: Hapi.IStrictReply<IHello>) {
reply({ msg: 'hello world' })
}
}]);
// config.validate parameters should be optional
server.route([{
method: 'GET',
+38 -15
View File
@@ -240,21 +240,9 @@ declare module "hapi" {
/** defines the default filename extension to append to template names when multiple engines are configured and not explicit extension is provided for a given template. No default value.*/
defaultExtension?: string;
}
/** Concludes the handler activity by setting a response and returning control over to the framework where:
erran optional error response.
resultan optional response payload.
Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first.
FLOW CONTROL:
When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */
export interface IReply {
<T>(err: Error,
result?: string | number | boolean | Buffer | stream.Stream | IPromise<T> | T,
/** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */
credentialData?: any): IBoom;
/** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */
<T>(result: string | number | boolean | Buffer | stream.Stream | IPromise<T> | T): Response;
interface IReplyMethods {
/** Returns control back to the framework without setting a response. If called in the handler, the response defaults to an empty payload with status code 200.
* The data argument is only used for passing back authentication data and is ignored elsewhere. */
continue(credentialData?: any): void;
@@ -310,8 +298,39 @@ declare module "hapi" {
unstate(name: string, options?: any): void;
}
/** Concludes the handler activity by setting a response and returning control over to the framework where:
erran optional error response.
result an optional response payload.
Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first.
FLOW CONTROL:
When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */
export interface IReply extends IReplyMethods {
<T>(err: Error,
result?: string | number | boolean | Buffer | stream.Stream | IPromise<T> | T,
/** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */
credentialData?: any): IBoom;
/** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */
<T>(result: string | number | boolean | Buffer | stream.Stream | IPromise<T> | T): Response;
}
/** Concludes the handler activity by setting a response and returning control over to the framework where:
erran optional error response.
result an optional response payload.
Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first.
FLOW CONTROL:
When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */
export interface IStrictReply<T> extends IReplyMethods {
(err: Error,
result?: IPromise<T> | T,
/** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */
credentialData?: any): IBoom;
/** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */
(result: IPromise<T> | T): Response;
}
export interface ISessionHandler {
(request: Request, reply: IReply): void;
<T>(request: Request, reply: IStrictReply<T>): void;
}
export interface IRequestHandler<T> {
(request: Request): T;
@@ -926,6 +945,7 @@ declare module "hapi" {
};
server.auth.scheme('custom', scheme);*/
authenticate(request: Request, reply: IReply): void;
authenticate<T>(request: Request, reply: IStrictReply<T>): void;
/** payload(request, reply) - optional function called to authenticate the request payload where:
request - the request object.
reply(err, response) - is called if authentication failed where:
@@ -934,6 +954,7 @@ declare module "hapi" {
reply.continue() - is called if payload authentication succeeded.
When the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'.*/
payload?(request: Request, reply: IReply): void;
payload?<T>(request: Request, reply: IStrictReply<T>): void;
/** response(request, reply) - optional function called to decorate the response with authentication headers before the response headers or payload is written where:
request - the request object.
reply(err, response) - is called if an error occurred where:
@@ -941,6 +962,7 @@ declare module "hapi" {
response - any authentication response to send instead of the current response. Ignored if err is present, otherwise required.
reply.continue() - is called if the operation succeeded.*/
response?(request: Request, reply: IReply): void;
response?<T>(request: Request, reply: IStrictReply<T>): void;
/** an optional object */
options?: {
/** if true, requires payload validation as part of the scheme and forbids routes from disabling payload auth validation. Defaults to false.*/
@@ -2018,6 +2040,7 @@ declare module "hapi" {
server.start();
// All requests will get routed to '/test'*/
ext(event: string, method: (request: Request, reply: IReply, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void;
ext<T>(event: string, method: (request: Request, reply: IStrictReply<T>, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void;
/** server.handler(name, method)
Registers a new handler type to be used in routes where:
+44 -4
View File
@@ -18,7 +18,45 @@ interface HelloJSLogoutOptions {
force?: boolean;
}
interface HelloJSEvent {
interface HelloJSImmediateSuccessCB<T, TP> {
(value: T): TP;
}
interface HelloJSImmediateErrorCB<TP> {
(err: any): TP;
}
interface HelloJSDeferredSuccessCB<T, TP> {
(value: T): HelloJSThenable<TP>;
}
interface HelloJSDeferredErrorCB<TP> {
(error: any): HelloJSThenable<TP>;
}
interface HelloJSThenable<T> {
then<TP>(
successCB?: HelloJSDeferredSuccessCB<T, TP>,
errorCB?: HelloJSDeferredErrorCB<TP>
): HelloJSThenable<TP>;
then<TP>(
successCB?: HelloJSDeferredSuccessCB<T, TP>,
errorCB?: HelloJSImmediateErrorCB<TP>
): HelloJSThenable<TP>;
then<TP>(
successCB?: HelloJSImmediateSuccessCB<T, TP>,
errorCB?: HelloJSDeferredErrorCB<TP>
): HelloJSThenable<TP>;
then<TP>(
successCB?: HelloJSImmediateSuccessCB<T, TP>,
errorCB?: HelloJSImmediateErrorCB<TP>
): HelloJSThenable<TP>;
}
interface HelloJSEvent extends HelloJSThenable<void> {
on(event: string, callback: (auth: HelloJSEventArgument) => void): HelloJSStatic;
off(event: string, callback: (auth: HelloJSEventArgument) => void): HelloJSStatic;
findEvents(event: string, callback: (name: string, index: number) => void): void;
@@ -30,15 +68,17 @@ interface HelloJSEvent {
}
interface HelloJSEventArgument {
network: string;
authResponse?: any;
}
interface HelloJSStatic extends HelloJSEvent {
init(serviceAppIds: { [id: string]: string; }, options?: HelloJSLoginOptions): void;
login(network: string, options?: HelloJSLoginOptions, callback?: () => void): void;
logout(network: string, options?: HelloJSLogoutOptions, callback?: () => void): void;
login(network: string, options?: HelloJSLoginOptions, callback?: () => void): HelloJSStatic;
logout(network: string, options?: HelloJSLogoutOptions, callback?: () => void): HelloJSStatic;
getAuthResponse(network: string): any;
service(network: string): HelloJSServiceDef;
settings: HelloJSLoginOptions;
@@ -50,7 +90,7 @@ interface HelloJSStaticNamed {
login(option?: HelloJSLoginOptions, callback?: () => void): void;
logout(callback?: () => void): void;
getAuthResponse(): any;
api(path?: string, method?: string, data?: any, callback?: (json?: any) => void): HelloJSStatic;
api(path?: string, method?: string, data?: any, callback?: (json?: any) => void): HelloJSStatic;
}
interface HelloJSOAuthDef {
+1 -1
View File
@@ -6053,7 +6053,7 @@ interface HighchartsStatic {
* throughout the page's lifetime. When a chart is destroyed, the array item becomes undefined.
* @since 2.3.4
*/
charts: HighchartsChart[];
charts: HighchartsChartObject[];
/**
* Formats a JavaScript date timestamp (milliseconds since Jan 1st 1970) into a human readable date string. The
* format is a subset of the formats for PHP's strftime function. Additional formats can be given in the
@@ -0,0 +1,18 @@
///<reference path="html-webpack-plugin.d.ts" />
import {Configuration} from "webpack";
import HtmlWebpackPlugin = require("html-webpack-plugin");
const a: Configuration = {
plugins: [
new HtmlWebpackPlugin()
]
};
const b: Configuration = {
plugins: [
new HtmlWebpackPlugin({
title: "test"
})
]
};
+89
View File
@@ -0,0 +1,89 @@
// Type definitions for html-webpack-plugin v2.22.2
// Project: https://github.com/ampedandwired/html-webpack-plugin
// Definitions by: Simon Hartcher <http://github.com/deevus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference path="../webpack/webpack.d.ts" />
declare module "html-webpack-plugin" {
import {Plugin} from "webpack";
interface HtmlWebpackPluginConfiguration {
/**
* The title to use for the generated HTML document.
*/
title?: string;
/**
* The file to write the HTML to. Defaults to index.html. You can specify a subdirectory here too (eg: `assets/admin.html`).
*/
filename?: string;
/**
* Webpack require path to the template. Please see the docs for details.
*/
template?: string;
/**
* `true | 'head' | 'body' | false`
*
* Inject all assets into the given template or templateContent - When passing true or 'body' all javascript resources will be placed at the bottom of the body element. 'head' will place the scripts in the head element.
*/
inject?: boolean | "head" | "body";
/**
* Adds the given favicon path to the output html.
*/
favicon?: string;
/**
* Pass a html-minifier options object to minify the output.
*
* https://github.com/kangax/html-minifier#options-quick-reference
*/
minify?: any;
/**
* `true | false` if `true` then append a unique webpack compilation hash to all included scripts and css files. This is useful for cache busting.
*/
hash?: boolean;
/**
* `true | false` if `true` (default) try to emit the file only if it was changed.
*/
cache?: boolean;
/**
* `true | false` if `true` (default) errors details will be written into the html page.
*/
showErrors?: boolean;
/**
* Allows you to add only some chunks (e.g. only the unit-test chunk)
*/
chunks?: string[];
/**
* Allows to control how chunks should be sorted before they are included to the html. Allowed values: `'none' | 'auto' | 'dependency' | {function}` - default: `'auto'`
*/
chunksSortMode?: "none" | "auto" | "dependency" | Function;
/**
* Allows you to skip some chunks (e.g. don't add the unit-test chunk)
*/
excludeChunks?: string[];
/**
* `true | false` If `true` render the link tags as self-closing, XHTML compliant. Default is `false`
*/
xhtml?: boolean;
}
interface HtmlWebpackPlugin {
new (): Plugin;
new (options: HtmlWebpackPluginConfiguration): Plugin;
}
const htmlWebpackPlugin: HtmlWebpackPlugin;
export = htmlWebpackPlugin;
}
@@ -3,7 +3,6 @@
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference path="../express/express.d.ts"/>
///<reference path="../i18next/i18next-2.0.17.d.ts"/>
declare namespace I18next {
@@ -81,8 +80,6 @@ declare namespace i18nextBrowserLanguageDetector {
}
declare module "i18next-browser-languagedetector" {
import * as express from "express";
import * as i18next from "i18next";
export default i18nextBrowserLanguageDetector.LngDetector;
}
+46 -35
View File
@@ -39,15 +39,15 @@ declare namespace I18next {
count?: number;
context?: any;
replace?: any;
lng?:string;
lngs?:string[];
fallbackLng?:string;
ns?:string|string[];
keySeparator?:string;
nsSeparator?:string;
returnObjects?:boolean;
joinArrays?:string;
postProcess?:string|any[];
lng?: string;
lngs?: string[];
fallbackLng?: string;
ns?: string | string[];
keySeparator?: string;
nsSeparator?: string;
returnObjects?: boolean;
joinArrays?: string;
postProcess?: string | any[];
interpolation?: InterpolationOptions;
}
@@ -56,10 +56,10 @@ declare namespace I18next {
resources?: ResourceStore;
lng?: string;
fallbackLng?: string;
ns?: string|string[];
ns?: string | string[];
defaultNS?: string;
fallbackNS?: string|string[];
whitelist?:string[];
fallbackNS?: string | string[];
whitelist?: string[];
lowerCaseLng?: boolean;
load?: string
preload?: string[];
@@ -69,61 +69,72 @@ declare namespace I18next {
contextSeparator?: string;
saveMissing?: boolean;
saveMissingTo?: string;
missingKeyHandler?: (lng:string, ns:string, key:string, fallbackValue:string) => void;
parseMissingKeyHandler?: (key:string) => void;
missingKeyHandler?: (lng: string, ns: string, key: string, fallbackValue: string) => void;
parseMissingKeyHandler?: (key: string) => void;
appendNamespaceToMissingKey?: boolean;
postProcess?: string|any[];
postProcess?: string | any[];
returnNull?: boolean;
returnEmptyString?: boolean;
returnObjects?: boolean;
returnedObjectHandler?: (key:string, value:string, options:any) => void;
returnedObjectHandler?: (key: string, value: string, options: any) => void;
joinArrays?: string;
overloadTranslationOptionHandler?: (args:any[]) => TranslationOptions;
overloadTranslationOptionHandler?: (args: any[]) => TranslationOptions;
interpolation?: InterpolationOptions;
detection?: any;
backend?: any;
cache?: any;
}
type TranslationFunction = (key:string, options?:TranslationOptions) => string;
type TranslationFunction = (key: string, options?: TranslationOptions) => string;
class I18n {
constructor(options?:Options, callback?:(err:any, t:TranslationFunction) => void);
constructor(options?: Options, callback?: (err: any, t: TranslationFunction) => void);
init(options?:Options, callback?:(err:any, t:TranslationFunction) => void):I18n;
init(options?: Options, callback?: (err: any, t: TranslationFunction) => void): I18n;
loadResources(callback?:(err:any) => void):void;
loadResources(callback?: (err: any) => void): void;
language:string;
language: string;
languages:string[];
languages: string[];
use(module:any):I18n;
use(module: any): I18n;
changeLanguage(lng:string, callback?:(err:any, t:TranslationFunction) => void):void;
changeLanguage(lng: string, callback?: (err: any, t: TranslationFunction) => void): void;
getFixedT(lng?:string, ns?:string|string[]):TranslationFunction;
getFixedT(lng?: string, ns?: string | string[]): TranslationFunction;
t(key:string, options?:TranslationOptions):string|any|Array<any>;
t(key: string, options?: TranslationOptions): string | any | Array<any>;
exists():boolean;
exists(): boolean;
setDefaultNamespace(ns:string):void;
setDefaultNamespace(ns: string): void;
loadNamespaces(ns:string[], callback?:() => void):void;
loadNamespaces(ns: string[], callback?: () => void): void;
loadLanguages(lngs:string[], callback?:()=>void):void;
loadLanguages(lngs: string[], callback?: () => void): void;
dir(lng?:string):string;
dir(lng?: string): string;
createInstance(options?:Options, callback?:(err:any, t:TranslationFunction) => void):I18n;
createInstance(options?: Options, callback?: (err: any, t: TranslationFunction) => void): I18n;
cloneInstance(options?:Options, callback?:(err:any, t:TranslationFunction) => void):I18n;
cloneInstance(options?: Options, callback?: (err: any, t: TranslationFunction) => void): I18n;
on(event: string, listener: () => void): void;
on(initialized: 'initialized', listener: (options: I18next.Options) => void): void;
on(loaded: 'loaded', listener: (loaded: any) => void): void;
on(failedLoading: 'failedLoading', listener: (lng: string, ns: string, msg: string) => void): void;
on(missingKey: 'missingKey', listener: (lngs: any, namespace: string, key: string, res: any) => void): void;
on(added: 'added', listener: (lng: string, ns: string) => void): void;
on(removed: 'removed', listener: (lng: string, ns: string) => void): void;
on(languageChanged: 'languageChanged', listener: (lng: string) => void): void;
off(event: string, listener: () => void): void;
}
}
declare module 'i18next' {
var i18n:I18next.I18n;
var i18n: I18next.I18n;
export = i18n;
}
+3
View File
@@ -73,6 +73,9 @@ declare class MockAjax {
stubRequest(url: RegExp, data?: string, method?: string): JasmineAjaxRequestStub;
stubRequest(url: string, data?: string, method?: string): JasmineAjaxRequestStub;
stubRequest(url: RegExp, data?: RegExp, method?: string): JasmineAjaxRequestStub;
stubRequest(url: string, data?: RegExp, method?: string): JasmineAjaxRequestStub;
requests: JasmineAjaxRequestTracker;
stubs: JasmineAjaxStubTracker;
+22 -2
View File
@@ -2,5 +2,25 @@
// Definitions by: Lokesh Peta <https://github.com/lokeshpeta/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference path="../jquery/jquery.d.ts" />
/// <reference path="jqgrid.d.ts" />
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="jqgrid.d.ts" />
var mydata: any[] = [];
$('#jqGrid')
.jqGrid({
datatype: 'local',
data: mydata,
loadonce: true,
gridview: true,
height: 400,
shrinkToFit: true,
width: null,
colModel: [
{ label: 'Name', name: 'id', width: 75, key: true, align: 'left' },
{ label: 'Description', name: 'description', width: 100 }
],
viewrecords: true, // show the current page, data rang and total records on the toolbar
caption: 'Matches',
onSelectRow(id: any, status: any, e: Event) { }
});
+375 -23
View File
@@ -4,44 +4,337 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference path="../jquery/jquery.d.ts" />
// http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options
interface JQueryJqGridColumn {
name: string;
index: string;
/**
* Defines the alignment of the cell in the Body layer, not in header cell. Possible values: left, center, right
*/
align?: "left" | "center" | "right";
/**
* This function add attributes to the cell during the creation of the data - i.e dynamically.
* By example all valid attributes for the table cell can be used or a style attribute with different properties.
* @param rowId the id of the row
* @param val the value which will be added in the cell
* @param rowObject the raw object of the data row - i.e if datatype is json - array, if datatype is xml xml node.
* @param cm all the properties of this column listed in the colModel
* @param rdata the data row which will be inserted in the row. This parameter is array of type name:value, where name is the name in colModel
* @returns {}
*/
cellattr?: (rowId: any, val: any, rowObject: any, cm: any, rdata: any) => string;
/**
* This option allow to add classes to the column. If more than one class will be used a space should be set.
* By example classes:'class1 class2' will set a class1 and class2 to every cell on that column.
* In the grid css there is a predefined class ui-ellipsis which allow to attach ellipsis to a particular row.
* Also this will work in FireFox too.
*/
classes?: string;
/**
* Governs format of sorttype:date (when datetype is set to local) and editrules {date:true} fields.
* Determines the expected date format for that column. Uses a PHP-like date formatting. Currently "/", "-", and "." are supported as date separators. Valid formats are:
* y,Y,yyyy for four digits year
* YY, yy for two digits year
* m,mm for months
* d,dd for days.
*/
datefmt?: string;
/**
* Defines if the field is editable. This option is used in cell, inline and form modules.
*/
editable?: boolean;
/**
* The predefined types (string) or custom function name that controls the format of this field
* @param cellvalue is the value to be formatted
* @param options is an object containing the following element: rowId - is the id of the row colModel is the object of the properties for this column getted from colModel array of jqGrid
* @param rowObject is a row data represented in the format determined from datatype option. If we have datatype: xml/xmlstring - the rowObject is xml node,provided according to the rules from xmlReader If we have datatype: json/jsonstring - the rowObject is array, provided according to the rules from jsonReader
* @returns {} the formatted value
*/
formatter?: "integer" | "number" | "currency" | "date" | "email" | "link" | "showlink" | "checkbox" | "select" | "actions" | ((cellvalue: any, options: { rowId: any, colModel: any }, rowObject: any) => any);
/**
* Defines if this column is hidden at initialization.
*/
hidden?: boolean;
sortable?: boolean;
/**
* Set the index name when sorting. Passed as sidx parameter.
*/
index?: string;
/**
* Overwrite the id (defined in readers) from server. Can be set as id for the unique row id. Only one column can have this property.
* This option have higher priority as those from the readers.
* If there are more than one key set the grid finds the first one and the second is ignored.
*/
key?: boolean;
/**
* When colNames array is empty, defines the heading for this column.
* If both the colNames array and this setting are empty, the heading for this column comes from the name property.
*/
label?: string;
/**
* Set the unique name in the grid for the column.
* This property is required.
* As well as other words used as property/event names, the reserved words (which cannot be used for names) include subgrid, cb and rn.
*/
name: string;
/**
* When used in search modules, disables or enables searching on that column
*/
search?: boolean;
/**
* Defines is this can be sorted
*/
sortable?: boolean;
/**
* Set the initial width of the column, in pixels. This value currently can not be set as percentage
*/
width?: number;
formatter?: (cellvalue: any, options: any, rowObject: any) => any;
}
interface IJqGridJsonReader {
/**
* tells jqGrid that the information for the data in the row is repeatable - i.e. the elements have the same tag cell described in cell element. Setting this option to false instructs jqGrid to search elements in the json data by name.
* This is the name from colModel or the name described with the jsonmap option in colModel
*/
repeatitems: boolean;
root(obj: any): any;
page(obj: any): any;
total(obj: any): number;
records(obj: {data: any[]}): number;
/**
* Name of the root property
* @param obj
* @returns {}
*/
root: string | ((obj: any) => any);
/**
* current page of the query
* @param obj
* @returns {}
*/
page: string | ((obj: any) => number);
/**
* total pages for the query
* @param obj
* @returns {}
*/
total: string | ((obj: any) => number);
/**
* total number of records for the query
* @param obj
* @returns {}
*/
records: string | ((obj: {data: any[]}) => number);
}
interface JQueryJqGridOptions {
datatype?: string;
mtype?: string;
/**
* When set to true encodes (html encode) the incoming (from server) and posted data (from editing modules).
*/
autoencode?: boolean;
pager?: string;
rowNum?: number;
rowList?: number[];
colNames?: string[];
/**
* When set to true, the grid width is recalculated automatically to the width of the parent element.
* This is done only initially when the grid is created.
* In order to resize the grid when the parent element changes width you should apply custom code and use the setGridWidth method for this purpose
*/
autoWidth?: boolean;
/**
* Defines the caption for the grid. This caption appears in the caption layer, which is above the header layer
*/
caption?: string;
/**
* Array which describes the parameters of the columns. This is the most important part of the grid.
*/
colModel?: JQueryJqGridColumn[];
sortname?: string;
sortorder?: string;
multiselect?: boolean;
multiboxonly?: boolean;
/**
* An array in which we place the names of the columns.
* This is the text that appears in the head of the grid (header layer). The names are separated with commas.
* Note that the number of elements in this array should be equal of the number elements in the colModel array.
*/
colNames?: string[];
/**
* An array that stores the local data passed to the grid. You can directly point to this variable in case you want to load an array data.
* It can replace the addRowData method which is slow on relative big data
*/
data?: any[];
/**
* Defines in what format to expect the data that fills the grid.
* Valid options are xml (we expect data in xml format), xmlstring (we expect xml data as string), json (we expect data in JSON format),
* jsonstring (we expect JSON data as a string), local (we expect data defined at client side (array data)),
* javascript (we expect javascript as data), function (custom defined function for retrieving data),
* or clientSide to manually load data via the data array
*/
datatype?: "xml" | "xmlstring" | "json" | "jsonstring" | "local" | "javascript" | Function | "clientSide";
/**
* If set to true, and a column's width is changed, the adjacent column (to the right) will resize so that the overall grid width is maintained
* (e.g., reducing the width of column 2 by 30px will increase the size of column 3 by 30px). In this case there is no horizontal scrollbar.
* Note: This option is not compatible with shrinkToFit option - i.e if shrinkToFit is set to false, forceFit is ignored.
*/
forceFit?: boolean;
height?: number;
width?: number;
shrinkToFit?: boolean;
url?: string;
/**
* What will be the result if we insert all the data at once?
* Yes, this can be done with a help of gridview option (set it to true).
* The result is a grid that is 5 to 10 times faster. Of course, when this option is set to true we have some limitations.
* If set to true we can not use treeGrid, subGrid, or the afterInsertRow event.
* If you do not use these three options in the grid you can set this option to true and enjoy the speed.
*/
gridview?: boolean;
/**
* The height of the grid.
* Can be set as number (in this case we mean pixels) or as percentage (only 100% is accepted) or value of auto is acceptable.
*/
height?: number | string | "auto";
/**
* If this flag is set to true, the grid loads the data from the server only once (using the appropriate datatype).
* After the first request, the datatype parameter is automatically changed to local and all further manipulations are done on the client side.
* The functions of the pager (if present) are disabled.
*/
loadonce?: boolean;
/**
* An array which describes the structure of the expected json data.
*/
jsonReader?: IJqGridJsonReader;
gridComplete?:()=>void;
/**
* Defines the type of request to make ("POST" or "GET")
*/
mtype?: "GET" | "POST";
/**
* This option works only when the multiselect option is set to true.
* When multiselect is set to true, clicking anywhere on a row selects that row;
* when multiboxonly is also set to true, the multiselection is done only when the checkbox is clicked (Yahoo style).
* Clicking in any other row (suppose the checkbox is not clicked) deselects all rows and selects the current row.
*/
multiboxonly?: boolean;
/**
* If this flag is set to true a multi selection of rows is enabled. A new column at left side containing checkboxes is added.
* Can be used with any datatype option
*/
multiselect?: boolean;
/**
* Defines that we want to use a pager bar to navigate through the records.
* This must be a valid HTML element; in our example we gave the div the id of "pager", but any name is acceptable.
* Note that the navigation layer (the "pager" div) can be positioned anywhere you want, determined by your HTML;
* in our example we specified that the pager will appear after the body layer.
* The valid settings can be (in the context of our example) pager, #pager, jQuery('#pager').
* I recommend to use the second one - #pager
*/
pager?: string;
/**
* An array to construct a select box element in the pager in which we can change the number of the visible rows.
* When changed during the execution, this parameter replaces the rowNum parameter that is passed to the url.
* If the array is empty, this element does not appear in the pager. Typically you can set this like [10,20,30].
* If the rowNum parameter is set to 30 then the selected value in the select box is 30
*/
rowList?: number[];
/**
* Sets how many records we want to view in the grid. This parameter is passed to the url for use by the server routine retrieving the data.
* Note that if you set this parameter to 10 (i.e. retrieve 10 records) and your server return 15 then only 10 records will be loaded
*/
rowNum?: number;
/**
* This option, if set, defines how the the width of the columns of the grid should be re-calculated, taking into consideration the width of the grid.
* If this value is true, and the width of the columns is also set, then every column is scaled in proportion to its width.
* For example, if we define two columns with widths 80 and 120 pixels, but want the grid to have a width of 300 pixels,
* then the columns will stretch to fit the entire grid, and the extra width assigned to them will depend on the width of the columns themselves and the extra width available.
* The re-calculation is done as follows: the first column gets the width (300(new width)/200(sum of all widths))*80(first column width) = 120 pixels,
* and the second column gets the width (300(new width)/200(sum of all widths))*120(second column width) = 180 pixels.
* Now the widths of the columns sum up to 300 pixels, which is the width of the grid.
* If the value is false and the value in width option is set, then no re-sizing happens whatsoever.
* So in this example, if shrinkToFit is set to false, column one will have a width of 80 pixels,
* column two will have a width of 120 pixels and the grid will retain the width of 300 pixels.
* If the value of shrinkToFit is an integer, the width is calculated according to it.
*/
shrinkToFit?: boolean | number;
/**
* The column according to which the data is to be sorted when it is initially loaded from the server
* (note that you will have to use datatypes xml or json to load remote data). This parameter is appended to the url.
* If this value is set and the index (name) matches the name from colModel,
* then an icon indicating that the grid is sorted according to this column is added to the column header.
* This icon also indicates the sorting order - descending or ascending (see the parameter sortorder). Also see prmNames
*/
sortname?: string;
/**
* The initial sorting order (ascending or descending) when we fetch data from the server using datatypes xml or json.
* This parameter is appended to the url - see prnNames. The two allowed values are - asc or desc.
*/
sortorder?: "asc" | "desc";
/**
* The url of the file that returns the data needed to populate the grid. May be set to clientArray to manualy post data to server
*/
url?: string | "clientArray";
/**
* If true, jqGrid displays the beginning and ending record number in the grid, out of the total number of records in the query.
* This information is shown in the pager bar (bottom right by default)in this format: "View X to Y out of Z".
* If this value is true, there are other parameters that can be adjusted, including emptyrecords and recordtext.
*/
viewrecords?: boolean;
/**
* If this option is not set, the width of the grid is the sum of the widths of the columns defined in the colModel (in pixels).
* If this option is set, the initial width of each column is set according to the value of the shrinkToFit option.
*/
width?: number;
// events
/**
* This fires after all the data is loaded into the grid and all other processes are complete.
* Also the event fires independent from the datatype parameter and after sorting paging and etc.
* @returns {}
*/
gridComplete?: () => void;
/**
* Raised immediately after row was right clicked
* @param rowid is the id of the row
* @param iRow is the index of the row (do not mix this with the rowid)
* @param iCol is the index of the cell
* @param e is the event object
* @returns {}
*/
onRightClickRow?: (rowid: any, iRow: number, iCol: number, e: Event) => void;
/**
* Raised immediately after row was clicked.
* @param id is the id of the row
* @param status is the status of the selection
* @param e is the event object. Can be used when multiselect is set to true. true if the row is selected, false if the row is deselected.
* @returns {}
*/
onSelectRow?: (id: string, status: any, e: Event) => void;
}
interface JQueryJqGridStatic {
@@ -60,5 +353,64 @@ interface JQueryStatic {
interface JQuery {
jqGrid?: JQueryJqGridStatic;
/**
* Populates a grid with the passed data (an array)
* @param data
* @returns {}
*/
addJSONData(data: any[]): void;
/**
* Edits the row specified by rowid.
* keys is a boolean value, indicating if to use the Enter key to accept the value ane Esc to cancel the edit, or not.
* @param rowid the id of the row to edit
* @param keys when set to true we can use [Enter] key to save the row and [Esc] to cancel editing
* @returns {}
*/
editRow(rowid: any, keys?: boolean): void;
/**
* Returns the value of the requested parameter. name is the name from the options array. If the name is not set, the entry options are returned.
* @param name
* @returns {}
*/
getGridParam(name: string): any;
/**
* This method restores the data to original values before the editing of the row
* @param rowId the row to restore
* @param afterRestoreFunc if defined this function is called in after the row is restored.
* @returns {}
*/
restoreRow(rowId: any, afterRestoreFunc?: (response: any) => void): void;
/**
* Saves the edited row.
* @param rowid the id of the row to save
* @param successfunc
* @param url if defined, this parameter replaces the editurl parameter from the options array. If set to 'clientArray', the data is not posted to the server but rather is saved only to the grid (presumably for later manual saving).
* @param extraparam an array of type name: value. When set these values are posted along with the other values to the server.
* @returns {}
*/
saveRow(rowid: string, successfunc?: (response: any) => boolean, url?: string, extraparam?: any): void;
/**
* Saves the edited row.
* @param rowid the id of the row to save
* @param successfunc
* @param url
* @param extraparam
* @returns {}
*/
saveRow(rowid: string, successfunc?: boolean, url?: string, extraparam?: any): void;
/**
* Sets a particular parameter.
* Note - for some parameters to take effect a trigger("reloadGrid") should be executed.
* Note that with this method we can override events.
* The name (in the name:value pair) is the name from options array
* @param obj
* @returns {}
*/
setGridParam(obj: any): void;
}
+1 -1
View File
@@ -252,7 +252,7 @@ interface ColorboxStatic {
/**
* This method allows you to call Colorbox without having to assign it to an element.
*/
(settings: ColorboxSettings);
(settings: ColorboxSettings): any;
/**
* This method moves to the next item in a group and are the same as pressing the 'next' or 'previous' buttons.
*/
+12
View File
@@ -0,0 +1,12 @@
/// <reference path="js-base64.d.ts" />
import { Base64 } from 'js-base64'
Base64.encode('dankogai'); // ZGFua29nYWk=
Base64.encode('小飼弾'); // 5bCP6aO85by+
Base64.encodeURI('小飼弾'); // 5bCP6aO85by-
Base64.decode('ZGFua29nYWk='); // dankogai
Base64.decode('5bCP6aO85by+'); // 小飼弾
// note .decodeURI() is unnecessary since it accepts both flavors
Base64.decode('5bCP6aO85by-'); // 小飼弾
+52
View File
@@ -0,0 +1,52 @@
// Type definitions for js-base64 v2.1.9
// Project: https://github.com/dankogai/js-base64
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
## TODO
add methods:
- [x] encode
- [x] encodeURI
- [x] decode
- [ ] atob
- [ ] btoa
- [ ] fromBase64
- [ ] toBase64
- [ ] utob
- [ ] btou
- [ ] noConflict
*/
interface Base64 {
/**
* .encode
* @param {String} string
* @return {String}
*/
encode(base64: string): string;
/**
* .encodeURI
* @param {String} string
* @return {String}
*/
encodeURI(base64: string): string
/**
* .decode
* @param {String} string
* @return {String}
*/
decode(base64: string): string
/**
* Library version
*/
VERSION:string
}
declare module 'js-base64' {
const Base64: Base64
}
+225
View File
@@ -0,0 +1,225 @@
/// <reference path="./json-merge-patch.d.ts" />
import * as jmp from "json-merge-patch";
var merge = jmp.merge;
var apply = jmp.apply;
var generate = jmp.generate;
var assert = {deepEqual: function (a: Object, b: Object) {
return JSON.stringify(a) === JSON.stringify(b);
}};
assert.deepEqual(
merge({a: 'b'}, {b: 'c'}),
{a: 'b', b: 'c'}
);
assert.deepEqual(
merge({a: 'b'}, {a: 'c'}),
{a: 'c'}
);
assert.deepEqual(
merge({a: 'b', b: 'd'}, {a: 'c'}),
{a: 'c', b: 'd'}
);
assert.deepEqual(
merge({a: null}, {b: 'c'}),
{a: null, b: 'c'}
);
assert.deepEqual(
merge({a: null}, {a: 'b'}),
{a: 'b'}
);
assert.deepEqual(
merge({a: 'b'}, {a: null}),
{a: null}
);
assert.deepEqual(
merge([], {a: 'b'}),
{a: 'b'}
);
assert.deepEqual(
merge({a: 'b'}, []),
[]
);
assert.deepEqual(
merge({a: {b: {c: 'd'}}, d: 'e'}, {a: {b: 'a'}}),
{a: {b: 'a'}, d: 'e'}
);
assert.deepEqual(
merge({a: {b: {c: 'd'}, d: 'e'}}, {a: {b: {c: 'e'}}}),
{a: {b: {c: 'e'}, d: 'e'}}
);
assert.deepEqual(
merge({a: 'b'}, null),
null
);
assert.deepEqual(
generate({a: 'b'}, {a: 'c'}),
{a: 'c'}
);
assert.deepEqual(
generate({a: 'b'}, { a: 'b', b: 'c'}),
{b: 'c'}
);
assert.deepEqual(
generate({a: 'b'}, {}),
{a: null}
);
assert.deepEqual(
generate({a: 'b', b: 'c'}, {b: 'c'}),
{a: null}
);
assert.deepEqual(
generate({a: ['b']}, {a: 'c'}),
{a: 'c'}
);
assert.deepEqual(
generate({a: 'c'}, {a: ['b']}),
{a: ['b']}
);
assert.deepEqual(
generate({a: [{b: 'c'}]}, {a: [1]}),
{a: [1]}
);
assert.deepEqual(
generate(['a', 'b'], ['c', 'd']),
['c', 'd']
);
assert.deepEqual(
generate(['a', 'b'], ['a']),
['a']
);
assert.deepEqual(
generate({a: 'b'}, ['c']),
['c']
);
assert.deepEqual(
generate({a: 'foo'}, null),
null
);
assert.deepEqual(
generate({a: 'foo'}, 'bar'),
'bar'
);
assert.deepEqual(
generate({e: null}, {e: null, a: 1}),
{a: 1}
);
assert.deepEqual(
generate({}, {a: {bb: {}}}),
{a: {bb: {}}}
);
assert.deepEqual(
generate({a: 'a'}, {a: 'a'}),
undefined
);
assert.deepEqual(
generate({a: {b: 'c'}}, {a: {b: 'c'}}),
undefined
);
assert.deepEqual(
generate([1,2,3], [1,2,3]),
undefined
);
assert.deepEqual(
apply({a: 'b'}, {a: 'c'}),
{a: 'c'}
);
assert.deepEqual(
apply({a: 'b'}, {b: 'c'}),
{a: 'b', b: 'c'}
);
assert.deepEqual(
apply({a: 'b'}, {a: null}),
{}
);
assert.deepEqual(
apply({a: 'b', b: 'c'}, {a: null}),
{b: 'c'}
);
assert.deepEqual(
apply({a: ['b']}, {a: 'c'}),
{a: 'c'}
);
assert.deepEqual(
apply({a: 'c'}, {a: ['b']}),
{a: ['b']}
);
assert.deepEqual(
apply({a: {b: 'c'}}, {a: {b: 'd', c: null}}),
{a: {b: 'd'}}
);
assert.deepEqual(
apply({a: [{b: 'c'}]}, {a: [1]}),
{a: [1]}
);
assert.deepEqual(
apply(['a', 'b'], ['c', 'd']),
['c', 'd']
);
assert.deepEqual(
apply({a: 'b'}, ['c']),
['c']
);
assert.deepEqual(
apply({a: 'foo'}, null),
null
);
assert.deepEqual(
apply({a: 'foo'}, 'bar'),
'bar'
);
assert.deepEqual(
apply({e: null}, {a: 1}),
{e: null, a: 1}
);
assert.deepEqual(
apply([1, 2], {a: 'b', c: null}),
{a: 'b'}
);
assert.deepEqual(
apply({}, {a: {bb: {ccc: null}}}),
{a: {bb: {}}}
);
+11
View File
@@ -0,0 +1,11 @@
// Type definitions for json-merge-patch
// Project: https://github.com/pierreinglebert/json-merge-patch
// Definitions by: Arsenij Schuetzer <https://github.com/senyaarseniy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "json-merge-patch" {
function apply(target: Object, patch: Object): Object;
function generate(before: Object, after: Object): Object;
function merge(patch1: Object, patch2: Object): Object;
}
+13
View File
@@ -57,6 +57,19 @@ var knex = Knex({
}
});
// acquireConnectionTimeout
var knex = Knex({
debug: true,
client: 'mysql',
connection: {
socketPath : '/path/to/socket.sock',
user : 'your_database_user',
password : 'your_database_password',
database : 'myapp_test'
},
acquireConnectionTimeout: 60000,
});
// Pure Query Builder without a connection
var knex = Knex({});
+1
View File
@@ -453,6 +453,7 @@ declare module "knex" {
Sqlite3ConnectionConfig|SocketConnectionConfig;
pool?: PoolConfig;
migrations?: MigratorConfig;
acquireConnectionTimeout?: number;
}
interface ConnectionConfig {
+1 -1
View File
@@ -46,6 +46,6 @@ declare module "koa-static" {
*/
gzip?: boolean;
}): { (ctx: Koa.Context, next?: () => any): any };
namespace serve{}
export = serve;
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for Lo-Dash
// Type definitions for Lo-Dash 3.10
// Project: http://lodash.com/
// Definitions by: Brian Zengel <https://github.com/bczengel>, Ilya Mochalov <https://github.com/chrootsu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for Lo-Dash
// Type definitions for Lo-Dash 4.14
// Project: http://lodash.com/
// Definitions by: Brian Zengel <https://github.com/bczengel>, Ilya Mochalov <https://github.com/chrootsu>, Stepan Mikhaylyuk <https://github.com/stepancar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+95
View File
@@ -0,0 +1,95 @@
/// <reference path="mainloop.js.d.ts" />
// To see what this test does, create an HTML file with these contents and open it:
/*
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>MainLoop.js test</title>
<meta name="description" content="TypeScript typings test for MainLoop.js.">
<style>
html, body { height: 100%; margin: 0; overflow: hidden; position: relative; }
</style>
</head>
<body>
<script src="https://rawgit.com/IceCreamYou/MainLoop.js/gh-pages/build/mainloop.min.js"></script>
<script src="mainloop.js-tests.js"></script>
</body>
</html>
*/
window.addEventListener('load', () => {
let cx = window.innerWidth / 2 - 15,
cy = window.innerHeight / 2 - 15,
x = cx + 120,
y = cy,
lx = x,
ly = y,
theta = 0
const radius = 120,
velocity = 0.1 * Math.PI / 180;
const actor = document.createElement('div');
actor.style.width = '30px';
actor.style.height = '30px';
actor.style.backgroundColor = 'red';
actor.style.position = 'absolute';
actor.style.left = x + 'px';
actor.style.top = y + 'px';
document.body.appendChild(actor);
const fpsCounter = document.createElement('div');
fpsCounter.style.position = 'absolute';
fpsCounter.style.left = '10px';
fpsCounter.style.top = '10px';
document.body.appendChild(fpsCounter);
document.body.addEventListener('click', (event) => {
cx = event.pageX;
cy = event.pageY;
});
MainLoop
.setBegin((timestamp, delta) => {
lx = x;
ly = y;
x = cx + Math.cos(theta) * radius;
y = cy + Math.sin(theta) * radius;
})
.setDraw((interpolationPercentage) => {
actor.style.left = (lx + (x - lx) * interpolationPercentage) + 'px';
actor.style.top = (ly + (y - ly) * interpolationPercentage) + 'px';
})
.setUpdate((delta) => {
theta += velocity * delta;
})
.setEnd((fps, panic) => {
fpsCounter.textContent = Math.round(fps) + ' FPS';
if (panic) {
console.info(
`Main loop panicked; tried to simulate too much time. Discarding ${MainLoop.resetFrameDelta()}ms`
);
}
})
.start();
document.body.addEventListener('keyup', (event) => {
if ((event.which || event.keyCode) === 80) { // Hit P to toggle Pause
if (MainLoop.isRunning()) {
MainLoop.stop();
}
else {
MainLoop.start();
}
}
});
});
+28
View File
@@ -0,0 +1,28 @@
// Type definitions for MainLoop.js v1.0.3
// Project: https://github.com/IceCreamYou/MainLoop.js
// Definitions by: Isaac Sukin <http://isaacsukin.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Interface for the MainLoop.js global.
*
* See the API documentation for a detailed explanation of these methods:
* http://icecreamyou.github.com/MainLoop.js/docs/#!/api/MainLoop
*/
interface MainLoop {
getFPS(): number;
getMaxAllowedFPS(): number;
getSimulationTimestep(): number;
isRunning(): boolean;
resetFrameDelta(): number;
setBegin(begin: (timestamp: number, delta: number) => void): MainLoop;
setDraw(draw: (interpolationPercentage: number) => void): MainLoop;
setUpdate(update: (delta: number) => void): MainLoop;
setEnd(end: (fps: number, panic: boolean) => void): MainLoop;
setMaxAllowedFPS(fps?: number): MainLoop;
setSimulationTimestep(timestep: number): MainLoop;
start(): MainLoop;
stop(): MainLoop;
}
declare var MainLoop: MainLoop;
+50 -5
View File
@@ -12,16 +12,22 @@ function test() {
function testRoot() {
makerjs.cloneObject({});
makerjs.createRouteKey([]);
makerjs.extendObject({abc:123}, {xyz:789});
makerjs.isFunction(function(){});
makerjs.isNumber(0);
makerjs.isObject({});
makerjs.isModel({});
makerjs.isPath({});
makerjs.isPathArc(paths.arc);
makerjs.isPathArcInBezierCurve({});
makerjs.isPathCircle(paths.circle);
makerjs.isPathLine(paths.line);
makerjs.isPoint([]);
makerjs.pathType.Circle;
makerjs.round(44.44444, .01);
makerjs.unitType.Millimeter;
new makerjs.Collector();
}
function testAngle() {
@@ -41,6 +47,7 @@ function test() {
new makerjs.exporter.Exporter({});
makerjs.exporter.toDXF(model);
makerjs.exporter.toOpenJsCad(model);
makerjs.exporter.toPDF({} as PDFKit.PDFDocument, model);
makerjs.exporter.toSTL(model);
makerjs.exporter.toSVG(model,
{
@@ -58,6 +65,11 @@ function test() {
makerjs.exporter.tryGetModelUnits(model);
}
function testImporter() {
makerjs.importer.fromSVGPathData('');
makerjs.importer.parseNumericList('');
}
function testKit() {
makerjs.kit.construct(null, null);
makerjs.kit.getParameterValues(null);
@@ -67,26 +79,42 @@ function test() {
}
function testMeasure() {
makerjs.measure.increase(mp, mm);
makerjs.measure.isPointEqual(p1, p2);
makerjs.measure.isPathEqual(paths.line, paths.circle, 4);
makerjs.measure.isAngleEqual(12, 13);
makerjs.measure.isArcConcaveTowardsPoint(paths.arc, [0,0]);
makerjs.measure.isArcOverlapping(paths.arc, paths.arc, true);
makerjs.measure.isBetween(7, 8, 9, false);
makerjs.measure.isBetweenArcAngles(7, paths.arc, false);
makerjs.measure.isBetweenPoints([1,1], paths.line, true);
makerjs.measure.modelExtents(model).high[0];
makerjs.measure.pathExtents(paths.circle).low[0];
makerjs.measure.isBezierSeedLinear({type: '', origin:[], end:[], controls:[]});
makerjs.measure.isLineOverlapping(paths.line, paths.line, false);
makerjs.measure.isMeasurementOverlapping(mm, mp);
var mm = makerjs.measure.modelExtents(model);
var mp = makerjs.measure.pathExtents(paths.circle);
makerjs.measure.pathLength(paths.line);
makerjs.measure.pointDistance([0,0], [9,9]);
new makerjs.measure.Atlas(model);
mm.low[0];
mp.high[1];
var s = makerjs.measure.lineSlope(paths.line);
makerjs.measure.isPointOnSlope([], s);
makerjs.measure.isSlopeEqual(s, s);
}
function testModel(){
makerjs.model.breakPathsAtIntersections(model, { paths:{ } });
var opts: MakerJs.ICombineOptions = { trimDeadEnds: true, pointMatchingDistance: 2 };
makerjs.model.combine(model, model, true, false, true, false, opts);
makerjs.model.combineIntersection(model, model);
makerjs.model.combineSubtraction(model, model);
makerjs.model.combineUnion(model, model);
makerjs.model.convertUnits(model, makerjs.unitType.Centimeter);
makerjs.model.countChildModels(model);
makerjs.model.detachLoop(model);
makerjs.model.expandPaths(model, 7);
makerjs.model.findChains(model, function (chains: MakerJs.IChain[], loose: MakerJs.IWalkPath[], layer: string) {})
makerjs.model.findLoops(model);
makerjs.model.getSimilarModelId(model, 'foo');
makerjs.model.getSimilarPathId(model, 'foo');
@@ -95,18 +123,26 @@ function test() {
makerjs.model.move(makerjs.model.originate(model, [9,9]), [0,0]);
makerjs.model.moveRelative(model, [1,1]);
makerjs.model.originate(model);
makerjs.model.outline(model, 5);
makerjs.model.prefixPathIds(model, 'a');
makerjs.model.removeDeadEnds(model);
makerjs.model.rotate(makerjs.model.scale(model, 6), 45, [0,0]);
makerjs.model.scale(model, 7);
makerjs.model.simplify(model);
makerjs.model.walk(model, {});
makerjs.model.walkPaths(model, (modelContext: MakerJs.IModel, pathId: string, pathContext: MakerJs.IPath) => {});
model.exporterOptions = { foo: 'bar' };
}
function testModels(): MakerJs.IModel[] {
return [
new makerjs.models.BezierCurve([]),
new makerjs.models.BoltCircle(7, 7, 7, 7),
new makerjs.models.BoltRectangle(2, 2, 2),
new makerjs.models.ConnectTheDots(true, [ [0,0], [1,1] ]),
new makerjs.models.Dome(5, 7),
new makerjs.models.Ellipse(2,2),
new makerjs.models.EllipticArc(2,2,3,4),
new makerjs.models.Oval(7, 7),
new makerjs.models.OvalArc(6, 4, 2, 12, true),
new makerjs.models.Polygon(7, 5),
@@ -116,20 +152,27 @@ function test() {
new makerjs.models.SCurve(5, .9),
new makerjs.models.Slot([0, 0], [1, 1], 7),
new makerjs.models.Square(8),
new makerjs.models.Star(5, 10, 5)
new makerjs.models.Star(5, 10, 5),
new makerjs.models.Text({} as opentypejs.Font, 'z', 12)
];
}
function testPath() {
makerjs.path.breakAtPoint(paths.arc, [0,0]).type;
makerjs.path.clone(paths.line);
makerjs.path.converge(paths.line, paths.line);
makerjs.path.distort(paths.arc, 5, 6);
makerjs.path.dogbone(paths.line, paths.line, 7);
makerjs.path.expand(paths.line, 5);
makerjs.path.fillet(paths.arc, paths.line, 4);
makerjs.path.intersection(paths.circle, paths.arc, { excludeTangents: true }).intersectionPoints;
makerjs.path.mirror(paths.arc, true, true);
makerjs.path.move(paths.line, [1,1]);
makerjs.path.moveRelative(paths.circle, [0,0]);
makerjs.path.moveTemporary([], [], function(){});
makerjs.path.rotate(paths.line, 5, [0,0]);
makerjs.path.scale(paths.arc, 8);
makerjs.path.straighten(paths.arc);
}
function testPaths() {
@@ -141,7 +184,7 @@ function test() {
new makerjs.paths.Chord(paths.arc);
new makerjs.paths.Parallel(paths.line, 4, [1,1]);
//paths.line.layer = "0";
var x: MakerJs.IPathLine = {
@@ -154,15 +197,17 @@ function test() {
return paths;
}
function testPoint() {
function testPoint() {
makerjs.point.add(p1, p2);
makerjs.point.average(p1, p2);
makerjs.point.clone(p1);
makerjs.point.closest([0,0], [p1, p2]);
makerjs.point.distort([1,1], 2, 3);
makerjs.point.fromAngleOnCircle(22, paths.circle);
makerjs.point.fromArc(paths.arc);
makerjs.point.fromPathEnds(paths.line);
makerjs.point.fromPolar(Math.PI, 7);
makerjs.point.fromSlopeIntersection(new makerjs.paths.Line([]), new makerjs.paths.Line([]));
makerjs.point.middle(paths.line);
makerjs.point.mirror(p1, true, false);
makerjs.point.rotate(p1, 5, p2);
+349 -10
View File
@@ -2,6 +2,8 @@
// Project: https://github.com/Microsoft/maker.js
// Definitions by: Dan Marshall <https://github.com/danmarshall>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../bezier-js/bezier-js.d.ts" />
/// <reference path="../opentype/opentype.d.ts" />
/// <reference path="../pdfkit/pdfkit.d.ts" />
/**
* Root module for Maker.js.
@@ -65,6 +67,27 @@ declare namespace MakerJs {
* @returns The original object after merging.
*/
function extendObject(target: Object, other: Object): Object;
/**
* Test to see if a variable is a function.
*
* @param value The object to test.
* @returns True if the object is a function type.
*/
function isFunction(value: any): boolean;
/**
* Test to see if a variable is a number.
*
* @param value The object to test.
* @returns True if the object is a number type.
*/
function isNumber(value: any): boolean;
/**
* Test to see if a variable is an object.
*
* @param value The object to test.
* @returns True if the object is an object type.
*/
function isObject(value: any): boolean;
/**
* An x-y point in a two-dimensional space.
* Implemented as an array with 2 elements. The first element is x, the second element is y.
@@ -193,6 +216,44 @@ declare namespace MakerJs {
* @param item The item to test.
*/
function isPathArc(item: any): boolean;
/**
* A bezier seed defines the endpoints and control points of a bezier curve.
*/
interface IPathBezierSeed extends IPathLine {
/**
* The bezier control points. One point for quadratic, 2 points for cubic.
*/
controls: IPoint[];
/**
* T values of the parent if this is a child that represents a split.
*/
parentRange?: IBezierRange;
}
/**
* Bezier t values for an arc path segment in a bezier curve.
*/
interface IBezierRange {
/**
* The bezier t-value at the starting point.
*/
startT: number;
/**
* The bezier t-value at the end point.
*/
endT: number;
}
/**
* An arc path segment in a bezier curve.
*/
interface IPathArcInBezierCurve extends IPathArc {
bezierData: IBezierRange;
}
/**
* Test to see if an object implements the required properties of an arc in a bezier curve.
*
* @param item The item to test.
*/
function isPathArcInBezierCurve(item: any): boolean;
/**
* A map of functions which accept a path as a parameter.
*/
@@ -224,6 +285,7 @@ declare namespace MakerJs {
Line: string;
Circle: string;
Arc: string;
BezierSeed: string;
};
/**
* Slope and y-intercept of a line.
@@ -457,6 +519,12 @@ declare namespace MakerJs {
interface IWalkPathCallback {
(context: IWalkPath): void;
}
/**
* Callback for returning a boolean from an IWalkPath.
*/
interface IWalkPathBooleanCallback {
(context: IWalkPath): boolean;
}
/**
* A link in a chain, with direction of flow.
*/
@@ -501,6 +569,10 @@ declare namespace MakerJs {
* Flag to separate chains by layers.
*/
byLayers?: boolean;
/**
* Flag to not recurse models, look only within current model's immediate paths.
*/
shallow?: boolean;
}
/**
* Reference to a model within a model.
@@ -774,6 +846,15 @@ declare namespace MakerJs.point {
* @returns A new point.
*/
function scale(pointToScale: IPoint, scaleValue: number): IPoint;
/**
* Distort a point's coordinates.
*
* @param pointToDistort The point to distort.
* @param scaleX The amount of x scaling.
* @param scaleY The amount of y scaling.
* @returns A new point.
*/
function distort(pointToDistort: IPoint, scaleX: number, scaleY: number): IPoint;
/**
* Subtract a point from another point, and return the result as a new point. Shortcut to Add(a, b, subtract = true).
*
@@ -804,10 +885,9 @@ declare namespace MakerJs.path {
* @param pathToMirror The path to mirror.
* @param mirrorX Boolean to mirror on the x axis.
* @param mirrorY Boolean to mirror on the y axis.
* @param newId Optional id to assign to the new path.
* @returns Mirrored path.
*/
function mirror(pathToMirror: IPath, mirrorX: boolean, mirrorY: boolean, newId?: string): IPath;
function mirror(pathToMirror: IPath, mirrorX: boolean, mirrorY: boolean): IPath;
/**
* Move a path to an absolute point.
*
@@ -850,6 +930,24 @@ declare namespace MakerJs.path {
* @returns The original path (for chaining).
*/
function scale(pathToScale: IPath, scaleValue: number): IPath;
/**
* Distort a path - scale x and y individually.
*
* @param pathToDistort The path to distort.
* @param scaleX The amount of x scaling.
* @param scaleY The amount of y scaling.
* @returns A new IModel (for circles and arcs) or IPath (for lines and bezier seeds).
*/
function distort(pathToDistort: IPath, scaleX: number, scaleY: number): IModel | IPath;
/**
* Connect 2 lines at their slope intersection point.
*
* @param lineA First line to converge.
* @param lineB Second line to converge.
* @param useOriginA Optional flag to converge the origin point of lineA instead of the end point.
* @param useOriginB Optional flag to converge the origin point of lineB instead of the end point.
*/
function converge(lineA: IPathLine, lineB: IPathLine, useOriginA?: boolean, useOriginB?: boolean): IPoint;
}
declare namespace MakerJs.path {
/**
@@ -916,9 +1014,25 @@ declare namespace MakerJs.paths {
type: string;
origin: IPoint;
radius: number;
/**
* Class for circle path, created from radius. Origin will be [0, 0].
*
* Example:
* ```
* var c = new makerjs.paths.Circle(7);
* ```
*
* @param radius The radius of the circle.
*/
constructor(radius: number);
/**
* Class for circle path, created from origin point and radius.
*
* Example:
* ```
* var c = new makerjs.paths.Circle([10, 10], 7);
* ```
*
* @param origin The center point of the circle.
* @param radius The radius of the circle.
*/
@@ -926,6 +1040,11 @@ declare namespace MakerJs.paths {
/**
* Class for circle path, created from 2 points.
*
* Example:
* ```
* var c = new makerjs.paths.Circle([5, 15], [25, 15]);
* ```
*
* @param pointA First point on the circle.
* @param pointB Second point on the circle.
*/
@@ -933,6 +1052,11 @@ declare namespace MakerJs.paths {
/**
* Class for circle path, created from 3 points.
*
* Example:
* ```
* var c = new makerjs.paths.Circle([0, 0], [0, 10], [20, 0]);
* ```
*
* @param pointA First point on the circle.
* @param pointB Second point on the circle.
* @param pointC Third point on the circle.
@@ -941,14 +1065,23 @@ declare namespace MakerJs.paths {
}
/**
* Class for line path.
*
* @param origin The origin point of the line.
* @param end The end point of the line.
*/
class Line implements IPathLine {
type: string;
origin: IPoint;
end: IPoint;
type: string;
/**
* Class for line path, constructed from array of 2 points.
*
* @param points Array of 2 points.
*/
constructor(points: IPoint[]);
/**
* Class for line path, constructed from 2 points.
*
* @param origin The origin point of the line.
* @param end The end point of the line.
*/
constructor(origin: IPoint, end: IPoint);
}
/**
@@ -1247,6 +1380,14 @@ declare namespace MakerJs.measure {
* @returns true if points are the same, false if they are not
*/
function isPointEqual(a: IPoint, b: IPoint, withinDistance?: number): boolean;
/**
* Find out if point is on a slope.
*
* @param p Point to check.
* @param b Slope.
* @returns true if point is on the slope
*/
function isPointOnSlope(p: IPoint, slope: ISlope, withinDistance?: number): boolean;
/**
* Check for slope equality.
*
@@ -1311,6 +1452,13 @@ declare namespace MakerJs.measure {
* @returns Boolean true if point is between (or equal to) the line's origin and end points.
*/
function isBetweenPoints(pointInQuestion: IPoint, line: IPathLine, exclusive: boolean): boolean;
/**
* Check if a given bezier seed is simply a line.
*
* @param seed The bezier seed to test.
* @returns Boolean true if bezier seed has control points on the line slope and between the line endpoints.
*/
function isBezierSeedLinear(seed: IPathBezierSeed): boolean;
/**
* Check for line overlapping another line.
*
@@ -1446,6 +1594,20 @@ declare namespace MakerJs.exporter {
exportItem(itemId: string, itemToExport: any, origin: IPoint): void;
}
}
declare namespace MakerJs.importer {
/**
* Create a numeric array from a string of numbers. The numbers may be delimited by anything non-numeric.
*
* Example:
* ```
* var n = makerjs.importer.parseNumericList('5, 10, 15.20 25-30-35 4e1 .5');
* ```
*
* @param s The string of numbers.
* @returns Array of numbers.
*/
function parseNumericList(s: string): number[];
}
declare namespace MakerJs.exporter {
function toDXF(modelToExport: IModel, options?: IDXFRenderOptions): string;
function toDXF(pathsToExport: IPath[], options?: IDXFRenderOptions): string;
@@ -1528,7 +1690,6 @@ declare namespace MakerJs.model {
*
* @param modelContext The model to search for chains.
* @param options Optional options object.
* @returns A list of chains.
*/
function findChains(modelContext: IModel, callback: IChainCallback, options?: IFindChainsOptions): void;
}
@@ -1554,7 +1715,7 @@ declare namespace MakerJs.model {
* @param options Optional options object.
* @returns The input model (for chaining).
*/
function removeDeadEnds(modelContext: IModel, pointMatchingDistance?: number): IModel;
function removeDeadEnds(modelContext: IModel, pointMatchingDistance?: any, keep?: IWalkPathBooleanCallback): IModel;
}
declare namespace MakerJs.exporter {
/**
@@ -1676,11 +1837,11 @@ declare namespace MakerJs.exporter {
/**
* Convert a chain to SVG path data.
*/
function chainToSVGPathData(chain: IChain, offset: IPoint): string;
function chainToSVGPathData(chain: IChain, offset: IPoint, scale: number): string;
/**
* Convert a path to SVG path data.
*/
function pathToSVGPathData(pathToExport: IPath, offset: IPoint, offset2: IPoint): string;
function pathToSVGPathData(pathToExport: IPath, offset: IPoint, offset2: IPoint, scale: number): string;
function toSVG(modelToExport: IModel, options?: ISVGRenderOptions): string;
function toSVG(pathsToExport: IPath[], options?: ISVGRenderOptions): string;
function toSVG(pathToExport: IPath, options?: ISVGRenderOptions): string;
@@ -1743,9 +1904,119 @@ declare namespace MakerJs.exporter {
viewBox?: boolean;
}
}
declare namespace MakerJs.importer {
function fromSVGPathData(pathData: string): IModel;
}
declare namespace MakerJs.models {
class BezierCurve implements IModel {
models: IModelMap;
paths: IPathMap;
origin: IPoint;
type: string;
seed: IPathBezierSeed;
accuracy: number;
constructor(points: IPoint[], accuracy?: number);
constructor(seed: IPathBezierSeed, accuracy?: number);
constructor(seed: IPathBezierSeed, isChild: boolean, accuracy?: number);
constructor(origin: IPoint, control: IPoint, end: IPoint, accuracy?: number);
constructor(origin: IPoint, controls: IPoint[], end: IPoint, accuracy?: number);
constructor(origin: IPoint, control1: IPoint, control2: IPoint, end: IPoint, accuracy?: number);
static typeName: string;
static getBezierSeeds(curve: BezierCurve, options?: IFindChainsOptions): IPathBezierSeed[];
static computePoint(seed: IPathBezierSeed, t: number): IPoint;
}
}
declare var Bezier: typeof BezierJs.Bezier;
declare namespace MakerJs.models {
class Ellipse implements IModel {
models: IModelMap;
origin: IPoint;
/**
* Class for Ellipse created with 2 radii.
*
* @param radiusX The x radius of the ellipse.
* @param radiusY The y radius of the ellipse.
* @param accuracy Optional accuracy of the underlying BezierCurve.
*/
constructor(radiusX: number, radiusY: number, accuracy?: number);
/**
* Class for Ellipse created at a specific origin and 2 radii.
*
* @param origin The center of the ellipse.
* @param radiusX The x radius of the ellipse.
* @param radiusY The y radius of the ellipse.
* @param accuracy Optional accuracy of the underlying BezierCurve.
*/
constructor(origin: IPoint, radiusX: number, radiusY: number, accuracy?: number);
/**
* Class for Ellipse created at a specific x, y and 2 radii.
*
* @param cx The x coordinate of the center of the ellipse.
* @param cy The y coordinate of the center of the ellipse.
* @param rX The x radius of the ellipse.
* @param rY The y radius of the ellipse.
* @param accuracy Optional accuracy of the underlying BezierCurve.
*/
constructor(cx: number, cy: number, rx: number, ry: number, accuracy?: number);
}
class EllipticArc implements IModel {
models: IModelMap;
/**
* Class for Elliptic Arc created by distorting a circular arc.
*
* @param arc The circular arc to use as the basis of the elliptic arc.
* @param radiusX The x radius of the ellipse.
* @param radiusY The y radius of the ellipse.
* @param accuracy Optional accuracy of the underlying BezierCurve.
*/
constructor(startAngle: number, endAngle: number, radiusX: number, radiusY: number, accuracy?: number);
/**
* Class for Elliptic Arc created by distorting a circular arc.
*
* @param arc The circular arc to use as the basis of the elliptic arc.
* @param distortX The x scale of the ellipse.
* @param distortY The y scale of the ellipse.
* @param accuracy Optional accuracy of the underlying BezierCurve.
*/
constructor(arc: IPathArc, distortX: number, distortY: number, accuracy?: number);
}
}
declare namespace MakerJs.models {
class ConnectTheDots implements IModel {
paths: IPathMap;
/**
* Create a model by connecting points designated in a string. The model will be 'closed' - i.e. the last point will connect to the first point.
*
* Example:
* ```
* var c = new makerjs.models.ConnectTheDots('-10 0 10 0 0 20'); // 3 coordinates to form a triangle
* ```
*
* @param numericList String containing a list of numbers which can be delimited by spaces, commas, or anything non-numeric (Note: [exponential notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential) is allowed).
*/
constructor(numericList: string);
/**
* Create a model by connecting points designated in a numeric array. The model will be 'closed' - i.e. the last point will connect to the first point.
*
* Example:
* ```
* var c = new makerjs.models.ConnectTheDots([-10, 0, 10, 0, 0, 20]); // 3 coordinates to form a triangle
* ```
*
* @param coords Array of coordinates.
*/
constructor(coords: number[]);
/**
* Create a model by connecting points designated in an array of points. The model may be closed, or left open.
*
* Example:
* ```
* var c = new makerjs.models.ConnectTheDots(false, [[-10, 0], [10, 0], [0, 20]]); // 3 coordinates left open
* ```
*
* @param isClosed Flag to specify if last point should connect to the first point.
* @param points Array of IPoints.
*/
constructor(isClosed: boolean, points: IPoint[]);
}
}
@@ -1777,8 +2048,34 @@ declare namespace MakerJs.models {
}
declare namespace MakerJs.models {
class RoundRectangle implements IModel {
origin: IPoint;
paths: IPathMap;
/**
* Create a round rectangle from width, height, and corner radius.
*
* Example:
* ```
* var r = new makerjs.models.RoundRectangle(100, 50, 5);
* ```
*
* @param width Width of the rectangle.
* @param height Height of the rectangle.
* @param radius Corner radius.
*/
constructor(width: number, height: number, radius: number);
/**
* Create a round rectangle which will surround a model.
*
* Example:
* ```
* var b = new makerjs.models.BoltRectangle(30, 20, 1); //draw a bolt rectangle so we have something to surround
* var r = new makerjs.models.RoundRectangle(b, 2.5); //surround it
* ```
*
* @param modelToSurround IModel object.
* @param margin Distance from the model. This will also become the corner radius.
*/
constructor(modelToSurround: IModel, margin: number);
}
}
declare namespace MakerJs.models {
@@ -1798,7 +2095,43 @@ declare namespace MakerJs.models {
class Rectangle implements IModel {
paths: IPathMap;
origin: IPoint;
/**
* Create a rectangle from width and height.
*
* Example:
* ```
* var r = new makerjs.models.Rectangle(100, 50);
* ```
*
* @param width Width of the rectangle.
* @param height Height of the rectangle.
*/
constructor(width: number, height: number);
/**
* Create a rectangle which will surround a model.
*
* Example:
* ```
* var e = new makerjs.models.Ellipse(17, 10); // draw an ellipse so we have something to surround.
* var r = new makerjs.models.Rectangle(e, 3); // draws a rectangle surrounding the ellipse by 3 units.
* ```
*
* @param modelToSurround IModel object.
* @param margin Optional distance from the model.
*/
constructor(modelToSurround: IModel, margin?: number);
/**
* Create a rectangle from a measurement.
*
* Example:
* ```
* var e = new makerjs.models.Ellipse(17, 10); // draw an ellipse so we have something to measure.
* var m = makerjs.measure.modelExtents(e); // measure the ellipse.
* var r = new makerjs.models.Rectangle(m); // draws a rectangle surrounding the ellipse.
* ```
*
* @param measurement IMeasure object. See http://microsoft.github.io/maker.js/docs/api/modules/makerjs.measure.html#pathextents and http://microsoft.github.io/maker.js/docs/api/modules/makerjs.measure.html#modelextents to get measurements of paths and models.
*/
constructor(measurement: IMeasure);
}
}
@@ -1835,3 +2168,9 @@ declare namespace MakerJs.models {
static InnerRadiusRatio(numberOfPoints: number, skipPoints: number): number;
}
}
declare namespace MakerJs.models {
class Text implements IModel {
models: IModelMap;
constructor(font: opentypejs.Font, text: string, fontSize: number, combine?: boolean);
}
}
+176 -200
View File
@@ -78,6 +78,7 @@ declare module "mongoose" {
import events = require('events');
import mongodb = require('mongodb');
import stream = require('stream');
import mongoose = require('mongoose');
/*
* Some mongoose classes have the same name as the native JS classes
@@ -90,234 +91,207 @@ declare module "mongoose" {
/*
* Public API
*/
export = mongoose;
/*
* section index.js
* http://mongoosejs.com/docs/api.html#index-js
*
* require('mongoose') is not actually a class with static
* methods. It is an instance of the Mongoose class.
*
* Reasons we use a class with static properties below:
* 1. MongooseThenable extends mongoose, so we need a
* scope to wrap everything. We can't use a namespace
* since namespaces can't be inherited from.
* 2. We can't use an interface to wrap everything, since
* some properties of mongoose are class constructors.
* Exporting an interface won't, for example, let us
* call new mongoose.Schema({})
* 3. We can't use a normal class since require('mongoose')
* is an instance object. All of its properties are
* immediately accessible: require('mongoose').model('')
* If we export a normal class and import * as mongoose
* we'll have to call new mongoose() before we can use
* any of its methods, which would be inaccurate.
*
* NOTE: the static properties below cannot be used for
* type-checking. If you want to use the names for
* type-checking you must add a corresponding interface
* inside namespace mongoose {} defined below.
*/
/* Class constructors */
export var Aggregate: typeof _mongoose.Aggregate;
export var CastError: typeof _mongoose.CastError;
export var Collection: _mongoose.Collection;
export var Connection: typeof _mongoose.Connection;
export var Document: typeof _mongoose.Document;
export var DocumentProvider: any;
export var Error: typeof _mongoose.Error;
export var Model: _mongoose.ModelConstructor<{}>;
export var Mongoose: {
// recursive constructor
new(...args: any[]): typeof mongoose;
}
/**
* Contains all the public properties and methods that can
* be accessed by mongoose = require('mongoose')
* To assign your own promise library:
*
* 1. Include this somewhere in your code:
* mongoose.Promise = YOUR_PROMISE;
*
* 2. Include this somewhere in your main .d.ts file:
* type MongoosePromise<T> = YOUR_PROMISE<T>;
*/
class mongoose {
/* Class constructors */
static Aggregate: typeof _mongoose.Aggregate;
static CastError: typeof _mongoose.CastError;
static Collection: _mongoose.Collection;
static Connection: typeof _mongoose.Connection;
static Document: typeof _mongoose.Document;
static DocumentProvider: any;
static Error: typeof _mongoose.Error;
static Model: _mongoose.ModelConstructor<{}>;
static Mongoose: {
// recursive constructor
new(...args: any[]): typeof mongoose;
}
/**
* To assign your own promise library:
*
* 1. Include this somewhere in your code:
* mongoose.Promise = YOUR_PROMISE;
*
* 2. Include this somewhere in your main .d.ts file:
* type MongoosePromise<T> = YOUR_PROMISE<T>;
*/
static Promise: any;
static PromiseProvider: any;
static Query: typeof _mongoose.ModelQuery;
static Schema: typeof _mongoose.Schema;
static SchemaType: typeof _mongoose.SchemaType;
static SchemaTypes: typeof _mongoose.Schema.Types;
static Types: {
Subdocument: typeof _mongoose.Types.Subdocument;
Array: typeof _mongoose.Types.Array;
DocumentArray: typeof _mongoose.Types.DocumentArray;
Buffer: typeof _mongoose.Types.Buffer;
ObjectId: typeof _mongoose.Types.ObjectId;
Embedded: typeof _mongoose.Types.Embedded;
}
static VirtualType: typeof _mongoose.VirtualType;
/* Properties */
/** Expose connection states for user-land */
static STATES: Object
/** The default connection of the mongoose module. */
static connection: _mongoose.Connection;
/** The node-mongodb-native driver Mongoose uses. */
static mongo: typeof mongodb;
/**
* The mquery query builder Mongoose uses.
* Currently there is no mquery type definition.
*/
static mquery: any;
/** The Mongoose version */
static version: string;
/* Methods */
/**
* Opens the default mongoose connection.
* Options passed take precedence over options included in connection strings.
* @returns pseudo-promise wrapper around this
*/
static connect(uris: string,
options?: _mongoose.MongooseConnectOptions,
callback?: (err: mongodb.MongoError) => void): typeof _mongoose.MongooseThenable;
static connect(uris: string,
callback?: (err: mongodb.MongoError) => void): typeof _mongoose.MongooseThenable;
/**
* Creates a Connection instance.
* Each connection instance maps to a single database. This method is helpful
* when mangaging multiple db connections.
* @param uri a mongodb:// URI
* @param options options to pass to the driver
* @returns the created Connection object
*/
static createConnection(): _mongoose.Connection;
static createConnection(uri: string,
options?: _mongoose.MongooseConnectOptions
): _mongoose.Connection;
static createConnection(host: string, database_name: string, port?: number,
options?: _mongoose.MongooseConnectOptions
): _mongoose.Connection;
/**
* Disconnects all connections.
* @param fn called after all connection close.
* @returns pseudo-promise wrapper around this
*/
static disconnect(fn?: (error: any) => void): typeof _mongoose.MongooseThenable;
/** Gets mongoose options */
static get(key: string): any;
/**
* Defines a model or retrieves it.
* Models defined on the mongoose instance are available to all connection
* created by the same mongoose instance.
* @param name model name
* @param collection (optional, induced from model name)
* @param skipInit whether to skip initialization (defaults to false)
*/
static model<T>(name: string, schema?: _mongoose.Schema, collection?: string,
skipInit?: boolean): _mongoose.ModelConstructor<T>;
static model<T, Statics>(name: string, schema?: _mongoose.Schema, collection?: string,
skipInit?: boolean): Statics & _mongoose.ModelConstructor<T>;
/**
* Returns an array of model names created on this instance of Mongoose.
* Does not include names of models created using connection.model().
*/
static modelNames(): string[];
/**
* Declares a global plugin executed on all Schemas.
* Equivalent to calling .plugin(fn) on each Schema you create.
* @param fn plugin callback
* @param opts optional options
*/
static plugin(fn: Function, opts?: Object): typeof mongoose;
/** Sets mongoose options */
static set(key: string, value: any): void;
export var Promise: any;
export var PromiseProvider: any;
export var Query: typeof _mongoose.ModelQuery;
export var Schema: typeof _mongoose.Schema;
export var SchemaType: typeof _mongoose.SchemaType;
export var SchemaTypes: typeof _mongoose.Schema.Types;
export var Types: {
Subdocument: typeof _mongoose.Types.Subdocument;
Array: typeof _mongoose.Types.Array;
DocumentArray: typeof _mongoose.Types.DocumentArray;
Buffer: typeof _mongoose.Types.Buffer;
ObjectId: typeof _mongoose.Types.ObjectId;
Embedded: typeof _mongoose.Types.Embedded;
}
export var VirtualType: typeof _mongoose.VirtualType;
/** All the types that are exposed for type checking. */
namespace mongoose {
type Aggregate<T> = _mongoose.Aggregate<T>;
type CastError = _mongoose.CastError;
type Collection = _mongoose.Collection;
type Connection = _mongoose.Connection;
type Document = _mongoose.Document;
type Error = _mongoose.Error;
type ValidationError = _mongoose.ValidationError;
/** Expose connection states for user-land */
export var STATES: Object
/** The default connection of the mongoose module. */
export var connection: _mongoose.Connection;
/** The node-mongodb-native driver Mongoose uses. */
export var mongo: typeof mongodb;
/**
* The mquery query builder Mongoose uses.
* Currently there is no mquery type definition.
*/
export var mquery: any;
/** The Mongoose version */
export var version: string;
/** Document created from model constructors. */
type model<T> = _mongoose.Model<T>;
/** Model Constructor. */
type Model<T> = _mongoose.ModelConstructor<T>;
/* Methods */
/**
* Opens the default mongoose connection.
* Options passed take precedence over options included in connection strings.
* @returns pseudo-promise wrapper around this
*/
export function connect(uris: string,
options?: _mongoose.MongooseConnectOptions,
callback?: (err: mongodb.MongoError) => void): _mongoose.MongooseThenable;
export function connect(uris: string,
callback?: (err: mongodb.MongoError) => void): _mongoose.MongooseThenable;
/**
* Creates a Connection instance.
* Each connection instance maps to a single database. This method is helpful
* when mangaging multiple db connections.
* @param uri a mongodb:// URI
* @param options options to pass to the driver
* @returns the created Connection object
*/
export function createConnection(): _mongoose.Connection;
export function createConnection(uri: string,
options?: _mongoose.MongooseConnectOptions
): _mongoose.Connection;
export function createConnection(host: string, database_name: string, port?: number,
options?: _mongoose.MongooseConnectOptions
): _mongoose.Connection;
/**
* Disconnects all connections.
* @param fn called after all connection close.
* @returns pseudo-promise wrapper around this
*/
export function disconnect(fn?: (error: any) => void): _mongoose.MongooseThenable;
/** Gets mongoose options */
export function get(key: string): any;
/**
* Defines a model or retrieves it.
* Models defined on the mongoose instance are available to all connection
* created by the same mongoose instance.
* @param name model name
* @param collection (optional, induced from model name)
* @param skipInit whether to skip initialization (defaults to false)
*/
export function model<T>(name: string, schema?: _mongoose.Schema, collection?: string,
skipInit?: boolean): _mongoose.ModelConstructor<T>;
export function model<T, Statics>(name: string, schema?: _mongoose.Schema, collection?: string,
skipInit?: boolean): Statics & _mongoose.ModelConstructor<T>;
/**
* Returns an array of model names created on this instance of Mongoose.
* Does not include names of models created using connection.model().
*/
export function modelNames(): string[];
/**
* Declares a global plugin executed on all Schemas.
* Equivalent to calling .plugin(fn) on each Schema you create.
* @param fn plugin callback
* @param opts optional options
*/
export function plugin(fn: Function, opts?: Object): typeof mongoose;
/** Sets mongoose options */
export function set(key: string, value: any): void;
type Mongoose = typeof mongoose;
type Promise<T> = _mongoose._MongoosePromise<T>;
type Query<T> = _mongoose.Query<T>;
type QueryCursor<T> = _mongoose.QueryCursor<T>;
type QueryStream = _mongoose.QueryStream;
type Schema = _mongoose.Schema;
namespace Schema {
namespace Types {
type Array = _mongoose.Schema._Types.Array;
type String = _mongoose.Schema._Types.String;
type DocumentArray = _mongoose.Schema._Types.DocumentArray;
type Number = _mongoose.Schema._Types.Number;
type Date = _mongoose.Schema._Types.Date;
type Buffer = _mongoose.Schema._Types.Buffer;
type Boolean = _mongoose.Schema._Types.Boolean;
type Bool = _mongoose.Schema._Types.Boolean;
type ObjectId = _mongoose.Schema._Types.ObjectId;
type Oid = _mongoose.Schema._Types.ObjectId;
type Mixed = _mongoose.Schema._Types.Mixed;
type Object = _mongoose.Schema._Types.Mixed;
type Embedded = _mongoose.Schema._Types.Embedded;
}
}
type SchemaType = _mongoose.SchemaType;
namespace Types {
type Subdocument = _mongoose.Types.Subdocument;
type Array<T> = _mongoose.Types.Array<T>;
type DocumentArray<T extends _mongoose.Document> = _mongoose.Types.DocumentArray<T>;
type Buffer = _mongoose.Types.Buffer;
type ObjectId = _mongoose.Types.ObjectId;
type Embedded = _mongoose.Types.Embedded;
}
type VirtualType = _mongoose.VirtualType;
type ConnectionOptions = _mongoose.MongooseConnectOptions;
}
/*
* Public API Details.
* All the types that are exposed for type checking.
*/
export type Aggregate<T> = _mongoose.Aggregate<T>;
export type CastError = _mongoose.CastError;
export type Collection = _mongoose.Collection;
export type Connection = _mongoose.Connection;
export type Document = _mongoose.Document;
export type Error = _mongoose.Error;
export type ValidationError = _mongoose.ValidationError;
/** Document created from model constructors. */
export type model<T> = _mongoose.Model<T>;
/** Model Constructor. */
export type Model<T> = _mongoose.ModelConstructor<T>;
export type Mongoose = typeof mongoose;
export type Promise<T> = _mongoose._MongoosePromise<T>;
export type Query<T> = _mongoose.Query<T>;
export type QueryCursor<T> = _mongoose.QueryCursor<T>;
export type QueryStream = _mongoose.QueryStream;
export type Schema = _mongoose.Schema;
namespace Schema {
namespace Types {
export type Array = _mongoose.Schema._Types.Array;
export type String = _mongoose.Schema._Types.String;
export type DocumentArray = _mongoose.Schema._Types.DocumentArray;
export type Number = _mongoose.Schema._Types.Number;
export type Date = _mongoose.Schema._Types.Date;
export type Buffer = _mongoose.Schema._Types.Buffer;
export type Boolean = _mongoose.Schema._Types.Boolean;
export type Bool = _mongoose.Schema._Types.Boolean;
export type ObjectId = _mongoose.Schema._Types.ObjectId;
export type Oid = _mongoose.Schema._Types.ObjectId;
export type Mixed = _mongoose.Schema._Types.Mixed;
export type Object = _mongoose.Schema._Types.Mixed;
export type Embedded = _mongoose.Schema._Types.Embedded;
}
}
export type SchemaType = _mongoose.SchemaType;
namespace Types {
export type Subdocument = _mongoose.Types.Subdocument;
export type Array<T> = _mongoose.Types.Array<T>;
export type DocumentArray<T extends _mongoose.Document> = _mongoose.Types.DocumentArray<T>;
export type Buffer = _mongoose.Types.Buffer;
export type ObjectId = _mongoose.Types.ObjectId;
export type Embedded = _mongoose.Types.Embedded;
}
export type VirtualType = _mongoose.VirtualType;
export type ConnectionOptions = _mongoose.MongooseConnectOptions;
/** Private */
namespace _mongoose {
/*
* section index.js
* http://mongoosejs.com/docs/api.html#index-js
*/
class MongooseThenable extends mongoose {
type MongooseThenable = typeof mongoose & _MongooseThenable;
interface _MongooseThenable {
/**
* Ability to use mongoose object as a pseudo-promise so .connect().then()
* and .disconnect().then() are viable.
*/
static then<TRes>(onFulfill?: () => void | TRes | PromiseLike<TRes>,
then<TRes>(onFulfill?: () => void | TRes | PromiseLike<TRes>,
onRejected?: (err: mongodb.MongoError) => void | TRes | PromiseLike<TRes>): _MongoosePromise<TRes>;
/**
* Ability to use mongoose object as a pseudo-promise so .connect().then()
* and .disconnect().then() are viable.
*/
static catch<TRes>(onRejected?: (err: mongodb.MongoError) => void | TRes | PromiseLike<TRes>): _MongoosePromise<TRes>;
catch<TRes>(onRejected?: (err: mongodb.MongoError) => void | TRes | PromiseLike<TRes>): _MongoosePromise<TRes>;
}
class CastError extends _mongoose.Error {
@@ -1148,7 +1122,9 @@ declare module "mongoose" {
* potentially overwritting any changes that happen between when you retrieved the object
* and when you save it.
*/
sort(compareFn?: (a: T, b: T) => number): T[];
// some lib.d.ts have return type "this" and others have return type "T[]"
// which causes errors. Let the inherited array provide the sort() method.
//sort(compareFn?: (a: T, b: T) => number): T[];
/**
* Wraps Array#splice with proper change tracking and casting.
@@ -2627,4 +2603,4 @@ declare module "mongoose" {
name: string;
}
}
}
}
+3
View File
@@ -9,6 +9,9 @@ device.busNumber = 1;
device.deviceAddress = 1;
device.portNumbers = [1, 2, 3];
device.__open();
device.__claimInterface(0);
device.open(true);
device.close();
const xferDevice: usb.Device = device.controlTransfer(1, 1, 1, 1, 1, (error: string, buf: Buffer): usb.Device => new usb.Device());
+3
View File
@@ -16,6 +16,9 @@ declare module "usb" {
public configDescriptor: ConfigDescriptor;
public interfaces: Array<Interface>;
__open(): void;
__claimInterface(addr: number): void;
open(defaultConfig?: boolean): void;
close(): void;
interface(addr: number): Interface;
+2 -2
View File
@@ -156,7 +156,7 @@ declare module "nw.gui" {
eval(frame: HTMLIFrameElement, script: string): void;
}
export interface App {
export interface App extends EventEmitter {
argv: any;
fullArgv: any;
dataPath: string;
@@ -199,7 +199,7 @@ declare module "nw.gui" {
menu?: Menu;
}
export class Tray implements TrayOption {
export class Tray extends EventEmitter implements TrayOption {
constructor(option: TrayOption);
title: string;
tooltip: string;
+8
View File
@@ -885,6 +885,14 @@ declare module "https" {
export interface Agent extends http.Agent { }
export interface AgentOptions extends http.AgentOptions {
pfx?: any;
key?: any;
passphrase?: string;
cert?: any;
ca?: any;
ciphers?: string;
rejectUnauthorized?: boolean;
secureProtocol?: string;
maxCachedSessions?: number;
}
+12 -2
View File
@@ -324,6 +324,7 @@ declare namespace NodeJS {
cwd(): string;
env: any;
exit(code?: number): void;
exitCode: number;
getgid(): number;
setgid(id: number): void;
setgid(id: string): void;
@@ -607,6 +608,7 @@ declare module "http" {
removeHeader(name: string): void;
write(chunk: any, encoding?: string): any;
addTrailers(headers: any): void;
finished: boolean;
// Extended base methods
end(): void;
@@ -901,7 +903,7 @@ declare module "https" {
requestCert?: boolean;
rejectUnauthorized?: boolean;
NPNProtocols?: any;
SNICallback?: (servername: string) => any;
SNICallback?: (servername: string, cb:(err:Error,ctx:tls.SecureContext)=>any) => any;
}
export interface RequestOptions extends http.RequestOptions {
@@ -918,6 +920,14 @@ declare module "https" {
export interface Agent extends http.Agent { }
export interface AgentOptions extends http.AgentOptions {
pfx?: any;
key?: any;
passphrase?: string;
cert?: any;
ca?: any;
ciphers?: string;
rejectUnauthorized?: boolean;
secureProtocol?: string;
maxCachedSessions?: number;
}
@@ -1985,7 +1995,7 @@ declare module "tls" {
requestCert?: boolean;
rejectUnauthorized?: boolean;
NPNProtocols?: any; //array or Buffer;
SNICallback?: (servername: string) => any;
SNICallback?: (servername: string, cb:(err:Error,ctx:SecureContext)=>any) => any;
}
export interface ConnectionOptions {
+1
View File
@@ -34,6 +34,7 @@ declare namespace nunjucks {
export function configure(options: ConfigureOptions): Environment;
export function configure(path: string, options?: ConfigureOptions): Environment;
export function configure(path: string[], options?: ConfigureOptions): Environment;
export interface ConfigureOptions {
autoescape?: boolean;
+20
View File
@@ -1070,6 +1070,25 @@ declare namespace olx {
rightHanded?: boolean;
}
}
namespace control {
interface ControlOptions {
/**
* The element is the control's container element. This only needs to be specified if you're developing a custom control.
*/
element?: Element;
/**
* Function called when the control should be re-rendered. This is called in a requestAnimationFrame callback.
*/
render?: any;
/**
* Specify a target if you want the control to be rendered outside of the map's viewport.
*/
target?: Element | string;
}
}
}
/**
@@ -2388,6 +2407,7 @@ declare namespace ol {
}
class Control {
constructor(options: olx.control.ControlOptions);
}
class FullScreen {
+24 -18
View File
@@ -8,7 +8,7 @@ declare namespace olx {
/** Attributions */
attributions?: Array<ol.Attribution>
/*** The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. */
crossOrigin?: string
@@ -47,7 +47,7 @@ declare namespace olx {
/*** The extent to zoom to. If undefined the validity extent of the view projection is used.*/
extent: ol.Extent;
}
interface AttributionOptions {
/** HTML markup for this attribution. */
@@ -1220,7 +1220,7 @@ declare namespace ol {
/**
* Events emitted by ol.Collection instances are instances of this type.
*/
class CollectionEvent<T> {
class CollectionEvent<T> extends ol.events.Event {
/**
* The element that is added to or removed from the collection.
@@ -1279,7 +1279,7 @@ declare namespace ol {
/**
* Events emitted by ol.interaction.DragBox instances are instances of this type.
*/
class DragBoxEvent {
class DragBoxEvent extends ol.events.Event {
/**
* The coordinate of the drag event.
@@ -1935,7 +1935,7 @@ declare namespace ol {
/**
* Events emitted as map events are instances of this type. See ol.Map for which events trigger a map event.
*/
class MapEvent {
class MapEvent extends ol.events.Event {
/**
* The frame state at the time of the event.
@@ -2005,7 +2005,7 @@ declare namespace ol {
/**
* Events emitted by ol.Object instances are instances of this type.
*/
class ObjectEvent {
class ObjectEvent extends ol.events.Event {
/**
* The name of the property whose value is changing.
@@ -2045,7 +2045,7 @@ declare namespace ol {
* @param ref The object to use as this in listener.
* @returns Unique key for the listener.
*/
on(type: string, listener: (event: MapBrowserEvent) => void, ref?: any): any;
on(type: string, listener: (event: ol.events.Event) => void, ref?: any): any;
/**
* Listen for a certain type of event.
@@ -2054,7 +2054,7 @@ declare namespace ol {
* @param ref The object to use as this in listener.
* @returns Unique key for the listener.
*/
on(type: Array<string>, listener: (event: MapBrowserEvent) => void, ref?: any): any;
on(type: Array<string>, listener: (event: ol.events.Event) => void, ref?: any): any;
/**
* Listen once for a certain type of event.
@@ -2063,7 +2063,7 @@ declare namespace ol {
* @param ref The object to use as this in listener.
* @returns Unique key for the listener.
*/
once(type: string, listener: (event: MapBrowserEvent) => void, ref?: any): any;
once(type: string, listener: (event: ol.events.Event) => void, ref?: any): any;
/**
* Listen once for a certain type of event.
@@ -2072,7 +2072,7 @@ declare namespace ol {
* @param ref The object to use as this in listener.
* @returns Unique key for the listener.
*/
once(type: Array<string>, listener: (event: MapBrowserEvent) => void, ref?: any): any;
once(type: Array<string>, listener: (event: ol.events.Event) => void, ref?: any): any;
/**
* Unlisten for a certain type of event.
@@ -2081,7 +2081,7 @@ declare namespace ol {
* @param ref The object to use as this in listener.
* @returns Unique key for the listener.
*/
un(type: Array<string>, listener: (event: MapBrowserEvent) => void, ref?: any): any;
un(type: Array<string>, listener: (event: ol.events.Event) => void, ref?: any): any;
/**
* Removes an event listener using the key returned by on() or once(). Note that using the ol.Observable.unByKey static function is to be preferred.
@@ -2165,7 +2165,7 @@ declare namespace ol {
/**
* Events emitted by ol.interaction.Select instances are instances of this type.
*/
class SelectEvent {
class SelectEvent extends ol.events.Event {
/**
* Deselected features array.
@@ -2551,6 +2551,12 @@ declare namespace ol {
function targetNotEditable(mapBrowserEvent: ol.MapBrowserEvent): boolean;
}
interface ConditionType { (mapBrowseEvent: ol.MapBrowserEvent): boolean; }
class Event {
target: any;
type: string;
preventDefault(): void;
stopPropagation(): void;
}
}
namespace extent {
@@ -3601,7 +3607,7 @@ declare namespace ol {
class DragAndDrop {
}
class DragAndDropEvent {
class DragAndDropEvent extends ol.events.Event {
}
class DragBox {
@@ -3623,7 +3629,7 @@ declare namespace ol {
constructor(opt_options?: olx.interaction.DrawOptions)
}
class DrawEvent {
class DrawEvent extends ol.events.Event {
}
class Interaction extends ol.Object {
@@ -4129,7 +4135,7 @@ declare namespace ol {
namespace render {
class Event {
class Event extends ol.events.Event {
}
class VectorContext {
@@ -4167,7 +4173,7 @@ declare namespace ol {
class ImageCanvas extends Image {
}
class ImageEvent {
class ImageEvent extends ol.events.Event {
}
class ImageMapGuide extends Image {
@@ -4216,7 +4222,7 @@ declare namespace ol {
class TileDebug extends Tile {
}
class TileEvent {
class TileEvent extends ol.events.Event {
}
class TileImage extends UrlTile {
@@ -4301,7 +4307,7 @@ declare namespace ol {
getFeaturesAtCoordinate(coordinate: ol.Coordinate): ol.Feature[];
}
class VectorEvent {
class VectorEvent extends ol.events.Event {
}
class VectorTile extends UrlTile {
+72
View File
@@ -0,0 +1,72 @@
/// <reference path="phoenix.d.ts" />
import { Socket, Channel, Presence } from 'phoenix';
function test_socket() {
const socket = new Socket("/ws", {params: {userToken: "123"}});
socket.connect();
}
function test_channel() {
const socket = new Socket("/ws", {params: {userToken: "123"}});
socket.connect();
const channel = socket.channel("room:123", {token: '123'});
channel.on("new_msg", msg => console.log("Got message", msg));
channel.push("new_msg", {body: 'some value'}, 10000)
.receive("ok", (msg) => console.log("created message", msg))
.receive("error", (reasons) => console.log("create failed", reasons))
.receive("timeout", () => console.log("Networking issue..."));
channel.join()
.receive("ok", ({messages}) => console.log("catching up", messages))
.receive("error", ({reason}) => console.log("failed join", reason))
.receive("timeout", () => console.log("Networking issue. Still waiting..."));
}
function test_hooks() {
const socket = new Socket("/ws", {params: {userToken: "123"}});
socket.connect();
socket.onError(() => console.log("there was an error with the connection!"));
socket.onClose(() => console.log("the connection dropped"));
const channel = socket.channel("room:123", {token: '123'});
channel.onError(() => console.log("there was an error!"));
channel.onClose(() => console.log("the channel has gone away gracefully"))
}
function test_presence() {
let state = {};
const stateFromServer = {};
const onJoin = (id: string, current: any, newPres: any) => {
if(!current){
console.log("user has entered for the first time", newPres)
} else {
console.log("user additional presence", newPres)
}
};
const onLeave = (id: string, current: any, leftPres: any) => {
if(current.metas.length === 0){
console.log("user has left from all devices", leftPres)
} else {
console.log("user left from a device", leftPres)
}
};
state = Presence.syncState(state, stateFromServer, onJoin, onLeave);
const listBy = (id: string, {metas: [first, ...rest]} : {metas: any[]}) => {
first.count = rest.length + 1;
first.id = id;
return first;
};
const onlineUsers = Presence.list(state, listBy);
}
+143
View File
@@ -0,0 +1,143 @@
// Type definitions for phoenix
// Project: https://github.com/phoenixframework/phoenix
// Definitions by: Mirosław Ciastek <https://github.com/mciastek>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "phoenix" {
class Push {
constructor(channel: Channel, event: string, payload: any, timeout: number);
resend(timeout: number): void;
send(): void;
receive(status: string, callback: (response?: any) => void): Push;
}
export class Channel {
constructor(topic: string, params?: Object, socket?: Socket);
rejoinUntilConnected(): void;
join(timeout?: number): Push;
leave(timeout?: number): Push;
onClose(callback: Function): void;
onError(callback: (reason?: any) => void): void;
onMessage(event: string, payload: any, ref: any): any;
on(event: string, callback: (response?: any) => void): void;
off(event: string): void;
canPush(): boolean;
push(event: string, payload: Object, timeout?: number): Push;
}
export class Socket {
constructor(endPoint: string, opts?: Object);
protocol(): string;
endPointURL(): string;
disconnect(callback?: Function, code?: string, reason?: any): void;
connect(params?: any): void;
log(kind: string, msg: string, data: any): void;
onOpen(callback: Function): void;
onClose(callback: Function): void;
onError(callback: Function): void;
onMessage(callback: Function): void;
onConnOpen(): void;
onConnClose(event: any): void;
onConnError(error: any): void;
triggerChanError(): void;
connectionState(): string;
isConnected(): boolean;
remove(channel: Channel): void;
channel(topic: string, chanParams?: Object): Channel;
push(data: any): void;
makeRef(): string;
sendHeartbeat(): void;
flushSendBuffer(): void;
onConnMessage(rawMessage: any): void;
}
export class LongPoll {
constructor(endPoint: string);
normalizeEndpoint(endPoint: string): string;
endpointURL(): string;
closeAndRetry(): void;
ontimeout(): void;
poll(): void;
send(body: any): void;
close(code?: any, reason?: any): void;
}
export class Ajax {
request(
method: string,
endPoint: string,
accept: string,
body: any,
timeout?: number,
ontimeout?: any,
callback?: (response?: any) => void
): void;
xdomainRequest(
req: any,
method: string,
endPoint: string,
body: any,
timeout?: number,
ontimeout?: any,
callback?: (response?: any) => void
): void;
xhrRequest(
req: any,
method: string,
endPoint: string,
accept: string,
body: any,
timeout?: number,
ontimeout?: any,
callback?: (response?: any) => void
): void;
parseJSON(resp: string): JSON;
serialize(obj: any, parentKey: string): string;
appendParams(url: string, params: any): string;
}
export var Presence: {
syncState(
currentState: any,
newState: any,
onJoin?: (key?: string, currentPresence?: any, newPresence?: any) => void,
onLeave?: (key?: string, currentPresence?: any, newPresence?: any) => void
): any;
syncDiff(
currentState: any,
newState: any,
onJoin?: (key?: string, currentPresence?: any, newPresence?: any) => void,
onLeave?: (key?: string, currentPresence?: any, newPresence?: any) => void
): any;
list(presences: any, chooser?: Function): any;
}
}
+47
View File
@@ -0,0 +1,47 @@
/// <reference path="./pkcs11js.d.ts" />
import * as pkcs11js from "pkcs11js";
const libPath = "C:\\tmp\\rtpkcs11ecp.dll";
let pkcs11 = new pkcs11js.PKCS11();
pkcs11.load(libPath);
pkcs11.C_Initialize();
try {
// Getting info about PKCS11 Module
let module_info = pkcs11.C_GetInfo();
// Getting list of slots
let slots = pkcs11.C_GetSlotList(true);
let slot = slots[0];
// Getting info about slot
let slot_info = pkcs11.C_GetSlotInfo(slot);
// Getting info about token
let token_info = pkcs11.C_GetTokenInfo(slot);
// Getting info about Mechanism
let mechs = pkcs11.C_GetMechanismList(slot);
let mech_info = pkcs11.C_GetMechanismInfo(slot, mechs[0]);
let session = pkcs11.C_OpenSession(slot, pkcs11js.CKF_RW_SESSION | pkcs11js.CKF_SERIAL_SESSION);
// Getting info about Session
let info = pkcs11.C_GetSessionInfo(session);
pkcs11.C_Login(session, 1, "12345678");
/**
* Your app code here
*/
pkcs11.C_Logout(session);
pkcs11.C_CloseSession(session);
}
catch (e) {
console.error(e);
}
finally {
pkcs11.C_Finalize();
}
+1226
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+76 -168
View File
@@ -1,6 +1,6 @@
// Type definitions for react-bootstrap
// Project: https://github.com/react-bootstrap/react-bootstrap
// Definitions by: Walker Burgin <https://github.com/walkerburgin>, Vincent Siao <https://github.com/vsiao>, Danilo Barros <https://github.com/danilojrr>
// Definitions by: Walker Burgin <https://github.com/walkerburgin>, Vincent Siao <https://github.com/vsiao>, Danilo Barros <https://github.com/danilojrr>, Batbold Gansukh <https://github.com/Batbold-Gansukh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference path="../react/react.d.ts"/>
@@ -27,12 +27,12 @@ declare namespace ReactBootstrap {
interface TransitionCallbacks {
onEnter?: Function;
onEntered?: Function;
onEntering?: Function;
onExit?: Function;
onExited?: Function;
onExiting?: Function;
onEnter?: Function;
onEntered?: Function;
onEntering?: Function;
onExit?: Function;
onExited?: Function;
onExiting?: Function;
}
@@ -52,14 +52,10 @@ declare namespace ReactBootstrap {
// <Breadcrumb />
interface BreadcrumbProps
extends React.Props<Breadcrumb>
{
interface BreadcrumbProps extends React.Props<Breadcrumb> {
bsClass?: string;
}
interface BreadcrumbClass
extends React.ClassicComponentClass<BreadcrumbProps>
{
interface BreadcrumbClass extends React.ClassicComponentClass<BreadcrumbProps> {
Item: typeof BreadcrumbItem;
}
type Breadcrumb = React.ClassicComponent<BreadcrumbProps, {}>;
@@ -67,12 +63,9 @@ declare namespace ReactBootstrap {
// <BreadcrumbItem />
interface BreadcrumbItemProps
extends React.Props<BreadcrumbItem>
{
interface BreadcrumbItemProps extends React.Props<BreadcrumbItem> {
active?: boolean;
id?: string | number;
linkId?: string | number;
href?: string;
title?: React.ReactNode;
target?: string;
@@ -82,15 +75,11 @@ declare namespace ReactBootstrap {
// <Button />
interface ButtonProps
extends React.HTMLProps<Button>
{
interface ButtonProps extends React.HTMLProps<Button> {
active?: boolean;
block?: boolean;
bsStyle?: string;
bsSize?: Sizes;
navItem?: boolean;
navDropdown?: boolean;
componentClass?: React.ReactType;
}
type Button = React.ClassicComponent<ButtonProps, {}>;
@@ -98,9 +87,7 @@ declare namespace ReactBootstrap {
// <ButtonToolbar />
interface ButtonToolbarProps
extends React.HTMLProps<ButtonToolbar>
{
interface ButtonToolbarProps extends React.HTMLProps<ButtonToolbar> {
block?: boolean;
bsSize?: Sizes;
bsStyle?: string;
@@ -112,9 +99,7 @@ declare namespace ReactBootstrap {
// <ButtonGroup />
interface ButtonGroupProps
extends React.HTMLProps<ButtonGroup>
{
interface ButtonGroupProps extends React.HTMLProps<ButtonGroup> {
block?: boolean;
bsSize?: Sizes;
bsStyle?: string;
@@ -126,39 +111,29 @@ declare namespace ReactBootstrap {
// <Checkbox />
interface CheckboxProps
extends React.HTMLProps<Checkbox>
{
interface CheckboxProps extends React.HTMLProps<Checkbox> {
bsClass?: string;
disabled?: boolean;
inline?: boolean;
inputRef?: ( instance:HTMLInputElement ) => void;
validationState?: "success" | "warning" | "error";
}
class Checkbox
extends React.Component<CheckboxProps, {}>
{ }
class Checkbox extends React.Component<CheckboxProps, {}> { }
// <Clearfix />
interface ClearfixProps
extends React.HTMLProps<Clearfix>
{
interface ClearfixProps extends React.HTMLProps<Clearfix> {
componentClass?: React.ReactType,
visibleXsBlock?: boolean;
visibleSmBlock?: boolean;
visibleMdBlock?: boolean;
visibleLgBlock?: boolean;
}
class Clearfix
extends React.Component<ClearfixProps, {}>
{ }
class Clearfix extends React.Component<ClearfixProps, {}> { }
// <Collapse />
interface CollapseProps
extends TransitionCallbacks, React.Props<Collapse>
{
interface CollapseProps extends TransitionCallbacks, React.Props<Collapse> {
dimension?: 'height' | 'width' | { ( ):string };
getDimensionValue?: ( dimension:number, element:React.ReactElement<any> ) => number;
in?: boolean;
@@ -166,9 +141,7 @@ declare namespace ReactBootstrap {
transitionAppear?: boolean;
unmountOnExit?: boolean;
}
class Collapse
extends React.Component<CollapseProps, {}>
{ }
class Collapse extends React.Component<CollapseProps, {}> { }
// <Dropdown />
@@ -186,18 +159,14 @@ declare namespace ReactBootstrap {
role?: string;
}
type DropdownProps = DropdownBaseProps & React.HTMLProps<Dropdown>;
class Dropdown
extends React.Component<DropdownProps, any>
{
class Dropdown extends React.Component<DropdownProps, any> {
public static Menu: typeof DropdownMenu;
public static Toggle: typeof DropdownToggle;
}
// <DropdownButton />
interface DropdownButtonBaseProps
extends DropdownBaseProps
{
interface DropdownButtonBaseProps extends DropdownBaseProps {
bsSize?: Sizes;
bsStyle?: string;
navItem?: boolean;
@@ -205,59 +174,44 @@ declare namespace ReactBootstrap {
pullRight?: boolean;
}
type DropdownButtonProps = DropdownButtonBaseProps & React.HTMLProps<DropdownButton>;
class DropdownButton
extends React.Component<DropdownButtonProps, {}>
{ }
class DropdownButton extends React.Component<DropdownButtonProps, {}> { }
// <Dropdown.Menu />
interface DropdownMenuProps
extends React.HTMLProps<DropdownMenu>
{
interface DropdownMenuProps extends React.HTMLProps<DropdownMenu> {
labelledBy?: string | number;
onClose?: Function;
onSelect?: SelectCallback;
open?: boolean;
pullRight?: boolean;
}
class DropdownMenu
extends React.Component<DropdownMenuProps, any>
{ }
class DropdownMenu extends React.Component<DropdownMenuProps, any> { }
// <Dropdown.Toggle />
interface DropdownToggleProps
extends React.HTMLProps<DropdownToggle>
{
interface DropdownToggleProps extends React.HTMLProps<DropdownToggle> {
bsRole?: string;
noCaret?: boolean;
open?: boolean;
title?: string;
useAnchor?: boolean;
bsClass?:string; // Added since v0.30.0
}
class DropdownToggle
extends React.Component<DropdownToggleProps, any>
{ }
class DropdownToggle extends React.Component<DropdownToggleProps, any> { }
// <Fade />
interface FadeProps
extends TransitionCallbacks, React.Props<Fade>
{
interface FadeProps extends TransitionCallbacks, React.Props<Fade> {
in?: boolean;
timeout?: number;
transitionAppear?: boolean;
unmountOnExit?: boolean;
}
class Fade
extends React.Component<FadeProps, {}>
{ }
class Fade extends React.Component<FadeProps, {}> { }
// <MenuItem />
interface MenuItemProps
extends React.HTMLProps<MenuItem>
{
interface MenuItemProps extends React.HTMLProps<MenuItem> {
active?: boolean;
bsClass?: string;
disabled?: boolean;
@@ -269,15 +223,11 @@ declare namespace ReactBootstrap {
target?: string;
title?: string;
}
class MenuItem
extends React.Component<MenuItemProps, {}>
{ }
class MenuItem extends React.Component<MenuItemProps, {}> { }
// <Panel />
interface PanelProps
extends TransitionCallbacks, React.HTMLProps<Panel>
{
interface PanelProps extends TransitionCallbacks, React.HTMLProps<Panel> {
bsClass?: string;
bsSize?: Sizes;
bsStyle?: string;
@@ -294,9 +244,7 @@ declare namespace ReactBootstrap {
// <PanelGroup />
interface PanelGroupProps
extends React.HTMLProps<PanelGroup>
{
interface PanelGroupProps extends React.HTMLProps<PanelGroup> {
accordion?: boolean;
activeKey?: any;
bsSize?: Sizes;
@@ -309,18 +257,14 @@ declare namespace ReactBootstrap {
// <SplitButton />
interface SplitButtonProps
extends React.HTMLProps<SplitButton>
{
interface SplitButtonProps extends React.HTMLProps<SplitButton> {
bsStyle?: string;
bsSize?: Sizes;
dropdownTitle?: any; // TODO: Add more specific type
dropup?: boolean;
pullRight?: boolean;
}
class SplitButton
extends React.Component<SplitButtonProps, {}>
{ }
class SplitButton extends React.Component<SplitButtonProps, {}> { }
// <Modal.Dialog />
@@ -444,8 +388,8 @@ declare namespace ReactBootstrap {
bsSize?: Sizes;
bsStyle?: string;
placement?: string;
positionLeft?: number;
positionTop?: number;
positionLeft?: number | string; // String support added since v0.30.0
positionTop?: number | string; // String support added since v0.30.0
}
type Popover = React.ClassicComponent<PopoverProps, {}>;
var Popover: React.ClassicComponentClass<PopoverProps>;
@@ -585,15 +529,12 @@ declare namespace ReactBootstrap {
// <NavDropdown />
interface NavDropdownBaseProps
extends DropdownBaseProps
{
interface NavDropdownBaseProps extends DropdownBaseProps {
active?: boolean;
noCaret?: boolean;
}
type NavDropdownProps = NavDropdownBaseProps & React.HTMLProps<NavDropdown>;
class NavDropdown
extends React.Component<NavDropdownProps, {}>
{ }
class NavDropdown extends React.Component<NavDropdownProps, {}> { }
// <Tabs />
@@ -652,19 +593,18 @@ declare namespace ReactBootstrap {
// <Pager />
interface PagerProps
extends React.HTMLProps<Pager>
{
interface PagerProps extends React.HTMLProps<Pager> {
onSelect?: SelectCallback;
}
interface PagerClass extends React.ClassicComponentClass<PagerProps> {
Item: typeof PageItem // Added since v0.30.0
}
type Pager = React.ClassicComponent<PagerProps, {}>;
var Pager: React.ClassicComponentClass<PagerProps>;
var Pager: PagerClass;
// <PageItem />
interface PageItemProps
extends React.HTMLProps<PageItem>
{
interface PageItemProps extends React.HTMLProps<PageItem> {
disabled?: boolean;
eventKey?: any;
next?: boolean;
@@ -673,13 +613,12 @@ declare namespace ReactBootstrap {
target?: string;
}
type PageItem = React.ClassicComponent<PageItemProps, {}>;
/** @deprecated since v0.30.0, should use <Pager.Item> instead of <PageItem>*/
var PageItem: React.ClassicComponentClass<PageItemProps>;
// <Pagination />
interface PaginationProps
extends React.HTMLProps<Pagination>
{
interface PaginationProps extends React.HTMLProps<Pagination> {
activePage?: number;
bsSize?: Sizes;
bsStyle?: string;
@@ -740,7 +679,6 @@ declare namespace ReactBootstrap {
active?: boolean;
animtateIn?: boolean;
animateOut?: boolean;
caption?: any; // TODO: Add more specific type
direction?: string;
index?: number;
onAnimateOutEnd?: Function;
@@ -807,6 +745,7 @@ declare namespace ReactBootstrap {
// <ListGroup />
interface ListGroupProps extends React.HTMLProps<ListGroup> {
componentClass?: React.ReactType; // Added since v0.30.0
fill?: boolean; // TODO: Add more specific type
}
class ListGroup extends React.Component<ListGroupProps, {}> {
@@ -890,56 +829,12 @@ declare namespace ReactBootstrap {
type Table = React.ClassicComponent<TableProps, {}>;
var Table: React.ClassicComponentClass<TableProps>;
// <Input />
interface InputProps extends React.HTMLProps<Input> {
defaultValue?:string;
addonAfter?: any; // TODO: Add more specific type
addonBefore?: any; // TODO: Add more specific type
bsSize?: Sizes;
bsStyle?: string;
buttonAfter?: any; // TODO: Add more specific type
buttonBefore?: any; // TODO: Add more specific type
feedbackIcon?: any; // TODO: Add more specific type
groupClassName?: string;
hasFeedback?: boolean;
help?: any; // TODO: Add more specific type
labelClassName?: string;
wrapperClassName?: string;
}
/** @deprecated since v0.29.0 */
class Input extends React.Component<InputProps, {}> {
}
// <ButtonInput />
interface ButtonInputProps extends React.HTMLProps<ButtonInput> {
addonAfter?: any; // TODO: Add more specific type
addonBefore?: any; // TODO: Add more specific type
bsSize?: Sizes;
bsStyle?: string;
buttonAfter?: any; // TODO: Add more specific type
buttonBefore?: any; // TODO: Add more specific type
feedbackIcon?: any; // TODO: Add more specific type
groupClassName?: string;
hasFeedback?: boolean;
help?: any; // TODO: Add more specific type
labelClassName?: string;
wrapperClassName?: string;
}
/** @deprecated since v0.29.0 */
class ButtonInput extends React.Component<ButtonInputProps, {}> {
}
// <InputGroup />
interface InputGroupProps
extends React.HTMLProps<InputGroup>
{
interface InputGroupProps extends React.HTMLProps<InputGroup> {
bsClass?: string;
bsSize?: Sizes;
}
interface InputGroupClass
extends React.ClassicComponentClass<InputGroupProps>
{
interface InputGroupClass extends React.ClassicComponentClass<InputGroupProps> {
Addon: typeof InputGroupAddon;
Button: typeof InputGroupButton;
}
@@ -948,17 +843,13 @@ declare namespace ReactBootstrap {
// <InputGroup.Addon />
interface InputGroupAddonProps
extends React.HTMLProps<InputGroupAddon>
{ }
interface InputGroupAddonProps extends React.HTMLProps<InputGroupAddon> { }
type InputGroupAddon = React.ClassicComponent<InputGroupAddonProps, {}>;
var InputGroupAddon: React.ClassicComponentClass<InputGroupAddonProps>;
// <InputGroup.Button />
interface InputGroupButtonProps
extends React.HTMLProps<InputGroupButton>
{ }
interface InputGroupButtonProps extends React.HTMLProps<InputGroupButton> { }
type InputGroupButton = React.ClassicComponent<InputGroupButtonProps, {}>;
var InputGroupButton: React.ClassicComponentClass<InputGroupButtonProps>;
@@ -1025,18 +916,14 @@ declare namespace ReactBootstrap {
// <Radio />
interface RadioProps
extends React.HTMLProps<Radio>
{
interface RadioProps extends React.HTMLProps<Radio> {
bsClass?: string;
disabled?: boolean;
inline?: boolean;
inputRef?: ( instance:HTMLInputElement ) => void;
validationState?: "success" | "warning" | "error";
}
class Radio
extends React.Component<RadioProps, {}>
{ }
class Radio extends React.Component<RadioProps, {}> { }
// <Portal />
@@ -1125,6 +1012,27 @@ declare namespace ReactBootstrap {
}
type Media = React.ClassicComponent<MediaProps, {}>;
var Media: MediaClass;
/* Utils */
interface bootstrapUtilsType{
// TODO: Implement functions
}
function createChainedFunctionType(...funcs:Function[]):Function
interface ValidComponentChildrenType{
map: (children:any,func:any,context:any) => any
forEach:(children:any,func:any,context:any) => any
count:(children:any) => number
filter:(children:any,func:any,context:any) => any
find:(children:any,func:any,context:any) => any
every:(children:any,func:any,context:any) => any
some:(children:any,func:any,context:any) => any
toArray:(children:any) => any
}
class utils {
static bootstrapUtils:bootstrapUtilsType
static createChainedFunction: typeof createChainedFunctionType
static ValidComponentChildren:ValidComponentChildrenType
}
}
declare module "react-bootstrap" {
@@ -0,0 +1,25 @@
///<reference path="../react/react.d.ts" />
///<reference path="../react-router/react-router.d.ts"/>
///<reference path="./react-breadcrumbs.d.ts" />
import * as React from 'react';
import * as Breadcrumbs from 'react-breadcrumbs';
interface MyComponentProps extends ReactRouter.RouteComponentProps<{}, { id: number }> {
}
class MyComponent extends React.Component<MyComponentProps, {}> {
render() {
return (
<div>
<Breadcrumbs
routes={this.props.routes}
params={this.props.params}
/>
</div>
);
}
}
+41
View File
@@ -0,0 +1,41 @@
// Type definitions for react-breadcrumbs 1.3.16
// Project: https://github.com/svenanders/react-breadcrumbs
// Definitions by: Kostya Esmukov <https://github.com/KostyaEsmukov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference path="../react/react.d.ts"/>
///<reference path="../react-router/react-router.d.ts"/>
declare namespace ReactBreadcrumbs {
import React = __React;
interface BreadcrumbsProps extends React.Props<Breadcrumbs> {
separator?: string | JSX.Element;
displayMissing?: boolean;
prettify?: boolean;
displayMissingText?: string;
displayName?: string;
breadcrumbName?: string;
wrapperElement?: string;
wrapperClass?: string;
itemElement?: string;
itemClass?: string;
customClass?: string;
activeItemClass?: string;
excludes?: string[];
hideNoPath?: boolean;
routes: ReactRouter.RouteConfig;
setDocumentTitle?: boolean;
params?: any; // todo make it compatible with params of the ReactRouter.RouteComponentProps<P, R>
}
interface Breadcrumbs extends React.ComponentClass<BreadcrumbsProps> {}
const Breadcrumbs: Breadcrumbs;
}
declare module 'react-breadcrumbs' {
import Breadcrumbs = ReactBreadcrumbs.Breadcrumbs;
export = Breadcrumbs;
}
@@ -0,0 +1,47 @@
///<reference path="../react/react.d.ts" />
///<reference path="./react-css-modules.d.ts" />
import * as React from 'react';
import * as CSSModules from 'react-css-modules';
const styles = {};
interface TableProps extends CSSModules.InjectedCSSModuleProps {
}
class Table extends React.Component<TableProps, {}> {
render () {
const { styles } = this.props;
return <div styleName='table'>
<div styleName='row'>
<div styleName='cell'>A0</div>
<div styleName='cell'>B0</div>
</div>
</div>;
}
}
const TableHOC = CSSModules(Table, styles);
interface TableDecoratedProps extends CSSModules.InjectedCSSModuleProps {
}
@CSSModules(styles)
class TableDecorated extends React.Component<TableDecoratedProps, {}> {
render () {
const { styles } = this.props;
return <div styleName='table'>
<div styleName='row'>
<div styleName='cell'>A0</div>
<div styleName='cell'>B0</div>
</div>
</div>;
}
}
+33
View File
@@ -0,0 +1,33 @@
// Type definitions for react-css-modules 3.7.9
// Project: https://github.com/gajus/react-css-modules
// Definitions by: Kostya Esmukov <https://github.com/KostyaEsmukov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'react-css-modules' {
interface TypeOptions {
allowMultiple?: boolean;
errorWhenNotFound?: boolean;
}
type StylesObject = any;
interface CSSModules {
(defaultStyles: StylesObject, options?: TypeOptions): <C extends Function>(Component: C) => C;
<C extends Function>(Component: C, defaultStyles: StylesObject, options?: TypeOptions): C;
}
module CSSModules {
// Extend your component's Prop interface with this one to get access to `this.props.styles`
//
// interface MyComponentProps extends CSSModules.InjectedCSSModuleProps {}
interface InjectedCSSModuleProps {
styles?: StylesObject;
}
}
let CSSModules: CSSModules;
export = CSSModules;
}
+95
View File
@@ -0,0 +1,95 @@
///<reference path="../react/react.d.ts" />
///<reference path="../react/react-dom.d.ts" />
///<reference path="../i18next/i18next.d.ts" />
///<reference path="./react-i18next.d.ts" />
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import * as i18n from 'i18next';
import { translate, I18nextProvider, Interpolate, InjectedTranslateProps } from 'react-i18next';
i18n
.init({
fallbackLng: 'en',
// have a common namespace used around the full app
ns: ['common'],
defaultNS: 'common',
debug: true,
interpolation: {
escapeValue: false // not needed for react!!
}
});
interface InnerAnotherComponentProps extends InjectedTranslateProps {
}
class InnerAnotherComponent extends React.Component<InnerAnotherComponentProps, {}> {
render() {
const { t } = this.props;
return <p>{t('content.text', { /* options t options */ })}</p>;
}
}
const AnotherComponent = translate('view', { wait: true })(InnerAnotherComponent);
interface InnerYetAnotherComponentProps extends InjectedTranslateProps {
}
class InnerYetAnotherComponent extends React.Component<InnerYetAnotherComponentProps, {}> {
render() {
const { t } = this.props;
return <p>{t('usingDefaultNS', { /* options t options */ })}</p>;
}
}
const YetAnotherComponent = translate()(InnerYetAnotherComponent);
interface TranslatableViewProps extends InjectedTranslateProps {
}
@translate(['view', 'nav'], { wait: true })
class TranslatableView extends React.Component<TranslatableViewProps, {}> {
render() {
const { t } = this.props;
let interpolateComponent = <strong>"a interpolated component"</strong>;
return (
<div>
<h1>{t('common:appName')}</h1>
<AnotherComponent />
<YetAnotherComponent />
<Interpolate parent='p' i18nKey='common:interpolateSample' value='"some value in props"' component={interpolateComponent} />
<a href='https://github.com/i18next/react-i18next' target='_blank'>{t('nav:link1')}</a>
</div>
)
}
}
class App extends React.Component<{}, {}> {
render() {
return (
<div className='main'>
<main>
<TranslatableView />
</main>
</div>
);
}
}
ReactDOM.render(
<I18nextProvider i18n={ i18n }><App /></I18nextProvider>,
document.getElementById('app')
);
+56
View File
@@ -0,0 +1,56 @@
// Type definitions for react-i18next 1.6.3
// Project: https://github.com/i18next/react-i18next
// Definitions by: Kostya Esmukov <https://github.com/KostyaEsmukov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference path="../react/react.d.ts"/>
///<reference path="../react-router/react-router.d.ts"/>
///<reference path="../i18next/i18next.d.ts" />
declare namespace ReactI18next {
import React = __React;
// Extend your component's Prop interface with this one to get access to `this.props.t`
//
// interface MyComponentProps extends ReactI18next.InjectedTranslateProps {}
export interface InjectedTranslateProps {
t?: I18next.TranslationFunction;
}
interface I18nextProviderProps {
i18n: I18next.I18n;
children?: React.ReactElement<any>;
}
export class I18nextProvider extends React.Component<I18nextProviderProps, {}> { }
type InterpolateValue = string | JSX.Element;
interface InterpolateProps {
i18nKey: string;
parent?: string;
regexp?: RegExp;
options?: I18next.TranslationOptions;
[regexKey: string]: InterpolateValue | RegExp | I18next.TranslationOptions;
}
export class Interpolate extends React.Component<InterpolateProps, {}> { }
interface TranslateOptions {
withRef?: boolean;
wait?: boolean;
}
export function translate(namespaces?: string[] | string, options?: TranslateOptions): <C extends Function>(WrappedComponent: C) => C;
export function loadNamespaces({ components, i18n }: { components: ReactRouter.RouteComponent[], i18n: I18next.I18n }): Promise<void>;
}
declare module 'react-i18next' {
export = ReactI18next;
}
+19
View File
@@ -141,6 +141,25 @@ class SelectTest extends React.Component<React.Props<{}>, {}> {
}
}
class SelectWithStringValueTest extends React.Component<React.Props<{}>, {}> {
render() {
const options: Option[] = [{ label: "Foo", value: "bar" }];
const onChange = (value: any) => console.log(value);
const selectProps: ReactSelectProps = {
name: "test-select-with-string-value",
value: "bar",
options: options,
onChange: onChange
};
return <div>
<Select {...selectProps} />
</div>;
}
}
class SelectAsyncTest extends React.Component<React.Props<{}>, {}> {
render() {
+1 -1
View File
@@ -303,7 +303,7 @@ declare namespace ReactSelect {
/**
* initial field value
*/
value?: Option | Option[];
value?: Option | Option[] | string | string[] | number | number[];
/**
* the option property to use for the value
* @default "value"
+3 -1
View File
@@ -15,7 +15,9 @@ declare namespace ReactTabs {
onSelect?: (index: number, last: number) => void;
}
interface Tabs extends __React.ComponentClass<TabsProps> {}
interface Tabs extends __React.ComponentClass<TabsProps> {
setUseDefaultStyles: (use: boolean) => void;
}
interface TabListProps {
className?: string;
+15
View File
@@ -178,6 +178,8 @@ declare namespace __React {
[key: string]: ReactInstance
};
}
class PureComponent<P, S> extends Component<P, S> {}
interface ClassicComponent<P, S> extends Component<P, S> {
replaceState(nextState: S, callback?: () => any): void;
@@ -275,6 +277,7 @@ declare namespace __React {
nativeEvent: Event;
preventDefault(): void;
stopPropagation(): void;
persist(): void;
target: EventTarget;
timeStamp: Date;
type: string;
@@ -2476,6 +2479,7 @@ declare namespace JSX {
circle: React.SVGProps;
clipPath: React.SVGProps;
defs: React.SVGProps;
desc: React.SVGProps;
ellipse: React.SVGProps;
feBlend: React.SVGProps;
feColorMatrix: React.SVGProps;
@@ -2484,14 +2488,21 @@ declare namespace JSX {
feConvolveMatrix: React.SVGProps;
feDiffuseLighting: React.SVGProps;
feDisplacementMap: React.SVGProps;
feDistantLight: React.SVGProps;
feFlood: React.SVGProps;
feFuncA: React.SVGProps;
feFuncB: React.SVGProps;
feFuncG: React.SVGProps;
feFuncR: React.SVGProps;
feGaussianBlur: React.SVGProps;
feImage: React.SVGProps;
feMerge: React.SVGProps;
feMergeNode: React.SVGProps;
feMorphology: React.SVGProps;
feOffset: React.SVGProps;
fePointLight: React.SVGProps;
feSpecularLighting: React.SVGProps;
feSpotLight: React.SVGProps;
feTile: React.SVGProps;
feTurbulence: React.SVGProps;
filter: React.SVGProps;
@@ -2502,6 +2513,7 @@ declare namespace JSX {
linearGradient: React.SVGProps;
marker: React.SVGProps;
mask: React.SVGProps;
metadata: React.SVGProps;
path: React.SVGProps;
pattern: React.SVGProps;
polygon: React.SVGProps;
@@ -2509,9 +2521,12 @@ declare namespace JSX {
radialGradient: React.SVGProps;
rect: React.SVGProps;
stop: React.SVGProps;
switch: React.SVGProps;
symbol: React.SVGProps;
text: React.SVGProps;
textPath: React.SVGProps;
tspan: React.SVGProps;
use: React.SVGProps;
view: React.SVGProps;
}
}
+22
View File
@@ -27,6 +27,28 @@ redis.print(err, value);
client = redis.createClient(num, str, options);
// Test the `retry_strategy` property
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
function retryStrategyNumber(options: redis.RetryStrategyOptions): number {
// Ensure that the properties of RetryStrategyOptions are resilient to breaking change.
// If the properties of the interface changes, the variables below will also need to be adapted.
var error: Error = options.error;
var total_retry_time: number = options.total_retry_time;
var times_connected: number = options.times_connected;
var attempt: number = options.attempt;
return 5000;
}
function retryStrategyError(options: redis.RetryStrategyOptions): Error {
return new Error('Foo');
}
client = redis.createClient({
retry_strategy: retryStrategyNumber
});
client = redis.createClient({
retry_strategy: retryStrategyError
});
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
bool = client.connected;
num = client.retry_delay;
num = client.retry_backoff;
+12
View File
@@ -34,6 +34,17 @@ declare module "redis" {
versions: number[];
}
export interface RetryStrategyOptions {
error: Error;
total_retry_time: number;
times_connected: number;
attempt: number;
}
export interface RetryStrategy {
(options: RetryStrategyOptions): number | Error;
}
export interface ClientOpts {
parser?: string;
return_buffers?: boolean;
@@ -50,6 +61,7 @@ declare module "redis" {
family?: string;
command_queue_high_water?: number;
command_queue_low_water?: number;
retry_strategy?: RetryStrategy;
}
export interface RedisClient extends NodeJS.EventEmitter {
+2 -2
View File
@@ -39,7 +39,7 @@ declare module 'redux-form' {
* The error for this field if its value is not passing validation. Both
* synchronous and asynchronous validation errors will be reported here.
*/
error?: string;
error?: string[];
/**
* The value for this field as supplied in initialValues to the form.
@@ -163,7 +163,7 @@ declare module 'redux-form' {
* result from the synchronous validation function, the asynchronous
* validation, or the rejected promise from onSubmit.
*/
error?: string;
error?: string[];
/**
* The form data, in the form { field1: <Object>, field2: <Object> }. The
+10
View File
@@ -6,6 +6,7 @@ import { reducer, createMiddleware, createLoader } from "redux-storage";
import reduxStorageImmutableMerger from "redux-storage-merger-immutablejs";
import filter from "redux-storage-decorator-filter";
import createEngine from "redux-storage-engine-localstorage";
import createReactNativeAsyncStorageEngine from "redux-storage-engine-reactnativeasyncstorage";
interface TestState {
a: number;
@@ -29,3 +30,12 @@ const store = applyMiddleware(storageMiddleware)(createStore)(enhancedReducer);
initialStateLoader(store).then(() => {
// render app
})
// Test for React Native Async Storage engine
const storageEngineReactNative = createReactNativeAsyncStorageEngine("test");
const storageMiddlewareReactNative = createMiddleware(storageEngine);
const storeReactNative = applyMiddleware(storageMiddlewareReactNative)(createStore)(enhancedReducer);
initialStateLoader(storeReactNative).then(() => {
// render app
})
+12
View File
@@ -96,6 +96,18 @@ declare module "redux-storage-engine-localstorage" {
export default function createEngine(key: string): LocalStorageEngine;
}
declare module "redux-storage-engine-reactnativeasyncstorage" {
import { StorageEngine } from "redux-storage";
export interface ReactNativeAsyncStorageEngine extends StorageEngine {}
/**
* Create React Native Async Storage
* @param key React Native Async Storage key
*/
export default function createEngine(key: string): ReactNativeAsyncStorageEngine;
}
declare module "redux-storage-merger-immutablejs" {
import { StateMerger } from "redux-storage";
+2 -2
View File
@@ -134,11 +134,11 @@ declare namespace rosie {
* Factory.define('Person').sequence('id');
*
* @param {string} attr
* @param {Array.<string>=} dependencies
* @param {Array.<string>=} | Function dependencies or builder
* @param {function(number): *=} builder
* @return {Factory}
*/
sequence(name: string, dependencies?: string[], builder?: Function) : IFactory;
sequence(name: string, dependenciesOrBuilder?: Function | string[], builder?: Function) : IFactory;
/**
* Sets a post-processor callback that will receive built objects and the
+2
View File
@@ -27,6 +27,7 @@ str = mod.inc(str, str, loose);
num = mod.major(str, loose);
num = mod.minor(str, loose);
num = mod.patch(str, loose);
strArr = mod.prerelease(str, loose);
// Comparison
bool = mod.gt(v1, v2, loose);
@@ -44,6 +45,7 @@ diff = mod.diff(v1, v2, loose);
str = mod.validRange(str, loose);
bool = mod.satisfies(version, str, loose);
str = mod.maxSatisfying(versions, str, loose);
str = mod.minSatisfying(versions, str, loose);
bool = mod.gtr(version, str, loose);
bool = mod.ltr(version, str, loose);
bool = mod.outside(version, str, str, loose);
+9 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for semver v4.3.4
// Type definitions for semver v5.3.0
// Project: https://github.com/npm/node-semver
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/semver
@@ -28,6 +28,10 @@ declare namespace SemVerModule {
* Return the patch version number.
*/
function patch(v: string, loose?: boolean): number;
/**
* Returns an array of prerelease components, or null if none exist.
*/
function prerelease(v: string, loose?: boolean): string[];
// Comparison
/**
@@ -84,6 +88,10 @@ declare namespace SemVerModule {
* Return the highest version in the list that satisfies the range, or null if none of them do.
*/
function maxSatisfying(versions: string[], range: string, loose?: boolean): string;
/**
* Return the lowest version in the list that satisfies the range, or null if none of them do.
*/
function minSatisfying(versions: string[], range: string, loose?: boolean): string;
/**
* Return true if version is greater than all the versions possible in the range.
*/

Some files were not shown because too many files have changed in this diff Show More