mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-24 11:29:30 +08:00
Merge remote-tracking branch 'upstream/master'
* upstream/master: (137 commits) add `delete` method Fixed typing issu Added Navigation typings and tests fix `convert` options on stream version add reference to `node.d.ts` add `imagemagick-native`s type definition file Updated a test code for dat-gui. Add chrome.browser type Add Decorator definition to IModule Update toastr.d.ts Fixed ur to url for RequestResource in phantomjs Update angular.d.ts - JSDoc-ed $filter Fix contructor Fix tests fix vertical whitespace Add mobile-detect type definitions Add type definitions for pty.js union type for `bindToController` AngularJS 1.4 - `bindToController` object definition add fulfilled to Assertion ...
This commit is contained in:
Vendored
+11
-1
@@ -576,7 +576,7 @@ declare module AceAjax {
|
||||
/**
|
||||
* Returns the current tab size.
|
||||
**/
|
||||
getTabSize(): string;
|
||||
getTabSize(): number;
|
||||
|
||||
/**
|
||||
* Returns `true` if the character at the position is a soft tab.
|
||||
@@ -1034,6 +1034,9 @@ declare module AceAjax {
|
||||
* Event sessions dealing with the mouse and keyboard are bubbled up from `Document` to the `Editor`, which decides what to do with them.
|
||||
**/
|
||||
export interface Editor {
|
||||
|
||||
addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any);
|
||||
addEventListener(ev: string, callback: Function);
|
||||
|
||||
inMultiSelectMode: boolean;
|
||||
|
||||
@@ -1710,6 +1713,13 @@ declare module AceAjax {
|
||||
**/
|
||||
new(renderer: VirtualRenderer, session?: IEditSession): Editor;
|
||||
}
|
||||
|
||||
interface EditorChangeEvent {
|
||||
start: Position;
|
||||
end: Position;
|
||||
action: string; // insert, remove
|
||||
lines: any[];
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
/// PlaceHolder
|
||||
|
||||
@@ -10,35 +10,41 @@ module controllers {
|
||||
|
||||
static $inject = ["$upload"];
|
||||
constructor(
|
||||
private $upload: ng.angularFileUpload.IUploadService
|
||||
private $upload: angular.angularFileUpload.IUploadService
|
||||
) {
|
||||
}
|
||||
|
||||
onFileSelect($files: File[]) {
|
||||
//$files: an array of files selected, each file has name, size, and type.
|
||||
var uploads: ng.IPromise<any>[] = [];
|
||||
// $files: an array of files selected, each file has name, size, and type.
|
||||
for (var i = 0; i < $files.length; i++) {
|
||||
var file = $files[i];
|
||||
uploads.push(this.$upload.upload<any>({
|
||||
url: "/api/upload",
|
||||
method: "POST",
|
||||
data: {
|
||||
extraData: {
|
||||
fileName: file.name, test: "anything"
|
||||
}
|
||||
},
|
||||
file: file
|
||||
this.$upload.upload({
|
||||
url: "/api/upload",
|
||||
method: "POST",
|
||||
data: {
|
||||
extraData: {
|
||||
fileName: file.name,
|
||||
test: "anything"
|
||||
}
|
||||
},
|
||||
file: file
|
||||
})
|
||||
.abort()
|
||||
.xhr((evt: any) => {
|
||||
console.log('xhr');
|
||||
})
|
||||
.progress((evt: any) => {
|
||||
console.log('progress');
|
||||
})
|
||||
.then(success => {
|
||||
// file is uploaded successfully
|
||||
console.log(success.data);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
}));
|
||||
.progress((evt: angular.angularFileUpload.IFileProgressEvent) => {
|
||||
var percent = parseInt((100.0 * evt.loaded / evt.total).toString(), 10);
|
||||
console.log("upload progress: " + percent + "% for " + evt.config.file.name);
|
||||
})
|
||||
.error((data: any, status: number, response: any, headers: any) => {
|
||||
console.error(data, status, response, headers);
|
||||
})
|
||||
.success((data: any, status: number, headers: any, config: angular.angularFileUpload.IFileUploadConfig) => {
|
||||
// file is uploaded successfully
|
||||
console.log("Success!", data, status, headers, config);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-4
@@ -1,5 +1,5 @@
|
||||
// Type definitions for Angular File Upload 1.6.7
|
||||
// Project: https://github.com/danialfarid/angular-file-upload
|
||||
// Type definitions for Angular File Upload 4.2.1
|
||||
// Project: https://github.com/danialfarid/ng-file-upload
|
||||
// Definitions by: John Reilly <https://github.com/johnnyreilly>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
@@ -14,8 +14,9 @@ declare module angular.angularFileUpload {
|
||||
}
|
||||
|
||||
interface IUploadPromise<T> extends IHttpPromise<T> {
|
||||
|
||||
abort(): IUploadPromise<T>;
|
||||
progress(callback: IHttpPromiseCallback<T>): IUploadPromise<T>;
|
||||
xhr(callback: IHttpPromiseCallback<T>): IUploadPromise<T>;
|
||||
}
|
||||
|
||||
interface IFileUploadConfig extends IRequestConfig {
|
||||
@@ -23,4 +24,9 @@ declare module angular.angularFileUpload {
|
||||
file: File;
|
||||
fileName?: string;
|
||||
}
|
||||
}
|
||||
|
||||
interface IFileProgressEvent extends ProgressEvent {
|
||||
|
||||
config: IFileUploadConfig;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="angular-jwt.d.ts" />
|
||||
|
||||
var app = angular.module("angular-jwt-tests", ["angular-jwt"]);
|
||||
|
||||
var $jwtHelper: angular.jwt.IJwtHelper;
|
||||
|
||||
var expToken = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3NhbXBsZXMuYXV0aDAuY29tLyIsInN1YiI6ImZhY2Vib29rfDEwMTU0Mjg3MDI3NTEwMzAyIiwiYXVkIjoiQlVJSlNXOXg2MHNJSEJ3OEtkOUVtQ2JqOGVESUZ4REMiLCJleHAiOjE0MTIyMzQ3MzAsImlhdCI6MTQxMjE5ODczMH0.7M5sAV50fF1-_h9qVbdSgqAnXVF7mz3I6RjS6JiH0H8';
|
||||
var tokenPayload = $jwtHelper.decodeToken(expToken);
|
||||
var date = $jwtHelper.getTokenExpirationDate(expToken);
|
||||
var bool = $jwtHelper.isTokenExpired(expToken);
|
||||
|
||||
var $jwtInterceptor: angular.jwt.IJwtInterceptor;
|
||||
|
||||
$jwtInterceptor.tokenGetter = () => {
|
||||
return expToken;
|
||||
}
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for angular-jwt 0.0.8
|
||||
// Project: https://github.com/auth0/angular-jwt
|
||||
// Definitions by: Reto Rezzonico <https://github.com/rerezz>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module angular.jwt {
|
||||
|
||||
interface JwtToken {
|
||||
iss: string;
|
||||
sub: string;
|
||||
aud: string;
|
||||
exp: number;
|
||||
nbf: number;
|
||||
iat: number;
|
||||
jti: string;
|
||||
unique_name: string;
|
||||
}
|
||||
|
||||
interface IJwtHelper {
|
||||
decodeToken(token: string): JwtToken;
|
||||
getTokenExpirationDate(token: any): Date;
|
||||
isTokenExpired(token: any, offsetSeconds?: number): boolean;
|
||||
}
|
||||
|
||||
interface IJwtInterceptor {
|
||||
tokenGetter(): string;
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi
|
||||
|
||||
// AngularFireObject
|
||||
{
|
||||
var obj = sync.$asObject();
|
||||
var obj = $FirebaseObject(ref);
|
||||
|
||||
// $id
|
||||
if (obj.$id !== ref.name()) throw "error";
|
||||
@@ -63,7 +63,7 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi
|
||||
});
|
||||
|
||||
// $ref()
|
||||
if (obj.$ref() !== sync) throw "error";
|
||||
if (obj.$ref() !== ref) throw "error";
|
||||
|
||||
// $bindTo()
|
||||
obj.$bindTo($scope, "data").then(function () {
|
||||
@@ -92,10 +92,10 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi
|
||||
|
||||
// AngularFireArray
|
||||
{
|
||||
var list = sync.$asArray();
|
||||
var list = $FirebaseArray(ref);
|
||||
|
||||
// $ref()
|
||||
if (list.$ref() !== sync) throw "error";
|
||||
if (list.$ref() !== ref) throw "error";
|
||||
|
||||
// $add()
|
||||
list.$add({ foo: "foo value" });
|
||||
|
||||
Vendored
+387
-2
@@ -10,6 +10,9 @@ interface AngularFireService {
|
||||
(firebase: Firebase, config?: any): AngularFire;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated. Not possible with AngularFire 1.0+
|
||||
*/
|
||||
interface AngularFire {
|
||||
$asArray(): AngularFireArray;
|
||||
$asObject(): AngularFireObject;
|
||||
@@ -24,37 +27,279 @@ interface AngularFire {
|
||||
$transaction(key:string, updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise<FirebaseDataSnapshot>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and maintains a synchronized object, with 2-way bindings between Angular and Firebase.
|
||||
*/
|
||||
interface AngularFireObject extends AngularFireSimpleObject {
|
||||
$id: string;
|
||||
$priority: number;
|
||||
$value: any;
|
||||
|
||||
/**
|
||||
* Removes all keys from the FirebaseObject and also removes
|
||||
* the remote data from the server.
|
||||
*
|
||||
* @returns a promise which will resolve after the op completes
|
||||
*/
|
||||
|
||||
$remove(): ng.IPromise<Firebase>;
|
||||
/**
|
||||
* Saves all data on the FirebaseObject back to Firebase.
|
||||
* @returns a promise which will resolve after the save is completed.
|
||||
*/
|
||||
$save(): ng.IPromise<Firebase>;
|
||||
|
||||
/**
|
||||
* The loaded method is invoked after the initial batch of data arrives from the server.
|
||||
* When this resolves, all data which existed prior to calling $asObject() is now cached
|
||||
* locally in the object.
|
||||
*
|
||||
* As a shortcut is also possible to pass resolve/reject methods directly into this
|
||||
* method just as they would be passed to .then()
|
||||
*
|
||||
* @param {Function} resolve
|
||||
* @param {Function} reject
|
||||
* @returns a promise which resolves after initial data is downloaded from Firebase
|
||||
*/
|
||||
$loaded(resolve?: (x: AngularFireObject) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireObject>;
|
||||
|
||||
/**
|
||||
* The loaded method is invoked after the initial batch of data arrives from the server.
|
||||
* When this resolves, all data which existed prior to calling $asObject() is now cached
|
||||
* locally in the object.
|
||||
*
|
||||
* As a shortcut is also possible to pass resolve/reject methods directly into this
|
||||
* method just as they would be passed to .then()
|
||||
*
|
||||
* @param {Function} resolve
|
||||
* @param {Function} reject
|
||||
* @returns a promise which resolves after initial data is downloaded from Firebase
|
||||
*/
|
||||
$loaded(resolve?: (x: AngularFireObject) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireObject>;
|
||||
|
||||
/**
|
||||
* The loaded method is invoked after the initial batch of data arrives from the server.
|
||||
* When this resolves, all data which existed prior to calling $asObject() is now cached
|
||||
* locally in the object.
|
||||
*
|
||||
* As a shortcut is also possible to pass resolve/reject methods directly into this
|
||||
* method just as they would be passed to .then()
|
||||
*
|
||||
* @param {Function} resolve
|
||||
* @param {Function} reject
|
||||
* @returns a promise which resolves after initial data is downloaded from Firebase
|
||||
*/
|
||||
$loaded(resolve?: (x: AngularFireObject) => void, reject?: (err: any) => any): ng.IPromise<AngularFireObject>;
|
||||
$ref(): AngularFire;
|
||||
|
||||
/**
|
||||
* @returns {Firebase} the original Firebase instance used to create this object.
|
||||
*/
|
||||
$ref(): Firebase;
|
||||
|
||||
/**
|
||||
* Creates a 3-way data sync between this object, the Firebase server, and a
|
||||
* scope variable. This means that any changes made to the scope variable are
|
||||
* pushed to Firebase, and vice versa.
|
||||
*
|
||||
* If scope emits a $destroy event, the binding is automatically severed. Otherwise,
|
||||
* it is possible to unbind the scope variable by using the `unbind` function
|
||||
* passed into the resolve method.
|
||||
*
|
||||
* Can only be bound to one scope variable at a time. If a second is attempted,
|
||||
* the promise will be rejected with an error.
|
||||
*
|
||||
* @param {object} scope
|
||||
* @param {string} varName
|
||||
* @returns a promise which resolves to an unbind method after data is set in scope
|
||||
*/
|
||||
$bindTo(scope: ng.IScope, varName: string): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Listeners passed into this method are notified whenever a new change is received
|
||||
* from the server. Each invocation is sent an object containing
|
||||
* <code>{ type: 'value', key: 'my_firebase_id' }</code>
|
||||
*
|
||||
* This method returns an unbind function that can be used to detach the listener.
|
||||
*
|
||||
* @param {Function} cb
|
||||
* @param {Object} [context]
|
||||
* @returns {Function} invoke to stop observing events
|
||||
*/
|
||||
$watch(callback: Function, context?: any): Function;
|
||||
|
||||
/**
|
||||
* Informs $firebase to stop sending events and clears memory being used
|
||||
* by this object (delete's its local content).
|
||||
*/
|
||||
$destroy(): void;
|
||||
}
|
||||
interface AngularFireObjectService {
|
||||
/**
|
||||
* Creates a synchronized object with 2-way bindings between Angular and Firebase.
|
||||
*
|
||||
* @param {Firebase} ref
|
||||
* @returns {FirebaseObject}
|
||||
*/
|
||||
(firebase: Firebase): AngularFireObject;
|
||||
$extend(ChildClass: Object, methods?: Object): Object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and maintains a synchronized list of data. This is a pseudo-read-only array. One should
|
||||
* not call splice(), push(), pop(), et al directly on this array, but should instead use the
|
||||
* $remove and $add methods.
|
||||
*
|
||||
* It is acceptable to .sort() this array, but it is important to use this in conjunction with
|
||||
* $watch(), so that it will be re-sorted any time the server data changes. Examples of this are
|
||||
* included in the $watch documentation.
|
||||
*/
|
||||
interface AngularFireArray extends Array<AngularFireSimpleObject> {
|
||||
/**
|
||||
* Create a new record with a unique ID and add it to the end of the array.
|
||||
* This should be used instead of Array.prototype.push, since those changes will not be
|
||||
* synchronized with the server.
|
||||
*
|
||||
* Any value, including a primitive, can be added in this way. Note that when the record
|
||||
* is created, the primitive value would be stored in $value (records are always objects
|
||||
* by default).
|
||||
*
|
||||
* Returns a future which is resolved when the data has successfully saved to the server.
|
||||
* The resolve callback will be passed a Firebase ref representing the new data element.
|
||||
*
|
||||
* @param data
|
||||
* @returns a promise resolved after data is added
|
||||
*/
|
||||
$add(newData: any): ng.IPromise<Firebase>;
|
||||
|
||||
/**
|
||||
* Pass either an item in the array or the index of an item and it will be saved back
|
||||
* to Firebase. While the array is read-only and its structure should not be changed,
|
||||
* it is okay to modify properties on the objects it contains and then save those back
|
||||
* individually.
|
||||
*
|
||||
* Returns a future which is resolved when the data has successfully saved to the server.
|
||||
* The resolve callback will be passed a Firebase ref representing the saved element.
|
||||
* If passed an invalid index or an object which is not a record in this array,
|
||||
* the promise will be rejected.
|
||||
*
|
||||
* @param {int|object} indexOrItem
|
||||
* @returns a promise resolved after data is saved
|
||||
*/
|
||||
$save(recordOrIndex: any): ng.IPromise<Firebase>;
|
||||
|
||||
/**
|
||||
* Pass either an existing item in this array or the index of that item and it will
|
||||
* be removed both locally and in Firebase. This should be used in place of
|
||||
* Array.prototype.splice for removing items out of the array, as calling splice
|
||||
* will not update the value on the server.
|
||||
*
|
||||
* Returns a future which is resolved when the data has successfully removed from the
|
||||
* server. The resolve callback will be passed a Firebase ref representing the deleted
|
||||
* element. If passed an invalid index or an object which is not a record in this array,
|
||||
* the promise will be rejected.
|
||||
*
|
||||
* @param {int|object} indexOrItem
|
||||
* @returns a promise which resolves after data is removed
|
||||
*/
|
||||
$remove(recordOrIndex: any): ng.IPromise<Firebase>;
|
||||
|
||||
/**
|
||||
* Returns the record for a given Firebase key (record.$id). If the record is not found
|
||||
* then returns null.
|
||||
*
|
||||
* @param {string} key
|
||||
* @returns {Object|null} a record in this array
|
||||
*/
|
||||
$getRecord(key: string): AngularFireSimpleObject;
|
||||
|
||||
/**
|
||||
* Given an item in this array or the index of an item in the array, this returns the
|
||||
* Firebase key (record.$id) for that record. If passed an invalid key or an item which
|
||||
* does not exist in this array, it will return null.
|
||||
*
|
||||
* @param {int|object} indexOrItem
|
||||
* @returns {null|string}
|
||||
*/
|
||||
$keyAt(recordOrIndex: any): string;
|
||||
|
||||
/**
|
||||
* The inverse of $keyAt, this method takes a Firebase key (record.$id) and returns the
|
||||
* index in the array where that record is stored. If the record is not in the array,
|
||||
* this method returns -1.
|
||||
*
|
||||
* @param {String} key
|
||||
* @returns {int} -1 if not found
|
||||
*/
|
||||
$indexFor(key: string): number;
|
||||
|
||||
/**
|
||||
* The loaded method is invoked after the initial batch of data arrives from the server.
|
||||
* When this resolves, all data which existed prior to calling $asArray() is now cached
|
||||
* locally in the array.
|
||||
*
|
||||
* As a shortcut is also possible to pass resolve/reject methods directly into this
|
||||
* method just as they would be passed to .then()
|
||||
*
|
||||
* @param {Function} [resolve]
|
||||
* @param {Function} [reject]
|
||||
* @returns a promise
|
||||
*/
|
||||
$loaded(resolve?: (x: AngularFireArray) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireArray>;
|
||||
|
||||
/**
|
||||
* The loaded method is invoked after the initial batch of data arrives from the server.
|
||||
* When this resolves, all data which existed prior to calling $asArray() is now cached
|
||||
* locally in the array.
|
||||
*
|
||||
* As a shortcut is also possible to pass resolve/reject methods directly into this
|
||||
* method just as they would be passed to .then()
|
||||
*
|
||||
* @param {Function} [resolve]
|
||||
* @param {Function} [reject]
|
||||
* @returns a promise
|
||||
*/
|
||||
$loaded(resolve?: (x: AngularFireArray) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireArray>;
|
||||
|
||||
/**
|
||||
* The loaded method is invoked after the initial batch of data arrives from the server.
|
||||
* When this resolves, all data which existed prior to calling $asArray() is now cached
|
||||
* locally in the array.
|
||||
*
|
||||
* As a shortcut is also possible to pass resolve/reject methods directly into this
|
||||
* method just as they would be passed to .then()
|
||||
*
|
||||
* @param {Function} [resolve]
|
||||
* @param {Function} [reject]
|
||||
* @returns a promise
|
||||
*/
|
||||
$loaded(resolve?: (x: AngularFireArray) => void, reject?: (err: any) => any): ng.IPromise<AngularFireArray>;
|
||||
$ref(): AngularFire;
|
||||
|
||||
/**
|
||||
* @returns {Firebase} the original Firebase ref used to create this object.
|
||||
*/
|
||||
$ref(): Firebase;
|
||||
|
||||
/**
|
||||
* Listeners passed into this method are notified whenever a new change (add, updated,
|
||||
* move, remove) is received from the server. Each invocation is sent an object
|
||||
* containing <code>{ type: 'child_added|child_updated|child_moved|child_removed',
|
||||
* key: 'key_of_item_affected'}</code>
|
||||
*
|
||||
* Additionally, added and moved events receive a prevChild parameter, containing the
|
||||
* key of the item before this one in the array.
|
||||
*
|
||||
* This method returns a function which can be invoked to stop observing events.
|
||||
*
|
||||
* @param {Function} cb
|
||||
* @param {Object} [context]
|
||||
* @returns {Function} used to stop observing
|
||||
*/
|
||||
$watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function;
|
||||
|
||||
/**
|
||||
* Informs $firebase to stop sending events and clears memory being used
|
||||
* by this array (delete's its local content).
|
||||
*/
|
||||
$destroy(): void;
|
||||
}
|
||||
interface AngularFireArrayService {
|
||||
@@ -75,20 +320,160 @@ interface AngularFireAuthService {
|
||||
}
|
||||
|
||||
interface AngularFireAuth {
|
||||
/**
|
||||
* Authenticates the Firebase reference with a custom authentication token.
|
||||
*
|
||||
* @param {string} authToken An authentication token or a Firebase Secret. A Firebase Secret
|
||||
* should only be used for authenticating a server process and provides full read / write
|
||||
* access to the entire Firebase.
|
||||
* @param {Object} [options] An object containing optional client arguments, such as configuring
|
||||
* session persistence.
|
||||
* @return {Promise<Object>} A promise fulfilled with an object containing authentication data.
|
||||
*/
|
||||
$authWithCustomToken(authToken: string, options?: Object): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Authenticates the Firebase reference anonymously.
|
||||
*
|
||||
* @param {Object} [options] An object containing optional client arguments, such as configuring
|
||||
* session persistence.
|
||||
* @return {Promise<Object>} A promise fulfilled with an object containing authentication data.
|
||||
*/
|
||||
$authAnonymously(options?: Object): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Authenticates the Firebase reference with an email/password user.
|
||||
*
|
||||
* @param {Object} credentials An object containing email and password attributes corresponding
|
||||
* to the user account.
|
||||
* @param {Object} [options] An object containing optional client arguments, such as configuring
|
||||
* session persistence.
|
||||
* @return {Promise<Object>} A promise fulfilled with an object containing authentication data.
|
||||
*/
|
||||
$authWithPassword(credentials: FirebaseCredentials, options?: Object): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Authenticates the Firebase reference with the OAuth popup flow.
|
||||
*
|
||||
* @param {string} provider The unique string identifying the OAuth provider to authenticate
|
||||
* with, e.g. google.
|
||||
* @param {Object} [options] An object containing optional client arguments, such as configuring
|
||||
* session persistence.
|
||||
* @return {Promise<Object>} A promise fulfilled with an object containing authentication data.
|
||||
*/
|
||||
$authWithOAuthPopup(provider: string, options?: Object): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Authenticates the Firebase reference with the OAuth redirect flow.
|
||||
*
|
||||
* @param {string} provider The unique string identifying the OAuth provider to authenticate
|
||||
* with, e.g. google.
|
||||
* @param {Object} [options] An object containing optional client arguments, such as configuring
|
||||
* session persistence.
|
||||
* @return {Promise<Object>} A promise fulfilled with an object containing authentication data.
|
||||
*/
|
||||
$authWithOAuthRedirect(provider: string, options?: Object): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Authenticates the Firebase reference with an OAuth token.
|
||||
*
|
||||
* @param {string} provider The unique string identifying the OAuth provider to authenticate
|
||||
* with, e.g. google.
|
||||
* @param {string|Object} credentials Either a string, such as an OAuth 2.0 access token, or an
|
||||
* Object of key / value pairs, such as a set of OAuth 1.0a credentials.
|
||||
* @param {Object} [options] An object containing optional client arguments, such as configuring
|
||||
* session persistence.
|
||||
* @return {Promise<Object>} A promise fulfilled with an object containing authentication data.
|
||||
*/
|
||||
$authWithOAuthToken(provider: string, credentials: Object|string, options?: Object): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Synchronously retrieves the current authentication data.
|
||||
*
|
||||
* @return {Object} The client's authentication data.
|
||||
*/
|
||||
$getAuth(): FirebaseAuthData;
|
||||
|
||||
/**
|
||||
* Asynchronously fires the provided callback with the current authentication data every time
|
||||
* the authentication data changes. It also fires as soon as the authentication data is
|
||||
* retrieved from the server.
|
||||
*
|
||||
* @param {function} callback A callback that fires when the client's authenticate state
|
||||
* changes. If authenticated, the callback will be passed an object containing authentication
|
||||
* data according to the provider used to authenticate. Otherwise, it will be passed null.
|
||||
* @param {string} [context] If provided, this object will be used as this when calling your
|
||||
* callback.
|
||||
* @return {function} A function which can be used to deregister the provided callback.
|
||||
*/
|
||||
$onAuth(callback: Function, context?: any): Function;
|
||||
|
||||
/**
|
||||
* Unauthenticates the Firebase reference.
|
||||
*/
|
||||
$unauth(): void;
|
||||
|
||||
/**
|
||||
* Utility method which can be used in a route's resolve() method to grab the current
|
||||
* authentication data.
|
||||
*
|
||||
* @returns {Promise<Object|null>} A promise fulfilled with the client's current authentication
|
||||
* state, which will be null if the client is not authenticated.
|
||||
*/
|
||||
$waitForAuth(): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Utility method which can be used in a route's resolve() method to require that a route has
|
||||
* a logged in client.
|
||||
*
|
||||
* @returns {Promise<Object>} A promise fulfilled with the client's current authentication
|
||||
* state or rejected if the client is not authenticated.
|
||||
*/
|
||||
$requireAuth(): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Creates a new email/password user. Note that this function only creates the user, if you
|
||||
* wish to log in as the newly created user, call $authWithPassword() after the promise for
|
||||
* this method has been resolved.
|
||||
*
|
||||
* @param {Object} credentials An object containing the email and password of the user to create.
|
||||
* @return {Promise<Object>} A promise fulfilled with the user object, which contains the
|
||||
* uid of the created user.
|
||||
*/
|
||||
$createUser(credentials: FirebaseCredentials): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Removes an email/password user.
|
||||
*
|
||||
* @param {Object} credentials An object containing the email and password of the user to remove.
|
||||
* @return {Promise<>} An empty promise fulfilled once the user is removed.
|
||||
*/
|
||||
$removeUser(credentials: FirebaseCredentials): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Changes the email for an email/password user.
|
||||
*
|
||||
* @param {Object} credentials An object containing the old email, new email, and password of
|
||||
* the user whose email is to change.
|
||||
* @return {Promise<>} An empty promise fulfilled once the email change is complete.
|
||||
*/
|
||||
$changeEmail(credentials: FirebaseChangeEmailCredentials): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Changes the password for an email/password user.
|
||||
*
|
||||
* @param {Object} credentials An object containing the email, old password, and new password of
|
||||
* the user whose password is to change.
|
||||
* @return {Promise<>} An empty promise fulfilled once the password change is complete.
|
||||
*/
|
||||
$changePassword(credentials: FirebaseChangePasswordCredentials): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Sends a password reset email to an email/password user.
|
||||
*
|
||||
* @param {Object} credentials An object containing the email of the user to send a reset
|
||||
* password email to.
|
||||
* @return {Promise<>} An empty promise fulfilled once the reset password email is sent.
|
||||
*/
|
||||
$resetPassword(credentials: FirebaseResetPasswordCredentials): ng.IPromise<any>;
|
||||
}
|
||||
|
||||
Vendored
+5
-2
@@ -39,8 +39,11 @@ declare module angular {
|
||||
dump(obj: any): string;
|
||||
|
||||
// see http://docs.angularjs.org/api/angular.mock.inject
|
||||
inject(...fns: Function[]): any;
|
||||
inject(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
|
||||
inject: {
|
||||
(...fns: Function[]): any;
|
||||
(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
|
||||
strictDi(val?: boolean): void;
|
||||
}
|
||||
|
||||
// see http://docs.angularjs.org/api/angular.mock.module
|
||||
module(...modules: any[]): any;
|
||||
|
||||
@@ -201,6 +201,9 @@ mod.constant(My.Namespace);
|
||||
mod.value('name', 23);
|
||||
mod.value('name', "23");
|
||||
mod.value(My.Namespace);
|
||||
mod.decorator('name', function($scope:ng.IScope){ });
|
||||
mod.decorator('name', ['$scope', <any>function($scope: ng.IScope){ }]);
|
||||
|
||||
|
||||
class TestProvider implements ng.IServiceProvider {
|
||||
constructor(private $scope: ng.IScope) {
|
||||
|
||||
Vendored
+111
-21
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular JS 1.3+
|
||||
// Type definitions for Angular JS 1.4+
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -384,6 +384,14 @@ declare module angular {
|
||||
value(name: string, value: any): IModule;
|
||||
value(object: Object): IModule;
|
||||
|
||||
/**
|
||||
* Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service.
|
||||
* @param name The name of the service to decorate
|
||||
* @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to.
|
||||
*/
|
||||
decorator(name:string, decoratorConstructor: Function): IModule;
|
||||
decorator(name:string, inlineAnnotatedConstructor: any[]): IModule;
|
||||
|
||||
// Properties
|
||||
name: string;
|
||||
requires: string[];
|
||||
@@ -474,6 +482,7 @@ declare module angular {
|
||||
// types do work and it's common to use them.
|
||||
$setViewValue(value: any, trigger?: string): void;
|
||||
$setPristine(): void;
|
||||
$setDirty(): void;
|
||||
$validate(): void;
|
||||
$setTouched(): void;
|
||||
$setUntouched(): void;
|
||||
@@ -736,17 +745,37 @@ declare module angular {
|
||||
eventFn(element: Node, doneFn: () => void): Function;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// FilterService
|
||||
// see http://docs.angularjs.org/api/ng.$filter
|
||||
// see http://docs.angularjs.org/api/ng.$filterProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* $filter - $filterProvider - service in module ng
|
||||
*
|
||||
* Filters are used for formatting data displayed to the user.
|
||||
*
|
||||
* see https://docs.angularjs.org/api/ng/service/$filter
|
||||
*/
|
||||
interface IFilterService {
|
||||
/**
|
||||
* Usage:
|
||||
* $filter(name);
|
||||
*
|
||||
* @param name Name of the filter function to retrieve
|
||||
*/
|
||||
(name: string): Function;
|
||||
}
|
||||
|
||||
/**
|
||||
* $filterProvider - $filter - provider in module ng
|
||||
*
|
||||
* Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To achieve this a filter definition consists of a factory function which is annotated with dependencies and is responsible for creating a filter function.
|
||||
*
|
||||
* see https://docs.angularjs.org/api/ng/provider/$filterProvider
|
||||
*/
|
||||
interface IFilterProvider extends IServiceProvider {
|
||||
register(name: string, filterFactory: Function): IServiceProvider;
|
||||
/**
|
||||
* register(name);
|
||||
*
|
||||
* @param name Name of the filter function, or an object map of filters where the keys are the filter names and the values are the filter factories. Note: Filter names must be valid angular Expressions identifiers, such as uppercase or orderBy. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (myappSubsectionFilterx) or underscores (myapp_subsection_filterx).
|
||||
*/
|
||||
register(name: string | {}): IServiceProvider;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -1032,37 +1061,98 @@ declare module angular {
|
||||
disableAutoScrolling(): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// CacheFactoryService
|
||||
// see http://docs.angularjs.org/api/ng.$cacheFactory
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* $cacheFactory - service in module ng
|
||||
*
|
||||
* Factory that constructs Cache objects and gives access to them.
|
||||
*
|
||||
* see https://docs.angularjs.org/api/ng/service/$cacheFactory
|
||||
*/
|
||||
interface ICacheFactoryService {
|
||||
// Lets not foce the optionsMap to have the capacity member. Even though
|
||||
// it's the ONLY option considered by the implementation today, a consumer
|
||||
// might find it useful to associate some other options to the cache object.
|
||||
//(cacheId: string, optionsMap?: { capacity: number; }): CacheObject;
|
||||
(cacheId: string, optionsMap?: { capacity: number; }): ICacheObject;
|
||||
/**
|
||||
* Factory that constructs Cache objects and gives access to them.
|
||||
*
|
||||
* @param cacheId Name or id of the newly created cache.
|
||||
* @param optionsMap Options object that specifies the cache behavior. Properties:
|
||||
*
|
||||
* capacity — turns the cache into LRU cache.
|
||||
*/
|
||||
(cacheId: string, optionsMap?: { capacity?: number; }): ICacheObject;
|
||||
|
||||
// Methods bellow are not documented
|
||||
/**
|
||||
* Get information about all the caches that have been created.
|
||||
* @returns key-value map of cacheId to the result of calling cache#info
|
||||
*/
|
||||
info(): any;
|
||||
|
||||
/**
|
||||
* Get access to a cache object by the cacheId used when it was created.
|
||||
*
|
||||
* @param cacheId Name or id of a cache to access.
|
||||
*/
|
||||
get(cacheId: string): ICacheObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* $cacheFactory.Cache - type in module ng
|
||||
*
|
||||
* A cache object used to store and retrieve data, primarily used by $http and the script directive to cache templates and other data.
|
||||
*
|
||||
* see https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache
|
||||
*/
|
||||
interface ICacheObject {
|
||||
/**
|
||||
* Retrieve information regarding a particular Cache.
|
||||
*/
|
||||
info(): {
|
||||
/**
|
||||
* the id of the cache instance
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* the number of entries kept in the cache instance
|
||||
*/
|
||||
size: number;
|
||||
|
||||
// Not garanteed to have, since it's a non-mandatory option
|
||||
//capacity: number;
|
||||
//...: any additional properties from the options object when creating the cache.
|
||||
};
|
||||
|
||||
/**
|
||||
* Inserts a named entry into the Cache object to be retrieved later, and incrementing the size of the cache if the key was not already present in the cache. If behaving like an LRU cache, it will also remove stale entries from the set.
|
||||
*
|
||||
* It will not insert undefined values into the cache.
|
||||
*
|
||||
* @param key the key under which the cached data is stored.
|
||||
* @param value the value to store alongside the key. If it is undefined, the key will not be stored.
|
||||
*/
|
||||
put<T>(key: string, value?: T): T;
|
||||
|
||||
/**
|
||||
* Retrieves named data stored in the Cache object.
|
||||
*
|
||||
* @param key the key of the data to be retrieved
|
||||
*/
|
||||
get(key: string): any;
|
||||
|
||||
/**
|
||||
* Removes an entry from the Cache object.
|
||||
*
|
||||
* @param key the key of the entry to be removed
|
||||
*/
|
||||
remove(key: string): void;
|
||||
|
||||
/**
|
||||
* Clears the cache object of any entries.
|
||||
*/
|
||||
removeAll(): void;
|
||||
|
||||
/**
|
||||
* Destroys the Cache object entirely, removing it from the $cacheFactory set.
|
||||
*/
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// CompileService
|
||||
// see http://docs.angularjs.org/api/ng.$compile
|
||||
@@ -1488,7 +1578,7 @@ declare module angular {
|
||||
compile?: IDirectiveCompileFn;
|
||||
controller?: any;
|
||||
controllerAs?: string;
|
||||
bindToController?: boolean;
|
||||
bindToController?: boolean|Object;
|
||||
link?: IDirectiveLinkFn | IDirectivePrePost;
|
||||
name?: string;
|
||||
priority?: number;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path="autoprefixer-core.d.ts" />
|
||||
import autoprefixer = require("autoprefixer-core");
|
||||
|
||||
var css: string;
|
||||
|
||||
var prefixed = autoprefixer.process(css).css;
|
||||
|
||||
var processor = autoprefixer({ browsers: ['> 1%', 'IE 7'], cascade: false });
|
||||
console.log(processor.info());
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// Type definitions for Autoprefixer Core 5.1.11
|
||||
// Project: https://github.com/postcss/autoprefixer-core
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "autoprefixer-core" {
|
||||
interface Config {
|
||||
browsers?: string[];
|
||||
cascade?: boolean;
|
||||
remove?: boolean;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
from?: string;
|
||||
to?: string;
|
||||
safe?: boolean;
|
||||
map?: {
|
||||
inline?: boolean;
|
||||
prev?: string | Object;
|
||||
}
|
||||
}
|
||||
|
||||
interface Result {
|
||||
css: string;
|
||||
map: string;
|
||||
opts: Options;
|
||||
}
|
||||
|
||||
interface Processor {
|
||||
postcss: any;
|
||||
info(): string;
|
||||
process(css: string, opts?: Options): Result;
|
||||
}
|
||||
|
||||
interface Exports {
|
||||
(config: Config): Processor;
|
||||
postcss: any;
|
||||
info(): string;
|
||||
process(css: string, opts?: Options): Result;
|
||||
}
|
||||
|
||||
var exports: Exports;
|
||||
export = exports;
|
||||
}
|
||||
Vendored
+1
-3
@@ -169,9 +169,7 @@ declare module Backbone {
|
||||
**/
|
||||
private static extend(properties: any, classProperties?: any): any;
|
||||
|
||||
// TODO: this really has to be typeof TModel
|
||||
//model: typeof TModel;
|
||||
model: { new(): TModel; }; // workaround
|
||||
model: new (...args:any[]) => TModel;
|
||||
models: TModel[];
|
||||
length: number;
|
||||
|
||||
|
||||
Vendored
+87
-46
@@ -8,12 +8,12 @@
|
||||
declare module Backgrid {
|
||||
|
||||
interface GridOptions {
|
||||
columns: Column[];
|
||||
collection: Backbone.Collection<Backbone.Model>;
|
||||
header: Header;
|
||||
body: Body;
|
||||
row: Row;
|
||||
footer: Footer;
|
||||
columns: Column[];
|
||||
collection: Backbone.Collection<Backbone.Model>;
|
||||
header: Header;
|
||||
body: Body;
|
||||
row: Row;
|
||||
footer: Footer;
|
||||
}
|
||||
|
||||
class Header extends Backbone.View<Backbone.Model> {
|
||||
@@ -21,65 +21,106 @@ declare module Backgrid {
|
||||
|
||||
class Footer extends Backbone.View<Backbone.Model> {
|
||||
}
|
||||
|
||||
|
||||
class Row extends Backbone.View<Backbone.Model> {
|
||||
}
|
||||
|
||||
class Command {
|
||||
cancel();
|
||||
moveDown();
|
||||
moveLeft();
|
||||
moveRight();
|
||||
moveUp();
|
||||
passThru();
|
||||
save();
|
||||
moveUp(): boolean;
|
||||
moveDown(): boolean;
|
||||
moveLeft(): boolean;
|
||||
moveRight(): boolean;
|
||||
save(): boolean;
|
||||
cancel(): boolean;
|
||||
passThru(): boolean;
|
||||
}
|
||||
|
||||
class CellFormatter {
|
||||
fromRaw(rawData: any, model: Backbone.Model);
|
||||
toRaw(formattedData: any, model: Backbone.Model);
|
||||
}
|
||||
|
||||
class NumberFormatter extends CellFormatter {}
|
||||
|
||||
class PercentFormatter extends NumberFormatter {}
|
||||
|
||||
class DateTimeFormatter extends CellFormatter {}
|
||||
|
||||
class StringFormatter extends CellFormatter {}
|
||||
|
||||
class EmailFormatter extends CellFormatter {}
|
||||
|
||||
class SelectFormatter extends CellFormatter {}
|
||||
|
||||
class CellEditor extends Backbone.View<Backbone.Model>{
|
||||
initialize(options?: any);
|
||||
postRender(model: Backbone.Model, column: Backbone.Model);
|
||||
}
|
||||
|
||||
class InputCellEditor extends CellEditor {
|
||||
render();
|
||||
saveOrCancel(event: any);
|
||||
}
|
||||
|
||||
class Cell extends Backbone.View<Backbone.Model>{
|
||||
tagName: string;
|
||||
formatter: CellFormatter;
|
||||
editor: InputCellEditor;
|
||||
enterEditMode();
|
||||
renderError();
|
||||
exitEditMode();
|
||||
remove();
|
||||
}
|
||||
|
||||
class StringCell extends Cell {
|
||||
}
|
||||
|
||||
interface ColumnAttr {
|
||||
name: string;
|
||||
cell: string;
|
||||
headerCell: string;
|
||||
label: string;
|
||||
sortable: boolean;
|
||||
editable: boolean;
|
||||
renderable: boolean;
|
||||
formater: string;
|
||||
name: string;
|
||||
cell: string;
|
||||
headerCell: string;
|
||||
label: string;
|
||||
sortable: boolean;
|
||||
editable: boolean;
|
||||
renderable: boolean;
|
||||
formater: string;
|
||||
}
|
||||
|
||||
class Column extends Backbone.Model {
|
||||
initialize(options?: any);
|
||||
initialize(options?: any);
|
||||
}
|
||||
|
||||
class Body extends Backbone.View<Backbone.Model> {
|
||||
tagName: string;
|
||||
tagName: string;
|
||||
|
||||
initialize(options?: any);
|
||||
insertRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
moveToNextCell(model: Backbone.Model, cell: Column, command: Command);
|
||||
refresh(): Body;
|
||||
remove(): Body;
|
||||
removeRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
render(): Body;
|
||||
initialize(options?: any);
|
||||
insertRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
moveToNextCell(model: Backbone.Model, cell: Column, command: Command);
|
||||
refresh(): Body;
|
||||
remove(): Body;
|
||||
removeRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
render(): Body;
|
||||
}
|
||||
|
||||
class Grid extends Backbone.View<Backbone.Model> {
|
||||
body: Backgrid.Body;
|
||||
className: string;
|
||||
footer: any;
|
||||
header: any;
|
||||
tagName: string;
|
||||
body: Backgrid.Body;
|
||||
className: string;
|
||||
footer: any;
|
||||
header: any;
|
||||
tagName: string;
|
||||
|
||||
initialize(options: any);
|
||||
getSelectedModels(): Backbone.Model[];
|
||||
insertColumn(...options: any[]): Grid;
|
||||
insertRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
remove():Grid;
|
||||
removeColumn(...options: any[]): Grid;
|
||||
removeRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
render():Grid;
|
||||
initialize(options: any);
|
||||
getSelectedModels(): Backbone.Model[];
|
||||
insertColumn(...options: any[]): Grid;
|
||||
insertRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
remove(): Grid;
|
||||
removeColumn(...options: any[]): Grid;
|
||||
removeRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
render(): Grid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
declare module "backgrid" {
|
||||
export = Backgrid;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="bootstrap-slider.d.ts" />
|
||||
|
||||
$(function() {
|
||||
// examples from http://seiyria.github.io/bootstrap-slider/
|
||||
|
||||
$('#ex1').slider({
|
||||
formatter: function(value) {
|
||||
return 'Current value: ' + value;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex2").slider({});
|
||||
|
||||
var RGBChange = function() {
|
||||
$('#RGB').css('background', 'rgb('+r.getValue()+','+g.getValue()+','+b.getValue()+')')
|
||||
};
|
||||
|
||||
var r = $('#R').slider()
|
||||
.on('slide', RGBChange)
|
||||
.data('slider');
|
||||
var g = $('#G').slider()
|
||||
.on('slide', RGBChange)
|
||||
.data('slider');
|
||||
var b = $('#B').slider()
|
||||
.on('slide', RGBChange)
|
||||
.data('slider');
|
||||
|
||||
|
||||
|
||||
$("#ex4").slider({
|
||||
reversed : true
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex5").slider();
|
||||
|
||||
$("#destroyEx5Slider").click(function() {
|
||||
$("#ex5").slider('destroy');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex6").slider();
|
||||
$("#ex6").on("slide", function(slideEvt) {
|
||||
$("#ex6SliderVal").text(<number>slideEvt.value);
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex7").slider();
|
||||
|
||||
$("#ex7-enabled").click(function() {
|
||||
if(this.checked) {
|
||||
// With JQuery
|
||||
$("#ex7").slider("enable");
|
||||
}
|
||||
else {
|
||||
// With JQuery
|
||||
$("#ex7").slider("disable");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex8").slider({
|
||||
tooltip: 'always'
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex9").slider({
|
||||
precision: 2,
|
||||
value: 8.115 // Slider will instantiate showing 8.12 due to specified precision
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex11").slider({step: 20000, min: 0, max: 200000});
|
||||
|
||||
|
||||
|
||||
$("#ex12a").slider({ id: "slider12a", min: 0, max: 10, value: 5 });
|
||||
$("#ex12b").slider({ id: "slider12b", min: 0, max: 10, range: true, value: [3, 7] });
|
||||
$("#ex12c").slider({ id: "slider12c", min: 0, max: 10, range: true, value: [3, 7] });
|
||||
|
||||
|
||||
|
||||
$("#ex13").slider({
|
||||
ticks: [0, 100, 200, 300, 400],
|
||||
ticks_labels: ['$0', '$100', '$200', '$300', '$400'],
|
||||
ticks_snap_bounds: 30
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex14").slider({
|
||||
ticks: [0, 100, 200, 300, 400],
|
||||
ticks_positions: [0, 30, 60, 70, 90, 100],
|
||||
ticks_labels: ['$0', '$100', '$200', '$300', '$400'],
|
||||
ticks_snap_bounds: 30
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex15").slider({
|
||||
min: 1000,
|
||||
max: 10000000,
|
||||
scale: 'logarithmic',
|
||||
step: 10
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex16a").slider({ min: 0, max: 10, value: 0, focus: true });
|
||||
$("#ex16b").slider({ min: 0, max: 10, value: [0, 10], focus: true });
|
||||
});
|
||||
+200
@@ -0,0 +1,200 @@
|
||||
// Type definitions for bootstrap-slider.js 4.8.3
|
||||
// Project: https://github.com/seiyria/bootstrap-slider
|
||||
// Definitions by: Daniel Beckwith <https://github.com/dbeckwith>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface SliderOptions {
|
||||
/**
|
||||
* Default: ''
|
||||
* set the id of the slider element when it's created
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* Default: 0
|
||||
* minimum possible value
|
||||
*/
|
||||
min?: number;
|
||||
/**
|
||||
* Default: 10
|
||||
* maximum possible value
|
||||
*/
|
||||
max?: number;
|
||||
/**
|
||||
* Default: 1
|
||||
* increment step
|
||||
*/
|
||||
step?: number;
|
||||
/**
|
||||
* Default: number of digits after the decimal of step value
|
||||
* The number of digits shown after the decimal. Defaults to the number of digits after the decimal of step value.
|
||||
*/
|
||||
precision?: number;
|
||||
/**
|
||||
* Default: 'horizontal'
|
||||
* set the orientation. Accepts 'vertical' or 'horizontal'
|
||||
*/
|
||||
orientation?: number;
|
||||
/**
|
||||
* Default: 5
|
||||
* initial value. Use array to have a range slider.
|
||||
*/
|
||||
value?: number|number[];
|
||||
/**
|
||||
* Default: false
|
||||
* make range slider. Optional if initial value is an array. If initial value is scalar, max will be used for second value.
|
||||
*/
|
||||
range?: boolean;
|
||||
/**
|
||||
* Default: 'before'
|
||||
* selection placement. Accepts: 'before', 'after' or 'none'. In case of a range slider, the selection will be placed between the handles
|
||||
*/
|
||||
selection?: string;
|
||||
/**
|
||||
* Default: 'show'
|
||||
* whether to show the tooltip on drag, hide the tooltip, or always show the tooltip. Accepts: 'show', 'hide', or 'always'
|
||||
*/
|
||||
tooltip?: string;
|
||||
/**
|
||||
* Default: false
|
||||
* if false show one tootip if true show two tooltips one for each handler
|
||||
*/
|
||||
tooltip_split?: boolean;
|
||||
/**
|
||||
* Default: 'round'
|
||||
* handle shape. Accepts: 'round', 'square', 'triangle' or 'custom'
|
||||
*/
|
||||
handle?: string;
|
||||
/**
|
||||
* Default: false
|
||||
* whether or not the slider should be reversed
|
||||
*/
|
||||
reversed?: boolean;
|
||||
/**
|
||||
* Default: true
|
||||
* whether or not the slider is initially enabled
|
||||
*/
|
||||
enabled?: boolean;
|
||||
/**
|
||||
* Default: returns the plain value
|
||||
* formatter callback. Return the value wanted to be displayed in the tooltip
|
||||
* @param val the current value to display
|
||||
*/
|
||||
formatter?(val:number): string;
|
||||
/**
|
||||
* Default: false
|
||||
* The natural order is used for the arrow keys. Arrow up select the upper slider value for vertical sliders, arrow right the righter slider value for a horizontal slider - no matter if the slider was reversed or not. By default the arrow keys are oriented by arrow up/right to the higher slider value, arrow down/left to the lower slider value.
|
||||
*/
|
||||
natural_arrow_keys?: boolean;
|
||||
/**
|
||||
* Default: [ ]
|
||||
* Used to define the values of ticks. Tick marks are indicators to denote special values in the range. This option overwrites min and max options.
|
||||
*/
|
||||
ticks?: number[];
|
||||
/**
|
||||
* Default: [ ]
|
||||
* Defines the positions of the tick values in percentages. The first value should alwasy be 0, the last value should always be 100 percent.
|
||||
*/
|
||||
ticks_positions?: number[];
|
||||
/**
|
||||
* Default: [ ]
|
||||
* Defines the labels below the tick marks. Accepts HTML input.
|
||||
*/
|
||||
ticks_labels?: string[];
|
||||
/**
|
||||
* Default: 0
|
||||
* Used to define the snap bounds of a tick. Snaps to the tick if value is within these bounds.
|
||||
*/
|
||||
ticks_snap_bounds?: number;
|
||||
/**
|
||||
* Default: 'linear'
|
||||
* Set to 'logarithmic' to use a logarithmic scale.
|
||||
*/
|
||||
scale?: string;
|
||||
/**
|
||||
* Default: false
|
||||
* Focus the appropriate slider handle after a value change.
|
||||
*/
|
||||
focus?: boolean;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* Creates a slider from the current element.
|
||||
* @param options
|
||||
*/
|
||||
slider(options?:SliderOptions): JQuery;
|
||||
slider(methodName:string, ...args:any[]): JQuery;
|
||||
}
|
||||
|
||||
interface ChangeValue {
|
||||
oldValue: number;
|
||||
newValue: number;
|
||||
}
|
||||
|
||||
interface JQueryEventObject {
|
||||
value: number|ChangeValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is actually not used when using the jQuery version of bootstrap-slider
|
||||
* The method documentation is still here thouh.
|
||||
* When using jQuery, slider methods like setValue(3, true) have to be called like $slider.slider('setValue', 3, true)
|
||||
*/
|
||||
interface Slider extends JQuery {
|
||||
/**
|
||||
* Get the current value from the slider
|
||||
*/
|
||||
getValue(): number;
|
||||
/**
|
||||
* Set a new value for the slider. If optional triggerSlideEvent parameter is true, 'slide' events will be triggered. If optional triggerChangeEvent parameter is true, 'change' events will be triggered.
|
||||
* @param newValue
|
||||
* @param triggerSlideEvent
|
||||
* @param triggerChangeEvent
|
||||
*/
|
||||
setValue(newValue:number, triggerSlideEvent?:boolean, triggerChangeEvent?:boolean): void;
|
||||
/**
|
||||
* Properly clean up and remove the slider instance
|
||||
*/
|
||||
destroy(): void;
|
||||
/**
|
||||
* Disables the slider and prevents the user from changing the value
|
||||
*/
|
||||
disable(): void;
|
||||
/**
|
||||
* Enables the slider
|
||||
*/
|
||||
enable(): void;
|
||||
/**
|
||||
* Returns true if enabled, false if disabled
|
||||
*/
|
||||
isEnabled(): boolean;
|
||||
/**
|
||||
* Updates the slider's attributes
|
||||
* @param attribute
|
||||
* @param value
|
||||
*/
|
||||
setAttribute(attribute:string, value:any): void;
|
||||
/**
|
||||
* Get the slider's attributes
|
||||
* @param attribute
|
||||
*/
|
||||
getAttribute(attribute:string): any;
|
||||
/**
|
||||
* Refreshes the current slider
|
||||
*/
|
||||
refresh(): void;
|
||||
/**
|
||||
* Renders the tooltip again, after initialization. Useful in situations when the slider and tooltip are initially hidden.
|
||||
*/
|
||||
relayout(): void;
|
||||
on: {
|
||||
(eventType:string, callback:(eventObject:JQueryEventObject, ...args:any[]) => any): Slider;
|
||||
(eventType:string, data:any, callback:(eventObject:JQueryEventObject, ...args:any[]) => any): Slider;
|
||||
(eventType:string, selector:string, callback:(eventObject:JQueryEventObject, ...eventData:any[]) => any): Slider;
|
||||
(eventType:string, selector:string, data:any, callback:(eventObject:JQueryEventObject, ...eventData:any[]) => any): Slider;
|
||||
(eventType:{ [key: string]: any; }, selector?:string, data?:any): Slider;
|
||||
(eventType:{ [key: string]: any; }, data?:any): Slider;
|
||||
}
|
||||
}
|
||||
@@ -70,3 +70,13 @@ evt.on("init", function () {
|
||||
});
|
||||
|
||||
browserSync(config);
|
||||
|
||||
var bs = browserSync.create();
|
||||
|
||||
bs.init({
|
||||
server: "./app"
|
||||
});
|
||||
|
||||
bs.reload();
|
||||
|
||||
|
||||
|
||||
Vendored
+102
-85
@@ -3,96 +3,113 @@
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../chokidar/chokidar.d.ts"/>
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "browser-sync" {
|
||||
import chokidar = require("chokidar");
|
||||
import fs = require("fs");
|
||||
import http = require("http");
|
||||
|
||||
function BrowserSync(config?: BrowserSync.Options, callback?: (err: Error, bs: Object) => any): void;
|
||||
|
||||
module BrowserSync {
|
||||
export function reload(): void;
|
||||
export function reload(file: string): void;
|
||||
export function reload(files: string[]): void;
|
||||
export function reload(options: {stream: boolean}): NodeJS.ReadWriteStream;
|
||||
|
||||
export function notify(message: string, timeout?: number): void;
|
||||
|
||||
export function exit(): void;
|
||||
|
||||
export var active: boolean;
|
||||
|
||||
export var emitter: NodeJS.EventEmitter;
|
||||
|
||||
interface Options {
|
||||
files?: string | string[];
|
||||
watchOptions?: GazeOptions;
|
||||
server?: ServerOptions;
|
||||
proxy?: string | boolean;
|
||||
port?: number;
|
||||
https?: boolean;
|
||||
ghostMode?: GhostOptions | boolean;
|
||||
logLevel?: string;
|
||||
logPrefix?: string;
|
||||
logConnections?: boolean;
|
||||
logFileChanges?: boolean;
|
||||
logSnippet?: boolean;
|
||||
snippetOptions?: SnippetOptions;
|
||||
tunnel?: string | boolean;
|
||||
online?: boolean;
|
||||
open?: string | boolean;
|
||||
browser?: string | string[];
|
||||
xip?: boolean;
|
||||
notify?: boolean;
|
||||
scrollProportionally?: boolean;
|
||||
scrollThrottle?: number;
|
||||
reloadDelay?: number;
|
||||
injectChanges?: boolean;
|
||||
startPath?: string;
|
||||
minify?: boolean;
|
||||
host?: string;
|
||||
codeSync?: boolean;
|
||||
timestamps?: boolean;
|
||||
scriptPath?: (path: string) => string;
|
||||
socket?: SocketOptions;
|
||||
}
|
||||
|
||||
interface GazeOptions {
|
||||
interval?: number;
|
||||
debounceDelay?: number;
|
||||
mode?: string;
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
interface ServerOptions {
|
||||
baseDir?: string | string[];
|
||||
directory?: boolean;
|
||||
index?: string;
|
||||
routes?: {[path: string]: string};
|
||||
middleware?: MiddlewareHandler[];
|
||||
}
|
||||
|
||||
interface MiddlewareHandler {
|
||||
(req: http.ServerRequest, res: http.ServerResponse, next: Function): any;
|
||||
}
|
||||
|
||||
interface GhostOptions {
|
||||
clicks?: boolean;
|
||||
scroll?: boolean;
|
||||
forms?: boolean;
|
||||
}
|
||||
|
||||
interface SnippetOptions {
|
||||
ignorePaths?: string;
|
||||
rule?: {match?: RegExp; fn?: (snippet: string, match: string) => any};
|
||||
}
|
||||
|
||||
interface SocketOptions {
|
||||
path?: string;
|
||||
clientPath?: string;
|
||||
namespace?: string;
|
||||
}
|
||||
interface Options {
|
||||
files?: string | string[];
|
||||
watchOptions?: GazeOptions;
|
||||
server?: ServerOptions;
|
||||
proxy?: string | boolean;
|
||||
port?: number;
|
||||
https?: boolean;
|
||||
ghostMode?: GhostOptions | boolean;
|
||||
logLevel?: string;
|
||||
logPrefix?: string;
|
||||
logConnections?: boolean;
|
||||
logFileChanges?: boolean;
|
||||
logSnippet?: boolean;
|
||||
snippetOptions?: SnippetOptions;
|
||||
rewriteRules?: boolean | RewriteRules[];
|
||||
tunnel?: string | boolean;
|
||||
online?: boolean;
|
||||
open?: string | boolean;
|
||||
browser?: string | string[];
|
||||
xip?: boolean;
|
||||
notify?: boolean;
|
||||
scrollProportionally?: boolean;
|
||||
scrollThrottle?: number;
|
||||
reloadDelay?: number;
|
||||
reloadDebounce?: number;
|
||||
plugins?: any[];
|
||||
injectChanges?: boolean;
|
||||
startPath?: string;
|
||||
minify?: boolean;
|
||||
host?: string;
|
||||
codeSync?: boolean;
|
||||
timestamps?: boolean;
|
||||
scriptPath?: (path: string) => string;
|
||||
socket?: SocketOptions;
|
||||
}
|
||||
|
||||
export = BrowserSync;
|
||||
interface GazeOptions {
|
||||
interval?: number;
|
||||
debounceDelay?: number;
|
||||
mode?: string;
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
interface ServerOptions {
|
||||
baseDir?: string | string[];
|
||||
directory?: boolean;
|
||||
index?: string;
|
||||
routes?: {[path: string]: string};
|
||||
middleware?: MiddlewareHandler[];
|
||||
}
|
||||
|
||||
interface MiddlewareHandler {
|
||||
(req: http.ServerRequest, res: http.ServerResponse, next: Function): any;
|
||||
}
|
||||
|
||||
interface GhostOptions {
|
||||
clicks?: boolean;
|
||||
scroll?: boolean;
|
||||
forms?: boolean;
|
||||
}
|
||||
|
||||
interface SnippetOptions {
|
||||
ignorePaths?: string;
|
||||
rule?: {match?: RegExp; fn?: (snippet: string, match: string) => any};
|
||||
}
|
||||
|
||||
interface SocketOptions {
|
||||
path?: string;
|
||||
clientPath?: string;
|
||||
namespace?: string;
|
||||
}
|
||||
|
||||
interface RewriteRules {
|
||||
match: RegExp;
|
||||
fn: (match: string) => string;
|
||||
}
|
||||
|
||||
interface BrowserSync {
|
||||
init(config?: Options, callback?: (err: Error, bs: Object) => any): void;
|
||||
reload(): void;
|
||||
reload(file: string): void;
|
||||
reload(files: string[]): void;
|
||||
reload(options: {stream: boolean}): NodeJS.ReadWriteStream;
|
||||
notify(message: string, timeout?: number): void;
|
||||
exit(): void;
|
||||
watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any): NodeJS.EventEmitter;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
emitter: NodeJS.EventEmitter;
|
||||
active: boolean;
|
||||
paused: boolean;
|
||||
}
|
||||
|
||||
interface Exports extends BrowserSync {
|
||||
create(): BrowserSync;
|
||||
(config?: Options, callback?: (err: Error, bs: Object) => any): void;
|
||||
}
|
||||
|
||||
var browserSync: Exports;
|
||||
|
||||
export = browserSync;
|
||||
}
|
||||
|
||||
+19
-3
@@ -1,6 +1,6 @@
|
||||
// Type definitions for bunyan-prettystream
|
||||
// Type definitions for bunyan-prettystream 0.1.3
|
||||
// Project: https://www.npmjs.com/package/bunyan-prettystream
|
||||
// Definitions by: Jason Swearingen <https://github.com/jasonswearingen/>
|
||||
// Definitions by: Jason Swearingen <https://github.com/jasonswearingen/>, Vadim Macagon <https://github.com/enlight/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
@@ -8,7 +8,23 @@
|
||||
declare module "bunyan-prettystream" {
|
||||
import stream = require("stream");
|
||||
class PrettyStream extends stream.Writable {
|
||||
public pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
/**
|
||||
* @param options.mode Output format, can be either `long`, `short`, or `dev`,
|
||||
* defaults to `long`.
|
||||
* @param options.useColor Indicates whether or not output should be colored,
|
||||
* defaults to `true`.
|
||||
*/
|
||||
constructor(options?: { mode?: string; useColor?: boolean });
|
||||
|
||||
/**
|
||||
* Pipes data from this stream to another.
|
||||
*
|
||||
* @param destination Stream to write data to.
|
||||
* @param options.end Indicates whether `end()` should be called on the `destination`
|
||||
* stream when this stream emits `end`, defaults to `true`.
|
||||
* @return The `destination` stream.
|
||||
*/
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
}
|
||||
export = PrettyStream;
|
||||
}
|
||||
@@ -9,6 +9,7 @@ chai.use(chaiAsPromised);
|
||||
var promise: any;
|
||||
chai.expect(promise).to.eventually.equal(3);
|
||||
chai.expect(promise).to.become(3);
|
||||
chai.expect(promise).to.be.fulfilled;
|
||||
chai.expect(promise).to.be.rejected;
|
||||
chai.expect(promise).to.be.rejectedWith(Error);
|
||||
chai.expect(promise).to.notify(() => console.log('done'));
|
||||
|
||||
+1
@@ -14,6 +14,7 @@ declare module Chai {
|
||||
|
||||
interface Assertion {
|
||||
become(expected: any): Assertion;
|
||||
fulfilled: Assertion;
|
||||
rejected: Assertion;
|
||||
rejectedWith(expected: any): Assertion;
|
||||
notify(fn: Function): Assertion;
|
||||
|
||||
Vendored
+1
-5
@@ -1,6 +1,6 @@
|
||||
// Type definitions for chai-subset 1.0.0
|
||||
// Project: https://github.com/e-conomic/chai-subset
|
||||
// Definitions by: Sam Noedel <https://github.com/delta62/>
|
||||
// Definitions by: Sam Noedel <https://github.com/delta62/>, Andrew Brown <https://github.com/AGBrown>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../chai/chai.d.ts" />
|
||||
@@ -11,10 +11,6 @@ declare module Chai {
|
||||
}
|
||||
}
|
||||
|
||||
interface Object {
|
||||
should: Chai.Assertion;
|
||||
}
|
||||
|
||||
declare module "chai-subset" {
|
||||
function chaiSubset(chai: any, utils: any): void;
|
||||
export = chaiSubset;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Vendored
+26
-1
@@ -1,12 +1,15 @@
|
||||
// Type definitions for chai 2.0.0
|
||||
// Project: http://chaijs.com/
|
||||
// Definitions by: Jed Mao <https://github.com/jedmao/>, Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions by: Jed Mao <https://github.com/jedmao/>,
|
||||
// Bart van der Schoor <https://github.com/Bartvds>,
|
||||
// Andrew Brown <https://github.com/AGBrown>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module Chai {
|
||||
|
||||
interface ChaiStatic {
|
||||
expect: ExpectStatic;
|
||||
should(): Should;
|
||||
/**
|
||||
* Provides a way to extend the internals of Chai
|
||||
*/
|
||||
@@ -25,6 +28,24 @@ declare module Chai {
|
||||
(target: any, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface ShouldAssertion {
|
||||
equal(value1: any, value2: any, message?: string): void;
|
||||
Throw: ShouldThrow;
|
||||
throw: ShouldThrow;
|
||||
exist(value: any, message?: string): void;
|
||||
}
|
||||
|
||||
interface Should extends ShouldAssertion {
|
||||
not: ShouldAssertion;
|
||||
fail(actual: any, expected: any, message?: string, operator?: string): void;
|
||||
}
|
||||
|
||||
interface ShouldThrow {
|
||||
(actual: Function): void;
|
||||
(actual: Function, expected: string|RegExp, message?: string): void;
|
||||
(actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void;
|
||||
}
|
||||
|
||||
interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
|
||||
not: Assertion;
|
||||
deep: Deep;
|
||||
@@ -281,3 +302,7 @@ declare var chai: Chai.ChaiStatic;
|
||||
declare module "chai" {
|
||||
export = chai;
|
||||
}
|
||||
|
||||
interface Object {
|
||||
should: Chai.Assertion;
|
||||
}
|
||||
|
||||
Vendored
+31
@@ -43,6 +43,37 @@ declare module chrome.alarms {
|
||||
var onAlarm: AlarmEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the chrome.browser API to interact with the Chrome browser associated with
|
||||
* the current application and Chrome profile.
|
||||
*/
|
||||
declare module chrome.browser {
|
||||
interface Options {
|
||||
/**
|
||||
* The URL to navigate to when the new tab is initially opened.
|
||||
*/
|
||||
url:string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a new tab in a browser window associated with the current application
|
||||
* and Chrome profile. If no browser window for the Chrome profile is opened,
|
||||
* a new one is opened prior to creating the new tab.
|
||||
* @param options Configures how the tab should be opened.
|
||||
* @param callback Called when the tab was successfully
|
||||
* created, or failed to be created. If failed, runtime.lastError will be set.
|
||||
*/
|
||||
export function openTab (options: Options, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* Opens a new tab in a browser window associated with the current application
|
||||
* and Chrome profile. If no browser window for the Chrome profile is opened,
|
||||
* a new one is opened prior to creating the new tab. Since Chrome 42 only.
|
||||
* @param options Configures how the tab should be opened.
|
||||
*/
|
||||
export function openTab (options: Options): void;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Bookmarks
|
||||
////////////////////
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
}
|
||||
|
||||
|
||||
var fill = d3.scale.category20();
|
||||
var fill = d3.scale.category20<number>();
|
||||
d3.layout.cloud().size([300, 300])
|
||||
.words([
|
||||
"Hello", "world", "normally", "you", "want", "more", "words",
|
||||
@@ -40,4 +40,4 @@
|
||||
return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")";
|
||||
})
|
||||
.text(function(d:ICompTextSize) { return d.text; });
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+69
-33
@@ -5,41 +5,77 @@
|
||||
|
||||
/// <reference path="../d3/d3.d.ts" />
|
||||
|
||||
declare module D3 {
|
||||
export module Layout {
|
||||
export interface IRotate {
|
||||
(number:number) : CloudLayout;
|
||||
(number:()=>number) : CloudLayout;
|
||||
declare module d3 {
|
||||
module layout {
|
||||
export function cloud(): Cloud<cloud.Word>;
|
||||
export function cloud<T extends cloud.Word>(): Cloud<T>;
|
||||
|
||||
module cloud {
|
||||
interface Word {
|
||||
text?: string;
|
||||
font?: string;
|
||||
style?: string;
|
||||
weight?: string | number;
|
||||
rotate?: number;
|
||||
size?: number;
|
||||
padding?: number;
|
||||
x?: number;
|
||||
y?: number;
|
||||
}
|
||||
}
|
||||
|
||||
interface Cloud<T extends cloud.Word> {
|
||||
start(): Cloud<T>;
|
||||
stop(): Cloud<T>;
|
||||
|
||||
timeInterval(): number;
|
||||
timeInterval(interval: number): Cloud<T>;
|
||||
|
||||
export interface CloudLayout {
|
||||
(layers: any[], index?: number): any[];
|
||||
values(accessor?: (d: any) => any): CloudLayout;
|
||||
offset(offset: string): CloudLayout;
|
||||
size: {
|
||||
/**
|
||||
* Gets the available layout size
|
||||
*/
|
||||
(): Array<number>;
|
||||
/**
|
||||
* Sets the available layout size
|
||||
*/
|
||||
(size: Array<number>): CloudLayout;
|
||||
};
|
||||
words: (inputArray: Array<any>) => CloudLayout;
|
||||
rotate:IRotate;
|
||||
padding: (number:number) => CloudLayout;
|
||||
font: (string:string) => CloudLayout;
|
||||
fontSize(fctn: (d: any) => number): CloudLayout;
|
||||
on: (eventname: string, callee: (words: any[]) => void) => CloudLayout;
|
||||
start: () => CloudLayout;
|
||||
words(): T[];
|
||||
words(words: T[]): Cloud<T>;
|
||||
|
||||
size(): [number, number];
|
||||
size(size: [number, number]): Cloud<T>;
|
||||
|
||||
font(): (datum: T, index: number) => string;
|
||||
font(font: string): Cloud<T>;
|
||||
font(font: (datum: T, index: number) => string): Cloud<T>;
|
||||
|
||||
fontStyle(): (datum: T, index: number) => string;
|
||||
fontStyle(style: string): Cloud<T>;
|
||||
fontStyle(style: (datum: T, index: number) => string): Cloud<T>;
|
||||
|
||||
fontWeight(): (datum: T, index: number) => string | number;
|
||||
fontWeight(weight: string | number): Cloud<T>;
|
||||
fontWeight(weight: (datum: T, index: number) => string | number): Cloud<T>;
|
||||
|
||||
rotate(): (datum: T, index: number) => number;
|
||||
rotate(rotate: number): Cloud<T>;
|
||||
rotate(rotate: (datum: T, index: number) => number): Cloud<T>;
|
||||
|
||||
text(): (datum: T, index: number) => string;
|
||||
text(text: string): Cloud<T>;
|
||||
text(text: (datum: T, index: number) => string): Cloud<T>;
|
||||
|
||||
spiral(): (size: number) => (t: number) => [number, number];
|
||||
spiral(name: string): Cloud<T>;
|
||||
spiral(spiral: (size: number) => (t: number) => [number, number]): Cloud<T>;
|
||||
|
||||
fontSize(): (datum: T, index: number) => number;
|
||||
fontSize(size: number): Cloud<T>;
|
||||
fontSize(size: (datum: T, index: number) => number): Cloud<T>;
|
||||
|
||||
padding(): (datum: T, index: number) => number;
|
||||
padding(padding: number): Cloud<T>;
|
||||
padding(padding: (datum: T, index: number) => number): Cloud<T>;
|
||||
|
||||
on(type: "word", listener: (word: T) => void): Cloud<T>;
|
||||
on(type: "end", listener: (tags: T[], bounds: { x: number; y: number }[]) => void): Cloud<T>;
|
||||
on(type: string, listener: (...args: any[]) => void): Cloud<T>;
|
||||
|
||||
on(type: "word"): (word: T) => void;
|
||||
on(type: "end"): (tags: T[], bounds: { x: number; y: number }[]) => void;
|
||||
on(type: string): (...args: any[]) => void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export interface Layout {
|
||||
cloud(): CloudLayout;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+386
-392
File diff suppressed because it is too large
Load Diff
Vendored
+3173
-3398
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,7 @@ function superformula() {
|
||||
.attr("width", 960)
|
||||
.attr("height", 500);
|
||||
|
||||
var small = d3.superformula()
|
||||
var small = d3.superformula<string>()
|
||||
.type(function (d) { return d; } )
|
||||
.size(size);
|
||||
|
||||
@@ -37,4 +37,4 @@ function superformula() {
|
||||
.attr("class", "big")
|
||||
.attr("transform", "translate(450,250)")
|
||||
.attr("d", big);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+28
-29
@@ -1,38 +1,37 @@
|
||||
/// <reference path="../d3.d.ts" />
|
||||
|
||||
declare module d3 {
|
||||
export function superformula<T>(): Superformula<T>;
|
||||
|
||||
declare module D3 {
|
||||
interface SuperformulaPath
|
||||
{
|
||||
superformulaPath(params: number[], n: number, diameter: number): Superformula;
|
||||
module superformula {
|
||||
interface Type {
|
||||
m: number;
|
||||
n1: number;
|
||||
n2: number;
|
||||
n3: number;
|
||||
a: number;
|
||||
b: number;
|
||||
}
|
||||
}
|
||||
|
||||
interface Superformula<T> {
|
||||
(datum: T, index: number): string;
|
||||
|
||||
interface SuperformulaType
|
||||
{
|
||||
(any: any): any;//hans
|
||||
m: number;
|
||||
n1: number;
|
||||
n2: number;
|
||||
n3: number;
|
||||
a: number;
|
||||
b: number;
|
||||
type(): (datum: T, index: number) => string;
|
||||
type(type: string): Superformula<T>;
|
||||
type(type: (datum: T, index: number) => string): Superformula<T>;
|
||||
|
||||
size(): (datum: T, index: number) => number;
|
||||
size(size: number): Superformula<T>;
|
||||
size(size: (datum: T, index: number) => number): Superformula<T>;
|
||||
|
||||
segments(): (datum: T, index: number) => number;
|
||||
segments(segments: number): Superformula<T>;
|
||||
segments(segments: (datum: T, index: number) => number): Superformula<T>;
|
||||
|
||||
param(name: string): number;
|
||||
param(name: string, value: number): Superformula<T>;
|
||||
}
|
||||
|
||||
interface Superformula
|
||||
{
|
||||
(): any;
|
||||
type(any: any): any;
|
||||
param(name: string, value: number): Superformula;
|
||||
size(x: number): Superformula;
|
||||
segments(x: number): Superformula;
|
||||
}
|
||||
|
||||
|
||||
interface Base extends Selectors
|
||||
{
|
||||
superformula: Superformula;
|
||||
superformulaPath: SuperformulaPath;
|
||||
superformulaTypes: SuperformulaType[];
|
||||
}
|
||||
export var superformulaTypes: string[];
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -24,7 +24,7 @@ declare module Dagre {
|
||||
|
||||
interface Render {
|
||||
new (): Render;
|
||||
(selection: D3.Selection, g: Dagre.Graph): void;
|
||||
(selection: d3.Selection<any>, g: Dagre.Graph): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -157,3 +157,19 @@ var FizzyText = function () {
|
||||
|
||||
update();
|
||||
}
|
||||
// ------------ 11. Object Literal Tests
|
||||
() => {
|
||||
var obj = {a:1,b:1};
|
||||
var gui = new dat.GUI();
|
||||
var controller = gui.add(obj, 'maxSize', 0, 10);
|
||||
|
||||
controller.onChange(function (value) {
|
||||
// Fires on every change, drag, keypress, etc.
|
||||
});
|
||||
|
||||
controller.onFinishChange(function (value) {
|
||||
// Fires when a controller loses focus.
|
||||
alert("The new value is " + value);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Vendored
+4
-4
@@ -47,8 +47,8 @@ export interface ILegendwidget {
|
||||
legend: (l:ILegendwidget) => T;
|
||||
chartID: () => number;
|
||||
options: (o:Object)=>void ;
|
||||
select: (selector: D3.Selection) => D3.Selection;
|
||||
selectAll: (selector: D3.Selection) => D3.Selection;
|
||||
select: (selector: d3.Selection<any>) => d3.Selection<any>;
|
||||
selectAll: (selector: d3.Selection<any>) => d3.Selection<any>;
|
||||
}
|
||||
|
||||
export interface IEvents {
|
||||
@@ -85,8 +85,8 @@ export interface ILegendwidget {
|
||||
x: IGetSet<any, T>;
|
||||
y: IGetSet<any, T>;
|
||||
elasticY: IGetSet<boolean, T>;
|
||||
xAxis: IGetSet<D3.Svg.Axis, T>;
|
||||
yAxis: IGetSet<D3.Svg.Axis, T>;
|
||||
xAxis: IGetSet<d3.svg.Axis, T>;
|
||||
yAxis: IGetSet<d3.svg.Axis, T>;
|
||||
yAxisPadding: IGetSet<number, T>;
|
||||
xAxisPadding: IGetSet<number, T>;
|
||||
renderHorizontalGridLines: IGetSet<boolean, T>;
|
||||
|
||||
Vendored
+33
-23
@@ -20,6 +20,16 @@ declare module DC {
|
||||
(t: T, r?: R): V;
|
||||
}
|
||||
|
||||
export interface Scale<T> {
|
||||
(x: any): T;
|
||||
|
||||
domain(values: any[]): Scale<T>;
|
||||
domain(): any[];
|
||||
|
||||
range(values: T[]): Scale<T>;
|
||||
range(): T[];
|
||||
}
|
||||
|
||||
export interface Accessor<T, V> {
|
||||
(datum: T, index?: number): V;
|
||||
}
|
||||
@@ -86,7 +96,7 @@ declare module DC {
|
||||
clamp(n: number, min: number, max: number): number;
|
||||
uniqueId(): number;
|
||||
nameToId(name: string): string;
|
||||
appendOrSelect(parent: D3.Selection, selector: string, tag: any): D3.Selection;
|
||||
appendOrSelect(parent: d3.Selection<any>, selector: string, tag: any): d3.Selection<any>;
|
||||
safeNumber(n: any): number;
|
||||
}
|
||||
|
||||
@@ -112,11 +122,11 @@ declare module DC {
|
||||
group: IGetSet<any, T>;
|
||||
ordering: IGetSet<Accessor<any, any>, T>;
|
||||
filterAll(): void;
|
||||
select(selector: D3.Selection|string): D3.Selection;
|
||||
selectAll(selector: D3.Selection|string): D3.Selection;
|
||||
anchor(anchor: BaseMixin<any>|D3.Selection|string, chartGroup?: string): D3.Selection;
|
||||
select(selector: d3.Selection<any>|string): d3.Selection<any>;
|
||||
selectAll(selector: d3.Selection<any>|string): d3.Selection<any>;
|
||||
anchor(anchor: BaseMixin<any>|d3.Selection<any>|string, chartGroup?: string): d3.Selection<any>;
|
||||
anchorName(): string;
|
||||
svg: IGetSet<D3.Selection, D3.Selection>;
|
||||
svg: IGetSet<d3.Selection<any>, d3.Selection<any>>;
|
||||
resetSvg(): void;
|
||||
filterPrinter: IGetSet<(filters: Array<any>) => string, T>;
|
||||
turnOnControls(): void;
|
||||
@@ -160,9 +170,9 @@ declare module DC {
|
||||
}
|
||||
|
||||
export interface ColorMixin<T> {
|
||||
colors: IGetSet<D3.Scale.GenericScale<any>|Array<string>, T>;
|
||||
colors: IGetSet<Array<string> | Scale<string | d3.Color>, T>;
|
||||
ordinalColors(r: Array<string>): void;
|
||||
linearColors(r: Array<number>): void;
|
||||
linearColors(r: Array<string>): void;
|
||||
colorAccessor: IGetSet<Accessor<any, string>, T>;
|
||||
colorDomain: IGetSet<Array<any>, T>;
|
||||
calculateColorDomain(): void;
|
||||
@@ -174,12 +184,12 @@ declare module DC {
|
||||
rangeChart: IGetSet<BaseMixin<any>, T>;
|
||||
zoomScale: IGetSet<Array<any>, T>;
|
||||
zoomOutRestrict: IGetSet<boolean, T>;
|
||||
g: IGetSet<D3.Selection, T>;
|
||||
g: IGetSet<d3.Selection<any>, T>;
|
||||
mouseZoomable: IGetSet<boolean, T>;
|
||||
chartBodyG(): D3.Selection;
|
||||
x: IGetSet<D3.Scale.GenericScale<any>, T>;
|
||||
chartBodyG(): d3.Selection<any>;
|
||||
x: IGetSet<(n: any) => any, T>;
|
||||
xUnits: IGetSet<UnitFunction, T>;
|
||||
xAxis: IGetSet<D3.Svg.Axis, T>;
|
||||
xAxis: IGetSet<d3.svg.Axis, T>;
|
||||
elasticX: IGetSet<boolean, T>;
|
||||
xAxisPadding: IGetSet<number, T>;
|
||||
xUnitCount(): number;
|
||||
@@ -187,8 +197,8 @@ declare module DC {
|
||||
isOrdinal(): boolean;
|
||||
xAxisLabel: IBiGetSet<string, number, T>;
|
||||
yAxisLabel: IBiGetSet<string, number, T>;
|
||||
y: IGetSet<D3.Scale.GenericQuantitativeScale<any>, T>;
|
||||
yAxis: IGetSet<D3.Svg.Axis, T>;
|
||||
y: IGetSet<Scale<number>, T>;
|
||||
yAxis: IGetSet<d3.svg.Axis, T>;
|
||||
elasticY: IGetSet<boolean, T>;
|
||||
renderHorizontalGridLines: IGetSet<boolean, T>;
|
||||
renderVerticalGridLines: IGetSet<boolean, T>;
|
||||
@@ -209,7 +219,7 @@ declare module DC {
|
||||
hideStack(name: string): void;
|
||||
showStack(name: string): void;
|
||||
// title(stackName: string, titleFn: Accessor<any, T>);
|
||||
stackLayout: IGetSet<D3.Layout.StackLayout, T>;
|
||||
stackLayout: IGetSet<d3.layout.Stack<any[], any>, T>;
|
||||
}
|
||||
|
||||
export interface CapMixin<T> {
|
||||
@@ -219,7 +229,7 @@ declare module DC {
|
||||
}
|
||||
|
||||
export interface BubbleMixin<T> extends ColorMixin<T> {
|
||||
r: IGetSet<D3.Scale.GenericQuantitativeScale<any>, T>;
|
||||
r: IGetSet<Scale<number>, T>;
|
||||
radiusValueAccessor: IGetSet<Accessor<any, number>, T>;
|
||||
minRadiusWithLabel: IGetSet<number, T>;
|
||||
maxBubbleRelativeSize: IGetSet<number, T>;
|
||||
@@ -295,8 +305,8 @@ declare module DC {
|
||||
children(): Array<BaseMixin<any>>;
|
||||
shareColors: IGetSet<boolean, CompositeChart>;
|
||||
shareTitle: IGetSet<boolean, CompositeChart>;
|
||||
rightY: IGetSet<D3.Scale.GenericQuantitativeScale<any>, CompositeChart>;
|
||||
rightYAxis: IGetSet<D3.Svg.Axis, CompositeChart>;
|
||||
rightY: IGetSet<(n: any) => any, CompositeChart>;
|
||||
rightYAxis: IGetSet<d3.svg.Axis, CompositeChart>;
|
||||
}
|
||||
|
||||
export interface SeriesChart extends CompositeChart {
|
||||
@@ -314,9 +324,9 @@ declare module DC {
|
||||
|
||||
export interface GeoChoroplethChart extends ColorMixin<GeoChoroplethChart>, BaseMixin<GeoChoroplethChart> {
|
||||
overlayGeoJson(json: any, name: string, keyAccessor: Accessor<any, any>): void;
|
||||
projection: IGetSet<D3.Geo.Projection, GeoChoroplethChart>;
|
||||
projection: IGetSet<d3.geo.Projection, GeoChoroplethChart>;
|
||||
geoJsons(): Array<GeoChoroplethLayer>;
|
||||
geoPath(): D3.Geo.Path;
|
||||
geoPath(): d3.geo.Path;
|
||||
removeGeoJson(name: string): void;
|
||||
}
|
||||
|
||||
@@ -325,9 +335,9 @@ declare module DC {
|
||||
}
|
||||
|
||||
export interface RowChart extends CapMixin<RowChart>, MarginMixin<RowChart>, ColorMixin<RowChart>, BaseMixin<RowChart> {
|
||||
x: IGetSet<D3.Scale.GenericQuantitativeScale<any>, RowChart>;
|
||||
x: IGetSet<Scale<number>, RowChart>;
|
||||
renderTitleLabel: IGetSet<boolean, RowChart>;
|
||||
xAxis: IGetSet<D3.Svg.Axis, RowChart>;
|
||||
xAxis: IGetSet<d3.svg.Axis, RowChart>;
|
||||
fixedBarHeight: IGetSet<number, RowChart>;
|
||||
gap: IGetSet<number, RowChart>;
|
||||
elasticX: IGetSet<boolean, RowChart>;
|
||||
@@ -338,7 +348,7 @@ declare module DC {
|
||||
|
||||
export interface ScatterPlot extends CoordinateGridMixin<ScatterPlot> {
|
||||
existenceAccessor: IGetSet<Accessor<any, boolean>, ScatterPlot>;
|
||||
symbol: IGetSet<D3.Svg.Symbol, ScatterPlot>;
|
||||
symbol: IGetSet<d3.svg.Symbol<any>, ScatterPlot>;
|
||||
symbolSize: IGetSet<number, ScatterPlot>;
|
||||
highlightedSize: IGetSet<number, ScatterPlot>;
|
||||
hiddenSize: IGetSet<number, ScatterPlot>;
|
||||
@@ -392,7 +402,7 @@ declare module DC {
|
||||
renderAll(group?: string): void;
|
||||
redrawAll(group?: string): void;
|
||||
disableTransitions: boolean;
|
||||
transition(selections: D3.Selection, duration: number, callback: (s: D3.Selection) => void): void;
|
||||
transition(selections: d3.Selection<any>, duration: number, callback: (s: d3.Selection<any>) => void): void;
|
||||
|
||||
units: Units;
|
||||
events: Events;
|
||||
|
||||
Vendored
+12
-12
@@ -4873,7 +4873,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
every(arr: any[], callback: Function, thisObject: Object): boolean;
|
||||
every(arr: any[], callback: Function, thisObject?: Object): boolean;
|
||||
/**
|
||||
* Determines whether or not every item in arr satisfies the
|
||||
* condition implemented by callback.
|
||||
@@ -4887,7 +4887,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
every(arr: String, callback: Function, thisObject: Object): boolean;
|
||||
every(arr: String, callback: Function, thisObject?: Object): boolean;
|
||||
/**
|
||||
* Determines whether or not every item in arr satisfies the
|
||||
* condition implemented by callback.
|
||||
@@ -4901,7 +4901,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
every(arr: any[], callback: String, thisObject: Object): boolean;
|
||||
every(arr: any[], callback: String, thisObject?: Object): boolean;
|
||||
/**
|
||||
* Determines whether or not every item in arr satisfies the
|
||||
* condition implemented by callback.
|
||||
@@ -4915,7 +4915,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
every(arr: String, callback: String, thisObject: Object): boolean;
|
||||
every(arr: String, callback: String, thisObject?: Object): boolean;
|
||||
/**
|
||||
* Returns a new Array with those items from arr that match the
|
||||
* condition implemented by callback.
|
||||
@@ -4929,7 +4929,7 @@ declare module dojo {
|
||||
* @param callback a function that is invoked with three arguments (item,index, array). The return of this function is expected tobe a boolean which determines whether the passed-in itemwill be included in the returned array.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
filter(arr: any[], callback: Function, thisObject: Object): any[];
|
||||
filter(arr: any[], callback: Function, thisObject?: Object): any[];
|
||||
/**
|
||||
* Returns a new Array with those items from arr that match the
|
||||
* condition implemented by callback.
|
||||
@@ -4943,7 +4943,7 @@ declare module dojo {
|
||||
* @param callback a function that is invoked with three arguments (item,index, array). The return of this function is expected tobe a boolean which determines whether the passed-in itemwill be included in the returned array.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
filter(arr: any[], callback: String, thisObject: Object): any[];
|
||||
filter(arr: any[], callback: String, thisObject?: Object): any[];
|
||||
/**
|
||||
* for every item in arr, callback is invoked. Return values are ignored.
|
||||
* If you want to break out of the loop, consider using array.every() or array.some().
|
||||
@@ -5020,7 +5020,7 @@ declare module dojo {
|
||||
* @param fromIndex Optional
|
||||
* @param findLast OptionalMakes indexOf() work like lastIndexOf(). Used internally; not meant for external usage.
|
||||
*/
|
||||
indexOf(arr: any[], value: Object, fromIndex: number, findLast: boolean): number;
|
||||
indexOf(arr: any[], value: Object, fromIndex?: number, findLast?: boolean): number;
|
||||
/**
|
||||
* locates the last index of the provided value in the passed
|
||||
* array. If the value is not found, -1 is returned.
|
||||
@@ -5036,7 +5036,7 @@ declare module dojo {
|
||||
* @param value
|
||||
* @param fromIndex Optional
|
||||
*/
|
||||
lastIndexOf(arr: any, value: any, fromIndex: number): number;
|
||||
lastIndexOf(arr: any, value: any, fromIndex?: number): number;
|
||||
/**
|
||||
* applies callback to each element of arr and returns
|
||||
* an Array with the results
|
||||
@@ -5110,7 +5110,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
some(arr: any[], callback: Function, thisObject: Object): boolean;
|
||||
some(arr: any[], callback: Function, thisObject?: Object): boolean;
|
||||
/**
|
||||
* Determines whether or not any item in arr satisfies the
|
||||
* condition implemented by callback.
|
||||
@@ -5124,7 +5124,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
some(arr: String, callback: Function, thisObject: Object): boolean;
|
||||
some(arr: String, callback: Function, thisObject?: Object): boolean;
|
||||
/**
|
||||
* Determines whether or not any item in arr satisfies the
|
||||
* condition implemented by callback.
|
||||
@@ -5138,7 +5138,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
some(arr: any[], callback: String, thisObject: Object): boolean;
|
||||
some(arr: any[], callback: String, thisObject?: Object): boolean;
|
||||
/**
|
||||
* Determines whether or not any item in arr satisfies the
|
||||
* condition implemented by callback.
|
||||
@@ -5152,7 +5152,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
some(arr: String, callback: String, thisObject: Object): boolean;
|
||||
some(arr: String, callback: String, thisObject?: Object): boolean;
|
||||
}
|
||||
/**
|
||||
* Permalink: http://dojotoolkit.org/api/1.9/dojo/_base/connect.html
|
||||
|
||||
+3
-3
@@ -6,9 +6,9 @@ function testEach() {
|
||||
return {
|
||||
paused: true,
|
||||
readable: false,
|
||||
started: true,
|
||||
done: true,
|
||||
total: true,
|
||||
started: 11,
|
||||
done: 12,
|
||||
total: 22,
|
||||
on: function (eventName: string, cb: (a: any, b?: () => void) => void) {
|
||||
return EachStaticClass([]);
|
||||
},
|
||||
|
||||
Vendored
+4
-4
@@ -6,9 +6,9 @@
|
||||
interface Each {
|
||||
paused: boolean;
|
||||
readable: boolean;
|
||||
started: boolean;
|
||||
done: boolean;
|
||||
total: boolean;
|
||||
started: number;
|
||||
done: number;
|
||||
total: number;
|
||||
on(eventName: string, onCallback: Function): Each;
|
||||
on(eventName: "item", onItem: (item: any, next: (error?: Error) => void) => void): Each;
|
||||
on(eventName: "error", onError: (error: Error[]) => void): Each;
|
||||
@@ -36,4 +36,4 @@ declare var each: EachStatic;
|
||||
|
||||
declare module "each" {
|
||||
export = each;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -58,7 +58,7 @@ declare module EmberStates {
|
||||
@arg {String} label optional string for labeling the promise. Useful for tooling.
|
||||
@return {Promise}
|
||||
*/
|
||||
then(onFulfilled: Function, onRejected: Function, label?: string): Ember.RSVP.Promise;
|
||||
then(onFulfilled: Function, onRejected?: Function, label?: string): Ember.RSVP.Promise;
|
||||
|
||||
/**
|
||||
Forwards to the internal `promise` property which you can
|
||||
|
||||
Vendored
+5
@@ -349,6 +349,11 @@ declare module "express" {
|
||||
/**
|
||||
* Parse the "Host" header field hostname.
|
||||
*/
|
||||
hostname: string;
|
||||
|
||||
/**
|
||||
* @deprecated Use hostname instead.
|
||||
*/
|
||||
host: string;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/// <reference path="farbtastic.d.ts" />
|
||||
|
||||
var callback = () => {};
|
||||
var domNode = document.createElement("div");
|
||||
|
||||
// Basic usage
|
||||
|
||||
// Can add a ready() handler to the document which initializes the color picker and links it to the text field
|
||||
$(document).ready(function() {
|
||||
$("#colorpicker").farbtastic("#color");
|
||||
});
|
||||
|
||||
// Advanced Usage: jQuery Method
|
||||
|
||||
// Create color pickers in the selected objects
|
||||
$("#colorpicker").farbtastic();
|
||||
|
||||
// Optional callback using a callback function
|
||||
$("#colorpicker").farbtastic(callback);
|
||||
$("#colourpicker").farbtastic(function (color) {
|
||||
console.log(typeof color === "string");
|
||||
});
|
||||
|
||||
// Optional callback using a DOM node
|
||||
$("#colorpicker").farbtastic(domNode);
|
||||
|
||||
// Optional callback using a jQuery object
|
||||
$("#colorpicker").farbtastic($("#color"));
|
||||
|
||||
// Optional callback using a jQuery selector
|
||||
$("#colorpicker").farbtastic("#color");
|
||||
|
||||
// Advanced Usage: Object
|
||||
|
||||
// Can invoke method for returning Farbtastic object instead of a jQuery object
|
||||
$.farbtastic(domNode);
|
||||
$.farbtastic($("#color"));
|
||||
$.farbtastic("#color");
|
||||
|
||||
// Optional callback using a callback function
|
||||
$.farbtastic(domNode, callback);
|
||||
$.farbtastic($("#color"), callback);
|
||||
$.farbtastic("#color", callback);
|
||||
|
||||
// Optional callback using a DOM node
|
||||
$.farbtastic(domNode, domNode);
|
||||
$.farbtastic($("#color"), domNode);
|
||||
$.farbtastic("#color", domNode);
|
||||
|
||||
// Optional callback using a jQuery object
|
||||
$.farbtastic(domNode, $("#color"));
|
||||
$.farbtastic($("#color"), $("#color"));
|
||||
$.farbtastic("#color", $("#color"));
|
||||
|
||||
// Optional callback using a jQuery selector
|
||||
$.farbtastic(domNode, "#color");
|
||||
$.farbtastic($("#color"), "#color");
|
||||
$.farbtastic("#color", "#color");
|
||||
|
||||
// Advanced Usage: Options
|
||||
$("#colorpicker").farbtastic({
|
||||
callback: (color) => {
|
||||
console.log(color);
|
||||
}
|
||||
});
|
||||
$.farbtastic(domNode, {
|
||||
width: 500
|
||||
});
|
||||
$.farbtastic($("#color"), {
|
||||
wheelWidth: 300
|
||||
});
|
||||
$.farbtastic("#color", {});
|
||||
|
||||
// Advanced Usage: Methods
|
||||
$.farbtastic("#colorpicker").linkTo(callback);
|
||||
$.farbtastic("#colorpicker").linkTo(domNode);
|
||||
$.farbtastic("#colorpicker").linkTo("#color");
|
||||
$.farbtastic("#colorpicker").linkTo($("#color"));
|
||||
|
||||
$.farbtastic("#colorpicker").setColor("#aabbcc");
|
||||
$.farbtastic("#colorpicker").setColor([0.1, 0.2, 0.3]);
|
||||
$.farbtastic("#colorpicker").setHSL([0.1, 0.2, 0.3]);
|
||||
|
||||
// Advanced Usage: Properties
|
||||
$.farbtastic("#colorpicker").color === "#aabbcc";
|
||||
$.farbtastic("#colorpicker").hsl === [0.1, 0.2, 0.3];
|
||||
$.farbtastic("#colorpicker").linked === $("#colorpicker");
|
||||
$.farbtastic("#colorpicker").linked === callback;
|
||||
|
||||
// Can chain jQuery methods
|
||||
$("#colorpicker")
|
||||
.farbtastic()
|
||||
.addClass("color-picker");
|
||||
|
||||
// Can chain Farbtastic methods
|
||||
$.farbtastic("#colorpicker")
|
||||
.linkTo(domNode)
|
||||
.setColor("#000000")
|
||||
.setHSL([0, 0, 0]);
|
||||
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// Type definitions for Farbtastic: jQuery Color Wheel v2.0.0-alpha.1
|
||||
// Project: http://mattfarina.github.io/farbtastic/
|
||||
// Definitions by: Matt Brooks <https://github.com/EnableSoftware>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module JQueryFarbtastic {
|
||||
type Placeholder = string | Element | JQuery;
|
||||
type CallbackFunction = (color: string) => any;
|
||||
type Callback = CallbackFunction | Placeholder;
|
||||
|
||||
interface Options {
|
||||
callback?: Callback;
|
||||
width?: number;
|
||||
wheelWidth?: number;
|
||||
}
|
||||
|
||||
interface Farbtastic {
|
||||
linked: CallbackFunction | JQuery;
|
||||
color: string;
|
||||
hsl: number[];
|
||||
|
||||
linkTo(callback: Callback): Farbtastic;
|
||||
setColor(color: string | number[]): Farbtastic;
|
||||
setHSL(hsl: number[]): Farbtastic;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
farbtastic(placeholder: JQueryFarbtastic.Placeholder, callback: JQueryFarbtastic.Callback): JQueryFarbtastic.Farbtastic;
|
||||
farbtastic(placeholder: JQueryFarbtastic.Placeholder, options: JQueryFarbtastic.Options): JQueryFarbtastic.Farbtastic;
|
||||
farbtastic(placeholder: JQueryFarbtastic.Placeholder): JQueryFarbtastic.Farbtastic;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
farbtastic(callback: JQueryFarbtastic.Callback): JQuery;
|
||||
farbtastic(options: JQueryFarbtastic.Options): JQuery;
|
||||
farbtastic(): JQuery;
|
||||
}
|
||||
Vendored
+39
@@ -65,6 +65,45 @@ declare module gapi.auth {
|
||||
* @param token The token to set.
|
||||
*/
|
||||
export function setToken(token: GoogleApiOAuth2TokenObject): void;
|
||||
/**
|
||||
* Initiates the client-side Google+ Sign-In OAuth 2.0 flow.
|
||||
* When the method is called, the OAuth 2.0 authorization dialog is displayed to the user and when they accept, the callback function is called.
|
||||
* @param params
|
||||
*/
|
||||
export function signIn(params: {
|
||||
/**
|
||||
* Your OAuth 2.0 client ID that you obtained from the Google Developers Console.
|
||||
*/
|
||||
clientid?: string;
|
||||
/**
|
||||
* Directs the sign-in button to store user and session information in a session cookie and HTML5 session storage on the user's client for the purpose of minimizing HTTP traffic and distinguishing between multiple Google accounts a user might be signed into.
|
||||
*/
|
||||
cookiepolicy?: string;
|
||||
/**
|
||||
* A function in the global namespace, which is called when the sign-in button is rendered and also called after a sign-in flow completes.
|
||||
*/
|
||||
callback?: Function;
|
||||
/**
|
||||
* If true, all previously granted scopes remain granted in each incremental request, for incremental authorization. The default value true is correct for most use cases; use false only if employing delegated auth, where you pass the bearer token to a less-trusted component with lower programmatic authority.
|
||||
*/
|
||||
includegrantedscopes?: boolean;
|
||||
/**
|
||||
* If your app will write moments, list the full URI of the types of moments that you intend to write.
|
||||
*/
|
||||
requestvisibleactions?: any;
|
||||
/**
|
||||
* The OAuth 2.0 scopes for the APIs that you would like to use as a space-delimited list.
|
||||
*/
|
||||
scope?: any;
|
||||
/**
|
||||
* If you have an Android app, you can drive automatic Android downloads from your web sign-in flow.
|
||||
*/
|
||||
apppackagename?: string;
|
||||
}): void;
|
||||
/**
|
||||
* Signs a user out of your app without logging the user out of Google. This method will only work when the user is signed in with Google+ Sign-In.
|
||||
*/
|
||||
export function signOut(): void;
|
||||
}
|
||||
|
||||
declare module gapi.client {
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
// Type definitions for gulp-istanbul v0.8.1
|
||||
// Project: https://github.com/SBoudrias/gulp-istanbul
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-istanbul" {
|
||||
function GulpIstanbul(opts?: GulpIstanbul.Options): NodeJS.ReadWriteStream;
|
||||
|
||||
module GulpIstanbul {
|
||||
export function hookRequire(): NodeJS.ReadWriteStream;
|
||||
export function summarizeCoverage(opts?: {coverageVariable?: string}): Coverage;
|
||||
export function writeReports(opts?: ReportOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
interface Options {
|
||||
coverageVariable?: string;
|
||||
includeUntested?: boolean;
|
||||
embedSource?: boolean;
|
||||
preserveComments?: boolean;
|
||||
noCompact?: boolean;
|
||||
noAutoWrap?: boolean;
|
||||
codeGenerationOptions?: Object;
|
||||
debug?: boolean;
|
||||
walkDebug?: boolean;
|
||||
}
|
||||
|
||||
interface Coverage {
|
||||
lines: CoverageStats;
|
||||
statements: CoverageStats;
|
||||
functions: CoverageStats;
|
||||
branches: CoverageStats;
|
||||
}
|
||||
|
||||
interface CoverageStats {
|
||||
total: number;
|
||||
covered: number;
|
||||
skipped: number;
|
||||
pct: number;
|
||||
}
|
||||
|
||||
interface ReportOptions {
|
||||
dir?: string;
|
||||
reporters?: string[];
|
||||
reportOpts?: {dir?: string};
|
||||
coverageVariable?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = GulpIstanbul;
|
||||
}
|
||||
@@ -29,4 +29,17 @@ gulp.task('test', function (cb) {
|
||||
.pipe(istanbul.writeReports({reporters: ['text']})) // Creating the reports after tests runned
|
||||
.on('end', cb);
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('test', function (cb) {
|
||||
gulp.src(['lib/**/*.js', 'main.js'])
|
||||
.pipe(istanbul({includeUntested: true})) // Covering files
|
||||
.pipe(istanbul.hookRequire())
|
||||
.on('finish', function () {
|
||||
gulp.src(['test/*.html'])
|
||||
.pipe(testFramework())
|
||||
.pipe(istanbul.writeReports({reporters: ['text']})) // Creating the reports after tests runned
|
||||
.pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) //
|
||||
.on('end', cb);
|
||||
});
|
||||
});
|
||||
Vendored
+15
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for gulp-istanbul
|
||||
// Type definitions for gulp-istanbul v0.9.0
|
||||
// Project: https://github.com/SBoudrias/gulp-istanbul
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -12,6 +12,7 @@ declare module "gulp-istanbul" {
|
||||
export function hookRequire(): NodeJS.ReadWriteStream;
|
||||
export function summarizeCoverage(opts?: {coverageVariable?: string}): Coverage;
|
||||
export function writeReports(opts?: ReportOptions): NodeJS.ReadWriteStream;
|
||||
export function enforceThresholds(opts?: ThresholdOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
interface Options {
|
||||
coverageVariable?: string;
|
||||
@@ -45,7 +46,19 @@ declare module "gulp-istanbul" {
|
||||
reportOpts?: {dir?: string};
|
||||
coverageVariable?: string;
|
||||
}
|
||||
|
||||
interface ThresholdOptions {
|
||||
coverageVariable?: string;
|
||||
thresholds?: { global?: Coverage|number; each?: Coverage|number };
|
||||
}
|
||||
|
||||
interface CoverageOptions {
|
||||
lines?: number;
|
||||
statements?: number;
|
||||
functions?: number;
|
||||
branches?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export = GulpIstanbul;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path="hashids.d.ts" />
|
||||
|
||||
/* require hashids */
|
||||
import Hashids = require("hashids");
|
||||
|
||||
/* creating class object */
|
||||
var hashids = new Hashids("this is my salt");
|
||||
|
||||
/* encoding several numbers into one id */
|
||||
var id = hashids.encode(1337, 5, 77, 12345678);
|
||||
id = hashids.encode(1337);
|
||||
id = hashids.encode(45, 434, 1313, 99);
|
||||
|
||||
/* decoding that id */
|
||||
var numbers = hashids.decode(id);
|
||||
numbers.length > 0 ? true : false;
|
||||
|
||||
hashids = new Hashids("this is my salt", 0, "abcdefgh123456789");
|
||||
hashids = new Hashids("this is my salt", 8);
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
// Type definitions for Hashids.js 1.x
|
||||
// Project: https://github.com/ivanakimov/hashids.node.js
|
||||
// Definitions by: Paulo Cesar <https://github.com/pocesar/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module Hashids {
|
||||
|
||||
export interface IHashids {
|
||||
new(salt: string, minHashLength?: number, alphabet?: string): IHashids;
|
||||
version: string;
|
||||
minAlphabetLength: number;
|
||||
sepDiv: number;
|
||||
guardDiv: number;
|
||||
errorAlphabetLength: string;
|
||||
errorAlphabetSpace: string;
|
||||
alphabet: string[];
|
||||
seps: string;
|
||||
minHashLength: number;
|
||||
salt: string;
|
||||
decode(hash: string): number[];
|
||||
encode(arg: number): string;
|
||||
encode(arg: number[]): string;
|
||||
encode(...args: number[]): string;
|
||||
encodeHex(str: string): string;
|
||||
decodeHex(hash: string): string;
|
||||
hash(input: number, alphabet: string): string;
|
||||
unhash(input: string[], alphabet: string): number;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'hashids' {
|
||||
var hashids: Hashids.IHashids;
|
||||
export = hashids;
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
/// <reference path="imagemagick-native.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import imagemagick = require('imagemagick-native');
|
||||
import fs = require('fs');
|
||||
|
||||
|
||||
// Examples
|
||||
|
||||
// * Convert formats
|
||||
// Convert from one format to another with quality control:
|
||||
fs.writeFileSync('after.png', imagemagick.convert({
|
||||
srcData: fs.readFileSync('before.jpg'),
|
||||
format: 'PNG',
|
||||
quality: 100 // (best) to 1 (worst)
|
||||
}));
|
||||
|
||||
// * Blur
|
||||
// Blur image:
|
||||
fs.writeFileSync('after.jpg', imagemagick.convert({
|
||||
srcData: fs.readFileSync('before.jpg'),
|
||||
blur: 5
|
||||
}));
|
||||
|
||||
// * Resize
|
||||
// Resized images by specifying width and height. There are three resizing styles:
|
||||
// - aspectfill: Default. The resulting image will be exactly the specified size, and may be cropped.
|
||||
// - aspectfit: Scales the image so that it will not have to be cropped.
|
||||
// - fill: Squishes or stretches the image so that it fills exactly the specified size.
|
||||
fs.writeFileSync('after_resize.jpg', imagemagick.convert({
|
||||
srcData: fs.readFileSync('before_resize.jpg'),
|
||||
width: 100,
|
||||
height: 100,
|
||||
resizeStyle: 'aspectfill', // is the default, or 'aspectfit' or 'fill'
|
||||
gravity: 'Center' // optional: position crop area when using 'aspectfill'
|
||||
}));
|
||||
|
||||
// * Rotate, flip, and mirror
|
||||
// Rotate and flip images, and combine the two to mirror:
|
||||
fs.writeFileSync('after_rotateflip.jpg', imagemagick.convert({
|
||||
srcData: fs.readFileSync('before_rotateflip.jpg'),
|
||||
rotate: 180,
|
||||
flip: true
|
||||
}));
|
||||
|
||||
|
||||
// API Reference
|
||||
|
||||
// * convert(options, [callback])
|
||||
// Convert a buffer provided as options.srcData and return a Buffer.
|
||||
var options = {
|
||||
srcData: fs.readFileSync('source.jpg'),
|
||||
srcFormat: 'jpeg',
|
||||
quality: 90,
|
||||
trim: true,
|
||||
trimFuzz: 0.25,
|
||||
width: 100,
|
||||
height: 100,
|
||||
density: 96,
|
||||
resizeStyle: 'aspectfill',
|
||||
gravity: 'NorthWest',
|
||||
format: 'png',
|
||||
filter: 'Lnaczos',
|
||||
blur: 3,
|
||||
strip: true,
|
||||
rotate: 30,
|
||||
flip: true,
|
||||
debug: true,
|
||||
ignoreWarnings: false
|
||||
};
|
||||
|
||||
imagemagick.convert(options, (err: any, buffer: Buffer) => {
|
||||
// check err, use buffer
|
||||
});
|
||||
fs.createReadStream('input.png')
|
||||
.pipe(imagemagick.streams.convert({
|
||||
quality: 75,
|
||||
width: 160,
|
||||
height: 160
|
||||
}))
|
||||
.pipe(fs.createWriteStream('output.png'));
|
||||
|
||||
|
||||
// * identify(options, [callback])
|
||||
// Identify a buffer provided as srcData and return an object.
|
||||
imagemagick.identify({
|
||||
srcData: fs.readFileSync('target.jpg'),
|
||||
debug: true,
|
||||
ignoreWarnings: false
|
||||
}, (err: any, result: imagemagick.IIdentifyResult) => {
|
||||
// check err, use result
|
||||
});
|
||||
|
||||
// * quantizeColors(options)
|
||||
// Quantize the image to a specified amount of colors from a buffer provided as srcData and return an array.
|
||||
var colors = imagemagick.quantizeColors({
|
||||
srcData: fs.readFileSync('target.jpg'),
|
||||
colors: 3,
|
||||
debug: true,
|
||||
ignoreWarnings: false
|
||||
});
|
||||
|
||||
// * composite(options, [callback])
|
||||
// Composite a buffer provided as options.compositeData on a buffer provided as options.srcData with gravity specified by options.gravity and return a Buffer
|
||||
imagemagick.composite({
|
||||
srcData: fs.readFileSync('target.jpg'),
|
||||
compositeData: fs.readFileSync('composite.jpg'),
|
||||
gravity: 'NorthWestGravity',
|
||||
debug: true,
|
||||
ignoreWarnings: false
|
||||
}, (err: any, buffer: Buffer) => {
|
||||
// check err, use buffer
|
||||
});
|
||||
|
||||
// * getConstPixels(options)
|
||||
// Get pixels of provided rectangular region.
|
||||
var pixels = imagemagick.getConstPixels({
|
||||
srcData: fs.readFileSync('target.jpg'),
|
||||
x: 0,
|
||||
y: 0,
|
||||
columns: 1,
|
||||
rows: 1
|
||||
});
|
||||
|
||||
// * quantumDepth
|
||||
// Return ImageMagick's QuantumDepth, which is defined in compile time.
|
||||
var depth: number = imagemagick.quantumDepth();
|
||||
|
||||
// * version
|
||||
// Return ImageMagick's version as string.
|
||||
var version: string = imagemagick.version();
|
||||
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
// Type definitions for imagemagick-native 1.7.0
|
||||
// Project: https://www.npmjs.org/package/imagemagick-native
|
||||
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "imagemagick-native" {
|
||||
|
||||
import stream = require('stream');
|
||||
export module streams {
|
||||
export function convert(options: IStreamConvertOptions): stream.Transform;
|
||||
}
|
||||
|
||||
function convert(options: IConvertOptions): Buffer;
|
||||
function convert(options: IConvertOptions, callback: (err: any, result: Buffer) => void): void;
|
||||
function identify(options: IIdentifyOptions): IIdentifyResult;
|
||||
function identify(options: IIdentifyOptions, callback: (err: any, result: IIdentifyResult) => void): void;
|
||||
function quantizeColors(options: IQuantizeColorsOptions): IQuantizeColorsItem[];
|
||||
function composite(options: ICompositeOptions): Buffer;
|
||||
function composite(options: ICompositeOptions, callback: (err: any, result: Buffer) => void): void;
|
||||
function getConstPixels(options: IConstPixelsOptions): IConstPixelsItem[];
|
||||
function quantumDepth(): number;
|
||||
function version(): string;
|
||||
|
||||
export interface IStreamConvertOptions {
|
||||
srcFormat?: string;
|
||||
quality?: number;
|
||||
trim?: boolean;
|
||||
trimFuzz?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
density?: number;
|
||||
resizeStyle?: string;
|
||||
gravity?: string;
|
||||
format?: string;
|
||||
filter?: string;
|
||||
blur?: number;
|
||||
strip?: boolean;
|
||||
rotate?: number;
|
||||
flip?: boolean;
|
||||
debug?: boolean;
|
||||
ignoreWarnings?: boolean;
|
||||
}
|
||||
export interface IConvertOptions {
|
||||
srcData: Buffer;
|
||||
srcFormat?: string;
|
||||
quality?: number;
|
||||
trim?: boolean;
|
||||
trimFuzz?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
density?: number;
|
||||
resizeStyle?: string;
|
||||
gravity?: string;
|
||||
format?: string;
|
||||
filter?: string;
|
||||
blur?: number;
|
||||
strip?: boolean;
|
||||
rotate?: number;
|
||||
flip?: boolean;
|
||||
debug?: boolean;
|
||||
ignoreWarnings?: boolean;
|
||||
}
|
||||
export interface IIdentifyOptions {
|
||||
srcData: Buffer;
|
||||
debug?: boolean;
|
||||
ignoreWarnings?: boolean;
|
||||
}
|
||||
export interface IIdentifyResult {
|
||||
format: string;
|
||||
width: number;
|
||||
height: number;
|
||||
depth: number;
|
||||
density : {
|
||||
width : number;
|
||||
height : number;
|
||||
};
|
||||
exif: {
|
||||
orientation: number; // 0 if none exists or e.g. 3 (portrait iPad pictures)
|
||||
};
|
||||
}
|
||||
export interface IQuantizeColorsOptions {
|
||||
srcData: Buffer;
|
||||
colors: number;
|
||||
debug?: boolean;
|
||||
ignoreWarnings?: boolean;
|
||||
}
|
||||
export interface IQuantizeColorsItem {
|
||||
r: number;
|
||||
g: number;
|
||||
b: number;
|
||||
hex: string;
|
||||
}
|
||||
export interface ICompositeOptions {
|
||||
srcData: Buffer;
|
||||
compositeData: Buffer;
|
||||
gravity?: string;
|
||||
debug?: boolean;
|
||||
ignoreWarnings?: boolean;
|
||||
}
|
||||
export interface IConstPixelsOptions {
|
||||
srcData: Buffer;
|
||||
x: number;
|
||||
y: number;
|
||||
columns: number;
|
||||
rows: number;
|
||||
}
|
||||
export interface IConstPixelsItem {
|
||||
red: number;
|
||||
green: number;
|
||||
blue: number;
|
||||
opacity: number;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ var interactable = interact(button);
|
||||
interactable.draggable();
|
||||
interactable.draggable(true);
|
||||
interactable.draggable({
|
||||
onstart: (event: InteractEvent) => {},
|
||||
onmove : (event: InteractEvent) => {},
|
||||
onend : (event: InteractEvent) => {}
|
||||
onstart: (event: Interact.InteractEvent) => {},
|
||||
onmove : (event: Interact.InteractEvent) => {},
|
||||
onend : (event: Interact.InteractEvent) => {}
|
||||
});
|
||||
interactable.dropzone();
|
||||
interactable.dropzone(true);
|
||||
@@ -45,7 +45,7 @@ interactable.inertia({
|
||||
});
|
||||
interactable.inertia(true);
|
||||
interactable.actionChecker();
|
||||
interactable.actionChecker((event: MouseEvent, defaultAction: string, interactable2: Interactable) => defaultAction);
|
||||
interactable.actionChecker((event: MouseEvent, defaultAction: string, interactable2: Interact.Interactable) => defaultAction);
|
||||
var rect: ClientRect = interactable.getRect();
|
||||
interactable.rectChecker();
|
||||
interactable.styleCursor();
|
||||
|
||||
Vendored
+234
-234
@@ -1,245 +1,245 @@
|
||||
// Type definitions for Interacting for interact.js v1.0.25
|
||||
// Project: https://github.com/taye/interact.js
|
||||
// Definitions by: Douglas Eichelberger <https://github.com/dduugg>, Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions by: Douglas Eichelberger <https://github.com/dduugg>, Adi Dahiya <https://github.com/adidahiya>, Tom Hasner <https://github.com/thasner>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// API documentation: http://interactjs.io/docs
|
||||
|
||||
interface Interactable {
|
||||
// returns Element or string
|
||||
accept(): any;
|
||||
accept(newValue: Element): Interactable;
|
||||
accept(newValue: string): Interactable;
|
||||
actionChecker(): Function;
|
||||
actionChecker(checker: Function): Interactable;
|
||||
// returns boolean or {[key: string]: any}
|
||||
autoScroll(): any;
|
||||
autoScroll(options: boolean): Interactable;
|
||||
autoScroll(options: {[key: string]: any}): Interactable;
|
||||
context(): Node;
|
||||
defaultActionChecker(event: any): string;
|
||||
deltaSource(): string;
|
||||
// returns Interactable if newValue is "page" or "client", otherwise returns string
|
||||
deltaSource(newValue: String): Interactable;
|
||||
draggable(): boolean;
|
||||
draggable(options: boolean): Interactable;
|
||||
draggable(options: {[key: string]: any}): Interactable;
|
||||
dropCheck(event: MouseEvent): boolean;
|
||||
dropCheck(event: TouchEvent): boolean;
|
||||
dropChecker(): Function;
|
||||
dropChecker(checker: Function): Interactable;
|
||||
// returns boolean or {[key: string]: any}
|
||||
dropzone(): any;
|
||||
dropzone(options: boolean): Interactable;
|
||||
dropzone(options: {[key: string]: any}): Interactable;
|
||||
// return HTMLElement or SVGElement
|
||||
element(): Element;
|
||||
fire(iEvent: InteractEvent): Interactable;
|
||||
// returns boolean or {[key: string]: any}
|
||||
gesturable(): any;
|
||||
gesturable(options: boolean): Interactable;
|
||||
gesturable(options: {[key: string]: any}): Interactable;
|
||||
getRect(): ClientRect;
|
||||
// returns Element or string
|
||||
ignoreFrom(): any;
|
||||
ignoreFrom(newValue: string): Interactable;
|
||||
ignoreFrom(newValue: Element): Interactable;
|
||||
// returns boolean or {[key: string]: any}
|
||||
inertia(): any;
|
||||
inertia(options: boolean): Interactable;
|
||||
inertia(options: {[key: string]: any}): Interactable;
|
||||
off(eventType: string, listener: Function, useCapture?: boolean): Interactable;
|
||||
on(eventType: string, listener: Function, useCapture?: boolean): Interactable;
|
||||
origin(): Point;
|
||||
origin(newValue: HTMLElement): Interactable;
|
||||
origin(newValue: SVGElement): Interactable;
|
||||
origin(newValue: Point): Interactable;
|
||||
rectChecker(): Function;
|
||||
rectChecker(newValue: Function): Interactable;
|
||||
resizable(): Interactable;
|
||||
resizable(options: boolean): Interactable;
|
||||
resizable(options: {[key: string]: any}): Interactable;
|
||||
restrict(): Restrict;
|
||||
restrict(newValue: Restrict): Interactable;
|
||||
set(options: {[key: string]: any}): Interactable;
|
||||
// returns boolean or {[key: string]: any}
|
||||
snap(): any;
|
||||
snap(options: boolean): Interactable;
|
||||
snap(options: {[key: string]: any}): Interactable;
|
||||
squareResize(): boolean;
|
||||
squareResize(newValue: boolean): Interactable;
|
||||
styleCursor(): boolean;
|
||||
styleCursor(newValue: boolean): Interactable;
|
||||
unset(): InteractStatic;
|
||||
validateSetting(context: string, option: string, value: any): any;
|
||||
declare module Interact {
|
||||
interface Interactable {
|
||||
// returns Element or string
|
||||
accept(): any;
|
||||
accept(newValue: Element): Interactable;
|
||||
accept(newValue: string): Interactable;
|
||||
actionChecker(): Function;
|
||||
actionChecker(checker: Function): Interactable;
|
||||
// returns boolean or {[key: string]: any}
|
||||
autoScroll(): any;
|
||||
autoScroll(options: boolean): Interactable;
|
||||
autoScroll(options: {[key: string]: any}): Interactable;
|
||||
context(): Node;
|
||||
defaultActionChecker(event: any): string;
|
||||
deltaSource(): string;
|
||||
// returns Interactable if newValue is "page" or "client", otherwise returns string
|
||||
deltaSource(newValue: String): Interactable;
|
||||
draggable(): boolean;
|
||||
draggable(options: boolean): Interactable;
|
||||
draggable(options: {[key: string]: any}): Interactable;
|
||||
dropCheck(event: MouseEvent): boolean;
|
||||
dropCheck(event: TouchEvent): boolean;
|
||||
dropChecker(): Function;
|
||||
dropChecker(checker: Function): Interactable;
|
||||
// returns boolean or {[key: string]: any}
|
||||
dropzone(): any;
|
||||
dropzone(options: boolean): Interactable;
|
||||
dropzone(options: {[key: string]: any}): Interactable;
|
||||
// return HTMLElement or SVGElement
|
||||
element(): Element;
|
||||
fire(iEvent: InteractEvent): Interactable;
|
||||
// returns boolean or {[key: string]: any}
|
||||
gesturable(): any;
|
||||
gesturable(options: boolean): Interactable;
|
||||
gesturable(options: {[key: string]: any}): Interactable;
|
||||
getRect(): ClientRect;
|
||||
// returns Element or string
|
||||
ignoreFrom(): any;
|
||||
ignoreFrom(newValue: string): Interactable;
|
||||
ignoreFrom(newValue: Element): Interactable;
|
||||
// returns boolean or {[key: string]: any}
|
||||
inertia(): any;
|
||||
inertia(options: boolean): Interactable;
|
||||
inertia(options: {[key: string]: any}): Interactable;
|
||||
off(eventType: string, listener: Function, useCapture?: boolean): Interactable;
|
||||
on(eventType: string, listener: Function, useCapture?: boolean): Interactable;
|
||||
origin(): Point;
|
||||
origin(newValue: HTMLElement): Interactable;
|
||||
origin(newValue: SVGElement): Interactable;
|
||||
origin(newValue: Point): Interactable;
|
||||
rectChecker(): Function;
|
||||
rectChecker(newValue: Function): Interactable;
|
||||
resizable(): Interactable;
|
||||
resizable(options: boolean): Interactable;
|
||||
resizable(options: {[key: string]: any}): Interactable;
|
||||
restrict(): Restrict;
|
||||
restrict(newValue: Restrict): Interactable;
|
||||
set(options: {[key: string]: any}): Interactable;
|
||||
// returns boolean or {[key: string]: any}
|
||||
snap(): any;
|
||||
snap(options: boolean): Interactable;
|
||||
snap(options: {[key: string]: any}): Interactable;
|
||||
squareResize(): boolean;
|
||||
squareResize(newValue: boolean): Interactable;
|
||||
styleCursor(): boolean;
|
||||
styleCursor(newValue: boolean): Interactable;
|
||||
unset(): InteractStatic;
|
||||
validateSetting(context: string, option: string, value: any): any;
|
||||
}
|
||||
|
||||
interface Coordinates {
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
timeStamp: number;
|
||||
}
|
||||
|
||||
interface Debug {
|
||||
target: any;
|
||||
dragging: any;
|
||||
resizing: any;
|
||||
gesturing: any;
|
||||
prepared: any;
|
||||
|
||||
prevCoords: Coordinates;
|
||||
downCoords: Coordinates;
|
||||
|
||||
pointerIds: any[];
|
||||
pointerMoves: any[];
|
||||
addPointer: any;
|
||||
removePointer: any;
|
||||
recordPointers: any;
|
||||
|
||||
inertia: InertiaStatus;
|
||||
|
||||
downTime: any;
|
||||
downEvent: any;
|
||||
prevEvent: any;
|
||||
|
||||
Interactable: any;
|
||||
IOptions: any;
|
||||
interactables: any;
|
||||
dropzones: any;
|
||||
pointerIsDown: any;
|
||||
defaultOptions: any;
|
||||
defaultActionChecker: any;
|
||||
|
||||
actions: any;
|
||||
dragMove: any;
|
||||
resizeMove: any;
|
||||
gestureMove: any;
|
||||
pointerUp: any;
|
||||
pointerDown: any;
|
||||
pointerMove: any;
|
||||
pointerHover: any;
|
||||
|
||||
events: any;
|
||||
globalEvents: any;
|
||||
delegatedEvents: any;
|
||||
}
|
||||
|
||||
interface InertiaStatus {
|
||||
active: boolean;
|
||||
target: any;
|
||||
targetElement: any;
|
||||
|
||||
startEvent: any;
|
||||
pointerUp: any
|
||||
|
||||
xe: number;
|
||||
ye: number;
|
||||
duration: number;
|
||||
|
||||
t0: number;
|
||||
vx0: number;
|
||||
vys: number;
|
||||
|
||||
lambda_v0: number;
|
||||
one_ve_v0: number;
|
||||
i: any;
|
||||
}
|
||||
|
||||
interface Point {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
// value types are either ClientRect or Element
|
||||
interface Restrict {
|
||||
drag?: any;
|
||||
gesture?: any;
|
||||
resize?: any;
|
||||
elementRect?: {[direction: string]: number};
|
||||
}
|
||||
|
||||
interface InteractEvent {
|
||||
altKey: boolean;
|
||||
axes: string;
|
||||
button: number
|
||||
clientX0: number;
|
||||
clientX: number
|
||||
clientY0: number;
|
||||
clientY: number
|
||||
ctrlKey: boolean
|
||||
dt: number;
|
||||
duration: number;
|
||||
dx: number;
|
||||
dy: number;
|
||||
metaKey: boolean;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
shiftKey: boolean;
|
||||
speed: number;
|
||||
t0: number;
|
||||
target: any;
|
||||
timeStamp: number;
|
||||
type: string;
|
||||
velocityX: number;
|
||||
velocityY: number;
|
||||
x0: number;
|
||||
y0: number;
|
||||
}
|
||||
|
||||
interface TouchEvent {
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface InteractStatic {
|
||||
(element: HTMLElement): Interactable;
|
||||
(element: SVGElement): Interactable;
|
||||
(element: string): Interactable;
|
||||
// returns boolean or {[key: string]: any}
|
||||
autoScroll(): any;
|
||||
autoScroll(options: boolean): InteractStatic;
|
||||
autoScroll(options: {[key: string]: any}): InteractStatic;
|
||||
currentAction(): string
|
||||
debug(): Debug;
|
||||
deltaSource(): string;
|
||||
// "page" and "client" are the valid parameters
|
||||
deltaSource(newValue: string): InteractStatic;
|
||||
dynamicDrop(): boolean;
|
||||
dynamicDrop(newValue: boolean): InteractStatic;
|
||||
enableDragging(): boolean;
|
||||
enableDragging(newValue: boolean): InteractStatic;
|
||||
enableGesturing(): boolean;
|
||||
enableGesturing(newValue: boolean): InteractStatic;
|
||||
enableResizing(): boolean;
|
||||
enableResizing(newValue: boolean): InteractStatic;
|
||||
// returns boolean or {[key: string]: any}
|
||||
inertia(): any;
|
||||
inertia(options: boolean): InteractStatic;
|
||||
inertia(options: {[key: string]: any}): InteractStatic;
|
||||
isSet(element: Element): boolean;
|
||||
margin(): number;
|
||||
margin(newvalue: number): InteractStatic;
|
||||
off(type: string, listener: Function, useCapture?: boolean): InteractStatic;
|
||||
on(type: string, listener: Function, useCapture?: boolean): InteractStatic;
|
||||
restrict(): Restrict;
|
||||
restrict(newValue: Restrict): InteractStatic;
|
||||
simulate(action: string, element: Element, pointerEvent?: any): InteractStatic;
|
||||
// returns boolean or {[key: string]: any}
|
||||
snap(): any;
|
||||
snap(options: boolean): InteractStatic;
|
||||
snap(options: {[key: string]: any}): InteractStatic;
|
||||
stop(event: Event): InteractStatic;
|
||||
styleCursor(): boolean;
|
||||
styleCursor(newValue: boolean): InteractStatic;
|
||||
supportsTouch(): boolean
|
||||
}
|
||||
}
|
||||
|
||||
interface Coordinates {
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
timeStamp: number;
|
||||
}
|
||||
|
||||
interface Debug {
|
||||
target: any;
|
||||
dragging: any;
|
||||
resizing: any;
|
||||
gesturing: any;
|
||||
prepared: any;
|
||||
|
||||
prevCoords: Coordinates;
|
||||
downCoords: Coordinates;
|
||||
|
||||
pointerIds: any[];
|
||||
pointerMoves: any[];
|
||||
addPointer: any;
|
||||
removePointer: any;
|
||||
recordPointers: any;
|
||||
|
||||
inertia: InertiaStatus;
|
||||
|
||||
downTime: any;
|
||||
downEvent: any;
|
||||
prevEvent: any;
|
||||
|
||||
Interactable: any;
|
||||
IOptions: any;
|
||||
interactables: any;
|
||||
dropzones: any;
|
||||
pointerIsDown: any;
|
||||
defaultOptions: any;
|
||||
defaultActionChecker: any;
|
||||
|
||||
actions: any;
|
||||
dragMove: any;
|
||||
resizeMove: any;
|
||||
gestureMove: any;
|
||||
pointerUp: any;
|
||||
pointerDown: any;
|
||||
pointerMove: any;
|
||||
pointerHover: any;
|
||||
|
||||
events: any;
|
||||
globalEvents: any;
|
||||
delegatedEvents: any;
|
||||
}
|
||||
|
||||
interface InertiaStatus {
|
||||
active: boolean;
|
||||
target: any;
|
||||
targetElement: any;
|
||||
|
||||
startEvent: any;
|
||||
pointerUp: any
|
||||
|
||||
xe: number;
|
||||
ye: number;
|
||||
duration: number;
|
||||
|
||||
t0: number;
|
||||
vx0: number;
|
||||
vys: number;
|
||||
|
||||
lambda_v0: number;
|
||||
one_ve_v0: number;
|
||||
i: any;
|
||||
}
|
||||
|
||||
interface Point {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
// value types are either ClientRect or Element
|
||||
interface Restrict {
|
||||
drag?: any;
|
||||
gesture?: any;
|
||||
resize?: any;
|
||||
elementRect?: {[direction: string]: number};
|
||||
}
|
||||
|
||||
interface InteractEvent {
|
||||
altKey: boolean;
|
||||
axes: string;
|
||||
button: number
|
||||
clientX0: number;
|
||||
clientX: number
|
||||
clientY0: number;
|
||||
clientY: number
|
||||
ctrlKey: boolean
|
||||
dt: number;
|
||||
duration: number;
|
||||
dx: number;
|
||||
dy: number;
|
||||
metaKey: boolean;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
shiftKey: boolean;
|
||||
speed: number;
|
||||
t0: number;
|
||||
target: any;
|
||||
timeStamp: number;
|
||||
type: string;
|
||||
velocityX: number;
|
||||
velocityY: number;
|
||||
x0: number;
|
||||
y0: number;
|
||||
}
|
||||
|
||||
interface TouchEvent {
|
||||
changedTouches: any[];
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
touches: any[];
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface InteractStatic {
|
||||
(element: HTMLElement): Interactable;
|
||||
(element: SVGElement): Interactable;
|
||||
(element: string): Interactable;
|
||||
// returns boolean or {[key: string]: any}
|
||||
autoScroll(): any;
|
||||
autoScroll(options: boolean): InteractStatic;
|
||||
autoScroll(options: {[key: string]: any}): InteractStatic;
|
||||
currentAction(): string
|
||||
debug(): Debug;
|
||||
deltaSource(): string;
|
||||
// "page" and "client" are the valid parameters
|
||||
deltaSource(newValue: string): InteractStatic;
|
||||
dynamicDrop(): boolean;
|
||||
dynamicDrop(newValue: boolean): InteractStatic;
|
||||
enableDragging(): boolean;
|
||||
enableDragging(newValue: boolean): InteractStatic;
|
||||
enableGesturing(): boolean;
|
||||
enableGesturing(newValue: boolean): InteractStatic;
|
||||
enableResizing(): boolean;
|
||||
enableResizing(newValue: boolean): InteractStatic;
|
||||
// returns boolean or {[key: string]: any}
|
||||
inertia(): any;
|
||||
inertia(options: boolean): InteractStatic;
|
||||
inertia(options: {[key: string]: any}): InteractStatic;
|
||||
isSet(element: Element): boolean;
|
||||
margin(): number;
|
||||
margin(newvalue: number): InteractStatic;
|
||||
off(type: string, listener: Function, useCapture?: boolean): InteractStatic;
|
||||
on(type: string, listener: Function, useCapture?: boolean): InteractStatic;
|
||||
restrict(): Restrict;
|
||||
restrict(newValue: Restrict): InteractStatic;
|
||||
simulate(action: string, element: Element, pointerEvent?: any): InteractStatic;
|
||||
// returns boolean or {[key: string]: any}
|
||||
snap(): any;
|
||||
snap(options: boolean): InteractStatic;
|
||||
snap(options: {[key: string]: any}): InteractStatic;
|
||||
stop(event: Event): InteractStatic;
|
||||
styleCursor(): boolean;
|
||||
styleCursor(newValue: boolean): InteractStatic;
|
||||
supportsTouch(): boolean
|
||||
}
|
||||
|
||||
declare var interact: InteractStatic;
|
||||
declare var interact: Interact.InteractStatic;
|
||||
|
||||
declare module "interact" {
|
||||
export = interact;
|
||||
|
||||
Vendored
+11
-2
@@ -61,6 +61,11 @@ declare module 'joi' {
|
||||
options?: ValidationOptions;
|
||||
}
|
||||
|
||||
export interface ValidationResult<T> {
|
||||
error: ValidationError;
|
||||
value: T;
|
||||
}
|
||||
|
||||
export interface SchemaMap {
|
||||
[key: string]: Schema;
|
||||
}
|
||||
@@ -252,6 +257,11 @@ declare module 'joi' {
|
||||
* Requires the string value to contain no whitespace before or after. If the validation convert option is on (enabled by default), the string will be trimmed.
|
||||
*/
|
||||
trim(): StringSchema;
|
||||
|
||||
/**
|
||||
* Requires the string value to be a valid uri with the passed scheme.
|
||||
*/
|
||||
uri(options?: { scheme?: string }): StringSchema;
|
||||
}
|
||||
|
||||
export interface ArraySchema extends AnySchema<ArraySchema> {
|
||||
@@ -461,8 +471,7 @@ declare module 'joi' {
|
||||
*/
|
||||
export function validate<T>(value: T, schema: Schema, callback: (err: ValidationError, value: T) => void): void;
|
||||
export function validate<T>(value: T, schema: Object, callback: (err: ValidationError, value: T) => void): void;
|
||||
export function validate<T>(value: T, schema: Schema, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void;
|
||||
export function validate<T>(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void;
|
||||
export function validate<T>(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): ValidationResult<T>;
|
||||
|
||||
/**
|
||||
* Converts literal schema definition to joi schema object (or returns the same back if already a joi schema object).
|
||||
|
||||
@@ -2,3 +2,7 @@
|
||||
/// <reference path="jquery.placeholder.d.ts"/>
|
||||
|
||||
$('input').placeholder();
|
||||
|
||||
// specify custom class
|
||||
$('input').placeholder({ customClass: 'my-placeholder' });
|
||||
|
||||
|
||||
+4
-5
@@ -1,13 +1,12 @@
|
||||
// Type definitions for jquery.placeholder.js 2.0.7
|
||||
// Type definitions for jquery.placeholder.js 2.1.1
|
||||
// Project: https://github.com/mathiasbynens/jquery-placeholder
|
||||
// Definitions by: Peter Gill <https://github.com/majorsilence>
|
||||
// Definitions by: Peter Gill <https://github.com/majorsilence>, Neil Culver <https://github.com/EnableSoftware>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface JQuery {
|
||||
|
||||
placeholder() : void;
|
||||
|
||||
placeholder(options: { customClass: string }) : JQuery
|
||||
placeholder() : JQuery
|
||||
}
|
||||
|
||||
|
||||
@@ -922,6 +922,8 @@ result = <string[]>_.methods(_);
|
||||
result = <_.LoDashArrayWrapper<string>>_(_).functions();
|
||||
result = <_.LoDashArrayWrapper<string>>_(_).methods();
|
||||
|
||||
result = <number>_.get({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
|
||||
|
||||
result = <boolean>_.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
|
||||
|
||||
interface FirstSecond {
|
||||
|
||||
Vendored
+16
@@ -5836,6 +5836,22 @@ declare module _ {
|
||||
methods(): _.LoDashArrayWrapper<string>;
|
||||
}
|
||||
|
||||
//_.get
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Gets the property value at path of object. If the resolved
|
||||
* value is undefined the defaultValue is used in its place.
|
||||
* @param object The object to query.
|
||||
* @param path The path of the property to get.
|
||||
* @param defaultValue The value returned if the resolved value is undefined.
|
||||
* @return Returns the resolved value.
|
||||
**/
|
||||
get<T>(object : Object,
|
||||
path:string|string[],
|
||||
defaultValue?:T
|
||||
): T;
|
||||
}
|
||||
|
||||
//_.has
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="magicsuggest.d.ts"/>
|
||||
|
||||
function basicTest() {
|
||||
$('#magicSuggest').magicSuggest();
|
||||
}
|
||||
|
||||
function testWithConfigurationOptions() {
|
||||
$('#magicSuggest').magicSuggest({
|
||||
data: [
|
||||
{ id: 1, name: "Buenos Aires" },
|
||||
{ id: 2, name: "New York" },
|
||||
{ id: 3, name: "Madrid" },
|
||||
],
|
||||
maxDropHeight: 500,
|
||||
maxSelection: 2,
|
||||
expandOnFocus: true,
|
||||
});
|
||||
}
|
||||
|
||||
function testSomeMethods() {
|
||||
var ms = $('#magicSuggest').magicSuggest();
|
||||
ms.addToSelection([{ id: 1, name: "Mexico" }]);
|
||||
console.info(ms.getSelection());
|
||||
ms.disable()
|
||||
}
|
||||
Vendored
+467
@@ -0,0 +1,467 @@
|
||||
// Type definitions for MagicSuggest 2.1.4
|
||||
// Project: http://nicolasbize.com/magicsuggest
|
||||
// Definitions by: Leonardo Chaia <http://github.com/leonardochaia>
|
||||
// Definitions: http://github.com/leonardochaia/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
interface JQuery {
|
||||
/**
|
||||
* Initialize MagicSuggest on this selector
|
||||
*/
|
||||
magicSuggest(configurationObject?: MagicSuggest.Configuration): MagicSuggest.Instance;
|
||||
}
|
||||
|
||||
declare module MagicSuggest {
|
||||
interface Configuration {
|
||||
/********** CONFIGURATION PROPERTIES ************/
|
||||
/**
|
||||
* Restricts or allows the user to validate typed entries.
|
||||
* Defaults to true.
|
||||
*/
|
||||
allowFreeEntries?: boolean;
|
||||
|
||||
/**
|
||||
* Restricts or allows the user to add the same entry more than once
|
||||
* Defaults to false.
|
||||
*/
|
||||
allowDuplicates?: boolean;
|
||||
|
||||
/**
|
||||
* Additional config object passed to each $.ajax call
|
||||
*/
|
||||
ajaxConfig?: JQueryAjaxSettings;
|
||||
|
||||
/**
|
||||
* If a single suggestion comes out, it is preselected.
|
||||
*/
|
||||
autoSelect?: boolean;
|
||||
|
||||
/**
|
||||
* Auto select the first matching item with multiple items shown
|
||||
*/
|
||||
selectFirst?: boolean;
|
||||
|
||||
/**
|
||||
* Allow customization of query parameter
|
||||
*/
|
||||
queryParam?: string;
|
||||
|
||||
/**
|
||||
* A function triggered just before the ajax request is sent, similar to jQuery
|
||||
*/
|
||||
beforeSend?: () => void;
|
||||
|
||||
/**
|
||||
* A custom CSS class to apply to the field's underlying element.
|
||||
*/
|
||||
cls?: string;
|
||||
|
||||
/**
|
||||
* JSON Data source used to populate the combo box. 3 options are available here:
|
||||
* No Data Source (default)
|
||||
* When left null, the combo box will not suggest anything. It can still enable the user to enter
|
||||
* multiple entries if allowFreeEntries is * set to true (default).
|
||||
* Static Source
|
||||
* You can pass an array of JSON objects, an array of strings or even a single CSV string as the
|
||||
* data source.For ex. data: [* {id:0,name:"Paris"}, {id: 1, name: "New York"}]
|
||||
* You can also pass any json object with the results property containing the json array.
|
||||
* Url
|
||||
* You can pass the url from which the component will fetch its JSON data.Data will be fetched
|
||||
* using a POST ajax request that will * include the entered text as 'query' parameter. The results
|
||||
* fetched from the server can be:
|
||||
* - an array of JSON objects (ex: [{id:...,name:...},{...}])
|
||||
* - a string containing an array of JSON objects ready to be parsed (ex: "[{id:...,name:...},{...}]")
|
||||
* - a JSON object whose data will be contained in the results property
|
||||
* (ex: {results: [{id:...,name:...},{...}]
|
||||
* Function
|
||||
* You can pass a function which returns an array of JSON objects (ex: [{id:...,name:...},{...}])
|
||||
* The function can return the JSON data or it can use the first argument as function to handle the data.
|
||||
* Only one (callback function or return value) is needed for the function to succeed.
|
||||
* See the following example:
|
||||
* function (response) { var myjson = [{name: 'test', id: 1}]; response(myjson); return myjson; }
|
||||
*/
|
||||
data?: any;
|
||||
|
||||
/**
|
||||
* Additional parameters to the ajax call
|
||||
*/
|
||||
dataUrlParams?: Object;
|
||||
|
||||
/**
|
||||
* Start the component in a disabled state.
|
||||
*/
|
||||
disabled?: boolean;
|
||||
|
||||
/**
|
||||
* Name of JSON object property that defines the disabled behaviour
|
||||
*/
|
||||
disabledField?: string;
|
||||
|
||||
/**
|
||||
* Name of JSON object property displayed in the combo list
|
||||
*/
|
||||
displayField?: string;
|
||||
|
||||
/**
|
||||
* Set to false if you only want mouse interaction. In that case the combo will
|
||||
* automatically expand on focus.
|
||||
*/
|
||||
editable?: boolean;
|
||||
|
||||
/**
|
||||
* Set starting state for combo.
|
||||
*/
|
||||
expanded?: boolean;
|
||||
|
||||
/**
|
||||
* Automatically expands combo on focus.
|
||||
*/
|
||||
expandOnFocus?: boolean;
|
||||
|
||||
/**
|
||||
* JSON property by which the list should be grouped
|
||||
*/
|
||||
groupBy?: string;
|
||||
|
||||
/**
|
||||
* Set to true to hide the trigger on the right
|
||||
*/
|
||||
hideTrigger?: boolean;
|
||||
|
||||
/**
|
||||
* Set to true to highlight search input within displayed suggestions
|
||||
*/
|
||||
highlight?: boolean;
|
||||
|
||||
/**
|
||||
* A custom ID for this component
|
||||
*/
|
||||
id?: string;
|
||||
|
||||
/**
|
||||
* A class that is added to the info message appearing on the top-right part of the component
|
||||
*/
|
||||
infoMsgCls?: string;
|
||||
|
||||
/**
|
||||
* Additional parameters passed out to the INPUT tag. Enables usage of AngularJS's custom tags for ex.
|
||||
*/
|
||||
inputCfg?: any;
|
||||
|
||||
/**
|
||||
* The class that is applied to show that the field is invalid
|
||||
*/
|
||||
invalidCls?: string;
|
||||
|
||||
/**
|
||||
* Set to true to filter data results according to case. Useless if the data is fetched remotely
|
||||
*/
|
||||
matchCase?: boolean;
|
||||
|
||||
/**
|
||||
* Once expanded, the combo's height will take as much room as the # of available results.
|
||||
* In case there are too many results displayed, this will fix the drop down height.
|
||||
*/
|
||||
maxDropHeight?: number;
|
||||
|
||||
/**
|
||||
* Defines how long the user free entry can be. Set to null for no limit.
|
||||
*/
|
||||
maxEntryLength?: number;
|
||||
|
||||
/**
|
||||
* A function that defines the helper text when the max entry length has been surpassed.
|
||||
*/
|
||||
maxEntryRenderer?: (v?: number) => void;
|
||||
|
||||
/**
|
||||
* The maximum number of results displayed in the combo drop down at once.
|
||||
*/
|
||||
maxSuggestions?: number;
|
||||
|
||||
/**
|
||||
* The maximum number of items the user can select if multiple selection is allowed.
|
||||
* Set to null to remove the limit.
|
||||
*/
|
||||
maxSelection?: number;
|
||||
|
||||
/**
|
||||
* A function that defines the helper text when the max selection amount has been reached. The function has a single
|
||||
* parameter which is the number of selected elements.
|
||||
*/
|
||||
maxSelectionRenderer?: (v: number) => void;
|
||||
|
||||
/**
|
||||
* The method used by the ajax request.
|
||||
*/
|
||||
method?: string;
|
||||
|
||||
/**
|
||||
* The minimum number of characters the user must type before the combo expands and offers suggestions.
|
||||
*/
|
||||
minChars?: number;
|
||||
|
||||
/**
|
||||
* A function that defines the helper text when not enough letters are set. The function has a single
|
||||
* parameter which is the difference between the required amount of letters and the current one.
|
||||
*/
|
||||
minCharsRenderer?: (v: number) => void;
|
||||
|
||||
/**
|
||||
* Whether or not sorting / filtering should be done remotely or locally.
|
||||
* Use either 'local' or 'remote'
|
||||
*/
|
||||
mode?: string;
|
||||
|
||||
/**
|
||||
* The name used as a form element.
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* The text displayed when there are no suggestions.
|
||||
*/
|
||||
noSuggestionText?: string;
|
||||
|
||||
/**
|
||||
* The default placeholder text when nothing has been entered
|
||||
*/
|
||||
placeholder?: string;
|
||||
|
||||
/**
|
||||
* A function used to define how the items will be presented in the combo
|
||||
*/
|
||||
renderer?: (item: any) => void;
|
||||
|
||||
/**
|
||||
* Whether or not this field should be required
|
||||
*/
|
||||
required?: boolean;
|
||||
|
||||
/**
|
||||
* Set to true to render selection as a delimited string
|
||||
*/
|
||||
resultAsString?: boolean;
|
||||
|
||||
/**
|
||||
* Text delimiter to use in a delimited string.
|
||||
*/
|
||||
resultAsStringDelimiter?: string;
|
||||
|
||||
/**
|
||||
* Name of JSON object property that represents the list of suggested objects
|
||||
*/
|
||||
resultsField?: string;
|
||||
|
||||
/**
|
||||
* A custom CSS class to add to a selected item
|
||||
*/
|
||||
selectionCls?: string;
|
||||
|
||||
/**
|
||||
* An optional element replacement in which the selection is rendered
|
||||
*/
|
||||
selectionContainer?: JQuery;
|
||||
|
||||
/**
|
||||
* Where the selected items will be displayed. Only 'right', 'bottom' and 'inner' are valid values
|
||||
*/
|
||||
selectionPosition?: string;
|
||||
|
||||
/**
|
||||
* A function used to define how the items will be presented in the tag list
|
||||
*/
|
||||
selectionRenderer?: (item: any) => void;
|
||||
|
||||
/**
|
||||
* Set to true to stack the selectioned items when positioned on the bottom
|
||||
* Requires the selectionPosition to be set to 'bottom'
|
||||
*/
|
||||
selectionStacked?: boolean;
|
||||
|
||||
/**
|
||||
* Direction used for sorting. Only 'asc' and 'desc' are valid values
|
||||
*/
|
||||
sortDir?: string;
|
||||
|
||||
/**
|
||||
* name of JSON object property for local result sorting.
|
||||
* Leave null if you do not wish the results to be ordered or if they are already ordered remotely.
|
||||
*/
|
||||
sortOrder?: string;
|
||||
|
||||
/**
|
||||
* If set to boolean; suggestions will have to start by user input (and not simply contain it as a substring)
|
||||
*/
|
||||
strictSuggest?: boolean;
|
||||
|
||||
/**
|
||||
* Custom style added to the component container.
|
||||
*/
|
||||
style?: string;
|
||||
|
||||
/**
|
||||
* If set to boolean; the combo will expand / collapse when clicked upon
|
||||
*/
|
||||
toggleOnClick?: boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Amount (in ms) between keyboard registers.
|
||||
*/
|
||||
typeDelay?: number;
|
||||
|
||||
/**
|
||||
* If set to boolean; tab won't blur the component but will be registered as the ENTER key
|
||||
*/
|
||||
useTabKey?: boolean;
|
||||
|
||||
/**
|
||||
* If set to boolean; using comma will validate the user's choice
|
||||
*/
|
||||
useCommaKey?: boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Determines whether or not the results will be displayed with a zebra table style
|
||||
*/
|
||||
useZebraStyle?: boolean;
|
||||
|
||||
/**
|
||||
* initial value for the field
|
||||
*/
|
||||
value?: any;
|
||||
|
||||
/**
|
||||
* name of JSON object property that represents its underlying value
|
||||
*/
|
||||
valueField?: string;
|
||||
|
||||
/**
|
||||
* regular expression to validate the values against
|
||||
*/
|
||||
vregex?: any;
|
||||
|
||||
/**
|
||||
* type to validate against
|
||||
*/
|
||||
vtype?: any;
|
||||
}
|
||||
|
||||
interface Instance {
|
||||
/**
|
||||
* Add one or multiple json items to the current selection
|
||||
* @param items - json object or array of json objects
|
||||
* @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered
|
||||
*/
|
||||
addToSelection(objs: Array<any>, isSilent?: boolean): void;
|
||||
|
||||
/**
|
||||
* Clears the current selection
|
||||
* @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered
|
||||
*/
|
||||
clear(isSilent?: boolean): void;
|
||||
|
||||
/**
|
||||
* Collapse the drop down part of the combo
|
||||
*/
|
||||
collapse(): void;
|
||||
|
||||
/**
|
||||
* Set the component in a disabled state.
|
||||
*/
|
||||
disable(): void;
|
||||
|
||||
/**
|
||||
* Empties out the combo user text
|
||||
*/
|
||||
empty(): void;
|
||||
|
||||
/**
|
||||
* Set the component in a enable state.
|
||||
*/
|
||||
enable(): void;
|
||||
|
||||
/**
|
||||
* Retrieve component enabled status
|
||||
* @return {boolean}
|
||||
*/
|
||||
isDisabled(): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the field is valid or not
|
||||
* @return {boolean}
|
||||
*/
|
||||
isValid(): boolean;
|
||||
|
||||
/**
|
||||
* Gets the data params for current ajax request
|
||||
*/
|
||||
getDataUrlParams(): Object;
|
||||
|
||||
/**
|
||||
* Gets the name given to the form input
|
||||
*/
|
||||
getName(): string;
|
||||
|
||||
/**
|
||||
* Retrieve an array of selected json objects
|
||||
* @return {Array}
|
||||
*/
|
||||
getSelection(): Array<any>;
|
||||
|
||||
/**
|
||||
* Retrieve the current text entered by the user
|
||||
*/
|
||||
getRawValue(): string;
|
||||
|
||||
/**
|
||||
* Retrieve an array of selected values
|
||||
*/
|
||||
getValue(): Array<any>;
|
||||
|
||||
/**
|
||||
* Remove one or multiples json items from the current selection
|
||||
* @param items - json object or array of json objects
|
||||
* @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered
|
||||
*/
|
||||
removeFromSelection(items: any, isSilent: boolean): void;
|
||||
|
||||
/**
|
||||
* Set up some combo data after it has been rendered
|
||||
* @param data
|
||||
*/
|
||||
setData(data: any): void;
|
||||
|
||||
/**
|
||||
* Get current data
|
||||
*/
|
||||
getData(): any;
|
||||
|
||||
/**
|
||||
* Sets the name for the input field so it can be fetched in the form
|
||||
* @param name
|
||||
*/
|
||||
setName(name: string): void;
|
||||
|
||||
/**
|
||||
* Sets the current selection with the JSON items provided
|
||||
* @param items
|
||||
* @param isSilent - (optional)
|
||||
*/
|
||||
setSelection(items: Array<any>, isSilet?: boolean): void;
|
||||
|
||||
/**
|
||||
* Sets a value for the combo box. Value must be an array of values with data type matching valueField one.
|
||||
* @param data
|
||||
*/
|
||||
setValue(values: Array<any>): void;
|
||||
|
||||
/**
|
||||
* Sets data params for subsequent ajax requests
|
||||
* @param params
|
||||
*/
|
||||
setDataUrlParams(params: any): void;
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
+9
@@ -1291,6 +1291,15 @@ declare module Marionette {
|
||||
|
||||
options: any;
|
||||
|
||||
/**
|
||||
* Behaviors can have their own ui hash, which will be mixed into the ui
|
||||
* hash of its associated View instance. ui elements defined on either the
|
||||
* Behavior or the View will be made available within events and triggers.
|
||||
* They also are attached directly to the Behavior and can be accessed within
|
||||
* Behavior methods as this.ui.
|
||||
*/
|
||||
ui: any;
|
||||
|
||||
/**
|
||||
* Any triggers you define on the Behavior will be triggered in response to the appropriate event on the view.
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+834
@@ -0,0 +1,834 @@
|
||||
// Type definitions for MarkerClustererPlus for Google Maps V3 2.1.1
|
||||
// Project: http://github.com/mahnunchik/markerclustererplus
|
||||
// Definitions by: Mathias Rodriguez <http://github.com/enanox>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
/// <reference path="../googlemaps/google.maps.d.ts" />
|
||||
|
||||
/**
|
||||
* @name ClusterIconStyle
|
||||
* @class This class represents the object for values in the <code>styles</code> array passed
|
||||
* to the {@link MarkerClusterer} constructor. The element in this array that is used to
|
||||
* style the cluster icon is determined by calling the <code>calculator</code> function.
|
||||
*
|
||||
* @property {string} url The URL of the cluster icon image file. Required.
|
||||
* @property {number} height The display height (in pixels) of the cluster icon. Required.
|
||||
* @property {number} width The display width (in pixels) of the cluster icon. Required.
|
||||
* @property {Array} [anchorText] The position (in pixels) from the center of the cluster icon to
|
||||
* where the text label is to be centered and drawn. The format is <code>[yoffset, xoffset]</code>
|
||||
* where <code>yoffset</code> increases as you go down from center and <code>xoffset</code>
|
||||
* increases to the right of center. The default is <code>[0, 0]</code>.
|
||||
* @property {Array} [anchorIcon] The anchor position (in pixels) of the cluster icon. This is the
|
||||
* spot on the cluster icon that is to be aligned with the cluster position. The format is
|
||||
* <code>[yoffset, xoffset]</code> where <code>yoffset</code> increases as you go down and
|
||||
* <code>xoffset</code> increases to the right of the top-left corner of the icon. The default
|
||||
* anchor position is the center of the cluster icon.
|
||||
* @property {string} [textColor="black"] The color of the label text shown on the
|
||||
* cluster icon.
|
||||
* @property {number} [textSize=11] The size (in pixels) of the label text shown on the
|
||||
* cluster icon.
|
||||
* @property {string} [textDecoration="none"] The value of the CSS <code>text-decoration</code>
|
||||
* property for the label text shown on the cluster icon.
|
||||
* @property {string} [fontWeight="bold"] The value of the CSS <code>font-weight</code>
|
||||
* property for the label text shown on the cluster icon.
|
||||
* @property {string} [fontStyle="normal"] The value of the CSS <code>font-style</code>
|
||||
* property for the label text shown on the cluster icon.
|
||||
* @property {string} [fontFamily="Arial,sans-serif"] The value of the CSS <code>font-family</code>
|
||||
* property for the label text shown on the cluster icon.
|
||||
* @property {string} [backgroundPosition="0 0"] The position of the cluster icon image
|
||||
* within the image defined by <code>url</code>. The format is <code>"xpos ypos"</code>
|
||||
* (the same format as for the CSS <code>background-position</code> property). You must set
|
||||
* this property appropriately when the image defined by <code>url</code> represents a sprite
|
||||
* containing multiple images. Note that the position <i>must</i> be specified in px units.
|
||||
*/
|
||||
|
||||
declare class ClusterIconStyle {
|
||||
url: string;
|
||||
height: number;
|
||||
width: number;
|
||||
anchorText: number[];
|
||||
anchorIcon: number[];
|
||||
textColor: string;
|
||||
textSize: number;
|
||||
textDecoration: string;
|
||||
fontWeight: string;
|
||||
fontStyle: string;
|
||||
fontFamily: string;
|
||||
backgroundPosition: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name ClusterIconInfo
|
||||
* @class This class is an object containing general information about a cluster icon. This is
|
||||
* the object that a <code>calculator</code> function returns.
|
||||
*
|
||||
* @property {string} text The text of the label to be shown on the cluster icon.
|
||||
* @property {number} index The index plus 1 of the element in the <code>styles</code>
|
||||
* array to be used to style the cluster icon.
|
||||
* @property {string} title The tooltip to display when the mouse moves over the cluster icon.
|
||||
* If this value is <code>undefined</code> or <code>""</code>, <code>title</code> is set to the
|
||||
* value of the <code>title</code> property passed to the MarkerClusterer.
|
||||
*/
|
||||
|
||||
declare class ClusterIconInfo extends google.maps.OverlayView {
|
||||
text: string;
|
||||
index: number;
|
||||
title: string;
|
||||
/**
|
||||
* A cluster icon.
|
||||
*
|
||||
* @constructor
|
||||
* @extends google.maps.OverlayView
|
||||
* @param {Cluster} cluster The cluster with which the icon is to be associated.
|
||||
* @param {Array} [styles] An array of {@link ClusterIconStyle} defining the cluster icons
|
||||
* to use for various cluster sizes.
|
||||
* @private
|
||||
*/
|
||||
constructor(cluster: Cluster, styles: ClusterIconStyle[]);
|
||||
|
||||
/**
|
||||
* Adds the icon to the DOM.
|
||||
*/
|
||||
onAdd(): void;
|
||||
|
||||
/**
|
||||
* Removes the icon from the DOM.
|
||||
*/
|
||||
onRemove(): void;
|
||||
|
||||
/**
|
||||
* Draws the icon.
|
||||
*/
|
||||
draw(): void;
|
||||
|
||||
/**
|
||||
* Hides the icon.
|
||||
*/
|
||||
hide(): void;
|
||||
|
||||
/**
|
||||
* Positions and shows the icon.
|
||||
*/
|
||||
show(): void;
|
||||
|
||||
/**
|
||||
* Sets the icon styles to the appropriate element in the styles array.
|
||||
*
|
||||
* @param {ClusterIconInfo} sums The icon label text and styles index.
|
||||
*/
|
||||
useStyle(sums: ClusterIconInfo[]): void;
|
||||
|
||||
/**
|
||||
* Sets the position at which to center the icon.
|
||||
*
|
||||
* @param {google.maps.LatLng} center The latlng to set as the center.
|
||||
*/
|
||||
setCenter(center: google.maps.LatLng): void;
|
||||
|
||||
/**
|
||||
* Creates the cssText style parameter based on the position of the icon.
|
||||
*
|
||||
* @param {google.maps.Point} pos The position of the icon.
|
||||
* @return {string} The CSS style text.
|
||||
*/
|
||||
createCss(pos: google.maps.Point): string;
|
||||
|
||||
/**
|
||||
* Returns the position at which to place the DIV depending on the latlng.
|
||||
*
|
||||
* @param {google.maps.LatLng} latlng The position in latlng.
|
||||
* @return {google.maps.Point} The position in pixels.
|
||||
*/
|
||||
getPosFromLatLng_(latLng: google.maps.LatLng): google.maps.Point;
|
||||
}
|
||||
|
||||
interface Cluster {
|
||||
/**
|
||||
* Creates a single cluster that manages a group of proximate markers.
|
||||
* Used internally, do not call this constructor directly.
|
||||
* @constructor
|
||||
* @param {MarkerClusterer} mc The <code>MarkerClusterer</code> object with which this
|
||||
* cluster is associated.
|
||||
*/
|
||||
new (mc: MarkerClusterer): Cluster;
|
||||
|
||||
/**
|
||||
* Returns the number of markers managed by the cluster. You can call this from
|
||||
* a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler
|
||||
* for the <code>MarkerClusterer</code> object.
|
||||
*
|
||||
* @return {number} The number of markers in the cluster.
|
||||
*/
|
||||
getSize(): number;
|
||||
|
||||
/**
|
||||
* Returns the array of markers managed by the cluster. You can call this from
|
||||
* a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler
|
||||
* for the <code>MarkerClusterer</code> object.
|
||||
*
|
||||
* @return {Array} The array of markers in the cluster.
|
||||
*/
|
||||
getMarkers(): google.maps.Marker[];
|
||||
|
||||
/**
|
||||
* Returns the center of the cluster. You can call this from
|
||||
* a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler
|
||||
* for the <code>MarkerClusterer</code> object.
|
||||
*
|
||||
* @return {google.maps.LatLng} The center of the cluster.
|
||||
*/
|
||||
getCenter(): google.maps.LatLng;
|
||||
|
||||
/**
|
||||
* Returns the map with which the cluster is associated.
|
||||
*
|
||||
* @return {google.maps.Map} The map.
|
||||
* @ignore
|
||||
*/
|
||||
getMap(): google.maps.Map;
|
||||
|
||||
/**
|
||||
* Returns the <code>MarkerClusterer</code> object with which the cluster is associated.
|
||||
*
|
||||
* @return {MarkerClusterer} The associated marker clusterer.
|
||||
* @ignore
|
||||
*/
|
||||
getMarkerClusterer(): MarkerClusterer;
|
||||
|
||||
/**
|
||||
* Returns the bounds of the cluster.
|
||||
*
|
||||
* @return {google.maps.LatLngBounds} the cluster bounds.
|
||||
* @ignore
|
||||
*/
|
||||
getBounds(): google.maps.LatLngBounds;
|
||||
|
||||
/**
|
||||
* Removes the cluster from the map.
|
||||
*
|
||||
* @ignore
|
||||
*/
|
||||
remove(): void;
|
||||
|
||||
/**
|
||||
* Adds a marker to the cluster.
|
||||
*
|
||||
* @param {google.maps.Marker} marker The marker to be added.
|
||||
* @return {boolean} True if the marker was added.
|
||||
* @ignore
|
||||
*/
|
||||
addMarker(marker: google.maps.Marker): boolean;
|
||||
|
||||
/**
|
||||
* Determines if a marker lies within the cluster's bounds.
|
||||
*
|
||||
* @param {google.maps.Marker} marker The marker to check.
|
||||
* @return {boolean} True if the marker lies in the bounds.
|
||||
* @ignore
|
||||
*/
|
||||
isMarkerInClusterBounds(marker: google.maps.Marker): boolean;
|
||||
|
||||
/**
|
||||
* Calculates the extended bounds of the cluster with the grid.
|
||||
*/
|
||||
calculateBounds_(): void;
|
||||
|
||||
/**
|
||||
* Updates the cluster icon.
|
||||
*/
|
||||
updateIcon_(): void;
|
||||
|
||||
/**
|
||||
* Determines if a marker has already been added to the cluster.
|
||||
*
|
||||
* @param {google.maps.Marker} marker The marker to check.
|
||||
* @return {boolean} True if the marker has already been added.
|
||||
*/
|
||||
isMarkerAlreadyAdded_(marker: google.maps.Marker): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name MarkerClustererOptions
|
||||
* @class This class represents the optional parameter passed to
|
||||
* the {@link MarkerClusterer} constructor.
|
||||
* @property {number} [gridSize=60] The grid size of a cluster in pixels. The grid is a square.
|
||||
* @property {number} [maxZoom=null] The maximum zoom level at which clustering is enabled or
|
||||
* <code>null</code> if clustering is to be enabled at all zoom levels.
|
||||
* @property {boolean} [zoomOnClick=true] Whether to zoom the map when a cluster marker is
|
||||
* clicked. You may want to set this to <code>false</code> if you have installed a handler
|
||||
* for the <code>click</code> event and it deals with zooming on its own.
|
||||
* @property {boolean} [averageCenter=false] Whether the position of a cluster marker should be
|
||||
* the average position of all markers in the cluster. If set to <code>false</code>, the
|
||||
* cluster marker is positioned at the location of the first marker added to the cluster.
|
||||
* @property {number} [minimumClusterSize=2] The minimum number of markers needed in a cluster
|
||||
* before the markers are hidden and a cluster marker appears.
|
||||
* @property {boolean} [ignoreHidden=false] Whether to ignore hidden markers in clusters. You
|
||||
* may want to set this to <code>true</code> to ensure that hidden markers are not included
|
||||
* in the marker count that appears on a cluster marker (this count is the value of the
|
||||
* <code>text</code> property of the result returned by the default <code>calculator</code>).
|
||||
* If set to <code>true</code> and you change the visibility of a marker being clustered, be
|
||||
* sure to also call <code>MarkerClusterer.repaint()</code>.
|
||||
* @property {string} [title=""] The tooltip to display when the mouse moves over a cluster
|
||||
* marker. (Alternatively, you can use a custom <code>calculator</code> function to specify a
|
||||
* different tooltip for each cluster marker.)
|
||||
* @property {function} [calculator=MarkerClusterer.CALCULATOR] The function used to determine
|
||||
* the text to be displayed on a cluster marker and the index indicating which style to use
|
||||
* for the cluster marker. The input parameters for the function are (1) the array of markers
|
||||
* represented by a cluster marker and (2) the number of cluster icon styles. It returns a
|
||||
* {@link ClusterIconInfo} object. The default <code>calculator</code> returns a
|
||||
* <code>text</code> property which is the number of markers in the cluster and an
|
||||
* <code>index</code> property which is one higher than the lowest integer such that
|
||||
* <code>10^i</code> exceeds the number of markers in the cluster, or the size of the styles
|
||||
* array, whichever is less. The <code>styles</code> array element used has an index of
|
||||
* <code>index</code> minus 1. For example, the default <code>calculator</code> returns a
|
||||
* <code>text</code> value of <code>"125"</code> and an <code>index</code> of <code>3</code>
|
||||
* for a cluster icon representing 125 markers so the element used in the <code>styles</code>
|
||||
* array is <code>2</code>. A <code>calculator</code> may also return a <code>title</code>
|
||||
* property that contains the text of the tooltip to be used for the cluster marker. If
|
||||
* <code>title</code> is not defined, the tooltip is set to the value of the <code>title</code>
|
||||
* property for the MarkerClusterer.
|
||||
* @property {string} [clusterClass="cluster"] The name of the CSS class defining general styles
|
||||
* for the cluster markers. Use this class to define CSS styles that are not set up by the code
|
||||
* that processes the <code>styles</code> array.
|
||||
* @property {Array} [styles] An array of {@link ClusterIconStyle} elements defining the styles
|
||||
* of the cluster markers to be used. The element to be used to style a given cluster marker
|
||||
* is determined by the function defined by the <code>calculator</code> property.
|
||||
* The default is an array of {@link ClusterIconStyle} elements whose properties are derived
|
||||
* from the values for <code>imagePath</code>, <code>imageExtension</code>, and
|
||||
* <code>imageSizes</code>.
|
||||
* @property {boolean} [enableRetinaIcons=false] Whether to allow the use of cluster icons that
|
||||
* have sizes that are some multiple (typically double) of their actual display size. Icons such
|
||||
* as these look better when viewed on high-resolution monitors such as Apple's Retina displays.
|
||||
* Note: if this property is <code>true</code>, sprites cannot be used as cluster icons.
|
||||
* @property {number} [batchSize=MarkerClusterer.BATCH_SIZE] Set this property to the
|
||||
* number of markers to be processed in a single batch when using a browser other than
|
||||
* Internet Explorer (for Internet Explorer, use the batchSizeIE property instead).
|
||||
* @property {number} [batchSizeIE=MarkerClusterer.BATCH_SIZE_IE] When Internet Explorer is
|
||||
* being used, markers are processed in several batches with a small delay inserted between
|
||||
* each batch in an attempt to avoid Javascript timeout errors. Set this property to the
|
||||
* number of markers to be processed in a single batch; select as high a number as you can
|
||||
* without causing a timeout error in the browser. This number might need to be as low as 100
|
||||
* if 15,000 markers are being managed, for example.
|
||||
* @property {string} [imagePath=MarkerClusterer.IMAGE_PATH]
|
||||
* The full URL of the root name of the group of image files to use for cluster icons.
|
||||
* The complete file name is of the form <code>imagePath</code>n.<code>imageExtension</code>
|
||||
* where n is the image file number (1, 2, etc.).
|
||||
* @property {string} [imageExtension=MarkerClusterer.IMAGE_EXTENSION]
|
||||
* The extension name for the cluster icon image files (e.g., <code>"png"</code> or
|
||||
* <code>"jpg"</code>).
|
||||
* @property {Array} [imageSizes=MarkerClusterer.IMAGE_SIZES]
|
||||
* An array of numbers containing the widths of the group of
|
||||
* <code>imagePath</code>n.<code>imageExtension</code> image files.
|
||||
* (The images are assumed to be square.)
|
||||
**/
|
||||
interface MarkerClustererOptions {
|
||||
gridSize: number;
|
||||
maxZoom: number;
|
||||
zoomOnClick: boolean;
|
||||
averageCenter: boolean;
|
||||
minimumClusterSize: number;
|
||||
ignoreHidden: boolean;
|
||||
title: string;
|
||||
calculator(): Function;
|
||||
clusterClass: string;
|
||||
styles: ClusterIconStyle[];
|
||||
enableRetinaIcons: boolean;
|
||||
batchSize: number;
|
||||
batchSizeIE: number;
|
||||
imagePath: string;
|
||||
imageExtension: string;
|
||||
imageSizes: number[];
|
||||
}
|
||||
|
||||
interface MarkerClusterer extends google.maps.OverlayView {
|
||||
/**
|
||||
* Creates a MarkerClusterer object with the options specified in {@link MarkerClustererOptions}.
|
||||
* @constructor
|
||||
* @extends google.maps.OverlayView
|
||||
* @param {google.maps.Map} map The Google map to attach to.
|
||||
* @param {Array.<google.maps.Marker>} [opt_markers] The markers to be added to the cluster.
|
||||
* @param {MarkerClustererOptions} [opt_options] The optional parameters.
|
||||
*/
|
||||
new (map: google.maps.Map, opt_markers: google.maps.Marker[], opt_options?: MarkerClustererOptions): MarkerClusterer;
|
||||
|
||||
/**
|
||||
* Implementation of the onAdd interface method.
|
||||
* @ignore
|
||||
*/
|
||||
onAdd(): void;
|
||||
|
||||
/**
|
||||
* Implementation of the onRemove interface method.
|
||||
* Removes map event listeners and all cluster icons from the DOM.
|
||||
* All managed markers are also put back on the map.
|
||||
* @ignore
|
||||
*/
|
||||
onRemove(): void;
|
||||
|
||||
/**
|
||||
* Implementation of the draw interface method.
|
||||
* @ignore
|
||||
*/
|
||||
draw(): void;
|
||||
|
||||
/**
|
||||
* Sets up the styles object.
|
||||
*/
|
||||
setupStyles_(): void;
|
||||
|
||||
/**
|
||||
* Fits the map to the bounds of the markers managed by the clusterer.
|
||||
*/
|
||||
fitMapToMarkers(): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>gridSize</code> property.
|
||||
*
|
||||
* @return {number} The grid size.
|
||||
*/
|
||||
getGridSize(): number;
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>gridSize</code> property.
|
||||
*
|
||||
* @param {number} gridSize The grid size.
|
||||
*/
|
||||
setGridSize(gridSize: number): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>minimumClusterSize</code> property.
|
||||
*
|
||||
* @return {number} The minimum cluster size.
|
||||
*/
|
||||
getMinimumClusterSize(): number;
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>minimumClusterSize</code> property.
|
||||
*
|
||||
* @param {number} minimumClusterSize The minimum cluster size.
|
||||
*/
|
||||
setMinimumClusterSize(minimumClusterSize: number): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>maxZoom</code> property.
|
||||
*
|
||||
* @return {number} The maximum zoom level.
|
||||
*/
|
||||
getMaxZoom(): number;
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>maxZoom</code> property.
|
||||
*
|
||||
* @param {number} maxZoom The maximum zoom level.
|
||||
*/
|
||||
setMaxZoom(maxZoom: number): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>styles</code> property.
|
||||
*
|
||||
* @return {Array} The array of styles defining the cluster markers to be used.
|
||||
*/
|
||||
getStyles(): ClusterIconStyle[];
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>styles</code> property.
|
||||
*
|
||||
* @param {Array.<ClusterIconStyle>} styles The array of styles to use.
|
||||
*/
|
||||
setStyles(styles: ClusterIconStyle[]): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>title</code> property.
|
||||
*
|
||||
* @return {string} The content of the title text.
|
||||
*/
|
||||
getTitle(): string;
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>title</code> property.
|
||||
*
|
||||
* @param {string} title The value of the title property.
|
||||
*/
|
||||
setTitle(title: string): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>zoomOnClick</code> property.
|
||||
*
|
||||
* @return {boolean} True if zoomOnClick property is set.
|
||||
*/
|
||||
getZoomOnClick(): boolean;
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>zoomOnClick</code> property.
|
||||
*
|
||||
* @param {boolean} zoomOnClick The value of the zoomOnClick property.
|
||||
*/
|
||||
setZoomOnClick(zoomOnClick: boolean): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>averageCenter</code> property.
|
||||
*
|
||||
* @return {boolean} True if averageCenter property is set.
|
||||
*/
|
||||
getAverageCenter(): boolean;
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>averageCenter</code> property.
|
||||
*
|
||||
* @param {boolean} averageCenter The value of the averageCenter property.
|
||||
*/
|
||||
setAverageCenter(averageCenter: boolean): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>ignoreHidden</code> property.
|
||||
*
|
||||
* @return {boolean} True if ignoreHidden property is set.
|
||||
*/
|
||||
getIgnoreHidden(): boolean;
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>ignoreHidden</code> property.
|
||||
*
|
||||
* @param {boolean} ignoreHidden The value of the ignoreHidden property.
|
||||
*/
|
||||
setIgnoreHidden(ignoreHidden: boolean): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>enableRetinaIcons</code> property.
|
||||
*
|
||||
* @return {boolean} True if enableRetinaIcons property is set.
|
||||
*/
|
||||
getEnableRetinaIcons(): boolean;
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>enableRetinaIcons</code> property.
|
||||
*
|
||||
* @param {boolean} enableRetinaIcons The value of the enableRetinaIcons property.
|
||||
*/
|
||||
setEnableRetinaIcons(enableRetinaIcons: boolean): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>imageExtension</code> property.
|
||||
*
|
||||
* @return {string} The value of the imageExtension property.
|
||||
*/
|
||||
getImageExtension(): string;
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>imageExtension</code> property.
|
||||
*
|
||||
* @param {string} imageExtension The value of the imageExtension property.
|
||||
*/
|
||||
setImageExtension(imageExtension: string): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>imagePath</code> property.
|
||||
*
|
||||
* @return {string} The value of the imagePath property.
|
||||
*/
|
||||
getImagePath(): string;
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>imagePath</code> property.
|
||||
*
|
||||
* @param {string} imagePath The value of the imagePath property.
|
||||
*/
|
||||
setImagePath(imagePath: string): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>imageSizes</code> property.
|
||||
*
|
||||
* @return {Array} The value of the imageSizes property.
|
||||
*/
|
||||
getImageSizes(): number[];
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>imageSizes</code> property.
|
||||
*
|
||||
* @param {Array} imageSizes The value of the imageSizes property.
|
||||
*/
|
||||
setImageSizes(imageSizes: number[]): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>calculator</code> property.
|
||||
*
|
||||
* @return {function} the value of the calculator property.
|
||||
*/
|
||||
getCalculator(): Function;
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>calculator</code> property.
|
||||
*
|
||||
* @param {function(Array.<google.maps.Marker>, number)} calculator The value
|
||||
* of the calculator property.
|
||||
*/
|
||||
setCalculator(calculator: (marker: google.maps.Marker, value: number) => Function): void;
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>hideLabel</code> property.
|
||||
*
|
||||
* @param {boolean} printable The value of the hideLabel property.
|
||||
*/
|
||||
setHideLabel(printable: boolean): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>hideLabel</code> property.
|
||||
*
|
||||
* @return {boolean} the value of the hideLabel property.
|
||||
*/
|
||||
getHideLabel(): boolean;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>batchSizeIE</code> property.
|
||||
*
|
||||
* @return {number} the value of the batchSizeIE property.
|
||||
*/
|
||||
getBatchSizeIE(): number;
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>batchSizeIE</code> property.
|
||||
*
|
||||
* @param {number} batchSizeIE The value of the batchSizeIE property.
|
||||
*/
|
||||
setBatchSizeIE(batchSizeIE: number): void;
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>clusterClass</code> property.
|
||||
*
|
||||
* @return {string} the value of the clusterClass property.
|
||||
*/
|
||||
getClusterClass(): string;
|
||||
|
||||
/**
|
||||
* Sets the value of the <code>clusterClass</code> property.
|
||||
*
|
||||
* @param {string} clusterClass The value of the clusterClass property.
|
||||
*/
|
||||
setClusterClass(clusterClass: string): void;
|
||||
|
||||
/**
|
||||
* Returns the array of markers managed by the clusterer.
|
||||
*
|
||||
* @return {Array} The array of markers managed by the clusterer.
|
||||
*/
|
||||
getMarkers(): google.maps.Marker[];
|
||||
|
||||
/**
|
||||
* Returns the number of markers managed by the clusterer.
|
||||
*
|
||||
* @return {number} The number of markers.
|
||||
*/
|
||||
getTotalMarkers(): number;
|
||||
|
||||
/**
|
||||
* Returns the current array of clusters formed by the clusterer.
|
||||
*
|
||||
* @return {Array} The array of clusters formed by the clusterer.
|
||||
*/
|
||||
getClusters(): Cluster[];
|
||||
|
||||
/**
|
||||
* Returns the number of clusters formed by the clusterer.
|
||||
*
|
||||
* @return {number} The number of clusters formed by the clusterer.
|
||||
*/
|
||||
getTotalClusters(): number;
|
||||
|
||||
/**
|
||||
* Adds a marker to the clusterer. The clusters are redrawn unless
|
||||
* <code>opt_nodraw</code> is set to <code>true</code>.
|
||||
*
|
||||
* @param {google.maps.Marker} marker The marker to add.
|
||||
* @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing.
|
||||
*/
|
||||
addMarker(marker: google.maps.Marker, opt_nodraw: boolean): void;
|
||||
|
||||
/**
|
||||
* Adds an array of markers to the clusterer. The clusters are redrawn unless
|
||||
* <code>opt_nodraw</code> is set to <code>true</code>.
|
||||
*
|
||||
* @param {Array.<google.maps.Marker>} markers The markers to add.
|
||||
* @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing.
|
||||
*/
|
||||
addMarkers(markers: google.maps.Marker[], opt_nodraw: boolean): void;
|
||||
|
||||
/**
|
||||
* Pushes a marker to the clusterer.
|
||||
*
|
||||
* @param {google.maps.Marker} marker The marker to add.
|
||||
*/
|
||||
pushMarkerTo_(marker: google.maps.Marker): void;
|
||||
|
||||
/**
|
||||
* Removes a marker from the cluster and map. The clusters are redrawn unless
|
||||
* <code>opt_nodraw</code> is set to <code>true</code>. Returns <code>true</code> if the
|
||||
* marker was removed from the clusterer.
|
||||
*
|
||||
* @param {google.maps.Marker} marker The marker to remove.
|
||||
* @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing.
|
||||
* @param {boolean} [opt_noMapRemove] Set to <code>true</code> to prevent removal from map but still removing from cluster management
|
||||
* @return {boolean} True if the marker was removed from the clusterer.
|
||||
*/
|
||||
removeMarker(marker: google.maps.Marker, opt_nodraw: boolean, noMapRemove: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Removes an array of markers from the cluster and map. The clusters are redrawn unless
|
||||
* <code>opt_nodraw</code> is set to <code>true</code>. Returns <code>true</code> if markers
|
||||
* were removed from the clusterer.
|
||||
*
|
||||
* @param {Array.<google.maps.Marker>} markers The markers to remove.
|
||||
* @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing.
|
||||
* @param {boolean} [opt_noMapRemove] Set to <code>true</code> to prevent removal from map but still removing from cluster management
|
||||
* @return {boolean} True if markers were removed from the clusterer.
|
||||
*/
|
||||
removeMarkers(markers: google.maps.Marker[], opt_nodraw: boolean, opt_noMapRemove: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Removes a marker and returns true if removed, false if not.
|
||||
*
|
||||
* @param {google.maps.Marker} marker The marker to remove
|
||||
* @param {boolean} removeFromMap set to <code>true</code> to explicitly remove from map as well as cluster manangement
|
||||
* @return {boolean} Whether the marker was removed or not
|
||||
*/
|
||||
removeMarker_(marker: google.maps.Marker, removeFromMap: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Removes all clusters and markers from the map and also removes all markers
|
||||
* managed by the clusterer.
|
||||
*/
|
||||
clearMarkers(): void;
|
||||
|
||||
/**
|
||||
* Recalculates and redraws all the marker clusters from scratch.
|
||||
* Call this after changing any properties.
|
||||
*/
|
||||
repaint(): void;
|
||||
|
||||
/**
|
||||
* Returns the current bounds extended by the grid size.
|
||||
*
|
||||
* @param {google.maps.LatLngBounds} bounds The bounds to extend.
|
||||
* @return {google.maps.LatLngBounds} The extended bounds.
|
||||
* @ignore
|
||||
*/
|
||||
getExtendedBounds(bounds: google.maps.LatLngBounds): google.maps.LatLngBounds;
|
||||
|
||||
/**
|
||||
* Redraws all the clusters.
|
||||
*/
|
||||
redraw_(): void;
|
||||
|
||||
/**
|
||||
* Removes all clusters from the map. The markers are also removed from the map
|
||||
* if <code>opt_hide</code> is set to <code>true</code>.
|
||||
*
|
||||
* @param {boolean} [opt_hide] Set to <code>true</code> to also remove the markers
|
||||
* from the map.
|
||||
*/
|
||||
resetViewport_(opt_hide: boolean): void;
|
||||
|
||||
/**
|
||||
* Calculates the distance between two latlng locations in km.
|
||||
*
|
||||
* @param {google.maps.LatLng} p1 The first lat lng point.
|
||||
* @param {google.maps.LatLng} p2 The second lat lng point.
|
||||
* @return {number} The distance between the two points in km.
|
||||
* @see http://www.movable-type.co.uk/scripts/latlong.html
|
||||
*/
|
||||
distanceBetweenPoints_(p1: google.maps.LatLng, p2: google.maps.LatLng): number;
|
||||
|
||||
/**
|
||||
* Determines if a marker is contained in a bounds.
|
||||
*
|
||||
* @param {google.maps.Marker} marker The marker to check.
|
||||
* @param {google.maps.LatLngBounds} bounds The bounds to check against.
|
||||
* @return {boolean} True if the marker is in the bounds.
|
||||
*/
|
||||
isMarkerInBounds_(marker: google.maps.Marker, bounds: google.maps.LatLngBounds): boolean;
|
||||
|
||||
/**
|
||||
* Adds a marker to a cluster, or creates a new cluster.
|
||||
*
|
||||
* @param {google.maps.Marker} marker The marker to add.
|
||||
*/
|
||||
addToClosestCluster_(marker: google.maps.Marker): void;
|
||||
|
||||
/**
|
||||
* Creates the clusters. This is done in batches to avoid timeout errors
|
||||
* in some browsers when there is a huge number of markers.
|
||||
*
|
||||
* @param {number} iFirst The index of the first marker in the batch of
|
||||
* markers to be added to clusters.
|
||||
*/
|
||||
createClusters_(iFirst: number): void;
|
||||
|
||||
/**
|
||||
* Extends an object's prototype by another's.
|
||||
*
|
||||
* @param {Object} obj1 The object to be extended.
|
||||
* @param {Object} obj2 The object to extend with.
|
||||
* @return {Object} The new extended object.
|
||||
* @ignore
|
||||
*/
|
||||
extend(obj1: Object, obj2: Object): Object;
|
||||
|
||||
/**
|
||||
* The default function for determining the label text and style
|
||||
* for a cluster icon.
|
||||
*
|
||||
* @param {Array.<google.maps.Marker>} markers The array of markers represented by the cluster.
|
||||
* @param {number} numStyles The number of marker styles available.
|
||||
* @return {ClusterIconInfo} The information resource for the cluster.
|
||||
* @constant
|
||||
* @ignore
|
||||
*/
|
||||
CALCULATOR(markers: google.maps.Marker[], numStyles: number): ClusterIconInfo;
|
||||
|
||||
/**
|
||||
* The number of markers to process in one batch.
|
||||
*
|
||||
* @type {number}
|
||||
* @constant
|
||||
*/
|
||||
BATCH_SIZE: number;
|
||||
|
||||
/**
|
||||
* The number of markers to process in one batch (IE only).
|
||||
*
|
||||
* @type {number}
|
||||
* @constant
|
||||
*/
|
||||
BATCH_SIZE_IE: number;
|
||||
|
||||
/**
|
||||
* The default root name for the marker cluster images.
|
||||
*
|
||||
* @type {string}
|
||||
* @constant
|
||||
*/
|
||||
IMAGE_PATH: string;
|
||||
|
||||
/**
|
||||
* The default extension name for the marker cluster images.
|
||||
*
|
||||
* @type {string}
|
||||
* @constant
|
||||
*/
|
||||
IMAGE_EXTENSION: string;
|
||||
|
||||
/**
|
||||
* The default array of sizes for the marker cluster images.
|
||||
*
|
||||
* @type {Array.<number>}
|
||||
* @constant
|
||||
*/
|
||||
IMAGE_SIZES: number[];
|
||||
|
||||
}
|
||||
|
||||
declare var MarkerClusterer: MarkerClusterer;
|
||||
|
||||
interface String {
|
||||
trim(): string;
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
///<reference path="maskedinput.d.ts" />
|
||||
|
||||
$("#test").inputmask("9:000");
|
||||
$("#test").inputmask("9:000", { numeric: true });
|
||||
$("#test").mask("9:000");
|
||||
$("#test").mask("9:000", { numeric: true });
|
||||
|
||||
var alies = $.inputmask.defaults.aliases;
|
||||
var alies = $.mask.defaults.aliases;
|
||||
|
||||
Vendored
+3
-3
@@ -47,9 +47,9 @@ interface MaskedInputDefaults {
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
inputmask: MaskedInputStatic;
|
||||
mask: MaskedInputStatic;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
inputmask(mask: string, options?: JQueryMaskedInputOptions): JQuery;
|
||||
}
|
||||
mask(mask: string, options?: JQueryMaskedInputOptions): JQuery;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path="mobile-detect.d.ts" />
|
||||
|
||||
var md: MobileDetect = new MobileDetect(window.navigator.userAgent);
|
||||
|
||||
var mobie: string = md.mobile()
|
||||
var phone: string = md.phone()
|
||||
var tablet: string = md.tablet()
|
||||
var userAgent: string = md.userAgent()
|
||||
var os: string = md.os()
|
||||
var isPhone: boolean = md.is('iPhone')
|
||||
var bot: boolean = md.is('bot')
|
||||
var version: number = md.version('Webkit')
|
||||
var versionStr: string = md.versionStr('Build')
|
||||
var match: boolean = md.match('playstation|xbox')
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// Type definitions for mobile-detect v1.2.0
|
||||
// Project: http://hgoebl.github.io/mobile-detect.js/
|
||||
// Definitions by: Martin McWhorter <https://github.com/martinmcwhorter/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare class MobileDetect {
|
||||
|
||||
constructor(userAgent: string, maxPhoneWidth?: number);
|
||||
|
||||
is(key: string): boolean;
|
||||
match(pattern: string|RegExp): boolean
|
||||
mobile(): string;
|
||||
mobileGrade(): string;
|
||||
os(): string;
|
||||
phone(): string;
|
||||
tablet(): string;
|
||||
userAgent(): string;
|
||||
version(value: string): number;
|
||||
versionStr(value: string): string;
|
||||
}
|
||||
@@ -12,14 +12,42 @@ var d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toronto"
|
||||
|
||||
a.tz();
|
||||
|
||||
var arr = [2013, 5, 1],
|
||||
var num = 1367337600000,
|
||||
arr = [2013, 5, 1],
|
||||
str = "2013-12-01",
|
||||
obj = { year : 2013, month : 5, day : 1 };
|
||||
date = new Date(2013, 4, 1),
|
||||
mo = moment([2013, 4, 1]),
|
||||
obj = { year : 2013, month : 5, day : 1 },
|
||||
format = "YYYY-MM-DD",
|
||||
formats = ["YYYY-MM-DD", "YYYY/MM/DD"],
|
||||
formatsIncludingSpecial = ["YYYY-MM-DD", moment.ISO_8601],
|
||||
language = "en";
|
||||
|
||||
moment.tz();
|
||||
moment.tz("America/Los_Angeles");
|
||||
|
||||
moment.tz(num, "America/Los_Angeles");
|
||||
moment.tz(arr, "America/Los_Angeles");
|
||||
moment.tz(str, "America/Los_Angeles");
|
||||
moment.tz(str, format, "America/Los_Angeles");
|
||||
moment.tz(str, format, true, "America/Los_Angeles");
|
||||
moment.tz(str, format, language, "America/Los_Angeles");
|
||||
moment.tz(str, format, language, true, "America/Los_Angeles");
|
||||
moment.tz(str, formats, "America/Los_Angeles");
|
||||
moment.tz(str, formats, true, "America/Los_Angeles");
|
||||
moment.tz(str, formats, language, "America/Los_Angeles");
|
||||
moment.tz(str, formats, language, true, "America/Los_Angeles");
|
||||
moment.tz(str, moment.ISO_8601, "America/Los_Angeles");
|
||||
moment.tz(str, moment.ISO_8601, true, "America/Los_Angeles");
|
||||
moment.tz(str, moment.ISO_8601, language, "America/Los_Angeles");
|
||||
moment.tz(str, moment.ISO_8601, language, true, "America/Los_Angeles");
|
||||
moment.tz(str, formatsIncludingSpecial, "America/Los_Angeles");
|
||||
moment.tz(str, formatsIncludingSpecial, true, "America/Los_Angeles");
|
||||
moment.tz(str, formatsIncludingSpecial, language, "America/Los_Angeles");
|
||||
moment.tz(str, formatsIncludingSpecial, language, true, "America/Los_Angeles");
|
||||
|
||||
moment.tz(date, "America/Los_Angeles");
|
||||
moment.tz(mo, "America/Los_Angeles");
|
||||
moment.tz(obj, "America/Los_Angeles");
|
||||
|
||||
moment.tz.zone('America/Los_Angeles').abbr(1403465838805);
|
||||
|
||||
Vendored
+17
-1
@@ -28,11 +28,27 @@ interface MomentZone {
|
||||
}
|
||||
|
||||
interface MomentTimezone {
|
||||
(): moment.Moment;
|
||||
(timezone: string): moment.Moment;
|
||||
(date: number, timezone: string): moment.Moment;
|
||||
(date: number[], timezone: string): moment.Moment;
|
||||
(date: string, timezone: string): moment.Moment;
|
||||
(date: string, format: string, timezone: string): moment.Moment;
|
||||
(date: string, format: string, useStrict: boolean, timezone: string): moment.Moment;
|
||||
(date: string, format: string, strict: boolean, timezone: string): moment.Moment;
|
||||
(date: string, format: string, language: string, timezone: string): moment.Moment;
|
||||
(date: string, format: string, language: string, strict: boolean, timezone: string): moment.Moment;
|
||||
(date: string, formats: string[], timezone: string): moment.Moment;
|
||||
(date: string, formats: string[], strict: boolean, timezone: string): moment.Moment;
|
||||
(date: string, formats: string[], language: string, timezone: string): moment.Moment;
|
||||
(date: string, formats: string[], language: string, strict: boolean, timezone: string): moment.Moment;
|
||||
(date: string, specialFormat: () => void, timezone: string): moment.Moment;
|
||||
(date: string, specialFormat: () => void, strict: boolean, timezone: string): moment.Moment;
|
||||
(date: string, specialFormat: () => void, language: string, timezone: string): moment.Moment;
|
||||
(date: string, specialFormat: () => void, language: string, strict: boolean, timezone: string): moment.Moment;
|
||||
(date: string, formatsIncludingSpecial: any[], timezone: string): moment.Moment;
|
||||
(date: string, formatsIncludingSpecial: any[], strict: boolean, timezone: string): moment.Moment;
|
||||
(date: string, formatsIncludingSpecial: any[], language: string, timezone: string): moment.Moment;
|
||||
(date: string, formatsIncludingSpecial: any[], language: string, strict: boolean, timezone: string): moment.Moment;
|
||||
(date: Date, timezone: string): moment.Moment;
|
||||
(date: moment.Moment, timezone: string): moment.Moment;
|
||||
(date: Object, timezone: string): moment.Moment;
|
||||
|
||||
@@ -188,6 +188,7 @@ moment(1318874398806).valueOf();
|
||||
moment(1318874398806).unix();
|
||||
moment([2000]).isLeapYear();
|
||||
moment().zone();
|
||||
moment().utcOffset();
|
||||
moment("2012-2", "YYYY-MM").daysInMonth();
|
||||
moment([2011, 2, 12]).isDST();
|
||||
|
||||
|
||||
Vendored
+482
@@ -0,0 +1,482 @@
|
||||
// Type definitions for Moment.js 2.8.0
|
||||
// Project: https://github.com/timrwood/moment
|
||||
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module moment {
|
||||
|
||||
interface MomentInput {
|
||||
|
||||
years?: number;
|
||||
y?: number;
|
||||
|
||||
months?: number;
|
||||
M?: number;
|
||||
|
||||
weeks?: number;
|
||||
w?: number;
|
||||
|
||||
days?: number;
|
||||
d?: number;
|
||||
|
||||
hours?: number;
|
||||
h?: number;
|
||||
|
||||
minutes?: number;
|
||||
m?: number;
|
||||
|
||||
seconds?: number;
|
||||
s?: number;
|
||||
|
||||
milliseconds?: number;
|
||||
ms?: number;
|
||||
|
||||
}
|
||||
|
||||
interface Duration {
|
||||
|
||||
humanize(withSuffix?: boolean): string;
|
||||
|
||||
as(units: string): number;
|
||||
|
||||
milliseconds(): number;
|
||||
asMilliseconds(): number;
|
||||
|
||||
seconds(): number;
|
||||
asSeconds(): number;
|
||||
|
||||
minutes(): number;
|
||||
asMinutes(): number;
|
||||
|
||||
hours(): number;
|
||||
asHours(): number;
|
||||
|
||||
days(): number;
|
||||
asDays(): number;
|
||||
|
||||
months(): number;
|
||||
asMonths(): number;
|
||||
|
||||
years(): number;
|
||||
asYears(): number;
|
||||
|
||||
add(n: number, p: string): Duration;
|
||||
add(n: number): Duration;
|
||||
add(d: Duration): Duration;
|
||||
|
||||
subtract(n: number, p: string): Duration;
|
||||
subtract(n: number): Duration;
|
||||
subtract(d: Duration): Duration;
|
||||
|
||||
toISOString(): string;
|
||||
|
||||
}
|
||||
|
||||
interface Moment {
|
||||
|
||||
format(format: string): string;
|
||||
format(): string;
|
||||
|
||||
fromNow(withoutSuffix?: boolean): string;
|
||||
|
||||
startOf(unitOfTime: string): Moment;
|
||||
endOf(unitOfTime: string): Moment;
|
||||
|
||||
/**
|
||||
* Mutates the original moment by adding time. (deprecated in 2.8.0)
|
||||
*
|
||||
* @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
|
||||
* @param amount the amount you want to add
|
||||
*/
|
||||
add(unitOfTime: string, amount: number): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time.
|
||||
*
|
||||
* @param amount the amount you want to add
|
||||
* @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
|
||||
*/
|
||||
add(amount: number, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time. Note that the order of arguments can be flipped.
|
||||
*
|
||||
* @param amount the amount you want to add
|
||||
* @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
|
||||
*/
|
||||
add(amount: string, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time.
|
||||
*
|
||||
* @param objectLiteral an object literal that describes multiple time units {days:7,months:1}
|
||||
*/
|
||||
add(objectLiteral: MomentInput): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time.
|
||||
*
|
||||
* @param duration a length of time
|
||||
*/
|
||||
add(duration: Duration): Moment;
|
||||
|
||||
/**
|
||||
* Mutates the original moment by subtracting time. (deprecated in 2.8.0)
|
||||
*
|
||||
* @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
|
||||
* @param amount the amount you want to subtract
|
||||
*/
|
||||
subtract(unitOfTime: string, amount: number): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time.
|
||||
*
|
||||
* @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
|
||||
* @param amount the amount you want to subtract
|
||||
*/
|
||||
subtract(amount: number, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time. Note that the order of arguments can be flipped.
|
||||
*
|
||||
* @param amount the amount you want to add
|
||||
* @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
|
||||
*/
|
||||
subtract(amount: string, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time.
|
||||
*
|
||||
* @param objectLiteral an object literal that describes multiple time units {days:7,months:1}
|
||||
*/
|
||||
subtract(objectLiteral: MomentInput): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time.
|
||||
*
|
||||
* @param duration a length of time
|
||||
*/
|
||||
subtract(duration: Duration): Moment;
|
||||
|
||||
calendar(): string;
|
||||
calendar(start: Moment): string;
|
||||
|
||||
clone(): Moment;
|
||||
|
||||
/**
|
||||
* @return Unix timestamp, or milliseconds since the epoch.
|
||||
*/
|
||||
valueOf(): number;
|
||||
|
||||
local(): Moment; // current date/time in local mode
|
||||
|
||||
utc(): Moment; // current date/time in UTC mode
|
||||
|
||||
isValid(): boolean;
|
||||
|
||||
year(y: number): Moment;
|
||||
year(): number;
|
||||
quarter(): number;
|
||||
quarter(q: number): Moment;
|
||||
month(M: number): Moment;
|
||||
month(M: string): Moment;
|
||||
month(): number;
|
||||
day(d: number): Moment;
|
||||
day(d: string): Moment;
|
||||
day(): number;
|
||||
date(d: number): Moment;
|
||||
date(): number;
|
||||
hour(h: number): Moment;
|
||||
hour(): number;
|
||||
hours(h: number): Moment;
|
||||
hours(): number;
|
||||
minute(m: number): Moment;
|
||||
minute(): number;
|
||||
minutes(m: number): Moment;
|
||||
minutes(): number;
|
||||
second(s: number): Moment;
|
||||
second(): number;
|
||||
seconds(s: number): Moment;
|
||||
seconds(): number;
|
||||
millisecond(ms: number): Moment;
|
||||
millisecond(): number;
|
||||
milliseconds(ms: number): Moment;
|
||||
milliseconds(): number;
|
||||
weekday(): number;
|
||||
weekday(d: number): Moment;
|
||||
isoWeekday(): number;
|
||||
isoWeekday(d: number): Moment;
|
||||
weekYear(): number;
|
||||
weekYear(d: number): Moment;
|
||||
isoWeekYear(): number;
|
||||
isoWeekYear(d: number): Moment;
|
||||
week(): number;
|
||||
week(d: number): Moment;
|
||||
weeks(): number;
|
||||
weeks(d: number): Moment;
|
||||
isoWeek(): number;
|
||||
isoWeek(d: number): Moment;
|
||||
isoWeeks(): number;
|
||||
isoWeeks(d: number): Moment;
|
||||
weeksInYear(): number;
|
||||
isoWeeksInYear(): number;
|
||||
dayOfYear(): number;
|
||||
dayOfYear(d: number): Moment;
|
||||
|
||||
from(f: Moment): string;
|
||||
from(f: Moment, suffix: boolean): string;
|
||||
from(d: Date): string;
|
||||
from(s: string): string;
|
||||
from(date: number[]): string;
|
||||
|
||||
diff(b: Moment): number;
|
||||
diff(b: Moment, unitOfTime: string): number;
|
||||
diff(b: Moment, unitOfTime: string, round: boolean): number;
|
||||
|
||||
toArray(): number[];
|
||||
toDate(): Date;
|
||||
toISOString(): string;
|
||||
toJSON(): string;
|
||||
unix(): number;
|
||||
|
||||
isLeapYear(): boolean;
|
||||
zone(): number;
|
||||
zone(b: number): Moment;
|
||||
zone(b: string): Moment;
|
||||
utcOffset(): number;
|
||||
utcOffset(b: number): Moment;
|
||||
utcOffset(b: string): Moment;
|
||||
daysInMonth(): number;
|
||||
isDST(): boolean;
|
||||
|
||||
isBefore(): boolean;
|
||||
isBefore(b: Moment): boolean;
|
||||
isBefore(b: string): boolean;
|
||||
isBefore(b: Number): boolean;
|
||||
isBefore(b: Date): boolean;
|
||||
isBefore(b: number[]): boolean;
|
||||
isBefore(b: Moment, granularity: string): boolean;
|
||||
isBefore(b: String, granularity: string): boolean;
|
||||
isBefore(b: Number, granularity: string): boolean;
|
||||
isBefore(b: Date, granularity: string): boolean;
|
||||
isBefore(b: number[], granularity: string): boolean;
|
||||
|
||||
isAfter(): boolean;
|
||||
isAfter(b: Moment): boolean;
|
||||
isAfter(b: string): boolean;
|
||||
isAfter(b: Number): boolean;
|
||||
isAfter(b: Date): boolean;
|
||||
isAfter(b: number[]): boolean;
|
||||
isAfter(b: Moment, granularity: string): boolean;
|
||||
isAfter(b: String, granularity: string): boolean;
|
||||
isAfter(b: Number, granularity: string): boolean;
|
||||
isAfter(b: Date, granularity: string): boolean;
|
||||
isAfter(b: number[], granularity: string): boolean;
|
||||
|
||||
isSame(b: Moment): boolean;
|
||||
isSame(b: string): boolean;
|
||||
isSame(b: Number): boolean;
|
||||
isSame(b: Date): boolean;
|
||||
isSame(b: number[]): boolean;
|
||||
isSame(b: Moment, granularity: string): boolean;
|
||||
isSame(b: String, granularity: string): boolean;
|
||||
isSame(b: Number, granularity: string): boolean;
|
||||
isSame(b: Date, granularity: string): boolean;
|
||||
isSame(b: number[], granularity: string): boolean;
|
||||
|
||||
// Deprecated as of 2.8.0.
|
||||
lang(language: string): Moment;
|
||||
lang(reset: boolean): Moment;
|
||||
lang(): MomentLanguage;
|
||||
|
||||
locale(language: string): Moment;
|
||||
locale(reset: boolean): Moment;
|
||||
locale(): string;
|
||||
|
||||
localeData(language: string): Moment;
|
||||
localeData(reset: boolean): Moment;
|
||||
localeData(): MomentLanguage;
|
||||
|
||||
// Deprecated as of 2.7.0.
|
||||
max(date: Date): Moment;
|
||||
max(date: number): Moment;
|
||||
max(date: any[]): Moment;
|
||||
max(date: string): Moment;
|
||||
max(date: string, format: string): Moment;
|
||||
max(clone: Moment): Moment;
|
||||
|
||||
// Deprecated as of 2.7.0.
|
||||
min(date: Date): Moment;
|
||||
min(date: number): Moment;
|
||||
min(date: any[]): Moment;
|
||||
min(date: string): Moment;
|
||||
min(date: string, format: string): Moment;
|
||||
min(clone: Moment): Moment;
|
||||
|
||||
get(unit: string): number;
|
||||
set(unit: string, value: number): Moment;
|
||||
|
||||
}
|
||||
|
||||
interface MomentCalendar {
|
||||
|
||||
lastDay: any;
|
||||
sameDay: any;
|
||||
nextDay: any;
|
||||
lastWeek: any;
|
||||
nextWeek: any;
|
||||
sameElse: any;
|
||||
|
||||
}
|
||||
|
||||
interface BaseMomentLanguage {
|
||||
months ?: any;
|
||||
monthsShort ?: any;
|
||||
weekdays ?: any;
|
||||
weekdaysShort ?: any;
|
||||
weekdaysMin ?: any;
|
||||
relativeTime ?: MomentRelativeTime;
|
||||
meridiem ?: (hour: number, minute: number, isLowercase: boolean) => string;
|
||||
calendar ?: MomentCalendar;
|
||||
ordinal ?: (num: number) => string;
|
||||
}
|
||||
|
||||
interface MomentLanguage extends BaseMomentLanguage {
|
||||
longDateFormat?: MomentLongDateFormat;
|
||||
}
|
||||
|
||||
interface MomentLanguageData extends BaseMomentLanguage {
|
||||
/**
|
||||
* @param formatType should be L, LL, LLL, LLLL.
|
||||
*/
|
||||
longDateFormat(formatType: string): string;
|
||||
}
|
||||
|
||||
interface MomentLongDateFormat {
|
||||
|
||||
L: string;
|
||||
LL: string;
|
||||
LLL: string;
|
||||
LLLL: string;
|
||||
LT: string;
|
||||
l?: string;
|
||||
ll?: string;
|
||||
lll?: string;
|
||||
llll?: string;
|
||||
lt?: string;
|
||||
|
||||
}
|
||||
|
||||
interface MomentRelativeTime {
|
||||
|
||||
future: any;
|
||||
past: any;
|
||||
s: any;
|
||||
m: any;
|
||||
mm: any;
|
||||
h: any;
|
||||
hh: any;
|
||||
d: any;
|
||||
dd: any;
|
||||
M: any;
|
||||
MM: any;
|
||||
y: any;
|
||||
yy: any;
|
||||
|
||||
}
|
||||
|
||||
interface MomentStatic {
|
||||
|
||||
version: string;
|
||||
|
||||
(): Moment;
|
||||
(date: number): Moment;
|
||||
(date: number[]): Moment;
|
||||
(date: string, format?: string, strict?: boolean): Moment;
|
||||
(date: string, format?: string, language?: string, strict?: boolean): Moment;
|
||||
(date: string, formats: string[], strict?: boolean): Moment;
|
||||
(date: string, formats: string[], language?: string, strict?: boolean): Moment;
|
||||
(date: string, specialFormat: () => void, strict?: boolean): Moment;
|
||||
(date: string, specialFormat: () => void, language?: string, strict?: boolean): Moment;
|
||||
(date: string, formatsIncludingSpecial: any[], strict?: boolean): Moment;
|
||||
(date: string, formatsIncludingSpecial: any[], language?: string, strict?: boolean): Moment;
|
||||
(date: Date): Moment;
|
||||
(date: Moment): Moment;
|
||||
(date: Object): Moment;
|
||||
|
||||
utc(): Moment;
|
||||
utc(date: number): Moment;
|
||||
utc(date: number[]): Moment;
|
||||
utc(date: string, format?: string, strict?: boolean): Moment;
|
||||
utc(date: string, format?: string, language?: string, strict?: boolean): Moment;
|
||||
utc(date: string, formats: string[], strict?: boolean): Moment;
|
||||
utc(date: string, formats: string[], language?: string, strict?: boolean): Moment;
|
||||
utc(date: Date): Moment;
|
||||
utc(date: Moment): Moment;
|
||||
utc(date: Object): Moment;
|
||||
|
||||
unix(timestamp: number): Moment;
|
||||
|
||||
invalid(parsingFlags?: Object): Moment;
|
||||
isMoment(): boolean;
|
||||
isMoment(m: any): boolean;
|
||||
isDuration(): boolean;
|
||||
isDuration(d: any): boolean;
|
||||
|
||||
// Deprecated in 2.8.0.
|
||||
lang(language?: string): string;
|
||||
lang(language?: string, definition?: MomentLanguage): string;
|
||||
|
||||
locale(language?: string): string;
|
||||
locale(language?: string[]): string;
|
||||
locale(language?: string, definition?: MomentLanguage): string;
|
||||
|
||||
localeData(language?: string): MomentLanguageData;
|
||||
|
||||
longDateFormat: any;
|
||||
relativeTime: any;
|
||||
meridiem: (hour: number, minute: number, isLowercase: boolean) => string;
|
||||
calendar: any;
|
||||
ordinal: (num: number) => string;
|
||||
|
||||
duration(milliseconds: Number): Duration;
|
||||
duration(num: Number, unitOfTime: string): Duration;
|
||||
duration(input: MomentInput): Duration;
|
||||
duration(object: any): Duration;
|
||||
duration(): Duration;
|
||||
|
||||
parseZone(date: string): Moment;
|
||||
|
||||
months(): string[];
|
||||
months(index: number): string;
|
||||
months(format: string): string[];
|
||||
months(format: string, index: number): string;
|
||||
monthsShort(): string[];
|
||||
monthsShort(index: number): string;
|
||||
monthsShort(format: string): string[];
|
||||
monthsShort(format: string, index: number): string;
|
||||
|
||||
weekdays(): string[];
|
||||
weekdays(index: number): string;
|
||||
weekdays(format: string): string[];
|
||||
weekdays(format: string, index: number): string;
|
||||
weekdaysShort(): string[];
|
||||
weekdaysShort(index: number): string;
|
||||
weekdaysShort(format: string): string[];
|
||||
weekdaysShort(format: string, index: number): string;
|
||||
weekdaysMin(): string[];
|
||||
weekdaysMin(index: number): string;
|
||||
weekdaysMin(format: string): string[];
|
||||
weekdaysMin(format: string, index: number): string;
|
||||
|
||||
min(moments: Moment[]): Moment;
|
||||
max(moments: Moment[]): Moment;
|
||||
|
||||
normalizeUnits(unit: string): string;
|
||||
relativeTimeThreshold(threshold: string, limit: number): void;
|
||||
|
||||
/**
|
||||
* Constant used to enable explicit ISO_8601 format parsing.
|
||||
*/
|
||||
ISO_8601(): void;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module 'moment' {
|
||||
var moment: moment.MomentStatic;
|
||||
export = moment;
|
||||
}
|
||||
@@ -188,6 +188,7 @@ moment(1318874398806).valueOf();
|
||||
moment(1318874398806).unix();
|
||||
moment([2000]).isLeapYear();
|
||||
moment().zone();
|
||||
moment().utcOffset();
|
||||
moment("2012-2", "YYYY-MM").daysInMonth();
|
||||
moment([2011, 2, 12]).isDST();
|
||||
|
||||
|
||||
Vendored
+1
-473
@@ -3,478 +3,6 @@
|
||||
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module moment {
|
||||
|
||||
interface MomentInput {
|
||||
|
||||
years?: number;
|
||||
y?: number;
|
||||
|
||||
months?: number;
|
||||
M?: number;
|
||||
|
||||
weeks?: number;
|
||||
w?: number;
|
||||
|
||||
days?: number;
|
||||
d?: number;
|
||||
|
||||
hours?: number;
|
||||
h?: number;
|
||||
|
||||
minutes?: number;
|
||||
m?: number;
|
||||
|
||||
seconds?: number;
|
||||
s?: number;
|
||||
|
||||
milliseconds?: number;
|
||||
ms?: number;
|
||||
|
||||
}
|
||||
|
||||
interface Duration {
|
||||
|
||||
humanize(withSuffix?: boolean): string;
|
||||
|
||||
as(units: string): number;
|
||||
|
||||
milliseconds(): number;
|
||||
asMilliseconds(): number;
|
||||
|
||||
seconds(): number;
|
||||
asSeconds(): number;
|
||||
|
||||
minutes(): number;
|
||||
asMinutes(): number;
|
||||
|
||||
hours(): number;
|
||||
asHours(): number;
|
||||
|
||||
days(): number;
|
||||
asDays(): number;
|
||||
|
||||
months(): number;
|
||||
asMonths(): number;
|
||||
|
||||
years(): number;
|
||||
asYears(): number;
|
||||
|
||||
add(n: number, p: string): Duration;
|
||||
add(n: number): Duration;
|
||||
add(d: Duration): Duration;
|
||||
|
||||
subtract(n: number, p: string): Duration;
|
||||
subtract(n: number): Duration;
|
||||
subtract(d: Duration): Duration;
|
||||
|
||||
toISOString(): string;
|
||||
|
||||
}
|
||||
|
||||
interface Moment {
|
||||
|
||||
format(format: string): string;
|
||||
format(): string;
|
||||
|
||||
fromNow(withoutSuffix?: boolean): string;
|
||||
|
||||
startOf(unitOfTime: string): Moment;
|
||||
endOf(unitOfTime: string): Moment;
|
||||
|
||||
/**
|
||||
* Mutates the original moment by adding time. (deprecated in 2.8.0)
|
||||
*
|
||||
* @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
|
||||
* @param amount the amount you want to add
|
||||
*/
|
||||
add(unitOfTime: string, amount: number): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time.
|
||||
*
|
||||
* @param amount the amount you want to add
|
||||
* @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
|
||||
*/
|
||||
add(amount: number, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time. Note that the order of arguments can be flipped.
|
||||
*
|
||||
* @param amount the amount you want to add
|
||||
* @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
|
||||
*/
|
||||
add(amount: string, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time.
|
||||
*
|
||||
* @param objectLiteral an object literal that describes multiple time units {days:7,months:1}
|
||||
*/
|
||||
add(objectLiteral: MomentInput): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time.
|
||||
*
|
||||
* @param duration a length of time
|
||||
*/
|
||||
add(duration: Duration): Moment;
|
||||
|
||||
/**
|
||||
* Mutates the original moment by subtracting time. (deprecated in 2.8.0)
|
||||
*
|
||||
* @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
|
||||
* @param amount the amount you want to subtract
|
||||
*/
|
||||
subtract(unitOfTime: string, amount: number): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time.
|
||||
*
|
||||
* @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
|
||||
* @param amount the amount you want to subtract
|
||||
*/
|
||||
subtract(amount: number, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time. Note that the order of arguments can be flipped.
|
||||
*
|
||||
* @param amount the amount you want to add
|
||||
* @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
|
||||
*/
|
||||
subtract(amount: string, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time.
|
||||
*
|
||||
* @param objectLiteral an object literal that describes multiple time units {days:7,months:1}
|
||||
*/
|
||||
subtract(objectLiteral: MomentInput): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time.
|
||||
*
|
||||
* @param duration a length of time
|
||||
*/
|
||||
subtract(duration: Duration): Moment;
|
||||
|
||||
calendar(): string;
|
||||
calendar(start: Moment): string;
|
||||
|
||||
clone(): Moment;
|
||||
|
||||
/**
|
||||
* @return Unix timestamp, or milliseconds since the epoch.
|
||||
*/
|
||||
valueOf(): number;
|
||||
|
||||
local(): Moment; // current date/time in local mode
|
||||
|
||||
utc(): Moment; // current date/time in UTC mode
|
||||
|
||||
isValid(): boolean;
|
||||
|
||||
year(y: number): Moment;
|
||||
year(): number;
|
||||
quarter(): number;
|
||||
quarter(q: number): Moment;
|
||||
month(M: number): Moment;
|
||||
month(M: string): Moment;
|
||||
month(): number;
|
||||
day(d: number): Moment;
|
||||
day(d: string): Moment;
|
||||
day(): number;
|
||||
date(d: number): Moment;
|
||||
date(): number;
|
||||
hour(h: number): Moment;
|
||||
hour(): number;
|
||||
hours(h: number): Moment;
|
||||
hours(): number;
|
||||
minute(m: number): Moment;
|
||||
minute(): number;
|
||||
minutes(m: number): Moment;
|
||||
minutes(): number;
|
||||
second(s: number): Moment;
|
||||
second(): number;
|
||||
seconds(s: number): Moment;
|
||||
seconds(): number;
|
||||
millisecond(ms: number): Moment;
|
||||
millisecond(): number;
|
||||
milliseconds(ms: number): Moment;
|
||||
milliseconds(): number;
|
||||
weekday(): number;
|
||||
weekday(d: number): Moment;
|
||||
isoWeekday(): number;
|
||||
isoWeekday(d: number): Moment;
|
||||
weekYear(): number;
|
||||
weekYear(d: number): Moment;
|
||||
isoWeekYear(): number;
|
||||
isoWeekYear(d: number): Moment;
|
||||
week(): number;
|
||||
week(d: number): Moment;
|
||||
weeks(): number;
|
||||
weeks(d: number): Moment;
|
||||
isoWeek(): number;
|
||||
isoWeek(d: number): Moment;
|
||||
isoWeeks(): number;
|
||||
isoWeeks(d: number): Moment;
|
||||
weeksInYear(): number;
|
||||
isoWeeksInYear(): number;
|
||||
dayOfYear(): number;
|
||||
dayOfYear(d: number): Moment;
|
||||
|
||||
from(f: Moment): string;
|
||||
from(f: Moment, suffix: boolean): string;
|
||||
from(d: Date): string;
|
||||
from(s: string): string;
|
||||
from(date: number[]): string;
|
||||
|
||||
diff(b: Moment): number;
|
||||
diff(b: Moment, unitOfTime: string): number;
|
||||
diff(b: Moment, unitOfTime: string, round: boolean): number;
|
||||
|
||||
toArray(): number[];
|
||||
toDate(): Date;
|
||||
toISOString(): string;
|
||||
toJSON(): string;
|
||||
unix(): number;
|
||||
|
||||
isLeapYear(): boolean;
|
||||
zone(): number;
|
||||
zone(b: number): Moment;
|
||||
zone(b: string): Moment;
|
||||
daysInMonth(): number;
|
||||
isDST(): boolean;
|
||||
|
||||
isBefore(): boolean;
|
||||
isBefore(b: Moment): boolean;
|
||||
isBefore(b: string): boolean;
|
||||
isBefore(b: Number): boolean;
|
||||
isBefore(b: Date): boolean;
|
||||
isBefore(b: number[]): boolean;
|
||||
isBefore(b: Moment, granularity: string): boolean;
|
||||
isBefore(b: String, granularity: string): boolean;
|
||||
isBefore(b: Number, granularity: string): boolean;
|
||||
isBefore(b: Date, granularity: string): boolean;
|
||||
isBefore(b: number[], granularity: string): boolean;
|
||||
|
||||
isAfter(): boolean;
|
||||
isAfter(b: Moment): boolean;
|
||||
isAfter(b: string): boolean;
|
||||
isAfter(b: Number): boolean;
|
||||
isAfter(b: Date): boolean;
|
||||
isAfter(b: number[]): boolean;
|
||||
isAfter(b: Moment, granularity: string): boolean;
|
||||
isAfter(b: String, granularity: string): boolean;
|
||||
isAfter(b: Number, granularity: string): boolean;
|
||||
isAfter(b: Date, granularity: string): boolean;
|
||||
isAfter(b: number[], granularity: string): boolean;
|
||||
|
||||
isSame(b: Moment): boolean;
|
||||
isSame(b: string): boolean;
|
||||
isSame(b: Number): boolean;
|
||||
isSame(b: Date): boolean;
|
||||
isSame(b: number[]): boolean;
|
||||
isSame(b: Moment, granularity: string): boolean;
|
||||
isSame(b: String, granularity: string): boolean;
|
||||
isSame(b: Number, granularity: string): boolean;
|
||||
isSame(b: Date, granularity: string): boolean;
|
||||
isSame(b: number[], granularity: string): boolean;
|
||||
|
||||
// Deprecated as of 2.8.0.
|
||||
lang(language: string): Moment;
|
||||
lang(reset: boolean): Moment;
|
||||
lang(): MomentLanguage;
|
||||
|
||||
locale(language: string): Moment;
|
||||
locale(reset: boolean): Moment;
|
||||
locale(): string;
|
||||
|
||||
localeData(language: string): Moment;
|
||||
localeData(reset: boolean): Moment;
|
||||
localeData(): MomentLanguage;
|
||||
|
||||
// Deprecated as of 2.7.0.
|
||||
max(date: Date): Moment;
|
||||
max(date: number): Moment;
|
||||
max(date: any[]): Moment;
|
||||
max(date: string): Moment;
|
||||
max(date: string, format: string): Moment;
|
||||
max(clone: Moment): Moment;
|
||||
|
||||
// Deprecated as of 2.7.0.
|
||||
min(date: Date): Moment;
|
||||
min(date: number): Moment;
|
||||
min(date: any[]): Moment;
|
||||
min(date: string): Moment;
|
||||
min(date: string, format: string): Moment;
|
||||
min(clone: Moment): Moment;
|
||||
|
||||
get(unit: string): number;
|
||||
set(unit: string, value: number): Moment;
|
||||
|
||||
}
|
||||
|
||||
interface MomentCalendar {
|
||||
|
||||
lastDay: any;
|
||||
sameDay: any;
|
||||
nextDay: any;
|
||||
lastWeek: any;
|
||||
nextWeek: any;
|
||||
sameElse: any;
|
||||
|
||||
}
|
||||
|
||||
interface BaseMomentLanguage {
|
||||
months ?: any;
|
||||
monthsShort ?: any;
|
||||
weekdays ?: any;
|
||||
weekdaysShort ?: any;
|
||||
weekdaysMin ?: any;
|
||||
relativeTime ?: MomentRelativeTime;
|
||||
meridiem ?: (hour: number, minute: number, isLowercase: boolean) => string;
|
||||
calendar ?: MomentCalendar;
|
||||
ordinal ?: (num: number) => string;
|
||||
}
|
||||
|
||||
interface MomentLanguage extends BaseMomentLanguage {
|
||||
longDateFormat?: MomentLongDateFormat;
|
||||
}
|
||||
|
||||
interface MomentLanguageData extends BaseMomentLanguage {
|
||||
/**
|
||||
* @param formatType should be L, LL, LLL, LLLL.
|
||||
*/
|
||||
longDateFormat(formatType: string): string;
|
||||
}
|
||||
|
||||
interface MomentLongDateFormat {
|
||||
|
||||
L: string;
|
||||
LL: string;
|
||||
LLL: string;
|
||||
LLLL: string;
|
||||
LT: string;
|
||||
l?: string;
|
||||
ll?: string;
|
||||
lll?: string;
|
||||
llll?: string;
|
||||
lt?: string;
|
||||
|
||||
}
|
||||
|
||||
interface MomentRelativeTime {
|
||||
|
||||
future: any;
|
||||
past: any;
|
||||
s: any;
|
||||
m: any;
|
||||
mm: any;
|
||||
h: any;
|
||||
hh: any;
|
||||
d: any;
|
||||
dd: any;
|
||||
M: any;
|
||||
MM: any;
|
||||
y: any;
|
||||
yy: any;
|
||||
|
||||
}
|
||||
|
||||
interface MomentStatic {
|
||||
|
||||
version: string;
|
||||
|
||||
(): Moment;
|
||||
(date: number): Moment;
|
||||
(date: number[]): Moment;
|
||||
(date: string, format?: string, strict?: boolean): Moment;
|
||||
(date: string, format?: string, language?: string, strict?: boolean): Moment;
|
||||
(date: string, formats: string[], strict?: boolean): Moment;
|
||||
(date: string, formats: string[], language?: string, strict?: boolean): Moment;
|
||||
(date: string, specialFormat: () => void, strict?: boolean): Moment;
|
||||
(date: string, specialFormat: () => void, language?: string, strict?: boolean): Moment;
|
||||
(date: string, formatsIncludingSpecial: any[], strict?: boolean): Moment;
|
||||
(date: string, formatsIncludingSpecial: any[], language?: string, strict?: boolean): Moment;
|
||||
(date: Date): Moment;
|
||||
(date: Moment): Moment;
|
||||
(date: Object): Moment;
|
||||
|
||||
utc(): Moment;
|
||||
utc(date: number): Moment;
|
||||
utc(date: number[]): Moment;
|
||||
utc(date: string, format?: string, strict?: boolean): Moment;
|
||||
utc(date: string, format?: string, language?: string, strict?: boolean): Moment;
|
||||
utc(date: string, formats: string[], strict?: boolean): Moment;
|
||||
utc(date: string, formats: string[], language?: string, strict?: boolean): Moment;
|
||||
utc(date: Date): Moment;
|
||||
utc(date: Moment): Moment;
|
||||
utc(date: Object): Moment;
|
||||
|
||||
unix(timestamp: number): Moment;
|
||||
|
||||
invalid(parsingFlags?: Object): Moment;
|
||||
isMoment(): boolean;
|
||||
isMoment(m: any): boolean;
|
||||
isDuration(): boolean;
|
||||
isDuration(d: any): boolean;
|
||||
|
||||
// Deprecated in 2.8.0.
|
||||
lang(language?: string): string;
|
||||
lang(language?: string, definition?: MomentLanguage): string;
|
||||
|
||||
locale(language?: string): string;
|
||||
locale(language?: string[]): string;
|
||||
locale(language?: string, definition?: MomentLanguage): string;
|
||||
|
||||
localeData(language?: string): MomentLanguageData;
|
||||
|
||||
longDateFormat: any;
|
||||
relativeTime: any;
|
||||
meridiem: (hour: number, minute: number, isLowercase: boolean) => string;
|
||||
calendar: any;
|
||||
ordinal: (num: number) => string;
|
||||
|
||||
duration(milliseconds: Number): Duration;
|
||||
duration(num: Number, unitOfTime: string): Duration;
|
||||
duration(input: MomentInput): Duration;
|
||||
duration(object: any): Duration;
|
||||
duration(): Duration;
|
||||
|
||||
parseZone(date: string): Moment;
|
||||
|
||||
months(): string[];
|
||||
months(index: number): string;
|
||||
months(format: string): string[];
|
||||
months(format: string, index: number): string;
|
||||
monthsShort(): string[];
|
||||
monthsShort(index: number): string;
|
||||
monthsShort(format: string): string[];
|
||||
monthsShort(format: string, index: number): string;
|
||||
|
||||
weekdays(): string[];
|
||||
weekdays(index: number): string;
|
||||
weekdays(format: string): string[];
|
||||
weekdays(format: string, index: number): string;
|
||||
weekdaysShort(): string[];
|
||||
weekdaysShort(index: number): string;
|
||||
weekdaysShort(format: string): string[];
|
||||
weekdaysShort(format: string, index: number): string;
|
||||
weekdaysMin(): string[];
|
||||
weekdaysMin(index: number): string;
|
||||
weekdaysMin(format: string): string[];
|
||||
weekdaysMin(format: string, index: number): string;
|
||||
|
||||
min(moments: Moment[]): Moment;
|
||||
max(moments: Moment[]): Moment;
|
||||
|
||||
normalizeUnits(unit: string): string;
|
||||
relativeTimeThreshold(threshold: string, limit: number): void;
|
||||
|
||||
/**
|
||||
* Constant used to enable explicit ISO_8601 format parsing.
|
||||
*/
|
||||
ISO_8601(): void;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/// <reference path="moment-node.d.ts" />
|
||||
|
||||
declare var moment: moment.MomentStatic;
|
||||
|
||||
declare module 'moment' {
|
||||
export = moment;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/// <reference path="mpromise.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
var assert = require('assert');
|
||||
import Promise = require('mpromise');
|
||||
|
||||
function ex1() {
|
||||
var promise = new Promise;
|
||||
}
|
||||
|
||||
function ex2() {
|
||||
var promise = new Promise<number, string> (function(reason: string, ...args: number[]) {
|
||||
return;
|
||||
});
|
||||
}
|
||||
|
||||
function ex3() {
|
||||
var promise = new Promise<number, string>();
|
||||
promise.onResolve(function(reason: string, ...args: number[]) {
|
||||
return;
|
||||
});
|
||||
}
|
||||
|
||||
function fulfill() {
|
||||
var promise = new Promise<number, Error>();
|
||||
promise.fulfill(1, 2, 3);
|
||||
}
|
||||
|
||||
function reject() {
|
||||
var promise = new Promise<number, string>();
|
||||
promise.reject('reason');
|
||||
}
|
||||
|
||||
function onFulfill1<R>() {
|
||||
var promise = new Promise<number, R>();
|
||||
promise.onFulfill(function (...args: number[]) {
|
||||
assert.equal(3, args[0] + args[1]);
|
||||
});
|
||||
promise.fulfill(1, 2);
|
||||
}
|
||||
|
||||
function onFulfill2() {
|
||||
var promise = new Promise<string, Error>();
|
||||
promise.fulfill(" :D ");
|
||||
promise.onFulfill(function (arg: string) {
|
||||
console.log(arg); // logs " :D "
|
||||
});
|
||||
}
|
||||
|
||||
function onReject1<F>() {
|
||||
var promise = new Promise<F, string>();
|
||||
promise.onReject(function (reason: string) {
|
||||
assert.equal('sad', reason);
|
||||
});
|
||||
promise.reject('sad');
|
||||
}
|
||||
|
||||
function onReject2() {
|
||||
var promise = new Promise<string, string>();
|
||||
promise.reject(" :( ");
|
||||
promise.onReject(function (reason: string) {
|
||||
console.log(reason); // logs " :( "
|
||||
});
|
||||
}
|
||||
|
||||
function onResolve1<R>() {
|
||||
var promise = new Promise<number, R>();
|
||||
promise.onResolve(function (err: R, ...args: number[]) {
|
||||
console.log(args[0] + args[1]); // logs 3
|
||||
});
|
||||
promise.fulfill(1, 2);
|
||||
}
|
||||
|
||||
function onResolve2<F>() {
|
||||
// rejection
|
||||
var promise = new Promise<F, Error>();
|
||||
promise.onResolve(function (err: Error) {
|
||||
if (err) {
|
||||
console.log(err.message); // logs "failed"
|
||||
}
|
||||
});
|
||||
promise.reject(new Error('failed'));
|
||||
}
|
||||
|
||||
function then() {
|
||||
var promise = new Promise<number, Error>();
|
||||
|
||||
promise.then(function (arg: number) {
|
||||
return arg + 1;
|
||||
}).then(function (arg: number) {
|
||||
throw new Error(arg + ' is an error!');
|
||||
}).then(null, function (err: Error) {
|
||||
assert.ok(err instanceof Error);
|
||||
assert.equal('2 is an error', err.message);
|
||||
});
|
||||
promise.fulfill(1);
|
||||
}
|
||||
|
||||
function end1() {
|
||||
var promise = new Promise<number, Error>();
|
||||
promise.then(function(){ throw new Error('shucks') });
|
||||
setTimeout(function () {
|
||||
promise.fulfill();
|
||||
// error was caught and swallowed by the promise returned from
|
||||
// p.then(). we either have to always register handlers on
|
||||
// the returned promises or we can do the following...
|
||||
}, 10);
|
||||
}
|
||||
|
||||
function end2() {
|
||||
// this time we use .end() which prevents catching thrown errors
|
||||
var promise = new Promise<any, Error>();
|
||||
setTimeout(function () {
|
||||
promise.fulfill(); // throws "shucks"
|
||||
}, 10);
|
||||
return promise.then(function(){ throw new Error('shucks') }).end(); // <--
|
||||
}
|
||||
|
||||
function chain() {
|
||||
function makeMeAPromise(i: number) {
|
||||
var p = new Promise<number, Error>();
|
||||
p.fulfill(i);
|
||||
return p;
|
||||
}
|
||||
|
||||
var initialPromise = new Promise<number, Error>();
|
||||
var returnPromise = initialPromise;
|
||||
for (var i=0; i<10; ++i) {
|
||||
returnPromise = returnPromise.chain(makeMeAPromise(i));
|
||||
}
|
||||
|
||||
initialPromise.fulfill();
|
||||
return returnPromise;
|
||||
}
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
// Type definitions for mpromise 0.5.4
|
||||
// Project: https://github.com/aheckmann/mpromise
|
||||
// Definitions by: Seulgi Kim <https://github.com/sgkim126/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "mpromise" {
|
||||
interface IFulfillFunction<F> {
|
||||
(...args: F[]): void;
|
||||
(arg: F): void;
|
||||
}
|
||||
interface IRejectFunction<R> {
|
||||
(err: R): void;
|
||||
}
|
||||
interface IResolveFunction<F, R> {
|
||||
(err: R, ...args: F[]): void;
|
||||
(err: R, arg: F): void;
|
||||
}
|
||||
|
||||
class Promise<F, R> {
|
||||
constructor(fn?: IResolveFunction<F, R>);
|
||||
|
||||
static FAILURE: string;
|
||||
static SUCCESS: string;
|
||||
|
||||
fulfill(...args: F[]): Promise<F, R>;
|
||||
fulfill(arg: F): Promise<F, R>;
|
||||
reject(reason: R): Promise<F, R>;
|
||||
resolve(reason: R, ...args: F[]): Promise<F, R>;
|
||||
resolve(reason: R, arg: F): Promise<F, R>;
|
||||
|
||||
onFulfill(callback: IFulfillFunction<F>): Promise<F, R>;
|
||||
onReject(callback: IRejectFunction<R>): Promise<F, R>;
|
||||
onResolve(callback: IResolveFunction<F, R>): Promise<F, R>;
|
||||
|
||||
then<F, R>(onFulfilled: IFulfillFunction<F>, onRejected?: IRejectFunction<R>): Promise<F, R>;
|
||||
end(): void;
|
||||
|
||||
chain(promise: Promise<F, R>): Promise<F, R>;
|
||||
}
|
||||
|
||||
export = Promise;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Vendored
+2551
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,117 @@
|
||||
/// <reference path="navigation.d.ts" />
|
||||
|
||||
// History Manager
|
||||
class LogHistoryManager extends Navigation.HashHistoryManager {
|
||||
addHistory(state: Navigation.State, url: string) {
|
||||
console.log('add history');
|
||||
super.addHistory(state, url);
|
||||
}
|
||||
}
|
||||
|
||||
// State Router
|
||||
class LogStateRouter extends Navigation.StateRouter {
|
||||
getData(route: string): { state: Navigation.State; data: any } {
|
||||
console.log('get data');
|
||||
return super.getData(route);
|
||||
}
|
||||
}
|
||||
|
||||
// Settings
|
||||
Navigation.settings.router = new LogStateRouter();
|
||||
Navigation.settings.historyManager = new LogHistoryManager();
|
||||
Navigation.settings.stateIdKey = 'state';
|
||||
|
||||
// Configuration
|
||||
Navigation.StateInfoConfig.build([
|
||||
{ key: 'home', initial: 'page', states: [
|
||||
{ key: 'page', route: '' }
|
||||
]},
|
||||
{ key: 'person', initial: 'list', states: [
|
||||
{ key: 'list', route: 'people/{page}', transitions: [
|
||||
{ key: 'select', to: 'details' }
|
||||
], defaults: { page: 1 }, trackCrumbTrail: false },
|
||||
{ key: 'details', route: 'person/{id}', defaultTypes: { id: 'number' } }
|
||||
]}
|
||||
]);
|
||||
|
||||
// StateInfo
|
||||
var dialogs = Navigation.StateInfoConfig.dialogs;
|
||||
var home = dialogs['home'];
|
||||
var homePage = home.states['page'];
|
||||
var homeKey = home.key;
|
||||
var homePageKey = homePage.key;
|
||||
homePage = home.initial;
|
||||
var person = dialogs['person'];
|
||||
var personList = person.states['list'];
|
||||
var personDetails = person.states['details'];
|
||||
var personListSelect = personList.transitions['select'];
|
||||
personList = personListSelect.parent;
|
||||
personDetails = personListSelect.to;
|
||||
var pageDefault = personList.defaults.page;
|
||||
var idDefaultType = personDetails.defaultTypes.id;
|
||||
|
||||
// StateNavigator
|
||||
personList.dispose = () => {};
|
||||
personList.navigating = (data, url, navigate) => {
|
||||
navigate();
|
||||
};
|
||||
personList.navigated = (data) => {};
|
||||
|
||||
// State Handler
|
||||
class LogStateHandler extends Navigation.StateHandler {
|
||||
getNavigationData(state: Navigation.State, url: string): any {
|
||||
console.log('get navigation data');
|
||||
super.getNavigationData(state, url);
|
||||
}
|
||||
}
|
||||
homePage.stateHandler = new LogStateHandler();
|
||||
personList.stateHandler = new LogStateHandler();
|
||||
personDetails.stateHandler = new LogStateHandler();
|
||||
|
||||
// Navigation Event
|
||||
var navigationListener =
|
||||
(oldState: Navigation.State, state: Navigation.State, data: any) => {
|
||||
Navigation.StateController.offNavigate(navigationListener);
|
||||
};
|
||||
Navigation.StateController.onNavigate(navigationListener);
|
||||
|
||||
// Navigation
|
||||
Navigation.start('home');
|
||||
Navigation.StateController.navigate('person');
|
||||
Navigation.StateController.refresh();
|
||||
Navigation.StateController.refresh({ page: 2 });
|
||||
Navigation.StateController.navigate('select', { id: 10 });
|
||||
var canGoBack: boolean = Navigation.StateController.canNavigateBack(1);
|
||||
Navigation.StateController.navigateBack(1);
|
||||
|
||||
// Navigation Link
|
||||
var link = Navigation.StateController.getNavigationLink('person');
|
||||
link = Navigation.StateController.getRefreshLink();
|
||||
link = Navigation.StateController.getRefreshLink({ page: 2 });
|
||||
link = Navigation.StateController.getNavigationLink('select', { id: 10 });
|
||||
var nextDialog = Navigation.StateController.getNextState('select').parent;
|
||||
person = nextDialog;
|
||||
Navigation.StateController.navigateLink(link);
|
||||
link = Navigation.StateController.getNavigationBackLink(1);
|
||||
var crumb = Navigation.StateController.crumbs[0];
|
||||
link = crumb.navigationLink;
|
||||
|
||||
// StateContext
|
||||
Navigation.StateController.navigate('home');
|
||||
Navigation.StateController.navigate('person');
|
||||
home = Navigation.StateContext.previousDialog;
|
||||
homePage = Navigation.StateContext.previousState;
|
||||
person === Navigation.StateContext.dialog;
|
||||
personList === Navigation.StateContext.state;
|
||||
var url: string = Navigation.StateContext.url;
|
||||
var page: number = Navigation.StateContext.data.page;
|
||||
|
||||
// Navigation Data
|
||||
Navigation.StateController.refresh({ page: 2 });
|
||||
var data = Navigation.StateContext.includeCurrentData({ sort: 'name' }, ['page']);
|
||||
Navigation.StateController.refresh(data);
|
||||
Navigation.StateContext.clear('sort');
|
||||
var data = Navigation.StateContext.includeCurrentData({ pageSize: 10 });
|
||||
Navigation.StateController.refresh(data);
|
||||
Navigation.StateContext.clear();
|
||||
Navigation.StateController.refresh();
|
||||
Vendored
+847
@@ -0,0 +1,847 @@
|
||||
// Type definitions for Navigation 1.0
|
||||
// Project: http://grahammendick.github.io/navigation/
|
||||
// Definitions by: Graham Mendick <https://github.com/grahammendick>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
declare module 'navigation' {
|
||||
export = Navigation;
|
||||
}
|
||||
|
||||
declare module Navigation {
|
||||
/**
|
||||
* Defines a contract a class must implement in order to represent a
|
||||
* logical grouping of child State elements. Navigating across different
|
||||
* dialogs will initialise the crumb trail
|
||||
*/
|
||||
interface IDialog<TState, TStates> {
|
||||
/**
|
||||
* Gets the State children
|
||||
*/
|
||||
states: TStates;
|
||||
/**
|
||||
* Gets the state to navigate to if the Key is passed as an action
|
||||
* parameter to the StateController
|
||||
*/
|
||||
initial: TState;
|
||||
/**
|
||||
* Gets the key, unique across dialogs, which is passed as the action
|
||||
* parameter to the StateController when navigating
|
||||
*/
|
||||
key: string;
|
||||
/**
|
||||
* Gets the textual description of the dialog
|
||||
*/
|
||||
title?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a contract a class must implement in order to configure state
|
||||
* information. A child of a Dialog element, it represents the endpoint of
|
||||
* a navigation
|
||||
*/
|
||||
interface IState<TTransitions> {
|
||||
/**
|
||||
* Gets the Transition children
|
||||
*/
|
||||
transitions?: TTransitions;
|
||||
/**
|
||||
* Gets the key, unique within a Parent, used by Dialog and Transition
|
||||
* elements to specify navigation configuration
|
||||
*/
|
||||
key: string;
|
||||
/**
|
||||
* Gets the default NavigationData for this State
|
||||
*/
|
||||
defaults?: any;
|
||||
/**
|
||||
* Gets the default NavigationData Types for this State
|
||||
*/
|
||||
defaultTypes?: any;
|
||||
/**
|
||||
* Gets the textual description of the state
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* Gets the route Url pattern
|
||||
*/
|
||||
route: string;
|
||||
/**
|
||||
* Gets a value that indicates whether to maintain crumb trail
|
||||
* information e.g PreviousState. This can be used together with Route
|
||||
* to produce user friendly Urls
|
||||
*/
|
||||
trackCrumbTrail?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a contract a class must implement in order to configure
|
||||
* transition information. A child of a State element it represents a
|
||||
* possible navigation from its Parent to a sibling State
|
||||
*/
|
||||
interface ITransition<TState> {
|
||||
/**
|
||||
* Gets the state to navigate to if the Key is passed as an action
|
||||
* parameter to the StateController
|
||||
*/
|
||||
to: TState;
|
||||
/**
|
||||
* Gets the key, unique within a Parent, which is passed as the action
|
||||
* parameter to the StateController when navigating
|
||||
*/
|
||||
key: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures dialog information. Represents a logical grouping of child
|
||||
* State elements. Navigating across different dialogs will initialise the
|
||||
* crumb trail
|
||||
*/
|
||||
class Dialog implements IDialog<State, { [index: string]: State; }> {
|
||||
/**
|
||||
* Gets the State children by index
|
||||
*/
|
||||
_states: State[];
|
||||
/**
|
||||
* Gets the State children
|
||||
*/
|
||||
states: {
|
||||
[index: string]: State;
|
||||
};
|
||||
/**
|
||||
* Gets the number of the dialog
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Gets the state to navigate to if the Key is passed as an action
|
||||
* parameter to the StateController
|
||||
*/
|
||||
initial: State;
|
||||
/**
|
||||
* Gets the key, unique across dialogs, which is passed as the action
|
||||
* parameter to the StateController when navigating
|
||||
*/
|
||||
key: string;
|
||||
/**
|
||||
* Gets the textual description of the dialog
|
||||
*/
|
||||
title: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures state information. A child of a Dialog element, it
|
||||
* represents the endpoint of a navigation
|
||||
*/
|
||||
class State implements IState<{ [index: string]: Transition; }> {
|
||||
/**
|
||||
* Gets the Transition children by index
|
||||
*/
|
||||
_transitions: Transition[];
|
||||
/**
|
||||
* Gets the Transition children
|
||||
*/
|
||||
transitions: {
|
||||
[index: string]: Transition;
|
||||
};
|
||||
/**
|
||||
* Gets the parent Dialog configuration item
|
||||
*/
|
||||
parent: Dialog;
|
||||
/**
|
||||
* Gets the number of the state within its Parent
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Gets the unique identifier for this State
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Gets the key, unique within a Parent, used by Dialog and Transition
|
||||
* elements to specify navigation configuration
|
||||
*/
|
||||
key: string;
|
||||
/**
|
||||
* Gets the default NavigationData for this State
|
||||
*/
|
||||
defaults: any;
|
||||
/**
|
||||
* Gets the default NavigationData Types for this State
|
||||
*/
|
||||
defaultTypes: any;
|
||||
/**
|
||||
* Gets the formatted default NavigationData for this State
|
||||
*/
|
||||
formattedDefaults: any;
|
||||
/**
|
||||
* Gets the textual description of the state
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* Gets the route Url pattern
|
||||
*/
|
||||
route: string;
|
||||
/**
|
||||
* Gets a value that indicates whether to maintain crumb trail
|
||||
* information e.g PreviousState. This can be used together with Route
|
||||
* to produce user friendly Urls
|
||||
*/
|
||||
trackCrumbTrail: boolean;
|
||||
/**
|
||||
* Gets or sets the IStateHandler responsible for building and parsing
|
||||
* avigation links to this State
|
||||
*/
|
||||
stateHandler: IStateHandler;
|
||||
/**
|
||||
* Called on the old State (this is not the same as the previous
|
||||
* State) after navigating to a different State
|
||||
*/
|
||||
dispose: () => void;
|
||||
/**
|
||||
* Called on the current State after navigating to it
|
||||
* @param data The current NavigationData
|
||||
*/
|
||||
navigated: (data: any) => void;
|
||||
/**
|
||||
* Called on the new State before navigating to it
|
||||
* @param data The new NavigationData
|
||||
* @param url The new target location
|
||||
* @param navigate The function to call to continue to navigate
|
||||
*/
|
||||
navigating: (data: any, url: string, navigate: () => void) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures transition information. A child of a State element it
|
||||
* represents a possible navigation from its Parent to a sibling State
|
||||
*/
|
||||
class Transition implements ITransition<State> {
|
||||
/**
|
||||
* Gets the state to navigate to if the Key is passed as an action
|
||||
* parameter to the StateController
|
||||
*/
|
||||
to: State;
|
||||
/**
|
||||
* Gets the parent State configuration item
|
||||
*/
|
||||
parent: State;
|
||||
/**
|
||||
* Gets the number of the transition within its Parent
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Gets the key, unique within a Parent, which is passed as the action
|
||||
* parameter to the StateController when navigating
|
||||
*/
|
||||
key: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides static access to the Dialog, State and Transition configuration
|
||||
*/
|
||||
class StateInfoConfig {
|
||||
/**
|
||||
* Gets a collection of Dialog information, by index, with their child
|
||||
* State information and grandchild Transition information
|
||||
*/
|
||||
static _dialogs: Dialog[];
|
||||
/**
|
||||
* Gets a collection of Dialog information with their child State
|
||||
* information and grandchild Transition information
|
||||
*/
|
||||
static dialogs: {
|
||||
[index: string]: Dialog;
|
||||
};
|
||||
/**
|
||||
* Builds the Dialog, State and Transition configuration
|
||||
* @param dialogs A collection of Dialog information with their child
|
||||
* State information and grandchild Transition information
|
||||
*/
|
||||
static build(dialogs: IDialog<string, IState<ITransition<string>[]>[]>[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a contract a class must implement in order to manage the browser
|
||||
* Url
|
||||
*/
|
||||
interface IHistoryManager {
|
||||
/**
|
||||
* Gets or sets a value indicating whether to disable browser history
|
||||
*/
|
||||
disabled: boolean;
|
||||
/**
|
||||
* Registers browser history event listeners
|
||||
*/
|
||||
init(): any;
|
||||
/**
|
||||
* Adds browser history
|
||||
* @param state The State navigated to
|
||||
* @param url The current url
|
||||
*/
|
||||
addHistory(state: State, url: string): void;
|
||||
/**
|
||||
* Gets the current location
|
||||
*/
|
||||
getCurrentUrl(): string;
|
||||
/**
|
||||
* Gets an Href from the url
|
||||
*/
|
||||
getHref(url: string): string;
|
||||
/**
|
||||
* Gets a Url from the anchor
|
||||
*/
|
||||
getUrl(anchor: HTMLAnchorElement): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages history using the browser Url's hash. If used in a browser
|
||||
* without the hashchange event or outside of a browser environment, then
|
||||
* history is disabled
|
||||
*/
|
||||
class HashHistoryManager implements IHistoryManager {
|
||||
/**
|
||||
* Gets or sets a value indicating whether to disable browser history.
|
||||
* Set to true if used in a browser without the hashchange event or
|
||||
* outside of a browser environment
|
||||
*/
|
||||
disabled: boolean;
|
||||
/**
|
||||
* Gets or sets a value indicating whether to use '#' in place of '?'
|
||||
* in Urls. Set to true for Internet explorer 6 and 7 support
|
||||
*/
|
||||
replaceQueryIdentifier: boolean;
|
||||
/**
|
||||
* Registers a listener for the hashchange event
|
||||
*/
|
||||
init(): void;
|
||||
/**
|
||||
* Sets the browser Url's hash to the url
|
||||
* @param state The State navigated to
|
||||
* @param url The current url
|
||||
*/
|
||||
addHistory(state: State, url: string): void;
|
||||
/**
|
||||
* Gets the current location
|
||||
*/
|
||||
getCurrentUrl(): string;
|
||||
/**
|
||||
* Gets an Href from the url
|
||||
*/
|
||||
getHref(url: string): string;
|
||||
/**
|
||||
* Gets a Url from the anchor
|
||||
*/
|
||||
getUrl(anchor: HTMLAnchorElement): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages history using the HTML5 history api. If used in a browser
|
||||
* without the HTML5 history api or outside of a browser environment, then
|
||||
* history is disabled
|
||||
*/
|
||||
class HTML5HistoryManager implements IHistoryManager {
|
||||
/**
|
||||
* Gets or sets a value indicating whether to disable browser history.
|
||||
* Set to true if used in a browser without the HTML5 history api or
|
||||
* outside of a browser environment
|
||||
*/
|
||||
disabled: boolean;
|
||||
/**
|
||||
* Registers a listener for the popstate event
|
||||
*/
|
||||
init(): void;
|
||||
/**
|
||||
* Sets the browser Url to the url using pushState
|
||||
* @param state The State navigated to
|
||||
* @param url The current url
|
||||
*/
|
||||
addHistory(state: State, url: string): void;
|
||||
/**
|
||||
* Gets the current location
|
||||
*/
|
||||
getCurrentUrl(): string;
|
||||
/**
|
||||
* Gets an Href from the url
|
||||
*/
|
||||
getHref(url: string): string;
|
||||
/**
|
||||
* Gets a Url from the anchor
|
||||
*/
|
||||
getUrl(anchor: HTMLAnchorElement): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a contract a class must implement in order to build and parse
|
||||
* navigation links
|
||||
*/
|
||||
interface IStateHandler {
|
||||
/**
|
||||
* Gets a link that navigates to the state passing the data
|
||||
* @param state The State to navigate to
|
||||
* @param data The data to pass when navigating
|
||||
* @returns The navigation link
|
||||
*/
|
||||
getNavigationLink(state: State, data: any): string;
|
||||
/**
|
||||
* Navigates to the url
|
||||
* @param oldState The current State
|
||||
* @param state The State to navigate to
|
||||
* @param url The target location
|
||||
*/
|
||||
navigateLink(oldState: State, state: State, url: string): void;
|
||||
/**
|
||||
* Gets the data parsed from the url
|
||||
* @param state The State navigated to
|
||||
* @param url The current url
|
||||
* @returns The navigation data
|
||||
*/
|
||||
getNavigationData(state: State, url: string): any;
|
||||
/**
|
||||
* Truncates the crumb trail
|
||||
* @param The State navigated to
|
||||
* @param The Crumb collection representing the crumb trail
|
||||
* @returns Truncated crumb trail
|
||||
*/
|
||||
truncateCrumbTrail(state: State, crumbs: Crumb[]): Crumb[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents one piece of the crumb trail and holds the information need
|
||||
* to return to and recreate the State as previously visited. In a single
|
||||
* crumb trail no two crumbs can have the same State but all must have the
|
||||
* same Dialog
|
||||
*/
|
||||
class Crumb {
|
||||
/**
|
||||
* Gets the Context Data held at the time of navigating away from this
|
||||
* State
|
||||
*/
|
||||
data: any;
|
||||
/**
|
||||
* Gets the configuration information associated with this navigation
|
||||
*/
|
||||
state: State;
|
||||
/**
|
||||
* Gets a value indicating whether the Crumb is the last in the crumb
|
||||
* trail
|
||||
*/
|
||||
last: boolean;
|
||||
/**
|
||||
* Gets the State Title
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* Gets the hyperlink navigation to return to the State and pass the
|
||||
* associated Data
|
||||
*/
|
||||
navigationLink: string;
|
||||
/**
|
||||
* Initializes a new instance of the Crumb class
|
||||
*/
|
||||
constructor(data: any, state: State, link: string, last: boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides access to the Navigation Settings configuration
|
||||
*/
|
||||
class NavigationSettings {
|
||||
router: IRouter;
|
||||
historyManager: IHistoryManager;
|
||||
/**
|
||||
* Gets or sets the key that identifies the StateId
|
||||
*/
|
||||
stateIdKey: string;
|
||||
/**
|
||||
* Gets or sets the key that identifies the PreviousStateId
|
||||
*/
|
||||
previousStateIdKey: string;
|
||||
/**
|
||||
* Gets or sets the key that identifies the ReturnData
|
||||
*/
|
||||
returnDataKey: string;
|
||||
/**
|
||||
* Gets or sets the key that identifies the CrumbTrail
|
||||
*/
|
||||
crumbTrailKey: string;
|
||||
/**
|
||||
* Gets or sets the application path
|
||||
*/
|
||||
applicationPath: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides static properties for accessing context sensitive navigation
|
||||
* information. Holds the current State and NavigationData. Also holds the
|
||||
* previous State (this is not the same as the previous Crumb)
|
||||
*/
|
||||
class StateContext {
|
||||
/**
|
||||
* Gets the State navigated away from to reach the current State
|
||||
*/
|
||||
static previousState: State;
|
||||
/**
|
||||
* Gets the parent of the PreviousState property
|
||||
*/
|
||||
static previousDialog: Dialog;
|
||||
/**
|
||||
* Gets the current State
|
||||
*/
|
||||
static state: State;
|
||||
/**
|
||||
* Gets the parent of the State property
|
||||
*/
|
||||
static dialog: Dialog;
|
||||
/**
|
||||
* Gets the NavigationData for the current State. It can be accessed.
|
||||
* Will become the data stored in a Crumb when part of a crumb trail
|
||||
*/
|
||||
static data: any;
|
||||
/**
|
||||
* Gets the current Url
|
||||
*/
|
||||
static url: string;
|
||||
/**
|
||||
* Combines the data with all the current NavigationData
|
||||
* @param The data to add to the current NavigationData
|
||||
* @returns The combined data
|
||||
*/
|
||||
static includeCurrentData(data: any): any;
|
||||
/**
|
||||
* Combines the data with a subset of the current NavigationData
|
||||
* @param The data to add to the current NavigationData
|
||||
* @returns The combined data
|
||||
*/
|
||||
static includeCurrentData(data: any, keys: string[]): any;
|
||||
/**
|
||||
* Removes all items from the NavigationData
|
||||
*/
|
||||
static clear(): void;
|
||||
/**
|
||||
* Removes a single item from the NavigationData
|
||||
* @param The key of the item to remove
|
||||
*/
|
||||
static clear(key: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages all navigation. These can be forward using an action parameter;
|
||||
* backward via a Crumb; or refreshing the current State
|
||||
*/
|
||||
class StateController {
|
||||
/**
|
||||
* Gets a Crumb collection representing the crumb trail, ordered oldest
|
||||
* Crumb first
|
||||
*/
|
||||
static crumbs: Crumb[];
|
||||
/**
|
||||
* Sets the Context Data with the data returned from the current
|
||||
* State's IStateHandler
|
||||
* @param state The current State
|
||||
* @param url The current Url
|
||||
*/
|
||||
static setStateContext(state: State, url: string): void;
|
||||
/**
|
||||
* Registers a navigate event listener
|
||||
* @param handler The navigate event listener
|
||||
*/
|
||||
static onNavigate(handler: (oldState: State, state: State, data: any) => void): void;
|
||||
/**
|
||||
* Unregisters a navigate event listener
|
||||
* @param handler The navigate event listener
|
||||
*/
|
||||
static offNavigate(handler: (oldState: State, state: State, data: any) => void): void;
|
||||
/**
|
||||
* Navigates to a State. Depending on the action will either navigate
|
||||
* to the 'to' State of a Transition or the 'initial' State of a
|
||||
* Dialog. It passes no NavigationData
|
||||
* @param action The key of a child Transition or the key of a Dialog
|
||||
* @throws action does not match the key of a child Transition or the
|
||||
* key of a Dialog; or there is NavigationData that cannot be converted
|
||||
* to a String
|
||||
* @throws A mandatory route parameter has not been supplied a value
|
||||
*/
|
||||
static navigate(action: string): void;
|
||||
/**
|
||||
* Navigates to a State. Depending on the action will either navigate
|
||||
* to the 'to' State of a Transition or the 'initial' State of a
|
||||
* Dialog
|
||||
* @param action The key of a child Transition or the key of a Dialog
|
||||
* @param toData The NavigationData to be passed to the next State and
|
||||
* stored in the StateContext
|
||||
* @throws action does not match the key of a child Transition or the
|
||||
* key of a Dialog; or there is NavigationData that cannot be converted
|
||||
* to a String
|
||||
* @throws A mandatory route parameter has not been supplied a value
|
||||
*/
|
||||
static navigate(action: string, toData: any): void;
|
||||
/**
|
||||
* Gets a Url to navigate to a State. Depending on the action will
|
||||
* either navigate to the 'to' State of a Transition or the 'initial'
|
||||
* State of a Dialog. It passes no NavigationData
|
||||
* @param action The key of a child Transition or the key of a Dialog
|
||||
* @returns Url that will navigate to State specified in the action
|
||||
* @throws action does not match the key of a child Transition or the
|
||||
* key of a Dialog; or there is NavigationData that cannot be converted
|
||||
* to a String
|
||||
*/
|
||||
static getNavigationLink(action: string): string;
|
||||
/**
|
||||
* Gets a Url to navigate to a State. Depending on the action will
|
||||
* either navigate to the 'to' State of a Transition or the 'initial'
|
||||
* State of a Dialog
|
||||
* @param action The key of a child Transition or the key of a Dialog
|
||||
* @param toData The NavigationData to be passed to the next State and
|
||||
* stored in the StateContext
|
||||
* @returns Url that will navigate to State specified in the action
|
||||
* @throws action does not match the key of a child Transition or the
|
||||
* key of a Dialog; or there is NavigationData that cannot be converted
|
||||
* to a String
|
||||
*/
|
||||
static getNavigationLink(action: string, toData: any): string;
|
||||
/**
|
||||
* Determines if the distance specified is within the bounds of the
|
||||
* crumb trail represented by the Crumbs collection
|
||||
*/
|
||||
static canNavigateBack(distance: number): boolean;
|
||||
/**
|
||||
* Navigates back to the Crumb contained in the crumb trail,
|
||||
* represented by the Crumbs collection, as specified by the distance.
|
||||
* In the crumb trail no two crumbs can have the same State but all
|
||||
* must have the same Dialog
|
||||
* @param distance Starting at 1, the number of Crumb steps to go back
|
||||
* @throws canNavigateBack returns false for this distance
|
||||
* @throws A mandatory route parameter has not been supplied a value
|
||||
*/
|
||||
static navigateBack(distance: number): void;
|
||||
/**
|
||||
* Gets a Url to navigate to a Crumb contained in the crumb trail,
|
||||
* represented by the Crumbs collection, as specified by the distance.
|
||||
* In the crumb trail no two crumbs can have the same State but all
|
||||
* must have the same Dialog
|
||||
* @param distance Starting at 1, the number of Crumb steps to go back
|
||||
* @throws canNavigateBack returns false for this distance
|
||||
*/
|
||||
static getNavigationBackLink(distance: number): string;
|
||||
/**
|
||||
* Navigates to the current State passing no NavigationData
|
||||
* @throws A mandatory route parameter has not been supplied a value
|
||||
*/
|
||||
static refresh(): void;
|
||||
/**
|
||||
* Navigates to the current State
|
||||
* @param toData The NavigationData to be passed to the current State
|
||||
* and stored in the StateContext
|
||||
* @throws There is NavigationData that cannot be converted to a String
|
||||
* @throws A mandatory route parameter has not been supplied a value
|
||||
*/
|
||||
static refresh(toData: any): void;
|
||||
/**
|
||||
* Gets a Url to navigate to the current State passing no
|
||||
* NavigationData
|
||||
*/
|
||||
static getRefreshLink(): string;
|
||||
/**
|
||||
* Gets a Url to navigate to the current State
|
||||
* @param toData The NavigationData to be passed to the current State
|
||||
* and stored in the StateContext
|
||||
* @returns Url that will navigate to the current State
|
||||
* @throws There is NavigationData that cannot be converted to a String
|
||||
*/
|
||||
static getRefreshLink(toData: any): string;
|
||||
/**
|
||||
* Navigates to the url
|
||||
* @param url The target location
|
||||
*/
|
||||
static navigateLink(url: string): void;
|
||||
/**
|
||||
* Gets the next State. Depending on the action will either return the
|
||||
* 'to' State of a Transition or the 'initial' State of a Dialog
|
||||
* @param action The key of a child Transition or the key of a Dialog
|
||||
* @throws action does not match the key of a child Transition or the
|
||||
* key of a Dialog
|
||||
*/
|
||||
static getNextState(action: string): State;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of IStateHandler that builds and parses navigation links
|
||||
*/
|
||||
class StateHandler implements IStateHandler {
|
||||
/**
|
||||
* Gets a link that navigates to the state passing the data
|
||||
* @param state The State to navigate to
|
||||
* @param data The data to pass when navigating
|
||||
* @returns The navigation link
|
||||
*/
|
||||
getNavigationLink(state: State, data: any): string;
|
||||
/**
|
||||
* Navigates to the url
|
||||
* @param oldState The current State
|
||||
* @param state The State to navigate to
|
||||
* @param url The target location
|
||||
*/
|
||||
navigateLink(oldState: State, state: State, url: string): void;
|
||||
/**
|
||||
* Gets the data parsed from the url
|
||||
* @param state The State navigated to
|
||||
* @param url The current url
|
||||
* @returns The navigation data
|
||||
*/
|
||||
getNavigationData(state: State, url: string): any;
|
||||
/**
|
||||
* Truncates the crumb trail whenever a repeated or initial State is
|
||||
* encountered
|
||||
* @param The State navigated to
|
||||
* @param The Crumb collection representing the crumb trail
|
||||
* @returns Truncated crumb trail
|
||||
*/
|
||||
truncateCrumbTrail(state: State, crumbs: Crumb[]): Crumb[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a contract a class must implement in order build and parse
|
||||
* State routes
|
||||
*/
|
||||
interface IRouter {
|
||||
/**
|
||||
* Gets the matching State and data for the route
|
||||
* @param route The route to match
|
||||
* @returns The matched State and data
|
||||
*/
|
||||
getData(route: string): { state: State; data: any; };
|
||||
/**
|
||||
* Gets the matching route and data for the state and data
|
||||
* @param The state to match
|
||||
* @param The data to match
|
||||
* @returns The matched route and data
|
||||
*/
|
||||
getRoute(state: State, data: any): { route: string; data: any; };
|
||||
/**
|
||||
* Gets or sets a value indicating whether the route matching supports
|
||||
* default parameter values
|
||||
*/
|
||||
supportsDefaults: boolean;
|
||||
/**
|
||||
* Registers all route configuration information
|
||||
* @param dialogs Collection of Dialogs with their child State route
|
||||
* information
|
||||
*/
|
||||
addRoutes(dialogs: Dialog[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of IRouter that builds and parses State routes using the
|
||||
* Navigation Router
|
||||
*/
|
||||
class StateRouter implements IRouter {
|
||||
/**
|
||||
* Gets the underlying Navigation Router
|
||||
*/
|
||||
router: Router;
|
||||
/**
|
||||
* Gets true, indicating the underlying Navigation Router supports
|
||||
* defaults
|
||||
*/
|
||||
supportsDefaults: boolean;
|
||||
/**
|
||||
* Gets the matching State and data for the route
|
||||
* @param route The route to match
|
||||
* @returns The matched State and data
|
||||
*/
|
||||
getData(route: string): { state: State; data: any; };
|
||||
/**
|
||||
* Gets the matching route and data for the state and data
|
||||
* @param The state to match
|
||||
* @param The data to match
|
||||
* @returns The matched route and data
|
||||
*/
|
||||
getRoute(state: State, data: any): { route: string; data: any; };
|
||||
/**
|
||||
* Registers all route configuration information with the underlying
|
||||
* Navigation Router
|
||||
* @param dialogs Collection of Dialogs with their child State route
|
||||
* information
|
||||
*/
|
||||
addRoutes(dialogs: Dialog[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds information about a route
|
||||
*/
|
||||
class Route {
|
||||
/**
|
||||
* Gets the path pattern of a route
|
||||
*/
|
||||
path: string;
|
||||
/**
|
||||
* Gets the default parameter values
|
||||
*/
|
||||
defaults: any;
|
||||
/**
|
||||
* Gets the list of parameters
|
||||
*/
|
||||
params: { name: string; optional: boolean; }[];
|
||||
/**
|
||||
* Initializes a new instance of the Route class
|
||||
* @param path The route pattern
|
||||
*/
|
||||
constructor(path: string);
|
||||
/**
|
||||
* Initializes a new instance of the Route class
|
||||
* @param path The route pattern
|
||||
* @param defaults The default parameter values
|
||||
*/
|
||||
constructor(path: string, defaults: any);
|
||||
/**
|
||||
* Gets the matching data for the path
|
||||
* @param path The path to match
|
||||
* @returns The matched data or null if there's no match
|
||||
*/
|
||||
match(path: string): any;
|
||||
/**
|
||||
* Gets the route populated with default values
|
||||
* @returns The built route
|
||||
*/
|
||||
build(): string;
|
||||
/**
|
||||
* Gets the route populated with data and default values
|
||||
* @param The data for the route parameters
|
||||
* @returns The built route
|
||||
*/
|
||||
build(data: any): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default Navigation router implementation
|
||||
*/
|
||||
class Router {
|
||||
/**
|
||||
* Registers a route
|
||||
* @param path The route path
|
||||
* @returns The parsed Route
|
||||
*/
|
||||
addRoute(path: string): Route;
|
||||
/**
|
||||
* Registers a route with default parameters
|
||||
* @param path The route path
|
||||
* @param defaults The route parameter defaults
|
||||
* @returns The parsed Route
|
||||
*/
|
||||
addRoute(path: string, defaults: any): Route;
|
||||
/**
|
||||
* Gets the matching route and data for the path
|
||||
* @param route The path to match
|
||||
* @returns The matched route and data
|
||||
*/
|
||||
match(path: string): { route: Route; data: any; };
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Navigation settings
|
||||
*/
|
||||
export var settings: NavigationSettings;
|
||||
|
||||
/**
|
||||
* Initializes the history manager and navigates to the current location.
|
||||
* If used outside of a browser environment, pass in the Url to navigate to
|
||||
* @param url If used outside of a browser, the url to navigate to
|
||||
*/
|
||||
export var start: (url?: string) => void;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/// <reference path="node-sass.d.ts" />
|
||||
import sass = require('node-sass');
|
||||
sass.render({
|
||||
file: '/path/to/myFile.scss',
|
||||
data: 'body{background:blue; a{color:black;}}',
|
||||
importer: function(url, prev, done) {
|
||||
// url is the path in import as is, which libsass encountered.
|
||||
// prev is the previously resolved path.
|
||||
// done is an optional callback, either consume it or return value synchronously.
|
||||
// this.options contains this options hash, this.callback contains the node-style callback
|
||||
someAsyncFunction(url, prev, function(result) {
|
||||
done({
|
||||
file: result.path, // only one of them is required, see section Sepcial Behaviours.
|
||||
contents: result.data
|
||||
});
|
||||
});
|
||||
// OR
|
||||
var result = someSyncFunction(url, prev);
|
||||
return { file: result.path, contents: result.data };
|
||||
},
|
||||
includePaths: ['lib/', 'mod/'],
|
||||
outputStyle: 'compressed'
|
||||
}, function(error, result) { // node-style callback from v3.0.0 onwards
|
||||
if (error) {
|
||||
console.log(error.status); // used to be "code" in v2x and below
|
||||
console.log(error.column);
|
||||
console.log(error.message);
|
||||
console.log(error.line);
|
||||
}
|
||||
else {
|
||||
console.log(result.css.toString());
|
||||
|
||||
console.log(result.stats);
|
||||
|
||||
console.log(result.map.toString());
|
||||
// or better
|
||||
console.log(JSON.stringify(result.map)); // note, JSON.stringify accepts Buffer too
|
||||
}
|
||||
});
|
||||
// OR
|
||||
var result = sass.renderSync({
|
||||
file: '/path/to/file.scss',
|
||||
data: 'body{background:blue; a{color:black;}}',
|
||||
outputStyle: 'compressed',
|
||||
outFile: '/to/my/output.css',
|
||||
sourceMap: true, // or an absolute or relative (to outFile) path
|
||||
importer: function(url, prev, done) {
|
||||
// url is the path in import as is, which libsass encountered.
|
||||
// prev is the previously resolved path.
|
||||
// done is an optional callback, either consume it or return value synchronously.
|
||||
// this.options contains this options hash
|
||||
someAsyncFunction(url, prev, function(result) {
|
||||
done({
|
||||
file: result.path, // only one of them is required, see section Sepcial Behaviours.
|
||||
contents: result.data
|
||||
});
|
||||
});
|
||||
// OR
|
||||
var result = someSyncFunction(url, prev);
|
||||
return { file: result.path, contents: result.data };
|
||||
},
|
||||
});
|
||||
|
||||
console.log(result.css);
|
||||
console.log(result.map);
|
||||
console.log(result.stats);
|
||||
|
||||
function someAsyncFunction(url: string, prev: string, callback: (result: { path: string; data: string }) => void): void {}
|
||||
function someSyncFunction(url: string, prev: string): { path: string; data: string} {
|
||||
return null;
|
||||
}
|
||||
Vendored
+56
@@ -0,0 +1,56 @@
|
||||
// Type definitions for Node Sass
|
||||
// Project: https://github.com/sass/node-sass
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "node-sass" {
|
||||
interface Importer {
|
||||
(url: string, prev: string, done: (data: { file: string; contents: string; }) => void): void;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
file?: string;
|
||||
data?: string;
|
||||
importer?: Importer | Importer[];
|
||||
functions?: { [key: string]: Function };
|
||||
includePaths?: string[];
|
||||
indentedSyntax?: boolean;
|
||||
indentType?: string;
|
||||
indentWidth?: number;
|
||||
linefeed?: string;
|
||||
omitSourceMapUrl?: boolean;
|
||||
outFile?: string;
|
||||
outputStyle?: string;
|
||||
precision?: number;
|
||||
sourceComments?: boolean;
|
||||
sourceMap?: boolean | string;
|
||||
sourceMapContents?: boolean;
|
||||
sourceMapEmbed?: boolean;
|
||||
sourceMapRoot?: boolean;
|
||||
}
|
||||
|
||||
interface SassError extends Error {
|
||||
message: string;
|
||||
line: number;
|
||||
column: number;
|
||||
status: number;
|
||||
file: string;
|
||||
}
|
||||
|
||||
interface Result {
|
||||
css: Buffer;
|
||||
map: Buffer;
|
||||
stats: {
|
||||
entry: string;
|
||||
start: number;
|
||||
end: number;
|
||||
duration: number;
|
||||
includedFiles: string[];
|
||||
}
|
||||
}
|
||||
|
||||
export function render(options: Options, callback: (err: SassError, result: Result) => any): void;
|
||||
export function renderSync(options: Options): Result;
|
||||
}
|
||||
@@ -19,7 +19,7 @@ function test3() {
|
||||
var sock = zmq.socket('push');
|
||||
sock.bindSync('tcp://127.0.0.1:3000');
|
||||
sock.send(['hello', 'world']);
|
||||
sock.on('message', function (buffer: Buffer) {
|
||||
sock.on('message', function (buffer1: Buffer, buffer2: Buffer) {
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -182,7 +182,7 @@ declare module 'zmq' {
|
||||
* @param eventName {string}
|
||||
* @param callback {Function}
|
||||
*/
|
||||
on(eventName: string, callback: (buffer: Buffer) => void): void;
|
||||
on(eventName: string, callback: (...buffer: Buffer[]) => void): void;
|
||||
|
||||
// Socket Options
|
||||
_fd: any;
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/// <reference path="papaparse.d.ts" />
|
||||
|
||||
import Papa = require("papaparse");
|
||||
|
||||
/**
|
||||
* Parsing
|
||||
*/
|
||||
var res = Papa.parse("3,3,3");
|
||||
|
||||
res.errors[0].code;
|
||||
|
||||
Papa.parse("3,3,3", {
|
||||
delimiter: ';',
|
||||
comments: false,
|
||||
|
||||
step: function(results, p) {
|
||||
p.abort();
|
||||
results.data.length;
|
||||
}
|
||||
});
|
||||
|
||||
var file = new File();
|
||||
|
||||
Papa.parse(file, {
|
||||
complete: function(a, b) {
|
||||
a.meta.fields;
|
||||
b.name;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Unparsing
|
||||
*/
|
||||
Papa.unparse([{a: 1, b: 1, c: 1}]);
|
||||
Papa.unparse([[1, 2, 3], [4, 5, 6]]);
|
||||
Papa.unparse({
|
||||
fields: ["3"],
|
||||
data: []
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Properties
|
||||
*/
|
||||
Papa.SCRIPT_PATH;
|
||||
Papa.LocalChunkSize;
|
||||
|
||||
/**
|
||||
* Parser
|
||||
*/
|
||||
var parser = new Papa.Parser({})
|
||||
parser.getCharIndex();
|
||||
parser.abort();
|
||||
parser.parse("", 0, false);
|
||||
Vendored
+144
@@ -0,0 +1,144 @@
|
||||
// Type definitions for PapaParse v4.1
|
||||
// Project: https://github.com/mholt/PapaParse
|
||||
// Definitions by: Pedro Flemming <https://github.com/torpedro>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module PapaParse {
|
||||
interface Static {
|
||||
/**
|
||||
* Parse a csv string or a csv file
|
||||
*/
|
||||
parse(csvString: string, config?: ParseConfig): ParseResult;
|
||||
|
||||
parse(file: File, config?: ParseConfig): ParseResult;
|
||||
|
||||
/**
|
||||
* Unparses javascript data objects and returns a csv string
|
||||
*/
|
||||
unparse(data: Array<Object>, config?: UnparseConfig): string;
|
||||
|
||||
unparse(data: Array<Array<any>>, config?: UnparseConfig): string;
|
||||
|
||||
unparse(data: UnparseObject, config?: UnparseConfig): string;
|
||||
|
||||
/**
|
||||
* Read-Only Properties
|
||||
*/
|
||||
// An array of characters that are not allowed as delimiters.
|
||||
BAD_DELIMETERS: Array<string>;
|
||||
|
||||
// The true delimiter. Invisible. ASCII code 30. Should be doing the job we strangely rely upon commas and tabs for.
|
||||
RECORD_SEP: string;
|
||||
|
||||
// Also sometimes used as a delimiting character. ASCII code 31.
|
||||
UNIT_SEP: string;
|
||||
|
||||
// Whether or not the browser supports HTML5 Web Workers. If false, worker: true will have no effect.
|
||||
WORKERS_SUPPORTED: boolean;
|
||||
|
||||
// The relative path to Papa Parse. This is automatically detected when Papa Parse is loaded synchronously.
|
||||
SCRIPT_PATH: string;
|
||||
|
||||
/**
|
||||
* Configurable Properties
|
||||
*/
|
||||
// The size in bytes of each file chunk. Used when streaming files obtained from the DOM that exist on the local computer. Default 10 MB.
|
||||
LocalChunkSize: string;
|
||||
|
||||
// Same as LocalChunkSize, but for downloading files from remote locations. Default 5 MB.
|
||||
RemoteChunkSize: string;
|
||||
|
||||
// The delimiter used when it is left unspecified and cannot be detected automatically. Default is comma.
|
||||
DefaultDelimiter: string;
|
||||
|
||||
/**
|
||||
* On Papa there are actually more classes exposed
|
||||
* but none of them are officially documented
|
||||
* Since we can interact with the Parser from one of the callbacks
|
||||
* I have included the API for this class.
|
||||
*/
|
||||
Parser: ParserConstructor;
|
||||
}
|
||||
|
||||
interface ParseConfig {
|
||||
delimiter?: string; // default: ""
|
||||
newline?: string; // default: ""
|
||||
header?: boolean; // default: false
|
||||
dynamicTyping?: boolean; // default: false
|
||||
preview?: number; // default: 0
|
||||
encoding?: string; // default: ""
|
||||
worker?: boolean; // default: false
|
||||
comments?: boolean; // default: false
|
||||
download?: boolean; // default: false
|
||||
skipEmptyLines?: boolean; // default: false
|
||||
fastMode?: boolean; // default: undefined
|
||||
|
||||
// Callbacks
|
||||
step?(results: ParseResult, parser: Parser): void; // default: undefined
|
||||
complete?(results: ParseResult, file?: File): void; // default: undefined
|
||||
error?(error: ParseError, file?: File): void; // default: undefined
|
||||
chunk?(results: ParseResult, parser: Parser): void; // default: undefined
|
||||
beforeFirstChunk?(chunk: string): string|void; // default: undefined
|
||||
}
|
||||
|
||||
interface UnparseConfig {
|
||||
quotes: boolean; // default: false
|
||||
delimiter: string; // default: ","
|
||||
newline: string; // default: "\r\n"
|
||||
}
|
||||
|
||||
interface UnparseObject {
|
||||
fields: Array<any>;
|
||||
data: string | Array<any>;
|
||||
}
|
||||
|
||||
interface ParseError {
|
||||
type: string; // A generalization of the error
|
||||
code: string; // Standardized error code
|
||||
message: string; // Human-readable details
|
||||
row: number; // Row index of parsed data where error is
|
||||
}
|
||||
|
||||
interface ParseMeta {
|
||||
delimiter: string; // Delimiter used
|
||||
linebreak: string; // Line break sequence used
|
||||
aborted: boolean; // Whether process was aborted
|
||||
fields: Array<string>; // Array of field names
|
||||
truncated: boolean; // Whether preview consumed all input
|
||||
}
|
||||
|
||||
/**
|
||||
* @interface ParseResult
|
||||
*
|
||||
* data: is an array of rows. If header is false, rows are arrays; otherwise they are objects of data keyed by the field name.
|
||||
* errors: is an array of errors
|
||||
* meta: contains extra information about the parse, such as delimiter used, the newline sequence, whether the process was aborted, etc. Properties in this object are not guaranteed to exist in all situations
|
||||
*/
|
||||
interface ParseResult {
|
||||
data: Array<any>;
|
||||
errors: Array<ParseError>;
|
||||
meta: ParseMeta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parser
|
||||
*/
|
||||
interface ParserConstructor { new(config: ParseConfig): Parser; }
|
||||
interface Parser {
|
||||
// Parses the input
|
||||
parse(input: string, baseIndex: number, ignoreLastRow: boolean): any;
|
||||
|
||||
// Sets the abort flag
|
||||
abort(): void;
|
||||
|
||||
// Gets the cursor position
|
||||
getCharIndex(): number;
|
||||
}
|
||||
}
|
||||
|
||||
declare var Papa: PapaParse.Static;
|
||||
|
||||
declare module "papaparse" {
|
||||
var Papa: PapaParse.Static;
|
||||
export = Papa;
|
||||
}
|
||||
Vendored
+1
-1
@@ -173,7 +173,7 @@ interface ResourceResponse {
|
||||
interface ResourceRequest {
|
||||
id: number;
|
||||
method: string;
|
||||
ur: string;
|
||||
url: string;
|
||||
time: Date;
|
||||
headers: { [name: string]: string; };
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="piwik-tracker.d.ts" />
|
||||
|
||||
// Example code taken from https://www.npmjs.com/package/piwik-tracker
|
||||
|
||||
var PiwikTracker = require('piwik-tracker');
|
||||
|
||||
// Initialize with your site ID and Piwik URL
|
||||
var piwik = new PiwikTracker(1, 'http://mywebsite.com/piwik.php');
|
||||
|
||||
// Optional: Respond to tracking errors
|
||||
piwik.on('error', function(err : Error) {
|
||||
console.log('error tracking request: ', err)
|
||||
})
|
||||
|
||||
// Track a request URL:
|
||||
// Either as a simple string …
|
||||
piwik.track('http://example.com/track/this/url');
|
||||
|
||||
// … or provide further options:
|
||||
piwik.track({
|
||||
url: 'http://example.com/track/this/url',
|
||||
action_name: 'This will be shown in your dashboard',
|
||||
ua: 'Node.js v0.10.24',
|
||||
cvar: JSON.stringify({
|
||||
'1': ['custom variable name', 'custom variable value']
|
||||
})
|
||||
});
|
||||
Vendored
+95
@@ -0,0 +1,95 @@
|
||||
// Type definitions for PiwikTracker v0.1.1
|
||||
// Project: https://www.npmjs.com/package/piwik-tracker
|
||||
// Definitions by: Guilherme Bernal <https://github.com/lbguilherme>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "piwik-tracker" {
|
||||
|
||||
import events = require('events');
|
||||
|
||||
export = PiwikTracker;
|
||||
|
||||
// refer to http://developer.piwik.org/api-reference/tracking-api
|
||||
interface PiwikTrackOptions {
|
||||
// Required parameters
|
||||
url : string;
|
||||
|
||||
// Recommended parameters
|
||||
action_name? : string;
|
||||
_id? : string;
|
||||
rand? : string;
|
||||
apiv? : number;
|
||||
|
||||
// Optional User info
|
||||
urlref? : string;
|
||||
_cvar? : string;
|
||||
_idvc? : string;
|
||||
_viewts? : string;
|
||||
_idts? : string;
|
||||
_rcn? : string;
|
||||
_rck? : string;
|
||||
res? : string;
|
||||
h? : number;
|
||||
m? : number;
|
||||
s? : number;
|
||||
ua? : string;
|
||||
lang? : string;
|
||||
uid? : string;
|
||||
cid? : string;
|
||||
new_visit? : number;
|
||||
|
||||
// Optional Action info
|
||||
cvar? : string;
|
||||
link? : string;
|
||||
download? : string;
|
||||
search? : string;
|
||||
search_cat? : string;
|
||||
search_count? : number;
|
||||
idgoal? : number;
|
||||
revenue? : number;
|
||||
gt_ms? : number;
|
||||
cs? : string;
|
||||
|
||||
// Optional Event Tracking info
|
||||
e_c? : string;
|
||||
e_a? : string;
|
||||
e_n? : string;
|
||||
e_v? : string;
|
||||
|
||||
// Optional Content Tracking info
|
||||
c_n? : string;
|
||||
c_p? : string;
|
||||
c_t? : string;
|
||||
c_i? : string;
|
||||
|
||||
// Optional Ecommerce info
|
||||
ec_id? : string;
|
||||
ec_items? : string;
|
||||
ec_st? : number;
|
||||
ec_tx? : number;
|
||||
ec_sh? : number;
|
||||
ec_dt? : number;
|
||||
_ects? : number;
|
||||
|
||||
// Other parameters (require authentication via token_auth)
|
||||
token_auth? : string;
|
||||
cip? : string;
|
||||
cdt? : string;
|
||||
country? : string;
|
||||
region? : string;
|
||||
city? : string;
|
||||
lat? : string;
|
||||
long? : string;
|
||||
|
||||
// Other parameters
|
||||
send_image? : number;
|
||||
}
|
||||
|
||||
class PiwikTracker extends events.EventEmitter {
|
||||
constructor(siteId : number, trackerUrl : string);
|
||||
track(options : PiwikTrackOptions) : void;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path="pty.js.d.ts" />
|
||||
|
||||
import pty = require('pty.js');
|
||||
|
||||
var term: pty.Terminal = pty.spawn('bash', [], {
|
||||
name: 'xterm-color',
|
||||
cols: 80,
|
||||
rows: 30,
|
||||
cwd: process.env.HOME,
|
||||
env: process.env
|
||||
});
|
||||
|
||||
term.on('data', function(data: any) {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
term.write('ls\r');
|
||||
term.resize(100, 40);
|
||||
term.write('ls /\r');
|
||||
|
||||
console.log(term.process);
|
||||
Vendored
+133
@@ -0,0 +1,133 @@
|
||||
// Type definitions for pty.js 0.2.7-1
|
||||
// Project: https://github.com/chjj/pty.js
|
||||
// Definitions by: Vadim Macagon <https://github.com/enlight/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'pty.js' {
|
||||
/** Options that can be used when creating a new pseudo-terminal. */
|
||||
interface TerminalOptions {
|
||||
name?: string;
|
||||
cols?: number;
|
||||
rows?: number;
|
||||
cwd?: string;
|
||||
env?: any;
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
}
|
||||
|
||||
import stream = require('stream');
|
||||
import net = require('net');
|
||||
|
||||
export class Terminal implements stream.Stream {
|
||||
/** Read-only name of the terminal. */
|
||||
name: string;
|
||||
/** Read-only number of columns in the terminal. */
|
||||
cols: number;
|
||||
/** Read-only number of rows in the terminal. */
|
||||
rows: number;
|
||||
/**
|
||||
* Read-only identifier of the spawned process associated with the slave end of the
|
||||
* pseudo-terminal. This will be null if the terminal was created via [[Terminal.open]].
|
||||
*/
|
||||
pid: number;
|
||||
/** Read-only file descriptor of the master end of the pseudo-terminal. */
|
||||
fd: number;
|
||||
/** Read-only name of the slave end of the pseudo-terminal. */
|
||||
pty: string;
|
||||
/** Read-only filename of the executable associated with the slave end of the pseudo-terminal. */
|
||||
file: string;
|
||||
/** Read-only name of the process associated with the slave end of the pseudo-terminal. */
|
||||
process: string;
|
||||
stdout: Terminal;
|
||||
/** Note that an exception will be thrown if an attempt is made to access this property. */
|
||||
stderr: Terminal;
|
||||
stdin: Terminal;
|
||||
socket: net.Socket;
|
||||
|
||||
/**
|
||||
* Creates a new pseudo-terminal, spawns a child process, and associates it with the slave
|
||||
* end of the pseudo-terminal.
|
||||
*/
|
||||
constructor(file?: string, args?: string[], opt?: TerminalOptions);
|
||||
|
||||
resize(cols?: number, rows?: number): void;
|
||||
/**
|
||||
* Sends a signal to the spawned process associated with the slave end of the
|
||||
* pseudo-terminal (this only works if [[pid]] is not null).
|
||||
*/
|
||||
kill(signal?: string): void;
|
||||
redraw(): void;
|
||||
|
||||
// NodeJS Socket-like interface (wrappers for this.socket)
|
||||
|
||||
write(data: any): boolean;
|
||||
end(data: any): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
setEncoding(encoding: string): void;
|
||||
/**
|
||||
* Closes the master end of the pseudo-terminal, and attempts to kill the spawned process
|
||||
* associated with the slave end of the pseudo-terminal (but only if [[pid]] is not null).
|
||||
*/
|
||||
destroy(): void;
|
||||
|
||||
// NodeJS Stream interface
|
||||
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
|
||||
// NodeJS EventEmitter interface
|
||||
|
||||
addListener(event: string, listener: Function): NodeJS.EventEmitter;
|
||||
on(event: string, listener: Function): NodeJS.EventEmitter;
|
||||
once(event: string, listener: Function): NodeJS.EventEmitter;
|
||||
removeListener(event: string, listener: Function): NodeJS.EventEmitter;
|
||||
removeAllListeners(event?: string): NodeJS.EventEmitter;
|
||||
// NOTE: this method is not actually defined in pty.js
|
||||
setMaxListeners(n: number): void;
|
||||
listeners(event: string): Function[];
|
||||
emit(event: string, ...args: any[]): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new pseudo-terminal, spawns a child process, and associates it with the slave
|
||||
* end of the pseudo-terminal.
|
||||
*/
|
||||
export function createTerminal(file?: string, args?: string[], opt?: TerminalOptions): Terminal;
|
||||
/** Alias for [[createTerminal]]. */
|
||||
export function fork(file?: string, args?: string[], opt?: TerminalOptions): Terminal;
|
||||
/** Alias for [[createTerminal]]. */
|
||||
export function spawn(file?: string, args?: string[], opt?: TerminalOptions): Terminal;
|
||||
/**
|
||||
* Creates a new pseudo-terminal.
|
||||
* This function is not available on Windows, use [[fork]] there instead.
|
||||
*/
|
||||
export function open(opt?: { cols?: number; rows?: number }): Terminal;
|
||||
|
||||
// Internal stuff that probably isn't very useful but is exported by pty.js
|
||||
export module native {
|
||||
/** Unix-only. */
|
||||
export function fork(
|
||||
file: string, args: string[], env: any, cwd: string, cols: number, rows: number,
|
||||
uid?: number, gid?: number
|
||||
): { fd: number; pid: number; pty: string };
|
||||
/** Unix-only. */
|
||||
export function open(
|
||||
cols: number, rows: number
|
||||
): { master: number; slave: number; pty: string };
|
||||
/** Unix-only. */
|
||||
export function process(fd: number, tty: string): string;
|
||||
/** Windows-only. */
|
||||
export function open(
|
||||
dataPipe: string, cols: number, rows: number, debug: boolean
|
||||
): { pid: number; pty: number; fd: number };
|
||||
/** Windows-only. */
|
||||
export function startProcess(
|
||||
pid: number, file: string, cmdline: string, env: string[], cwd: string
|
||||
): void;
|
||||
/** Windows-only. */
|
||||
export function kill(pid: number): void;
|
||||
export function resize(fd: number, cols: number, rows: number): void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/// <reference path="raygun4js.d.ts"/>
|
||||
|
||||
var client: raygun.RaygunStatic = Raygun.noConflict();
|
||||
|
||||
var newClient: raygun.RaygunStatic = client.constructNewRaygun();
|
||||
|
||||
client.init('api-key');
|
||||
client.init('api-key', { allowInsecureSubmissions: true });
|
||||
client.init('api-key', { allowInsecureSubmissions: true }, { some: 'data' });
|
||||
|
||||
client.withCustomData({ some: 'data' });
|
||||
|
||||
client.withTags(['tag1', 'tag2']);
|
||||
|
||||
client.attach().detach();
|
||||
|
||||
client.send(new Error('a error'));
|
||||
client.send(new Error('a error'), ['tag1', 'tag2']);
|
||||
|
||||
try {
|
||||
throw new Error('oops');
|
||||
}
|
||||
catch (e) {
|
||||
client.send(e);
|
||||
}
|
||||
|
||||
client.setUser('username');
|
||||
client.setUser('username', true);
|
||||
client.setUser('username', false, 'user@email.com', 'Robbie Robot');
|
||||
client.setUser('username', false, 'user@email.com', 'Robbie Robot', 'Robbie');
|
||||
client.setUser('username', false, 'user@email.com', 'Robbie Robot', 'Robbie', '8ae89fc9-1144-42d6-9629-bf085dab18d2');
|
||||
|
||||
client.resetAnonymousUser();
|
||||
|
||||
client.setVersion('1.2.3.4');
|
||||
|
||||
client.saveIfOffline(true);
|
||||
|
||||
client.filterSensitiveData(['field1', 'field2']);
|
||||
|
||||
client.setFilterScope('all');
|
||||
|
||||
client.whitelistCrossOriginDomains(['domain1', 'domain2']);
|
||||
|
||||
client.onBeforeSend(payload=> {
|
||||
payload.OccurredOn = new Date();
|
||||
return payload;
|
||||
});
|
||||
Vendored
+97
@@ -0,0 +1,97 @@
|
||||
// Type definitions for raygun4js 1.18.3
|
||||
// Project: https://github.com/MindscapeHQ/raygun4js
|
||||
// Definitions by: Brian Surowiec <https://github.com/xt0rted>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module raygun {
|
||||
|
||||
// https://github.com/MindscapeHQ/raygun4js/blob/c7d8880045214ab6d403d5cc613c207f696a3cdd/src/raygun.js#L533-539
|
||||
interface IStackTrace {
|
||||
LineNumber: number;
|
||||
ColumnNumber: number;
|
||||
ClassName: string;
|
||||
FileName: string;
|
||||
MethodName: string;
|
||||
}
|
||||
|
||||
// https://github.com/MindscapeHQ/raygun4js/blob/c7d8880045214ab6d403d5cc613c207f696a3cdd/src/raygun.js#L598-637
|
||||
interface IPayload {
|
||||
OccurredOn: Date;
|
||||
Details: {
|
||||
Error: {
|
||||
ClassName: string;
|
||||
Message: string;
|
||||
StackTrace: IStackTrace[];
|
||||
};
|
||||
Environment: {
|
||||
UtcOffset: number;
|
||||
'User-Language': string;
|
||||
'Document-Mode': number;
|
||||
'Browser-Width': number;
|
||||
'Browser-Height': number;
|
||||
'Screen-Width': number;
|
||||
'Screen-Height': number;
|
||||
'Color-Depth': number;
|
||||
Browser: string;
|
||||
'Browser-Name': string;
|
||||
'Browser-Version': string;
|
||||
Platform: string;
|
||||
};
|
||||
Client: {
|
||||
Name: string;
|
||||
Version: string;
|
||||
};
|
||||
UserCustomData: any;
|
||||
Tags: string[];
|
||||
Request: {
|
||||
Url: string;
|
||||
QueryString: string;
|
||||
Headers: {
|
||||
'User-Agent': string;
|
||||
Referer: string;
|
||||
Host: string;
|
||||
};
|
||||
};
|
||||
Version: string;
|
||||
};
|
||||
}
|
||||
|
||||
// https://github.com/MindscapeHQ/raygun4js/blob/c7d8880045214ab6d403d5cc613c207f696a3cdd/src/raygun.js#L61-82
|
||||
interface IRaygunOptions {
|
||||
allowInsecureSubmissions?: boolean;
|
||||
ignoreAjaxAbort?: boolean;
|
||||
ignoreAjaxError?: boolean;
|
||||
disableAnonymousUserTracking?: boolean;
|
||||
excludedHostnames?: boolean;
|
||||
excludedUserAgents?: boolean;
|
||||
wrapAsynchronousCallbacks?: boolean;
|
||||
debugMode?: boolean;
|
||||
ignore3rdPartyErrors?: boolean;
|
||||
}
|
||||
|
||||
interface RaygunStatic {
|
||||
noConflict(): RaygunStatic;
|
||||
constructNewRaygun(): RaygunStatic;
|
||||
init(apiKey: string, options?: IRaygunOptions, customdata?: any): RaygunStatic;
|
||||
withCustomData(customdata: any): RaygunStatic;
|
||||
withTags(tags: string[]): RaygunStatic;
|
||||
attach(): RaygunStatic;
|
||||
detach(): RaygunStatic;
|
||||
send(e: Error, customData?: any, tags?: string[]): RaygunStatic;
|
||||
setUser(user: string, isAnonymous?: boolean, email?: string, fullName?: string, firstName?: string, uuid?: string): RaygunStatic;
|
||||
resetAnonymousUser(): void;
|
||||
setVersion(version: string): RaygunStatic;
|
||||
saveIfOffline(enableOffline: boolean): RaygunStatic;
|
||||
filterSensitiveData(filteredKeys: string[]): RaygunStatic;
|
||||
setFilterScope(scope: string): RaygunStatic;
|
||||
whitelistCrossOriginDomains(whitelist: string[]): RaygunStatic;
|
||||
onBeforeSend(callback: (payload: IPayload) => IPayload): RaygunStatic;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare var Raygun: raygun.RaygunStatic;
|
||||
|
||||
declare module 'Raygun' {
|
||||
export = Raygun;
|
||||
}
|
||||
+7
-6
@@ -1,10 +1,11 @@
|
||||
# React v0.13.0 Type Definitions
|
||||
# React v0.13.3 Type Definitions
|
||||
|
||||
This folder contains the following `.d.ts` files:
|
||||
* `react-0.13.0.d.ts` declares the external module `"react"`
|
||||
* `react-addons-0.13.0.d.ts` declares the external module `"react/addons"`
|
||||
* `react-global-0.13.0.d.ts` declares the internal module `React` in the global namespace
|
||||
* `react-addons-global-0.13.0.d.ts` extends the global `React` module with `addons`
|
||||
* `react.d.ts` declares the external module `"react"`
|
||||
* `react-addons.d.ts` declares the external module `"react/addons"`
|
||||
* `react-global.d.ts` declares the internal module `React` in the global namespace
|
||||
* `react-addons-global.d.ts` extends the global `React` module with `addons`
|
||||
|
||||
Interfaces are duplicated between these files; please take care to keep them in sync when making changes. See [#3615](https://github.com/borisyankov/DefinitelyTyped/pull/3615) for relevant discussion.
|
||||
Interfaces are duplicated between these files; please take care to keep them in sync when making changes.
|
||||
See [#3615](https://github.com/borisyankov/DefinitelyTyped/pull/3615) for relevant discussion.
|
||||
|
||||
|
||||
Vendored
+93
-82
@@ -9,33 +9,39 @@ declare module React {
|
||||
// React.addons
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export var addons: {
|
||||
CSSTransitionGroup: CSSTransitionGroup;
|
||||
LinkedStateMixin: LinkedStateMixin;
|
||||
PureRenderMixin: PureRenderMixin;
|
||||
TransitionGroup: TransitionGroup;
|
||||
export module addons {
|
||||
export var CSSTransitionGroup: CSSTransitionGroup;
|
||||
export var TransitionGroup: TransitionGroup;
|
||||
|
||||
batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
|
||||
batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
||||
batchedUpdates(callback: () => any): void;
|
||||
export var LinkedStateMixin: LinkedStateMixin;
|
||||
export var PureRenderMixin: PureRenderMixin;
|
||||
|
||||
export function batchedUpdates<A, B>(
|
||||
callback: (a: A, b: B) => any, a: A, b: B): void;
|
||||
export function batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
||||
export function batchedUpdates(callback: () => any): void;
|
||||
|
||||
// deprecated: use petehunt/react-classset or JedWatson/classnames
|
||||
classSet(cx: { [key: string]: boolean }): string;
|
||||
classSet(...classList: string[]): string;
|
||||
export function classSet(cx: { [key: string]: boolean }): string;
|
||||
export function classSet(...classList: string[]): string;
|
||||
|
||||
cloneWithProps<P>(element: DOMElement<P>, props: P): DOMElement<P>;
|
||||
cloneWithProps<P>(element: ClassicElement<P>, props: P): ClassicElement<P>;
|
||||
cloneWithProps<P>(element: ReactElement<P>, props: P): ReactElement<P>;
|
||||
export function cloneWithProps<P>(
|
||||
element: DOMElement<P>, props: P): DOMElement<P>;
|
||||
export function cloneWithProps<P>(
|
||||
element: ClassicElement<P>, props: P): ClassicElement<P>;
|
||||
export function cloneWithProps<P>(
|
||||
element: ReactElement<P>, props: P): ReactElement<P>;
|
||||
|
||||
createFragment(object: { [key: string]: ReactNode }): ReactFragment;
|
||||
export function createFragment(
|
||||
object: { [key: string]: ReactNode }): ReactFragment;
|
||||
|
||||
update(value: any[], spec: UpdateArraySpec): any[];
|
||||
update(value: {}, spec: UpdateSpec): any;
|
||||
export function update(value: any[], spec: UpdateArraySpec): any[];
|
||||
export function update(value: {}, spec: UpdateSpec): any;
|
||||
|
||||
// Development tools
|
||||
Perf: ReactPerf;
|
||||
TestUtils: ReactTestUtils;
|
||||
};
|
||||
export import Perf = ReactPerf;
|
||||
export import TestUtils = ReactTestUtils;
|
||||
}
|
||||
|
||||
//
|
||||
// React.addons (Transitions)
|
||||
@@ -114,14 +120,14 @@ declare module React {
|
||||
totalTime: number;
|
||||
}
|
||||
|
||||
interface ReactPerf {
|
||||
start(): void;
|
||||
stop(): void;
|
||||
printInclusive(measurements: Measurements[]): void;
|
||||
printExclusive(measurements: Measurements[]): void;
|
||||
printWasted(measurements: Measurements[]): void;
|
||||
printDOM(measurements: Measurements[]): void;
|
||||
getLastMeasurements(): Measurements[];
|
||||
module ReactPerf {
|
||||
export function start(): void;
|
||||
export function stop(): void;
|
||||
export function printInclusive(measurements: Measurements[]): void;
|
||||
export function printExclusive(measurements: Measurements[]): void;
|
||||
export function printWasted(measurements: Measurements[]): void;
|
||||
export function printDOM(measurements: Measurements[]): void;
|
||||
export function getLastMeasurements(): Measurements[];
|
||||
}
|
||||
|
||||
//
|
||||
@@ -132,55 +138,59 @@ declare module React {
|
||||
new(): any;
|
||||
}
|
||||
|
||||
interface ReactTestUtils {
|
||||
Simulate: Simulate;
|
||||
module ReactTestUtils {
|
||||
export import Simulate = ReactSimulate;
|
||||
|
||||
renderIntoDocument<P>(element: ReactElement<P>): Component<P, any>;
|
||||
renderIntoDocument<C extends Component<any, any>>(element: ReactElement<any>): C;
|
||||
export function renderIntoDocument<P>(
|
||||
element: ReactElement<P>): Component<P, any>;
|
||||
export function renderIntoDocument<C extends Component<any, any>>(
|
||||
element: ReactElement<any>): C;
|
||||
|
||||
mockComponent(mocked: MockedComponentClass, mockTagName?: string): ReactTestUtils;
|
||||
export function mockComponent(
|
||||
mocked: MockedComponentClass, mockTagName?: string): typeof ReactTestUtils;
|
||||
|
||||
isElementOfType(element: ReactElement<any>, type: ReactType): boolean;
|
||||
isTextComponent(instance: Component<any, any>): boolean;
|
||||
isDOMComponent(instance: Component<any, any>): boolean;
|
||||
isCompositeComponent(instance: Component<any, any>): boolean;
|
||||
isCompositeComponentWithType(
|
||||
export function isElementOfType(
|
||||
element: ReactElement<any>, type: ReactType): boolean;
|
||||
export function isTextComponent(instance: Component<any, any>): boolean;
|
||||
export function isDOMComponent(instance: Component<any, any>): boolean;
|
||||
export function isCompositeComponent(instance: Component<any, any>): boolean;
|
||||
export function isCompositeComponentWithType(
|
||||
instance: Component<any, any>,
|
||||
type: ComponentClass<any>): boolean;
|
||||
|
||||
findAllInRenderedTree(
|
||||
export function findAllInRenderedTree(
|
||||
tree: Component<any, any>,
|
||||
fn: (i: Component<any, any>) => boolean): Component<any, any>;
|
||||
|
||||
scryRenderedDOMComponentsWithClass(
|
||||
export function scryRenderedDOMComponentsWithClass(
|
||||
tree: Component<any, any>,
|
||||
className: string): DOMComponent<any>[];
|
||||
findRenderedDOMComponentWithClass(
|
||||
export function findRenderedDOMComponentWithClass(
|
||||
tree: Component<any, any>,
|
||||
className: string): DOMComponent<any>;
|
||||
|
||||
scryRenderedDOMComponentsWithTag(
|
||||
export function scryRenderedDOMComponentsWithTag(
|
||||
tree: Component<any, any>,
|
||||
tagName: string): DOMComponent<any>[];
|
||||
findRenderedDOMComponentWithTag(
|
||||
export function findRenderedDOMComponentWithTag(
|
||||
tree: Component<any, any>,
|
||||
tagName: string): DOMComponent<any>;
|
||||
|
||||
scryRenderedComponentsWithType<P>(
|
||||
export function scryRenderedComponentsWithType<P>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<P>): Component<P, {}>[];
|
||||
scryRenderedComponentsWithType<C extends Component<any, any>>(
|
||||
export function scryRenderedComponentsWithType<C extends Component<any, any>>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<any>): C[];
|
||||
|
||||
findRenderedComponentWithType<P>(
|
||||
export function findRenderedComponentWithType<P>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<P>): Component<P, {}>;
|
||||
findRenderedComponentWithType<C extends Component<any, any>>(
|
||||
export function findRenderedComponentWithType<C extends Component<any, any>>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<any>): C;
|
||||
|
||||
createRenderer(): ShallowRenderer;
|
||||
export function createRenderer(): ShallowRenderer;
|
||||
}
|
||||
|
||||
interface SyntheticEventData {
|
||||
@@ -222,44 +232,45 @@ declare module React {
|
||||
(component: Component<any, any>, eventData?: SyntheticEventData): void;
|
||||
}
|
||||
|
||||
interface Simulate {
|
||||
blur: EventSimulator;
|
||||
change: EventSimulator;
|
||||
click: EventSimulator;
|
||||
cut: EventSimulator;
|
||||
doubleClick: EventSimulator;
|
||||
drag: EventSimulator;
|
||||
dragEnd: EventSimulator;
|
||||
dragEnter: EventSimulator;
|
||||
dragExit: EventSimulator;
|
||||
dragLeave: EventSimulator;
|
||||
dragOver: EventSimulator;
|
||||
dragStart: EventSimulator;
|
||||
drop: EventSimulator;
|
||||
focus: EventSimulator;
|
||||
input: EventSimulator;
|
||||
keyDown: EventSimulator;
|
||||
keyPress: EventSimulator;
|
||||
keyUp: EventSimulator;
|
||||
mouseDown: EventSimulator;
|
||||
mouseEnter: EventSimulator;
|
||||
mouseLeave: EventSimulator;
|
||||
mouseMove: EventSimulator;
|
||||
mouseOut: EventSimulator;
|
||||
mouseOver: EventSimulator;
|
||||
mouseUp: EventSimulator;
|
||||
paste: EventSimulator;
|
||||
scroll: EventSimulator;
|
||||
submit: EventSimulator;
|
||||
touchCancel: EventSimulator;
|
||||
touchEnd: EventSimulator;
|
||||
touchMove: EventSimulator;
|
||||
touchStart: EventSimulator;
|
||||
wheel: EventSimulator;
|
||||
module ReactSimulate {
|
||||
export var blur: EventSimulator;
|
||||
export var change: EventSimulator;
|
||||
export var click: EventSimulator;
|
||||
export var cut: EventSimulator;
|
||||
export var doubleClick: EventSimulator;
|
||||
export var drag: EventSimulator;
|
||||
export var dragEnd: EventSimulator;
|
||||
export var dragEnter: EventSimulator;
|
||||
export var dragExit: EventSimulator;
|
||||
export var dragLeave: EventSimulator;
|
||||
export var dragOver: EventSimulator;
|
||||
export var dragStart: EventSimulator;
|
||||
export var drop: EventSimulator;
|
||||
export var focus: EventSimulator;
|
||||
export var input: EventSimulator;
|
||||
export var keyDown: EventSimulator;
|
||||
export var keyPress: EventSimulator;
|
||||
export var keyUp: EventSimulator;
|
||||
export var mouseDown: EventSimulator;
|
||||
export var mouseEnter: EventSimulator;
|
||||
export var mouseLeave: EventSimulator;
|
||||
export var mouseMove: EventSimulator;
|
||||
export var mouseOut: EventSimulator;
|
||||
export var mouseOver: EventSimulator;
|
||||
export var mouseUp: EventSimulator;
|
||||
export var paste: EventSimulator;
|
||||
export var scroll: EventSimulator;
|
||||
export var submit: EventSimulator;
|
||||
export var touchCancel: EventSimulator;
|
||||
export var touchEnd: EventSimulator;
|
||||
export var touchMove: EventSimulator;
|
||||
export var touchStart: EventSimulator;
|
||||
export var wheel: EventSimulator;
|
||||
}
|
||||
|
||||
class ShallowRenderer {
|
||||
getRenderOutput<C extends Component<any, any>>(): C;
|
||||
getRenderOutput<E extends ReactElement<any>>(): E;
|
||||
getRenderOutput(): ReactElement<any>;
|
||||
render(element: ReactElement<any>, context?: any): void;
|
||||
unmount(): void;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/// <reference path="react-addons.d.ts" />
|
||||
import React = require("react/addons");
|
||||
|
||||
import TestUtils = React.addons.TestUtils;
|
||||
|
||||
interface Props extends React.Props<MyComponent> {
|
||||
hello: string;
|
||||
world?: string;
|
||||
@@ -397,12 +399,12 @@ React.createFactory(React.addons.CSSTransitionGroup)({
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
var node: Element;
|
||||
React.addons.TestUtils.Simulate.click(node);
|
||||
React.addons.TestUtils.Simulate.change(node);
|
||||
React.addons.TestUtils.Simulate.keyDown(node, { key: "Enter" });
|
||||
TestUtils.Simulate.click(node);
|
||||
TestUtils.Simulate.change(node);
|
||||
TestUtils.Simulate.keyDown(node, { key: "Enter" });
|
||||
|
||||
var renderer: React.ShallowRenderer =
|
||||
React.addons.TestUtils.createRenderer();
|
||||
TestUtils.createRenderer();
|
||||
renderer.render(React.createElement(Timer));
|
||||
var output: Timer = renderer.getRenderOutput<Timer>();
|
||||
|
||||
var output: React.ReactElement<React.Props<Timer>> =
|
||||
renderer.getRenderOutput();
|
||||
|
||||
Vendored
+105
-84
@@ -435,10 +435,16 @@ declare module "react/addons" {
|
||||
draggable?: boolean;
|
||||
encType?: string;
|
||||
form?: string;
|
||||
formAction?: string;
|
||||
formEncType?: string;
|
||||
formMethod?: string;
|
||||
formNoValidate?: boolean;
|
||||
formTarget?: string;
|
||||
frameBorder?: number | string;
|
||||
headers?: string;
|
||||
height?: number | string;
|
||||
hidden?: boolean;
|
||||
high?: number;
|
||||
href?: string;
|
||||
hrefLang?: string;
|
||||
htmlFor?: string;
|
||||
@@ -449,7 +455,10 @@ declare module "react/addons" {
|
||||
lang?: string;
|
||||
list?: string;
|
||||
loop?: boolean;
|
||||
low?: number;
|
||||
manifest?: string;
|
||||
marginHeight?: number;
|
||||
marginWidth?: number;
|
||||
max?: number | string;
|
||||
maxLength?: number;
|
||||
media?: string;
|
||||
@@ -461,6 +470,7 @@ declare module "react/addons" {
|
||||
name?: string;
|
||||
noValidate?: boolean;
|
||||
open?: boolean;
|
||||
optimum?: number;
|
||||
pattern?: string;
|
||||
placeholder?: string;
|
||||
poster?: string;
|
||||
@@ -474,9 +484,8 @@ declare module "react/addons" {
|
||||
rowSpan?: number;
|
||||
sandbox?: string;
|
||||
scope?: string;
|
||||
scrollLeft?: number;
|
||||
scoped?: boolean;
|
||||
scrolling?: string;
|
||||
scrollTop?: number;
|
||||
seamless?: boolean;
|
||||
selected?: boolean;
|
||||
shape?: string;
|
||||
@@ -506,6 +515,7 @@ declare module "react/addons" {
|
||||
itemProp?: string;
|
||||
itemScope?: boolean;
|
||||
itemType?: string;
|
||||
unselectable?: boolean;
|
||||
}
|
||||
|
||||
interface SVGAttributes extends DOMAttributes {
|
||||
@@ -744,33 +754,39 @@ declare module "react/addons" {
|
||||
// React.addons
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export var addons: {
|
||||
CSSTransitionGroup: CSSTransitionGroup;
|
||||
LinkedStateMixin: LinkedStateMixin;
|
||||
PureRenderMixin: PureRenderMixin;
|
||||
TransitionGroup: TransitionGroup;
|
||||
export module addons {
|
||||
export var CSSTransitionGroup: CSSTransitionGroup;
|
||||
export var TransitionGroup: TransitionGroup;
|
||||
|
||||
batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
|
||||
batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
||||
batchedUpdates(callback: () => any): void;
|
||||
export var LinkedStateMixin: LinkedStateMixin;
|
||||
export var PureRenderMixin: PureRenderMixin;
|
||||
|
||||
export function batchedUpdates<A, B>(
|
||||
callback: (a: A, b: B) => any, a: A, b: B): void;
|
||||
export function batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
||||
export function batchedUpdates(callback: () => any): void;
|
||||
|
||||
// deprecated: use petehunt/react-classset or JedWatson/classnames
|
||||
classSet(cx: { [key: string]: boolean }): string;
|
||||
classSet(...classList: string[]): string;
|
||||
export function classSet(cx: { [key: string]: boolean }): string;
|
||||
export function classSet(...classList: string[]): string;
|
||||
|
||||
cloneWithProps<P>(element: DOMElement<P>, props: P): DOMElement<P>;
|
||||
cloneWithProps<P>(element: ClassicElement<P>, props: P): ClassicElement<P>;
|
||||
cloneWithProps<P>(element: ReactElement<P>, props: P): ReactElement<P>;
|
||||
export function cloneWithProps<P>(
|
||||
element: DOMElement<P>, props: P): DOMElement<P>;
|
||||
export function cloneWithProps<P>(
|
||||
element: ClassicElement<P>, props: P): ClassicElement<P>;
|
||||
export function cloneWithProps<P>(
|
||||
element: ReactElement<P>, props: P): ReactElement<P>;
|
||||
|
||||
createFragment(object: { [key: string]: ReactNode }): ReactFragment;
|
||||
export function createFragment(
|
||||
object: { [key: string]: ReactNode }): ReactFragment;
|
||||
|
||||
update(value: any[], spec: UpdateArraySpec): any[];
|
||||
update(value: {}, spec: UpdateSpec): any;
|
||||
export function update(value: any[], spec: UpdateArraySpec): any[];
|
||||
export function update(value: {}, spec: UpdateSpec): any;
|
||||
|
||||
// Development tools
|
||||
Perf: ReactPerf;
|
||||
TestUtils: ReactTestUtils;
|
||||
};
|
||||
export import Perf = ReactPerf;
|
||||
export import TestUtils = ReactTestUtils;
|
||||
}
|
||||
|
||||
//
|
||||
// React.addons (Transitions)
|
||||
@@ -849,14 +865,14 @@ declare module "react/addons" {
|
||||
totalTime: number;
|
||||
}
|
||||
|
||||
interface ReactPerf {
|
||||
start(): void;
|
||||
stop(): void;
|
||||
printInclusive(measurements: Measurements[]): void;
|
||||
printExclusive(measurements: Measurements[]): void;
|
||||
printWasted(measurements: Measurements[]): void;
|
||||
printDOM(measurements: Measurements[]): void;
|
||||
getLastMeasurements(): Measurements[];
|
||||
module ReactPerf {
|
||||
export function start(): void;
|
||||
export function stop(): void;
|
||||
export function printInclusive(measurements: Measurements[]): void;
|
||||
export function printExclusive(measurements: Measurements[]): void;
|
||||
export function printWasted(measurements: Measurements[]): void;
|
||||
export function printDOM(measurements: Measurements[]): void;
|
||||
export function getLastMeasurements(): Measurements[];
|
||||
}
|
||||
|
||||
//
|
||||
@@ -867,55 +883,59 @@ declare module "react/addons" {
|
||||
new(): any;
|
||||
}
|
||||
|
||||
interface ReactTestUtils {
|
||||
Simulate: Simulate;
|
||||
module ReactTestUtils {
|
||||
export import Simulate = ReactSimulate;
|
||||
|
||||
renderIntoDocument<P>(element: ReactElement<P>): Component<P, any>;
|
||||
renderIntoDocument<C extends Component<any, any>>(element: ReactElement<any>): C;
|
||||
export function renderIntoDocument<P>(
|
||||
element: ReactElement<P>): Component<P, any>;
|
||||
export function renderIntoDocument<C extends Component<any, any>>(
|
||||
element: ReactElement<any>): C;
|
||||
|
||||
mockComponent(mocked: MockedComponentClass, mockTagName?: string): ReactTestUtils;
|
||||
export function mockComponent(
|
||||
mocked: MockedComponentClass, mockTagName?: string): typeof ReactTestUtils;
|
||||
|
||||
isElementOfType(element: ReactElement<any>, type: ReactType): boolean;
|
||||
isTextComponent(instance: Component<any, any>): boolean;
|
||||
isDOMComponent(instance: Component<any, any>): boolean;
|
||||
isCompositeComponent(instance: Component<any, any>): boolean;
|
||||
isCompositeComponentWithType(
|
||||
export function isElementOfType(
|
||||
element: ReactElement<any>, type: ReactType): boolean;
|
||||
export function isTextComponent(instance: Component<any, any>): boolean;
|
||||
export function isDOMComponent(instance: Component<any, any>): boolean;
|
||||
export function isCompositeComponent(instance: Component<any, any>): boolean;
|
||||
export function isCompositeComponentWithType(
|
||||
instance: Component<any, any>,
|
||||
type: ComponentClass<any>): boolean;
|
||||
|
||||
findAllInRenderedTree(
|
||||
export function findAllInRenderedTree(
|
||||
tree: Component<any, any>,
|
||||
fn: (i: Component<any, any>) => boolean): Component<any, any>;
|
||||
|
||||
scryRenderedDOMComponentsWithClass(
|
||||
export function scryRenderedDOMComponentsWithClass(
|
||||
tree: Component<any, any>,
|
||||
className: string): DOMComponent<any>[];
|
||||
findRenderedDOMComponentWithClass(
|
||||
export function findRenderedDOMComponentWithClass(
|
||||
tree: Component<any, any>,
|
||||
className: string): DOMComponent<any>;
|
||||
|
||||
scryRenderedDOMComponentsWithTag(
|
||||
export function scryRenderedDOMComponentsWithTag(
|
||||
tree: Component<any, any>,
|
||||
tagName: string): DOMComponent<any>[];
|
||||
findRenderedDOMComponentWithTag(
|
||||
export function findRenderedDOMComponentWithTag(
|
||||
tree: Component<any, any>,
|
||||
tagName: string): DOMComponent<any>;
|
||||
|
||||
scryRenderedComponentsWithType<P>(
|
||||
export function scryRenderedComponentsWithType<P>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<P>): Component<P, {}>[];
|
||||
scryRenderedComponentsWithType<C extends Component<any, any>>(
|
||||
export function scryRenderedComponentsWithType<C extends Component<any, any>>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<any>): C[];
|
||||
|
||||
findRenderedComponentWithType<P>(
|
||||
export function findRenderedComponentWithType<P>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<P>): Component<P, {}>;
|
||||
findRenderedComponentWithType<C extends Component<any, any>>(
|
||||
export function findRenderedComponentWithType<C extends Component<any, any>>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<any>): C;
|
||||
|
||||
createRenderer(): ShallowRenderer;
|
||||
export function createRenderer(): ShallowRenderer;
|
||||
}
|
||||
|
||||
interface SyntheticEventData {
|
||||
@@ -957,44 +977,45 @@ declare module "react/addons" {
|
||||
(component: Component<any, any>, eventData?: SyntheticEventData): void;
|
||||
}
|
||||
|
||||
interface Simulate {
|
||||
blur: EventSimulator;
|
||||
change: EventSimulator;
|
||||
click: EventSimulator;
|
||||
cut: EventSimulator;
|
||||
doubleClick: EventSimulator;
|
||||
drag: EventSimulator;
|
||||
dragEnd: EventSimulator;
|
||||
dragEnter: EventSimulator;
|
||||
dragExit: EventSimulator;
|
||||
dragLeave: EventSimulator;
|
||||
dragOver: EventSimulator;
|
||||
dragStart: EventSimulator;
|
||||
drop: EventSimulator;
|
||||
focus: EventSimulator;
|
||||
input: EventSimulator;
|
||||
keyDown: EventSimulator;
|
||||
keyPress: EventSimulator;
|
||||
keyUp: EventSimulator;
|
||||
mouseDown: EventSimulator;
|
||||
mouseEnter: EventSimulator;
|
||||
mouseLeave: EventSimulator;
|
||||
mouseMove: EventSimulator;
|
||||
mouseOut: EventSimulator;
|
||||
mouseOver: EventSimulator;
|
||||
mouseUp: EventSimulator;
|
||||
paste: EventSimulator;
|
||||
scroll: EventSimulator;
|
||||
submit: EventSimulator;
|
||||
touchCancel: EventSimulator;
|
||||
touchEnd: EventSimulator;
|
||||
touchMove: EventSimulator;
|
||||
touchStart: EventSimulator;
|
||||
wheel: EventSimulator;
|
||||
module ReactSimulate {
|
||||
export var blur: EventSimulator;
|
||||
export var change: EventSimulator;
|
||||
export var click: EventSimulator;
|
||||
export var cut: EventSimulator;
|
||||
export var doubleClick: EventSimulator;
|
||||
export var drag: EventSimulator;
|
||||
export var dragEnd: EventSimulator;
|
||||
export var dragEnter: EventSimulator;
|
||||
export var dragExit: EventSimulator;
|
||||
export var dragLeave: EventSimulator;
|
||||
export var dragOver: EventSimulator;
|
||||
export var dragStart: EventSimulator;
|
||||
export var drop: EventSimulator;
|
||||
export var focus: EventSimulator;
|
||||
export var input: EventSimulator;
|
||||
export var keyDown: EventSimulator;
|
||||
export var keyPress: EventSimulator;
|
||||
export var keyUp: EventSimulator;
|
||||
export var mouseDown: EventSimulator;
|
||||
export var mouseEnter: EventSimulator;
|
||||
export var mouseLeave: EventSimulator;
|
||||
export var mouseMove: EventSimulator;
|
||||
export var mouseOut: EventSimulator;
|
||||
export var mouseOver: EventSimulator;
|
||||
export var mouseUp: EventSimulator;
|
||||
export var paste: EventSimulator;
|
||||
export var scroll: EventSimulator;
|
||||
export var submit: EventSimulator;
|
||||
export var touchCancel: EventSimulator;
|
||||
export var touchEnd: EventSimulator;
|
||||
export var touchMove: EventSimulator;
|
||||
export var touchStart: EventSimulator;
|
||||
export var wheel: EventSimulator;
|
||||
}
|
||||
|
||||
class ShallowRenderer {
|
||||
getRenderOutput<C extends Component<any, any>>(): C;
|
||||
getRenderOutput<E extends ReactElement<any>>(): E;
|
||||
getRenderOutput(): ReactElement<any>;
|
||||
render(element: ReactElement<any>, context?: any): void;
|
||||
unmount(): void;
|
||||
}
|
||||
|
||||
Vendored
+12
-2
@@ -435,10 +435,16 @@ declare module React {
|
||||
draggable?: boolean;
|
||||
encType?: string;
|
||||
form?: string;
|
||||
formAction?: string;
|
||||
formEncType?: string;
|
||||
formMethod?: string;
|
||||
formNoValidate?: boolean;
|
||||
formTarget?: string;
|
||||
frameBorder?: number | string;
|
||||
headers?: string;
|
||||
height?: number | string;
|
||||
hidden?: boolean;
|
||||
high?: number;
|
||||
href?: string;
|
||||
hrefLang?: string;
|
||||
htmlFor?: string;
|
||||
@@ -449,7 +455,10 @@ declare module React {
|
||||
lang?: string;
|
||||
list?: string;
|
||||
loop?: boolean;
|
||||
low?: number;
|
||||
manifest?: string;
|
||||
marginHeight?: number;
|
||||
marginWidth?: number;
|
||||
max?: number | string;
|
||||
maxLength?: number;
|
||||
media?: string;
|
||||
@@ -461,6 +470,7 @@ declare module React {
|
||||
name?: string;
|
||||
noValidate?: boolean;
|
||||
open?: boolean;
|
||||
optimum?: number;
|
||||
pattern?: string;
|
||||
placeholder?: string;
|
||||
poster?: string;
|
||||
@@ -474,9 +484,8 @@ declare module React {
|
||||
rowSpan?: number;
|
||||
sandbox?: string;
|
||||
scope?: string;
|
||||
scrollLeft?: number;
|
||||
scoped?: boolean;
|
||||
scrolling?: string;
|
||||
scrollTop?: number;
|
||||
seamless?: boolean;
|
||||
selected?: boolean;
|
||||
shape?: string;
|
||||
@@ -506,6 +515,7 @@ declare module React {
|
||||
itemProp?: string;
|
||||
itemScope?: boolean;
|
||||
itemType?: string;
|
||||
unselectable?: boolean;
|
||||
}
|
||||
|
||||
interface SVGAttributes extends DOMAttributes {
|
||||
|
||||
Vendored
+12
-2
@@ -435,10 +435,16 @@ declare module "react" {
|
||||
draggable?: boolean;
|
||||
encType?: string;
|
||||
form?: string;
|
||||
formAction?: string;
|
||||
formEncType?: string;
|
||||
formMethod?: string;
|
||||
formNoValidate?: boolean;
|
||||
formTarget?: string;
|
||||
frameBorder?: number | string;
|
||||
headers?: string;
|
||||
height?: number | string;
|
||||
hidden?: boolean;
|
||||
high?: number;
|
||||
href?: string;
|
||||
hrefLang?: string;
|
||||
htmlFor?: string;
|
||||
@@ -449,7 +455,10 @@ declare module "react" {
|
||||
lang?: string;
|
||||
list?: string;
|
||||
loop?: boolean;
|
||||
low?: number;
|
||||
manifest?: string;
|
||||
marginHeight?: number;
|
||||
marginWidth?: number;
|
||||
max?: number | string;
|
||||
maxLength?: number;
|
||||
media?: string;
|
||||
@@ -461,6 +470,7 @@ declare module "react" {
|
||||
name?: string;
|
||||
noValidate?: boolean;
|
||||
open?: boolean;
|
||||
optimum?: number;
|
||||
pattern?: string;
|
||||
placeholder?: string;
|
||||
poster?: string;
|
||||
@@ -474,9 +484,8 @@ declare module "react" {
|
||||
rowSpan?: number;
|
||||
sandbox?: string;
|
||||
scope?: string;
|
||||
scrollLeft?: number;
|
||||
scoped?: boolean;
|
||||
scrolling?: string;
|
||||
scrollTop?: number;
|
||||
seamless?: boolean;
|
||||
selected?: boolean;
|
||||
shape?: string;
|
||||
@@ -506,6 +515,7 @@ declare module "react" {
|
||||
itemProp?: string;
|
||||
itemScope?: boolean;
|
||||
itemType?: string;
|
||||
unselectable?: boolean;
|
||||
}
|
||||
|
||||
interface SVGAttributes extends DOMAttributes {
|
||||
|
||||
Vendored
+27
-25
@@ -15,40 +15,40 @@ declare module 'request' {
|
||||
|
||||
export = RequestAPI;
|
||||
|
||||
function RequestAPI(uri: string, options?: RequestAPI.Options, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request;
|
||||
function RequestAPI(uri: string, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request;
|
||||
function RequestAPI(options: RequestAPI.Options, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request;
|
||||
function RequestAPI(uri: string, options?: RequestAPI.Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request;
|
||||
function RequestAPI(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request;
|
||||
function RequestAPI(options: RequestAPI.Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request;
|
||||
|
||||
module RequestAPI {
|
||||
export function defaults(options: Options): typeof RequestAPI;
|
||||
|
||||
export function request(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function request(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function request(options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function request(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
export function request(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
export function request(options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
|
||||
export function get(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function get(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function get(options: Options, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function get(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
export function get(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
export function get(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
|
||||
export function post(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function post(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function post(options: Options, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function post(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
export function post(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
export function post(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
|
||||
export function put(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function put(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function put(options: Options, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function put(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
export function put(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
export function put(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
|
||||
export function head(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function head(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function head(options: Options, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function head(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
export function head(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
export function head(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
|
||||
export function patch(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function patch(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function patch(options: Options, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function patch(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
export function patch(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
export function patch(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
|
||||
export function del(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function del(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function del(options: Options, callback?: (error: any, response: any, body: any) => void): Request;
|
||||
export function del(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
export function del(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
export function del(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request;
|
||||
|
||||
export function forever(agentOptions: any, optionsArg: any): Request;
|
||||
export function jar(): CookieJar;
|
||||
@@ -59,9 +59,10 @@ declare module 'request' {
|
||||
export interface Options {
|
||||
url?: string;
|
||||
uri?: string;
|
||||
callback?: (error: any, response: any, body: any) => void;
|
||||
callback?: (error: any, response: http.IncomingMessage, body: any) => void;
|
||||
jar?: any; // CookieJar
|
||||
form?: any; // Object or string
|
||||
auth?: AuthOptions;
|
||||
oauth?: OAuthOptions;
|
||||
aws?: AWSOptions;
|
||||
hawk ?: HawkOptions;
|
||||
@@ -107,6 +108,7 @@ declare module 'request' {
|
||||
multipart(multipart: RequestPart[]): Request;
|
||||
json(val: any): Request;
|
||||
aws(opts: AWSOptions, now?: boolean): Request;
|
||||
auth(username: string, password: string, sendInmediately?: boolean, bearer?: string): Request;
|
||||
oauth(oauth: OAuthOptions): Request;
|
||||
jar(jar: CookieJar): Request;
|
||||
|
||||
|
||||
+21
-1
@@ -54,4 +54,24 @@ routie("users/12312312");
|
||||
routie("*", function () {
|
||||
});
|
||||
|
||||
routie("anything");
|
||||
routie("anything");
|
||||
|
||||
// STATIC
|
||||
|
||||
// Lookup
|
||||
var existing = routie.lookup("users/bob", () => {
|
||||
});
|
||||
|
||||
// Remove
|
||||
routie.remove("users/bob", () => {
|
||||
});
|
||||
|
||||
// RemoveAll
|
||||
routie.removeAll();
|
||||
|
||||
// Navigate
|
||||
routie.navigate("users/bob");
|
||||
routie.navigate("users/bob", { silent: true });
|
||||
|
||||
// NoConflict
|
||||
var myRoutie = routie.noConflict();
|
||||
|
||||
Vendored
+28
-10
@@ -3,15 +3,33 @@
|
||||
// Definitions by: Adilson <https://github.com/Adilson>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface Route {
|
||||
constructor(path: string, name: string): Route;
|
||||
addHandler(fn: Function): void;
|
||||
removeHandler(fn: Function): void;
|
||||
run(params: any): void;
|
||||
match(path: string, params: any): boolean;
|
||||
toURL(params: any): string;
|
||||
declare module routie {
|
||||
interface Route {
|
||||
constructor(path: string, name: string): Route;
|
||||
addHandler(fn: Function): void;
|
||||
removeHandler(fn: Function): void;
|
||||
run(params: any): void;
|
||||
match(path: string, params: any): boolean;
|
||||
toURL(params: any): string;
|
||||
}
|
||||
|
||||
interface Routie extends RoutieStatic {
|
||||
(path: string): void;
|
||||
(path: string, fn: Function): void;
|
||||
(routes: { [key: string]: Function }): void;
|
||||
}
|
||||
|
||||
interface RoutieStatic {
|
||||
lookup(name: string, fn: Function): string;
|
||||
remove(path: string, fn: Function): void;
|
||||
removeAll(): void;
|
||||
navigate(path: string, options?: RouteOptions): void;
|
||||
noConflict(): Routie;
|
||||
}
|
||||
|
||||
interface RouteOptions {
|
||||
silent?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare function routie(path: string): void;
|
||||
declare function routie(path: string, fn: Function): void;
|
||||
declare function routie(routes: { [key: string]: Function }): void;
|
||||
declare var routie: routie.Routie;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user