mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -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(() => { }, () => { });
|
||||
Vendored
+112
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
/// <reference path="./alexa-sdk.d.ts" />
|
||||
|
||||
import * as Alexa from "alexa-sdk";
|
||||
|
||||
exports.handler = function(event: Alexa.RequestBody, context: Alexa.Context, callback: Function) {
|
||||
let alexa = Alexa.handler(event, context);
|
||||
alexa.registerHandlers(handlers);
|
||||
alexa.execute();
|
||||
};
|
||||
|
||||
let handlers: Alexa.Handlers = {
|
||||
'LaunchRequest': function () {
|
||||
var self: Alexa.Handler = this;
|
||||
self.emit('SayHello');
|
||||
},
|
||||
'HelloWorldIntent': function () {
|
||||
var self: Alexa.Handler = this;
|
||||
self.emit('SayHello');
|
||||
},
|
||||
'SayHello': function () {
|
||||
var self: Alexa.Handler = this;
|
||||
self.emit(':tell', 'Hello World!');
|
||||
}
|
||||
};
|
||||
Vendored
+132
@@ -0,0 +1,132 @@
|
||||
// Type definitions for Alexa SDK for Node.js v1.0.3
|
||||
// Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs
|
||||
// Definitions by: Pete Beegle <https://github.com/petebeegle>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'alexa-sdk' {
|
||||
export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject;
|
||||
export function CreateStateHandler(state: string, obj: any): any;
|
||||
export var StateString: string;
|
||||
|
||||
interface AlexaObject {
|
||||
_event: any;
|
||||
_context: any;
|
||||
_callback: any;
|
||||
state: any;
|
||||
appId: any;
|
||||
response: any;
|
||||
dynamoDBTableName: any;
|
||||
saveBeforeResponse: boolean;
|
||||
registerHandlers: (...handlers: Handlers[]) => any;
|
||||
execute: () => void;
|
||||
}
|
||||
|
||||
interface Handlers {
|
||||
[intent: string]: () => void;
|
||||
}
|
||||
|
||||
interface Handler {
|
||||
on: any;
|
||||
emit(event: string, ...args: any[]): boolean;
|
||||
emitWithState: any;
|
||||
state: any;
|
||||
handler: any;
|
||||
event: RequestBody;
|
||||
attributes: any;
|
||||
context: any;
|
||||
name: any;
|
||||
isOverriden: any;
|
||||
}
|
||||
|
||||
interface Context {
|
||||
callbackWaitsForEmptyEventLoop: boolean;
|
||||
logGroupName: string;
|
||||
logStreamName: string;
|
||||
functionName: string;
|
||||
memoryLimitInMB: string;
|
||||
functionVersion: string;
|
||||
invokeid: string;
|
||||
awsRequestId: string;
|
||||
}
|
||||
|
||||
interface RequestBody {
|
||||
version: string;
|
||||
session: Session;
|
||||
request: LaunchRequest | IntentRequest | SessionEndedRequest;
|
||||
}
|
||||
|
||||
interface Session {
|
||||
new: boolean;
|
||||
sessionId: string;
|
||||
attributes: any;
|
||||
application: SessionApplication;
|
||||
user: SessionUser;
|
||||
}
|
||||
|
||||
interface SessionApplication {
|
||||
applicationId: string;
|
||||
}
|
||||
|
||||
interface SessionUser {
|
||||
userId: string;
|
||||
accessToken: string;
|
||||
}
|
||||
|
||||
interface LaunchRequest extends IRequest {}
|
||||
|
||||
interface IntentRequest extends IRequest {
|
||||
intent: Intent;
|
||||
}
|
||||
|
||||
interface Intent {
|
||||
name: string;
|
||||
slots: any;
|
||||
}
|
||||
|
||||
interface SessionEndedRequest extends IRequest{
|
||||
reason: string;
|
||||
}
|
||||
|
||||
interface IRequest {
|
||||
type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest";
|
||||
requestId: string;
|
||||
timeStamp: string;
|
||||
}
|
||||
|
||||
interface ResponseBody {
|
||||
version: string;
|
||||
sessionAttributes?: any;
|
||||
response: Response;
|
||||
}
|
||||
|
||||
interface Response {
|
||||
outputSpeech?: OutputSpeech;
|
||||
card?: Card;
|
||||
reprompt?: Reprompt;
|
||||
shouldEndSession: boolean;
|
||||
}
|
||||
|
||||
interface OutputSpeech {
|
||||
type: "PlainText" | "SSML";
|
||||
text?: string;
|
||||
ssml?: string;
|
||||
}
|
||||
|
||||
interface Card {
|
||||
type: "Simple" | "Standard" | "LinkAccount";
|
||||
title?: string;
|
||||
content?: string;
|
||||
text?: string;
|
||||
image?: Image;
|
||||
}
|
||||
|
||||
interface Image {
|
||||
smallImageUrl: string;
|
||||
largeImageUrl: string;
|
||||
}
|
||||
|
||||
interface Reprompt {
|
||||
outputSpeech: OutputSpeech;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -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;
|
||||
|
||||
Vendored
+14
-1
@@ -26,6 +26,19 @@ 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;
|
||||
|
||||
/** Set a method to be called before initializing the chart.
|
||||
* When the method is called, the chart instance is passed as an attribute.
|
||||
* You can use this feature to preprocess chart data or do some other things you need
|
||||
* before initializing the chart.
|
||||
* @param {Function} handler - The method to be called.
|
||||
* @param {string[]} types - Which chart types should call this method. Defaults to all
|
||||
* if none is passed.
|
||||
*/
|
||||
function addInitHandler(handler: Function, types: string[]);
|
||||
|
||||
/** 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
|
||||
@@ -1003,7 +1016,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
bold - specifies if text is bold (true/false),
|
||||
url - url
|
||||
*/
|
||||
addLabel(x: number, y: number, text: string, align: string, size: number, color: string, rotation: number, alpha: number, bold: boolean, url: string);
|
||||
addLabel(x: number|string, y: number|string, text: string, align: string, size?: number, color?: string, rotation?: number, alpha?: number, bold?: boolean, url?: string);
|
||||
/** Adds a legend to the chart.
|
||||
By default, you don't need to create div for your legend, however if you want it to be positioned in some different way, you can create div anywhere you want and pass id or reference to your div as a second parameter.
|
||||
(NOTE: This method will not work on StockPanel.)
|
||||
|
||||
+28
-5
@@ -247,6 +247,7 @@ declare namespace angular.material {
|
||||
extendPalette(name: string, palette: IPalette): IPalette;
|
||||
setDefaultTheme(theme: string): void;
|
||||
alwaysWatchTheme(alwaysWatch: boolean): void;
|
||||
setNonce(nonce: string): void;
|
||||
}
|
||||
|
||||
interface IDateLocaleProvider {
|
||||
@@ -298,6 +299,7 @@ declare namespace angular.material {
|
||||
locals?: {[index: string]: any};
|
||||
resolve?: {[index: string]: angular.IPromise<any>}
|
||||
attachTo?: string|JQuery|Element;
|
||||
propagateContainerEvents?: boolean;
|
||||
panelClass?: string;
|
||||
zIndex?: number; // default: 80
|
||||
position?: IPanelPosition;
|
||||
@@ -330,16 +332,18 @@ declare namespace angular.material {
|
||||
addClass(newClass: string): void;
|
||||
removeClass(oldClass: string): void;
|
||||
toggleClass(toggleClass: string): void;
|
||||
focusOnOpen(): void;
|
||||
updatePosition(position: IPanelPosition): void;
|
||||
}
|
||||
|
||||
interface IPanelPosition {
|
||||
absolute(): IPanelPosition;
|
||||
relativeTo(someElement: string|JQuery|Element): IPanelPosition;
|
||||
top(opt_top: string): IPanelPosition; // default: '0'
|
||||
bottom(opt_bottom: string): IPanelPosition; // default: '0'
|
||||
left(opt_left: string): IPanelPosition; // default: '0'
|
||||
right(opt_right: string): IPanelPosition; // default: '0'
|
||||
top(top?: string): IPanelPosition; // default: '0'
|
||||
bottom(bottom?: string): IPanelPosition; // default: '0'
|
||||
start(start?: string): IPanelPosition; // default: '0'
|
||||
end(end?: string): IPanelPosition; // default: '0'
|
||||
left(left?: string): IPanelPosition; // default: '0'
|
||||
right(right?: string): IPanelPosition; // default: '0'
|
||||
centerHorizontally(): IPanelPosition;
|
||||
centerVertically(): IPanelPosition;
|
||||
center(): IPanelPosition;
|
||||
@@ -359,5 +363,24 @@ declare namespace angular.material {
|
||||
open(opt_config: IPanelConfig): angular.IPromise<IPanelRef>;
|
||||
newPanelPosition(): IPanelPosition;
|
||||
newPanelAnimation(): IPanelAnimation;
|
||||
xPosition: {
|
||||
CENTER: string,
|
||||
ALIGN_START: string,
|
||||
ALIGN_END: string,
|
||||
OFFSET_START: string,
|
||||
OFFSET_END: string,
|
||||
};
|
||||
yPosition: {
|
||||
CENTER: string,
|
||||
ALIGN_TOPS: string,
|
||||
ALIGN_BOTTOMS: string,
|
||||
ABOVE: string,
|
||||
BELOW: string,
|
||||
};
|
||||
animation: {
|
||||
SLIDE: string,
|
||||
SCALE: string,
|
||||
FADE: string,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
@@ -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
@@ -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;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/// <reference path="angular-ui-router.d.ts" />
|
||||
|
||||
var myApp = angular.module('testModule');
|
||||
import uiRouterModule from "angular-ui-router";
|
||||
var myApp = angular.module("testModule", [uiRouterModule]);
|
||||
|
||||
interface MyAppScope extends ng.IScope {
|
||||
items: string[];
|
||||
@@ -141,7 +142,7 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
private $state: ng.ui.IStateService
|
||||
) {
|
||||
$rootScope.$on("$locationChangeSuccess", (event: ng.IAngularEvent) => this.onLocationChangeSuccess(event));
|
||||
$rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
|
||||
$rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
|
||||
this.onStateNotFound(event, unfoundState, fromState, fromParams));
|
||||
}
|
||||
|
||||
@@ -164,14 +165,14 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private onStateNotFound(event: ng.IAngularEvent,
|
||||
unfoundState: ng.ui.IUnfoundState,
|
||||
fromState: ng.ui.IState,
|
||||
fromParams: {}) {
|
||||
var unfoundTo: string = unfoundState.to;
|
||||
var unfoundToParams: {} = unfoundState.toParams;
|
||||
var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
|
||||
var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
|
||||
}
|
||||
|
||||
private stateServiceTest() {
|
||||
|
||||
+2
-8
@@ -7,13 +7,7 @@
|
||||
|
||||
// Support for AMD require and CommonJS
|
||||
declare module 'angular-ui-router' {
|
||||
// Since angular-ui-router adds providers for a bunch of
|
||||
// injectable dependencies, it doesn't really return any
|
||||
// actual data except the plain string 'ui.router'.
|
||||
//
|
||||
// As such, I don't think anybody will ever use the actual
|
||||
// default value of the module. So I've only included the
|
||||
// the types. (@xogeny)
|
||||
export default "ui.router";
|
||||
export type IState = angular.ui.IState;
|
||||
export type IStateProvider = angular.ui.IStateProvider;
|
||||
export type IUrlMatcher = angular.ui.IUrlMatcher;
|
||||
@@ -109,7 +103,7 @@ declare namespace angular.ui {
|
||||
toParams: {},
|
||||
options: IStateOptions
|
||||
}
|
||||
|
||||
|
||||
interface IStateProvider extends angular.IServiceProvider {
|
||||
state(name:string, config:IState): IStateProvider;
|
||||
state(config:IState): IStateProvider;
|
||||
|
||||
Vendored
+7
-6
@@ -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;
|
||||
|
||||
+1
-1
@@ -790,7 +790,7 @@ declare module Microsoft.ApplicationInsights {
|
||||
}
|
||||
|
||||
declare module 'applicationinsights-js' {
|
||||
export = appInsights;
|
||||
export let AppInsights: Microsoft.ApplicationInsights.IAppInsights;
|
||||
}
|
||||
|
||||
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
|
||||
@@ -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'),
|
||||
|
||||
Vendored
+46
-6
@@ -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,13 +1,165 @@
|
||||
/// <reference path="../auth0/auth0.d.ts" />
|
||||
/// <reference path="auth0.lock.d.ts" />
|
||||
|
||||
var lock: Auth0LockStatic = new Auth0Lock("dsa7d77dsa7d7", "mine.auth0.com");
|
||||
const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID";
|
||||
const DOMAIN = "YOUR_DOMAIN_AT.auth0.com";
|
||||
|
||||
lock.showSignin({
|
||||
connections: ["facebook", "google-oauth2", "twitter", "Username-Password-Authentication"],
|
||||
icon: "https://contoso.com/logo-32.png",
|
||||
socialBigButtons: true
|
||||
},
|
||||
() => {
|
||||
// The Auth0 Widget is now loaded.
|
||||
var lock: Auth0LockStatic = new Auth0Lock(CLIENT_ID, DOMAIN);
|
||||
|
||||
lock.show();
|
||||
lock.hide();
|
||||
lock.logout(() => {});
|
||||
|
||||
// The examples below are lifted from auth0-lock documentation on Github
|
||||
|
||||
// "on" event-driven example
|
||||
|
||||
lock.on("authenticated", function(authResult : any) {
|
||||
lock.getProfile(authResult.idToken, function(error, profile) {
|
||||
if (error) {
|
||||
// Handle error
|
||||
return;
|
||||
}
|
||||
|
||||
localStorage.setItem("idToken", authResult.idToken);
|
||||
localStorage.setItem("profile", JSON.stringify(profile));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// test theme
|
||||
|
||||
var themeOptions : Auth0LockConstructorOptions = {
|
||||
theme: {
|
||||
logo: "https://example.com/assets/logo.png",
|
||||
primaryColor: "green"
|
||||
}
|
||||
};
|
||||
|
||||
new Auth0Lock(CLIENT_ID, DOMAIN, themeOptions);
|
||||
|
||||
// test authentication
|
||||
|
||||
var authOptions : Auth0LockConstructorOptions = {
|
||||
auth: {
|
||||
params: { state: "foo" },
|
||||
redirect: true,
|
||||
redirectUrl: "some url",
|
||||
responseType: "token",
|
||||
sso: true
|
||||
}
|
||||
};
|
||||
|
||||
new Auth0Lock(CLIENT_ID, DOMAIN, authOptions);
|
||||
|
||||
// test multi-variant example
|
||||
|
||||
var multiVariantOptions : Auth0LockConstructorOptions = {
|
||||
container: "myContainer",
|
||||
closable: false,
|
||||
languageDictionary: {
|
||||
signUpTerms: "I agree to the <a href='/terms' target='_new'>terms of service</a> ...",
|
||||
title: "My Company",
|
||||
},
|
||||
autofocus: false
|
||||
};
|
||||
|
||||
new Auth0Lock(CLIENT_ID, DOMAIN, multiVariantOptions);
|
||||
|
||||
// test text-field additional sign up field
|
||||
|
||||
var textFieldOptions : Auth0LockConstructorOptions = {
|
||||
additionalSignUpFields: [{
|
||||
name: "address",
|
||||
placeholder: "enter your address",
|
||||
// The following properties are optional
|
||||
icon: "https://example.com/assests/address_icon.png",
|
||||
prefill: "street 123",
|
||||
validator: function(input : string) {
|
||||
return {
|
||||
valid: input.length >= 10,
|
||||
hint: "Must have 10 or more chars" // optional
|
||||
};
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
||||
new Auth0Lock(CLIENT_ID, DOMAIN, textFieldOptions);
|
||||
|
||||
// test select-field additional sign up field
|
||||
|
||||
var selectFieldOptions : Auth0LockConstructorOptions = {
|
||||
additionalSignUpFields: [{
|
||||
type: "select",
|
||||
name: "location",
|
||||
placeholder: "choose your location",
|
||||
options: [
|
||||
{value: "us", label: "United States"},
|
||||
{value: "fr", label: "France"},
|
||||
{value: "ar", label: "Argentina"}
|
||||
],
|
||||
// The following properties are optional
|
||||
icon: "https://example.com/assests/location_icon.png",
|
||||
prefill: "us"
|
||||
}]
|
||||
};
|
||||
|
||||
new Auth0Lock(CLIENT_ID, DOMAIN, selectFieldOptions);
|
||||
|
||||
// test select-field additional sign up field with callbacks for
|
||||
|
||||
var selectFieldOptionsWithCallbacks : Auth0LockConstructorOptions = {
|
||||
additionalSignUpFields: [{
|
||||
type: "select",
|
||||
name: "location",
|
||||
placeholder: "choose your location",
|
||||
options: function(cb) {
|
||||
// obtain options, in case of error you call cb with the error in the
|
||||
// first arg instead of null
|
||||
|
||||
let options = [
|
||||
{value: "us", label: "United States"},
|
||||
{value: "fr", label: "France"},
|
||||
{value: "ar", label: "Argentina"}
|
||||
];
|
||||
|
||||
cb(null, options);
|
||||
},
|
||||
icon: "https://example.com/assests/location_icon.png",
|
||||
prefill: function(cb) {
|
||||
// obtain prefill, in case of error you call cb with the error in the
|
||||
// first arg instead of null
|
||||
|
||||
let prefill = "us";
|
||||
|
||||
cb(null, prefill);
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
new Auth0Lock(CLIENT_ID, DOMAIN, selectFieldOptionsWithCallbacks);
|
||||
|
||||
// test Avatar options
|
||||
|
||||
var avatarOptions : Auth0LockConstructorOptions = {
|
||||
avatar: {
|
||||
url: (email : string, cb : Auth0LockAvatarUrlCallback) => {
|
||||
// obtain url for email, in case of error you call cb with the error in
|
||||
// the first arg instead of null
|
||||
|
||||
let url = "url";
|
||||
|
||||
cb(null, url);
|
||||
},
|
||||
displayName: (email : string, cb : Auth0LockAvatarDisplayNameCallback) => {
|
||||
// obtain displayName for email, in case of error you call cb with the
|
||||
// error in the first arg instead of null
|
||||
|
||||
let displayName = "displayName";
|
||||
|
||||
cb(null, displayName);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
new Auth0Lock(CLIENT_ID, DOMAIN, avatarOptions);
|
||||
|
||||
Vendored
+98
-55
@@ -1,10 +1,70 @@
|
||||
// Type definitions for Auth0Widget.js
|
||||
// Type definitions for auth0-lock v10.0.1
|
||||
// Project: http://auth0.com
|
||||
// Definitions by: Robert McLaws <https://github.com/advancedrei>
|
||||
// Definitions by: Brian Caruso <https://github.com/carusology>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../auth0/auth0.d.ts" />
|
||||
|
||||
interface Auth0LockAdditionalSignUpFieldOption {
|
||||
value: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
type Auth0LockAdditionalSignUpFieldOptionsCallback =
|
||||
(error: Auth0Error, options: Auth0LockAdditionalSignUpFieldOption[]) => void;
|
||||
|
||||
type Auth0LockAdditionalSignUpFieldOptionsFunction =
|
||||
(callback: Auth0LockAdditionalSignUpFieldOptionsCallback) => void;
|
||||
|
||||
type Auth0LockAdditionalSignUpFieldPrefillCallback =
|
||||
(error: Auth0Error, prefill: string) => void;
|
||||
|
||||
type Auth0LockAdditionalSignUpFieldPrefillFunction =
|
||||
(callback: Auth0LockAdditionalSignUpFieldPrefillCallback) => void;
|
||||
|
||||
interface Auth0LockAdditionalSignUpField {
|
||||
icon?: string;
|
||||
name: string;
|
||||
options?: Auth0LockAdditionalSignUpFieldOption[] | Auth0LockAdditionalSignUpFieldOptionsFunction;
|
||||
placeholder: string;
|
||||
prefill?: string | Auth0LockAdditionalSignUpFieldPrefillFunction;
|
||||
type?: "select" | "text";
|
||||
validator?: (input: string) => { valid: boolean; hint?: string };
|
||||
}
|
||||
|
||||
type Auth0LockAvatarUrlCallback = (error: Auth0Error, url: string) => void;
|
||||
type Auth0LockAvatarDisplayNameCallback = (error: Auth0Error, displayName: string) => void;
|
||||
|
||||
interface Auth0LockAvatarOptions {
|
||||
url: (email: string, callback: Auth0LockAvatarUrlCallback) => void;
|
||||
displayName: (email: string, callback: Auth0LockAvatarDisplayNameCallback) => void;
|
||||
}
|
||||
|
||||
interface Auth0LockThemeOptions {
|
||||
logo?: string;
|
||||
primaryColor?: string;
|
||||
}
|
||||
|
||||
// https://auth0.com/docs/libraries/lock/v10/sending-authentication-parameters
|
||||
interface Auth0LockAuthParamsOptions {
|
||||
access_token?: any;
|
||||
connection_scopes?: any;
|
||||
device?: any;
|
||||
nonce?: any;
|
||||
protocol?: any;
|
||||
request_id?: any;
|
||||
scope?: string;
|
||||
state?: string;
|
||||
}
|
||||
|
||||
interface Auth0LockAuthOptions {
|
||||
params?: Auth0LockAuthParamsOptions;
|
||||
redirect?: boolean;
|
||||
redirectUrl?: string;
|
||||
responseType?: string;
|
||||
sso?: boolean;
|
||||
}
|
||||
|
||||
interface Auth0LockPopupOptions {
|
||||
width: number;
|
||||
height: number;
|
||||
@@ -12,68 +72,51 @@ interface Auth0LockPopupOptions {
|
||||
top: number;
|
||||
}
|
||||
|
||||
interface Auth0LockOptions {
|
||||
authParams?: any;
|
||||
callbackURL?: string;
|
||||
connections?: string[];
|
||||
container?: string;
|
||||
closable?: boolean;
|
||||
dict?: any;
|
||||
defaultUserPasswordConnection?: string;
|
||||
defaultADUsernameFromEmailPrefix?: boolean;
|
||||
disableResetAction?: boolean;
|
||||
disableSignupAction?: boolean;
|
||||
focusInput?: boolean;
|
||||
forceJSONP?: boolean;
|
||||
gravatar?: boolean;
|
||||
integratedWindowsLogin?: boolean;
|
||||
icon?: string;
|
||||
loginAfterSignup?: boolean;
|
||||
popup?: boolean;
|
||||
popupOptions?: Auth0LockPopupOptions;
|
||||
rememberLastLogin?: boolean;
|
||||
resetLink?: string;
|
||||
responseType?: string;
|
||||
signupLink?: string;
|
||||
socialBigButtons?: boolean;
|
||||
sso?: boolean;
|
||||
theme?: string;
|
||||
usernameStyle?: any;
|
||||
}
|
||||
|
||||
interface Auth0LockConstructorOptions {
|
||||
cdn?: string;
|
||||
additionalSignUpFields?: Auth0LockAdditionalSignUpField[];
|
||||
allowedConnections?: string[];
|
||||
allowForgotPassword?: boolean;
|
||||
allowLogin?: boolean;
|
||||
allowSignUp?: boolean;
|
||||
assetsUrl?: string;
|
||||
useCordovaSocialPlugins?: boolean;
|
||||
auth?: Auth0LockAuthOptions;
|
||||
autoclose?: boolean;
|
||||
autofocus?: boolean;
|
||||
avatar?: Auth0LockAvatarOptions;
|
||||
closable?: boolean;
|
||||
container?: string;
|
||||
defaultADUsernameFromEmailPrefix?: string;
|
||||
defaultDatabaseConnection?: string;
|
||||
defaultEnterpriseConnection?: string;
|
||||
forgotPasswordLink?: string;
|
||||
initialScreen?: "login" | "signUp" | "forgotPassword";
|
||||
language?: string;
|
||||
languageDictionary?: any;
|
||||
loginAfterSignup?: boolean;
|
||||
mustAcceptTerms?: boolean;
|
||||
popupOptions?: Auth0LockPopupOptions;
|
||||
prefill?: { email?: string, username?: string};
|
||||
rememberLastLogin?: boolean;
|
||||
signupLink?: string;
|
||||
socialButtonStyle?: "big" | "small";
|
||||
theme?: Auth0LockThemeOptions;
|
||||
usernameStyle?: string;
|
||||
}
|
||||
|
||||
interface Auth0LockStatic {
|
||||
new (clientId: string, domain: string, options?: Auth0LockConstructorOptions): Auth0LockStatic;
|
||||
getProfile(token: string, callback: (error: Auth0Error, profile: Auth0UserProfile) => void) : void;
|
||||
|
||||
show(): void;
|
||||
show(options: Auth0LockOptions): void;
|
||||
show(callback: (error?: Auth0Error, profile?: Auth0UserProfile, token?: string) => void) : void;
|
||||
show(options: Auth0LockOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, token?: string) => void) : void;
|
||||
hide(): void;
|
||||
logout(query: any): void;
|
||||
|
||||
showSignin(): void;
|
||||
showSignin(options: Auth0LockOptions): void;
|
||||
showSignin(callback: (error?: Auth0Error, profile?: Auth0UserProfile, token?: string) => void) : void;
|
||||
showSignin(options: Auth0LockOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, token?: string) => void) : void;
|
||||
|
||||
showSignup(): void;
|
||||
showSignup(options: Auth0LockOptions): void;
|
||||
showSignup(callback: (error?: Auth0Error) => void) : void;
|
||||
showSignup(options: Auth0LockOptions, callback: (error?: Auth0Error) => void) : void;
|
||||
|
||||
showReset(): void;
|
||||
showReset(options: Auth0LockOptions): void;
|
||||
showReset(callback: (error?: Auth0Error) => void) : void;
|
||||
showReset(options: Auth0LockOptions, callback: (error?: Auth0Error) => void) : void;
|
||||
|
||||
hide(callback: () => void): void;
|
||||
logout(callback: () => void): void;
|
||||
|
||||
getClient(): Auth0Static;
|
||||
on(event: "show", callback: () => void) : void;
|
||||
on(event: "hide", callback: () => void) : void;
|
||||
on(event: "unrecoverable_error", callback: (error: Auth0Error) => void) : void;
|
||||
on(event: "authorization_error", callback: (error: Auth0Error) => void) : void;
|
||||
on(event: "authenticated", callback: (authResult: any) => void) : void;
|
||||
on(event: string, callback: (...args: any[]) => void) : void;
|
||||
}
|
||||
|
||||
declare var Auth0Lock: Auth0LockStatic;
|
||||
|
||||
Vendored
+1
@@ -163,6 +163,7 @@ declare namespace autobahn {
|
||||
}
|
||||
|
||||
interface IPublishOptions {
|
||||
acknowledge?: boolean;
|
||||
exclude?: number[];
|
||||
eligible?: number[];
|
||||
disclose_me?: Boolean;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path="autosize.d.ts" />
|
||||
|
||||
// from a NodeList
|
||||
autosize(document.querySelectorAll('textarea'));
|
||||
|
||||
// from a single Node
|
||||
autosize(document.querySelector('textarea'));
|
||||
|
||||
// from a single element
|
||||
autosize(document.getElementById('my-textarea'));
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for jquery.autosize 3.0.7
|
||||
// Project: http://www.jacklmoore.com/autosize/
|
||||
// Definitions by: Aaron T. King <https://github.com/kingdango>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace autosize {
|
||||
interface AutosizeStatic {
|
||||
(el: Element): void;
|
||||
(el: NodeList): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare var autosize: autosize.AutosizeStatic;
|
||||
|
||||
declare module 'autosize' {
|
||||
export = autosize;
|
||||
}
|
||||
@@ -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();
|
||||
Vendored
+43
@@ -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;
|
||||
}
|
||||
Vendored
+1685
-1376
File diff suppressed because it is too large
Load Diff
Vendored
+26
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Backbone 1.0.0
|
||||
// Type definitions for Backbone 1.3.3
|
||||
// Project: http://backbonejs.org/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Natan Vivo <https://github.com/nvivo/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -109,9 +109,15 @@ declare namespace Backbone {
|
||||
|
||||
attributes: any;
|
||||
changed: any[];
|
||||
cidPrefix: string;
|
||||
cid: string;
|
||||
collection: Collection<any>;
|
||||
|
||||
private _changing: boolean;
|
||||
private _previousAttributes : any;
|
||||
private _pending: boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Default attributes for the model. It can be an object hash or a method returning an object hash.
|
||||
* For assigning an object hash, do it like this: this.defaults = <any>{ attribute: value, ... };
|
||||
@@ -147,7 +153,14 @@ declare namespace Backbone {
|
||||
/*private*/ set(attributeName: string, value: any, options?: ModelSetOptions): Model;
|
||||
set(obj: any, options?: ModelSetOptions): Model;
|
||||
|
||||
changedAttributes(attributes?: any): any[];
|
||||
/**
|
||||
* Return an object containing all the attributes that have changed, or
|
||||
* false if there are no changed attributes. Useful for determining what
|
||||
* parts of a view need to be updated and/or what attributes need to be
|
||||
* persisted to the server. Unset attributes will be set to undefined.
|
||||
* You can also pass an attributes object to diff against the model,
|
||||
* determining if there *would be* a change. */
|
||||
changedAttributes(attributes?: any): any;
|
||||
clear(options?: Silenceable): any;
|
||||
clone(): Model;
|
||||
destroy(options?: ModelDestroyOptions): any;
|
||||
@@ -178,6 +191,7 @@ declare namespace Backbone {
|
||||
omit(fn: (value: any, key: any, object: any) => any): any;
|
||||
chain(): any;
|
||||
isEmpty(): boolean;
|
||||
matches(attrs: any): boolean;
|
||||
}
|
||||
|
||||
class Collection<TModel extends Model> extends ModelBase {
|
||||
@@ -208,6 +222,7 @@ declare namespace Backbone {
|
||||
* Get a model from a collection, specified by an id, a cid, or by passing in a model.
|
||||
**/
|
||||
get(id: number|string|Model): TModel;
|
||||
has(key: number|string|Model): boolean;
|
||||
create(attributes: any, options?: ModelSaveOptions): TModel;
|
||||
pluck(attribute: string): any[];
|
||||
push(model: TModel, options?: AddOptions): TModel;
|
||||
@@ -221,10 +236,12 @@ declare namespace Backbone {
|
||||
unshift(model: TModel, options?: AddOptions): TModel;
|
||||
where(properties: any): TModel[];
|
||||
findWhere(properties: any): TModel;
|
||||
modelId(attrs: any) : any
|
||||
|
||||
private _prepareModel(attributes?: any, options?: any): any;
|
||||
private _removeReference(model: TModel): void;
|
||||
private _onModelEvent(event: string, model: TModel, collection: Collection<TModel>, options: any): void;
|
||||
private _isModel(obj: any) : obj is Model;
|
||||
|
||||
/**
|
||||
* Return a shallow copy of this collection's models, using the same options as native Array#slice.
|
||||
@@ -314,6 +331,8 @@ declare namespace Backbone {
|
||||
navigate(fragment: string, options?: NavigateOptions): Router;
|
||||
navigate(fragment: string, trigger?: boolean): Router;
|
||||
|
||||
execute(callback: Function, args: any[], name: string) : void;
|
||||
|
||||
private _bindRoutes(): void;
|
||||
private _routeToRegExp(route: string): RegExp;
|
||||
private _extractParameters(route: RegExp, fragment: string): string[];
|
||||
@@ -330,9 +349,14 @@ declare namespace Backbone {
|
||||
|
||||
getHash(window?: Window): string;
|
||||
getFragment(fragment?: string): string;
|
||||
decodeFragment(fragment: string): string;
|
||||
getSearch(): string;
|
||||
stop(): void;
|
||||
route(route: string, callback: Function): number;
|
||||
checkUrl(e?: any): void;
|
||||
getPath(): string;
|
||||
matchRoot(): boolean;
|
||||
atRoot(): boolean;
|
||||
loadUrl(fragmentOverride?: string): boolean;
|
||||
navigate(fragment: string, options?: any): boolean;
|
||||
static started: boolean;
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Backbone 1.0.0
|
||||
// Type definitions for Backbone 1.3.3
|
||||
// Project: http://backbonejs.org/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Natan Vivo <https://github.com/nvivo/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
Vendored
+6
-1
@@ -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 */
|
||||
|
||||
Vendored
+1
-1
@@ -747,7 +747,7 @@ declare namespace c3 {
|
||||
/**
|
||||
* The radius size of each point.
|
||||
*/
|
||||
r?: number;
|
||||
r?: number | ((d: any) => number);
|
||||
|
||||
focus?: {
|
||||
expand: {
|
||||
|
||||
+21
-21
@@ -16,10 +16,10 @@ declare module "cassandra-driver" {
|
||||
|
||||
namespace policies {
|
||||
namespace addressResolution {
|
||||
var EC2MultiRegionTranslator: EC2MultiRegionTranslatorStatic;
|
||||
var EC2MultiRegionTranslator: EC2MultiRegionTranslatorStatic;
|
||||
|
||||
interface AddressTranslator {
|
||||
translate(address: string, port: number, callback: Callback): void;
|
||||
translate(address: string, port: number, callback: Callback): void;
|
||||
}
|
||||
|
||||
interface EC2MultiRegionTranslatorStatic {
|
||||
@@ -141,7 +141,7 @@ declare module "cassandra-driver" {
|
||||
var Tuple: TupleStatic;
|
||||
var Uuid: UuidStatic;
|
||||
|
||||
enum consistencies {
|
||||
enum consistencies {
|
||||
any = 0,
|
||||
one,
|
||||
two,
|
||||
@@ -154,7 +154,7 @@ declare module "cassandra-driver" {
|
||||
localSerial,
|
||||
localOne
|
||||
}
|
||||
|
||||
|
||||
enum dataTypes {
|
||||
custom = 0,
|
||||
ascii,
|
||||
@@ -204,7 +204,7 @@ declare module "cassandra-driver" {
|
||||
fromString(value: string): BigDecimal;
|
||||
fromNumber(value: number): BigDecimal;
|
||||
}
|
||||
|
||||
|
||||
interface BigDecimal {
|
||||
equals(other: BigDecimal): boolean;
|
||||
inspect(): string;
|
||||
@@ -239,7 +239,7 @@ declare module "cassandra-driver" {
|
||||
|
||||
interface IntegerStatic {
|
||||
new(bits: Array<number>, sign: number): Integer;
|
||||
|
||||
|
||||
fromInt(value: number): Integer;
|
||||
fromNumber(value: number): Integer;
|
||||
fromBits(bits: Array<number>): Integer;
|
||||
@@ -295,7 +295,7 @@ declare module "cassandra-driver" {
|
||||
fromString(value: string): LocalDate;
|
||||
fromBuffer(buffer: Buffer): LocalDate;
|
||||
}
|
||||
|
||||
|
||||
interface LocalDate {
|
||||
_value: number;
|
||||
year: number;
|
||||
@@ -384,7 +384,7 @@ declare module "cassandra-driver" {
|
||||
|
||||
interface TimeUuidStatic {
|
||||
new (value?: Date, ticks?: number, nodeId?: string|Buffer, clockId?: string|Buffer): TimeUuid;
|
||||
|
||||
|
||||
fromDate(date: Date, ticks?: number, nodeId?: string|Buffer, clockId?: string|Buffer): TimeUuid;
|
||||
fromString(value: string): TimeUuid;
|
||||
min(date: Date, ticks?: number): TimeUuid;
|
||||
@@ -408,7 +408,7 @@ declare module "cassandra-driver" {
|
||||
interface Tuple {
|
||||
elements: Array<any>;
|
||||
length: number;
|
||||
|
||||
|
||||
get(index: number): any;
|
||||
toString(): string;
|
||||
toJSON(): string;
|
||||
@@ -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;
|
||||
@@ -513,7 +513,7 @@ declare module "cassandra-driver" {
|
||||
execute(query: string, params?: any, options?: QueryOptions, callback?: ResultCallback): void;
|
||||
getReplicas(keyspace: string, token: Buffer): Array<any>; // TODO: Should this be a more explicit return?
|
||||
shutdown(callback?: Callback): void;
|
||||
stream(query: string, params?: any, options?: QueryOptions, callback?: Callback): void;
|
||||
stream(query: string, params?: any, options?: QueryOptions, callback?: Callback): NodeJS.ReadableStream;
|
||||
}
|
||||
|
||||
interface HostStatic {
|
||||
@@ -549,7 +549,7 @@ declare module "cassandra-driver" {
|
||||
}
|
||||
|
||||
interface EncoderStatic {
|
||||
new(protocolVersion: number, options: ClientOptions) : Encoder;
|
||||
new(protocolVersion: number, options: ClientOptions) : Encoder;
|
||||
}
|
||||
|
||||
interface Encoder {
|
||||
@@ -590,29 +590,29 @@ declare module "cassandra-driver" {
|
||||
}
|
||||
|
||||
class ArgumentError extends DriverError {
|
||||
constructor(message: string);
|
||||
constructor(message: string);
|
||||
}
|
||||
|
||||
class AuthenticationError extends DriverError {
|
||||
constructor(message: string);
|
||||
constructor(message: string);
|
||||
}
|
||||
|
||||
class DriverInternalError extends DriverError {
|
||||
constructor(message: string);
|
||||
constructor(message: string);
|
||||
}
|
||||
|
||||
class NoHostAvailableError extends DriverError {
|
||||
constructor(innerErrors: any, message?: string);
|
||||
constructor(innerErrors: any, message?: string);
|
||||
}
|
||||
|
||||
class NotSupportedError extends DriverError {
|
||||
constructor(message: string);
|
||||
constructor(message: string);
|
||||
}
|
||||
|
||||
class OperationTimedOutError extends DriverError {}
|
||||
|
||||
class ResponseError extends DriverError {
|
||||
constructor(code: number, message: string);
|
||||
constructor(code: number, message: string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -688,7 +688,7 @@ declare module "cassandra-driver" {
|
||||
|
||||
interface IndexStatic {
|
||||
new (name: string, target: string, kind: IndexType, options: Object): Index;
|
||||
|
||||
|
||||
fromRows(indexRows: Array<types.Row>): Array<Index>;
|
||||
fromColumnRows(columnRows: Array<types.Row>, columnsByName: { [key:string]: ColumnInfo }): Array<Index>;
|
||||
}
|
||||
@@ -758,4 +758,4 @@ declare module "cassandra-driver" {
|
||||
replicateOnWrite: boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+8
@@ -24,6 +24,14 @@ declare namespace Chai {
|
||||
value(text: string): Assertion;
|
||||
|
||||
}
|
||||
|
||||
interface Include {
|
||||
|
||||
text(text: string|string[]): Assertion;
|
||||
|
||||
html(text: string|string[]): Assertion;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Vendored
+57
-28
@@ -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;
|
||||
|
||||
Vendored
+39
-3
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+28
-1
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Vendored
+25
-7
@@ -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;
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -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;
|
||||
|
||||
+40
-1
@@ -49,5 +49,44 @@ function printDiff(diff:jsdiff.IDiffResult[]) {
|
||||
console.log(addLineHeader(" ", part.value));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
function verifyPatchMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) {
|
||||
var verifyPatch = jsdiff.parsePatch(
|
||||
jsdiff.createTwoFilesPatch("oldFile.ts", "newFile.ts", oldStr, newStr,
|
||||
"old", "new", { context: 1 }));
|
||||
if (JSON.stringify(verifyPatch) !== JSON.stringify(uniDiff)) {
|
||||
console.error("Patch did not match uniDiff");
|
||||
}
|
||||
}
|
||||
|
||||
function verifyApplyMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) {
|
||||
var verifyApply = [
|
||||
jsdiff.applyPatch(oldStr, uniDiff),
|
||||
jsdiff.applyPatch(oldStr, [uniDiff])
|
||||
];
|
||||
jsdiff.applyPatches([uniDiff], {
|
||||
loadFile: (index: number, callback: (err: Error, data: string) => void) => {
|
||||
callback(undefined, one);
|
||||
},
|
||||
patched: (index: number, content: string) => {
|
||||
verifyApply.push(content);
|
||||
},
|
||||
complete: (err?: Error) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
verifyApply.forEach(result => {
|
||||
if (result !== newStr) {
|
||||
console.error("Result did not match newStr");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
verifyPatchMethods(one, other, uniDiff);
|
||||
var uniDiff = jsdiff.structuredPatch("oldFile.ts", "newFile.ts", one, other,
|
||||
"old", "new", { context: 1 });
|
||||
verifyApplyMethods(one, other, uniDiff);
|
||||
|
||||
Vendored
+30
-2
@@ -16,6 +16,22 @@ declare namespace JsDiff {
|
||||
componenets: IDiffResult[];
|
||||
}
|
||||
|
||||
interface IHunk {
|
||||
oldStart: number;
|
||||
oldLines: number;
|
||||
newStart: number;
|
||||
newLines: number;
|
||||
lines: string[];
|
||||
}
|
||||
|
||||
interface IUniDiff {
|
||||
oldFileName: string;
|
||||
newFileName: string;
|
||||
oldHeader: string;
|
||||
newHeader: string;
|
||||
hunks: IHunk[];
|
||||
}
|
||||
|
||||
class Diff {
|
||||
ignoreWhitespace:boolean;
|
||||
|
||||
@@ -46,9 +62,21 @@ declare namespace JsDiff {
|
||||
|
||||
function diffCss(oldStr:string, newStr:string):IDiffResult[];
|
||||
|
||||
function createPatch(fileName:string, oldStr:string, newStr:string, oldHeader:string, newHeader:string):string;
|
||||
function createPatch(fileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string;
|
||||
|
||||
function applyPatch(oldStr:string, uniDiff:string):string;
|
||||
function createTwoFilesPatch(oldFileName: string, newFileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string;
|
||||
|
||||
function structuredPatch(oldFileName: string, newFileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): IUniDiff;
|
||||
|
||||
function applyPatch(oldStr: string, uniDiff: string | IUniDiff | IUniDiff[]): string;
|
||||
|
||||
function applyPatches(uniDiff: IUniDiff[], options: {
|
||||
loadFile: (index: number, callback: (err: Error, data: string) => void) => void,
|
||||
patched: (index: number, content: string) => void,
|
||||
complete: (err?: Error) => void
|
||||
}): void;
|
||||
|
||||
function parsePatch(diffStr: string, options?: {strict: boolean}): IUniDiff[];
|
||||
|
||||
function convertChangesToXML(changes:IDiffResult[]):string;
|
||||
|
||||
|
||||
@@ -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();
|
||||
Vendored
+8972
File diff suppressed because it is too large
Load Diff
Vendored
+36
-2
@@ -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;
|
||||
|
||||
@@ -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!');
|
||||
|
||||
|
||||
Vendored
+94
-298
@@ -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;
|
||||
}
|
||||
|
||||
Vendored
+10
-10
@@ -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.
|
||||
|
||||
+16
-6
@@ -192,9 +192,10 @@ declare module "express-serve-static-core" {
|
||||
* req.accepts('html, json');
|
||||
* // => "json"
|
||||
*/
|
||||
accepts(type: string): string;
|
||||
|
||||
accepts(type: string[]): string;
|
||||
accepts(): string[];
|
||||
accepts(type: string): string | boolean;
|
||||
accepts(type: string[]): string | boolean;
|
||||
accepts(...type: string[]): string | boolean;
|
||||
|
||||
/**
|
||||
* Returns the first accepted charset of the specified character sets,
|
||||
@@ -204,7 +205,10 @@ declare module "express-serve-static-core" {
|
||||
* For more information, or if you have issues or concerns, see accepts.
|
||||
* @param charset
|
||||
*/
|
||||
acceptsCharsets(charset?: string | string[]): string[];
|
||||
acceptsCharsets(): string[];
|
||||
acceptsCharsets(charset: string): string | boolean;
|
||||
acceptsCharsets(charset: string[]): string | boolean;
|
||||
acceptsCharsets(...charset: string[]): string | boolean;
|
||||
|
||||
/**
|
||||
* Returns the first accepted encoding of the specified encodings,
|
||||
@@ -214,7 +218,10 @@ declare module "express-serve-static-core" {
|
||||
* For more information, or if you have issues or concerns, see accepts.
|
||||
* @param encoding
|
||||
*/
|
||||
acceptsEncodings(encoding?: string | string[]): string[];
|
||||
acceptsEncodings(): string[];
|
||||
acceptsEncodings(encoding: string): string | boolean;
|
||||
acceptsEncodings(encoding: string[]): string | boolean;
|
||||
acceptsEncodings(...encoding: string[]): string | boolean;
|
||||
|
||||
/**
|
||||
* Returns the first accepted language of the specified languages,
|
||||
@@ -225,7 +232,10 @@ declare module "express-serve-static-core" {
|
||||
*
|
||||
* @param lang
|
||||
*/
|
||||
acceptsLanguages(lang?: string | string[]): string[];
|
||||
acceptsLanguages(): string[];
|
||||
acceptsLanguages(lang: string): string | boolean;
|
||||
acceptsLanguages(lang: string[]): string | boolean;
|
||||
acceptsLanguages(...lang: string[]): string | boolean;
|
||||
|
||||
/**
|
||||
* Parse Range header field,
|
||||
|
||||
@@ -50,6 +50,26 @@ router.delete(pathRE);
|
||||
router.use((req, res, next) => { next(); })
|
||||
router.route('/users')
|
||||
.get((req, res, next) => {
|
||||
let types: string[] = req.accepts();
|
||||
let type: string | boolean = req.accepts('json');
|
||||
type = req.accepts(['json', 'text']);
|
||||
type = req.accepts('json', 'text');
|
||||
|
||||
let charsets: string[] = req.acceptsCharsets();
|
||||
let charset: string | boolean = req.acceptsCharsets('utf-8');
|
||||
charset = req.acceptsCharsets(['utf-8', 'utf-16']);
|
||||
charset = req.acceptsCharsets('utf-8', 'utf-16');
|
||||
|
||||
let encodings: string[] = req.acceptsEncodings();
|
||||
let encoding: string | boolean = req.acceptsEncodings('gzip');
|
||||
encoding = req.acceptsEncodings(['gzip', 'deflate']);
|
||||
encoding = req.acceptsEncodings('gzip', 'deflate');
|
||||
|
||||
let languages: string[] = req.acceptsLanguages();
|
||||
let language: string | boolean = req.acceptsLanguages('en');
|
||||
language = req.acceptsLanguages(['en', 'ja']);
|
||||
language = req.acceptsLanguages('en', 'ja');
|
||||
|
||||
res.send(req.query['token']);
|
||||
});
|
||||
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+67
@@ -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
|
||||
}
|
||||
Vendored
+18
-1
@@ -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;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/// <reference path="get-port.d.ts" />
|
||||
|
||||
import * as getPort from "get-port";
|
||||
|
||||
getPort().then(port => {
|
||||
console.log(port);
|
||||
});
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for ajv
|
||||
// Project: https://github.com/sindresorhus/get-port
|
||||
// Definitions by: York Yao <https://github.com/plantain-00/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "get-port" {
|
||||
var getPort: () => PromiseLike<number>
|
||||
export = getPort;
|
||||
}
|
||||
@@ -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());
|
||||
@@ -946,3 +985,15 @@ app.on('ready', function () {
|
||||
|
||||
console.log(webContents.getAllWebContents());
|
||||
console.log(webContents.getFocusedWebContents());
|
||||
|
||||
var win = new BrowserWindow({
|
||||
webPreferences: {
|
||||
offscreen: true
|
||||
}
|
||||
});
|
||||
|
||||
win.webContents.on('paint', (event, dirty, image) => {
|
||||
console.log(dirty, image.getBitmap());
|
||||
});
|
||||
|
||||
win.loadURL('http://github.com');
|
||||
|
||||
Vendored
+232
-57
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Electron v1.3.1
|
||||
// Type definitions for Electron v1.3.3
|
||||
// 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
|
||||
|
||||
/**
|
||||
@@ -282,13 +299,13 @@ declare namespace Electron {
|
||||
* Note: This is only implemented on macOS and Windows.
|
||||
* On macOS, you can only register protocols that have been added to your app's info.plist.
|
||||
*/
|
||||
setAsDefaultProtocolClient(protocol: string): void;
|
||||
setAsDefaultProtocolClient(protocol: string): boolean;
|
||||
/**
|
||||
* Removes the current executable as the default handler for a protocol (aka URI scheme).
|
||||
*
|
||||
* Note: This is only implemented on macOS and Windows.
|
||||
*/
|
||||
removeAsDefaultProtocolClient(protocol: string): void;
|
||||
removeAsDefaultProtocolClient(protocol: string): boolean;
|
||||
/**
|
||||
* @returns Whether the current executable is the default handler for a protocol (aka URI scheme).
|
||||
*
|
||||
@@ -300,7 +317,7 @@ declare namespace Electron {
|
||||
*
|
||||
* Note: This API is only available on Windows.
|
||||
*/
|
||||
setUserTasks(tasks: Task[]): void;
|
||||
setUserTasks(tasks: Task[]): boolean;
|
||||
/**
|
||||
* This method makes your application a Single Instance Application instead of allowing
|
||||
* multiple instances of your app to run, this will ensure that only a single instance
|
||||
@@ -332,6 +349,8 @@ declare namespace Electron {
|
||||
getCurrentActivityType(): string;
|
||||
/**
|
||||
* Changes the Application User Model ID to id.
|
||||
*
|
||||
* Note: This is only implemented on Windows.
|
||||
*/
|
||||
setAppUserModelId(id: string): void;
|
||||
/**
|
||||
@@ -473,6 +492,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.
|
||||
*
|
||||
@@ -783,6 +809,10 @@ declare namespace Electron {
|
||||
* @returns Whether the window is focused.
|
||||
*/
|
||||
isFocused(): boolean;
|
||||
/**
|
||||
* @returns Whether the window is destroyed.
|
||||
*/
|
||||
isDestroyed(): boolean;
|
||||
/**
|
||||
* Shows and gives focus to the window.
|
||||
*/
|
||||
@@ -844,7 +874,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.
|
||||
*/
|
||||
@@ -853,6 +883,14 @@ declare namespace Electron {
|
||||
* @returns The window's width, height, x and y values.
|
||||
*/
|
||||
getBounds(): Rectangle;
|
||||
/**
|
||||
* Resizes and moves the window's client area (e.g. the web page) to width, height, x, y.
|
||||
*/
|
||||
setContentBounds(options: Rectangle, animate?: boolean): void;
|
||||
/**
|
||||
* @returns The window's client area (e.g. the web page) width, height, x and y values.
|
||||
*/
|
||||
getContentBounds(): Rectangle;
|
||||
/**
|
||||
* Resizes the window to width and height.
|
||||
*/
|
||||
@@ -1077,7 +1115,13 @@ declare namespace Electron {
|
||||
* @param progress Valid range is [0, 1.0]. If < 0, the progress bar is removed.
|
||||
* If greater than 0, it becomes indeterminate.
|
||||
*/
|
||||
setProgressBar(progress: number): void;
|
||||
setProgressBar(progress: number, options?: {
|
||||
/**
|
||||
* Mode for the progress bar.
|
||||
* Note: This is only implemented on Windows.
|
||||
*/
|
||||
mode: 'none' | 'normal' | 'indeterminate' | 'error' | 'paused'
|
||||
}): void;
|
||||
/**
|
||||
* Sets a 16px overlay onto the current Taskbar icon, usually used to convey
|
||||
* some sort of application status or to passively notify the user.
|
||||
@@ -1112,7 +1156,12 @@ declare namespace Electron {
|
||||
*
|
||||
* Note: This API is available only on Windows.
|
||||
*/
|
||||
setThumbnailClip(region: Bounds): void;
|
||||
setThumbnailClip(region: Rectangle): boolean;
|
||||
/**
|
||||
* Sets the toolTip that is displayed when hovering over the window thumbnail in the taskbar.
|
||||
* Note: This API is available only on Windows.
|
||||
*/
|
||||
setThumbnailToolTip(toolTip: string): boolean;
|
||||
/**
|
||||
* Same as webContents.showDefinitionForSelection().
|
||||
* Note: This API is available only on macOS.
|
||||
@@ -1355,12 +1404,17 @@ declare namespace Electron {
|
||||
defaultEncoding?: string;
|
||||
/**
|
||||
* Whether to throttle animations and timers when the page becomes background.
|
||||
* Default: true
|
||||
* Default: true.
|
||||
*/
|
||||
backgroundThrottling?: boolean;
|
||||
/**
|
||||
* Whether to enable offscreen rendering for the browser window.
|
||||
* Default: false.
|
||||
*/
|
||||
offscreen?: boolean;
|
||||
}
|
||||
|
||||
interface BrowserWindowOptions extends Rectangle {
|
||||
interface BrowserWindowOptions {
|
||||
/**
|
||||
* Window’s width in pixels.
|
||||
* Default: 800.
|
||||
@@ -1570,13 +1624,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 +1900,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 +2086,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.
|
||||
*/
|
||||
@@ -2244,8 +2296,8 @@ declare namespace Electron {
|
||||
}
|
||||
|
||||
type MenuItemType = 'normal' | 'separator' | 'submenu' | 'checkbox' | 'radio';
|
||||
type MenuItemRole = 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteandmatchstyle' | 'selectall' | 'delete' | 'minimize' | 'close' | 'quit' | 'togglefullscreen';
|
||||
type MenuItemRoleMac = 'about' | 'hide' | 'hideothers' | 'unhide' | 'front' | 'zoom' | 'window' | 'help' | 'services';
|
||||
type MenuItemRole = 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteandmatchstyle' | 'selectall' | 'delete' | 'minimize' | 'close' | 'quit' | 'togglefullscreen' | 'resetzoom' | 'zoomin' | 'zoomout';
|
||||
type MenuItemRoleMac = 'about' | 'hide' | 'hideothers' | 'unhide' | 'startspeaking' | 'stopspeaking' | 'front' | 'zoom' | 'window' | 'help' | 'services';
|
||||
|
||||
interface MenuItemOptions {
|
||||
/**
|
||||
@@ -2428,13 +2480,25 @@ 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 a copy of the image's raw bitmap pixel data.
|
||||
*/
|
||||
toBitmap(): Buffer;
|
||||
/**
|
||||
* @returns Buffer that contains the image's raw bitmap pixel data.
|
||||
*
|
||||
* The difference between getBitmap() and toBitmap() is, getBitmap() does not copy the bitmap data,
|
||||
* so you have to use the returned Buffer immediately in current event loop tick,
|
||||
* otherwise the data might be changed or destroyed.
|
||||
*/
|
||||
getBitmap(): Buffer;
|
||||
/**
|
||||
* @returns string The data URL of the image.
|
||||
*/
|
||||
@@ -2452,7 +2516,7 @@ declare namespace Electron {
|
||||
/**
|
||||
* @returns {} The size of the image.
|
||||
*/
|
||||
getSize(): Dimension;
|
||||
getSize(): Size;
|
||||
/**
|
||||
* Marks the image as template image.
|
||||
*/
|
||||
@@ -2675,10 +2739,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 +2754,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 +2793,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 +3304,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
|
||||
@@ -3271,6 +3374,26 @@ declare namespace Electron {
|
||||
* Note: This is only implemented on macOS.
|
||||
*/
|
||||
isDarkMode(): boolean;
|
||||
/**
|
||||
* @returns If the Swipe between pages setting is on.
|
||||
*
|
||||
* Note: This is only implemented on macOS.
|
||||
*/
|
||||
isSwipeTrackingFromScrollEventsEnabled(): boolean;
|
||||
/**
|
||||
* Posts event as native notifications of macOS.
|
||||
* The userInfo contains the user information dictionary sent along with the notification.
|
||||
*
|
||||
* Note: This is only implemented on macOS.
|
||||
*/
|
||||
postNotification(event: string, userInfo: Object): void;
|
||||
/**
|
||||
* Posts event as native notifications of macOS.
|
||||
* The userInfo contains the user information dictionary sent along with the notification.
|
||||
*
|
||||
* Note: This is only implemented on macOS.
|
||||
*/
|
||||
postLocalNotification(event: string, userInfo: Object): void;
|
||||
/**
|
||||
* Subscribes to native notifications of macOS, callback will be called when the corresponding event happens.
|
||||
* The id of the subscriber is returned, which can be used to unsubscribe the event.
|
||||
@@ -3318,17 +3441,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 +3551,7 @@ declare namespace Electron {
|
||||
/**
|
||||
* @returns The bounds of this tray icon.
|
||||
*/
|
||||
getBounds(): Bounds;
|
||||
getBounds(): Rectangle;
|
||||
}
|
||||
|
||||
interface Modifiers {
|
||||
@@ -3641,9 +3764,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.
|
||||
*/
|
||||
@@ -3657,9 +3780,9 @@ declare namespace Electron {
|
||||
*/
|
||||
on(event: 'select-bluetooth-device', listener: (event: Event, deviceList: BluetoothDevice[], callback: (deviceId: string) => void) => void): this;
|
||||
/**
|
||||
* Emitted when a page's view is repainted.
|
||||
* Emitted when a new frame is generated. Only the dirty area is passed in the buffer.
|
||||
*/
|
||||
on(event: 'view-painted', listener: Function): this;
|
||||
on(event: 'paint', listener: (event: Event, dirtyRect: Rectangle, image: NativeImage) => void): this;
|
||||
on(event: string, listener: Function): this;
|
||||
/**
|
||||
* Loads the url in the window.
|
||||
@@ -3769,6 +3892,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.
|
||||
*/
|
||||
@@ -3935,6 +4081,31 @@ declare namespace Electron {
|
||||
* Note: This API is available only on macOS.
|
||||
*/
|
||||
showDefinitionForSelection(): void;
|
||||
/**
|
||||
* @returns Whether offscreen rendering is enabled.
|
||||
*/
|
||||
isOffscreen(): boolean;
|
||||
/**
|
||||
* If offscreen rendering is enabled and not painting, start painting.
|
||||
*/
|
||||
startPainting(): void;
|
||||
/**
|
||||
* If offscreen rendering is enabled and painting, stop painting.
|
||||
*/
|
||||
stopPainting(): void;
|
||||
/**
|
||||
* If offscreen rendering is enabled returns whether it is currently painting.
|
||||
*/
|
||||
isPainting(): boolean;
|
||||
/**
|
||||
* If offscreen rendering is enabled sets the frame rate to the specified number.
|
||||
* Only values between 1 and 60 are accepted.
|
||||
*/
|
||||
setFrameRate(fps: number): void;
|
||||
/**
|
||||
* If offscreen rendering is enabled returns the current frame rate.
|
||||
*/
|
||||
getFrameRate(): number;
|
||||
/**
|
||||
* Sets the item as dragging item for current drag-drop operation.
|
||||
*/
|
||||
@@ -3985,7 +4156,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 +4360,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 +4465,7 @@ declare namespace Electron {
|
||||
/**
|
||||
* Coordinates of first match region.
|
||||
*/
|
||||
selectionArea?: Bounds;
|
||||
selectionArea?: Rectangle;
|
||||
}
|
||||
|
||||
interface DeviceEmulationParameters {
|
||||
@@ -4306,7 +4477,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 +4491,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
|
||||
@@ -4591,6 +4762,10 @@ declare namespace Electron {
|
||||
* @returns The title of guest page.
|
||||
*/
|
||||
getTitle(): string;
|
||||
/**
|
||||
* @returns Whether the web page is destroyed.
|
||||
*/
|
||||
isDestroyed(): boolean;
|
||||
/**
|
||||
* @returns Whether guest page is still loading resources.
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
Vendored
+3054
File diff suppressed because it is too large
Load Diff
Vendored
+5
-4
@@ -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 {
|
||||
|
||||
Vendored
+1635
-2109
File diff suppressed because it is too large
Load Diff
@@ -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": () => { },
|
||||
|
||||
Vendored
+16
-3
@@ -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.
|
||||
|
||||
Vendored
+69
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Handlebars v3.0.3
|
||||
// Type definitions for Handlebars v4.0.5
|
||||
// Project: http://handlebarsjs.com/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -15,14 +15,25 @@ declare namespace Handlebars {
|
||||
export function Exception(message: string): void;
|
||||
export function log(level: number, obj: any): void;
|
||||
export function parse(input: string): hbs.AST.Program;
|
||||
export function compile(input: any, options?: any): HandlebarsTemplateDelegate;
|
||||
export function compile(input: any, options?: CompileOptions): HandlebarsTemplateDelegate;
|
||||
export function precompile(input: any, options?: PrecompileOptions): TemplateSpecification;
|
||||
export function template(precompilation: TemplateSpecification): HandlebarsTemplateDelegate;
|
||||
|
||||
export function create(): typeof Handlebars;
|
||||
|
||||
export var SafeString: typeof hbs.SafeString;
|
||||
export var escapeExpression: typeof hbs.Utils.escapeExpression;
|
||||
export var Utils: typeof hbs.Utils;
|
||||
export var logger: Logger;
|
||||
export var templates: HandlebarsTemplates;
|
||||
export var helpers: any;
|
||||
|
||||
export function registerDecorator(name: string, fn: Function): void;
|
||||
export function registerDecorator(obj: {[name: string] : Function}): void;
|
||||
export function unregisterDecorator(name: string): void;
|
||||
|
||||
export function noConflict(): typeof Handlebars;
|
||||
|
||||
export module AST {
|
||||
export var helpers: hbs.AST.helpers;
|
||||
}
|
||||
@@ -32,6 +43,9 @@ declare namespace Handlebars {
|
||||
Program(program: hbs.AST.Program): void;
|
||||
BlockStatement(block: hbs.AST.BlockStatement): void;
|
||||
PartialStatement(partial: hbs.AST.PartialStatement): void;
|
||||
PartialBlockStatement(partial: hbs.AST.PartialBlockStatement): void;
|
||||
DecoratorBlock(decorator: hbs.AST.DecoratorBlock): void;
|
||||
Decorator(decorator: hbs.AST.Decorator): void;
|
||||
MustacheStatement(mustache: hbs.AST.MustacheStatement): void;
|
||||
ContentStatement(content: hbs.AST.ContentStatement): void;
|
||||
CommentStatement(comment?: hbs.AST.CommentStatement): void;
|
||||
@@ -52,6 +66,9 @@ declare namespace Handlebars {
|
||||
Program(program: hbs.AST.Program): void;
|
||||
BlockStatement(block: hbs.AST.BlockStatement): void;
|
||||
PartialStatement(partial: hbs.AST.PartialStatement): void;
|
||||
PartialBlockStatement(partial: hbs.AST.PartialBlockStatement): void;
|
||||
DecoratorBlock(decorator: hbs.AST.DecoratorBlock): void;
|
||||
Decorator(decorator: hbs.AST.Decorator): void;
|
||||
MustacheStatement(mustache: hbs.AST.MustacheStatement): void;
|
||||
ContentStatement(content: hbs.AST.ContentStatement): void;
|
||||
CommentStatement(comment?: hbs.AST.CommentStatement): void;
|
||||
@@ -81,6 +98,37 @@ interface HandlebarsTemplates {
|
||||
[index: string]: HandlebarsTemplateDelegate;
|
||||
}
|
||||
|
||||
interface TemplateSpecification {
|
||||
|
||||
}
|
||||
|
||||
interface CompileOptions {
|
||||
data?: boolean;
|
||||
compat?: boolean;
|
||||
knownHelpers?: {
|
||||
helperMissing?: boolean;
|
||||
blockHelperMissing?: boolean;
|
||||
each?: boolean;
|
||||
if?: boolean;
|
||||
unless?: boolean;
|
||||
with?: boolean;
|
||||
log?: boolean;
|
||||
lookup?: boolean;
|
||||
}
|
||||
knownHelpersOnly?: boolean;
|
||||
noEscape?: boolean;
|
||||
strict?: boolean;
|
||||
assumeObjects?: boolean;
|
||||
preventIndent?: boolean;
|
||||
ignoreStandalone?: boolean;
|
||||
explicitPartialContext?: boolean;
|
||||
}
|
||||
|
||||
interface PrecompileOptions extends CompileOptions {
|
||||
srcName?: string;
|
||||
destName?: string;
|
||||
}
|
||||
|
||||
declare namespace hbs {
|
||||
class SafeString {
|
||||
constructor(str: string);
|
||||
@@ -89,6 +137,12 @@ declare namespace hbs {
|
||||
|
||||
namespace Utils {
|
||||
function escapeExpression(str: string): string;
|
||||
function createFrame(obj: Object): Object;
|
||||
function isEmpty(obj: any) : boolean;
|
||||
function extend(obj: any, ...source: any[]): any;
|
||||
function toString(obj: any): string;
|
||||
function isArray(obj: any): boolean;
|
||||
function isFunction(obj: any): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +191,8 @@ declare namespace hbs {
|
||||
strip: StripFlags;
|
||||
}
|
||||
|
||||
interface Decorator extends MustacheStatement { }
|
||||
|
||||
interface BlockStatement extends Statement {
|
||||
path: PathExpression;
|
||||
params: Expression[];
|
||||
@@ -148,6 +204,8 @@ declare namespace hbs {
|
||||
closeStrip: StripFlags;
|
||||
}
|
||||
|
||||
interface DecoratorBlock extends BlockStatement { }
|
||||
|
||||
interface PartialStatement extends Statement {
|
||||
name: PathExpression | SubExpression;
|
||||
params: Expression[];
|
||||
@@ -156,6 +214,15 @@ declare namespace hbs {
|
||||
strip: StripFlags;
|
||||
}
|
||||
|
||||
interface PartialBlockStatement extends Statement {
|
||||
name: PathExpression | SubExpression;
|
||||
params: Expression[],
|
||||
hash: Hash,
|
||||
program: Program,
|
||||
openStrip: StripFlags,
|
||||
closeStrip: StripFlags
|
||||
}
|
||||
|
||||
interface ContentStatement extends Statement {
|
||||
value: string;
|
||||
original: StripFlags;
|
||||
|
||||
Vendored
+36
-15
@@ -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:
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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',
|
||||
|
||||
Vendored
+38
-15
@@ -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:
|
||||
|
||||
Vendored
+44
-4
@@ -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 {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/// <reference path="hellosign-embedded.d.ts" />
|
||||
|
||||
HelloSign.init('abc123');
|
||||
|
||||
// some options
|
||||
HelloSign.open({
|
||||
url: 'http://example.org',
|
||||
messageListener: (e: HelloSign.MessageEvent) => {
|
||||
if (e.event === HelloSign.EVENT_SIGNED) {
|
||||
console.log('signed');
|
||||
}
|
||||
},
|
||||
uxVersion: 2
|
||||
});
|
||||
|
||||
// all options
|
||||
HelloSign.open({
|
||||
url: 'http://example.org',
|
||||
redirectUrl: 'https://github.com/DefinitelyTyped/DefinitelyTyped',
|
||||
allowCancel: true,
|
||||
messageListener: (e: HelloSign.MessageEvent) => {
|
||||
if (e.event === HelloSign.EVENT_SIGNED) {
|
||||
console.log('signed');
|
||||
}
|
||||
},
|
||||
userCulture: HelloSign.CULTURES.EN_US,
|
||||
debug: true,
|
||||
skipDomainVerification: true,
|
||||
container: document.getElementById('#hellosign-container'),
|
||||
height: 1326,
|
||||
hideHeader: true,
|
||||
uxVersion: 2,
|
||||
requester: 'hellosign@example.org',
|
||||
whiteLabelingOptions: {
|
||||
"page_background_color": "#f7f8f9"
|
||||
}
|
||||
});
|
||||
|
||||
HelloSign.close();
|
||||
+193
@@ -0,0 +1,193 @@
|
||||
// Type definitions for hellosign-embedded v1.0.3
|
||||
// Project: https://github.com/HelloFax/hellosign-embedded
|
||||
// Definitions by: Brian Surowiec <https://github.com/xt0rted/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
declare module HelloSign {
|
||||
interface MessageEvent {
|
||||
event: string;
|
||||
}
|
||||
|
||||
interface ClientCultures {
|
||||
/**
|
||||
* English (United States)
|
||||
*
|
||||
* @default en_US
|
||||
*/
|
||||
EN_US: string;
|
||||
|
||||
/**
|
||||
* French (France)
|
||||
*
|
||||
* @default fr_FR
|
||||
*/
|
||||
FR_FR: string;
|
||||
|
||||
/**
|
||||
* German (Germany)
|
||||
*
|
||||
* @default de_DE
|
||||
*/
|
||||
DE_DE: string;
|
||||
|
||||
/**
|
||||
* Swedish (Sweden)
|
||||
*
|
||||
* @default sv_SE
|
||||
*/
|
||||
SV_SE: string;
|
||||
|
||||
/**
|
||||
* Chinese (China)
|
||||
*
|
||||
* @default zh_CN
|
||||
*/
|
||||
ZH_CN: string;
|
||||
|
||||
/**
|
||||
* Danish (Denmark)
|
||||
*
|
||||
* @default da_DK
|
||||
*/
|
||||
DA_DK: string;
|
||||
|
||||
/**
|
||||
* Dutch (The Netherlands)
|
||||
* @default nl_NL
|
||||
*/
|
||||
NL_NL: string;
|
||||
|
||||
/**
|
||||
* The available client UI cultures
|
||||
*/
|
||||
supportedCultures: string[];
|
||||
}
|
||||
|
||||
interface OpenParameters {
|
||||
/**
|
||||
* The url to open in the child frame
|
||||
*/
|
||||
url?: string;
|
||||
|
||||
/**
|
||||
* Where to go after the signature is completed
|
||||
*/
|
||||
redirectUrl?: string;
|
||||
|
||||
/**
|
||||
* Whether a cancel button should be displayed
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
allowCancel?: boolean;
|
||||
|
||||
/**
|
||||
* A listener for X-window messages coming from the child frame
|
||||
*/
|
||||
messageListener?: (eventData: MessageEvent) => void;
|
||||
|
||||
/**
|
||||
* One of the HelloSign.CULTURES.supportedCultures
|
||||
*
|
||||
* @default HelloSign.CULTURES.EN_US
|
||||
*/
|
||||
userCulture?: string;
|
||||
|
||||
/**
|
||||
* When true, debugging statements will be written to the console
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* When true, domain verification step will be skipped if and only if the Signature Request was created with test_mode=1
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
skipDomainVerification?: boolean;
|
||||
|
||||
/**
|
||||
* DOM element that will contain the iframe on the page (defaults to document.body)
|
||||
*/
|
||||
container?: Element;
|
||||
|
||||
/**
|
||||
* Height of the iFrame (only applicable when a container is specified)
|
||||
*/
|
||||
height?: number;
|
||||
|
||||
/**
|
||||
* When true, the header will be hidden.
|
||||
* This is only functional for customers with embedded branding enabled.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
hideHeader?: boolean;
|
||||
|
||||
/**
|
||||
* The version of the embedded user experience to display to signers (1 = legacy, 2 = responsive).
|
||||
* This option is only honored if your account has accessed the API prior to Nov 14, 2015.
|
||||
*/
|
||||
uxVersion?: number;
|
||||
|
||||
/**
|
||||
* The email of the person issuing a signature request.
|
||||
* Required for allowing 'Me + Others' requests
|
||||
*/
|
||||
requester?: string;
|
||||
|
||||
/**
|
||||
* An associative array to be used to customize the app's signer page
|
||||
*/
|
||||
whiteLabelingOptions?: Object;
|
||||
}
|
||||
|
||||
interface HelloSignStatic {
|
||||
/**
|
||||
* The available client UI cultures
|
||||
*/
|
||||
CULTURES: ClientCultures;
|
||||
|
||||
/**
|
||||
* The signature request was signed
|
||||
*
|
||||
* @default signature_request_signed
|
||||
*/
|
||||
EVENT_SIGNED: string;
|
||||
|
||||
/**
|
||||
* The user closed the iFrame before completing
|
||||
*
|
||||
* @default signature_request_canceled
|
||||
*/
|
||||
EVENT_CANCELED: string;
|
||||
|
||||
/**
|
||||
* An error occurred in the iFrame
|
||||
*
|
||||
* @default error
|
||||
*/
|
||||
EVENT_ERROR: string;
|
||||
|
||||
/**
|
||||
* Initialize using your HelloSign API client ID.
|
||||
*
|
||||
* @param appClientId The API client ID the request is for.
|
||||
*/
|
||||
init(appClientId: string): void;
|
||||
|
||||
/**
|
||||
* Open the signing window.
|
||||
*
|
||||
* @param params The options to use when opening the signing window.
|
||||
*/
|
||||
open(params: OpenParameters): void;
|
||||
|
||||
/**
|
||||
* Close the signing window.
|
||||
*/
|
||||
close(): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare var HelloSign: HelloSign.HelloSignStatic;
|
||||
Vendored
+9
-1
@@ -3183,6 +3183,14 @@ interface HighchartsPointEvents {
|
||||
* @since 1.2.0
|
||||
*/
|
||||
update?: (event: Event) => boolean|void;
|
||||
/**
|
||||
* Fires when the legend item belonging to the pie point (slice) is clicked.
|
||||
* The this keyword refers to the point itself. One parameter, event, is passed to the function.
|
||||
* This contains common event information based on jQuery or MooTools depending on which library is used as the base for Highcharts.
|
||||
* The default action is to toggle the visibility of the point. This can be prevented by calling event.preventDefault().
|
||||
*/
|
||||
legendItemClick?: (event: Event) => boolean | void;
|
||||
|
||||
}
|
||||
|
||||
interface HighchartsHalo {
|
||||
@@ -6053,7 +6061,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
@@ -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;
|
||||
}
|
||||
|
||||
Vendored
+46
-35
@@ -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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
/// <reference path="./inversify-inject-decorators.d.ts" />
|
||||
/// <reference path="../inversify/inversify.d.ts" />
|
||||
|
||||
import getDecorators from "inversify-inject-decorators";
|
||||
import { Kernel, injectable, tagged, named } from "inversify";
|
||||
|
||||
module lazyInject {
|
||||
|
||||
let kernel = new Kernel();
|
||||
let { lazyInject } = getDecorators(kernel);
|
||||
let TYPES = { Weapon: "Weapon" };
|
||||
|
||||
interface Weapon {
|
||||
name: string;
|
||||
durability: number;
|
||||
use(): void;
|
||||
}
|
||||
|
||||
@injectable()
|
||||
class Sword implements Weapon {
|
||||
public name: string;
|
||||
public durability: number;
|
||||
public constructor() {
|
||||
this.durability = 100;
|
||||
this.name = "Sword";
|
||||
}
|
||||
public use() {
|
||||
this.durability = this.durability - 10;
|
||||
}
|
||||
}
|
||||
|
||||
class Warrior {
|
||||
@lazyInject(TYPES.Weapon)
|
||||
public weapon: Weapon;
|
||||
}
|
||||
|
||||
kernel.bind<Weapon>(TYPES.Weapon).to(Sword);
|
||||
|
||||
let warrior = new Warrior();
|
||||
console.log(warrior.weapon instanceof Sword); // true
|
||||
|
||||
}
|
||||
|
||||
module lazyInjectNamed {
|
||||
|
||||
let kernel = new Kernel();
|
||||
let { lazyInjectNamed } = getDecorators(kernel);
|
||||
let TYPES = { Weapon: "Weapon" };
|
||||
|
||||
interface Weapon {
|
||||
name: string;
|
||||
durability: number;
|
||||
use(): void;
|
||||
}
|
||||
|
||||
@injectable()
|
||||
class Sword implements Weapon {
|
||||
public name: string;
|
||||
public durability: number;
|
||||
public constructor() {
|
||||
this.durability = 100;
|
||||
this.name = "Sword";
|
||||
}
|
||||
public use() {
|
||||
this.durability = this.durability - 10;
|
||||
}
|
||||
}
|
||||
|
||||
@injectable()
|
||||
class Shuriken implements Weapon {
|
||||
public name: string;
|
||||
public durability: number;
|
||||
public constructor() {
|
||||
this.durability = 100;
|
||||
this.name = "Shuriken";
|
||||
}
|
||||
public use() {
|
||||
this.durability = this.durability - 10;
|
||||
}
|
||||
}
|
||||
|
||||
class Warrior {
|
||||
|
||||
@lazyInjectNamed(TYPES.Weapon, "not-throwwable")
|
||||
@named("not-throwwable")
|
||||
public primaryWeapon: Weapon;
|
||||
|
||||
@lazyInjectNamed(TYPES.Weapon, "throwwable")
|
||||
@named("throwwable")
|
||||
public secondaryWeapon: Weapon;
|
||||
|
||||
}
|
||||
|
||||
kernel.bind<Weapon>(TYPES.Weapon).to(Sword).whenTargetNamed("not-throwwable");
|
||||
kernel.bind<Weapon>(TYPES.Weapon).to(Shuriken).whenTargetNamed("throwwable");
|
||||
|
||||
let warrior = new Warrior();
|
||||
console.log(warrior.primaryWeapon instanceof Sword); // true
|
||||
console.log(warrior.primaryWeapon instanceof Shuriken); // true
|
||||
|
||||
}
|
||||
|
||||
module lazyInjectTagged {
|
||||
|
||||
let kernel = new Kernel();
|
||||
let { lazyInjectTagged } = getDecorators(kernel);
|
||||
let TYPES = { Weapon: "Weapon" };
|
||||
|
||||
interface Weapon {
|
||||
name: string;
|
||||
durability: number;
|
||||
use(): void;
|
||||
}
|
||||
|
||||
@injectable()
|
||||
class Sword implements Weapon {
|
||||
public name: string;
|
||||
public durability: number;
|
||||
public constructor() {
|
||||
this.durability = 100;
|
||||
this.name = "Sword";
|
||||
}
|
||||
public use() {
|
||||
this.durability = this.durability - 10;
|
||||
}
|
||||
}
|
||||
|
||||
@injectable()
|
||||
class Shuriken implements Weapon {
|
||||
public name: string;
|
||||
public durability: number;
|
||||
public constructor() {
|
||||
this.durability = 100;
|
||||
this.name = "Shuriken";
|
||||
}
|
||||
public use() {
|
||||
this.durability = this.durability - 10;
|
||||
}
|
||||
}
|
||||
|
||||
class Warrior {
|
||||
|
||||
@lazyInjectTagged(TYPES.Weapon, "throwwable", false)
|
||||
@tagged("throwwable", false)
|
||||
public primaryWeapon: Weapon;
|
||||
|
||||
@lazyInjectTagged(TYPES.Weapon, "throwwable", true)
|
||||
@tagged("throwwable", true)
|
||||
public secondaryWeapon: Weapon;
|
||||
|
||||
}
|
||||
|
||||
kernel.bind<Weapon>(TYPES.Weapon).to(Sword).whenTargetTagged("throwwable", false);
|
||||
kernel.bind<Weapon>(TYPES.Weapon).to(Shuriken).whenTargetTagged("throwwable", true);
|
||||
|
||||
let warrior = new Warrior();
|
||||
console.log(warrior.primaryWeapon instanceof Sword); // true
|
||||
console.log(warrior.primaryWeapon instanceof Shuriken); // true
|
||||
|
||||
}
|
||||
|
||||
module lazyMultiInject {
|
||||
|
||||
let kernel = new Kernel();
|
||||
let { lazyMultiInject } = getDecorators(kernel);
|
||||
let TYPES = { Weapon: "Weapon" };
|
||||
|
||||
interface Weapon {
|
||||
name: string;
|
||||
durability: number;
|
||||
use(): void;
|
||||
}
|
||||
|
||||
@injectable()
|
||||
class Sword implements Weapon {
|
||||
public name: string;
|
||||
public durability: number;
|
||||
public constructor() {
|
||||
this.durability = 100;
|
||||
this.name = "Sword";
|
||||
}
|
||||
public use() {
|
||||
this.durability = this.durability - 10;
|
||||
}
|
||||
}
|
||||
|
||||
@injectable()
|
||||
class Shuriken implements Weapon {
|
||||
public name: string;
|
||||
public durability: number;
|
||||
public constructor() {
|
||||
this.durability = 100;
|
||||
this.name = "Shuriken";
|
||||
}
|
||||
public use() {
|
||||
this.durability = this.durability - 10;
|
||||
}
|
||||
}
|
||||
|
||||
class Warrior {
|
||||
|
||||
@lazyMultiInject(TYPES.Weapon)
|
||||
public weapons: Weapon[];
|
||||
|
||||
}
|
||||
|
||||
kernel.bind<Weapon>(TYPES.Weapon).to(Sword);
|
||||
kernel.bind<Weapon>(TYPES.Weapon).to(Shuriken);
|
||||
|
||||
let warrior = new Warrior();
|
||||
console.log(warrior.weapons[0] instanceof Sword); // true
|
||||
console.log(warrior.weapons[1] instanceof Shuriken); // true
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Type definitions for inversify-inject-decorators 1.0.0-beta.1
|
||||
// Project: https://github.com/inversify/inversify-inject-decorators
|
||||
// Definitions by: inversify <https://github.com/inversify/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../inversify/inversify.d.ts" />
|
||||
|
||||
declare namespace inversifyInjectDecorators {
|
||||
|
||||
interface InjectDecorators {
|
||||
|
||||
lazyInject: (serviceIdentifier: (string|Symbol|inversify.interfaces.Newable<any>)) =>
|
||||
(proto: any, key: string) => void;
|
||||
|
||||
lazyInjectNamed: (serviceIdentifier: (string|Symbol|inversify.interfaces.Newable<any>), named: string) =>
|
||||
(proto: any, key: string) => void;
|
||||
|
||||
lazyInjectTagged: (serviceIdentifier: (string|Symbol|inversify.interfaces.Newable<any>), key: string, value: any) =>
|
||||
(proto: any, propertyName: string) => void;
|
||||
|
||||
lazyMultiInject: (serviceIdentifier: (string|Symbol|inversify.interfaces.Newable<any>)) =>
|
||||
(proto: any, key: string) => void;
|
||||
|
||||
}
|
||||
|
||||
export function getDecorators(kernel: inversify.interfaces.Kernel): InjectDecorators;
|
||||
|
||||
}
|
||||
|
||||
declare module "inversify-inject-decorators" {
|
||||
export default inversifyInjectDecorators.getDecorators;
|
||||
}
|
||||
Vendored
+3
@@ -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
@@ -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) { }
|
||||
});
|
||||
|
||||
Vendored
+375
-23
@@ -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;
|
||||
}
|
||||
Vendored
+1
-1
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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-'); // 小飼弾
|
||||
Vendored
+52
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
/// <reference path="json-editor.d.ts" />
|
||||
|
||||
var element = document.getElementById('editor_holder');
|
||||
var editor = new JSONEditor(element, {});
|
||||
|
||||
// Set an option globally
|
||||
JSONEditor.defaults.options.theme = 'bootstrap2';
|
||||
// Set an option during instantiation
|
||||
editor = new JSONEditor(element, {
|
||||
theme: 'bootstrap2'
|
||||
});
|
||||
editor.on('ready', function () {
|
||||
// Now the api methods will be available
|
||||
editor.validate();
|
||||
});
|
||||
|
||||
var editor2 = new JSONEditor<{ name: string; }>(element, {});
|
||||
editor2.setValue({ name: "John Smith" });
|
||||
var value = editor2.getValue();
|
||||
console.log(value.name) // Will log "John Smith"
|
||||
|
||||
// Get a reference to a node within the editor
|
||||
var name2 = editor.getEditor('root.name');
|
||||
|
||||
// `getEditor` will return null if the path is invalid
|
||||
if (name2) {
|
||||
name2.setValue("John Smith");
|
||||
|
||||
console.log(name2.getValue());
|
||||
}
|
||||
|
||||
var errors = editor.validate();
|
||||
|
||||
if (errors.length) {
|
||||
// errors is an array of objects, each with a `path`, `property`, and `message` parameter
|
||||
// `property` is the schema keyword that triggered the validation error (e.g. "minLength")
|
||||
// `path` is a dot separated path into the JSON object (e.g. "root.path.to.field")
|
||||
console.log(errors);
|
||||
}
|
||||
else {
|
||||
// It's valid!
|
||||
}
|
||||
|
||||
// Validate an arbitrary value against the editor's schema
|
||||
var errors = editor.validate({
|
||||
value: {
|
||||
to: "test"
|
||||
}
|
||||
});
|
||||
|
||||
editor.on('change', function () {
|
||||
// Do something
|
||||
});
|
||||
|
||||
editor.off('change', function () {
|
||||
// Do something
|
||||
});
|
||||
|
||||
editor.watch('path.to.field', function () {
|
||||
// Do something
|
||||
});
|
||||
|
||||
editor.unwatch('path.to.field', function () {
|
||||
// Do something
|
||||
});
|
||||
|
||||
// Disable entire form
|
||||
editor.disable();
|
||||
|
||||
// Disable part of the form
|
||||
editor.getEditor('root.location').disable();
|
||||
|
||||
// Enable entire form
|
||||
editor.enable();
|
||||
|
||||
// Enable part of the form
|
||||
editor.getEditor('root.location').enable();
|
||||
|
||||
// Check if form is currently enabled
|
||||
if (editor.isEnabled()) alert("It's editable!");
|
||||
|
||||
editor.destroy();
|
||||
|
||||
JSONEditor.defaults.options.theme = 'foundation5';
|
||||
|
||||
JSONEditor.plugins.sceditor.emoticonsEnabled = false;
|
||||
|
||||
JSONEditor.plugins.epiceditor.basePath = 'epiceditor';
|
||||
|
||||
JSONEditor.plugins.ace.theme = 'twilight';
|
||||
|
||||
JSONEditor.defaults.editors.object.options.collapsed = true;
|
||||
|
||||
JSONEditor.defaults.options.template = 'handlebars';
|
||||
|
||||
var myengine = {
|
||||
compile: function (template: any) {
|
||||
// Compile should return a render function
|
||||
return function (vars: any) {
|
||||
// A real template engine would render the template here
|
||||
var result = template;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Set globally
|
||||
JSONEditor.defaults.options.template = myengine;
|
||||
|
||||
// Override a specific translation
|
||||
JSONEditor.defaults.languages.en.error_minLength =
|
||||
"This better be at least {{0}} characters long or else!";
|
||||
|
||||
|
||||
// Create your own language mapping
|
||||
// Any keys not defined here will fall back to the "en" language
|
||||
JSONEditor.defaults.languages.es = {
|
||||
error_notset: "propiedad debe existir"
|
||||
};
|
||||
|
||||
JSONEditor.defaults.language = "es";
|
||||
|
||||
JSONEditor.defaults.resolvers.unshift(function (schema) {
|
||||
if (schema.type === "object" && schema.format === "location") {
|
||||
return "location";
|
||||
}
|
||||
|
||||
// If no valid editor is returned, the next resolver function will be used
|
||||
});
|
||||
|
||||
JSONEditor.plugins.selectize.enable = true;
|
||||
|
||||
JSONEditor.defaults.custom_validators.push(function (schema, value, path) {
|
||||
var errors: JSONEditorError[] = [];
|
||||
if (schema.format === "date") {
|
||||
if (!/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(value)) {
|
||||
// Errors must be an object with `path`, `property`, and `message`
|
||||
errors.push({
|
||||
path: path,
|
||||
property: 'format',
|
||||
message: 'Dates must be in the format "YYYY-MM-DD"'
|
||||
});
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
});
|
||||
Vendored
+184
@@ -0,0 +1,184 @@
|
||||
// Type definitions for json-editor
|
||||
// Project: https://github.com/jdorn/json-editor
|
||||
// Definitions by: York Yao <https://github.com/plantain-00/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
type JSONEditorOptions<TValue> = {
|
||||
/**
|
||||
* If true, JSON Editor will load external URLs in $ref via ajax.
|
||||
*/
|
||||
ajax?: boolean;
|
||||
/**
|
||||
* If true, remove all "add row" buttons from arrays.
|
||||
*/
|
||||
disable_array_add?: boolean;
|
||||
/**
|
||||
* If true, remove all "delete row" buttons from arrays.
|
||||
*/
|
||||
disable_array_delete?: boolean;
|
||||
/**
|
||||
* If true, remove all "move up" and "move down" buttons from arrays.
|
||||
*/
|
||||
disable_array_reorder?: boolean;
|
||||
/**
|
||||
* If true, remove all collapse buttons from objects and arrays.
|
||||
*/
|
||||
disable_collapse?: boolean;
|
||||
/**
|
||||
* If true, remove all Edit JSON buttons from objects.
|
||||
*/
|
||||
disable_edit_json?: boolean;
|
||||
/**
|
||||
* If true, remove all Edit Properties buttons from objects.
|
||||
*/
|
||||
disable_properties?: boolean;
|
||||
/**
|
||||
* The first part of the `name` attribute of form inputs in the editor. An full example name is `root[person][name]` where "root" is the form_name_root.
|
||||
*/
|
||||
form_name_root?: string;
|
||||
/**
|
||||
* The icon library to use for the editor.
|
||||
*/
|
||||
iconlib?: boolean;
|
||||
/**
|
||||
* If true, objects can only contain properties defined with the properties keyword.
|
||||
*/
|
||||
no_additional_properties?: boolean;
|
||||
/**
|
||||
* An object containing schema definitions for URLs. Allows you to pre-define external schemas.
|
||||
*/
|
||||
refs?: any;
|
||||
/**
|
||||
* If true, all schemas that don't explicitly set the required property will be required.
|
||||
*/
|
||||
required_by_default?: boolean;
|
||||
/**
|
||||
* If true, makes oneOf copy properties over when switching.
|
||||
*/
|
||||
keep_oneof_values?: boolean;
|
||||
/**
|
||||
* A valid JSON Schema to use for the editor. Version 3 and Version 4 of the draft specification are supported.
|
||||
*/
|
||||
schema?: any;
|
||||
/**
|
||||
* When to show validation errors in the UI. Valid values are interaction, change, always, and never.
|
||||
*/
|
||||
show_errors?: "interaction" | "change" | "always" | "never";
|
||||
/**
|
||||
* Seed the editor with an initial value. This should be valid against the editor's schema.
|
||||
*/
|
||||
startval?: TValue;
|
||||
/**
|
||||
* The JS template engine to use.
|
||||
*/
|
||||
template?: string | { compile: (template: string) => (vars: any) => string };
|
||||
/**
|
||||
* The CSS theme to use.
|
||||
*/
|
||||
theme?: string;
|
||||
/**
|
||||
* If true, only required properties will be included by default.
|
||||
*/
|
||||
display_required_only?: boolean;
|
||||
}
|
||||
type JSONEditorError = {
|
||||
path: string;
|
||||
property: string;
|
||||
message: string;
|
||||
}
|
||||
type JSONEditorObjectOptions = {
|
||||
/**
|
||||
* If set to true, the editor will start collapsed
|
||||
*/
|
||||
collapsed?: boolean;
|
||||
/**
|
||||
* If set to true, the collapse button will be hidden
|
||||
*/
|
||||
disable_collapse?: boolean;
|
||||
/**
|
||||
* If set to true, the Edit JSON button will be hidden
|
||||
*/
|
||||
disable_edit_json?: boolean;
|
||||
/**
|
||||
* If set to true, the Edit Properties button will be hidden
|
||||
*/
|
||||
disable_properties?: boolean;
|
||||
}
|
||||
type JSONEditorArrayOptions = {
|
||||
/**
|
||||
* If set to true, the editor will start collapsed
|
||||
*/
|
||||
collapsed?: boolean;
|
||||
/**
|
||||
* If set to true, the "add row" button will be hidden
|
||||
*/
|
||||
disable_array_add?: boolean;
|
||||
/**
|
||||
* If set to true, all of the "delete" buttons will be hidden
|
||||
*/
|
||||
disable_array_delete?: boolean;
|
||||
/**
|
||||
* If set to true, just the "delete all rows" button will be hidden
|
||||
*/
|
||||
disable_array_delete_all_rows?: boolean;
|
||||
/**
|
||||
* If set to true, just the "delete last row" buttons will be hidden
|
||||
*/
|
||||
disable_array_delete_last_row?: boolean;
|
||||
/**
|
||||
* If set to true, the "move up/down" buttons will be hidden
|
||||
*/
|
||||
disable_array_reorder?: boolean;
|
||||
/**
|
||||
* If set to true, the collapse button will be hidden
|
||||
*/
|
||||
disable_collapse?: boolean;
|
||||
}
|
||||
declare class JSONEditor<TValue> {
|
||||
public static defaults: {
|
||||
options: JSONEditorOptions<any>;
|
||||
editors: {
|
||||
object: {
|
||||
options: JSONEditorObjectOptions;
|
||||
};
|
||||
array: {
|
||||
options: JSONEditorArrayOptions;
|
||||
}
|
||||
};
|
||||
languages: any;
|
||||
language: string;
|
||||
resolvers: ((schema: any) => string)[];
|
||||
custom_validators: (((schema: any, value: string, path: string) => JSONEditorError[]))[];
|
||||
};
|
||||
public static plugins: {
|
||||
sceditor: {
|
||||
emoticonsEnabled: boolean;
|
||||
};
|
||||
epiceditor: {
|
||||
basePath: string;
|
||||
};
|
||||
ace: {
|
||||
theme: string;
|
||||
};
|
||||
selectize: {
|
||||
enable: boolean;
|
||||
};
|
||||
};
|
||||
constructor(element: HTMLElement, options: JSONEditorOptions<TValue>);
|
||||
public on(event: string, fn: Function): JSONEditor<TValue>;
|
||||
public off(event: string, fn: Function): JSONEditor<TValue>;
|
||||
public watch(event: string, fn: Function): JSONEditor<TValue>;
|
||||
public unwatch(event: string, fn: Function): JSONEditor<TValue>;
|
||||
public validate(value?: TValue): JSONEditorError[];
|
||||
public setValue(value: TValue): void;
|
||||
public getValue(): TValue;
|
||||
public getEditor(name: string): JSONEditor<TValue>;
|
||||
public disable(): void;
|
||||
public enable(): void;
|
||||
public isEnabled(): boolean;
|
||||
public destroy(): void;
|
||||
}
|
||||
|
||||
declare module "json-editor" {
|
||||
export = JSONEditor;
|
||||
}
|
||||
@@ -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
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/// <reference path="jsonschema.d.ts" />
|
||||
import { Validator, IJSONSchemaValidationError } from "jsonschema";
|
||||
|
||||
const v: Validator = new Validator();
|
||||
|
||||
const validationResults: { errors: Array<IJSONSchemaValidationError> } = v.validate("Smith", {"type": "string"});
|
||||
Vendored
+103
@@ -0,0 +1,103 @@
|
||||
// Type definitions for jsonschema
|
||||
// Project: https://github.com/tdegrunt/jsonschema
|
||||
// Definitions by: Vlado Tešanovic <https://github.com/vladotesanovic>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
declare module "jsonschema" {
|
||||
|
||||
export interface IJSONSchemaResult {
|
||||
errors: Array<IJSONSchemaValidationError>;
|
||||
instance: any;
|
||||
arguments: Array<{}>;
|
||||
propertyPath: string;
|
||||
name: string;
|
||||
schema: {};
|
||||
throwError: any;
|
||||
disableFormat: boolean;
|
||||
}
|
||||
|
||||
export interface IJSONSchemaValidationError {
|
||||
message: string;
|
||||
property: string;
|
||||
stack: string;
|
||||
schema: {};
|
||||
name: string;
|
||||
instance: any;
|
||||
argument: {};
|
||||
}
|
||||
|
||||
export interface IJSONSchemaOptions {
|
||||
propertyName?: string;
|
||||
base?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* How to;
|
||||
*
|
||||
* const v: Validator = new Validator();
|
||||
*
|
||||
* const schema: {} = {
|
||||
* "type": "object",
|
||||
* "properties": {
|
||||
* "key": {
|
||||
* "type": "string",
|
||||
* "required": true
|
||||
* },
|
||||
* "value": {
|
||||
* "type": "string",
|
||||
* "required": true
|
||||
* }
|
||||
* }
|
||||
* };
|
||||
*
|
||||
* const validationResults: { errors: Array<IJSONSchemaValidationError> } =
|
||||
* v.validate({ key: "Name", value: "A10" }, {"type": "string"});
|
||||
*
|
||||
*/
|
||||
export class Validator {
|
||||
|
||||
/**
|
||||
* Creates a new Validator object
|
||||
* @name Validator
|
||||
* @constructor
|
||||
*/
|
||||
new(): this;
|
||||
|
||||
/**
|
||||
* Validates instance against the provided schema
|
||||
* @param instance
|
||||
* @param schema
|
||||
* @param [options]
|
||||
* @param [ctx]
|
||||
* @return {Array}
|
||||
*/
|
||||
validate(instance: any, schema: {}, options?: IJSONSchemaOptions, ctx?: {}): IJSONSchemaResult;
|
||||
|
||||
/**
|
||||
* Adds a schema with a certain urn to the Validator instance.
|
||||
* @param schema
|
||||
* @param urn
|
||||
* @return {Object}
|
||||
*/
|
||||
addSchema(schema: {}, urn: string): {};
|
||||
|
||||
/**
|
||||
* Add Sub schema to existing one
|
||||
* @param baseuri
|
||||
* @param schema
|
||||
*/
|
||||
addSubSchema(baseuri: string, schema: {}): {}
|
||||
|
||||
/**
|
||||
* Sets all the schemas of the Validator instance.
|
||||
* @param schemas
|
||||
*/
|
||||
setSchemas (schemas: Array<{}>): void;
|
||||
|
||||
/**
|
||||
* Returns the schema of a certain urn
|
||||
* @param urn
|
||||
*/
|
||||
getSchema(urn: string): {};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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({});
|
||||
|
||||
@@ -65,6 +78,18 @@ var knex = Knex({
|
||||
client: 'pg'
|
||||
});
|
||||
|
||||
// searchPath
|
||||
var knex = Knex({
|
||||
client: 'pg',
|
||||
searchPath: 'public',
|
||||
});
|
||||
|
||||
// useNullAsDefault
|
||||
var knex = Knex({
|
||||
client: 'sqlite',
|
||||
useNullAsDefault: true,
|
||||
});
|
||||
|
||||
knex('books').insert({title: 'Test'}).returning('*').toString();
|
||||
|
||||
// Migrations
|
||||
|
||||
Vendored
+3
@@ -453,6 +453,9 @@ declare module "knex" {
|
||||
Sqlite3ConnectionConfig|SocketConnectionConfig;
|
||||
pool?: PoolConfig;
|
||||
migrations?: MigratorConfig;
|
||||
acquireConnectionTimeout?: number;
|
||||
useNullAsDefault?: boolean;
|
||||
searchPath?: string;
|
||||
}
|
||||
|
||||
interface ConnectionConfig {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path="./koa-hbs.d.ts" />
|
||||
/// <reference path="../koa/koa.d.ts" />
|
||||
|
||||
import * as Hbs from 'koa-hbs';
|
||||
import * as Koa from 'koa';
|
||||
import * as Path from 'path';
|
||||
|
||||
const app = new Koa();
|
||||
const hbs = new Hbs();
|
||||
|
||||
app.use(hbs.middleware({
|
||||
viewPath: Path.join(__dirname, './views')
|
||||
}));
|
||||
|
||||
app.use(function *(next: any) {
|
||||
yield this.render('index', {
|
||||
title: 'Hello World!'
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000);
|
||||
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
// Type definitions for koa-favicon v2.x
|
||||
// Project: https://github.com/gilt/koa-hbs
|
||||
// Definitions by: Jacob Malone <https://github.com/jcbmln/>
|
||||
// Definitions: https://github.com/jcbmln/DefinitelyTyped
|
||||
|
||||
/* =================== USAGE ===================
|
||||
|
||||
import * as Hbs from "koa-hbs";
|
||||
import * as Koa from "koa";
|
||||
|
||||
var hbs = new Hbs();
|
||||
var app = new Koa();
|
||||
|
||||
app.use(hbs.middleware({
|
||||
viewPath: __dirname + '/views'
|
||||
}));
|
||||
|
||||
app.use(function *() {
|
||||
yield this.render('main', {
|
||||
title: 'koa-hbs'
|
||||
});
|
||||
});
|
||||
|
||||
=============================================== */
|
||||
|
||||
/// <reference path="../koa/koa.d.ts" />
|
||||
|
||||
declare module "koa-hbs" {
|
||||
|
||||
import * as Koa from "koa";
|
||||
|
||||
namespace Hbs {
|
||||
export interface Middleware {
|
||||
viewPath: Array<string> | string,
|
||||
handlebars?: Function,
|
||||
templateOptions?: {},
|
||||
extname?: string,
|
||||
partialsPath?: Array<string> | string,
|
||||
defaultLayout?: string,
|
||||
layoutsPath?: string,
|
||||
contentHelperName?: string,
|
||||
blockHelperName?: string,
|
||||
disableCache?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
class Hbs {
|
||||
constructor();
|
||||
|
||||
middleware(opts: Hbs.Middleware): any;
|
||||
}
|
||||
|
||||
namespace Hbs {}
|
||||
export = Hbs;
|
||||
}
|
||||
Vendored
+1
-1
@@ -46,6 +46,6 @@ declare module "koa-static" {
|
||||
*/
|
||||
gzip?: boolean;
|
||||
}): { (ctx: Koa.Context, next?: () => any): any };
|
||||
|
||||
namespace serve{}
|
||||
export = serve;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path="../leaflet/leaflet.d.ts" />
|
||||
/// <reference path="leaflet-geocoder-mapzen.d.ts" />
|
||||
|
||||
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
||||
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}),
|
||||
map = new L.Map('map', {layers: [osm], center: new L.LatLng(-37.7772, 175.2756), zoom: 15 });
|
||||
|
||||
// Add geocoding plugin
|
||||
L.control.geocoder('search-MKZrG6M').addTo(map);
|
||||
@@ -0,0 +1,177 @@
|
||||
// Type definitions for leaflet-geocoder-mapzen v1.6.3
|
||||
// Project: https://github.com/mapzen/leaflet-geocoder
|
||||
// Definitions by: Leonard Lausen <http://leonard.lausen.nl/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
/// <reference path="../leaflet/leaflet.d.ts" />
|
||||
|
||||
declare namespace L {
|
||||
namespace Control {
|
||||
export interface GeocoderStatic extends ClassStatic {
|
||||
/**
|
||||
* Creates a geocoder control.
|
||||
*/
|
||||
new (options?: GeocoderOptions): Geocoder;
|
||||
}
|
||||
|
||||
export interface Geocoder extends L.Control {
|
||||
}
|
||||
|
||||
export interface GeocoderOptions {
|
||||
/**
|
||||
* Host endpoint for a Pelias-compatible search API.
|
||||
*
|
||||
* Default value: 'https://search.mapzen.com/v1'.
|
||||
*/
|
||||
url?: string;
|
||||
|
||||
/**
|
||||
* If true, search is bounded by the current map view.
|
||||
* You may also provide a custom bounding box in form of a LatLngBounds object.
|
||||
* Note: bounds is not supported by autocomplete.
|
||||
*
|
||||
* Default value: false.
|
||||
*/
|
||||
bounds?: LatLngBounds | boolean;
|
||||
|
||||
/**
|
||||
* If true, search and autocomplete prioritizes results near the center
|
||||
* of the current view.
|
||||
* You may also provide a custom LatLng value
|
||||
* (in any of the accepted Leaflet formats) to act as the center bias.
|
||||
*
|
||||
* Default value: 'true'.
|
||||
*/
|
||||
focus?: LatLng | boolean;
|
||||
|
||||
/**
|
||||
* Filters results by layers (documentation).
|
||||
* If left blank, results will come from all available layers.
|
||||
*
|
||||
* Default value: null.
|
||||
*/
|
||||
layers?: string | any[] ;
|
||||
|
||||
/**
|
||||
* An object of key-value pairs which will be serialized
|
||||
* into query parameters that will be passed to the API.
|
||||
* This allows custom queries that are not already supported
|
||||
* by the convenience options listed above.
|
||||
* For a full list of supported parameters,
|
||||
* please read the Mapzen Search documentation.
|
||||
*
|
||||
* IMPORTANT: some parameters only work with the /search endpoint,
|
||||
* and do not apply to /autocomplete requests!
|
||||
* All supplied parameters are passed through;
|
||||
* this library doesn't know which are valid parameters and which are not.
|
||||
* In the event that other options conflict with parameters passed through params,
|
||||
* the params option takes precedence.
|
||||
*
|
||||
* Default value: null.
|
||||
*/
|
||||
params?: Object;
|
||||
|
||||
/**
|
||||
* The position of the control (one of the map corners).
|
||||
* Can be 'topleft', 'topright', 'bottomleft', or 'bottomright'.
|
||||
*
|
||||
* Default value: 'topleft'.
|
||||
*/
|
||||
position?: PositionString;
|
||||
|
||||
/**
|
||||
* Attribution text to include.
|
||||
* Set to blank or null to disable.
|
||||
*
|
||||
* Default value: 'Geocoding by <a href="https://mapzen.com/projects/search/">Mapzen</a>'
|
||||
*/
|
||||
attribution?: string;
|
||||
|
||||
/**
|
||||
* Placeholder text to display in the search input box.
|
||||
* Set to blank or null to disable.
|
||||
*
|
||||
* Default value: 'Search'
|
||||
*/
|
||||
placeholder?: string;
|
||||
|
||||
/**
|
||||
* Tooltip text to display on the search icon. Set to blank or null to disable.
|
||||
*
|
||||
* Default value: 'Search'
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* If true, highlighting a search result pans the map to that location.
|
||||
*
|
||||
* Default value: true
|
||||
*/
|
||||
panToPoint?: boolean;
|
||||
|
||||
/**
|
||||
* If true, an icon is used to indicate a polygonal result,
|
||||
* matching any non-"venue" or non-"address" layer type.
|
||||
* If false, no icon is displayed.
|
||||
* For custom icons, pass a string containing a path to the image.
|
||||
*
|
||||
* Default value: true
|
||||
*/
|
||||
polygonIcon?: boolean | string;
|
||||
|
||||
/**
|
||||
* If true, search results drops Leaflet's default blue markers onto the map.
|
||||
* You may customize this marker's appearance and
|
||||
* behavior using Leaflet marker options.
|
||||
*
|
||||
* Default value: true
|
||||
*/
|
||||
markers?: MarkerOptions | boolean;
|
||||
|
||||
/**
|
||||
* If true, the input box will expand to take up the full width of the map container.
|
||||
* If an integer breakpoint is provided,
|
||||
* the full width applies only if the map container width is below this breakpoint.
|
||||
*
|
||||
* Default value: 650
|
||||
*/
|
||||
fullWidth?: number | boolean;
|
||||
|
||||
/**
|
||||
* If true, the search input is always expanded.
|
||||
* It does not collapse into a button-only state.
|
||||
*
|
||||
* Default value: false
|
||||
*/
|
||||
expanded?: boolean;
|
||||
|
||||
/**
|
||||
* If true, suggested results are fetched on each keystroke.
|
||||
* If false, this is disabled and users must obtain results
|
||||
* by pressing the Enter key after typing in their query.
|
||||
*
|
||||
* Default value: true
|
||||
*/
|
||||
autocomplete?: boolean;
|
||||
|
||||
/**
|
||||
* If true, selected results will make a request to the service /place endpoint.
|
||||
* If false, this is disabled.
|
||||
* The geocoder does not handle responses to /place,
|
||||
* you will need to do handle it yourself in the results event listener (see below).
|
||||
*
|
||||
* Default value: false
|
||||
*/
|
||||
place?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace control {
|
||||
|
||||
/**
|
||||
* Creates a geocoder control.
|
||||
*/
|
||||
export function geocoder(api_key: string, options?: Control.GeocoderOptions): L.Control.Geocoder;
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -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
|
||||
|
||||
Vendored
+1
-1
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
Vendored
+28
@@ -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;
|
||||
@@ -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);
|
||||
|
||||
Vendored
+349
-10
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/// <reference path="../googlemaps/google.maps.d.ts" />
|
||||
/// <reference path='./marker-animate-unobtrusive.d.ts' />
|
||||
|
||||
import SlidingMarker = require('SlidingMarker');
|
||||
import MarkerWithGhost = require('MarkerWithGhost');
|
||||
|
||||
SlidingMarker.initializeGlobally();
|
||||
MarkerWithGhost.initializeGlobally();
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user