mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-27 11:40:08 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
/// <reference path="./amazon-product-api.d.ts" />
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
import amazon = require('amazon-product-api');
|
||||
|
||||
var client = amazon.createClient({
|
||||
awsId: process.env.AWS_ACCESS_KEY_ID,
|
||||
awsSecret: process.env.AWS_SECRET,
|
||||
awsTag: process.env.AWS_ASSOCIATE_TAG
|
||||
});
|
||||
|
||||
|
||||
// Item Search
|
||||
|
||||
var searchQuery = {
|
||||
director: 'Quentin Tarantino',
|
||||
actor: 'Samuel L. Jackson',
|
||||
searchIndex: 'DVD',
|
||||
audienceRating: 'R',
|
||||
responseGroup: 'ItemAttributes,Offers,Images'
|
||||
};
|
||||
|
||||
client.itemSearch(searchQuery).then((results) => {
|
||||
console.log(getResultCount(results) + " search results");
|
||||
}).catch(function(err){
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
client.itemSearch(searchQuery, (err, results) => {
|
||||
if(err) {
|
||||
console.log(err);
|
||||
return;
|
||||
}
|
||||
console.log(getResultCount(results) + " search results");
|
||||
});
|
||||
|
||||
|
||||
// Item Lookup
|
||||
|
||||
var lookupQuery = {
|
||||
itemId: 'B00008OE6I',
|
||||
idType: 'ASIN',
|
||||
responseGroup: 'OfferFull',
|
||||
Condition: 'All'
|
||||
};
|
||||
|
||||
client.itemLookup(lookupQuery).then((results) => {
|
||||
console.log(getResultCount(results) + " lookup results");
|
||||
}).catch(function(err){
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
client.itemLookup(lookupQuery, (err, results) => {
|
||||
if(err) {
|
||||
console.log(err);
|
||||
return;
|
||||
}
|
||||
console.log(getResultCount(results) + " lookup results");
|
||||
});
|
||||
|
||||
// Browse Node Lookup
|
||||
|
||||
var nodeLookupQuery = {
|
||||
browseNodeId: '2625373011'
|
||||
};
|
||||
|
||||
client.browseNodeLookup(nodeLookupQuery).then((results) => {
|
||||
console.log(getResultCount(results) + " node lookup results");
|
||||
}).catch(function(err){
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
client.browseNodeLookup(nodeLookupQuery, (err, results) => {
|
||||
if(err) {
|
||||
console.log(err);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(getResultCount(results) + " node lookup results");
|
||||
});
|
||||
|
||||
function getResultCount(results: Object[]) {
|
||||
return results != undefined ? results.length : 0;
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// Type definitions for amazon-product-api
|
||||
// Project: https://github.com/t3chnoboy/amazon-product-api
|
||||
// Definitions by: Matti Lehtinen <https://github.com/MattiLehtinen/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../es6-promise/es6-promise.d.ts"/>
|
||||
|
||||
declare module "amazon-product-api" {
|
||||
|
||||
interface ICredentials {
|
||||
awsId: string,
|
||||
awsSecret: string,
|
||||
awsTag: string
|
||||
}
|
||||
|
||||
interface IAmazonProductQueryCallback {
|
||||
(err: string, results: Object[]): void;
|
||||
}
|
||||
|
||||
interface IAmazonProductClient {
|
||||
itemSearch(query: any, callback?: IAmazonProductQueryCallback) : Promise<Object[]>;
|
||||
itemLookup(query: any, callback?: IAmazonProductQueryCallback) : Promise<Object[]>;
|
||||
browseNodeLookup(query: any, callback?: IAmazonProductQueryCallback) : Promise<Object[]>;
|
||||
}
|
||||
|
||||
export function createClient(credentials:ICredentials) : IAmazonProductClient;
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
/// <reference path="amplify-deferred.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
// Copied examples directly from AmplifyJs site
|
||||
|
||||
// Subscribe and publish with no data
|
||||
|
||||
amplify.subscribe("nodataexample", function () {
|
||||
alert("nodataexample topic published!");
|
||||
});
|
||||
|
||||
// Subscribe and publish with data
|
||||
|
||||
amplify.publish("nodataexample");
|
||||
|
||||
amplify.subscribe("dataexample", function (data) {
|
||||
alert(data.foo); // bar
|
||||
});
|
||||
|
||||
|
||||
amplify.publish("dataexample", { foo: "bar" });
|
||||
|
||||
amplify.subscribe("dataexample2", function (param1, param2) {
|
||||
alert(param1 + param2); // barbaz
|
||||
});
|
||||
|
||||
//...
|
||||
|
||||
amplify.publish("dataexample2", "bar", "baz");
|
||||
|
||||
// Subscribe and publish with context and data
|
||||
|
||||
amplify.subscribe("datacontextexample", $("p:first"), function (data) {
|
||||
this.text(data.exampleText); // first p element would have "foo bar baz" as text
|
||||
});
|
||||
|
||||
amplify.publish("datacontextexample", { exampleText: "foo bar baz" });
|
||||
|
||||
// Subscribe to a topic with high priority
|
||||
|
||||
amplify.subscribe("priorityexample", function (data) {
|
||||
alert(data.foo);
|
||||
});
|
||||
|
||||
amplify.subscribe("priorityexample", function (data) {
|
||||
if (data.foo === "oops") {
|
||||
return false;
|
||||
}
|
||||
}, 1);
|
||||
|
||||
|
||||
// Store data with amplify storage picking the default storage technology:
|
||||
|
||||
amplify.publish("priorityexample", { foo: "bar" });
|
||||
amplify.publish("priorityexample", { foo: "oops" });
|
||||
|
||||
amplify.store("storeExample1", { foo: "bar" });
|
||||
amplify.store("storeExample2", "baz");
|
||||
// retrieve the data later via the key
|
||||
var myStoredValue = amplify.store("storeExample1"),
|
||||
myStoredValue2 = amplify.store("storeExample2"),
|
||||
myStoredValues = amplify.store();
|
||||
myStoredValue.foo; // bar
|
||||
myStoredValue2; // baz
|
||||
myStoredValues.storeExample1.foo; // bar
|
||||
myStoredValues.storeExample2; // baz
|
||||
|
||||
// Store data explicitly with session storage
|
||||
|
||||
amplify.store.sessionStorage("explicitExample", { foo2: "baz" });
|
||||
// retrieve the data later via the key
|
||||
var myStoredValue2 = amplify.store.sessionStorage("explicitExample");
|
||||
myStoredValue2.foo2; // baz
|
||||
|
||||
|
||||
// REQUEST
|
||||
|
||||
// Set up and use a request utilizing Ajax
|
||||
|
||||
|
||||
amplify.request.define("ajaxExample1", "ajax", {
|
||||
url: "/myApiUrl",
|
||||
dataType: "json",
|
||||
type: "GET"
|
||||
});
|
||||
|
||||
// later in code
|
||||
amplify.request("ajaxExample1", function (data) {
|
||||
data.foo; // bar
|
||||
});
|
||||
|
||||
// Set up and use a request utilizing Ajax and Caching
|
||||
|
||||
amplify.request.define("ajaxExample2", "ajax", {
|
||||
url: "/myApiUrl",
|
||||
dataType: "json",
|
||||
type: "GET",
|
||||
cache: "persist"
|
||||
});
|
||||
|
||||
// later in code
|
||||
amplify.request("ajaxExample2", function (data) {
|
||||
data.foo; // bar
|
||||
});
|
||||
|
||||
// a second call will result in pulling from the cache
|
||||
amplify.request("ajaxExample2", function (data) {
|
||||
data.baz; // qux
|
||||
})
|
||||
|
||||
// Set up and use a RESTful request utilizing Ajax
|
||||
|
||||
amplify.request.define("ajaxRESTFulExample", "ajax", {
|
||||
url: "/myRestFulApi/{type}/{id}",
|
||||
type: "GET"
|
||||
})
|
||||
|
||||
// later in code
|
||||
amplify.request("ajaxRESTFulExample",
|
||||
{
|
||||
type: "foo",
|
||||
id: "bar"
|
||||
},
|
||||
function (data) {
|
||||
// /myRESTFulApi/foo/bar was the URL used
|
||||
data.foo; // bar
|
||||
}
|
||||
);
|
||||
|
||||
// POST data with Ajax
|
||||
|
||||
amplify.request.define("ajaxPostExample", "ajax", {
|
||||
url: "/myRestFulApi",
|
||||
type: "POST"
|
||||
})
|
||||
|
||||
// later in code
|
||||
amplify.request("ajaxPostExample",
|
||||
{
|
||||
type: "foo",
|
||||
id: "bar"
|
||||
},
|
||||
function (data) {
|
||||
data.foo; // bar
|
||||
}
|
||||
);
|
||||
// Using data maps
|
||||
|
||||
// When searching Twitter, the key for the search phrase is q.If we want a more descriptive name, such as term, we can use a data map:
|
||||
|
||||
amplify.request.define("twitter-search", "ajax", {
|
||||
url: "http://search.twitter.com/search.json",
|
||||
dataType: "jsonp",
|
||||
dataMap: {
|
||||
term: "q"
|
||||
}
|
||||
});
|
||||
|
||||
amplify.request("twitter-search", { term: "amplifyjs" });
|
||||
|
||||
// Similarly, we can create a request that searches for mentions, by accepting a username:
|
||||
|
||||
amplify.request.define("twitter-mentions", "ajax", {
|
||||
url: "http://search.twitter.com/search.json",
|
||||
dataType: "jsonp",
|
||||
dataMap: function (data) {
|
||||
return {
|
||||
q: "@" + data.user
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
amplify.request("twitter-mentions", { user: "amplifyjs" });
|
||||
|
||||
// Setting up and using decoders
|
||||
|
||||
//Example:
|
||||
|
||||
var appEnvelopeDecoder: amplifyDecoder = function (data, status, xhr, success, error) {
|
||||
if (data.status === "success") {
|
||||
success(data.data);
|
||||
} else if (data.status === "fail" || data.status === "error") {
|
||||
error(data.message, data.status);
|
||||
} else {
|
||||
error(data.message, "fatal");
|
||||
}
|
||||
};
|
||||
|
||||
//a new decoder can be added to the amplifyDecoders interface
|
||||
interface amplifyDecoders {
|
||||
appEnvelope: amplifyDecoder;
|
||||
}
|
||||
|
||||
amplify.request.decoders.appEnvelope = appEnvelopeDecoder;
|
||||
|
||||
//but you can also just add it via an index
|
||||
amplify.request.decoders['appEnvelopeStr'] = appEnvelopeDecoder;
|
||||
|
||||
|
||||
amplify.request.define("decoderExample", "ajax", {
|
||||
url: "/myAjaxUrl",
|
||||
type: "POST",
|
||||
decoder: "appEnvelope"
|
||||
});
|
||||
|
||||
amplify.request({
|
||||
resourceId: "decoderExample",
|
||||
success: function (data) {
|
||||
data.foo; // bar
|
||||
},
|
||||
error: function (message, level) {
|
||||
alert("always handle errors with alerts.");
|
||||
}
|
||||
});
|
||||
|
||||
// POST with caching and single - use decoder
|
||||
|
||||
// Example:
|
||||
|
||||
amplify.request.define("decoderSingleExample", "ajax", {
|
||||
url: "/myAjaxUrl",
|
||||
type: "POST",
|
||||
decoder: function (data, status, xhr, success, error) {
|
||||
if (data.status === "success") {
|
||||
success(data.data);
|
||||
} else if (data.status === "fail" || data.status === "error") {
|
||||
error(data.message, data.status);
|
||||
} else {
|
||||
error(data.message, "fatal");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
amplify.request({
|
||||
resourceId: "decoderSingleExample",
|
||||
success: function (data) {
|
||||
data.foo; // bar
|
||||
},
|
||||
error: function (message, level) {
|
||||
alert("always handle errors with alerts.");
|
||||
}
|
||||
});
|
||||
// Handling Status
|
||||
// Status in Success and Error Callbacks
|
||||
|
||||
// amplify.request comes with built in support for status.The status parameter appears in the default success or error callbacks when using an ajax definition.
|
||||
|
||||
amplify.request.define("statusExample1", "ajax", {
|
||||
//...
|
||||
});
|
||||
|
||||
amplify.request({
|
||||
resourceId: "statusExample1",
|
||||
success: function (data, status) {
|
||||
},
|
||||
error: function (data, status) {
|
||||
}
|
||||
});
|
||||
|
||||
amplify.request({
|
||||
resourceId: "statusExample1"
|
||||
}).done(function (data, status) {
|
||||
}).fail(function (data, status) {
|
||||
}).always(function (data, status) { });
|
||||
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
// Type definitions for AmplifyJs 1.1.0 using JQuery Deferred
|
||||
// Project: http://amplifyjs.com/
|
||||
// Definitions by: Jonas Eriksson <https://github.com/joeriks/>, Laurentiu Stamate <https://github.com/laurentiustamate94>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
interface amplifyRequestSettings {
|
||||
resourceId: string;
|
||||
data?: any;
|
||||
success?: (...args: any[]) => void;
|
||||
error?: (...args: any[]) => void;
|
||||
}
|
||||
|
||||
interface amplifyDecoder {
|
||||
(
|
||||
data?: any,
|
||||
status?: string,
|
||||
xhr?: JQueryXHR,
|
||||
success?: (...args: any[]) => void,
|
||||
error?: (...args: any[]) => void
|
||||
): void
|
||||
}
|
||||
|
||||
interface amplifyDecoders {
|
||||
[decoderName: string]: amplifyDecoder;
|
||||
jsSend: amplifyDecoder;
|
||||
}
|
||||
|
||||
interface amplifyAjaxSettings extends JQueryAjaxSettings {
|
||||
cache?: any;
|
||||
dataMap?: {} | ((data: any) => {});
|
||||
decoder?: any /* string or amplifyDecoder */;
|
||||
}
|
||||
|
||||
interface amplifyRequest {
|
||||
|
||||
/***
|
||||
* Request a resource.
|
||||
* resourceId: Identifier string for the resource.
|
||||
* data: A set of key/value pairs of data to be sent to the resource.
|
||||
* callback: A function to invoke if the resource is retrieved successfully.
|
||||
*/
|
||||
(resourceId: string, hash?: any, callback?: Function): JQueryPromise<any>;
|
||||
|
||||
/***
|
||||
* Request a resource.
|
||||
* settings: A set of key/value pairs of settings for the request.
|
||||
* resourceId: Identifier string for the resource.
|
||||
* data (optional): Data associated with the request.
|
||||
* success (optional): Function to invoke on success.
|
||||
* error (optional): Function to invoke on error.
|
||||
*/
|
||||
(settings: amplifyRequestSettings): JQueryPromise<any>;
|
||||
|
||||
/***
|
||||
* Define a resource.
|
||||
* resourceId: Identifier string for the resource.
|
||||
* requestType: The type of data retrieval method from the server. See the request types sections for more information.
|
||||
* settings: A set of key/value pairs that relate to the server communication technology. The following settings are available:
|
||||
* Any settings found in jQuery.ajax().
|
||||
* cache: See the cache section for more details.
|
||||
* decoder: See the decoder section for more details.
|
||||
*/
|
||||
define(resourceId: string, requestType: string, settings?: amplifyAjaxSettings): void;
|
||||
|
||||
/***
|
||||
* Define a custom request.
|
||||
* resourceId: Identifier string for the resource.
|
||||
* resource: Function to handle requests. Receives a hash with the following properties:
|
||||
* resourceId: Identifier string for the resource.
|
||||
* data: Data provided by the user.
|
||||
* success: Callback to invoke on success.
|
||||
* error: Callback to invoke on error.
|
||||
*/
|
||||
define(resourceId: string, resource: (settings: amplifyRequestSettings) => void): void;
|
||||
|
||||
decoders: amplifyDecoders;
|
||||
cache: any;
|
||||
}
|
||||
|
||||
interface amplifySubscribe {
|
||||
/***
|
||||
* Subscribe to a message.
|
||||
* topic: Name of the message to subscribe to.
|
||||
* callback: Function to invoke when the message is published.
|
||||
*/
|
||||
(topic: string, callback: Function): void;
|
||||
/***
|
||||
* Subscribe to a message.
|
||||
* topic: Name of the message to subscribe to.
|
||||
* context: What this will be when the callback is invoked.
|
||||
* callback: Function to invoke when the message is published.
|
||||
* [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10.
|
||||
*/
|
||||
(topic: string, context: any, callback: Function, priority?: number): void;
|
||||
/***
|
||||
* Subscribe to a message.
|
||||
* topic: Name of the message to subscribe to.
|
||||
* callback: Function to invoke when the message is published.
|
||||
* [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10.
|
||||
*/
|
||||
(topic: string, callback: Function, priority?: number): void;
|
||||
}
|
||||
interface amplifyStorageTypeStore {
|
||||
/***
|
||||
* Stores a value for a given key using the default storage type.
|
||||
*
|
||||
* key: Identifier for the value being stored.
|
||||
* value: The value to store. The value can be anything that can be serialized as JSON.
|
||||
* [options]: A set of key/value pairs that relate to settings for storing the value.
|
||||
*/
|
||||
(key: string, value: any, options?: any): void;
|
||||
|
||||
/***
|
||||
* Gets a stored value based on the key.
|
||||
*/
|
||||
(key: string): any;
|
||||
|
||||
/***
|
||||
* Gets a hash of all stored values.
|
||||
*/
|
||||
(): any;
|
||||
}
|
||||
|
||||
interface amplifyStore extends amplifyStorageTypeStore {
|
||||
|
||||
/***
|
||||
* IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
|
||||
*/
|
||||
localStorage: amplifyStorageTypeStore;
|
||||
|
||||
/***
|
||||
* IE 8+, Firefox 2+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
|
||||
*/
|
||||
sessionStorage: amplifyStorageTypeStore;
|
||||
|
||||
/***
|
||||
* Firefox 2+
|
||||
*/
|
||||
globalStorage: amplifyStorageTypeStore;
|
||||
|
||||
/***
|
||||
* IE 5 - 7
|
||||
*/
|
||||
userData: amplifyStorageTypeStore;
|
||||
|
||||
/***
|
||||
* An in-memory store is provided as a fallback if none of the other storage types are available.
|
||||
*/
|
||||
memory: amplifyStorageTypeStore;
|
||||
|
||||
|
||||
}
|
||||
|
||||
interface amplifyStatic {
|
||||
|
||||
subscribe: amplifySubscribe;
|
||||
|
||||
/***
|
||||
* Remove a subscription.
|
||||
* topic: The topic being unsubscribed from.
|
||||
* callback: The callback that was originally subscribed.
|
||||
*/
|
||||
unsubscribe(topic: string, callback: Function): void;
|
||||
|
||||
/***
|
||||
* Publish a message.
|
||||
* topic: The name of the message to publish.
|
||||
* Any additional parameters will be passed to the subscriptions.
|
||||
* amplify.publish returns a boolean indicating whether any subscriptions returned false. The return value is true if none of the subscriptions returned false, and false otherwise. Note that only one subscription can return false because doing so will prevent additional subscriptions from being invoked.
|
||||
*/
|
||||
publish(topic: string, ...args: any[]): boolean;
|
||||
|
||||
store: amplifyStore;
|
||||
|
||||
request: amplifyRequest;
|
||||
|
||||
}
|
||||
|
||||
declare var amplify: amplifyStatic;
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ declare module angular.growl {
|
||||
/**
|
||||
* Pre-defined server error interceptor.
|
||||
*/
|
||||
serverMessagesInterceptor: (string|Function)[];
|
||||
serverMessagesInterceptor: (string|IHttpInterceptorFactory)[];
|
||||
|
||||
/**
|
||||
* Set default TTL settings.
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ declare module angular.localForage {
|
||||
}
|
||||
|
||||
interface ILocalForageService {
|
||||
setDriver(driver:string):angular.IPromise<void>;
|
||||
driver<T>():lf.ILocalForage<T>;
|
||||
driver(): LocalForageDriver;
|
||||
setDriver(name: string | string[]): angular.IPromise<void>;
|
||||
|
||||
setItem(key:string, value:any):angular.IPromise<void>;
|
||||
setItem(keys:Array<string>, values:Array<any>):angular.IPromise<void>;
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
// Support for AMD require
|
||||
declare module 'angular-bootstrap' {}
|
||||
|
||||
declare module angular.ui.bootstrap {
|
||||
|
||||
interface IAccordionConfig {
|
||||
|
||||
@@ -158,7 +158,9 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
|
||||
private stateServiceTest() {
|
||||
this.$state.go("myState");
|
||||
this.$state.go(this.$state.current);
|
||||
this.$state.transitionTo("myState");
|
||||
this.$state.transitionTo(this.$state.current);
|
||||
if (this.$state.includes("myState") === true) {
|
||||
//
|
||||
}
|
||||
|
||||
+3
@@ -228,8 +228,11 @@ declare module angular.ui {
|
||||
* @param options Options object.
|
||||
*/
|
||||
go(to: string, params?: {}, options?: IStateOptions): angular.IPromise<any>;
|
||||
go(to: IState, params?: {}, options?: IStateOptions): angular.IPromise<any>;
|
||||
transitionTo(state: string, params?: {}, updateLocation?: boolean): void;
|
||||
transitionTo(state: IState, params?: {}, updateLocation?: boolean): void;
|
||||
transitionTo(state: string, params?: {}, options?: IStateOptions): void;
|
||||
transitionTo(state: IState, params?: {}, options?: IStateOptions): void;
|
||||
includes(state: string, params?: {}): boolean;
|
||||
is(state:string, params?: {}): boolean;
|
||||
is(state: IState, params?: {}): boolean;
|
||||
|
||||
+12214
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@ class Cmp {
|
||||
Cmp.annotations = [
|
||||
Component({
|
||||
selector: 'cmp',
|
||||
injectables: [Service, bind(Service2).toValue(null)]
|
||||
bindings: [Service, bind(Service2).toValue(null)]
|
||||
}),
|
||||
View({
|
||||
template: '{{greeting}} world!',
|
||||
@@ -27,9 +27,9 @@ Cmp.annotations = [
|
||||
properties: [
|
||||
'text: tooltip'
|
||||
],
|
||||
hostListeners: {
|
||||
'onmouseenter': 'onMouseEnter()',
|
||||
'onmouseleave': 'onMouseLeave()'
|
||||
host: {
|
||||
'(onmouseenter)': 'onMouseEnter()',
|
||||
'(onmouseleave)': 'onMouseLeave()'
|
||||
}
|
||||
})
|
||||
];
|
||||
|
||||
@@ -1 +1 @@
|
||||
--experimentalDecorators --target ES5
|
||||
--experimentalDecorators --noImplicitAny --target ES5
|
||||
|
||||
Vendored
+8025
-1731
File diff suppressed because it is too large
Load Diff
Vendored
+1007
File diff suppressed because it is too large
Load Diff
Vendored
+1007
File diff suppressed because it is too large
Load Diff
Vendored
+9
-9
@@ -81,7 +81,7 @@ declare module ngRouter {
|
||||
* ]);
|
||||
* ```
|
||||
*/
|
||||
config(definitions: List<RouteDefinition>): Promise<any>;
|
||||
config(definitions: Array<RouteDefinition>): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
@@ -135,7 +135,7 @@ declare module ngRouter {
|
||||
* Generate a URL from a component name and optional map of parameters. The URL is relative to the
|
||||
* app's base href.
|
||||
*/
|
||||
generate(linkParams: List<any>): Instruction;
|
||||
generate(linkParams: Array<any>): Instruction;
|
||||
}
|
||||
|
||||
class RootRouter extends Router {
|
||||
@@ -258,7 +258,7 @@ declare module ngRouter {
|
||||
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
|
||||
* generates a url with a leading slash relative to the provided `parentComponent`.
|
||||
*/
|
||||
generate(linkParams: List<any>, parentComponent: any): Instruction;
|
||||
generate(linkParams: Array<any>, parentComponent: any): Instruction;
|
||||
}
|
||||
|
||||
class LocationStrategy {
|
||||
@@ -343,7 +343,7 @@ declare module ngRouter {
|
||||
*/
|
||||
class Pipeline {
|
||||
|
||||
steps: List<Function>;
|
||||
steps: Array<Function>;
|
||||
|
||||
process(instruction: Instruction): Promise<any>;
|
||||
}
|
||||
@@ -547,7 +547,7 @@ declare module ngRouter {
|
||||
|
||||
urlPath: string;
|
||||
|
||||
urlParams: List<string>;
|
||||
urlParams: Array<string>;
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
@@ -568,7 +568,7 @@ declare module ngRouter {
|
||||
|
||||
child: Url;
|
||||
|
||||
auxiliary: List<Url>;
|
||||
auxiliary: Array<Url>;
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
@@ -594,9 +594,9 @@ declare module ngRouter {
|
||||
|
||||
}
|
||||
|
||||
const routerDirectives : List<any> ;
|
||||
const routerDirectives : Array<any> ;
|
||||
|
||||
var routerInjectables : List<any> ;
|
||||
var routerInjectables : Array<any> ;
|
||||
|
||||
class Route implements RouteDefinition {
|
||||
|
||||
@@ -669,7 +669,7 @@ declare module ngRouter {
|
||||
|
||||
const ROUTE_DATA : OpaqueToken ;
|
||||
|
||||
var RouteConfig : (configs: List<RouteDefinition>) => ClassDecorator ;
|
||||
var RouteConfig : (configs: Array<RouteDefinition>) => ClassDecorator ;
|
||||
|
||||
interface ComponentDefinition {
|
||||
|
||||
|
||||
Vendored
+9
-9
@@ -81,7 +81,7 @@ declare module ngRouter {
|
||||
* ]);
|
||||
* ```
|
||||
*/
|
||||
config(definitions: List<RouteDefinition>): Promise<any>;
|
||||
config(definitions: Array<RouteDefinition>): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
@@ -135,7 +135,7 @@ declare module ngRouter {
|
||||
* Generate a URL from a component name and optional map of parameters. The URL is relative to the
|
||||
* app's base href.
|
||||
*/
|
||||
generate(linkParams: List<any>): Instruction;
|
||||
generate(linkParams: Array<any>): Instruction;
|
||||
}
|
||||
|
||||
class RootRouter extends Router {
|
||||
@@ -258,7 +258,7 @@ declare module ngRouter {
|
||||
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
|
||||
* generates a url with a leading slash relative to the provided `parentComponent`.
|
||||
*/
|
||||
generate(linkParams: List<any>, parentComponent: any): Instruction;
|
||||
generate(linkParams: Array<any>, parentComponent: any): Instruction;
|
||||
}
|
||||
|
||||
class LocationStrategy {
|
||||
@@ -343,7 +343,7 @@ declare module ngRouter {
|
||||
*/
|
||||
class Pipeline {
|
||||
|
||||
steps: List<Function>;
|
||||
steps: Array<Function>;
|
||||
|
||||
process(instruction: Instruction): Promise<any>;
|
||||
}
|
||||
@@ -547,7 +547,7 @@ declare module ngRouter {
|
||||
|
||||
urlPath: string;
|
||||
|
||||
urlParams: List<string>;
|
||||
urlParams: Array<string>;
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
@@ -568,7 +568,7 @@ declare module ngRouter {
|
||||
|
||||
child: Url;
|
||||
|
||||
auxiliary: List<Url>;
|
||||
auxiliary: Array<Url>;
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
@@ -596,9 +596,9 @@ declare module ngRouter {
|
||||
|
||||
const ROUTE_DATA : OpaqueToken ;
|
||||
|
||||
const ROUTER_DIRECTIVES : List<any> ;
|
||||
const ROUTER_DIRECTIVES : Array<any> ;
|
||||
|
||||
const ROUTER_BINDINGS : List<any> ;
|
||||
const ROUTER_BINDINGS : Array<any> ;
|
||||
|
||||
class Route implements RouteDefinition {
|
||||
|
||||
@@ -669,7 +669,7 @@ declare module ngRouter {
|
||||
data?: any;
|
||||
}
|
||||
|
||||
var RouteConfig : (configs: List<RouteDefinition>) => ClassDecorator ;
|
||||
var RouteConfig : (configs: Array<RouteDefinition>) => ClassDecorator ;
|
||||
|
||||
interface ComponentDefinition {
|
||||
|
||||
|
||||
Vendored
+738
@@ -0,0 +1,738 @@
|
||||
// Type definitions for Angular v2.0.0-alpha.37
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// ***********************************************************
|
||||
// This file is generated by the Angular build process.
|
||||
// Please do not create manual edits or send pull requests
|
||||
// modifying this file.
|
||||
// ***********************************************************
|
||||
|
||||
// angular2/router depends transitively on these libraries.
|
||||
// If you don't have them installed you can install them using TSD
|
||||
// https://github.com/DefinitelyTyped/tsd
|
||||
|
||||
///<reference path="./angular2.d.ts"/>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @module
|
||||
* @description
|
||||
* Maps application URLs into application states, to support deep-linking and navigation.
|
||||
*/
|
||||
declare module ngRouter {
|
||||
|
||||
/**
|
||||
* # Router
|
||||
* The router is responsible for mapping URLs to components.
|
||||
*
|
||||
* You can see the state of the router by inspecting the read-only field `router.navigating`.
|
||||
* This may be useful for showing a spinner, for instance.
|
||||
*
|
||||
* ## Concepts
|
||||
* Routers and component instances have a 1:1 correspondence.
|
||||
*
|
||||
* The router holds reference to a number of "outlets." An outlet is a placeholder that the
|
||||
* router dynamically fills in depending on the current URL.
|
||||
*
|
||||
* When the router navigates from a URL, it must first recognizes it and serialize it into an
|
||||
* `Instruction`.
|
||||
* The router uses the `RouteRegistry` to get an `Instruction`.
|
||||
*/
|
||||
class Router {
|
||||
|
||||
navigating: boolean;
|
||||
|
||||
lastNavigationAttempt: string;
|
||||
|
||||
registry: RouteRegistry;
|
||||
|
||||
parent: Router;
|
||||
|
||||
hostComponent: any;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
|
||||
* component.
|
||||
*/
|
||||
childRouter(hostComponent: any): Router;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
|
||||
* component.
|
||||
*/
|
||||
auxRouter(hostComponent: any): Router;
|
||||
|
||||
|
||||
/**
|
||||
* Register an outlet to notified of primary route changes.
|
||||
*
|
||||
* You probably don't need to use this unless you're writing a reusable component.
|
||||
*/
|
||||
registerPrimaryOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Register an outlet to notified of auxiliary route changes.
|
||||
*
|
||||
* You probably don't need to use this unless you're writing a reusable component.
|
||||
*/
|
||||
registerAuxOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Given an instruction, returns `true` if the instruction is currently active,
|
||||
* otherwise `false`.
|
||||
*/
|
||||
isRouteActive(instruction: Instruction): boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Dynamically update the routing configuration and trigger a navigation.
|
||||
*
|
||||
* # Usage
|
||||
*
|
||||
* ```
|
||||
* router.config([
|
||||
* { 'path': '/', 'component': IndexComp },
|
||||
* { 'path': '/user/:id', 'component': UserComp },
|
||||
* ]);
|
||||
* ```
|
||||
*/
|
||||
config(definitions: RouteDefinition[]): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigate to a URL. Returns a promise that resolves when navigation is complete.
|
||||
*
|
||||
* If the given URL begins with a `/`, router will navigate absolutely.
|
||||
* If the given URL does not begin with `/`, the router will navigate relative to this component.
|
||||
*/
|
||||
navigate(url: string, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigate via the provided instruction. Returns a promise that resolves when navigation is
|
||||
* complete.
|
||||
*/
|
||||
navigateInstruction(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Updates this router and all descendant routers according to the given instruction
|
||||
*/
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Subscribe to URL updates from the router
|
||||
*/
|
||||
subscribe(onNext: (value: any) => void): Object;
|
||||
|
||||
|
||||
/**
|
||||
* Removes the contents of this router's outlet and all descendant outlets
|
||||
*/
|
||||
deactivate(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL, returns an instruction representing the component graph
|
||||
*/
|
||||
recognize(url: string): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigates to either the last URL successfully navigated to, or the last URL requested if the
|
||||
* router has yet to successfully navigate.
|
||||
*/
|
||||
renavigate(): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Generate a URL from a component name and optional map of parameters. The URL is relative to the
|
||||
* app's base href.
|
||||
*/
|
||||
generate(linkParams: any[]): Instruction;
|
||||
}
|
||||
|
||||
class RootRouter extends Router {
|
||||
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A router outlet is a placeholder that Angular dynamically fills based on the application's route.
|
||||
*
|
||||
* ## Use
|
||||
*
|
||||
* ```
|
||||
* <router-outlet></router-outlet>
|
||||
* ```
|
||||
*/
|
||||
class RouterOutlet {
|
||||
|
||||
name: string;
|
||||
|
||||
|
||||
/**
|
||||
* Called by the Router to instantiate a new component during the commit phase of a navigation.
|
||||
* This method in turn is responsible for calling the `onActivate` hook of its child.
|
||||
*/
|
||||
activate(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during the commit phase of a navigation when an outlet
|
||||
* reuses a component between different routes.
|
||||
* This method in turn is responsible for calling the `onReuse` hook of its child.
|
||||
*/
|
||||
reuse(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} when an outlet reuses a component across navigations.
|
||||
* This method in turn is responsible for calling the `onReuse` hook of its child.
|
||||
*/
|
||||
deactivate(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during recognition phase of a navigation.
|
||||
*
|
||||
* If this resolves to `false`, the given navigation is cancelled.
|
||||
*
|
||||
* This method delegates to the child component's `canDeactivate` hook if it exists,
|
||||
* and otherwise resolves to true.
|
||||
*/
|
||||
canDeactivate(nextInstruction: ComponentInstruction): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during recognition phase of a navigation.
|
||||
*
|
||||
* If the new child component has a different Type than the existing child component,
|
||||
* this will resolve to `false`. You can't reuse an old component when the new component
|
||||
* is of a different Type.
|
||||
*
|
||||
* Otherwise, this method delegates to the child component's `canReuse` hook if it exists,
|
||||
* or resolves to true if the hook is not present.
|
||||
*/
|
||||
canReuse(nextInstruction: ComponentInstruction): Promise<boolean>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouterLink directive lets you link to specific parts of your app.
|
||||
*
|
||||
* Consider the following route configuration:
|
||||
*
|
||||
* ```
|
||||
* @RouteConfig([
|
||||
* { path: '/user', component: UserCmp, as: 'user' }
|
||||
* ]);
|
||||
* class MyComp {}
|
||||
* ```
|
||||
*
|
||||
* When linking to this `user` route, you can write:
|
||||
*
|
||||
* ```
|
||||
* <a [router-link]="['./user']">link to user component</a>
|
||||
* ```
|
||||
*
|
||||
* RouterLink expects the value to be an array of route names, followed by the params
|
||||
* for that level of routing. For instance `['/team', {teamId: 1}, 'user', {userId: 2}]`
|
||||
* means that we want to generate a link for the `team` route with params `{teamId: 1}`,
|
||||
* and with a child route `user` with params `{userId: 2}`.
|
||||
*
|
||||
* The first route name should be prepended with `/`, `./`, or `../`.
|
||||
* If the route begins with `/`, the router will look up the route from the root of the app.
|
||||
* If the route begins with `./`, the router will instead look in the current component's
|
||||
* children for the route. And if the route begins with `../`, the router will look at the
|
||||
* current component's parent.
|
||||
*/
|
||||
class RouterLink {
|
||||
|
||||
visibleHref: string;
|
||||
|
||||
isRouteActive: boolean;
|
||||
|
||||
routeParams: any;
|
||||
|
||||
onClick(): boolean;
|
||||
}
|
||||
|
||||
class RouteParams {
|
||||
|
||||
params: StringMap<string, string>;
|
||||
|
||||
get(param: string): string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouteRegistry holds route configurations for each component in an Angular app.
|
||||
* It is responsible for creating Instructions from URLs, and generating URLs based on route and
|
||||
* parameters.
|
||||
*/
|
||||
class RouteRegistry {
|
||||
|
||||
|
||||
/**
|
||||
* Given a component and a configuration object, add the route to this registry
|
||||
*/
|
||||
config(parentComponent: any, config: RouteDefinition): void;
|
||||
|
||||
|
||||
/**
|
||||
* Reads the annotations of a component and configures the registry based on them
|
||||
*/
|
||||
configFromComponent(component: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL and a parent component, return the most specific instruction for navigating
|
||||
* the application into the state specified by the url
|
||||
*/
|
||||
recognize(url: string, parentComponent: any): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
|
||||
* generates a url with a leading slash relative to the provided `parentComponent`.
|
||||
*/
|
||||
generate(linkParams: any[], parentComponent: any): Instruction;
|
||||
}
|
||||
|
||||
class LocationStrategy {
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(ctx: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
onPopState(fn: (_: any) => any): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
}
|
||||
|
||||
class HashLocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
class PathLocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is the service that an application developer will directly interact with.
|
||||
*
|
||||
* Responsible for normalizing the URL against the application's base href.
|
||||
* A normalized URL is absolute from the URL host, includes the application's base href, and has no
|
||||
* trailing slash:
|
||||
* - `/my/app/user/123` is normalized
|
||||
* - `my/app/user/123` **is not** normalized
|
||||
* - `/my/app/user/123/` **is not** normalized
|
||||
*/
|
||||
class Location {
|
||||
|
||||
platformStrategy: LocationStrategy;
|
||||
|
||||
path(): string;
|
||||
|
||||
normalize(url: string): string;
|
||||
|
||||
normalizeAbsolutely(url: string): string;
|
||||
|
||||
go(url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
subscribe(onNext: (value: any) => void, onThrow?: (exception: any) => void, onReturn?: () => void): void;
|
||||
}
|
||||
|
||||
const APP_BASE_HREF : OpaqueToken ;
|
||||
|
||||
|
||||
/**
|
||||
* Responsible for performing each step of navigation.
|
||||
* "Steps" are conceptually similar to "middleware"
|
||||
*/
|
||||
class Pipeline {
|
||||
|
||||
steps: Function[];
|
||||
|
||||
process(instruction: Instruction): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onActivate], which is called by the router at the end of a
|
||||
* successful route navigation.
|
||||
*
|
||||
* For a single component's navigation, only one of either [onActivate] or [onReuse] will be called,
|
||||
* depending on the result of [canReuse].
|
||||
*
|
||||
* If `onActivate` returns a promise, the route change will wait until the promise settles to
|
||||
* instantiate and activate child components.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements OnActivate {
|
||||
* onActivate(next, prev) {
|
||||
* this.log = 'Finished navigating from ' + prev.urlPath + ' to ' + next.urlPath;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnActivate {
|
||||
|
||||
onActivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onDeactivate], which is called by the router before destroying
|
||||
* a component as part of a route change.
|
||||
*
|
||||
* If `onDeactivate` returns a promise, the route change will wait until the promise settles.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse() {
|
||||
* return true;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.params = next.params;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnDeactivate {
|
||||
|
||||
onDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onReuse], which is called by the router at the end of a
|
||||
* successful route navigation when [canReuse] is implemented and returns or resolves to true.
|
||||
*
|
||||
* For a single component's navigation, only one of either [onActivate] or [onReuse] will be called,
|
||||
* depending on the result of [canReuse].
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse() {
|
||||
* return true;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.params = next.params;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnReuse {
|
||||
|
||||
onReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canDeactivate], which is called by the router to determine
|
||||
* if a component can be removed as part of a navigation.
|
||||
*
|
||||
* If `canDeactivate` returns or resolves to `false`, the navigation is cancelled.
|
||||
*
|
||||
* If `canDeactivate` throws or rejects, the navigation is also cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanDeactivate {
|
||||
* canDeactivate(next, prev) {
|
||||
* return askUserIfTheyAreSureTheyWantToQuit();
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface CanDeactivate {
|
||||
|
||||
canDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canReuse], which is called by the router to determine whether a
|
||||
* component should be reused across routes, or whether to destroy and instantiate a new component.
|
||||
*
|
||||
* If `canReuse` returns or resolves to `true`, the component instance will be reused.
|
||||
*
|
||||
* If `canReuse` throws or rejects, the navigation will be cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse(next, prev) {
|
||||
* return next.params.id == prev.params.id;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.id = next.params.id;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface CanReuse {
|
||||
|
||||
canReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canActivate], which is called by the router to determine
|
||||
* if a component can be instantiated as part of a navigation.
|
||||
*
|
||||
* Note that unlike other lifecycle hooks, this one uses an annotation rather than an interface.
|
||||
* This is because [canActivate] is called before the component is instantiated.
|
||||
*
|
||||
* If `canActivate` returns or resolves to `false`, the navigation is cancelled.
|
||||
*
|
||||
* If `canActivate` throws or rejects, the navigation is also cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'control-panel-cmp'
|
||||
* })
|
||||
* @CanActivate(() => checkIfUserIsLoggedIn())
|
||||
* class ControlPanelCmp {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
var CanActivate : (hook: (next: ComponentInstruction, prev: ComponentInstruction) => Promise<boolean>| boolean) =>
|
||||
ClassDecorator ;
|
||||
|
||||
|
||||
/**
|
||||
* `Instruction` is a tree of `ComponentInstructions`, with all the information needed
|
||||
* to transition each component in the app to a given route, including all auxiliary routes.
|
||||
*
|
||||
* This is a public API.
|
||||
*/
|
||||
class Instruction {
|
||||
|
||||
component: ComponentInstruction;
|
||||
|
||||
child: Instruction;
|
||||
|
||||
auxInstruction: StringMap<string, Instruction>;
|
||||
|
||||
replaceChild(child: Instruction): Instruction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A `ComponentInstruction` represents the route state for a single component. An `Instruction` is
|
||||
* composed of a tree of these `ComponentInstruction`s.
|
||||
*
|
||||
* `ComponentInstructions` is a public API. Instances of `ComponentInstruction` are passed
|
||||
* to route lifecycle hooks, like {@link CanActivate}.
|
||||
*
|
||||
* `ComponentInstruction`s are [https://en.wikipedia.org/wiki/Hash_consing](hash consed). You should
|
||||
* never construct one yourself with "new." Instead, rely on {@link PathRecognizer} to construct
|
||||
* `ComponentInstruction`s.
|
||||
*
|
||||
* You should not modify this object. It should be treated as immutable.
|
||||
*/
|
||||
class ComponentInstruction {
|
||||
|
||||
reuse: boolean;
|
||||
|
||||
urlPath: string;
|
||||
|
||||
urlParams: string[];
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
componentType: any;
|
||||
|
||||
resolveComponentType(): Promise<ng.Type>;
|
||||
|
||||
specificity: any;
|
||||
|
||||
terminal: any;
|
||||
|
||||
routeData(): Object;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This class represents a parsed URL
|
||||
*/
|
||||
class Url {
|
||||
|
||||
path: string;
|
||||
|
||||
child: Url;
|
||||
|
||||
auxiliary: Url[];
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
toString(): string;
|
||||
|
||||
segmentToString(): string;
|
||||
}
|
||||
|
||||
class OpaqueToken {
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
const ROUTE_DATA : OpaqueToken ;
|
||||
|
||||
const ROUTER_DIRECTIVES : any[] ;
|
||||
|
||||
const ROUTER_BINDINGS : any[] ;
|
||||
|
||||
class Route implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
component: ng.Type;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
redirectTo: string;
|
||||
}
|
||||
|
||||
class Redirect implements RouteDefinition {
|
||||
|
||||
path: string;
|
||||
|
||||
redirectTo: string;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
data: any;
|
||||
}
|
||||
|
||||
class AuxRoute implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
component: ng.Type;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
redirectTo: string;
|
||||
}
|
||||
|
||||
class AsyncRoute implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
as: string;
|
||||
}
|
||||
|
||||
interface RouteDefinition {
|
||||
|
||||
path: string;
|
||||
|
||||
component?: ng.Type | ComponentDefinition;
|
||||
|
||||
loader?: Function;
|
||||
|
||||
redirectTo?: string;
|
||||
|
||||
as?: string;
|
||||
|
||||
data?: any;
|
||||
}
|
||||
|
||||
var RouteConfig : (configs: RouteDefinition[]) => ClassDecorator ;
|
||||
|
||||
interface ComponentDefinition {
|
||||
|
||||
type: string;
|
||||
|
||||
loader?: Function;
|
||||
|
||||
component?: ng.Type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module "angular2/router" {
|
||||
export = ngRouter;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+277
-228
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular v2.0.0-alpha.36
|
||||
// Type definitions for Angular v2.0.0-alpha.37
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -28,52 +28,75 @@ declare module ngRouter {
|
||||
/**
|
||||
* # Router
|
||||
* The router is responsible for mapping URLs to components.
|
||||
*
|
||||
*
|
||||
* You can see the state of the router by inspecting the read-only field `router.navigating`.
|
||||
* This may be useful for showing a spinner, for instance.
|
||||
*
|
||||
*
|
||||
* ## Concepts
|
||||
* Routers and component instances have a 1:1 correspondence.
|
||||
*
|
||||
*
|
||||
* The router holds reference to a number of "outlets." An outlet is a placeholder that the
|
||||
* router dynamically fills in depending on the current URL.
|
||||
*
|
||||
*
|
||||
* When the router navigates from a URL, it must first recognizes it and serialize it into an
|
||||
* `Instruction`.
|
||||
* The router uses the `RouteRegistry` to get an `Instruction`.
|
||||
*/
|
||||
class Router {
|
||||
|
||||
|
||||
navigating: boolean;
|
||||
|
||||
|
||||
lastNavigationAttempt: string;
|
||||
|
||||
|
||||
registry: RouteRegistry;
|
||||
|
||||
|
||||
parent: Router;
|
||||
|
||||
|
||||
hostComponent: any;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
|
||||
* component.
|
||||
*/
|
||||
childRouter(hostComponent: any): Router;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Register an object to notify of route changes. You probably don't need to use this unless
|
||||
* you're writing a reusable component.
|
||||
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
|
||||
* component.
|
||||
*/
|
||||
registerOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
auxRouter(hostComponent: any): Router;
|
||||
|
||||
|
||||
/**
|
||||
* Register an outlet to notified of primary route changes.
|
||||
*
|
||||
* You probably don't need to use this unless you're writing a reusable component.
|
||||
*/
|
||||
registerPrimaryOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Register an outlet to notified of auxiliary route changes.
|
||||
*
|
||||
* You probably don't need to use this unless you're writing a reusable component.
|
||||
*/
|
||||
registerAuxOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Given an instruction, returns `true` if the instruction is currently active,
|
||||
* otherwise `false`.
|
||||
*/
|
||||
isRouteActive(instruction: Instruction): boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Dynamically update the routing configuration and trigger a navigation.
|
||||
*
|
||||
*
|
||||
* # Usage
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* router.config([
|
||||
* { 'path': '/', 'component': IndexComp },
|
||||
@@ -81,129 +104,153 @@ declare module ngRouter {
|
||||
* ]);
|
||||
* ```
|
||||
*/
|
||||
config(definitions: List<RouteDefinition>): Promise<any>;
|
||||
|
||||
config(definitions: RouteDefinition[]): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigate to a URL. Returns a promise that resolves when navigation is complete.
|
||||
*
|
||||
*
|
||||
* If the given URL begins with a `/`, router will navigate absolutely.
|
||||
* If the given URL does not begin with `/`, the router will navigate relative to this component.
|
||||
*/
|
||||
navigate(url: string, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Navigate via the provided instruction. Returns a promise that resolves when navigation is
|
||||
* complete.
|
||||
*/
|
||||
navigateInstruction(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Updates this router and all descendant routers according to the given instruction
|
||||
*/
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Subscribe to URL updates from the router
|
||||
*/
|
||||
subscribe(onNext: (value: any) => void): Object;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Removes the contents of this router's outlet and all descendant outlets
|
||||
*/
|
||||
deactivate(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL, returns an instruction representing the component graph
|
||||
*/
|
||||
recognize(url: string): Promise<Instruction>;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Navigates to either the last URL successfully navigated to, or the last URL requested if the
|
||||
* router has yet to successfully navigate.
|
||||
*/
|
||||
renavigate(): Promise<any>;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generate a URL from a component name and optional map of parameters. The URL is relative to the
|
||||
* app's base href.
|
||||
*/
|
||||
generate(linkParams: List<any>): Instruction;
|
||||
generate(linkParams: any[]): Instruction;
|
||||
}
|
||||
|
||||
|
||||
class RootRouter extends Router {
|
||||
|
||||
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A router outlet is a placeholder that Angular dynamically fills based on the application's route.
|
||||
*
|
||||
*
|
||||
* ## Use
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* <router-outlet></router-outlet>
|
||||
* ```
|
||||
*/
|
||||
class RouterOutlet {
|
||||
|
||||
childRouter: Router;
|
||||
|
||||
|
||||
name: string;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given an instruction, update the contents of this outlet.
|
||||
* Called by the Router to instantiate a new component during the commit phase of a navigation.
|
||||
* This method in turn is responsible for calling the `onActivate` hook of its child.
|
||||
*/
|
||||
commit(instruction: Instruction): Promise<any>;
|
||||
|
||||
activate(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by Router during recognition phase
|
||||
* Called by the {@link Router} during the commit phase of a navigation when an outlet
|
||||
* reuses a component between different routes.
|
||||
* This method in turn is responsible for calling the `onReuse` hook of its child.
|
||||
*/
|
||||
canDeactivate(nextInstruction: Instruction): Promise<boolean>;
|
||||
|
||||
reuse(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by Router during recognition phase
|
||||
* Called by the {@link Router} when an outlet reuses a component across navigations.
|
||||
* This method in turn is responsible for calling the `onReuse` hook of its child.
|
||||
*/
|
||||
canReuse(nextInstruction: Instruction): Promise<boolean>;
|
||||
|
||||
deactivate(nextInstruction: Instruction): Promise<any>;
|
||||
deactivate(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during recognition phase of a navigation.
|
||||
*
|
||||
* If this resolves to `false`, the given navigation is cancelled.
|
||||
*
|
||||
* This method delegates to the child component's `canDeactivate` hook if it exists,
|
||||
* and otherwise resolves to true.
|
||||
*/
|
||||
canDeactivate(nextInstruction: ComponentInstruction): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during recognition phase of a navigation.
|
||||
*
|
||||
* If the new child component has a different Type than the existing child component,
|
||||
* this will resolve to `false`. You can't reuse an old component when the new component
|
||||
* is of a different Type.
|
||||
*
|
||||
* Otherwise, this method delegates to the child component's `canReuse` hook if it exists,
|
||||
* or resolves to true if the hook is not present.
|
||||
*/
|
||||
canReuse(nextInstruction: ComponentInstruction): Promise<boolean>;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The RouterLink directive lets you link to specific parts of your app.
|
||||
*
|
||||
*
|
||||
* Consider the following route configuration:
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* @RouteConfig([
|
||||
* { path: '/user', component: UserCmp, as: 'user' }
|
||||
* ]);
|
||||
* class MyComp {}
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* When linking to this `user` route, you can write:
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* <a [router-link]="['./user']">link to user component</a>
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* RouterLink expects the value to be an array of route names, followed by the params
|
||||
* for that level of routing. For instance `['/team', {teamId: 1}, 'user', {userId: 2}]`
|
||||
* means that we want to generate a link for the `team` route with params `{teamId: 1}`,
|
||||
* and with a child route `user` with params `{userId: 2}`.
|
||||
*
|
||||
*
|
||||
* The first route name should be prepended with `/`, `./`, or `../`.
|
||||
* If the route begins with `/`, the router will look up the route from the root of the app.
|
||||
* If the route begins with `./`, the router will instead look in the current component's
|
||||
@@ -211,21 +258,23 @@ declare module ngRouter {
|
||||
* current component's parent.
|
||||
*/
|
||||
class RouterLink {
|
||||
|
||||
|
||||
visibleHref: string;
|
||||
|
||||
|
||||
isRouteActive: boolean;
|
||||
|
||||
routeParams: any;
|
||||
|
||||
|
||||
onClick(): boolean;
|
||||
}
|
||||
|
||||
|
||||
class RouteParams {
|
||||
|
||||
|
||||
params: StringMap<string, string>;
|
||||
|
||||
|
||||
get(param: string): string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The RouteRegistry holds route configurations for each component in an Angular app.
|
||||
@@ -233,83 +282,83 @@ declare module ngRouter {
|
||||
* parameters.
|
||||
*/
|
||||
class RouteRegistry {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given a component and a configuration object, add the route to this registry
|
||||
*/
|
||||
config(parentComponent: any, config: RouteDefinition): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reads the annotations of a component and configures the registry based on them
|
||||
*/
|
||||
configFromComponent(component: any): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL and a parent component, return the most specific instruction for navigating
|
||||
* the application into the state specified by the url
|
||||
*/
|
||||
recognize(url: string, parentComponent: any): Promise<Instruction>;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
|
||||
* generates a url with a leading slash relative to the provided `parentComponent`.
|
||||
*/
|
||||
generate(linkParams: List<any>, parentComponent: any): Instruction;
|
||||
generate(linkParams: any[], parentComponent: any): Instruction;
|
||||
}
|
||||
|
||||
|
||||
class LocationStrategy {
|
||||
|
||||
|
||||
path(): string;
|
||||
|
||||
|
||||
pushState(ctx: any, title: string, url: string): void;
|
||||
|
||||
|
||||
forward(): void;
|
||||
|
||||
|
||||
back(): void;
|
||||
|
||||
|
||||
onPopState(fn: (_: any) => any): void;
|
||||
|
||||
|
||||
getBaseHref(): string;
|
||||
}
|
||||
|
||||
|
||||
class HashLocationStrategy extends LocationStrategy {
|
||||
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
|
||||
path(): string;
|
||||
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
|
||||
forward(): void;
|
||||
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
|
||||
class PathLocationStrategy extends LocationStrategy {
|
||||
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
|
||||
path(): string;
|
||||
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
|
||||
forward(): void;
|
||||
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This is the service that an application developer will directly interact with.
|
||||
*
|
||||
*
|
||||
* Responsible for normalizing the URL against the application's base href.
|
||||
* A normalized URL is absolute from the URL host, includes the application's base href, and has no
|
||||
* trailing slash:
|
||||
@@ -318,47 +367,49 @@ declare module ngRouter {
|
||||
* - `/my/app/user/123/` **is not** normalized
|
||||
*/
|
||||
class Location {
|
||||
|
||||
|
||||
platformStrategy: LocationStrategy;
|
||||
|
||||
path(): string;
|
||||
|
||||
|
||||
normalize(url: string): string;
|
||||
|
||||
|
||||
normalizeAbsolutely(url: string): string;
|
||||
|
||||
|
||||
go(url: string): void;
|
||||
|
||||
|
||||
forward(): void;
|
||||
|
||||
|
||||
back(): void;
|
||||
|
||||
|
||||
subscribe(onNext: (value: any) => void, onThrow?: (exception: any) => void, onReturn?: () => void): void;
|
||||
}
|
||||
|
||||
|
||||
const APP_BASE_HREF : OpaqueToken ;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Responsible for performing each step of navigation.
|
||||
* "Steps" are conceptually similar to "middleware"
|
||||
*/
|
||||
class Pipeline {
|
||||
|
||||
steps: List<Function>;
|
||||
|
||||
|
||||
steps: Function[];
|
||||
|
||||
process(instruction: Instruction): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onActivate], which is called by the router at the end of a
|
||||
* successful route navigation.
|
||||
*
|
||||
*
|
||||
* For a single component's navigation, only one of either [onActivate] or [onReuse] will be called,
|
||||
* depending on the result of [canReuse].
|
||||
*
|
||||
*
|
||||
* If `onActivate` returns a promise, the route change will wait until the promise settles to
|
||||
* instantiate and activate child components.
|
||||
*
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
@@ -372,17 +423,17 @@ declare module ngRouter {
|
||||
* ```
|
||||
*/
|
||||
interface OnActivate {
|
||||
|
||||
|
||||
onActivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onDeactivate], which is called by the router before destroying
|
||||
* a component as part of a route change.
|
||||
*
|
||||
*
|
||||
* If `onDeactivate` returns a promise, the route change will wait until the promise settles.
|
||||
*
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
@@ -392,7 +443,7 @@ declare module ngRouter {
|
||||
* canReuse() {
|
||||
* return true;
|
||||
* }
|
||||
*
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.params = next.params;
|
||||
* }
|
||||
@@ -400,18 +451,18 @@ declare module ngRouter {
|
||||
* ```
|
||||
*/
|
||||
interface OnDeactivate {
|
||||
|
||||
|
||||
onDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onReuse], which is called by the router at the end of a
|
||||
* successful route navigation when [canReuse] is implemented and returns or resolves to true.
|
||||
*
|
||||
*
|
||||
* For a single component's navigation, only one of either [onActivate] or [onReuse] will be called,
|
||||
* depending on the result of [canReuse].
|
||||
*
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
@@ -421,7 +472,7 @@ declare module ngRouter {
|
||||
* canReuse() {
|
||||
* return true;
|
||||
* }
|
||||
*
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.params = next.params;
|
||||
* }
|
||||
@@ -429,19 +480,19 @@ declare module ngRouter {
|
||||
* ```
|
||||
*/
|
||||
interface OnReuse {
|
||||
|
||||
|
||||
onReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canDeactivate], which is called by the router to determine
|
||||
* if a component can be removed as part of a navigation.
|
||||
*
|
||||
*
|
||||
* If `canDeactivate` returns or resolves to `false`, the navigation is cancelled.
|
||||
*
|
||||
*
|
||||
* If `canDeactivate` throws or rejects, the navigation is also cancelled.
|
||||
*
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
@@ -455,19 +506,19 @@ declare module ngRouter {
|
||||
* ```
|
||||
*/
|
||||
interface CanDeactivate {
|
||||
|
||||
|
||||
canDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canReuse], which is called by the router to determine whether a
|
||||
* component should be reused across routes, or whether to destroy and instantiate a new component.
|
||||
*
|
||||
*
|
||||
* If `canReuse` returns or resolves to `true`, the component instance will be reused.
|
||||
*
|
||||
*
|
||||
* If `canReuse` throws or rejects, the navigation will be cancelled.
|
||||
*
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
@@ -477,7 +528,7 @@ declare module ngRouter {
|
||||
* canReuse(next, prev) {
|
||||
* return next.params.id == prev.params.id;
|
||||
* }
|
||||
*
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.id = next.params.id;
|
||||
* }
|
||||
@@ -485,22 +536,22 @@ declare module ngRouter {
|
||||
* ```
|
||||
*/
|
||||
interface CanReuse {
|
||||
|
||||
|
||||
canReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canActivate], which is called by the router to determine
|
||||
* if a component can be instantiated as part of a navigation.
|
||||
*
|
||||
*
|
||||
* Note that unlike other lifecycle hooks, this one uses an annotation rather than an interface.
|
||||
* This is because [canActivate] is called before the component is instantiated.
|
||||
*
|
||||
*
|
||||
* If `canActivate` returns or resolves to `false`, the navigation is cancelled.
|
||||
*
|
||||
*
|
||||
* If `canActivate` throws or rejects, the navigation is also cancelled.
|
||||
*
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
@@ -514,172 +565,170 @@ declare module ngRouter {
|
||||
*/
|
||||
var CanActivate : (hook: (next: ComponentInstruction, prev: ComponentInstruction) => Promise<boolean>| boolean) =>
|
||||
ClassDecorator ;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* `Instruction` is a tree of `ComponentInstructions`, with all the information needed
|
||||
* to transition each component in the app to a given route, including all auxiliary routes.
|
||||
*
|
||||
*
|
||||
* This is a public API.
|
||||
*/
|
||||
class Instruction {
|
||||
|
||||
|
||||
component: ComponentInstruction;
|
||||
|
||||
|
||||
child: Instruction;
|
||||
|
||||
|
||||
auxInstruction: StringMap<string, Instruction>;
|
||||
|
||||
|
||||
replaceChild(child: Instruction): Instruction;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A `ComponentInstruction` represents the route state for a single component. An `Instruction` is
|
||||
* composed of a tree of these `ComponentInstruction`s.
|
||||
*
|
||||
*
|
||||
* `ComponentInstructions` is a public API. Instances of `ComponentInstruction` are passed
|
||||
* to route lifecycle hooks, like {@link CanActivate}.
|
||||
*
|
||||
* `ComponentInstruction`s are [https://en.wikipedia.org/wiki/Hash_consing](hash consed). You should
|
||||
* never construct one yourself with "new." Instead, rely on {@link PathRecognizer} to construct
|
||||
* `ComponentInstruction`s.
|
||||
*
|
||||
* You should not modify this object. It should be treated as immutable.
|
||||
*/
|
||||
class ComponentInstruction {
|
||||
|
||||
|
||||
reuse: boolean;
|
||||
|
||||
|
||||
urlPath: string;
|
||||
|
||||
urlParams: List<string>;
|
||||
|
||||
|
||||
urlParams: string[];
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
|
||||
componentType: any;
|
||||
|
||||
resolveComponentType(): Promise<Type>;
|
||||
|
||||
|
||||
resolveComponentType(): Promise<ng.Type>;
|
||||
|
||||
specificity: any;
|
||||
|
||||
|
||||
terminal: any;
|
||||
|
||||
|
||||
routeData(): Object;
|
||||
}
|
||||
|
||||
class Url {
|
||||
|
||||
path: string;
|
||||
|
||||
child: Url;
|
||||
|
||||
auxiliary: List<Url>;
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
toString(): string;
|
||||
|
||||
segmentToString(): string;
|
||||
}
|
||||
|
||||
class OpaqueToken {
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Runtime representation of a type.
|
||||
*
|
||||
* In JavaScript a Type is a constructor function.
|
||||
* This class represents a parsed URL
|
||||
*/
|
||||
interface Type extends Function {
|
||||
|
||||
new(args: any): any;
|
||||
|
||||
class Url {
|
||||
|
||||
path: string;
|
||||
|
||||
child: Url;
|
||||
|
||||
auxiliary: Url[];
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
toString(): string;
|
||||
|
||||
segmentToString(): string;
|
||||
}
|
||||
|
||||
|
||||
class OpaqueToken {
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
const ROUTE_DATA : OpaqueToken ;
|
||||
|
||||
const ROUTER_DIRECTIVES : List<any> ;
|
||||
|
||||
const ROUTER_BINDINGS : List<any> ;
|
||||
|
||||
|
||||
const ROUTER_DIRECTIVES : any[] ;
|
||||
|
||||
const ROUTER_BINDINGS : any[] ;
|
||||
|
||||
class Route implements RouteDefinition {
|
||||
|
||||
|
||||
data: any;
|
||||
|
||||
|
||||
path: string;
|
||||
|
||||
component: Type;
|
||||
|
||||
|
||||
component: ng.Type;
|
||||
|
||||
as: string;
|
||||
|
||||
|
||||
loader: Function;
|
||||
|
||||
|
||||
redirectTo: string;
|
||||
}
|
||||
|
||||
|
||||
class Redirect implements RouteDefinition {
|
||||
|
||||
|
||||
path: string;
|
||||
|
||||
|
||||
redirectTo: string;
|
||||
|
||||
|
||||
as: string;
|
||||
|
||||
|
||||
loader: Function;
|
||||
|
||||
|
||||
data: any;
|
||||
}
|
||||
|
||||
|
||||
class AuxRoute implements RouteDefinition {
|
||||
|
||||
|
||||
data: any;
|
||||
|
||||
|
||||
path: string;
|
||||
|
||||
component: Type;
|
||||
|
||||
|
||||
component: ng.Type;
|
||||
|
||||
as: string;
|
||||
|
||||
|
||||
loader: Function;
|
||||
|
||||
|
||||
redirectTo: string;
|
||||
}
|
||||
|
||||
|
||||
class AsyncRoute implements RouteDefinition {
|
||||
|
||||
|
||||
data: any;
|
||||
|
||||
|
||||
path: string;
|
||||
|
||||
|
||||
loader: Function;
|
||||
|
||||
|
||||
as: string;
|
||||
}
|
||||
|
||||
|
||||
interface RouteDefinition {
|
||||
|
||||
|
||||
path: string;
|
||||
|
||||
component?: Type | ComponentDefinition;
|
||||
|
||||
|
||||
component?: ng.Type | ComponentDefinition;
|
||||
|
||||
loader?: Function;
|
||||
|
||||
|
||||
redirectTo?: string;
|
||||
|
||||
|
||||
as?: string;
|
||||
|
||||
|
||||
data?: any;
|
||||
}
|
||||
|
||||
var RouteConfig : (configs: List<RouteDefinition>) => ClassDecorator ;
|
||||
|
||||
|
||||
var RouteConfig : (configs: RouteDefinition[]) => ClassDecorator ;
|
||||
|
||||
interface ComponentDefinition {
|
||||
|
||||
|
||||
type: string;
|
||||
|
||||
|
||||
loader?: Function;
|
||||
|
||||
component?: Type;
|
||||
|
||||
component?: ng.Type;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
declare module "angular2/router" {
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ declare module ngtoaster {
|
||||
error(params: IPopParams): void
|
||||
error(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener,
|
||||
toasterId?:number): void
|
||||
into(params: IPopParams): void
|
||||
info(params: IPopParams): void
|
||||
info(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener,
|
||||
toasterId?:number): void
|
||||
wait(params: IPopParams): void
|
||||
|
||||
Vendored
+2
-2
@@ -30,11 +30,11 @@ declare module angular.animate {
|
||||
/**
|
||||
* Globally enables / disables animations.
|
||||
*
|
||||
* @param value If provided then set the animation on or off.
|
||||
* @param element If provided then the element will be used to represent the enable/disable operation.
|
||||
* @param value If provided then set the animation on or off.
|
||||
* @returns current animation state
|
||||
*/
|
||||
enabled(value?: boolean, element?: JQuery): boolean;
|
||||
enabled(element?: JQuery, value?: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Performs an inline animation on the element.
|
||||
|
||||
Vendored
+5
@@ -10,6 +10,11 @@ declare module "angular-mocks/ngMock" {
|
||||
export = _;
|
||||
}
|
||||
|
||||
declare module "angular-mocks/ngMockE2E" {
|
||||
var _: string;
|
||||
export = _;
|
||||
}
|
||||
|
||||
declare module "angular-mocks/ngAnimateMock" {
|
||||
var _: string;
|
||||
export = _;
|
||||
|
||||
Vendored
+84
-56
@@ -1313,51 +1313,25 @@ declare module angular {
|
||||
/**
|
||||
* Runtime equivalent of the $httpProvider.defaults property. Allows configuration of default headers, withCredentials as well as request and response transformations.
|
||||
*/
|
||||
defaults: IRequestConfig;
|
||||
defaults: IHttpProviderDefaults;
|
||||
|
||||
/**
|
||||
* Array of config objects for currently pending requests. This is primarily meant to be used for debugging purposes.
|
||||
*/
|
||||
pendingRequests: any[];
|
||||
pendingRequests: IRequestConfig[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Object describing the request to be made and how it should be processed.
|
||||
* see http://docs.angularjs.org/api/ng/service/$http#usage
|
||||
*/
|
||||
interface IRequestShortcutConfig {
|
||||
interface IRequestShortcutConfig extends IHttpProviderDefaults {
|
||||
/**
|
||||
* {Object.<string|Object>}
|
||||
* Map of strings or objects which will be turned to ?key1=value1&key2=value2 after the url. If the value is not a string, it will be JSONified.
|
||||
*/
|
||||
params?: any;
|
||||
|
||||
/**
|
||||
* Map of strings or functions which return strings representing HTTP headers to send to the server. If the return value of a function is null, the header will not be sent.
|
||||
*/
|
||||
headers?: any;
|
||||
|
||||
/**
|
||||
* Name of HTTP header to populate with the XSRF token.
|
||||
*/
|
||||
xsrfHeaderName?: string;
|
||||
|
||||
/**
|
||||
* Name of cookie containing the XSRF token.
|
||||
*/
|
||||
xsrfCookieName?: string;
|
||||
|
||||
/**
|
||||
* {boolean|Cache}
|
||||
* If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching.
|
||||
*/
|
||||
cache?: any;
|
||||
|
||||
/**
|
||||
* whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information.
|
||||
*/
|
||||
withCredentials?: boolean;
|
||||
|
||||
/**
|
||||
* {string|Object}
|
||||
* Data to be sent as the request message data.
|
||||
@@ -1365,25 +1339,12 @@ declare module angular {
|
||||
data?: any;
|
||||
|
||||
/**
|
||||
* {function(data, headersGetter)|Array.<function(data, headersGetter)>}
|
||||
* Transform function or an array of such functions. The transform function takes the http request body and headers and returns its transformed (typically serialized) version.
|
||||
*/
|
||||
transformRequest?: any;
|
||||
|
||||
/**
|
||||
* {function(data, headersGetter)|Array.<function(data, headersGetter)>}
|
||||
* Transform function or an array of such functions. The transform function takes the http response body and headers and returns its transformed (typically deserialized) version.
|
||||
*/
|
||||
transformResponse?: any;
|
||||
|
||||
/**
|
||||
* {number|Promise}
|
||||
* Timeout in milliseconds, or promise that should abort the request when resolved.
|
||||
*/
|
||||
timeout?: any;
|
||||
timeout?: number|IPromise<any>;
|
||||
|
||||
/**
|
||||
* See requestType.
|
||||
* See [XMLHttpRequest.responseType]https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype
|
||||
*/
|
||||
responseType?: string;
|
||||
}
|
||||
@@ -1426,31 +1387,98 @@ declare module angular {
|
||||
then<TResult>(successCallback: (response: IHttpPromiseCallbackArg<T>) => IPromise<TResult>|TResult, errorCallback?: (response: IHttpPromiseCallbackArg<any>) => any): IPromise<TResult>;
|
||||
}
|
||||
|
||||
// See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228
|
||||
interface IHttpResquestTransformer {
|
||||
(data: any, headersGetter: IHttpHeadersGetter): any;
|
||||
}
|
||||
|
||||
// The definition of fields are the same as IHttpPromiseCallbackArg
|
||||
interface IHttpResponseTransformer {
|
||||
(data: any, headersGetter: IHttpHeadersGetter, status: number): any;
|
||||
}
|
||||
|
||||
interface IHttpRequestConfigHeaders {
|
||||
[requestType: string]: string|(() => string);
|
||||
common?: string|(() => string);
|
||||
get?: string|(() => string);
|
||||
post?: string|(() => string);
|
||||
put?: string|(() => string);
|
||||
patch?: string|(() => string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Object that controls the defaults for $http provider
|
||||
* Object that controls the defaults for $http provider. Not all fields of IRequestShortcutConfig can be configured
|
||||
* via defaults and the docs do not say which. The following is based on the inspection of the source code.
|
||||
* https://docs.angularjs.org/api/ng/service/$http#defaults
|
||||
* https://docs.angularjs.org/api/ng/service/$http#usage
|
||||
* https://docs.angularjs.org/api/ng/provider/$httpProvider The properties section
|
||||
*/
|
||||
interface IHttpProviderDefaults {
|
||||
cache?: boolean;
|
||||
/**
|
||||
* {boolean|Cache}
|
||||
* If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching.
|
||||
*/
|
||||
cache?: any;
|
||||
|
||||
/**
|
||||
* Transform function or an array of such functions. The transform function takes the http request body and
|
||||
* headers and returns its transformed (typically serialized) version.
|
||||
* @see {@link https://docs.angularjs.org/api/ng/service/$http#transforming-requests-and-responses}
|
||||
*/
|
||||
transformRequest?: ((data: any, headersGetter?: any) => any)|((data: any, headersGetter?: any) => any)[];
|
||||
xsrfCookieName?: string;
|
||||
transformRequest?: IHttpResquestTransformer |IHttpResquestTransformer[];
|
||||
|
||||
/**
|
||||
* Transform function or an array of such functions. The transform function takes the http response body and
|
||||
* headers and returns its transformed (typically deserialized) version.
|
||||
*/
|
||||
transformResponse?: IHttpResponseTransformer | IHttpResponseTransformer[];
|
||||
|
||||
/**
|
||||
* Map of strings or functions which return strings representing HTTP headers to send to the server. If the
|
||||
* return value of a function is null, the header will not be sent.
|
||||
* The key of the map is the request verb in lower case. The "common" key applies to all requests.
|
||||
* @see {@link https://docs.angularjs.org/api/ng/service/$http#setting-http-headers}
|
||||
*/
|
||||
headers?: IHttpRequestConfigHeaders;
|
||||
|
||||
/** Name of HTTP header to populate with the XSRF token. */
|
||||
xsrfHeaderName?: string;
|
||||
|
||||
/** Name of cookie containing the XSRF token. */
|
||||
xsrfCookieName?: string;
|
||||
|
||||
/**
|
||||
* whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information.
|
||||
*/
|
||||
withCredentials?: boolean;
|
||||
headers?: {
|
||||
common?: any;
|
||||
post?: any;
|
||||
put?: any;
|
||||
patch?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function used to the prepare string representation of request parameters (specified as an object). If
|
||||
* specified as string, it is interpreted as a function registered with the $injector. Defaults to
|
||||
* $httpParamSerializer.
|
||||
*/
|
||||
paramSerializer?: string | ((obj: any) => string);
|
||||
}
|
||||
|
||||
interface IHttpInterceptor {
|
||||
request?: (config: IRequestConfig) => IRequestConfig|IPromise<IRequestConfig>;
|
||||
requestError?: (rejection: any) => any;
|
||||
response?: <T>(response: IHttpPromiseCallbackArg<T>) => IPromise<T>|T;
|
||||
responseError?: (rejection: any) => any;
|
||||
}
|
||||
|
||||
interface IHttpInterceptorFactory {
|
||||
(...args: any[]): IHttpInterceptor;
|
||||
}
|
||||
|
||||
interface IHttpProvider extends IServiceProvider {
|
||||
defaults: IHttpProviderDefaults;
|
||||
interceptors: any[];
|
||||
|
||||
/**
|
||||
* Register service factories (names or implementations) for interceptors which are called before and after
|
||||
* each request.
|
||||
*/
|
||||
interceptors: (string|IHttpInterceptorFactory|(string|IHttpInterceptorFactory)[])[];
|
||||
useApplyAsync(): boolean;
|
||||
useApplyAsync(value: boolean): IHttpProvider;
|
||||
|
||||
@@ -1694,7 +1722,7 @@ declare module angular {
|
||||
interface IInjectorService {
|
||||
annotate(fn: Function): string[];
|
||||
annotate(inlineAnnotatedFunction: any[]): string[];
|
||||
get<T>(name: string): T;
|
||||
get<T>(name: string, caller?: string): T;
|
||||
has(name: string): boolean;
|
||||
instantiate<T>(typeConstructor: Function, locals?: any): T;
|
||||
invoke(inlineAnnotatedFunction: any[]): any;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
module Analytics {
|
||||
angular.module("angulartics.app", ["angulartics"])
|
||||
.config(["$analyticsProvider", ($analyticsProvider: Angulartics.IAnalyticsServiceProvider) => {
|
||||
.config(["$analyticsProvider", ($analyticsProvider:angulartics.IAnalyticsServiceProvider) => {
|
||||
angulartics.waitForVendorApi("location", 1000, (message: string) => {
|
||||
console.log(message);
|
||||
});
|
||||
@@ -17,9 +17,8 @@ module Analytics {
|
||||
console.log(action);
|
||||
});
|
||||
|
||||
$analyticsProvider.registerPageTrack((path: string, locationObj: ng.ILocationService) => {
|
||||
$analyticsProvider.registerPageTrack((path:string, locationObj:angular.ILocationService) => {
|
||||
console.log("viewed " + path);
|
||||
});
|
||||
}]);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+7
-8
@@ -4,16 +4,15 @@
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
declare module angulartics {
|
||||
|
||||
interface Angulartics {
|
||||
waitForVendorApi(objectName: string, delay: number, containsField?: any, registerFn?: any, onTimeout?: boolean): void;
|
||||
}
|
||||
|
||||
declare module Angulartics {
|
||||
interface IAngularticsStatic {
|
||||
waitForVendorApi(objectName:string, delay:number, containsField?:any, registerFn?:any, onTimeout?:boolean): void;
|
||||
}
|
||||
|
||||
interface IAnalyticsService {
|
||||
eventTrack(eventName: string, properties?: any): any;
|
||||
pageTrack(path: string, location?: ng.ILocationService): any;
|
||||
pageTrack(path:string, location?:angular.ILocationService): any;
|
||||
setAlias(alias: string): any;
|
||||
setUsername(username: string): any;
|
||||
setUserProperties(properties: any): any;
|
||||
@@ -27,7 +26,7 @@ declare module Angulartics {
|
||||
withAutoBase(value: boolean): void;
|
||||
developerMode(value: boolean): void;
|
||||
|
||||
registerPageTrack(callback: (path: string, location?: ng.ILocationService) => any): void;
|
||||
registerPageTrack(callback:(path:string, location?:angular.ILocationService) => any): void;
|
||||
registerEventTrack(callback: (eventName: string, properties?: any) => any): void;
|
||||
registerSetAlias(callback: (alias: string) => any): void
|
||||
registerSetUsername(callback: (username: string) => any): void
|
||||
@@ -36,4 +35,4 @@ declare module Angulartics {
|
||||
}
|
||||
}
|
||||
|
||||
declare var angulartics:Angulartics;
|
||||
declare var angulartics:angulartics.IAngularticsStatic;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path="archiver.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import Archiver = require('archiver');
|
||||
import FS = require('fs');
|
||||
|
||||
var archiver = Archiver.create('zip');
|
||||
|
||||
var writeStream = FS.createWriteStream('./archiver.d.ts');
|
||||
var readStream = FS.createReadStream('./archiver.d.ts');
|
||||
|
||||
archiver.pipe(writeStream);
|
||||
archiver.append(readStream, {name: 'archiver.d.ts'});
|
||||
archiver.finalize();
|
||||
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
// Type definitions for archiver v0.15.0
|
||||
// Project: https://github.com/archiverjs/node-archiver
|
||||
// Definitions by: Esri <https://github.com/archiverjs/node-archiver>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/* =================== USAGE ===================
|
||||
|
||||
import Archiver = require('archiver);
|
||||
var archiver = Archiver.create('zip');
|
||||
archiver.pipe(FS.createWriteStream('xxx'));
|
||||
archiver.append(FS.createReadStream('xxx'));
|
||||
archiver.finalize();
|
||||
|
||||
=============================================== */
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
declare module "archiver" {
|
||||
import * as FS from 'fs';
|
||||
|
||||
interface nameInterface {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface Archiver {
|
||||
pipe(writeStream: FS.WriteStream): void;
|
||||
append(readStream: FS.ReadStream, name: nameInterface): void;
|
||||
finalize(): void;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
|
||||
}
|
||||
|
||||
function archiver(format: string, options?: Options): Archiver;
|
||||
|
||||
namespace archiver {
|
||||
function create(format: string, options?: Options): Archiver;
|
||||
}
|
||||
|
||||
export = archiver;
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./async.d.ts" />
|
||||
|
||||
import async = require("async");
|
||||
|
||||
async.map(["a", "b", "c"], (item, cb) => cb(null, [item.toUpperCase()]), (err, results) => { });
|
||||
async.map(["a", "b", "c"], (item, cb) => cb(null, [item.toUpperCase()]), (err, results) => { });
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path="better-curry.d.ts" />
|
||||
|
||||
import bc = require('better-curry');
|
||||
bc.flatten([1,2,3,[1,2],['a']]) === [];
|
||||
bc.MAX_OPTIMIZED = 5;
|
||||
|
||||
function fn(...args: number[]): number[] {
|
||||
return [].concat([1]);
|
||||
}
|
||||
|
||||
function fn2(arg1: string, arg2: any): number {
|
||||
return parseInt(arg1 + String(arg2)) + 1;
|
||||
}
|
||||
|
||||
bc.predefine(fn, [1,2])() === [];
|
||||
bc.predefine(fn, [1,2]).__length === 3;
|
||||
|
||||
var f = bc.wrap(fn2, {}, 10, true);
|
||||
f('1', 2) === 3;
|
||||
|
||||
var delegate = bc.delegate({}, 'ok');
|
||||
delegate.access('ok') === delegate;
|
||||
delegate.getter('getter').setter('setter') === delegate;
|
||||
delegate.all(['1','2']);
|
||||
delegate.revoke('adsf').access('asdf');
|
||||
|
||||
BetterCurry.wrap(fn2, {}, -1, false).__length === 10;
|
||||
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
// Type definitions for better-curry
|
||||
// Project: https://github.com/pocesar/js-bettercurry
|
||||
// Definitions by: Paulo Cesar <https://github.com/pocesar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare var BetterCurry: BetterCurryModule.BetterCurry;
|
||||
|
||||
declare module BetterCurryModule {
|
||||
|
||||
export interface DelegateOptions {
|
||||
as?: string;
|
||||
len?: number;
|
||||
args?: any[];
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export class Delegate<T> {
|
||||
proto: T;
|
||||
target: string;
|
||||
methods: any[];
|
||||
getters: any[];
|
||||
setters: any[];
|
||||
all: (skip?: string[]) => void;
|
||||
method: (name: string|DelegateOptions) => Delegate<T>;
|
||||
getter: (name: string|DelegateOptions) => Delegate<T>;
|
||||
setter: (name: string|DelegateOptions) => Delegate<T>;
|
||||
access: (name: string|DelegateOptions) => Delegate<T>;
|
||||
revoke: (name: string) => Delegate<T>;
|
||||
constructor(proto: T, target: string);
|
||||
}
|
||||
|
||||
export interface OriginalFunctionReminder<T> extends Function {
|
||||
__length: number;
|
||||
}
|
||||
|
||||
export interface BetterCurry {
|
||||
predefine: <T extends Function>(fn: T, args: any[], context?: Object, len?: number, checkArguments?: boolean) => OriginalFunctionReminder<T>;
|
||||
wrap: <T extends Function>(fn: T, context?: Object, len?: number, checkArguments?: boolean) => OriginalFunctionReminder<T>;
|
||||
flatten: (...args: Array<Array<any>|any>) => any[];
|
||||
delegate: <T>(proto: T, target: string) => Delegate<T>;
|
||||
MAX_OPTIMIZED: number;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module 'better-curry' {
|
||||
var bc: BetterCurryModule.BetterCurry;
|
||||
|
||||
export = bc;
|
||||
}
|
||||
Vendored
+2
-2
@@ -6,7 +6,7 @@
|
||||
|
||||
declare module BigJsLibrary {
|
||||
|
||||
export enum RoundingMode {
|
||||
export const enum RoundingMode {
|
||||
RoundTowardsZero = 0,
|
||||
RoundTowardsNearestAwayFromZero = 1,
|
||||
RoundTowardsNearestTowardsEven = 2,
|
||||
@@ -200,4 +200,4 @@ declare module BigJsLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
declare var Big: BigJsLibrary.BigJS;
|
||||
declare var Big: BigJsLibrary.BigJS;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/// <reference path="bluebird-retry.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
import Promise = require('bluebird');
|
||||
import retry = require('bluebird-retry');
|
||||
|
||||
function promiseSuccess(text:string) {
|
||||
return Promise.resolve(text);
|
||||
};
|
||||
|
||||
var count = 0;
|
||||
function myfunc() {
|
||||
console.log('myfunc called ' + (++count) + ' times');
|
||||
if (count < 3) {
|
||||
throw new Error('i fail the first two times');
|
||||
} else {
|
||||
return promiseSuccess('i succeed the third time');
|
||||
}
|
||||
}
|
||||
|
||||
retry(myfunc)
|
||||
.done(function(result) { console.log(result); } );
|
||||
|
||||
|
||||
//Options example
|
||||
function logFail() {
|
||||
console.log(new Date().toISOString());
|
||||
throw new Error('bail');
|
||||
}
|
||||
|
||||
var options:retry.Options = {
|
||||
max_tries: 4,
|
||||
interval: 500
|
||||
};
|
||||
|
||||
retry(logFail, options);
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for bluebird-retry
|
||||
// Project: https://github.com/jut-io/bluebird-retry
|
||||
// Definitions by: Pascal Vomhoff <https://github.com/pvomhoff>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
declare module "bluebird-retry" {
|
||||
import Promise = require('bluebird');
|
||||
|
||||
function retry<T>(func:(param:T)=>void, options?:retry.Options):Promise<T>;
|
||||
|
||||
module retry {
|
||||
export interface Options {
|
||||
interval?:number;
|
||||
backoff?:number;
|
||||
max_interval?:number;
|
||||
timeout?:number;
|
||||
max_tries?:number;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export = retry;
|
||||
}
|
||||
+7
@@ -137,6 +137,13 @@ interface JQueryEventObject {
|
||||
value: number|ChangeValue;
|
||||
}
|
||||
|
||||
interface SliderStatics {
|
||||
new (selector: string, opts: SliderOptions): Slider;
|
||||
prototype: Slider;
|
||||
}
|
||||
|
||||
declare var Slider: SliderStatics;
|
||||
|
||||
/**
|
||||
* This class is actually not used when using the jQuery version of bootstrap-slider
|
||||
* The method documentation is still here thouh.
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/// <reference path="./bowser.d.ts" />
|
||||
|
||||
import Bowser = require('bowser');
|
||||
|
||||
Bowser.msedge === true;
|
||||
Bowser.test(['msie']) === true;
|
||||
Bowser.a === Bowser.c;
|
||||
Bowser.osversion > 10;
|
||||
Bowser.osversion === '10.1A';
|
||||
Bowser.osversion === '10.1A';
|
||||
|
||||
+13
-7
@@ -11,7 +11,7 @@ function test_dataType() {
|
||||
var x = typ.parentEnum === <breeze.core.IEnum> breeze.DataType;
|
||||
var isFalse = breeze.DataType.contains(breeze.DataType.Double);
|
||||
var dt = breeze.DataType.fromName("Decimal");
|
||||
|
||||
|
||||
}
|
||||
|
||||
function test_dataProperty() {
|
||||
@@ -33,7 +33,7 @@ function test_dataService() {
|
||||
var em = new breeze.EntityManager({
|
||||
dataService: ds
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function test_entityAspect() {
|
||||
@@ -69,7 +69,7 @@ function test_entityAspect() {
|
||||
var errorsAdded = validationChangeArgs.added;
|
||||
var errorsCleared = validationChangeArgs.removed;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function test_entityKey() {
|
||||
@@ -132,7 +132,7 @@ function test_entityManager() {
|
||||
serviceName: "breeze/NorthwindIBModel",
|
||||
metadataStore: metadataStore
|
||||
});
|
||||
|
||||
|
||||
return new breeze.QueryOptions({
|
||||
mergeStrategy: null,
|
||||
fetchStrategy: this.fetchStrategy
|
||||
@@ -157,7 +157,7 @@ function test_entityManager() {
|
||||
|
||||
var cust2 = em1.createEntity("Customer", { companyName: "foo" });
|
||||
var cust3 = em1.createEntity("foo", { xxx: 3 }, breeze.EntityState.Added);
|
||||
|
||||
|
||||
em1.attachEntity(cust1, breeze.EntityState.Added);
|
||||
em1.clear();
|
||||
var em2 = em1.createEmptyCopy();
|
||||
@@ -246,7 +246,7 @@ function test_entityManager() {
|
||||
var custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer");
|
||||
var orderType = <breeze.EntityType> em1.metadataStore.getEntityType("Order");
|
||||
if (em1.hasChanges([custType, orderType])) { };
|
||||
|
||||
|
||||
var bundle = em1.exportEntities();
|
||||
window.localStorage.setItem("myEntityManager", bundle);
|
||||
var bundleFromStorage = window.localStorage.getItem("myEntityManager");
|
||||
@@ -434,7 +434,7 @@ function test_entityState() {
|
||||
return es === breeze.EntityState.Unchanged;
|
||||
var es = anEntity.entityAspect.entityState;
|
||||
return es.isUnchangedOrModified();
|
||||
|
||||
|
||||
return es === breeze.EntityState.Unchanged || es === breeze.EntityState.Modified;
|
||||
}
|
||||
|
||||
@@ -443,12 +443,14 @@ function test_entityType() {
|
||||
var myEntityType: breeze.EntityType;
|
||||
var dataProperty1: breeze.DataProperty, dataProperty2: breeze.DataProperty, navigationProperty1: breeze.DataProperty;
|
||||
var em1: breeze.EntityManager;
|
||||
/* NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
|
||||
var entityManager = new breeze.EntityType({
|
||||
metadataStore: myMetadataStore,
|
||||
serviceName: "breeze/NorthwindIBModel",
|
||||
name: "person",
|
||||
namespace: "myAppNamespace"
|
||||
});
|
||||
*/
|
||||
myEntityType.addProperty(dataProperty1);
|
||||
myEntityType.addProperty(dataProperty2);
|
||||
myEntityType.addProperty(navigationProperty1);
|
||||
@@ -759,9 +761,11 @@ function test_validator() {
|
||||
orderType = <breeze.EntityType> em1.metadataStore.getEntityType("Order");
|
||||
var orderDateProperty = orderType.getProperty("OrderDate");
|
||||
orderDateProperty.validators.push(breeze.Validator.date());
|
||||
/* NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
|
||||
var v0 = breeze.Validator.maxLength({ maxLength: 5, displayName: "City" });
|
||||
v0.validate("adasdfasdf");
|
||||
var errMessage = v0.getMessage();
|
||||
*/
|
||||
custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer");
|
||||
var customerIdProperty = custType.getProperty("CustomerID");
|
||||
customerIdProperty.validators.push(breeze.Validator.guid());
|
||||
@@ -788,6 +792,7 @@ function test_validator() {
|
||||
regionProperty.validators.push(breeze.Validator.string());
|
||||
custType = <breeze.EntityType> em1.metadataStore.getEntityType("Customer");
|
||||
regionProperty = custType.getProperty("Region");
|
||||
/* NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
|
||||
regionProperty.validators.push(breeze.Validator.stringLength({ minLength: 2, maxLength: 5 }));
|
||||
var validator = breeze.Validator.maxLength({ maxLength: 5, displayName: "City" });
|
||||
var result = validator.validate("asdf");
|
||||
@@ -796,6 +801,7 @@ function test_validator() {
|
||||
var errMsg = result.errorMessage;
|
||||
var context = result.context;
|
||||
var sameValidator = result.validator;
|
||||
*/
|
||||
var valFn = function (v: any) {
|
||||
if (v == null) return true;
|
||||
return (v.substr(0,2) === "US");
|
||||
|
||||
Vendored
+308
@@ -0,0 +1,308 @@
|
||||
// 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>,
|
||||
// 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
|
||||
*/
|
||||
use(fn: (chai: any, utils: any) => void): any;
|
||||
assert: AssertStatic;
|
||||
config: Config;
|
||||
}
|
||||
|
||||
export interface ExpectStatic extends AssertionStatic {
|
||||
}
|
||||
|
||||
export interface AssertStatic extends Assert {
|
||||
}
|
||||
|
||||
export interface AssertionStatic {
|
||||
(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;
|
||||
a: TypeComparison;
|
||||
an: TypeComparison;
|
||||
include: Include;
|
||||
contain: Include;
|
||||
ok: Assertion;
|
||||
true: Assertion;
|
||||
false: Assertion;
|
||||
null: Assertion;
|
||||
undefined: Assertion;
|
||||
exist: Assertion;
|
||||
empty: Assertion;
|
||||
arguments: Assertion;
|
||||
Arguments: Assertion;
|
||||
equal: Equal;
|
||||
equals: Equal;
|
||||
eq: Equal;
|
||||
eql: Equal;
|
||||
eqls: Equal;
|
||||
property: Property;
|
||||
ownProperty: OwnProperty;
|
||||
haveOwnProperty: OwnProperty;
|
||||
length: Length;
|
||||
lengthOf: Length;
|
||||
match(regexp: RegExp|string, message?: string): Assertion;
|
||||
string(string: string, message?: string): Assertion;
|
||||
keys: Keys;
|
||||
key(string: string): Assertion;
|
||||
throw: Throw;
|
||||
throws: Throw;
|
||||
Throw: Throw;
|
||||
respondTo(method: string, message?: string): Assertion;
|
||||
itself: Assertion;
|
||||
satisfy(matcher: Function, message?: string): Assertion;
|
||||
closeTo(expected: number, delta: number, message?: string): Assertion;
|
||||
members: Members;
|
||||
}
|
||||
|
||||
interface LanguageChains {
|
||||
to: Assertion;
|
||||
be: Assertion;
|
||||
been: Assertion;
|
||||
is: Assertion;
|
||||
that: Assertion;
|
||||
which: Assertion;
|
||||
and: Assertion;
|
||||
has: Assertion;
|
||||
have: Assertion;
|
||||
with: Assertion;
|
||||
at: Assertion;
|
||||
of: Assertion;
|
||||
same: Assertion;
|
||||
}
|
||||
|
||||
interface NumericComparison {
|
||||
above: NumberComparer;
|
||||
gt: NumberComparer;
|
||||
greaterThan: NumberComparer;
|
||||
least: NumberComparer;
|
||||
gte: NumberComparer;
|
||||
below: NumberComparer;
|
||||
lt: NumberComparer;
|
||||
lessThan: NumberComparer;
|
||||
most: NumberComparer;
|
||||
lte: NumberComparer;
|
||||
within(start: number, finish: number, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface NumberComparer {
|
||||
(value: number, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface TypeComparison {
|
||||
(type: string, message?: string): Assertion;
|
||||
instanceof: InstanceOf;
|
||||
instanceOf: InstanceOf;
|
||||
}
|
||||
|
||||
interface InstanceOf {
|
||||
(constructor: Object, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Deep {
|
||||
equal: Equal;
|
||||
include: Include;
|
||||
property: Property;
|
||||
}
|
||||
|
||||
interface Equal {
|
||||
(value: any, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Property {
|
||||
(name: string, value?: any, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface OwnProperty {
|
||||
(name: string, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Length extends LanguageChains, NumericComparison {
|
||||
(length: number, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Include {
|
||||
(value: Object, message?: string): Assertion;
|
||||
(value: string, message?: string): Assertion;
|
||||
(value: number, message?: string): Assertion;
|
||||
keys: Keys;
|
||||
members: Members;
|
||||
}
|
||||
|
||||
interface Keys {
|
||||
(...keys: string[]): Assertion;
|
||||
(keys: any[]): Assertion;
|
||||
}
|
||||
|
||||
interface Throw {
|
||||
(): Assertion;
|
||||
(expected: string, message?: string): Assertion;
|
||||
(expected: RegExp, message?: string): Assertion;
|
||||
(constructor: Error, expected?: string, message?: string): Assertion;
|
||||
(constructor: Error, expected?: RegExp, message?: string): Assertion;
|
||||
(constructor: Function, expected?: string, message?: string): Assertion;
|
||||
(constructor: Function, expected?: RegExp, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Members {
|
||||
(set: any[], message?: string): Assertion;
|
||||
}
|
||||
|
||||
export interface Assert {
|
||||
/**
|
||||
* @param expression Expression to test for truthiness.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
(expression: any, message?: string): void;
|
||||
|
||||
fail(actual?: any, expected?: any, msg?: string, operator?: string): void;
|
||||
|
||||
ok(val: any, msg?: string): void;
|
||||
notOk(val: any, msg?: string): void;
|
||||
|
||||
equal(act: any, exp: any, msg?: string): void;
|
||||
notEqual(act: any, exp: any, msg?: string): void;
|
||||
|
||||
strictEqual(act: any, exp: any, msg?: string): void;
|
||||
notStrictEqual(act: any, exp: any, msg?: string): void;
|
||||
|
||||
deepEqual(act: any, exp: any, msg?: string): void;
|
||||
notDeepEqual(act: any, exp: any, msg?: string): void;
|
||||
|
||||
isTrue(val: any, msg?: string): void;
|
||||
isFalse(val: any, msg?: string): void;
|
||||
|
||||
isNull(val: any, msg?: string): void;
|
||||
isNotNull(val: any, msg?: string): void;
|
||||
|
||||
isUndefined(val: any, msg?: string): void;
|
||||
isDefined(val: any, msg?: string): void;
|
||||
|
||||
isFunction(val: any, msg?: string): void;
|
||||
isNotFunction(val: any, msg?: string): void;
|
||||
|
||||
isObject(val: any, msg?: string): void;
|
||||
isNotObject(val: any, msg?: string): void;
|
||||
|
||||
isArray(val: any, msg?: string): void;
|
||||
isNotArray(val: any, msg?: string): void;
|
||||
|
||||
isString(val: any, msg?: string): void;
|
||||
isNotString(val: any, msg?: string): void;
|
||||
|
||||
isNumber(val: any, msg?: string): void;
|
||||
isNotNumber(val: any, msg?: string): void;
|
||||
|
||||
isBoolean(val: any, msg?: string): void;
|
||||
isNotBoolean(val: any, msg?: string): void;
|
||||
|
||||
typeOf(val: any, type: string, msg?: string): void;
|
||||
notTypeOf(val: any, type: string, msg?: string): void;
|
||||
|
||||
instanceOf(val: any, type: Function, msg?: string): void;
|
||||
notInstanceOf(val: any, type: Function, msg?: string): void;
|
||||
|
||||
include(exp: string, inc: any, msg?: string): void;
|
||||
include(exp: any[], inc: any, msg?: string): void;
|
||||
|
||||
notInclude(exp: string, inc: any, msg?: string): void;
|
||||
notInclude(exp: any[], inc: any, msg?: string): void;
|
||||
|
||||
match(exp: any, re: RegExp, msg?: string): void;
|
||||
notMatch(exp: any, re: RegExp, msg?: string): void;
|
||||
|
||||
property(obj: Object, prop: string, msg?: string): void;
|
||||
notProperty(obj: Object, prop: string, msg?: string): void;
|
||||
deepProperty(obj: Object, prop: string, msg?: string): void;
|
||||
notDeepProperty(obj: Object, prop: string, msg?: string): void;
|
||||
|
||||
propertyVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||
propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||
|
||||
deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||
deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||
|
||||
lengthOf(exp: any, len: number, msg?: string): void;
|
||||
//alias frenzy
|
||||
throw(fn: Function, msg?: string): void;
|
||||
throw(fn: Function, regExp: RegExp): void;
|
||||
throw(fn: Function, errType: Function, msg?: string): void;
|
||||
throw(fn: Function, errType: Function, regExp: RegExp): void;
|
||||
|
||||
throws(fn: Function, msg?: string): void;
|
||||
throws(fn: Function, regExp: RegExp): void;
|
||||
throws(fn: Function, errType: Function, msg?: string): void;
|
||||
throws(fn: Function, errType: Function, regExp: RegExp): void;
|
||||
|
||||
Throw(fn: Function, msg?: string): void;
|
||||
Throw(fn: Function, regExp: RegExp): void;
|
||||
Throw(fn: Function, errType: Function, msg?: string): void;
|
||||
Throw(fn: Function, errType: Function, regExp: RegExp): void;
|
||||
|
||||
doesNotThrow(fn: Function, msg?: string): void;
|
||||
doesNotThrow(fn: Function, regExp: RegExp): void;
|
||||
doesNotThrow(fn: Function, errType: Function, msg?: string): void;
|
||||
doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void;
|
||||
|
||||
operator(val: any, operator: string, val2: any, msg?: string): void;
|
||||
closeTo(act: number, exp: number, delta: number, msg?: string): void;
|
||||
|
||||
sameMembers(set1: any[], set2: any[], msg?: string): void;
|
||||
includeMembers(set1: any[], set2: any[], msg?: string): void;
|
||||
|
||||
ifError(val: any, msg?: string): void;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
includeStack: boolean;
|
||||
}
|
||||
|
||||
export class AssertionError {
|
||||
constructor(message: string, _props?: any, ssf?: Function);
|
||||
name: string;
|
||||
message: string;
|
||||
showDiff: boolean;
|
||||
stack: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare var chai: Chai.ChaiStatic;
|
||||
|
||||
declare module "chai" {
|
||||
export = chai;
|
||||
}
|
||||
|
||||
interface Object {
|
||||
should: Chai.Assertion;
|
||||
}
|
||||
+248
-42
@@ -31,6 +31,16 @@ function fail() {
|
||||
err(() => {
|
||||
should.fail('foo', 'bar', 'should fail', 'equal');
|
||||
}, 'expected fail to throw an AssertionError');
|
||||
|
||||
err(() => {
|
||||
expect.fail('foo', 'bar');
|
||||
}, 'expected fail to throw an AssertionError');
|
||||
err(() => {
|
||||
expect.fail('foo', 'bar', 'should fail');
|
||||
}, 'expected fail to throw an AssertionError');
|
||||
err(() => {
|
||||
expect.fail('foo', 'bar', 'should fail', 'equal');
|
||||
}, 'expected fail to throw an AssertionError');
|
||||
}
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
@@ -107,11 +117,20 @@ function _undefined() {
|
||||
}, 'expected \'\' to be undefined');
|
||||
}
|
||||
|
||||
function _NaN() {
|
||||
expect(NaN).to.be.NaN;
|
||||
expect(12).to.be.not.NaN;
|
||||
expect("NaN").to.be.not.NaN;
|
||||
(NaN).should.be.NaN;
|
||||
(12).should.be.not.NaN;
|
||||
("NaN").should.be.not.NaN;
|
||||
}
|
||||
|
||||
function exist() {
|
||||
var foo = 'bar';
|
||||
expect(foo).to.exist;
|
||||
should.exist(foo);
|
||||
expect(void(0)).to.not.exist;
|
||||
expect(void (0)).to.not.exist;
|
||||
should.not.exist(void (0));
|
||||
}
|
||||
|
||||
@@ -128,8 +147,8 @@ function argumentsTest() {
|
||||
}
|
||||
|
||||
function equal() {
|
||||
expect(undefined).to.equal(void(0));
|
||||
should.equal(undefined, void(0));
|
||||
expect(undefined).to.equal(void (0));
|
||||
should.equal(undefined, void (0));
|
||||
}
|
||||
|
||||
function _typeof() {
|
||||
@@ -372,6 +391,9 @@ function match() {
|
||||
expect('foobar').to.not.match(/^bar/);
|
||||
'foobar'.should.not.match(/^bar/);
|
||||
|
||||
expect('foobar').matches(/^foo/);
|
||||
'foobar'.should.not.matches(/^bar/);
|
||||
|
||||
err(() => {
|
||||
expect('foobar').to.match(/^bar/i, 'blah');
|
||||
'foobar'.should.match(/^bar/i, 'blah');
|
||||
@@ -490,8 +512,8 @@ function deepEqual3() {
|
||||
function deepInclude() {
|
||||
expect(['foo', 'bar']).to.deep.include(['bar', 'foo']);
|
||||
['foo', 'bar'].should.deep.include(['bar', 'foo']);
|
||||
expect(['foo', 'bar']).not.to.deep.equal(['foo', 'baz' ]);
|
||||
['foo', 'bar'].should.not.deep.equal(['foo', 'baz' ]);
|
||||
expect(['foo', 'bar']).not.to.deep.equal(['foo', 'baz']);
|
||||
['foo', 'bar'].should.not.deep.equal(['foo', 'baz']);
|
||||
}
|
||||
|
||||
class FakeArgs {
|
||||
@@ -670,6 +692,20 @@ function ownProperty() {
|
||||
}, 'blah: expected { length: 12 } to not have own property \'length\'');
|
||||
}
|
||||
|
||||
function ownPropertyDescriptor() {
|
||||
expect('test').to.have.ownPropertyDescriptor('length');
|
||||
expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 });
|
||||
expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 });
|
||||
expect('test').to.haveOwnPropertyDescriptor('length').to.have.property('enumerable', false);
|
||||
expect('test').to.haveOwnPropertyDescriptor('length').to.contain.keys('value');
|
||||
|
||||
'test'.should.have.ownPropertyDescriptor('length');
|
||||
'test'.should.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 });
|
||||
'test'.should.not.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 });
|
||||
'test'.should.haveOwnPropertyDescriptor('length').to.have.property('enumerable', false);
|
||||
'test'.should.haveOwnPropertyDescriptor('length').to.contain.keys('value');
|
||||
}
|
||||
|
||||
function string() {
|
||||
expect('foobar').to.have.string('bar');
|
||||
'foobar'.should.have.string('bar');
|
||||
@@ -707,6 +743,10 @@ function include() {
|
||||
['foo', 'bar'].should.not.include('baz');
|
||||
expect(['foo', 'bar']).to.not.include(1);
|
||||
['foo', 'bar'].should.not.include(1);
|
||||
// alias
|
||||
|
||||
expect(['foo', 'bar']).includes('foo');
|
||||
['foo', 'bar'].should.includes('foo');
|
||||
|
||||
err(() => {
|
||||
expect(['foo']).to.include('bar', 'blah');
|
||||
@@ -732,6 +772,14 @@ function keys() {
|
||||
({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('bar', 'foo');
|
||||
expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('baz');
|
||||
({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('baz');
|
||||
// alias
|
||||
|
||||
expect({ foo: 1, bar: 2, baz: 3 }).contains.keys('baz');
|
||||
|
||||
expect({ foo: 1, bar: 2 }).to.have.all.keys(['foo', 'bar']);
|
||||
expect({ foo: 1, bar: 2 }).to.have.any.keys(['foo', 'bar']);
|
||||
({ foo: 1, bar: 2, baz: 3 }).should.contain.all.keys('baz');
|
||||
({ foo: 1, bar: 2, baz: 3 }).should.contain.any.keys('baz');
|
||||
|
||||
expect({ foo: 1, bar: 2 }).to.contain.keys('foo');
|
||||
({ foo: 1, bar: 2 }).should.contain.keys('foo');
|
||||
@@ -830,7 +878,28 @@ function chaining() {
|
||||
tea.should.be.a('object').and.have.property('name', 'chai');
|
||||
}
|
||||
|
||||
class PoorlyConstructedError {}
|
||||
function exxtensible() {
|
||||
expect({}).to.be.extensible;
|
||||
expect(Object.preventExtensions({})).to.be.not.extensible;
|
||||
({}).should.be.extensible;
|
||||
Object.preventExtensions({}).should.not.be.extensible;
|
||||
}
|
||||
function sealed() {
|
||||
expect({}).to.be.not.sealed;
|
||||
expect(Object.seal({})).to.be.sealed;
|
||||
({}).should.be.not.sealed;
|
||||
Object.seal({}).should.be.sealed;
|
||||
}
|
||||
|
||||
function frozen() {
|
||||
expect({}).to.be.not.frozen;
|
||||
expect(Object.freeze({})).to.be.frozen;
|
||||
({}).should.be.not.frozen;
|
||||
Object.freeze({}).should.be.frozen;
|
||||
}
|
||||
|
||||
|
||||
class PoorlyConstructedError { }
|
||||
function _throw() {
|
||||
// See GH-45: some poorly-constructed custom errors don't have useful names
|
||||
// on either their constructor or their constructor prototype, but instead
|
||||
@@ -1023,34 +1092,44 @@ function _throw() {
|
||||
}, 'blah: expected [Function] to throw error including \'hello\' but got \'testing\'');
|
||||
}
|
||||
|
||||
function use(){
|
||||
function use() {
|
||||
// ReSharper disable once InconsistentNaming
|
||||
chai.use((_chai) => {
|
||||
_chai.can.use.any();
|
||||
_chai.can.use.any();
|
||||
});
|
||||
}
|
||||
|
||||
class Klass {
|
||||
val: number;
|
||||
constructor() { this.val = 0; }
|
||||
bar() { }
|
||||
|
||||
static baz() { }
|
||||
}
|
||||
|
||||
function respondTo() {
|
||||
var bar = {};
|
||||
var obj = new Klass();
|
||||
|
||||
expect(Foo).to.respondTo('bar');
|
||||
Foo.should.respondTo('bar');
|
||||
expect(Foo).to.not.respondTo('foo');
|
||||
Foo.should.not.respondTo('foo');
|
||||
expect(Foo).itself.to.respondTo('func');
|
||||
expect(Foo).itself.not.to.respondTo('bar');
|
||||
expect(Klass).to.respondTo('bar');
|
||||
expect(obj).respondsTo('bar');
|
||||
Klass.should.respondTo('bar');
|
||||
Klass.should.respondsTo('bar');
|
||||
expect(Klass).to.not.respondTo('foo');
|
||||
Klass.should.not.respondTo('foo');
|
||||
expect(Klass).itself.to.respondTo('func');
|
||||
expect(Klass).itself.not.to.respondTo('bar');
|
||||
|
||||
expect(bar).to.respondTo('foo');
|
||||
bar.should.respondTo('foo');
|
||||
expect(obj).not.to.respondTo('foo');
|
||||
obj.should.not.respondTo('foo');
|
||||
|
||||
err(() => {
|
||||
expect(Foo).to.respondTo('baz', 'constructor');
|
||||
Foo.should.respondTo('baz', 'constructor');
|
||||
}, /^(constructor: expected)(.*)(\[Function: Foo\])(.*)(to respond to \'baz\')$/);
|
||||
expect(Klass).to.respondTo('baz', 'constructor');
|
||||
Klass.should.respondTo('baz', 'constructor');
|
||||
}, /^(constructor: expected)(.*)(\[Function: Klass\])(.*)(to respond to \'baz\')$/);
|
||||
|
||||
err(() => {
|
||||
expect(bar).to.respondTo('baz', 'object');
|
||||
bar.should.respondTo('baz', 'object');
|
||||
expect(obj).to.respondTo('baz', 'object');
|
||||
obj.should.respondTo('baz', 'object');
|
||||
}, /^(object: expected)(.*)(\{ foo: \[Function\] \}|\{ Object \()(.*)(to respond to \'baz\')$/);
|
||||
}
|
||||
|
||||
@@ -1116,6 +1195,23 @@ function sameMembers() {
|
||||
[5, 4].should.not.have.same.members([6, 3]);
|
||||
expect([5, 4]).to.not.have.same.members([5, 4, 2]);
|
||||
[5, 4].should.not.have.same.members([5, 4, 2]);
|
||||
|
||||
assert.sameMembers([5, 4], [4, 5]);
|
||||
}
|
||||
function sameDeepMembers() {
|
||||
expect([{ id: 5 }, { id: 4 }]).to.have.same.deep.members([{ id: 4 }, { id: 5 }]);
|
||||
[{ id: 5 }, { id: 4 }].should.have.same.deep.members([{ id: 4 }, { id: 5 }]);
|
||||
expect([{ id: 5 }, { id: 4 }]).to.have.same.members([{ id: 5 }, { id: 4 }]);
|
||||
[{ id: 5 }, { id: 4 }].should.have.same.members([{ id: 5 }, { id: 4 }]);
|
||||
|
||||
expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([]);
|
||||
[{ id: 5 }, { id: 4 }].should.not.have.same.members([]);
|
||||
expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 6 }, { id: 3 }]);
|
||||
[{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 6 }, { id: 3 }]);
|
||||
expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]);
|
||||
[{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]);
|
||||
|
||||
assert.sameDeepMembers([{ id: 5 }, { id: 4 }], [{ id: 4 }, { id: 5 }]);
|
||||
}
|
||||
|
||||
function members() {
|
||||
@@ -1127,16 +1223,48 @@ function members() {
|
||||
expect([5, 4]).not.members([5, 4, 2]);
|
||||
}
|
||||
|
||||
function increaseDecreaseChange() {
|
||||
var obj = { val: 10 };
|
||||
var inc = () => { obj.val++; };
|
||||
var dec = () => { obj.val--; };
|
||||
var same = () => { };
|
||||
|
||||
expect(inc).to.increase(obj, "val");
|
||||
expect(inc).increases(obj, "val");
|
||||
expect(inc).to.change(obj, "val");
|
||||
|
||||
expect(dec).to.decrease(obj, "val");
|
||||
expect(dec).decreases(obj, "val");
|
||||
expect(dec).to.change(obj, "val");
|
||||
expect(dec).changes(obj, "val");
|
||||
|
||||
expect(inc).to.not.decrease(obj, "val");
|
||||
expect(dec).to.not.increase(obj, "val");
|
||||
expect(same).to.not.increase(obj, "val");
|
||||
expect(same).to.not.decrease(obj, "val");
|
||||
expect(same).to.not.change(obj, "val");
|
||||
|
||||
inc.should.increase(obj, "val");
|
||||
inc.should.change(obj, "val");
|
||||
|
||||
dec.should.decrease(obj, "val");
|
||||
dec.should.change(obj, "val");
|
||||
|
||||
inc.should.not.decrease(obj, "val");
|
||||
dec.should.not.increase(obj, "val");
|
||||
same.should.not.change(obj, "val");
|
||||
}
|
||||
|
||||
//tdd
|
||||
declare function suite(description: string, action: Function):void;
|
||||
declare function test(description: string, action: Function):void;
|
||||
declare function suite(description: string, action: Function): void;
|
||||
declare function test(description: string, action: Function): void;
|
||||
|
||||
interface FieldObj {
|
||||
field: any;
|
||||
}
|
||||
|
||||
class CrashyObject {
|
||||
inspect (): void {
|
||||
inspect(): void {
|
||||
throw new Error('Arg\'s inspect() called even though the test passed');
|
||||
}
|
||||
}
|
||||
@@ -1172,6 +1300,9 @@ suite('assert', () => {
|
||||
assert.ok(true);
|
||||
assert.ok(1);
|
||||
assert.ok('test');
|
||||
assert.isOk(true);
|
||||
assert.isOk(1);
|
||||
assert.isOk('test');
|
||||
|
||||
err(() => {
|
||||
assert.ok(false);
|
||||
@@ -1186,6 +1317,27 @@ suite('assert', () => {
|
||||
}, 'expected \'\' to be truthy');
|
||||
});
|
||||
|
||||
test('notOk', () => {
|
||||
assert.notOk(false);
|
||||
assert.notOk(0);
|
||||
assert.notOk('');
|
||||
assert.isNotOk(false);
|
||||
assert.isNotOk(0);
|
||||
assert.isNotOk('');
|
||||
|
||||
err(() => {
|
||||
assert.notOk(true);
|
||||
}, 'expected true to be falsy');
|
||||
|
||||
err(() => {
|
||||
assert.notOk(1);
|
||||
}, 'expected 1 to be falsy');
|
||||
|
||||
err(() => {
|
||||
assert.notOk('test');
|
||||
}, 'expected \'test\' to be falsy');
|
||||
});
|
||||
|
||||
test('isFalse', () => {
|
||||
assert.isFalse(false);
|
||||
|
||||
@@ -1199,7 +1351,7 @@ suite('assert', () => {
|
||||
});
|
||||
|
||||
test('equal', () => {
|
||||
assert.equal(void(0), undefined);
|
||||
assert.equal(void (0), undefined);
|
||||
});
|
||||
|
||||
test('typeof / notTypeOf', () => {
|
||||
@@ -1288,19 +1440,19 @@ suite('assert', () => {
|
||||
});
|
||||
|
||||
test('deepEqual', () => {
|
||||
assert.deepEqual({tea: 'chai'}, {tea: 'chai'});
|
||||
assert.deepEqual({ tea: 'chai' }, { tea: 'chai' });
|
||||
|
||||
err(() => {
|
||||
assert.deepEqual({tea: 'chai'}, {tea: 'black'});
|
||||
assert.deepEqual({ tea: 'chai' }, { tea: 'black' });
|
||||
}, 'expected { tea: \'chai\' } to deeply equal { tea: \'black\' }');
|
||||
|
||||
var obja = Object.create({ tea: 'chai' })
|
||||
, objb = Object.create({ tea: 'chai' });
|
||||
, objb = Object.create({ tea: 'chai' });
|
||||
|
||||
assert.deepEqual(obja, objb);
|
||||
|
||||
var obj1 = Object.create({tea: 'chai'})
|
||||
, obj2 = Object.create({tea: 'black'});
|
||||
var obj1 = Object.create({ tea: 'chai' })
|
||||
, obj2 = Object.create({ tea: 'black' });
|
||||
|
||||
err(() => {
|
||||
assert.deepEqual(obj1, obj2);
|
||||
@@ -1309,13 +1461,13 @@ suite('assert', () => {
|
||||
|
||||
test('deepEqual (ordering)', () => {
|
||||
var a = { a: 'b', c: 'd' }
|
||||
, b = { c: 'd', a: 'b' };
|
||||
, b = { c: 'd', a: 'b' };
|
||||
assert.deepEqual(a, b);
|
||||
});
|
||||
|
||||
test('deepEqual (circular)', () => {
|
||||
var circularObject:any = {}
|
||||
, secondCircularObject:any = {};
|
||||
var circularObject: any = {}
|
||||
, secondCircularObject: any = {};
|
||||
circularObject.field = circularObject;
|
||||
secondCircularObject.field = secondCircularObject;
|
||||
|
||||
@@ -1328,15 +1480,15 @@ suite('assert', () => {
|
||||
});
|
||||
|
||||
test('notDeepEqual', () => {
|
||||
assert.notDeepEqual({tea: 'jasmine'}, {tea: 'chai'});
|
||||
assert.notDeepEqual({ tea: 'jasmine' }, { tea: 'chai' });
|
||||
err(() => {
|
||||
assert.notDeepEqual({tea: 'chai'}, {tea: 'chai'});
|
||||
assert.notDeepEqual({ tea: 'chai' }, { tea: 'chai' });
|
||||
}, 'expected { tea: \'chai\' } to not deeply equal { tea: \'chai\' }');
|
||||
});
|
||||
|
||||
test('notDeepEqual (circular)', () => {
|
||||
var circularObject:any = {}
|
||||
, secondCircularObject:any = { tea: 'jasmine' };
|
||||
var circularObject: any = {}
|
||||
, secondCircularObject: any = { tea: 'jasmine' };
|
||||
circularObject.field = circularObject;
|
||||
secondCircularObject.field = secondCircularObject;
|
||||
|
||||
@@ -1380,6 +1532,22 @@ suite('assert', () => {
|
||||
}, 'expected undefined to not equal undefined');
|
||||
});
|
||||
|
||||
test('isNaN', () => {
|
||||
assert.isNaN(NaN);
|
||||
|
||||
err(() => {
|
||||
assert.isNaN(12);
|
||||
}, 'expected 12 to be NaN');
|
||||
});
|
||||
|
||||
test('isNotNaN', () => {
|
||||
assert.isNotNaN(12);
|
||||
|
||||
err(() => {
|
||||
assert.isNotNaN(NaN);
|
||||
}, 'expected NaN to not NaN');
|
||||
});
|
||||
|
||||
test('isFunction', () => {
|
||||
var func = () => {
|
||||
};
|
||||
@@ -1431,7 +1599,7 @@ suite('assert', () => {
|
||||
|
||||
test('isNotString', () => {
|
||||
assert.isNotString(3);
|
||||
assert.isNotString([ 'hello' ]);
|
||||
assert.isNotString(['hello']);
|
||||
|
||||
err(() => {
|
||||
assert.isNotString('hello');
|
||||
@@ -1449,7 +1617,7 @@ suite('assert', () => {
|
||||
|
||||
test('isNotNumber', () => {
|
||||
assert.isNotNumber('hello');
|
||||
assert.isNotNumber([ 5 ]);
|
||||
assert.isNotNumber([5]);
|
||||
|
||||
err(() => {
|
||||
assert.isNotNumber(4);
|
||||
@@ -1479,7 +1647,7 @@ suite('assert', () => {
|
||||
|
||||
test('include', () => {
|
||||
assert.include('foobar', 'bar');
|
||||
assert.include([ 1, 2, 3], 3);
|
||||
assert.include([1, 2, 3], 3);
|
||||
|
||||
err(() => {
|
||||
assert.include('foobar', 'baz');
|
||||
@@ -1492,7 +1660,7 @@ suite('assert', () => {
|
||||
|
||||
test('notInclude', () => {
|
||||
assert.notInclude('foobar', 'baz');
|
||||
assert.notInclude([ 1, 2, 3 ], 4);
|
||||
assert.notInclude([1, 2, 3], 4);
|
||||
|
||||
err(() => {
|
||||
assert.notInclude('foobar', 'bar');
|
||||
@@ -1739,4 +1907,42 @@ suite('assert', () => {
|
||||
}, 'expected [ 1, 54 ] to have the same members as [ 6, 1, 54 ]');
|
||||
});
|
||||
|
||||
|
||||
test('isAbove', () => {
|
||||
assert.isAbove(10, 5);
|
||||
|
||||
err(() => {
|
||||
assert.isAbove(1, 5);
|
||||
}, 'expected 1 to be above 5');
|
||||
err(() => {
|
||||
assert.isAbove(5, 5);
|
||||
}, 'expected 5 to be above 5');
|
||||
});
|
||||
|
||||
test('isBelow', () => {
|
||||
assert.isBelow(5, 10);
|
||||
|
||||
err(() => {
|
||||
assert.isBelow(5, 1);
|
||||
}, 'expected 5 to be above 1');
|
||||
err(() => {
|
||||
assert.isBelow(5, 5);
|
||||
}, 'expected 5 to be below 5');
|
||||
});
|
||||
|
||||
test('extensible', () => { assert.extensible({}); });
|
||||
test('isExtensible', () => { assert.isExtensible({}); });
|
||||
test('notExtensible', () => { assert.notExtensible(Object.preventExtensions({})); });
|
||||
test('isNotExtensible', () => { assert.isNotExtensible(Object.preventExtensions({})); });
|
||||
|
||||
test('sealed', () => { assert.sealed(Object.seal({})); });
|
||||
test('isSealed', () => { assert.isSealed(Object.seal({})); });
|
||||
test('notSealed', () => { assert.notSealed({}); });
|
||||
test('isNotSealed', () => { assert.isNotSealed({}); });
|
||||
|
||||
test('frozen', () => { assert.frozen(Object.freeze({})); });
|
||||
test('isFrozen', () => { assert.isFrozen(Object.freeze({})); });
|
||||
test('notFrozen', () => { assert.notFrozen({}); });
|
||||
test('isNotFrozen', () => { assert.isNotFrozen({}); });
|
||||
|
||||
});
|
||||
|
||||
Vendored
+87
-7
@@ -1,10 +1,13 @@
|
||||
// Type definitions for chai 2.0.0
|
||||
// Type definitions for chai 3.2.0
|
||||
// Project: http://chaijs.com/
|
||||
// Definitions by: Jed Mao <https://github.com/jedmao/>,
|
||||
// Bart van der Schoor <https://github.com/Bartvds>,
|
||||
// Andrew Brown <https://github.com/AGBrown>
|
||||
// Andrew Brown <https://github.com/AGBrown>,
|
||||
// Olivier Chevet <https://github.com/olivr70>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// <reference path="../assertion-error/assertion-error.d.ts"/>
|
||||
|
||||
declare module Chai {
|
||||
|
||||
interface ChaiStatic {
|
||||
@@ -16,9 +19,11 @@ declare module Chai {
|
||||
use(fn: (chai: any, utils: any) => void): any;
|
||||
assert: AssertStatic;
|
||||
config: Config;
|
||||
AssertionError: AssertionError;
|
||||
}
|
||||
|
||||
export interface ExpectStatic extends AssertionStatic {
|
||||
fail(actual?: any, expected?: any, message?: string, operator?: string): void;
|
||||
}
|
||||
|
||||
export interface AssertStatic extends Assert {
|
||||
@@ -49,15 +54,20 @@ declare module Chai {
|
||||
interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
|
||||
not: Assertion;
|
||||
deep: Deep;
|
||||
any: KeyFilter;
|
||||
all: KeyFilter;
|
||||
a: TypeComparison;
|
||||
an: TypeComparison;
|
||||
include: Include;
|
||||
includes: Include;
|
||||
contain: Include;
|
||||
contains: Include;
|
||||
ok: Assertion;
|
||||
true: Assertion;
|
||||
false: Assertion;
|
||||
null: Assertion;
|
||||
undefined: Assertion;
|
||||
NaN: Assertion;
|
||||
exist: Assertion;
|
||||
empty: Assertion;
|
||||
arguments: Assertion;
|
||||
@@ -70,20 +80,35 @@ declare module Chai {
|
||||
property: Property;
|
||||
ownProperty: OwnProperty;
|
||||
haveOwnProperty: OwnProperty;
|
||||
ownPropertyDescriptor: OwnPropertyDescriptor;
|
||||
haveOwnPropertyDescriptor: OwnPropertyDescriptor;
|
||||
length: Length;
|
||||
lengthOf: Length;
|
||||
match(regexp: RegExp|string, message?: string): Assertion;
|
||||
match: Match;
|
||||
matches: Match;
|
||||
string(string: string, message?: string): Assertion;
|
||||
keys: Keys;
|
||||
key(string: string): Assertion;
|
||||
throw: Throw;
|
||||
throws: Throw;
|
||||
Throw: Throw;
|
||||
respondTo(method: string, message?: string): Assertion;
|
||||
respondTo: RespondTo;
|
||||
respondsTo: RespondTo;
|
||||
itself: Assertion;
|
||||
satisfy(matcher: Function, message?: string): Assertion;
|
||||
satisfy: Satisfy;
|
||||
satisfies: Satisfy;
|
||||
closeTo(expected: number, delta: number, message?: string): Assertion;
|
||||
members: Members;
|
||||
increase: PropertyChange;
|
||||
increases: PropertyChange;
|
||||
decrease: PropertyChange;
|
||||
decreases: PropertyChange;
|
||||
change: PropertyChange;
|
||||
changes: PropertyChange;
|
||||
extensible: Assertion;
|
||||
sealed: Assertion;
|
||||
frozen: Assertion;
|
||||
|
||||
}
|
||||
|
||||
interface LanguageChains {
|
||||
@@ -134,6 +159,11 @@ declare module Chai {
|
||||
equal: Equal;
|
||||
include: Include;
|
||||
property: Property;
|
||||
members: Members;
|
||||
}
|
||||
|
||||
interface KeyFilter {
|
||||
keys: Keys;
|
||||
}
|
||||
|
||||
interface Equal {
|
||||
@@ -148,6 +178,11 @@ declare module Chai {
|
||||
(name: string, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface OwnPropertyDescriptor {
|
||||
(name: string, descriptor: PropertyDescriptor, message?: string): Assertion;
|
||||
(name: string, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Length extends LanguageChains, NumericComparison {
|
||||
(length: number, message?: string): Assertion;
|
||||
}
|
||||
@@ -158,11 +193,18 @@ declare module Chai {
|
||||
(value: number, message?: string): Assertion;
|
||||
keys: Keys;
|
||||
members: Members;
|
||||
any: KeyFilter;
|
||||
all: KeyFilter;
|
||||
}
|
||||
|
||||
interface Match {
|
||||
(regexp: RegExp|string, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Keys {
|
||||
(...keys: string[]): Assertion;
|
||||
(keys: any[]): Assertion;
|
||||
(keys: Object): Assertion;
|
||||
}
|
||||
|
||||
interface Throw {
|
||||
@@ -175,10 +217,22 @@ declare module Chai {
|
||||
(constructor: Function, expected?: RegExp, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface RespondTo {
|
||||
(method: string, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Satisfy {
|
||||
(matcher: Function, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Members {
|
||||
(set: any[], message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface PropertyChange {
|
||||
(object: Object, prop: string, msg?: string): Assertion;
|
||||
}
|
||||
|
||||
export interface Assert {
|
||||
/**
|
||||
* @param expression Expression to test for truthiness.
|
||||
@@ -189,7 +243,9 @@ declare module Chai {
|
||||
fail(actual?: any, expected?: any, msg?: string, operator?: string): void;
|
||||
|
||||
ok(val: any, msg?: string): void;
|
||||
isOk(val: any, msg?: string): void;
|
||||
notOk(val: any, msg?: string): void;
|
||||
isNotOk(val: any, msg?: string): void;
|
||||
|
||||
equal(act: any, exp: any, msg?: string): void;
|
||||
notEqual(act: any, exp: any, msg?: string): void;
|
||||
@@ -209,6 +265,12 @@ declare module Chai {
|
||||
isUndefined(val: any, msg?: string): void;
|
||||
isDefined(val: any, msg?: string): void;
|
||||
|
||||
isNaN(val: any, msg?: string): void;
|
||||
isNotNaN(val: any, msg?: string): void;
|
||||
|
||||
isAbove(val: number, abv: number, msg?: string): void;
|
||||
isBelow(val: number, blw: number, msg?: string): void;
|
||||
|
||||
isFunction(val: any, msg?: string): void;
|
||||
isNotFunction(val: any, msg?: string): void;
|
||||
|
||||
@@ -279,9 +341,27 @@ declare module Chai {
|
||||
closeTo(act: number, exp: number, delta: number, msg?: string): void;
|
||||
|
||||
sameMembers(set1: any[], set2: any[], msg?: string): void;
|
||||
includeMembers(set1: any[], set2: any[], msg?: string): void;
|
||||
sameDeepMembers(set1: any[], set2: any[], msg?: string): void;
|
||||
includeMembers(superset: any[], subset: any[], msg?: string): void;
|
||||
|
||||
ifError(val: any, msg?: string): void;
|
||||
|
||||
isExtensible(obj: {}, msg?: string): void;
|
||||
extensible(obj: {}, msg?: string): void;
|
||||
isNotExtensible(obj: {}, msg?: string): void;
|
||||
notExtensible(obj: {}, msg?: string): void;
|
||||
|
||||
isSealed(obj: {}, msg?: string): void;
|
||||
sealed(obj: {}, msg?: string): void;
|
||||
isNotSealed(obj: {}, msg?: string): void;
|
||||
notSealed(obj: {}, msg?: string): void;
|
||||
|
||||
isFrozen(obj: Object, msg?: string): void;
|
||||
frozen(obj: Object, msg?: string): void;
|
||||
isNotFrozen(obj: Object, msg?: string): void;
|
||||
notFrozen(obj: Object, msg?: string): void;
|
||||
|
||||
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
@@ -305,4 +385,4 @@ declare module "chai" {
|
||||
|
||||
interface Object {
|
||||
should: Chai.Assertion;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference path="cheerio.d.ts" />
|
||||
|
||||
import cheerio from 'cheerio';
|
||||
import * as cheerio from 'cheerio';
|
||||
|
||||
/*
|
||||
* LOADING
|
||||
@@ -29,7 +29,7 @@ $ = cheerio.load(html, {
|
||||
normalizeWhitespace: true,
|
||||
xmlMode: true,
|
||||
decodeEntities: true,
|
||||
lowercaseTags: true,
|
||||
lowerCaseTags: true,
|
||||
lowerCaseAttributeNames: true,
|
||||
recognizeCDATA: true,
|
||||
recognizeSelfClosing: true
|
||||
|
||||
Vendored
+1
-1
@@ -262,5 +262,5 @@ interface CheerioAPI extends CheerioSelector {
|
||||
declare var cheerio:CheerioAPI;
|
||||
|
||||
declare module "cheerio" {
|
||||
export default cheerio;
|
||||
export = cheerio;
|
||||
}
|
||||
|
||||
Vendored
+8
-3
@@ -1,13 +1,18 @@
|
||||
// Type definitions for classnames
|
||||
// Project: https://github.com/JedWatson/classnames
|
||||
// Definitions by: Dave Keen <http://www.keendevelopment.ch>
|
||||
// Definitions by: Dave Keen <http://www.keendevelopment.ch>, Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface ClassDictionary {
|
||||
[id: string]: boolean;
|
||||
}
|
||||
|
||||
interface ClassNamesFn {
|
||||
(...classes: (string | ClassDictionary)[]): string;
|
||||
}
|
||||
|
||||
declare var classNames: ClassNamesFn;
|
||||
|
||||
declare module "classnames" {
|
||||
function classNames(...classes: (string|ClassDictionary)[]): string;
|
||||
export = classNames
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./clone.d.ts" />
|
||||
|
||||
import clone = require("clone");
|
||||
|
||||
var original = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/// <reference path="codemirror.d.ts" />
|
||||
/// <reference path="showhint.d.ts" />
|
||||
/// <reference path="codemirror-showhint.d.ts" />
|
||||
var doc = new CodeMirror.Doc('text');
|
||||
var pos = new CodeMirror.Pos(2, 3);
|
||||
CodeMirror.showHint(doc);
|
||||
+23
-11
@@ -1,10 +1,12 @@
|
||||
// Type definitions for CodeMirror
|
||||
// Project: https://github.com/marijnh/CodeMirror
|
||||
// Definitions by: jacqt <https://github.com/jacqt>
|
||||
// Definitions by: jacqt <https://github.com/jacqt>, basarat <https://github.com/basarat>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// See docs https://codemirror.net/doc/manual.html#addon_show-hint
|
||||
|
||||
declare module CodeMirror {
|
||||
var commands : any;
|
||||
var commands: any;
|
||||
|
||||
/** Provides a framework for showing autocompletion hints. Defines editor.showHint, which takes an optional
|
||||
options object, and pops up a widget that allows the user to select a completion. Finding hints is done with
|
||||
@@ -12,13 +14,12 @@ declare module CodeMirror {
|
||||
and return a {list, from, to} object, where list is an array of strings or objects (the completions), and
|
||||
from and to give the start and end of the token that is being completed as {line, ch} objects. An optional
|
||||
selectedHint property (an integer) can be added to the completion object to control the initially selected hint. */
|
||||
function showHint (cm: CodeMirror.Doc, hinter?: (doc : CodeMirror.Doc) => Hints, options?: IShowHintOptions) : void;
|
||||
|
||||
function showHint(cm: CodeMirror.Doc, hinter?: (doc: CodeMirror.Doc) => Hints, options?: ShowHintOptions): void;
|
||||
|
||||
interface Hints {
|
||||
from: Position;
|
||||
to: Position;
|
||||
list: Hint[] | string[];
|
||||
list: (Hint | string)[];
|
||||
}
|
||||
|
||||
/** Interface used by showHint.js Codemirror add-on
|
||||
@@ -28,25 +29,27 @@ declare module CodeMirror {
|
||||
className?: string;
|
||||
displayText?: string;
|
||||
from?: Position;
|
||||
render?: (element: any, self: any, data: any) => void;
|
||||
/** Called if a completion is picked. If provided *you* are responsible for applying the completion */
|
||||
hint?: (cm: any, data: Hints, cur: Hint) => void;
|
||||
render?: (element: HTMLLIElement, data: Hints, cur: Hint) => void;
|
||||
to?: Position;
|
||||
}
|
||||
|
||||
interface Editor {
|
||||
/** An extension of the existing CodeMirror typings for the Editor.on("keyup", func) syntax */
|
||||
on(eventName: string, handler: (doc: CodeMirror.Doc, event : any ) => void ): void;
|
||||
off(eventName: string, handler: (doc: CodeMirror.Doc, event : any) => void ): void;
|
||||
on(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void;
|
||||
off(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void;
|
||||
}
|
||||
|
||||
/** Extend CodeMirror.Doc with a state object, so that the Doc.state.completionActive property is reachable*/
|
||||
interface Doc {
|
||||
state: any;
|
||||
showHint: (options: IShowHintOptions) => void;
|
||||
showHint: (options: ShowHintOptions) => void;
|
||||
}
|
||||
|
||||
interface IShowHintOptions {
|
||||
interface ShowHintOptions {
|
||||
completeSingle: boolean;
|
||||
hint: (doc : CodeMirror.Doc) => Hints;
|
||||
hint: (doc: CodeMirror.Doc) => Hints;
|
||||
}
|
||||
|
||||
/** The Handle used to interact with the autocomplete dialog box.*/
|
||||
@@ -59,4 +62,13 @@ declare module CodeMirror {
|
||||
pick(): void;
|
||||
data: any;
|
||||
}
|
||||
|
||||
interface EditorConfiguration {
|
||||
showHint?: boolean;
|
||||
hintOptions?: ShowHintOptions;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "codemirror/addon/hint/show-hint" {
|
||||
export = CodeMirror;
|
||||
}
|
||||
Vendored
+4
@@ -1090,3 +1090,7 @@ declare module CodeMirror {
|
||||
to?: Position;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "codemirror" {
|
||||
export = CodeMirror;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/// <reference path="codemirror.d.ts" />
|
||||
/// <reference path="searchcursor.d.ts" />
|
||||
|
||||
var doc = new CodeMirror.Doc('text some string and another text match');
|
||||
var cursor = doc.getSearchCursor('text', new CodeMirror.Pos(0,0), false);
|
||||
cursor = doc.getSearchCursor('text', new CodeMirror.Pos(0,0));
|
||||
cursor = doc.getSearchCursor('text');
|
||||
|
||||
|
||||
cursor.find(false);
|
||||
cursor.findNext();
|
||||
cursor.findPrevious();
|
||||
cursor.from();
|
||||
cursor.to();
|
||||
cursor.replace("blah");
|
||||
cursor.replace("text", "origin");
|
||||
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
// Type definitions for CodeMirror
|
||||
// Project: https://github.com/marijnh/CodeMirror
|
||||
// Definitions by: jacqt <https://github.com/jacqt>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module CodeMirror {
|
||||
interface Doc {
|
||||
/** This method can be used to implement search/replace functionality.
|
||||
* `query`: This can be a regular * expression or a string (only strings will match across lines -
|
||||
* if they contain newlines).
|
||||
* `start`: This provides the starting position of the search. It can be a `{line, ch} object,
|
||||
* or can be left off to default to the start of the document
|
||||
* `caseFold`: This is only relevant when matching a string. IT will cause the search to be case-insenstive */
|
||||
getSearchCursor(query: string | RegExp, start?: Position, caseFold?: boolean): SearchCursor;
|
||||
}
|
||||
|
||||
interface SearchCursor {
|
||||
/** Searches forward or backward from the current position. The return value indicates whether a match was
|
||||
* found. If matching a regular expression, the return value will be the array returned by the match method, in case
|
||||
* you want to extract matched groups */
|
||||
find(reverse: boolean): boolean | any[];
|
||||
|
||||
/** Searches forward from the current position. The return value indicates whether a match was
|
||||
* found. If matching a regular expression, the return value will be the array returned by the match method, in case
|
||||
* you want to extract matched groups */
|
||||
findNext(): boolean | any[];
|
||||
|
||||
/** Searches backward from the current position. The return value indicates whether a match was
|
||||
* found. If matching a regular expression, the return value will be the array returned by the match method, in case
|
||||
* you want to extract matched groups */
|
||||
findPrevious(): boolean | any[];
|
||||
|
||||
/** Only valid when the last call to find, findNext, or findPrevious did not return false. Returns {line, ch}
|
||||
* objects pointing the start of the match. */
|
||||
from(): Position;
|
||||
|
||||
/** Only valid when the last call to find, findNext, or findPrevious did not return false. Returns {line, ch}
|
||||
* objects pointing the end of the match. */
|
||||
to(): Position;
|
||||
|
||||
|
||||
/** Replaces the currently found match with the given text and adjusts the cursor position to reflect the deplacement. */
|
||||
replace(text: string, origin?: string): void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/// <reference path="config.d.ts" />
|
||||
|
||||
import config = require('config');
|
||||
|
||||
var value1: string = config.get<string>("");
|
||||
var value2: any = config.get("");
|
||||
|
||||
var has: boolean = config.has("");
|
||||
|
||||
// util tests:
|
||||
var extended1: any = config.util.extendDeep({}, {});
|
||||
var extended2: any = config.util.extendDeep({}, {}, 20);
|
||||
|
||||
var clone1: any = config.util.cloneDeep({});
|
||||
var clone2: any = config.util.cloneDeep({}, 20);
|
||||
|
||||
var equals1: boolean = config.util.equalsDeep({}, {});
|
||||
var equals2: boolean = config.util.equalsDeep({}, {}, 20);
|
||||
|
||||
var diff1: any = config.util.diffDeep({}, {});
|
||||
var diff2: any = config.util.diffDeep({}, {}, 20);
|
||||
|
||||
var immutable1: any = config.util.makeImmutable({});
|
||||
var immutable2: any = config.util.makeImmutable({}, "");
|
||||
var immutable3: any = config.util.makeImmutable({}, "", "");
|
||||
|
||||
var hidden1: any = config.util.makeHidden({}, "");
|
||||
var hidden2: any = config.util.makeHidden({}, "", "");
|
||||
|
||||
var env: string = config.util.getEnv("");
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for node-config
|
||||
// Project: https://github.com/lorenwest/node-config
|
||||
// Definitions by: Roman Korneev <https://github.com/RWander>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "config" {
|
||||
// see https://github.com/lorenwest/node-config/wiki/Using-Config-Utilities
|
||||
interface IUtil {
|
||||
// Extend an object (and any object it contains) with one or more objects (and objects contained in them).
|
||||
extendDeep(mergeInto: any, mergeFrom: any, depth?: number): any;
|
||||
|
||||
// Return a deep copy of the specified object.
|
||||
cloneDeep(copyFrom: any, depth?: number): any;
|
||||
|
||||
// Return true if two objects have equal contents.
|
||||
equalsDeep(object1: any, object2: any, dept?: number): boolean;
|
||||
|
||||
// Returns an object containing all elements that differ between two objects.
|
||||
diffDeep(object1: any, object2: any, depth?: number): any;
|
||||
|
||||
// Make a javascript object property immutable (assuring it cannot be changed from the current value).
|
||||
makeImmutable(object: any, propertyName?: string, propertyValue?: string): any;
|
||||
|
||||
// Make an object property hidden so it doesn't appear when enumerating elements of the object.
|
||||
makeHidden(object: any, propertyName: string, propertyValue?: string): any;
|
||||
|
||||
// Get the current value of a config environment variable
|
||||
getEnv(varName: string): string;
|
||||
}
|
||||
|
||||
export function get<T>(setting: string): T;
|
||||
export function has(setting: string): boolean;
|
||||
export var util: IUtil;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="../express/express.d.ts"/>
|
||||
/// <reference path="./connect-slashes.d.ts"/>
|
||||
|
||||
import express = require('express');
|
||||
import slashes = require('connect-slashes');
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./contextjs.d.ts" />
|
||||
|
||||
import context = require("contextjs");
|
||||
|
||||
context.init();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./convert-source-map.d.ts" />
|
||||
|
||||
import convert = require("convert-source-map");
|
||||
|
||||
var json = convert
|
||||
@@ -10,4 +12,4 @@ var modified = convert
|
||||
.toJSON();
|
||||
|
||||
console.log(json);
|
||||
console.log(modified);
|
||||
console.log(modified);
|
||||
|
||||
Vendored
+2
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for cookie-parser
|
||||
// Type definitions for cookie-parser v1.3.4
|
||||
// Project: https://github.com/expressjs/cookie-parser
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -8,5 +8,6 @@
|
||||
declare module "cookie-parser" {
|
||||
import express = require('express');
|
||||
function e(secret?: string, options?: any): express.RequestHandler;
|
||||
namespace e{}
|
||||
export = e;
|
||||
}
|
||||
@@ -7,4 +7,6 @@ cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
|
||||
cordova.plugins.Keyboard.close();
|
||||
cordova.plugins.Keyboard.disableScroll(true);
|
||||
cordova.plugins.Keyboard.disableScroll(false);
|
||||
cordova.plugins.Keyboard.show();
|
||||
cordova.plugins.Keyboard.close();
|
||||
console.log(cordova.plugins.Keyboard.isVisible);
|
||||
|
||||
Vendored
+8
@@ -17,6 +17,14 @@ declare module Ionic {
|
||||
* Close the keyboard if it is open.
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
/**
|
||||
* Force keyboard to be shown on Android.
|
||||
* This typically helps if autofocus on a text element does not pop up the keyboard automatically
|
||||
*
|
||||
* Supported Platforms: Android, Blackberry 10
|
||||
*/
|
||||
show(): void;
|
||||
|
||||
/**
|
||||
* Disable native scrolling, useful if you are using JavaScript to scroll
|
||||
|
||||
Vendored
+21
-4
@@ -1,17 +1,32 @@
|
||||
// Type definitions for Apache Cordova Vibration plugin.
|
||||
// Project: https://github.com/apache/cordova-plugin-vibration
|
||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>
|
||||
// Definitions by: Microsoft Open Technologies, Inc. <http://msopentech.com>, Louis Lagrange <https://github.com/Minishlink/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
//
|
||||
//
|
||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
interface Navigator {
|
||||
/**
|
||||
* Vibrates the device for the specified amount of time.
|
||||
* @param time Milliseconds to vibrate the device. 0 cancels the vibration. Ignored on iOS.
|
||||
*/
|
||||
vibrate(time: number): void;
|
||||
|
||||
/**
|
||||
* Vibrates the device with a given pattern.
|
||||
* @param time Sequence of durations (in milliseconds) for which to turn on or off the vibrator. Ignored on iOS.
|
||||
*/
|
||||
vibrate(time: number[]): void;
|
||||
}
|
||||
|
||||
interface Notification {
|
||||
/**
|
||||
* Vibrates the device for the specified amount of time.
|
||||
* @param time Milliseconds to vibrate the device. Ignored on iOS.
|
||||
* @deprecated
|
||||
*/
|
||||
vibrate(time: number): void
|
||||
vibrate(time: number): void;
|
||||
/**
|
||||
* Vibrates the device with a given pattern.
|
||||
* @param number[] pattern Pattern with which to vibrate the device.
|
||||
@@ -19,10 +34,12 @@ interface Notification {
|
||||
* The next value - the number of milliseconds for which to keep the vibrator on before turning it off.
|
||||
* @param number repeat Optional index into the pattern array at which to start repeating (will repeat until canceled),
|
||||
* or -1 for no repetition (default).
|
||||
* @deprecated
|
||||
*/
|
||||
vibrateWithPattern(pattern: number[], repeat: number): void;
|
||||
/**
|
||||
* Immediately cancels any currently running vibration.
|
||||
* @deprecated
|
||||
*/
|
||||
cancelVibration(): void;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+146
-151
@@ -22,13 +22,13 @@ declare type PropertyKey = string | number | symbol;
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 6: Object & Function
|
||||
// Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of,
|
||||
// Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of,
|
||||
// es6.object.to-string, es6.function.name and es6.function.has-instance.
|
||||
// #############################################################################################
|
||||
|
||||
|
||||
interface ObjectConstructor {
|
||||
/**
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
* @param target The target object to copy to.
|
||||
* @param sources One or more source objects to copy properties from.
|
||||
@@ -57,10 +57,10 @@ interface Function {
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Determines if a constructor object recognizes an object as one of the
|
||||
/**
|
||||
* Determines if a constructor object recognizes an object as one of the
|
||||
* constructor’s instances.
|
||||
* @param value The object to test.
|
||||
* @param value The object to test.
|
||||
*/
|
||||
[Symbol.hasInstance](value: any): boolean;
|
||||
}
|
||||
@@ -71,30 +71,25 @@ interface Function {
|
||||
// and es6.array.find-index
|
||||
// #############################################################################################
|
||||
|
||||
interface ArrayLike<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
|
||||
interface Array<T> {
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex(predicate: (value: T) => boolean, thisArg?: any): number;
|
||||
@@ -102,21 +97,21 @@ interface Array<T> {
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
fill(value: T, start?: number, end?: number): T[];
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
copyWithin(target: number, start: number, end?: number): T[];
|
||||
|
||||
@@ -161,47 +156,47 @@ interface ArrayConstructor {
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 6: String & RegExp
|
||||
// Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at,
|
||||
// es6.string.ends-with, es6.string.includes, es6.string.repeat,
|
||||
// Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at,
|
||||
// es6.string.ends-with, es6.string.includes, es6.string.repeat,
|
||||
// es6.string.starts-with, and es6.regexp
|
||||
// #############################################################################################
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
|
||||
* value of the UTF-16 encoded code point starting at the string element at position pos in
|
||||
* the String resulting from converting this object to a String.
|
||||
* If there is no element at that position, the result is undefined.
|
||||
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
|
||||
* value of the UTF-16 encoded code point starting at the string element at position pos in
|
||||
* the String resulting from converting this object to a String.
|
||||
* If there is no element at that position, the result is undefined.
|
||||
* If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
|
||||
*/
|
||||
codePointAt(pos: number): number;
|
||||
|
||||
/**
|
||||
* Returns true if searchString appears as a substring of the result of converting this
|
||||
* object to a String, at one or more positions that are
|
||||
* Returns true if searchString appears as a substring of the result of converting this
|
||||
* object to a String, at one or more positions that are
|
||||
* greater than or equal to position; otherwise, returns false.
|
||||
* @param searchString search string
|
||||
* @param searchString search string
|
||||
* @param position If position is undefined, 0 is assumed, so as to search all of the String.
|
||||
*/
|
||||
includes(searchString: string, position?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* endPosition – length(this). Otherwise returns false.
|
||||
*/
|
||||
endsWith(searchString: string, endPosition?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns a String value that is made from count copies appended together. If count is 0,
|
||||
* Returns a String value that is made from count copies appended together. If count is 0,
|
||||
* T is the empty String is returned.
|
||||
* @param count number of copies to append
|
||||
*/
|
||||
repeat(count: number): string;
|
||||
|
||||
/**
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* position. Otherwise returns false.
|
||||
*/
|
||||
startsWith(searchString: string, position?: number): boolean;
|
||||
@@ -216,7 +211,7 @@ interface StringConstructor {
|
||||
|
||||
/**
|
||||
* String.raw is intended for use as a tag function of a Tagged Template String. When called
|
||||
* as such the first argument will be a well formed template call site object and the rest
|
||||
* as such the first argument will be a well formed template call site object and the rest
|
||||
* parameter will contain the substitution values.
|
||||
* @param template A well-formed template string call site representation.
|
||||
* @param substitutions A set of substitution values.
|
||||
@@ -248,14 +243,14 @@ interface RegExp {
|
||||
interface NumberConstructor {
|
||||
/**
|
||||
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
|
||||
* that is representable as a Number value, which is approximately:
|
||||
* that is representable as a Number value, which is approximately:
|
||||
* 2.2204460492503130808472633361816 x 10−16.
|
||||
*/
|
||||
EPSILON: number;
|
||||
|
||||
/**
|
||||
* Returns true if passed value is finite.
|
||||
* Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
|
||||
* Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
|
||||
* number. Only finite values of the type number, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
@@ -268,7 +263,7 @@ interface NumberConstructor {
|
||||
isInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
|
||||
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
|
||||
* number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter
|
||||
* to a number. Only values of the type number, that are also NaN, result in true.
|
||||
* @param number A numeric value.
|
||||
@@ -281,30 +276,30 @@ interface NumberConstructor {
|
||||
*/
|
||||
isSafeInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* The value of the largest integer n such that n and n + 1 are both exactly representable as
|
||||
* a Number value.
|
||||
/**
|
||||
* The value of the largest integer n such that n and n + 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1.
|
||||
*/
|
||||
MAX_SAFE_INTEGER: number;
|
||||
|
||||
/**
|
||||
* The value of the smallest integer n such that n and n − 1 are both exactly representable as
|
||||
* a Number value.
|
||||
/**
|
||||
* The value of the smallest integer n such that n and n − 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).
|
||||
*/
|
||||
MIN_SAFE_INTEGER: number;
|
||||
|
||||
/**
|
||||
* Converts a string to a floating-point number.
|
||||
* @param string A string that contains a floating-point number.
|
||||
* Converts a string to a floating-point number.
|
||||
* @param string A string that contains a floating-point number.
|
||||
*/
|
||||
parseFloat(string: string): number;
|
||||
|
||||
/**
|
||||
* Converts A string to an integer.
|
||||
* @param s A string to convert into a number.
|
||||
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
|
||||
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
|
||||
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
|
||||
* All other strings are considered decimal.
|
||||
*/
|
||||
@@ -350,7 +345,7 @@ interface Math {
|
||||
log1p(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
|
||||
* Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
|
||||
* the natural logarithms).
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
@@ -436,8 +431,8 @@ interface Symbol {
|
||||
}
|
||||
|
||||
interface SymbolConstructor {
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
prototype: Symbol;
|
||||
|
||||
@@ -448,14 +443,14 @@ interface SymbolConstructor {
|
||||
(description?: string|number): symbol;
|
||||
|
||||
/**
|
||||
* Returns a Symbol object from the global symbol registry matching the given key if found.
|
||||
* Returns a Symbol object from the global symbol registry matching the given key if found.
|
||||
* Otherwise, returns a new symbol with this key.
|
||||
* @param key key to search for.
|
||||
*/
|
||||
for(key: string): symbol;
|
||||
|
||||
/**
|
||||
* Returns a key from the global symbol registry matching the given Symbol if found.
|
||||
* Returns a key from the global symbol registry matching the given Symbol if found.
|
||||
* Otherwise, returns a undefined.
|
||||
* @param sym Symbol to find the key for.
|
||||
*/
|
||||
@@ -463,72 +458,72 @@ interface SymbolConstructor {
|
||||
|
||||
// Well-known Symbols
|
||||
|
||||
/**
|
||||
* A method that determines if a constructor object recognizes an object as one of the
|
||||
* constructor’s instances. Called by the semantics of the instanceof operator.
|
||||
/**
|
||||
* A method that determines if a constructor object recognizes an object as one of the
|
||||
* constructor’s instances. Called by the semantics of the instanceof operator.
|
||||
*/
|
||||
hasInstance: symbol;
|
||||
|
||||
/**
|
||||
/**
|
||||
* A Boolean value that if true indicates that an object should flatten to its array elements
|
||||
* by Array.prototype.concat.
|
||||
*/
|
||||
isConcatSpreadable: symbol;
|
||||
|
||||
/**
|
||||
* A method that returns the default iterator for an object. Called by the semantics of the
|
||||
/**
|
||||
* A method that returns the default iterator for an object. Called by the semantics of the
|
||||
* for-of statement.
|
||||
*/
|
||||
iterator: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that matches the regular expression against a string. Called
|
||||
* by the String.prototype.match method.
|
||||
* A regular expression method that matches the regular expression against a string. Called
|
||||
* by the String.prototype.match method.
|
||||
*/
|
||||
match: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that replaces matched substrings of a string. Called by the
|
||||
/**
|
||||
* A regular expression method that replaces matched substrings of a string. Called by the
|
||||
* String.prototype.replace method.
|
||||
*/
|
||||
replace: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that returns the index within a string that matches the
|
||||
* A regular expression method that returns the index within a string that matches the
|
||||
* regular expression. Called by the String.prototype.search method.
|
||||
*/
|
||||
search: symbol;
|
||||
|
||||
/**
|
||||
* A function valued property that is the constructor function that is used to create
|
||||
/**
|
||||
* A function valued property that is the constructor function that is used to create
|
||||
* derived objects.
|
||||
*/
|
||||
species: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that splits a string at the indices that match the regular
|
||||
* A regular expression method that splits a string at the indices that match the regular
|
||||
* expression. Called by the String.prototype.split method.
|
||||
*/
|
||||
split: symbol;
|
||||
|
||||
/**
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
|
||||
* abstract operation.
|
||||
*/
|
||||
toPrimitive: symbol;
|
||||
|
||||
/**
|
||||
/**
|
||||
* A String value that is used in the creation of the default string description of an object.
|
||||
* Called by the built-in method Object.prototype.toString.
|
||||
*/
|
||||
toStringTag: symbol;
|
||||
|
||||
/**
|
||||
* An Object whose own property names are property names that are excluded from the with
|
||||
/**
|
||||
* An Object whose own property names are property names that are excluded from the with
|
||||
* environment bindings of the associated objects.
|
||||
*/
|
||||
unscopables: symbol;
|
||||
|
||||
|
||||
/**
|
||||
* Non-standard. Use simple mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
|
||||
*/
|
||||
@@ -544,12 +539,12 @@ declare var Symbol: SymbolConstructor;
|
||||
|
||||
interface Object {
|
||||
/**
|
||||
* Determines whether an object has a property with the specified name.
|
||||
* Determines whether an object has a property with the specified name.
|
||||
* @param v A property name.
|
||||
*/
|
||||
hasOwnProperty(v: PropertyKey): boolean;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Determines whether a specified property is enumerable.
|
||||
* @param v A property name.
|
||||
*/
|
||||
@@ -564,17 +559,17 @@ interface ObjectConstructor {
|
||||
getOwnPropertySymbols(o: any): symbol[];
|
||||
|
||||
/**
|
||||
* Gets the own property descriptor of the specified object.
|
||||
* An own property descriptor is one that is defined directly on the object and is not
|
||||
* inherited from the object's prototype.
|
||||
* Gets the own property descriptor of the specified object.
|
||||
* An own property descriptor is one that is defined directly on the object and is not
|
||||
* inherited from the object's prototype.
|
||||
* @param o Object that contains the property.
|
||||
* @param p Name of the property.
|
||||
*/
|
||||
getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor;
|
||||
|
||||
/**
|
||||
* Adds a property to an object, or modifies attributes of an existing property.
|
||||
* @param o Object on which to add or modify the property. This can be a native JavaScript
|
||||
* Adds a property to an object, or modifies attributes of an existing property.
|
||||
* @param o Object on which to add or modify the property. This can be a native JavaScript
|
||||
* object (that is, a user-defined object or a built in object) or a DOM object.
|
||||
* @param p The property name.
|
||||
* @param attributes Descriptor for the property. It can be for a data property or an accessor
|
||||
@@ -693,17 +688,17 @@ interface Array<T> {
|
||||
/** Iterator */
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIterator<[number, T]>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIterator<T>;
|
||||
@@ -776,21 +771,21 @@ interface Promise<T> {
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
prototype: Promise<any>;
|
||||
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
@@ -798,7 +793,7 @@ interface PromiseConstructor {
|
||||
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
@@ -859,7 +854,7 @@ declare module Reflect {
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 7
|
||||
// Modules: es7.array.includes, es7.string.at, es7.string.lpad, es7.string.rpad,
|
||||
// Modules: es7.array.includes, es7.string.at, es7.string.lpad, es7.string.rpad,
|
||||
// es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape,
|
||||
// es7.map.to-json, and es7.set.to-json
|
||||
// #############################################################################################
|
||||
@@ -918,14 +913,14 @@ interface ArrayConstructor {
|
||||
*/
|
||||
join<T>(array: ArrayLike<T>, separator?: string): string;
|
||||
/**
|
||||
* Reverses the elements in an Array.
|
||||
* Reverses the elements in an Array.
|
||||
*/
|
||||
reverse<T>(array: ArrayLike<T>): T[];
|
||||
/**
|
||||
* Removes the first element from an array and returns it.
|
||||
*/
|
||||
shift<T>(array: ArrayLike<T>): T;
|
||||
/**
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
@@ -988,21 +983,21 @@ interface ArrayConstructor {
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
|
||||
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
forEach<T>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
|
||||
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that contains the results.
|
||||
* @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
|
||||
* @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
map<T, U>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
|
||||
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
filter<T>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
|
||||
@@ -1021,53 +1016,53 @@ interface ArrayConstructor {
|
||||
*/
|
||||
reduce<T>(array: ArrayLike<T>, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
|
||||
*/
|
||||
reduceRight<T, U>(array: ArrayLike<T>, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
|
||||
*/
|
||||
reduceRight<T>(array: ArrayLike<T>, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries<T>(array: ArrayLike<T>): IterableIterator<[number, T]>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys<T>(array: ArrayLike<T>): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values<T>(array: ArrayLike<T>): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find<T>(array: ArrayLike<T>, predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex<T>(array: ArrayLike<T>, predicate: (value: T) => boolean, thisArg?: any): number;
|
||||
@@ -1075,21 +1070,21 @@ interface ArrayConstructor {
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
fill<T>(array: ArrayLike<T>, value: T, start?: number, end?: number): T[];
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
copyWithin<T>(array: ArrayLike<T>, target: number, start: number, end?: number): T[];
|
||||
|
||||
@@ -1113,7 +1108,7 @@ interface ObjectConstructor {
|
||||
* Non-standard.
|
||||
*/
|
||||
classof(value: any): string;
|
||||
|
||||
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
@@ -1477,13 +1472,13 @@ declare module core {
|
||||
}
|
||||
|
||||
declare module "core-js" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/shim" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/core" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/core/$for" {
|
||||
import $for = core.$for;
|
||||
@@ -2149,10 +2144,10 @@ declare module "core-js/fn/symbol/unscopables" {
|
||||
export = unscopables;
|
||||
}
|
||||
declare module "core-js/es5" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/es6" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/es6/array" {
|
||||
var Array: typeof core.Array;
|
||||
@@ -2211,7 +2206,7 @@ declare module "core-js/es6/weak-set" {
|
||||
export = WeakSet;
|
||||
}
|
||||
declare module "core-js/es7" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/es7/array" {
|
||||
var Array: typeof core.Array;
|
||||
@@ -2238,32 +2233,32 @@ declare module "core-js/es7/string" {
|
||||
export = String;
|
||||
}
|
||||
declare module "core-js/js" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/js/array" {
|
||||
var Array: typeof core.Array;
|
||||
export = Array;
|
||||
}
|
||||
declare module "core-js/web" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/web/dom" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/web/immediate" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/web/timers" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/shim" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/core" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/core/$for" {
|
||||
import $for = core.$for;
|
||||
@@ -2928,10 +2923,10 @@ declare module "core-js/libary/fn/symbol/unscopables" {
|
||||
export = unscopables;
|
||||
}
|
||||
declare module "core-js/libary/es5" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/es6" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/es6/array" {
|
||||
var Array: typeof core.Array;
|
||||
@@ -2990,7 +2985,7 @@ declare module "core-js/libary/es6/weak-set" {
|
||||
export = WeakSet;
|
||||
}
|
||||
declare module "core-js/libary/es7" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/es7/array" {
|
||||
var Array: typeof core.Array;
|
||||
@@ -3017,21 +3012,21 @@ declare module "core-js/libary/es7/string" {
|
||||
export = String;
|
||||
}
|
||||
declare module "core-js/libary/js" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/js/array" {
|
||||
var Array: typeof core.Array;
|
||||
export = Array;
|
||||
}
|
||||
declare module "core-js/libary/web" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/web/dom" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/web/immediate" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/web/timers" {
|
||||
export = core;
|
||||
export = core;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ module Tests.ui {
|
||||
activeStateEnabled: true,
|
||||
allowColumnReordering: true,
|
||||
allowColumnResizing: true,
|
||||
onCellClick: function () { },
|
||||
onCellClick: function() { },
|
||||
cellHintEnabled: true,
|
||||
columnAutoWidth: true,
|
||||
columnChooser: {
|
||||
@@ -17,67 +17,52 @@ module Tests.ui {
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
text: '5 columns with custom css class', value: [
|
||||
{ dataField: 'Processed', dataType: 'boolean', allowSorting: false },
|
||||
{ dataField: 'CustomerID', cssClass: 'customCssClass' },
|
||||
'OrderDate',
|
||||
{ dataField: 'Freight', validationRules: [{ type: "range", min: 1, max: 100 }] },
|
||||
{ dataField: 'ShipName', validationRules: [{ type: 'required' }] },
|
||||
'ShipCity']
|
||||
},
|
||||
{
|
||||
text: 'with show editor always', value: [
|
||||
{ dataField: 'Processed', dataType: 'boolean', allowSorting: false, showEditorAlways: true },
|
||||
{ dataField: 'OrderDate', dataType: 'date', showEditorAlways: true },
|
||||
{ dataField: 'CustomerID', showEditorAlways: true },
|
||||
{ dataField: 'Freight', showEditorAlways: true },
|
||||
{ dataField: 'ShipName', showEditorAlways: true }]
|
||||
},
|
||||
{
|
||||
text: 'custom template/edit/header template', value: [
|
||||
'CustomerID',
|
||||
'OrderDate',
|
||||
'Freight',
|
||||
{
|
||||
dataField: 'ShipVia',
|
||||
editCellTemplate: function (container: JQuery, options: { value: number }) {
|
||||
container.addClass('dx-editor-cell');
|
||||
container.append($('<div />').dxSelectBox({
|
||||
value: options.value,
|
||||
dataSource: [
|
||||
{ ShipperID: 1, CompanyName: 'Speedy Express' },
|
||||
{ ShipperID: 2, CompanyName: 'United Package' },
|
||||
{ ShipperID: 3, CompanyName: 'Federal Shipping' }
|
||||
],
|
||||
valueExpr: 'ShipperID',
|
||||
displayExpr: 'CompanyName'
|
||||
}));
|
||||
},
|
||||
cellTemplate: function (container: JQuery, options: { value: number }) {
|
||||
container.text(String(options.value));
|
||||
},
|
||||
headerCellTemplate: function (container: JQuery, options: { headerCaption: string }) {
|
||||
container.append($('<div/>').css({ border: '1px solid red' }).text(options.headerCaption));
|
||||
}
|
||||
},
|
||||
'ShipName',
|
||||
'ShipCity']
|
||||
},
|
||||
{ text: 'none', value: '' },
|
||||
{
|
||||
text: 'custom template/header hogan template', value: [
|
||||
'CustomerID',
|
||||
'OrderDate',
|
||||
'Freight',
|
||||
{
|
||||
dataField: 'ShipVia',
|
||||
cellTemplate: '#hoganColumnTemplate',
|
||||
headerCellTemplate: $('#hoganHeaderColumnTemplate')
|
||||
},
|
||||
'ShipName',
|
||||
'ShipCity']
|
||||
}],
|
||||
customizeColumns: function (columns) {
|
||||
alignment: "center",
|
||||
allowFixing: true,
|
||||
allowEditing: true,
|
||||
allowFiltering: true,
|
||||
allowGrouping: true,
|
||||
allowHiding: true,
|
||||
allowReordering: true,
|
||||
allowResizing: true,
|
||||
allowSearch: true,
|
||||
allowSorting: true,
|
||||
autoExpandGroup: true,
|
||||
calculateCellValue: function(rowData: Object) { return "test-value"; },
|
||||
calculateFilterExpression: function(filterValue: any, selectedFilterOperation: string) { return []; },
|
||||
caption: "Test column",
|
||||
cellTemplate: function(container: JQuery, options: Object) { $("<span>Template</span>").appendTo(container); },
|
||||
cssClass: "test-ccs-class-name",
|
||||
customizeText: function(cellInfo: { value: any, valueText: string; }) { return "New text" },
|
||||
dataField: "Test",
|
||||
dataType: "string",
|
||||
encodeHtml: true,
|
||||
falseText: "FALSE",
|
||||
filterOperations: ["contains", "notcontains"],
|
||||
filterType: "exclude",
|
||||
filterValue: "Test-filter-value",
|
||||
fixed: true,
|
||||
fixedPosition: "right",
|
||||
groupIndex: 0,
|
||||
lookup: {
|
||||
allowClearing: true,
|
||||
dataSource: ["first", "second"],
|
||||
displayExpr: "this",
|
||||
valueExpr: "this"
|
||||
},
|
||||
name: "test-column-name",
|
||||
showEditorAlways: true,
|
||||
showInColumnChooser: true,
|
||||
showWhenGrouped: true,
|
||||
sortIndex: 1,
|
||||
sortOrder: "desc",
|
||||
trueText: "TRUE",
|
||||
visible: true,
|
||||
visibleIndex: 0,
|
||||
width: "100%"
|
||||
}
|
||||
],
|
||||
customizeColumns: function(columns) {
|
||||
var i: number;
|
||||
for (i = 0; i < columns.length; i++) {
|
||||
if (columns[i].dataField.indexOf('Date') > 0) {
|
||||
@@ -94,16 +79,16 @@ module Tests.ui {
|
||||
valueExpr: 'CustomerID',
|
||||
displayExpr: 'ContactName'
|
||||
}
|
||||
}
|
||||
}
|
||||
if (columns[i].dataField === 'EmployeeID') {
|
||||
columns[i].lookup = {
|
||||
dataSource: { store: [], sort: 'LastName' },
|
||||
valueExpr: 'EmployeeID',
|
||||
displayExpr: function (data: any) {
|
||||
displayExpr: function(data: any) {
|
||||
return data.LastName + ' ' + data.FirstName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (columns[i].dataField === 'ShipVia') {
|
||||
columns[i].lookup = {
|
||||
dataSource: [
|
||||
@@ -114,14 +99,14 @@ module Tests.ui {
|
||||
valueExpr: 'ShipperID',
|
||||
displayExpr: 'CompanyName'
|
||||
}
|
||||
}
|
||||
}
|
||||
if (columns[i].dataField === 'ShipCity') {
|
||||
columns[i].editCellTemplate = function (container: JQuery, options: { value: string; setValue: Function }) {
|
||||
columns[i].editCellTemplate = function(container: JQuery, options: { value: string; setValue: Function }) {
|
||||
$('<div/>').dxAutocomplete({
|
||||
items: ["Bern", "Lyon", "Lander"],
|
||||
dataSource: ["Bern", "Lyon", "Lander"],
|
||||
value: options.value,
|
||||
onValueChanged: function (e:{ value: string }) {
|
||||
options.setValue(e.value);
|
||||
onValueChanged: function() {
|
||||
options.setValue("test-value");
|
||||
}
|
||||
}).appendTo(container);
|
||||
}
|
||||
@@ -242,10 +227,10 @@ module Tests.viz {
|
||||
{ valueField: 's8' }
|
||||
],
|
||||
title: 'Long Chart\'s Title',
|
||||
onPointClick: function (arg: any) {
|
||||
onPointClick: function(arg: any) {
|
||||
arg.target.isSelected() ? arg.target.clearSelection() : arg.target.select();
|
||||
},
|
||||
onSeriesClick: function (arg: any) {
|
||||
onSeriesClick: function(arg: any) {
|
||||
arg.target.isVisible() ? arg.target.hide() : arg.target.show();
|
||||
}
|
||||
};
|
||||
@@ -313,8 +298,8 @@ module Tests.data {
|
||||
pageSize: 25,
|
||||
paginate: true,
|
||||
|
||||
map: function (item) { return item; },
|
||||
postProcess: function (data) { return data; },
|
||||
map: function(item) { return item; },
|
||||
postProcess: function(data) { return data; },
|
||||
searchExpr: "expr",
|
||||
searchOperation: "contains",
|
||||
searchValue: "somevalue",
|
||||
@@ -328,7 +313,7 @@ module Tests.data {
|
||||
});
|
||||
|
||||
new DevExpress.data.CustomStore(<DevExpress.data.CustomStoreOptions>{
|
||||
load: function () {
|
||||
load: function() {
|
||||
return $.Deferred().promise();
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+80
-77
@@ -35,7 +35,7 @@ declare module DevExpress {
|
||||
brokenRules: any[];
|
||||
validators: IValidator[];
|
||||
}
|
||||
export interface GroupConfig extends EventsMixin<GroupConfig> {
|
||||
export interface GroupConfig extends EventsMixin<GroupConfig> {
|
||||
group: any;
|
||||
validators: IValidator[];
|
||||
validate(): ValidationGroupValidationResult;
|
||||
@@ -56,7 +56,7 @@ declare module DevExpress {
|
||||
/** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */
|
||||
export function validateModel(model: Object): ValidationGroupValidationResult;
|
||||
/** Registers all the dxValidator objects by which the fields of the specified ViewModel are extended. */
|
||||
export function registerModelForValidation(model: Object) : void;
|
||||
export function registerModelForValidation(model: Object): void;
|
||||
}
|
||||
export var hardwareBackButton: JQueryCallback;
|
||||
/** Processes the hardware back button click. */
|
||||
@@ -1789,7 +1789,7 @@ declare module DevExpress.ui {
|
||||
interval?: number;
|
||||
/** Specifies the maximum zoom level of a calendar, which is used to pick the date. */
|
||||
maxZoomLevel?: string;
|
||||
/** Specifies the minimal zoom level of a calendar, which is used to pick the date. */
|
||||
/** Specifies the minimal zoom level of a calendar, which is used to pick the date. */
|
||||
minZoomLevel?: string;
|
||||
/** Specifies the type of date/time picker. */
|
||||
pickerType?: string;
|
||||
@@ -1869,7 +1869,7 @@ declare module DevExpress.ui {
|
||||
/** A container widget used to arrange inner elements. */
|
||||
export class dxBox extends CollectionWidget {
|
||||
constructor(element: JQuery, options?: dxBoxOptions);
|
||||
constructor(element: Element, options?: dxBoxOptions);
|
||||
constructor(element: Element, options?: dxBoxOptions);
|
||||
}
|
||||
export interface dxResponsiveBoxOptions extends CollectionWidgetOptions {
|
||||
/** Specifies the collection of rows for the grid used to position layout elements. */
|
||||
@@ -3041,7 +3041,7 @@ declare module DevExpress.ui {
|
||||
lookup?: {
|
||||
/** Specifies whether or not a user can nullify values of a lookup column. */
|
||||
allowClearing?: boolean;
|
||||
/**
|
||||
/**
|
||||
* Specifies the data source providing data for a lookup column.
|
||||
*/
|
||||
dataSource?: any;
|
||||
@@ -3076,6 +3076,9 @@ declare module DevExpress.ui {
|
||||
showInColumnChooser?: boolean;
|
||||
/** Specifies the identifier of the column. */
|
||||
name?: string;
|
||||
// NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
|
||||
text?: string;
|
||||
value?: any;
|
||||
}
|
||||
export interface dxDataGridOptions extends WidgetOptions {
|
||||
/** Specifies whether the outer borders of the grid are visible or not. */
|
||||
@@ -3171,7 +3174,7 @@ declare module DevExpress.ui {
|
||||
cancel?: string;
|
||||
}
|
||||
};
|
||||
/**
|
||||
/**
|
||||
* An array of grid columns.
|
||||
*/
|
||||
columns?: dxDataGridColumn[];
|
||||
@@ -3271,7 +3274,7 @@ declare module DevExpress.ui {
|
||||
autoExpandAll?: boolean;
|
||||
/** Specifies the message displayed in a group row when the corresponding group is continued from the previous page. */
|
||||
groupContinuedMessage?: string;
|
||||
/**
|
||||
/**
|
||||
* Specifies the message displayed in a group row when the corresponding group continues on the next page.
|
||||
*/
|
||||
groupContinuesMessage?: string;
|
||||
@@ -3653,7 +3656,7 @@ declare module DevExpress.ui {
|
||||
removeRow(rowIndex: number): void;
|
||||
/** Saves changes made in a grid. */
|
||||
saveEditData(): void;
|
||||
/**
|
||||
/**
|
||||
* Searches grid records by a search string.
|
||||
*/
|
||||
searchByText(text: string): void;
|
||||
@@ -4332,16 +4335,16 @@ declare module DevExpress.viz.core {
|
||||
}) => void;
|
||||
/** A handler for the incidentOccurred event. */
|
||||
onIncidentOccurred?: (
|
||||
component: BaseWidget,
|
||||
element: Element,
|
||||
target: {
|
||||
id: string;
|
||||
type: string;
|
||||
args: any;
|
||||
text: string;
|
||||
widget: string;
|
||||
version: string;
|
||||
}
|
||||
component: BaseWidget,
|
||||
element: Element,
|
||||
target: {
|
||||
id: string;
|
||||
type: string;
|
||||
args: any;
|
||||
text: string;
|
||||
widget: string;
|
||||
version: string;
|
||||
}
|
||||
) => void;
|
||||
/** Notifies a widget that it is embedded into an HTML page that uses a path modifier. */
|
||||
pathModified?: boolean;
|
||||
@@ -4656,59 +4659,59 @@ declare module DevExpress.viz.charts {
|
||||
};
|
||||
}
|
||||
export interface CommonPointOptions {
|
||||
/** Specifies border options for points in the line and area series. */
|
||||
/** Specifies border options for points in the line and area series. */
|
||||
border?: viz.core.Border;
|
||||
/** Specifies the points color. */
|
||||
color?: string;
|
||||
/** Specifies what series points to highlight when a point is hovered over. */
|
||||
hoverMode?: string;
|
||||
/** An object defining configuration options for a hovered point. */
|
||||
hoverStyle?: {
|
||||
/** An object defining the border options for a hovered point. */
|
||||
border?: viz.core.Border;
|
||||
/** Specifies the points color. */
|
||||
/** Sets a color for a point when it is hovered over. */
|
||||
color?: string;
|
||||
/** Specifies what series points to highlight when a point is hovered over. */
|
||||
hoverMode?: string;
|
||||
/** An object defining configuration options for a hovered point. */
|
||||
hoverStyle?: {
|
||||
/** An object defining the border options for a hovered point. */
|
||||
border?: viz.core.Border;
|
||||
/** Sets a color for a point when it is hovered over. */
|
||||
color?: string;
|
||||
/** Specifies the diameter of a hovered point in the series that represents data points as symbols (not as bars for instance). */
|
||||
size?: number;
|
||||
};
|
||||
/** Specifies what series points to highlight when a point is selected. */
|
||||
selectionMode?: string;
|
||||
/** An object defining configuration options for a selected point. */
|
||||
selectionStyle?: {
|
||||
/** An object defining the border options for a selected point. */
|
||||
border?: viz.core.Border;
|
||||
/** <p>Sets a color for a point when it is selected.</p> */
|
||||
color?: string;
|
||||
/** Specifies the diameter of a selected point in the series that represents data points as symbols (not as bars for instance). */
|
||||
size?: number;
|
||||
};
|
||||
/** Specifies the point diameter in pixels for those series that represent data points as symbols (not as bars for instance). */
|
||||
/** Specifies the diameter of a hovered point in the series that represents data points as symbols (not as bars for instance). */
|
||||
size?: number;
|
||||
/** Specifies a symbol for presenting points of the line and area series. */
|
||||
symbol?: string;
|
||||
visible?: boolean;
|
||||
};
|
||||
/** Specifies what series points to highlight when a point is selected. */
|
||||
selectionMode?: string;
|
||||
/** An object defining configuration options for a selected point. */
|
||||
selectionStyle?: {
|
||||
/** An object defining the border options for a selected point. */
|
||||
border?: viz.core.Border;
|
||||
/** <p>Sets a color for a point when it is selected.</p> */
|
||||
color?: string;
|
||||
/** Specifies the diameter of a selected point in the series that represents data points as symbols (not as bars for instance). */
|
||||
size?: number;
|
||||
};
|
||||
/** Specifies the point diameter in pixels for those series that represent data points as symbols (not as bars for instance). */
|
||||
size?: number;
|
||||
/** Specifies a symbol for presenting points of the line and area series. */
|
||||
symbol?: string;
|
||||
visible?: boolean;
|
||||
}
|
||||
export interface ChartCommonPointOptions extends CommonPointOptions {
|
||||
/** An object specifying the parameters of an image that is used as a point marker. */
|
||||
image?: {
|
||||
/** Specifies the height of an image that is used as a point marker. */
|
||||
height?: any;
|
||||
/** Specifies a URL leading to the image to be used as a point marker. */
|
||||
url?: any;
|
||||
/** Specifies the width of an image that is used as a point marker. */
|
||||
width?: any;
|
||||
};
|
||||
/** An object specifying the parameters of an image that is used as a point marker. */
|
||||
image?: {
|
||||
/** Specifies the height of an image that is used as a point marker. */
|
||||
height?: any;
|
||||
/** Specifies a URL leading to the image to be used as a point marker. */
|
||||
url?: any;
|
||||
/** Specifies the width of an image that is used as a point marker. */
|
||||
width?: any;
|
||||
};
|
||||
}
|
||||
export interface PolarCommonPointOptions extends CommonPointOptions {
|
||||
/** An object specifying the parameters of an image that is used as a point marker. */
|
||||
image?: {
|
||||
/** Specifies the height of an image that is used as a point marker. */
|
||||
height?: number;
|
||||
/** Specifies a URL leading to the image to be used as a point marker. */
|
||||
url?: string;
|
||||
/** Specifies the width of an image that is used as a point marker. */
|
||||
width?: number;
|
||||
};
|
||||
/** An object specifying the parameters of an image that is used as a point marker. */
|
||||
image?: {
|
||||
/** Specifies the height of an image that is used as a point marker. */
|
||||
height?: number;
|
||||
/** Specifies a URL leading to the image to be used as a point marker. */
|
||||
url?: string;
|
||||
/** Specifies the width of an image that is used as a point marker. */
|
||||
width?: number;
|
||||
};
|
||||
}
|
||||
/** An object that defines configuration options for chart series. */
|
||||
export interface CommonSeriesConfig extends BaseCommonSeriesConfig {
|
||||
@@ -5091,17 +5094,17 @@ declare module DevExpress.viz.charts {
|
||||
text?: string;
|
||||
}
|
||||
export interface AxisLabel {
|
||||
/** Specifies the text for a hint that appears when a user hovers the mouse pointer over a label on the value axis. */
|
||||
/** Specifies the text for a hint that appears when a user hovers the mouse pointer over a label on the value axis. */
|
||||
customizeHint?: (argument: { value: any; valueText: string }) => string;
|
||||
/** Specifies a callback function that returns the text to be displayed in value axis labels. */
|
||||
/** Specifies a callback function that returns the text to be displayed in value axis labels. */
|
||||
customizeText?: (argument: { value: any; valueText: string }) => string;
|
||||
/** Specifies a format for the text displayed by axis labels. */
|
||||
/** Specifies a format for the text displayed by axis labels. */
|
||||
format?: string;
|
||||
/** Specifies a precision for the formatted value displayed in the axis labels. */
|
||||
/** Specifies a precision for the formatted value displayed in the axis labels. */
|
||||
precision?: number;
|
||||
}
|
||||
export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel {}
|
||||
export interface PolarAxisLabel extends PolarCommonAxisLabel, AxisLabel {}
|
||||
export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel { }
|
||||
export interface PolarAxisLabel extends PolarCommonAxisLabel, AxisLabel { }
|
||||
export interface AxisTitle extends CommonAxisTitle {
|
||||
/** Specifies the text for the value axis title. */
|
||||
text?: string;
|
||||
@@ -5117,7 +5120,7 @@ declare module DevExpress.viz.charts {
|
||||
value?: any;
|
||||
}
|
||||
export interface PolarConstantLine extends PolarCommonConstantLineStyle {
|
||||
/** An object defining constant line label options. */
|
||||
/** An object defining constant line label options. */
|
||||
label?: PolarConstantLineLabel;
|
||||
/** Specifies a value to be displayed by a constant line. */
|
||||
value?: any;
|
||||
@@ -5170,7 +5173,7 @@ declare module DevExpress.viz.charts {
|
||||
/** Specifies the elements that will be highlighted when the argument axis is hovered over. */
|
||||
hoverMode?: string;
|
||||
}
|
||||
export interface ChartArgumentAxis extends ChartAxis, ArgumentAxis {}
|
||||
export interface ChartArgumentAxis extends ChartAxis, ArgumentAxis { }
|
||||
export interface PolarArgumentAxis extends PolarAxis, ArgumentAxis {
|
||||
/** Specifies a start angle for the argument axis in degrees. */
|
||||
startAngle?: number;
|
||||
@@ -5186,7 +5189,7 @@ declare module DevExpress.viz.charts {
|
||||
showZero?: boolean;
|
||||
/** Specifies the desired type of axis values. */
|
||||
valueType?: string;
|
||||
}
|
||||
}
|
||||
export interface ChartValueAxis extends ChartAxis, ValueAxis {
|
||||
/** Specifies the spacing, in pixels, between multiple value axes in a chart. */
|
||||
multipleAxesSpacing?: number;
|
||||
@@ -5385,7 +5388,7 @@ declare module DevExpress.viz.charts {
|
||||
/** Specifies whether a single series or multiple series can be selected in the chart. */
|
||||
seriesSelectionMode?: string;
|
||||
/** Specifies how the chart must behave when series point labels overlap. */
|
||||
resolveLabelOverlapping?: string;
|
||||
resolveLabelOverlapping?: string;
|
||||
}
|
||||
export interface Legend extends AdvancedLegend {
|
||||
/** Specifies whether the legend is located outside or inside the chart's plot. */
|
||||
@@ -5580,7 +5583,7 @@ declare module DevExpress.viz.charts {
|
||||
onLegendClick?: any;
|
||||
legendClick?: any;
|
||||
/** Specifies how the chart must behave when series point labels overlap. */
|
||||
resolveLabelOverlapping?: string;
|
||||
resolveLabelOverlapping?: string;
|
||||
}
|
||||
/** A circular chart widget for HTML JS applications. */
|
||||
export class dxPieChart extends BaseChart {
|
||||
@@ -5952,7 +5955,7 @@ declare module DevExpress.viz.rangeSelector {
|
||||
behavior?: {
|
||||
/** Indicates whether or not you can swap sliders. */
|
||||
allowSlidersSwap?: boolean;
|
||||
/**
|
||||
/**
|
||||
Indicates whether or not animation is enabled.
|
||||
*/
|
||||
animationEnabled?: boolean;
|
||||
@@ -6067,7 +6070,7 @@ Indicates whether or not animation is enabled.
|
||||
maxRange?: any;
|
||||
/** Specifies the number of minor ticks between neighboring major ticks. */
|
||||
minorTickCount?: number;
|
||||
/**
|
||||
/**
|
||||
Specifies an interval between minor ticks.
|
||||
*/
|
||||
minorTickInterval?: any;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="./dragula.d.ts" />
|
||||
|
||||
import dragula = require("dragula");
|
||||
|
||||
// containers
|
||||
|
||||
Vendored
+59
-64
@@ -12,7 +12,7 @@ interface IteratorResult<T> {
|
||||
|
||||
interface IterableShim<T> {
|
||||
/**
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
*/
|
||||
"_es6-shim iterator_"(): Iterator<T>;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ interface StringConstructor {
|
||||
|
||||
/**
|
||||
* String.raw is intended for use as a tag function of a Tagged Template String. When called
|
||||
* as such the first argument will be a well formed template call site object and the rest
|
||||
* as such the first argument will be a well formed template call site object and the rest
|
||||
* parameter will contain the substitution values.
|
||||
* @param template A well-formed template string call site representation.
|
||||
* @param substitutions A set of substitution values.
|
||||
@@ -49,40 +49,40 @@ interface StringConstructor {
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
|
||||
* value of the UTF-16 encoded code point starting at the string element at position pos in
|
||||
* the String resulting from converting this object to a String.
|
||||
* If there is no element at that position, the result is undefined.
|
||||
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
|
||||
* value of the UTF-16 encoded code point starting at the string element at position pos in
|
||||
* the String resulting from converting this object to a String.
|
||||
* If there is no element at that position, the result is undefined.
|
||||
* If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
|
||||
*/
|
||||
codePointAt(pos: number): number;
|
||||
|
||||
/**
|
||||
* Returns true if searchString appears as a substring of the result of converting this
|
||||
* object to a String, at one or more positions that are
|
||||
* Returns true if searchString appears as a substring of the result of converting this
|
||||
* object to a String, at one or more positions that are
|
||||
* greater than or equal to position; otherwise, returns false.
|
||||
* @param searchString search string
|
||||
* @param searchString search string
|
||||
* @param position If position is undefined, 0 is assumed, so as to search all of the String.
|
||||
*/
|
||||
includes(searchString: string, position?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* endPosition – length(this). Otherwise returns false.
|
||||
*/
|
||||
endsWith(searchString: string, endPosition?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns a String value that is made from count copies appended together. If count is 0,
|
||||
* Returns a String value that is made from count copies appended together. If count is 0,
|
||||
* T is the empty String is returned.
|
||||
* @param count number of copies to append
|
||||
*/
|
||||
repeat(count: number): string;
|
||||
|
||||
/**
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* position. Otherwise returns false.
|
||||
*/
|
||||
startsWith(searchString: string, position?: number): boolean;
|
||||
@@ -130,19 +130,14 @@ interface String {
|
||||
sub(): string;
|
||||
|
||||
/** Returns a <sup> HTML element */
|
||||
sup(): string;
|
||||
sup(): string;
|
||||
|
||||
/**
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
*/
|
||||
"_es6-shim iterator_"(): IterableIteratorShim<string>;
|
||||
}
|
||||
|
||||
interface ArrayLike<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
|
||||
interface ArrayConstructor {
|
||||
/**
|
||||
* Creates an array from an array-like object.
|
||||
@@ -180,24 +175,24 @@ interface ArrayConstructor {
|
||||
}
|
||||
|
||||
interface Array<T> {
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex(predicate: (value: T) => boolean, thisArg?: any): number;
|
||||
@@ -205,41 +200,41 @@ interface Array<T> {
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
fill(value: T, start?: number, end?: number): T[];
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
copyWithin(target: number, start: number, end?: number): T[];
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIteratorShim<[number, T]>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIteratorShim<number>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIteratorShim<T>;
|
||||
|
||||
/**
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
*/
|
||||
"_es6-shim iterator_"(): IterableIteratorShim<T>;
|
||||
}
|
||||
@@ -247,14 +242,14 @@ interface Array<T> {
|
||||
interface NumberConstructor {
|
||||
/**
|
||||
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
|
||||
* that is representable as a Number value, which is approximately:
|
||||
* that is representable as a Number value, which is approximately:
|
||||
* 2.2204460492503130808472633361816 x 10−16.
|
||||
*/
|
||||
EPSILON: number;
|
||||
|
||||
/**
|
||||
* Returns true if passed value is finite.
|
||||
* Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
|
||||
* Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
|
||||
* number. Only finite values of the type number, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
@@ -267,7 +262,7 @@ interface NumberConstructor {
|
||||
isInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
|
||||
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
|
||||
* number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter
|
||||
* to a number. Only values of the type number, that are also NaN, result in true.
|
||||
* @param number A numeric value.
|
||||
@@ -280,30 +275,30 @@ interface NumberConstructor {
|
||||
*/
|
||||
isSafeInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* The value of the largest integer n such that n and n + 1 are both exactly representable as
|
||||
* a Number value.
|
||||
/**
|
||||
* The value of the largest integer n such that n and n + 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1.
|
||||
*/
|
||||
MAX_SAFE_INTEGER: number;
|
||||
|
||||
/**
|
||||
* The value of the smallest integer n such that n and n − 1 are both exactly representable as
|
||||
* a Number value.
|
||||
/**
|
||||
* The value of the smallest integer n such that n and n − 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).
|
||||
*/
|
||||
MIN_SAFE_INTEGER: number;
|
||||
|
||||
/**
|
||||
* Converts a string to a floating-point number.
|
||||
* @param string A string that contains a floating-point number.
|
||||
* Converts a string to a floating-point number.
|
||||
* @param string A string that contains a floating-point number.
|
||||
*/
|
||||
parseFloat(string: string): number;
|
||||
|
||||
/**
|
||||
* Converts A string to an integer.
|
||||
* @param s A string to convert into a number.
|
||||
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
|
||||
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
|
||||
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
|
||||
* All other strings are considered decimal.
|
||||
*/
|
||||
@@ -312,7 +307,7 @@ interface NumberConstructor {
|
||||
|
||||
interface ObjectConstructor {
|
||||
/**
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
* @param target The target object to copy to.
|
||||
* @param sources One or more source objects to copy properties from.
|
||||
@@ -390,7 +385,7 @@ interface Math {
|
||||
log1p(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
|
||||
* Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
|
||||
* the natural logarithms).
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
@@ -497,21 +492,21 @@ interface Promise<T> {
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
prototype: Promise<any>;
|
||||
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
@@ -519,7 +514,7 @@ interface PromiseConstructor {
|
||||
all<T>(values: IterableShim<T | PromiseLike<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
@@ -670,4 +665,4 @@ declare module "es6-shim" {
|
||||
function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
|
||||
function setPrototypeOf(target: any, proto: any): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+6
@@ -106,6 +106,8 @@ declare module "express" {
|
||||
use(handler: ErrorRequestHandler): T;
|
||||
use(path: string, ...handler: RequestHandler[]): T;
|
||||
use(path: string, handler: ErrorRequestHandler): T;
|
||||
use(path: string[], ...handler: RequestHandler[]): T;
|
||||
use(path: string[], handler: ErrorRequestHandler[]): T;
|
||||
}
|
||||
|
||||
export function Router(options?: any): Router;
|
||||
@@ -410,6 +412,10 @@ declare module "express" {
|
||||
originalUrl: string;
|
||||
|
||||
url: string;
|
||||
|
||||
baseUrl: string;
|
||||
|
||||
app: Application;
|
||||
}
|
||||
|
||||
interface MediaType {
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
/// <reference path="faker.d.ts" />
|
||||
|
||||
import faker = require('faker');
|
||||
|
||||
faker.address.zipCode();
|
||||
faker.address.zipCode('###');
|
||||
faker.address.city();
|
||||
faker.address.city(0);
|
||||
faker.address.cityPrefix();
|
||||
faker.address.citySuffix();
|
||||
faker.address.streetName();
|
||||
faker.address.streetAddress();
|
||||
faker.address.streetAddress(false);;
|
||||
faker.address.streetSuffix();
|
||||
faker.address.streetPrefix();
|
||||
faker.address.secondaryAddress();
|
||||
faker.address.county();
|
||||
faker.address.country();
|
||||
faker.address.countryCode();
|
||||
faker.address.state();
|
||||
faker.address.state(false);
|
||||
faker.address.stateAbbr();
|
||||
faker.address.latitude();
|
||||
faker.address.longitude();
|
||||
|
||||
faker.commerce.color();
|
||||
faker.commerce.department();
|
||||
faker.commerce.productName();
|
||||
faker.commerce.price();
|
||||
faker.commerce.price(0, 0, 0, '#');
|
||||
faker.commerce.productAdjective();
|
||||
faker.commerce.productMaterial();
|
||||
faker.commerce.product();
|
||||
|
||||
faker.company.suffixes();
|
||||
faker.company.companyName();
|
||||
faker.company.companyName(0);
|
||||
faker.company.companySuffix();
|
||||
faker.company.catchPhrase();
|
||||
faker.company.bs();
|
||||
faker.company.catchPhraseAdjective();
|
||||
faker.company.catchPhraseDescriptor();
|
||||
faker.company.catchPhraseNoun();
|
||||
faker.company.bsAdjective();
|
||||
faker.company.bsBuzz();
|
||||
faker.company.bsNoun();
|
||||
|
||||
faker.date.past();
|
||||
faker.date.future();
|
||||
faker.date.between('foo', 'bar');
|
||||
faker.date.between(new Date(), new Date());
|
||||
faker.date.recent();
|
||||
faker.date.recent(100);
|
||||
faker.date.month();
|
||||
faker.date.month({
|
||||
abbr: true,
|
||||
context: true
|
||||
});
|
||||
faker.date.weekday();
|
||||
faker.date.weekday({
|
||||
abbr: true,
|
||||
context: true
|
||||
});
|
||||
|
||||
faker.finance.account();
|
||||
faker.finance.account(0);
|
||||
faker.finance.accountName();
|
||||
faker.finance.mask();
|
||||
faker.finance.mask(0, false, false);
|
||||
faker.finance.amount();
|
||||
faker.finance.amount(0, 0, 0, '#');
|
||||
faker.finance.transactionType();
|
||||
faker.finance.currencyCode();
|
||||
faker.finance.currencyName();
|
||||
faker.finance.currencySymbol();
|
||||
|
||||
faker.hacker.abbreviation();
|
||||
faker.hacker.adjective();
|
||||
faker.hacker.noun();
|
||||
faker.hacker.verb();
|
||||
faker.hacker.ingverb();
|
||||
faker.hacker.phrase();
|
||||
|
||||
faker.helpers.randomize();
|
||||
faker.helpers.randomize([1,2,3,4]);
|
||||
faker.helpers.randomize(['foo', 'bar', 'quux']);
|
||||
faker.helpers.slugify('foo bar quux');
|
||||
faker.helpers.replaceSymbolWithNumber('foo# bar#');
|
||||
faker.helpers.replaceSymbols('foo# bar? quux#');
|
||||
faker.helpers.shuffle(['foo', 'bar', 'quux']);
|
||||
faker.helpers.mustache('{{foo}}{{bar}}', {foo: 'x', bar: 'y'});
|
||||
faker.helpers.createCard();
|
||||
faker.helpers.contextualCard();
|
||||
faker.helpers.userCard();
|
||||
|
||||
faker.internet.avatar();
|
||||
faker.internet.email();
|
||||
faker.internet.email('foo', 'bar', 'quux');
|
||||
faker.internet.protocol();
|
||||
faker.internet.url();
|
||||
faker.internet.domainName();
|
||||
faker.internet.domainSuffix();
|
||||
faker.internet.domainWord();
|
||||
faker.internet.ip();
|
||||
faker.internet.userAgent();
|
||||
faker.internet.color();
|
||||
faker.internet.color(0, 0, 0);
|
||||
faker.internet.mac();
|
||||
faker.internet.password();
|
||||
faker.internet.password(0, false, '#', 'foo');
|
||||
|
||||
faker.lorem.words();
|
||||
faker.lorem.words(0);
|
||||
faker.lorem.sentence();
|
||||
faker.lorem.sentence(0, 0);
|
||||
faker.lorem.sentences();
|
||||
faker.lorem.sentences(0);
|
||||
faker.lorem.paragraph();
|
||||
faker.lorem.paragraph(0);
|
||||
faker.lorem.paragraphs();
|
||||
faker.lorem.paragraphs(0, '');
|
||||
|
||||
faker.name.firstName();
|
||||
faker.name.firstName(0);
|
||||
faker.name.lastName();
|
||||
faker.name.lastName(0);
|
||||
faker.name.findName();
|
||||
faker.name.findName('', '', 0);
|
||||
faker.name.jobTitle();
|
||||
faker.name.prefix();
|
||||
faker.name.suffix();
|
||||
faker.name.title();
|
||||
faker.name.jobDescriptor();
|
||||
faker.name.jobArea();
|
||||
faker.name.jobType();
|
||||
|
||||
faker.phone.phoneNumber();
|
||||
faker.phone.phoneNumber('#');
|
||||
faker.phone.phoneNumberFormat();
|
||||
// https://github.com/Marak/faker.js/blob/master/lib/phone_number.js#L9-L13
|
||||
faker.phone.phoneNumberFormat(0);
|
||||
faker.phone.phoneFormats();
|
||||
|
||||
faker.random.number();
|
||||
faker.random.number(0);
|
||||
faker.random.number({
|
||||
min: 0,
|
||||
max: 0,
|
||||
precision: 0
|
||||
});
|
||||
faker.random.arrayElement();
|
||||
faker.random.arrayElement(['foo', 'bar', 'quux'])
|
||||
faker.random.objectElement();
|
||||
faker.random.objectElement({foo: 'bar', field: 'foo'});
|
||||
faker.random.uuid();
|
||||
faker.random.boolean();
|
||||
Vendored
+260
@@ -0,0 +1,260 @@
|
||||
// Type definitions for faker
|
||||
// Project: http://marak.com/faker.js/
|
||||
// Definitions by: Bas Pennings <https://github.com/basp/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module Faker {
|
||||
interface Post {
|
||||
words: string;
|
||||
sentence: string;
|
||||
sentences: string;
|
||||
paragraph: string;
|
||||
}
|
||||
|
||||
interface Address {
|
||||
street: string;
|
||||
suite: string;
|
||||
city: string;
|
||||
zipcode: string;
|
||||
geo: {
|
||||
lat: string;
|
||||
lon: string
|
||||
}
|
||||
}
|
||||
|
||||
interface Transaction {
|
||||
amount: number,
|
||||
date: Date,
|
||||
business: string,
|
||||
name: string,
|
||||
type: string,
|
||||
account: string
|
||||
}
|
||||
|
||||
interface Company {
|
||||
name: string;
|
||||
catchPhrase: string;
|
||||
bs: string;
|
||||
}
|
||||
|
||||
interface Card {
|
||||
name: string;
|
||||
username: string;
|
||||
email: string;
|
||||
address: Address;
|
||||
phone: string,
|
||||
website: string,
|
||||
company: Company;
|
||||
posts: Post[],
|
||||
accountHistory: Transaction[]
|
||||
}
|
||||
|
||||
interface ContextualCard {
|
||||
name: string;
|
||||
username: string;
|
||||
avatar: string;
|
||||
email: string;
|
||||
dob: Date;
|
||||
phone: string;
|
||||
address: Address;
|
||||
website: string;
|
||||
company: Company;
|
||||
}
|
||||
|
||||
interface UserCard {
|
||||
name: string;
|
||||
username: string;
|
||||
email: string;
|
||||
address: Address;
|
||||
phone: string;
|
||||
website: string;
|
||||
company: Company;
|
||||
}
|
||||
|
||||
interface AddressGenerators {
|
||||
zipCode(format?: string): string;
|
||||
city(format?: number): string;
|
||||
cityPrefix(): string;
|
||||
citySuffix(): string;
|
||||
streetName(): string;
|
||||
streetAddress(useFullAddress?: boolean): string;
|
||||
streetSuffix(): string;
|
||||
streetPrefix(): string;
|
||||
secondaryAddress(): string;
|
||||
county(): string;
|
||||
country(): string;
|
||||
countryCode(): string;
|
||||
state(useAbbr?: boolean): string;
|
||||
stateAbbr(): string;
|
||||
latitude(): string;
|
||||
longitude(): string;
|
||||
}
|
||||
|
||||
interface CommerceGenerators {
|
||||
color(): string;
|
||||
department(): string;
|
||||
productName(): string;
|
||||
price(min?: number, max?: number, dec?: number, symbol?: string): string;
|
||||
productAdjective(): string;
|
||||
productMaterial(): string;
|
||||
product(): string;
|
||||
}
|
||||
|
||||
interface CompanyGenerators {
|
||||
suffixes(): string[];
|
||||
companyName(format?: number): string;
|
||||
companySuffix(): string;
|
||||
catchPhrase(): string;
|
||||
bs(): string;
|
||||
catchPhraseAdjective(): string;
|
||||
catchPhraseDescriptor(): string;
|
||||
catchPhraseNoun(): string;
|
||||
bsAdjective(): string;
|
||||
bsBuzz(): string;
|
||||
bsNoun(): string;
|
||||
}
|
||||
|
||||
interface DateGenerators {
|
||||
past(years?: number, refDate?: Date|string): Date;
|
||||
future(years?: number, refDate?: Date|string): Date;
|
||||
between(from: Date|string, to: Date|string): Date;
|
||||
recent(days?: number): Date;
|
||||
month(options?: {
|
||||
abbr?: boolean,
|
||||
context?: boolean
|
||||
}): string;
|
||||
weekday(options?: {
|
||||
abbr?: boolean,
|
||||
context?: boolean
|
||||
}): string;
|
||||
}
|
||||
|
||||
interface FinanceGenerators {
|
||||
account(length?: number): string;
|
||||
accountName(): string;
|
||||
mask(length?: number, parens?: boolean, elipsis?: boolean): string;
|
||||
amount(min?: number, max?: number, dec?: number, symbol?: string): string;
|
||||
transactionType(): string;
|
||||
currencyCode(): string;
|
||||
currencyName(): string;
|
||||
currencySymbol(): string;
|
||||
}
|
||||
|
||||
interface HackerGenerators {
|
||||
abbreviation(): string;
|
||||
adjective(): string;
|
||||
noun(): string;
|
||||
verb(): string;
|
||||
ingverb(): string;
|
||||
phrase(): string;
|
||||
}
|
||||
|
||||
interface Helpers {
|
||||
randomize<T>(array?: Array<T>): T;
|
||||
slugify(str: string): string;
|
||||
replaceSymbolWithNumber(s: string, symbol?: string): string;
|
||||
replaceSymbols(str: string): string;
|
||||
shuffle<T>(array: Array<T>): Array<T>;
|
||||
mustache(str: string, data: Object): string;
|
||||
createCard(): Card;
|
||||
contextualCard(): Card;
|
||||
userCard(): UserCard;
|
||||
createTransaction(): Transaction;
|
||||
}
|
||||
|
||||
interface ImageGenerators {
|
||||
image(): string;
|
||||
avator(): string;
|
||||
imageUrl(width?: number, height?: number, category?: string): string;
|
||||
abstract(width?: number, height?: number): string;
|
||||
animals(width?: number, height?: number): string;
|
||||
business(width?: number, height?: number): string;
|
||||
cats(width?: number, height?: number): string;
|
||||
city(width?: number, height?: number): string;
|
||||
food(width?: number, height?: number): string;
|
||||
nightlife(width?: number, height?: number): string;
|
||||
fashion(width?: number, height?: number): string;
|
||||
people(width?: number, height?: number): string;
|
||||
nature(width?: number, height?: number): string;
|
||||
sports(width?: number, height?: number): string;
|
||||
technics(width?: number, height?: number): string;
|
||||
transport(width?: number, height?: number): string;
|
||||
}
|
||||
|
||||
interface InternetGenerators {
|
||||
avatar(): string;
|
||||
email(firstName?: string, lastName?: string, provider?: string): string;
|
||||
userName(firstName?: string, lastName?: string): string;
|
||||
protocol(): string;
|
||||
url(): string;
|
||||
domainName(): string;
|
||||
domainSuffix(): string;
|
||||
domainWord(): string;
|
||||
ip(): string;
|
||||
userAgent(): string;
|
||||
color(baseRed255?: number, baseGreen255?: number, baseBlue255?: number): string;
|
||||
mac(): string;
|
||||
password(len?: number, memorable?: boolean, pattern?: string, prefix?: string): string;
|
||||
}
|
||||
|
||||
interface LoremGenerators {
|
||||
words(num?: number): string[];
|
||||
sentence(wordCount?: number, range?: number): string;
|
||||
sentences(sentenceCount?: number): string;
|
||||
paragraph(sentenceCount?: number): string;
|
||||
paragraphs(paragraphCount?: number, separator?: string): string;
|
||||
}
|
||||
|
||||
interface NameGenerators {
|
||||
firstName(gender?: number): string;
|
||||
lastName(gender?: number): string;
|
||||
findName(firstName?: string, lastName?: string, gender?: number): string;
|
||||
jobTitle(): string;
|
||||
prefix(): string;
|
||||
suffix(): string;
|
||||
title(): string;
|
||||
jobDescriptor(): string;
|
||||
jobArea(): string;
|
||||
jobType(): string;
|
||||
}
|
||||
|
||||
interface PhoneGenerators {
|
||||
phoneNumber(format?: string): string;
|
||||
// https://github.com/Marak/faker.js/blob/master/lib/phone_number.js#L9-L13
|
||||
phoneNumberFormat(phoneFormatsArrayIndex?: number): string;
|
||||
phoneFormats(): string;
|
||||
}
|
||||
|
||||
interface RandomGenerators {
|
||||
number(max: number): number;
|
||||
number(options?: {
|
||||
min?: number,
|
||||
max?: number,
|
||||
precision?: number
|
||||
}): number;
|
||||
arrayElement<T>(array?: Array<T>): T;
|
||||
objectElement(object?: Object, field?: string): any;
|
||||
uuid(): string;
|
||||
boolean(): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "faker" {
|
||||
var faker: {
|
||||
address: Faker.AddressGenerators;
|
||||
commerce: Faker.CommerceGenerators;
|
||||
company: Faker.CompanyGenerators;
|
||||
date: Faker.DateGenerators;
|
||||
finance: Faker.FinanceGenerators;
|
||||
hacker: Faker.HackerGenerators;
|
||||
helpers: Faker.Helpers;
|
||||
image: Faker.ImageGenerators;
|
||||
internet: Faker.InternetGenerators;
|
||||
lorem: Faker.LoremGenerators;
|
||||
name: Faker.NameGenerators;
|
||||
phone: Faker.PhoneGenerators;
|
||||
random: Faker.RandomGenerators;
|
||||
}
|
||||
|
||||
export = faker;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
///<reference path='fontoxml.d.ts' />
|
||||
|
||||
var workflow:com.fontoxml.IWorkflowInfo = {
|
||||
id:"1",
|
||||
displayName:"workflow"
|
||||
}
|
||||
|
||||
var user:com.fontoxml.IUserInfo = {
|
||||
id: "123",
|
||||
displayName: "test",
|
||||
roleId: "editor"
|
||||
}
|
||||
|
||||
var init:com.fontoxml.IInvocator = {
|
||||
documentIds: ["11-22-33","44-55-66"],
|
||||
cmsBaseUrl: "/test/",
|
||||
editSessionToken: "aa-bb-cc-dd-ee",
|
||||
user: user,
|
||||
workflow: workflow,
|
||||
autosave: false,
|
||||
heartbeat: 300
|
||||
}
|
||||
|
||||
var simpleinit:com.fontoxml.IInvocator = {
|
||||
documentIds: ["11-22-33","44-55-66"],
|
||||
cmsBaseUrl: "/test/",
|
||||
editSessionToken: "aa-bb-cc-dd-ee"
|
||||
}
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// Type definitions for FontoXML
|
||||
// Project: http://www.fontoxml.com/
|
||||
// Definitions by: Roland Zwaga <https://github.com/rolandzwaga>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module com.fontoxml
|
||||
{
|
||||
//This is a description of how to invoke the FontoXML editor, and instruct it to load (a) document(s).
|
||||
//Please keep in mind that the URL length may be limited in certain browsers, so a safe limit of 2000 characters
|
||||
//for the whole URL including query parameters should be used.
|
||||
export interface IInvocator
|
||||
{
|
||||
//The document id's of the documents to load from the CMS.
|
||||
documentIds: string[];
|
||||
//The base URL where the CMS endpoints are exposed.
|
||||
cmsBaseUrl: string;
|
||||
//The edit session token to use for accessing the CMS endpoints.
|
||||
editSessionToken: string;
|
||||
//User information.
|
||||
user?: IUserInfo;
|
||||
//Workflow information.
|
||||
workflow?: IWorkflowInfo;
|
||||
//Allow/disallow auto-save functionality.
|
||||
autosave?: boolean;
|
||||
//If set to a positive integer, enable the Heartbeat API to send every x seconds.
|
||||
heartbeat?: number;
|
||||
}
|
||||
|
||||
export interface IWorkflowInfo
|
||||
{
|
||||
id:string;
|
||||
displayName:string;
|
||||
}
|
||||
|
||||
export interface IUserInfo extends IWorkflowInfo
|
||||
{
|
||||
roleId:string;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,6 +43,8 @@ app.on('ready', () => {
|
||||
|
||||
// and load the index.html of the app.
|
||||
mainWindow.loadUrl(`file://${__dirname}/index.html`);
|
||||
mainWindow.loadUrl('file://foo/bar', {userAgent: 'cool-agent', httpReferrer: 'greateRefferer'});
|
||||
mainWindow.webContents.loadUrl('file://foo/bar', {userAgent: 'cool-agent', httpReferrer: 'greateRefferer'});
|
||||
|
||||
mainWindow.openDevTools()
|
||||
var opened: boolean = mainWindow.isDevToolsOpened()
|
||||
@@ -409,6 +411,7 @@ app.on('ready', () => {
|
||||
]);
|
||||
appIcon.setToolTip('This is my application.');
|
||||
appIcon.setContextMenu(contextMenu);
|
||||
appIcon.setImage('/path/to/new/icon');
|
||||
});
|
||||
|
||||
// clipboard
|
||||
|
||||
Vendored
+9
-3
@@ -400,7 +400,10 @@ declare module GitHubElectron {
|
||||
/**
|
||||
* Same with webContents.loadUrl(url).
|
||||
*/
|
||||
loadUrl(url: string): void;
|
||||
loadUrl(url: string, options?: {
|
||||
httpReferrer?: string;
|
||||
userAgent?: string;
|
||||
}): void;
|
||||
/**
|
||||
* Same with webContents.reload.
|
||||
*/
|
||||
@@ -537,7 +540,10 @@ declare module GitHubElectron {
|
||||
* Loads the url in the window.
|
||||
* @param url Must contain the protocol prefix (e.g., the http:// or file://).
|
||||
*/
|
||||
loadUrl(url: string): void;
|
||||
loadUrl(url: string, options?: {
|
||||
httpReferrer?: string;
|
||||
userAgent?: string;
|
||||
}): void;
|
||||
/**
|
||||
* @returns The URL of current web page.
|
||||
*/
|
||||
@@ -1212,7 +1218,7 @@ declare module GitHubElectron {
|
||||
/**
|
||||
* Sets the image associated with this tray icon.
|
||||
*/
|
||||
setImage(image: NativeImage): void;
|
||||
setImage(image: NativeImage|string): void;
|
||||
/**
|
||||
* Sets the image associated with this tray icon when pressed.
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -32,7 +32,7 @@ declare module JQueryGlide {
|
||||
/**
|
||||
* Default: 500
|
||||
* Animation time in ms
|
||||
* @type {Int}
|
||||
* @type {number}
|
||||
*/
|
||||
animationDuration?: number;
|
||||
/**
|
||||
|
||||
Vendored
+1
@@ -13,6 +13,7 @@ declare module "gm" {
|
||||
module m {
|
||||
export interface ClassOptions {
|
||||
imageMagick?: boolean;
|
||||
nativeAutoOrient?: boolean;
|
||||
}
|
||||
|
||||
export interface CompareCallback {
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/// <reference path="gulp-cheerio.d.ts" />
|
||||
/// <reference path="../vinyl/vinyl.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
/// <reference path="../cheerio/cheerio.d.ts" />
|
||||
|
||||
import cheerio = require('gulp-cheerio');
|
||||
import gulp = require('gulp');
|
||||
import Vinyl = require('vinyl');
|
||||
|
||||
//
|
||||
// There are two ways to use gulp-cheerio: synchronous and asynchronous. See the following usage examples:
|
||||
//
|
||||
|
||||
gulp.task('sync', function () {
|
||||
return gulp
|
||||
.src(['src/*.html'])
|
||||
.pipe(cheerio(function ($: CheerioStatic, file: Vinyl) {
|
||||
// Each file will be run through cheerio and each corresponding `$` will be passed here.
|
||||
// `file` is the gulp file object
|
||||
// Make all h1 tags uppercase
|
||||
$('h1').each(function () {
|
||||
var h1 = $(this);
|
||||
h1.text(h1.text().toUpperCase());
|
||||
});
|
||||
}))
|
||||
.pipe(gulp.dest('dist/'));
|
||||
});
|
||||
gulp.task('async', function () {
|
||||
return gulp
|
||||
.src(['src/*.html'])
|
||||
.pipe(cheerio(function ($: CheerioStatic, file: Vinyl, done: Function) {
|
||||
// The only difference here is the inclusion of a `done` parameter.
|
||||
// Call `done` when everything is finished. `done` accepts an error if applicable.
|
||||
done();
|
||||
}))
|
||||
.pipe(gulp.dest('dist/'));
|
||||
});
|
||||
//TODO
|
||||
|
||||
|
||||
//
|
||||
// Additional options can be passed by passing an object as the main argument with your function as the run option:
|
||||
//
|
||||
|
||||
|
||||
gulp.task('sync', function () {
|
||||
return gulp
|
||||
.src(['src/*.html'])
|
||||
.pipe(cheerio({
|
||||
run: function ($: CheerioStatic, file: Vinyl) {
|
||||
// Each file will be run through cheerio and each corresponding `$` will be passed here.
|
||||
// `file` is the gulp file object
|
||||
// Make all h1 tags uppercase
|
||||
$('h1').each(function () {
|
||||
var h1 = $(this);
|
||||
h1.text(h1.text().toUpperCase());
|
||||
});
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('dist/'));
|
||||
});
|
||||
|
||||
gulp.task('async', function () {
|
||||
return gulp
|
||||
.src(['src/*.html'])
|
||||
.pipe(cheerio({
|
||||
run: function ($: CheerioStatic, file: Vinyl, done: Function) {
|
||||
// The only difference here is the inclusion of a `done` parameter.
|
||||
// Call `done` when everything is finished. `done` accepts an error if applicable.
|
||||
done();
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('dist/'));
|
||||
});
|
||||
|
||||
cheerio({
|
||||
run: function () {},
|
||||
parserOptions: {
|
||||
// Options here
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
cheerio({
|
||||
run: function () {},
|
||||
parserOptions: {
|
||||
xmlMode: true
|
||||
}
|
||||
});
|
||||
|
||||
cheerio({
|
||||
cheerio: require('../cheerio/cheerio.d.ts') as CheerioStatic // special version of `cheerio`
|
||||
});
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for gulp-cheerio
|
||||
// Project: https://github.com/KenPowers/gulp-cheerio
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../cheerio/cheerio.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../vinyl/vinyl.d.ts"/>
|
||||
|
||||
declare module "gulp-cheerio" {
|
||||
import Vinyl = require('vinyl');
|
||||
|
||||
namespace cheerio {
|
||||
interface Cheerio {
|
||||
(callback: Callback): NodeJS.ReadWriteStream;
|
||||
(option: Option): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
interface Callback {
|
||||
($: CheerioStatic, file: Vinyl, done?: Function): any;
|
||||
}
|
||||
|
||||
interface Option {
|
||||
run?: Callback;
|
||||
parserOptions?: CheerioOptionsInterface;
|
||||
cheerio?: CheerioStatic;
|
||||
}
|
||||
}
|
||||
|
||||
var cheerio: cheerio.Cheerio;
|
||||
|
||||
export = cheerio;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/// <reference path="gulp-coffeelint.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import coffeelint = require('gulp-coffeelint');
|
||||
import gulp = require('gulp');
|
||||
|
||||
|
||||
gulp.task('lint', function () {
|
||||
gulp.src('./src/*.coffee')
|
||||
.pipe(coffeelint())
|
||||
.pipe(coffeelint.reporter())
|
||||
});
|
||||
|
||||
gulp.src('./src/*.coffee')
|
||||
.pipe(coffeelint())
|
||||
.pipe(coffeelint.reporter('csv'));
|
||||
|
||||
|
||||
declare var stylish: Function;
|
||||
|
||||
gulp.src('./src/*.coffee')
|
||||
.pipe(coffeelint())
|
||||
.pipe(coffeelint.reporter(stylish));
|
||||
|
||||
gulp.src('./src/*.coffee')
|
||||
.pipe(coffeelint())
|
||||
.pipe(coffeelint.reporter('coffelint-stylish'));
|
||||
|
||||
gulp.src('./src/*.coffee')
|
||||
.pipe(coffeelint())
|
||||
.pipe(coffeelint.reporter('coffeelint-stylish'))
|
||||
.pipe(coffeelint.reporter('fail'));
|
||||
|
||||
var myReporter = (function() {
|
||||
function MyReporter(errorReport: any) {
|
||||
this.errorReport = errorReport;
|
||||
}
|
||||
|
||||
MyReporter.prototype.publish = function() {
|
||||
var hasError = this.errorReport.hasError();
|
||||
if (hasError) {
|
||||
return console.log('Oh no!');
|
||||
}
|
||||
return console.log('Oh yeah!');
|
||||
};
|
||||
|
||||
return MyReporter;
|
||||
})();
|
||||
|
||||
gulp.task('lint', function() {
|
||||
return gulp.src('./src/*.coffee')
|
||||
.pipe(coffeelint())
|
||||
.pipe(coffeelint.reporter(myReporter));
|
||||
});
|
||||
|
||||
|
||||
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for gulp-coffeelint
|
||||
// Project: https://github.com/janraasch/gulp-coffeelint
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-coffeelint" {
|
||||
namespace coffeelint {
|
||||
interface Coffeelint {
|
||||
/**
|
||||
* @param optFile Absolute path of a json file containing options for coffeelint.
|
||||
* @param opt Options you wish to send to coffeelint. If optFile is given, this will be ignored.
|
||||
* @param literate Are we dealing with Literate CoffeeScript?
|
||||
* @param rules Add custom rules to coffeelint.
|
||||
*/
|
||||
(optFile?: string, opt?: any, literate?: boolean, rules?: Function[]): NodeJS.ReadWriteStream;
|
||||
reporter(reporter?: string|Function): NodeJS.ReadWriteStream;
|
||||
}
|
||||
}
|
||||
|
||||
var coffeelint: coffeelint.Coffeelint;
|
||||
|
||||
export = coffeelint;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require("gulp");
|
||||
import concat = require("gulp-concat");
|
||||
import * as concat from "gulp-concat";
|
||||
|
||||
gulp.task("concat:simple", () => {
|
||||
gulp.src(["file*.txt"])
|
||||
|
||||
Vendored
+6
-3
@@ -35,8 +35,11 @@ declare module "gulp-concat" {
|
||||
contents?: NodeJS.ReadableStream | Buffer;
|
||||
}
|
||||
|
||||
function concat(filename: string, options?: IOptions): NodeJS.ReadWriteStream;
|
||||
function concat(options: IVinylOptions): NodeJS.ReadWriteStream;
|
||||
interface IConcat {
|
||||
(filename: string, options?: IOptions): NodeJS.ReadWriteStream;
|
||||
(options: IVinylOptions): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
export = concat;
|
||||
var _tmp: IConcat;
|
||||
export = _tmp;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path="gulp-gzip.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require('gulp');
|
||||
import gzip = require('gulp-gzip');
|
||||
|
||||
gzip({ append: true });
|
||||
|
||||
gzip({ extension: 'zip' }); // note that the `.` should not be included in the extension
|
||||
|
||||
gzip({ preExtension: 'gz' }); // note that the `.` should not be included in the extension
|
||||
|
||||
gzip({ threshold: '1kb' });
|
||||
|
||||
gzip({ threshold: 1024 });
|
||||
|
||||
gzip({ threshold: true });
|
||||
|
||||
gzip({ gzipOptions: { level: 9 } });
|
||||
|
||||
gzip({ gzipOptions: { memLevel: 1 } });
|
||||
|
||||
gulp.task('compress', function() {
|
||||
gulp.src('./dev/scripts/*.js')
|
||||
.pipe(gzip())
|
||||
.pipe(gulp.dest('./public/scripts'));
|
||||
});
|
||||
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
// Type definitions for gulp-gzip
|
||||
// Project: https://github.com/jstuckey/gulp-gzip
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-gzip" {
|
||||
import zlib = require('zlib');
|
||||
|
||||
namespace gzip {
|
||||
interface Gzip {
|
||||
(options?: Options): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Appends .gz file extension if true.
|
||||
* @default true
|
||||
*/
|
||||
append?: boolean;
|
||||
/**
|
||||
* Appends an arbitrary extension to the filename. Disables append and preExtension options.
|
||||
*/
|
||||
extension?: string;
|
||||
/**
|
||||
* Appends an arbitrary pre-extension to the filename. Disables append and extension options.
|
||||
*/
|
||||
preExtension?: string;
|
||||
/**
|
||||
* Minimum size required to compress a file.
|
||||
* @default false
|
||||
*/
|
||||
threshold?: number|string|boolean;
|
||||
/**
|
||||
* Options object to pass through to zlib.Gzip.
|
||||
* See <a href='https://nodejs.org/api/zlib.html#zlib_options'>zlib</a> documentation for more information.
|
||||
*/
|
||||
gzipOptions?: zlib.ZlibOptions;
|
||||
}
|
||||
}
|
||||
|
||||
var gzip: gzip.Gzip;
|
||||
|
||||
export = gzip;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path="gulp-ng-annotate.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import ngAnnotate = require('gulp-ng-annotate');
|
||||
import gulp = require('gulp');
|
||||
|
||||
gulp.task('default', function () {
|
||||
return gulp.src('src/app.js')
|
||||
.pipe(ngAnnotate())
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
ngAnnotate({
|
||||
remove: true,
|
||||
add: true,
|
||||
single_quotes: true
|
||||
});
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
// Type definitions for gulp-ng-annotate
|
||||
// Project: https://github.com/Kagami/gulp-ng-annotate
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-ng-annotate" {
|
||||
|
||||
namespace ngAnnotate {
|
||||
interface NgAnnotate {
|
||||
(option?: Option): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
//TODO: Should be on ng-annotate module
|
||||
interface Option {
|
||||
/**
|
||||
* Add annotations where non-existing
|
||||
*/
|
||||
add?: boolean;
|
||||
/**
|
||||
* Remove all existing annotations
|
||||
*/
|
||||
remove?: boolean;
|
||||
/**
|
||||
* List optional matchers
|
||||
*/
|
||||
list?: boolean;
|
||||
/**
|
||||
* Restrict matching further or to expand matching
|
||||
*/
|
||||
regexp?: string;
|
||||
/**
|
||||
* Enable optional matcher
|
||||
*/
|
||||
enable?: boolean;
|
||||
/**
|
||||
* Output '$scope' instead of "$scope".
|
||||
*/
|
||||
single_quotes?: boolean;
|
||||
/**
|
||||
* Rename providers (services, factories, controllers, etc.) with a new name when declared and referenced through annotation
|
||||
*/
|
||||
rename?: RenameOption[];
|
||||
/**
|
||||
* Load a user plugin with the provided path
|
||||
*/
|
||||
plugin?: any[];
|
||||
}
|
||||
|
||||
interface RenameOption {
|
||||
from: string;
|
||||
to: string;
|
||||
}
|
||||
}
|
||||
|
||||
var ngAnnotate: ngAnnotate.NgAnnotate;
|
||||
|
||||
export = ngAnnotate;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/// <reference path="gulp-nodemon.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require('gulp');
|
||||
import path = require('path');
|
||||
import nodemon = require('gulp-nodemon');
|
||||
|
||||
gulp.task('start', function () {
|
||||
nodemon({
|
||||
script: 'server.js'
|
||||
, ext: 'js html'
|
||||
, env: { 'NODE_ENV': 'development' }
|
||||
})
|
||||
});
|
||||
|
||||
nodemon({
|
||||
script: 'index.js'
|
||||
, tasks: ['browserify']
|
||||
});
|
||||
|
||||
nodemon({
|
||||
script: './index.js'
|
||||
, ext: 'js css'
|
||||
, tasks: function (changedFiles: string[]): string[] {
|
||||
var tasks: string[] = [];
|
||||
changedFiles.forEach(function (file: string) {
|
||||
if (path.extname(file) === '.js' && !~tasks.indexOf('lint')) tasks.push('lint')
|
||||
if (path.extname(file) === '.css' && !~tasks.indexOf('cssmin')) tasks.push('cssmin')
|
||||
});
|
||||
return tasks
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
gulp.task('develop', function () {
|
||||
nodemon({ script: 'server.js'
|
||||
, ext: 'html js'
|
||||
, ignore: ['ignored.js']
|
||||
, tasks: ['lint'] })
|
||||
.on('restart', function () {
|
||||
console.log('restarted!')
|
||||
})
|
||||
});
|
||||
Vendored
+88
@@ -0,0 +1,88 @@
|
||||
// Type definitions for gulp-nodemon
|
||||
// Project: https://github.com/JacksonGariety/gulp-nodemon
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-nodemon" {
|
||||
namespace nodemon {
|
||||
|
||||
interface Nodemon {
|
||||
(option?: Option): EventEmitter;
|
||||
}
|
||||
|
||||
interface Option extends _Option {
|
||||
tasks?: string[]|((changedFiles: string[]) => string[]);
|
||||
}
|
||||
|
||||
// TODO: Properties may be insufficient
|
||||
// TODO: In future this interface should be moved to nodemon.d.ts
|
||||
interface _Option {
|
||||
env?: { [key: string]: string|boolean|number; };
|
||||
script?: string;
|
||||
/**
|
||||
* Extensions to look for, ie. js,jade,hbs.
|
||||
*/
|
||||
ext?: string;
|
||||
/**
|
||||
* Execute script with "app", ie. -x "python -v".
|
||||
*/
|
||||
exec?: string;
|
||||
/**
|
||||
* Watch directory "dir" or files. use once for each directory or file to watch.
|
||||
*/
|
||||
watch?: string[];
|
||||
/**
|
||||
* Ignore specific files or directories.
|
||||
*/
|
||||
ignore?: string[];
|
||||
/**
|
||||
* Minimise nodemon messages to start/stop only.
|
||||
*/
|
||||
quiet?: boolean;
|
||||
/**
|
||||
* Show detail on what is causing restarts.
|
||||
*/
|
||||
verbose?: boolean;
|
||||
/**
|
||||
* Try to read from stdin.
|
||||
*/
|
||||
stdin?: boolean;
|
||||
stdout?: boolean;
|
||||
/**
|
||||
* Execute script on change only, not startup
|
||||
*/
|
||||
runOnChangeOnly?: boolean;
|
||||
/**
|
||||
* Debounce restart in seconds.
|
||||
*/
|
||||
delay?: number;
|
||||
/**
|
||||
* Forces node to use the most compatible version for watching file changes.
|
||||
*/
|
||||
legacyWatch?: boolean;
|
||||
/**
|
||||
* Exit on crash, allows use of nodemon with daemon tools like forever.js.
|
||||
*/
|
||||
exitcrash?: boolean;
|
||||
execMap?: { [key: string]: string|boolean|number; };
|
||||
events?: { [key: string]: string; };
|
||||
restartable?: string;
|
||||
}
|
||||
|
||||
interface EventEmitter extends NodeJS.EventEmitter {
|
||||
addListener(event: string, listener: Function): EventEmitter;
|
||||
addListener(event: string, tasks: string[]): EventEmitter;
|
||||
on(event: string, listener: Function): EventEmitter;
|
||||
on(event: string, tasks: string[]): EventEmitter;
|
||||
once(event: string, listener: Function): EventEmitter;
|
||||
once(event: string, tasks: string[]): EventEmitter;
|
||||
}
|
||||
}
|
||||
|
||||
var nodemon: nodemon.Nodemon;
|
||||
|
||||
export = nodemon;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference path="./gulp-sass.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import sass = require("gulp-sass");
|
||||
import * as sass from "gulp-sass";
|
||||
|
||||
gulp.task('sass', function () {
|
||||
gulp.src('./scss/*.scss')
|
||||
|
||||
Vendored
+5
-2
@@ -43,7 +43,10 @@ declare module "gulp-sass" {
|
||||
sync?: boolean;
|
||||
}
|
||||
|
||||
function sass(opts?: Options): NodeJS.ReadWriteStream;
|
||||
interface Sass {
|
||||
(opts?: Options): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
export = sass;
|
||||
var _tmp: Sass;
|
||||
export = _tmp;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/// <reference path="gulp-shell.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import shell = require('gulp-shell');
|
||||
import gulp = require('gulp');
|
||||
|
||||
gulp.task('example', function () {
|
||||
return gulp.src('*.js', {read: false})
|
||||
.pipe(shell([
|
||||
'echo <%= f(file.path) %>',
|
||||
'ls -l <%= file.path %>'
|
||||
], {
|
||||
templateData: {
|
||||
f: function (s: string) {
|
||||
return s.replace(/$/, '.bak')
|
||||
}
|
||||
}
|
||||
}))
|
||||
});
|
||||
|
||||
gulp.task('shorthand', shell.task([
|
||||
'echo hello',
|
||||
'echo world'
|
||||
]));
|
||||
|
||||
var paths: any = {
|
||||
js: ['*.js', 'test/*.js']
|
||||
};
|
||||
|
||||
gulp.task('test', shell.task('mocha -R spec'));
|
||||
|
||||
gulp.task('coverage', ['test'], shell.task('istanbul cover _mocha -- -R spec'));
|
||||
|
||||
gulp.task('coveralls', ['coverage'], shell.task('cat coverage/lcov.info | coveralls'));
|
||||
|
||||
gulp.task('lint', shell.task('eslint ' + paths.js.join(' ')));
|
||||
|
||||
gulp.task('default', ['coverage', 'lint']);
|
||||
|
||||
gulp.task('watch', function () {
|
||||
gulp.watch(paths.js, ['default'])
|
||||
});
|
||||
Vendored
+68
@@ -0,0 +1,68 @@
|
||||
// Type definitions for gulp-shell
|
||||
// Project: https://github.com/sun-zheng-an/gulp-shell
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-shell" {
|
||||
|
||||
namespace shell {
|
||||
interface Shell {
|
||||
(commands: string|string[], options?: Option): NodeJS.ReadWriteStream;
|
||||
task(commands: string|string[], options?: Option): () => NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
interface Option {
|
||||
/**
|
||||
* You can add a custom error message for when the command fails. This can be a template which can be
|
||||
* interpolated with the current command, some file info (e.g. file.path) and some error info
|
||||
* (e.g. error.code).
|
||||
* @default 'Command `<%= command %>` failed with exit code <%= error.code %>'
|
||||
*/
|
||||
errorMessage?: string;
|
||||
/**
|
||||
* By default, it will emit an error event when the command finishes unsuccessfully.
|
||||
* @default false
|
||||
*/
|
||||
ignoreErrors?: boolean;
|
||||
/**
|
||||
* By default, it will print the command output.
|
||||
* @default false
|
||||
*/
|
||||
quiet?: boolean;
|
||||
/**
|
||||
* Sets the current working directory for the command.
|
||||
* @default process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
/**
|
||||
* The data that can be accessed in template.
|
||||
*/
|
||||
templateData?: any;
|
||||
/**
|
||||
* You won't need to set this option unless you encounter a "stdout maxBuffer exceeded" error.
|
||||
* @default 16MB(16 * 1024 * 1024)
|
||||
*/
|
||||
maxBuffer?: number;
|
||||
/**
|
||||
* The maximum amount of time in milliseconds the process is allowed to run.
|
||||
* @default
|
||||
*/
|
||||
timeout?: number;
|
||||
/**
|
||||
* By default, all the commands will be executed in an environment with all the variables in process.env
|
||||
* and PATH prepended by ./node_modules/.bin (allowing you to run executables in your Node's dependencies).
|
||||
* You can override any environment variables with this option.
|
||||
* For example, setting it to {PATH: process.env.PATH} will reset the PATH
|
||||
* if the default one brings your some troubles.
|
||||
*/
|
||||
env?: any;
|
||||
}
|
||||
}
|
||||
|
||||
var shell: shell.Shell;
|
||||
|
||||
export = shell;
|
||||
}
|
||||
|
||||
@@ -80,3 +80,5 @@ Handlebars.registerHelper('fullName', (person: typeof context.author) => {
|
||||
});
|
||||
|
||||
var escapedExpression = Handlebars.Utils.escapeExpression('<script>alert(\'xss\');</script>');
|
||||
|
||||
Handlebars.helpers !== undefined;
|
||||
|
||||
Vendored
+1
@@ -18,6 +18,7 @@ declare module Handlebars {
|
||||
export var Utils: typeof hbs.Utils;
|
||||
export var logger: Logger;
|
||||
export var templates: HandlebarsTemplates;
|
||||
export var helpers: any;
|
||||
|
||||
export module AST {
|
||||
export var helpers: hbs.AST.helpers;
|
||||
|
||||
@@ -37,4 +37,4 @@ class AppController {
|
||||
}
|
||||
}
|
||||
|
||||
app.controller("AppController", AppController);
|
||||
app.controller("AppController", AppController);
|
||||
|
||||
Vendored
+4
-4
@@ -6,11 +6,11 @@
|
||||
/// <reference path="../highcharts/highcharts.d.ts" />
|
||||
|
||||
interface HighChartsNGConfig {
|
||||
options: HighchartsChartOptions;
|
||||
options: HighchartsOptions;
|
||||
//The below properties are watched separately for changes.
|
||||
|
||||
//Series object (optional) - a list of series using normal highcharts series options.
|
||||
series?: number[]|[number, number][]| HighchartsDataPoint[];
|
||||
series?: number[]|[number, number][]| HighchartsDataPoint[] | {data:number[];}[];
|
||||
//Title configuration (optional)
|
||||
title?: {
|
||||
text?: string;
|
||||
@@ -24,7 +24,7 @@ interface HighChartsNGConfig {
|
||||
currentMin?: number;
|
||||
currentMax?: number;
|
||||
title?: { text?: string }
|
||||
},
|
||||
};
|
||||
//Whether to use HighStocks instead of HighCharts (optional). Defaults to false.
|
||||
useHighStocks?: boolean;
|
||||
//size (optional) if left out the chart will default to size of the div or something sensible.
|
||||
@@ -40,4 +40,4 @@ interface HighChartsNGConfig {
|
||||
interface HighChartsNGChart extends HighChartsNGConfig {
|
||||
//This is a simple way to access all the Highcharts API that is not currently managed by this directive.
|
||||
getHighcharts(): HighchartsChartObject;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -249,7 +249,7 @@ interface HighchartsCSSObject {
|
||||
fontWeight?: string;
|
||||
left?: string;
|
||||
opacity?: number;
|
||||
padding?: string;
|
||||
padding?: string | number;
|
||||
position?: string;
|
||||
top?: string;
|
||||
}
|
||||
|
||||
Vendored
+9
-4
@@ -22,29 +22,34 @@ declare module i18n {
|
||||
*/
|
||||
directory?: string;
|
||||
|
||||
/**
|
||||
/**
|
||||
* whether to write new locale information to disk
|
||||
* @default true
|
||||
*/
|
||||
updateFiles?: boolean;
|
||||
|
||||
/**
|
||||
/**
|
||||
* What to use as the indentation unit
|
||||
* @default "\t"
|
||||
*/
|
||||
indent?: string;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Setting extension of json files (you might want to set this to '.js' according to webtranslateit)
|
||||
* @default ".json"
|
||||
*/
|
||||
extension?: string;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Enable object notation
|
||||
* @default false
|
||||
*/
|
||||
objectNotation?: boolean;
|
||||
|
||||
/**
|
||||
* json files prefix
|
||||
*/
|
||||
prefix?: string;
|
||||
}
|
||||
export interface TranslateOptions {
|
||||
phrase: string;
|
||||
|
||||
Vendored
+9
@@ -19,6 +19,12 @@ interface IResourceStoreKey {
|
||||
|
||||
interface I18nTranslateOptions extends I18nextOptions {
|
||||
defaultValue?: any; // normally a string
|
||||
// NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
|
||||
toAdd?: any;
|
||||
child?: any;
|
||||
sprintf?: any;
|
||||
count?: any;
|
||||
context?: any;
|
||||
}
|
||||
|
||||
interface I18nextOptions {
|
||||
@@ -66,6 +72,9 @@ interface I18nextOptions {
|
||||
cookieName?: string; // Default value: 'i18next'
|
||||
|
||||
postProcess?: string; // Default value: undefined
|
||||
|
||||
// NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
|
||||
replace?: any;
|
||||
}
|
||||
|
||||
interface I18nextStatic {
|
||||
|
||||
@@ -0,0 +1,528 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="inquirer.d.ts" />
|
||||
|
||||
import inquirer = require('inquirer');
|
||||
|
||||
|
||||
inquirer.prompt([/* Pass your questions in here */], function( answers: inquirer.Answers ) {
|
||||
// Use user feedback for... whatever!!
|
||||
});
|
||||
|
||||
//
|
||||
// examples/bottom-bar.js
|
||||
//
|
||||
|
||||
//var BottomBar = require("../lib/ui/bottom-bar");
|
||||
var BottomBar = inquirer.ui.BottomBar;
|
||||
declare var cmdify: any;
|
||||
|
||||
var loader = [
|
||||
"/ Installing",
|
||||
"| Installing",
|
||||
"\\ Installing",
|
||||
"- Installing"
|
||||
];
|
||||
var i = 4;
|
||||
var ui = new BottomBar({ bottomBar: loader[i % 4] });
|
||||
|
||||
setInterval(function() {
|
||||
ui.updateBottomBar( loader[i++ % 4] );
|
||||
}, 300 );
|
||||
|
||||
var spawn = require("child_process").spawn;
|
||||
|
||||
var cmd = spawn(cmdify("npm"), [ "-g", "install", "inquirer" ], { stdio: "pipe" });
|
||||
cmd.stdout.pipe( ui.log );
|
||||
cmd.on( "close", function() {
|
||||
ui.updateBottomBar("Installation done!\n");
|
||||
process.exit();
|
||||
});
|
||||
|
||||
|
||||
//
|
||||
// examples/checkbox.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Checkbox list examples
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
inquirer.prompt([
|
||||
{
|
||||
type: "checkbox",
|
||||
message: "Select toppings",
|
||||
name: "toppings",
|
||||
choices: [
|
||||
new inquirer.Separator("The usual:"),
|
||||
{
|
||||
name: "Peperonni"
|
||||
},
|
||||
{
|
||||
name: "Cheese",
|
||||
checked: true
|
||||
},
|
||||
{
|
||||
name: "Mushroom"
|
||||
},
|
||||
new inquirer.Separator("The extras:"),
|
||||
{
|
||||
name: "Pineapple",
|
||||
},
|
||||
{
|
||||
name: "Bacon"
|
||||
},
|
||||
{
|
||||
name: "Olives",
|
||||
disabled: "out of stock"
|
||||
},
|
||||
{
|
||||
name: "Extra cheese"
|
||||
}
|
||||
],
|
||||
validate: function( answer ) {
|
||||
if ( answer.length < 1 ) {
|
||||
return "You must choose at least one topping.";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
], function( answers: inquirer.Answers ) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
|
||||
//
|
||||
// examples/expand.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Expand list examples
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
inquirer.prompt([
|
||||
{
|
||||
type: "expand",
|
||||
message: "Conflict on `file.js`: ",
|
||||
name: "overwrite",
|
||||
choices: [
|
||||
{
|
||||
key: "y",
|
||||
name: "Overwrite",
|
||||
value: "overwrite"
|
||||
},
|
||||
{
|
||||
key: "a",
|
||||
name: "Overwrite this one and all next",
|
||||
value: "overwrite_all"
|
||||
},
|
||||
{
|
||||
key: "d",
|
||||
name: "Show diff",
|
||||
value: "diff"
|
||||
},
|
||||
new inquirer.Separator(),
|
||||
{
|
||||
key: "x",
|
||||
name: "Abort",
|
||||
value: "abort"
|
||||
}
|
||||
]
|
||||
}
|
||||
], function( answers: inquirer.Answers ) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
|
||||
//
|
||||
// examples/input.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Input prompt example
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
var questions = [
|
||||
{
|
||||
type: "input",
|
||||
name: "first_name",
|
||||
message: "What's your first name"
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "last_name",
|
||||
message: "What's your last name",
|
||||
default: function () { return "Doe"; }
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "phone",
|
||||
message: "What's your phone number",
|
||||
validate: function( value: string ): string|boolean {
|
||||
var pass = value.match(/^([01]{1})?[\-\.\s]?\(?(\d{3})\)?[\-\.\s]?(\d{3})[\-\.\s]?(\d{4})\s?((?:#|ext\.?\s?|x\.?\s?){1}(?:\d+)?)?$/i);
|
||||
if (pass) {
|
||||
return true;
|
||||
} else {
|
||||
return "Please enter a valid phone number";
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
inquirer.prompt( questions, function( answers ) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
//
|
||||
// examples/list.js
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* List prompt example
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
inquirer.prompt([
|
||||
{
|
||||
type: "list",
|
||||
name: "theme",
|
||||
message: "What do you want to do?",
|
||||
choices: [
|
||||
"Order a pizza",
|
||||
"Make a reservation",
|
||||
new inquirer.Separator(),
|
||||
"Ask opening hours",
|
||||
"Talk to the receptionnist"
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "list",
|
||||
name: "size",
|
||||
message: "What size do you need",
|
||||
choices: [ "Jumbo", "Large", "Standard", "Medium", "Small", "Micro" ],
|
||||
filter: function( val: string ) { return val.toLowerCase(); }
|
||||
}
|
||||
], function( answers: inquirer.Answers ) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
//
|
||||
// examples/long-list.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Paginated list
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
var choices = Array.apply(0, new Array(26)).map(function(x: number,y: number) {
|
||||
return String.fromCharCode(y + 65);
|
||||
});
|
||||
choices.push("Multiline option \n super cool feature");
|
||||
choices.push("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.");
|
||||
|
||||
inquirer.prompt([
|
||||
{
|
||||
type : "list",
|
||||
name : "letter",
|
||||
message : "What's your favorite letter?",
|
||||
paginated : true,
|
||||
choices : choices
|
||||
},
|
||||
{
|
||||
type : "checkbox",
|
||||
name : "name",
|
||||
message : "Select the letter contained in your name:",
|
||||
paginated : true,
|
||||
choices : choices
|
||||
}
|
||||
], function( answers: inquirer.Answers ) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
//
|
||||
// examples/nested-call.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Nested Inquirer call
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
inquirer.prompt({
|
||||
type: "list",
|
||||
name: "chocolate",
|
||||
message: "What's your favorite chocolate?",
|
||||
choices: [ "Mars", "Oh Henry", "Hershey" ]
|
||||
}, function( answers: inquirer.Answers ) {
|
||||
inquirer.prompt({
|
||||
type: "list",
|
||||
name: "beverage",
|
||||
message: "And your favorite beverage?",
|
||||
choices: [ "Pepsi", "Coke", "7up", "Mountain Dew", "Red Bull" ]
|
||||
});
|
||||
});
|
||||
|
||||
//
|
||||
// examples/password.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Password prompt example
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
inquirer.prompt([
|
||||
{
|
||||
type: "password",
|
||||
message: "Enter your git password",
|
||||
name: "password"
|
||||
}
|
||||
], function( answers: inquirer.Answers ) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
//
|
||||
// examples/pizza.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Pizza delivery prompt example
|
||||
* run example by writing `node pizza.js` in your console
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
console.log("Hi, welcome to Node Pizza");
|
||||
|
||||
var questions2 = [
|
||||
{
|
||||
type: "confirm",
|
||||
name: "toBeDelivered",
|
||||
message: "Is it for a delivery",
|
||||
default: false
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "phone",
|
||||
message: "What's your phone number",
|
||||
validate: function( value: string ): string|boolean {
|
||||
var pass = value.match(/^([01]{1})?[\-\.\s]?\(?(\d{3})\)?[\-\.\s]?(\d{3})[\-\.\s]?(\d{4})\s?((?:#|ext\.?\s?|x\.?\s?){1}(?:\d+)?)?$/i);
|
||||
if (pass) {
|
||||
return true;
|
||||
} else {
|
||||
return "Please enter a valid phone number";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "list",
|
||||
name: "size",
|
||||
message: "What size do you need",
|
||||
choices: [ "Large", "Medium", "Small" ],
|
||||
filter: function( val: string ) { return val.toLowerCase(); }
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "quantity",
|
||||
message: "How many do you need",
|
||||
validate: function( value: string ) {
|
||||
var valid = !isNaN(parseFloat(value));
|
||||
return valid || "Please enter a number";
|
||||
},
|
||||
filter: Number
|
||||
},
|
||||
{
|
||||
type: "expand",
|
||||
name: "toppings",
|
||||
message: "What about the toping",
|
||||
choices: [
|
||||
{
|
||||
key: "p",
|
||||
name: "Peperonni and chesse",
|
||||
value: "PeperonniChesse"
|
||||
},
|
||||
{
|
||||
key: "a",
|
||||
name: "All dressed",
|
||||
value: "alldressed"
|
||||
},
|
||||
{
|
||||
key: "w",
|
||||
name: "Hawaïan",
|
||||
value: "hawaian"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "rawlist",
|
||||
name: "beverage",
|
||||
message: "You also get a free 2L beverage",
|
||||
choices: [ "Pepsi", "7up", "Coke" ]
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "comments",
|
||||
message: "Any comments on your purchase experience",
|
||||
default: "Nope, all good!"
|
||||
},
|
||||
{
|
||||
type: "list",
|
||||
name: "prize",
|
||||
message: "For leaving a comments, you get a freebie",
|
||||
choices: [ "cake", "fries" ],
|
||||
when: function( answers: inquirer.Answers ) {
|
||||
return answers['comments'] !== "Nope, all good!";
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
inquirer.prompt( questions, function( answers ) {
|
||||
console.log("\nOrder receipt:");
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
//
|
||||
// examples/rawlist.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Raw List prompt example
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
inquirer.prompt([
|
||||
{
|
||||
type: "rawlist",
|
||||
name: "theme",
|
||||
message: "What do you want to do?",
|
||||
choices: [
|
||||
"Order a pizza",
|
||||
"Make a reservation",
|
||||
new inquirer.Separator(),
|
||||
"Ask opening hours",
|
||||
"Talk to the receptionnist"
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "rawlist",
|
||||
name: "size",
|
||||
message: "What size do you need",
|
||||
choices: [ "Jumbo", "Large", "Standard", "Medium", "Small", "Micro" ],
|
||||
filter: function( val: string ) { return val.toLowerCase(); }
|
||||
}
|
||||
], function( answers: inquirer.Answers ) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
|
||||
//
|
||||
// examples/recursive.js
|
||||
//
|
||||
|
||||
/**
|
||||
* Recursive prompt example
|
||||
* Allows user to choose when to exit prompt
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
var output2: (string|boolean)[] = [];
|
||||
|
||||
var questions3 = [
|
||||
{
|
||||
type: "input",
|
||||
name: "tvShow",
|
||||
message: "What's your favorite TV show?"
|
||||
},
|
||||
{
|
||||
type: "confirm",
|
||||
name: "askAgain",
|
||||
message: "Want to enter another TV show favorite (just hit enter for YES)?",
|
||||
default: true
|
||||
}
|
||||
];
|
||||
|
||||
function ask() {
|
||||
inquirer.prompt( questions3, function( answers: inquirer.Answers ) {
|
||||
output2.push( answers['tvShow'] );
|
||||
if ( answers['askAgain'] ) {
|
||||
ask();
|
||||
} else {
|
||||
console.log( "Your favorite TV Shows:", output2.join(", ") );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ask();
|
||||
|
||||
//
|
||||
// examples/when.js
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* When example
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
var questions4 = [
|
||||
{
|
||||
type: "confirm",
|
||||
name: "bacon",
|
||||
message: "Do you like bacon?"
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "favorite",
|
||||
message: "Bacon lover, what is your favorite type of bacon?",
|
||||
when: function ( answers: inquirer.Answers ) {
|
||||
return answers['bacon'];
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "confirm",
|
||||
name: "pizza",
|
||||
message: "Ok... Do you like pizza?",
|
||||
when: function (answers: inquirer.Answers) {
|
||||
return !likesFood( "bacon" )(answers);
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "favorite",
|
||||
message: "Whew! What is your favorite type of pizza?",
|
||||
when: likesFood( "pizza" )
|
||||
}
|
||||
];
|
||||
|
||||
function likesFood ( aFood: string ) {
|
||||
return function ( answers: inquirer.Answers ) {
|
||||
return answers[ aFood ];
|
||||
}
|
||||
}
|
||||
|
||||
inquirer.prompt(questions, function (answers) {
|
||||
console.log( JSON.stringify(answers, null, " ") );
|
||||
});
|
||||
Vendored
+299
@@ -0,0 +1,299 @@
|
||||
// Type definitions for Inquirer.js
|
||||
// Project: https://github.com/SBoudrias/Inquirer.js
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../rx/rx-lite.d.ts" />
|
||||
/// <reference path="../through/through.d.ts" />
|
||||
|
||||
declare module "inquirer" {
|
||||
import through = require('through');
|
||||
|
||||
namespace inquirer {
|
||||
type Prompts = { [name: string]: PromptModule };
|
||||
type ChoiceType = string|objects.ChoiceOption|objects.Separator;
|
||||
type Questions = Question|Question[]|Rx.Observable<Question>;
|
||||
|
||||
interface Inquirer {
|
||||
restoreDefaultPrompts(): void;
|
||||
/**
|
||||
* Expose helper functions on the top level for easiest usage by common users
|
||||
* @param name
|
||||
* @param prompt
|
||||
*/
|
||||
registerPrompt(name: string, prompt: PromptModule): void;
|
||||
/**
|
||||
* Create a new self-contained prompt module.
|
||||
*/
|
||||
createPromptModule(): PromptModule;
|
||||
/**
|
||||
* Public CLI helper interface
|
||||
* @param questions Questions settings array
|
||||
* @param cb Callback being passed the user answers
|
||||
* @return
|
||||
*/
|
||||
prompt(questions: Questions, cb?: (answers: Answers) => any): ui.Prompt;
|
||||
prompts: Prompts;
|
||||
Separator: objects.SeparatorStatic;
|
||||
ui: {
|
||||
BottomBar: ui.BottomBar;
|
||||
Prompt: ui.Prompt;
|
||||
}
|
||||
}
|
||||
|
||||
interface PromptModule {
|
||||
(questions: Questions, cb: (answers: Answers) => any): ui.Prompt;
|
||||
/**
|
||||
* Register a prompt type
|
||||
* @param name Prompt type name
|
||||
* @param prompt Prompt constructor
|
||||
*/
|
||||
registerPrompt(name: string, prompt: PromptModule): ui.Prompt;
|
||||
/**
|
||||
* Register the defaults provider prompts
|
||||
*/
|
||||
restoreDefaultPrompts(): void;
|
||||
}
|
||||
|
||||
interface Question {
|
||||
/**
|
||||
* Type of the prompt.
|
||||
* Possible values:
|
||||
* <ul>
|
||||
* <li>input</li>
|
||||
* <li>confirm</li>
|
||||
* <li>list</li>
|
||||
* <li>rawlist</li>
|
||||
* <li>password</li>
|
||||
* </ul>
|
||||
* @defaults: 'input'
|
||||
*/
|
||||
type?: string;
|
||||
/**
|
||||
* The name to use when storing the answer in the anwers hash.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* The question to print. If defined as a function,
|
||||
* the first parameter will be the current inquirer session answers.
|
||||
*/
|
||||
message?: string|((answers: Answers) => string);
|
||||
/**
|
||||
* Default value(s) to use if nothing is entered, or a function that returns the default value(s).
|
||||
* If defined as a function, the first parameter will be the current inquirer session answers.
|
||||
*/
|
||||
default?: any|((answers: Answers) => any);
|
||||
/**
|
||||
* Choices array or a function returning a choices array. If defined as a function,
|
||||
* the first parameter will be the current inquirer session answers.
|
||||
* Array values can be simple strings, or objects containing a name (to display) and a value properties
|
||||
* (to save in the answers hash). Values can also be a Separator.
|
||||
*/
|
||||
choices?: ChoiceType[]|((answers: Answers) => ChoiceType[]);
|
||||
/**
|
||||
* Receive the user input and should return true if the value is valid, and an error message (String)
|
||||
* otherwise. If false is returned, a default error message is provided.
|
||||
*/
|
||||
validate?(input: string): boolean|string;
|
||||
/**
|
||||
* Receive the user input and return the filtered value to be used inside the program.
|
||||
* The value returned will be added to the Answers hash.
|
||||
*/
|
||||
filter?(input: string): string;
|
||||
/**
|
||||
* Receive the current user answers hash and should return true or false depending on whether or
|
||||
* not this question should be asked. The value can also be a simple boolean.
|
||||
*/
|
||||
when?: boolean|((answers: Answers) => boolean);
|
||||
paginated?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A key/value hash containing the client answers in each prompt.
|
||||
*/
|
||||
interface Answers {
|
||||
[key: string]: string|boolean;
|
||||
}
|
||||
|
||||
namespace ui {
|
||||
/**
|
||||
* Base interface class other can inherits from
|
||||
*/
|
||||
interface Prompt extends BaseUI<Prompts> {
|
||||
new(promptModule: Prompts): Prompt;
|
||||
/**
|
||||
* Once all prompt are over
|
||||
*/
|
||||
onCompletion(): void;
|
||||
processQuestion(question: Question): any;
|
||||
fetchAnswer(question: Question): any;
|
||||
setDefaultType(question: Question): any;
|
||||
filterIfRunnable(question: Question): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sticky bottom bar user interface
|
||||
*/
|
||||
interface BottomBar extends BaseUI<BottomBarOption> {
|
||||
new(opt?: BottomBarOption): BottomBar;
|
||||
/**
|
||||
* Render the prompt to screen
|
||||
* @return self
|
||||
*/
|
||||
render(): BottomBar;
|
||||
/**
|
||||
* Update the bottom bar content and rerender
|
||||
* @param bottomBar Bottom bar content
|
||||
* @return self
|
||||
*/
|
||||
updateBottomBar(bottomBar: string): BottomBar;
|
||||
/**
|
||||
* Rerender the prompt
|
||||
* @return self
|
||||
*/
|
||||
writeLog(data: any): BottomBar;
|
||||
/**
|
||||
* Make sure line end on a line feed
|
||||
* @param str Input string
|
||||
* @return The input string with a final line feed
|
||||
*/
|
||||
enforceLF(str: string): string;
|
||||
/**
|
||||
* Helper for writing message in Prompt
|
||||
* @param message The message to be output
|
||||
*/
|
||||
write(message: string): void;
|
||||
log: through.ThroughStream;
|
||||
}
|
||||
|
||||
interface BottomBarOption {
|
||||
bottomBar?: string;
|
||||
}
|
||||
/**
|
||||
* Base interface class other can inherits from
|
||||
*/
|
||||
interface BaseUI<TOpt> {
|
||||
new(opt: TOpt): void;
|
||||
/**
|
||||
* Handle the ^C exit
|
||||
* @return {null}
|
||||
*/
|
||||
onForceClose(): void;
|
||||
/**
|
||||
* Close the interface and cleanup listeners
|
||||
*/
|
||||
close(): void;
|
||||
/**
|
||||
* Handle and propagate keypress events
|
||||
*/
|
||||
onKeypress(s: string, key: Key): void;
|
||||
}
|
||||
|
||||
interface Key {
|
||||
sequence: string;
|
||||
name: string;
|
||||
meta: boolean;
|
||||
shift: boolean;
|
||||
ctrl: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
namespace objects {
|
||||
/**
|
||||
* Choice object
|
||||
* Normalize input as choice object
|
||||
* @constructor
|
||||
* @param {String|Object} val Choice value. If an object is passed, it should contains
|
||||
* at least one of `value` or `name` property
|
||||
*/
|
||||
interface Choice {
|
||||
new(str: string): Choice;
|
||||
new(separator: Separator): Choice;
|
||||
new(option: ChoiceOption): Choice;
|
||||
}
|
||||
|
||||
interface ChoiceOption {
|
||||
name?: string;
|
||||
value?: string;
|
||||
type?: string;
|
||||
extra?: any;
|
||||
key?: string;
|
||||
checked?: boolean;
|
||||
disabled?: string|((answers: Answers) => any);
|
||||
}
|
||||
|
||||
/**
|
||||
* Choices collection
|
||||
* Collection of multiple `choice` object
|
||||
* @constructor
|
||||
* @param choices All `choice` to keep in the collection
|
||||
*/
|
||||
interface Choices {
|
||||
new(choices: (string|Separator|ChoiceOption)[], answers?: Answers): Choices;
|
||||
choices: Choice[];
|
||||
realChoices: Choice[];
|
||||
length: number;
|
||||
realLength: number;
|
||||
/**
|
||||
* Get a valid choice from the collection
|
||||
* @param selector The selected choice index
|
||||
* @return Return the matched choice or undefined
|
||||
*/
|
||||
getChoice(selector: number): Choice;
|
||||
/**
|
||||
* Get a raw element from the collection
|
||||
* @param selector The selected index value
|
||||
* @return Return the matched choice or undefined
|
||||
*/
|
||||
get(selector: number): Choice;
|
||||
/**
|
||||
* Match the valid choices against a where clause
|
||||
* @param whereClause Lodash `where` clause
|
||||
* @return Matching choices or empty array
|
||||
*/
|
||||
where<U extends {}>(whereClause: U): Choice[];
|
||||
/**
|
||||
* Pluck a particular key from the choices
|
||||
* @param propertyName Property name to select
|
||||
* @return Selected properties
|
||||
*/
|
||||
pluck(propertyName: string): any[];
|
||||
forEach<T>(application: (choice: Choice) => T): T[];
|
||||
}
|
||||
|
||||
interface SeparatorStatic {
|
||||
/**
|
||||
* @param line Separation line content (facultative)
|
||||
*/
|
||||
new(line?: string): Separator;
|
||||
/**
|
||||
* Helper function returning false if object is a separator
|
||||
* @param obj object to test against
|
||||
* @return `false` if object is a separator
|
||||
*/
|
||||
exclude(obj: any): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Separator object
|
||||
* Used to space/separate choices group
|
||||
* @constructor
|
||||
* @param {String} line Separation line content (facultative)
|
||||
*/
|
||||
interface Separator {
|
||||
type: string;
|
||||
line: string;
|
||||
/**
|
||||
* Stringify separator
|
||||
* @return {String} the separator display string
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var inquirer: inquirer.Inquirer;
|
||||
|
||||
export = inquirer;
|
||||
}
|
||||
|
||||
Vendored
+15
-15
@@ -58,7 +58,7 @@ declare module jasmine {
|
||||
function addMatchers(matchers: CustomMatcherFactories): void;
|
||||
function stringMatching(str: string): Any;
|
||||
function stringMatching(str: RegExp): Any;
|
||||
|
||||
|
||||
interface Any {
|
||||
|
||||
new (expectedClass: any): any;
|
||||
@@ -72,7 +72,7 @@ declare module jasmine {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
|
||||
|
||||
interface ArrayContaining {
|
||||
new (sample: any[]): any;
|
||||
|
||||
@@ -279,21 +279,21 @@ declare module jasmine {
|
||||
isNot?: boolean;
|
||||
message(): any;
|
||||
|
||||
toBe(expected: any): boolean;
|
||||
toEqual(expected: any): boolean;
|
||||
toMatch(expected: any): boolean;
|
||||
toBeDefined(): boolean;
|
||||
toBeUndefined(): boolean;
|
||||
toBeNull(): boolean;
|
||||
toBe(expected: any, expectationFailOutput?: any): boolean;
|
||||
toEqual(expected: any, expectationFailOutput?: any): boolean;
|
||||
toMatch(expected: any, expectationFailOutput?: any): boolean;
|
||||
toBeDefined(expectationFailOutput?: any): boolean;
|
||||
toBeUndefined(expectationFailOutput?: any): boolean;
|
||||
toBeNull(expectationFailOutput?: any): boolean;
|
||||
toBeNaN(): boolean;
|
||||
toBeTruthy(): boolean;
|
||||
toBeFalsy(): boolean;
|
||||
toBeTruthy(expectationFailOutput?: any): boolean;
|
||||
toBeFalsy(expectationFailOutput?: any): boolean;
|
||||
toHaveBeenCalled(): boolean;
|
||||
toHaveBeenCalledWith(...params: any[]): boolean;
|
||||
toContain(expected: any): boolean;
|
||||
toBeLessThan(expected: any): boolean;
|
||||
toBeGreaterThan(expected: any): boolean;
|
||||
toBeCloseTo(expected: any, precision: any): boolean;
|
||||
toContain(expected: any, expectationFailOutput?: any): boolean;
|
||||
toBeLessThan(expected: any, expectationFailOutput?: any): boolean;
|
||||
toBeGreaterThan(expected: any, expectationFailOutput?: any): boolean;
|
||||
toBeCloseTo(expected: any, precision: any, expectationFailOutput?: any): boolean;
|
||||
toContainHtml(expected: string): boolean;
|
||||
toContainText(expected: string): boolean;
|
||||
toThrow(expected?: any): boolean;
|
||||
@@ -450,7 +450,7 @@ declare module jasmine {
|
||||
/** By chaining the spy with calls.reset(), will clears all tracking for a spy **/
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
|
||||
interface CallInfo {
|
||||
/** The context (the this) for the call */
|
||||
object: any;
|
||||
|
||||
@@ -0,0 +1,287 @@
|
||||
/// <reference path="../jquery-ajax-chain/jquery-ajax-chain.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="../core-js/core-js.d.ts" />
|
||||
|
||||
function test_public_methods(): void {
|
||||
|
||||
let ajaxChain: ajaxChain.JQueryAjaxChain,
|
||||
configurationObj1: ajaxChain.AjaxChainConfiguration,
|
||||
configurationObj2: ajaxChain.AjaxChainConfiguration;
|
||||
|
||||
configurationObj1 = {
|
||||
|
||||
ajaxSettings: {
|
||||
|
||||
type: 'GET',
|
||||
dataType: 'xml',
|
||||
url: '/endpoint1'
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
configurationObj2 = {
|
||||
|
||||
ajaxSettings: {
|
||||
|
||||
type: 'GET',
|
||||
dataType: 'xml',
|
||||
url: '/endpoint2'
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ajaxChain.enqueue(configurationObj1);
|
||||
ajaxChain.clearQueue();
|
||||
ajaxChain.enqueue([configurationObj1, configurationObj2]);
|
||||
ajaxChain.dequeue().then(doneResult => { console.log(doneResult); },
|
||||
failResult => { console.log(failResult); },
|
||||
progressResult => { console.log(progressResult); });
|
||||
|
||||
}
|
||||
|
||||
function test_optional_parameters(): void {
|
||||
|
||||
let itemsCollectionCache: XMLDocument = null,
|
||||
itemDetailCacheMap: WeakMap<String, XMLDocument> = new WeakMap<String, XMLDocument>(),
|
||||
ajaxChain: ajaxChain.JQueryAjaxChain,
|
||||
configurationObj1: ajaxChain.AjaxChainConfiguration,
|
||||
configurationObj2: ajaxChain.AjaxChainConfiguration,
|
||||
configurationObj3: ajaxChain.AjaxChainConfiguration,
|
||||
configurationObj4: ajaxChain.AjaxChainConfiguration;
|
||||
|
||||
ajaxChain = new $.AjaxChain();
|
||||
|
||||
configurationObj1 = {
|
||||
|
||||
ajaxSettings: {
|
||||
|
||||
type: 'GET',
|
||||
dataType: 'xml',
|
||||
url: '/items',
|
||||
success: function (xmlResponse): void {
|
||||
|
||||
itemsCollectionCache = xmlResponse;
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
hasHaltingCapabilities: function (xmlResponse): Boolean {
|
||||
|
||||
let $tempXmlResponse: JQuery;
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
|
||||
if (!$tempXmlResponse.find('item').length) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
|
||||
hasCache: function (xmlResponse): XMLDocument {
|
||||
|
||||
if (itemsCollectionCache) {
|
||||
|
||||
return itemsCollectionCache;
|
||||
|
||||
};
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
transform: function (xmlResponse): Object {
|
||||
|
||||
let $tempXmlResponse: JQuery,
|
||||
$tempItems: JQuery,
|
||||
nextCallDataObj: Object;
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
$tempItems = $tempXmlResponse.find('item');
|
||||
|
||||
if ($tempItems.length) {
|
||||
|
||||
nextCallDataObj = {
|
||||
|
||||
id: $tempItems.first()
|
||||
.attr('id')
|
||||
|
||||
};
|
||||
|
||||
return nextCallDataObj;
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
configurationObj2 = {
|
||||
|
||||
ajaxSettings: {
|
||||
|
||||
type: 'GET',
|
||||
dataType: 'xml',
|
||||
url: '/item',
|
||||
success: function (xmlResponse): void {
|
||||
|
||||
let $tempXmlResponse: JQuery,
|
||||
itemId: String;
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
|
||||
itemId = $tempXmlResponse.find('id')
|
||||
.text();
|
||||
|
||||
if (itemId && !itemDetailCacheMap.has(itemId)) {
|
||||
|
||||
itemDetailCacheMap.set(itemId, xmlResponse);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
transform: function (xmlResponse): String {
|
||||
|
||||
let $tempXmlResponse: JQuery,
|
||||
tempTrackingCode: String,
|
||||
nextCallDataStr: String = "";
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
|
||||
tempTrackingCode = $tempXmlResponse.find('code')
|
||||
.text();
|
||||
|
||||
if (tempTrackingCode) {
|
||||
|
||||
nextCallDataStr = "tracking=" + tempTrackingCode;
|
||||
|
||||
}
|
||||
|
||||
return nextCallDataStr;
|
||||
|
||||
},
|
||||
|
||||
hasCache: function (xmlResponse): XMLDocument {
|
||||
|
||||
let $tempXmlResponse: JQuery,
|
||||
itemId: String;
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
|
||||
itemId = $tempXmlResponse.find('id')
|
||||
.text();
|
||||
|
||||
if (itemDetailCacheMap.has(itemId)) {
|
||||
|
||||
return itemDetailCacheMap.get(itemId);
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
},
|
||||
|
||||
hasErrors: function (xmlResponse): String {
|
||||
|
||||
var $tempXmlResponse: JQuery,
|
||||
categoryFilter: string = '1';
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
|
||||
if ($tempXmlResponse.find('categoryId')
|
||||
.text() === categoryFilter) {
|
||||
|
||||
return '[Exception] forbidden category id: ' + categoryFilter;
|
||||
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
},
|
||||
|
||||
appendToUrl: function (xmlResponse): String {
|
||||
|
||||
let $tempXmlResponse: JQuery,
|
||||
categoryId: string = '';
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
categoryId = $tempXmlResponse.find('categoryId')
|
||||
.text();
|
||||
|
||||
return (categoryId) ? ('/' + categoryId) : '';
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
configurationObj3 = {
|
||||
|
||||
ajaxSettings: {
|
||||
|
||||
type: 'GET',
|
||||
dataType: 'xml',
|
||||
url: '/categories'
|
||||
|
||||
},
|
||||
|
||||
isSkippable: function (xmlResponse): Boolean {
|
||||
|
||||
return true;
|
||||
|
||||
},
|
||||
|
||||
transform: function (xmlResponse): Object[] {
|
||||
|
||||
let $tempXmlResponse: JQuery,
|
||||
nextCallDataArr: Object[] = [];
|
||||
|
||||
$tempXmlResponse = $(xmlResponse);
|
||||
|
||||
$tempXmlResponse.find('subCategory').each(function (index, node) {
|
||||
|
||||
let $tempIdNode = $(node).find('id');
|
||||
|
||||
nextCallDataArr.push({
|
||||
|
||||
name: $tempIdNode.attr('name'),
|
||||
value: $tempIdNode.text()
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
return nextCallDataArr;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
configurationObj4 = {
|
||||
|
||||
ajaxSettings: {
|
||||
|
||||
type: 'GET',
|
||||
dataType: 'xml',
|
||||
url: '/subcategories'
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ajaxChain.enqueue([configurationObj1, configurationObj2, configurationObj3, configurationObj4])
|
||||
.dequeue()
|
||||
.then(doneResult => { console.log(doneResult); },
|
||||
failResult => { console.log(failResult); },
|
||||
progressResult => { console.log(progressResult); });
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user