diff --git a/ajv/ajv-tests.ts b/ajv/ajv-tests.ts
index e6413fd824..133a198db4 100644
--- a/ajv/ajv-tests.ts
+++ b/ajv/ajv-tests.ts
@@ -1,4 +1,4 @@
-///
+///
import * as Ajv from 'ajv';
var ajv = new Ajv(); // options can be passed, e.g. {allErrors: true}
diff --git a/ajv/ajv.d.ts b/ajv/ajv.d.ts
deleted file mode 100644
index d8bfd56ef3..0000000000
--- a/ajv/ajv.d.ts
+++ /dev/null
@@ -1,112 +0,0 @@
-// Type definitions for ajv
-// Project: https://github.com/epoberezkin/ajv
-// Definitions by: York Yao
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
-declare module "ajv" {
- class Ajv {
- /**
- * Create Ajv instance.
- */
- constructor(options?: Ajv.AjvOptions);
- /**
- * Generate validating function and cache the compiled schema for future use.
- */
- compile(schema: any): Ajv.AjvValidate;
- /**
- * Asyncronous version of compile method that loads missing remote schemas using asynchronous function in options.loadSchema.
- */
- compileAsync(schema: any, callback: (error: Error, validate: Ajv.AjvValidate) => void): void;
- /**
- * Validate data using passed schema (it will be compiled and cached).
- */
- validate(schema: any, data: any): boolean | PromiseLike;
- errors: Ajv.ValidationError[];
- /**
- * Add schema(s) to validator instance.
- */
- addSchema(schema: any, key: string): void;
- /**
- * Adds meta schema(s) that can be used to validate other schemas.
- * That function should be used instead of addSchema because there may be instance options that would compile a meta schema incorrectly (at the moment it is removeAdditional option).
- */
- addMetaSchema(schema: any, key: string): void;
- /**
- * Validates schema.
- * This method should be used to validate schemas rather than validate due to the inconsistency of uri format in JSON-Schema standard.
- */
- validateSchema(schema: any): Boolean;
- /**
- * Retrieve compiled schema previously added with addSchema by the key passed to addSchema or by its full reference (id).
- * Returned validating function has schema property with the reference to the original schema.
- */
- getSchema(key: string): Ajv.AjvValidate;
- /**
- * Remove added/cached schema.
- * Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references.
- */
- removeSchema(schema: any): void;
- /**
- * Add custom format to validate strings. It can also be used to replace pre-defined formats for Ajv instance.
- */
- addFormat(name: string, format: any): void;
- /**
- * Add custom validation keyword to Ajv instance.
- */
- addKeyword(keyword: string, definition: Ajv.AjxKeywordDefinition): void;
- errorsText(): any;
- static ValidationError: Function;
- }
- namespace Ajv {
- type AjvOptions = {
- v5?: boolean;
- allErrors?: boolean;
- verbose?: boolean;
- jsonPointers?: boolean;
- uniqueItems?: boolean;
- unicode?: boolean;
- format?: string;
- formats?: any;
- schemas?: any;
- missingRefs?: boolean;
- loadSchema?(uri: string, callback: (error: Error, body: any) => void): void;
- removeAdditional?: boolean;
- useDefaults?: boolean;
- coerceTypes?: boolean;
- async?: any;
- transpile?: string;
- meta?: boolean;
- validateSchema?: boolean;
- addUsedSchema?: boolean;
- inlineRefs?: boolean;
- passContext?: boolean;
- loopRequired?: number;
- ownProperties?: boolean;
- multipleOfPrecision?: boolean;
- errorDataPath?: string,
- messages?: boolean;
- beautify?: boolean;
- cache?: any;
- }
- type AjvValidate = ((data: any) => boolean | PromiseLike) & {
- errors: ValidationError[];
- }
- type AjxKeywordDefinition = {
- async?: boolean;
- type: string;
- compile?: (schema: any, parentsSchema: any) => ((data: any) => boolean | PromiseLike);
- validate?: (schema: any, data: any) => boolean;
- }
- type ValidationError = {
- keyword: string;
- dataPath: string;
- schemaPath: string;
- params: any;
- message: string;
- schema: any;
- parentSchema: any;
- data: any;
- }
- }
- export = Ajv;
-}
diff --git a/ajv/index.d.ts b/ajv/index.d.ts
new file mode 100644
index 0000000000..691b6b6ad0
--- /dev/null
+++ b/ajv/index.d.ts
@@ -0,0 +1,112 @@
+// Type definitions for ajv
+// Project: https://github.com/epoberezkin/ajv
+// Definitions by: York Yao
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare class Ajv {
+ /**
+ * Create Ajv instance.
+ */
+ constructor(options?: Ajv.AjvOptions);
+ /**
+ * Generate validating function and cache the compiled schema for future use.
+ */
+ compile(schema: any): Ajv.AjvValidate;
+ /**
+ * Asyncronous version of compile method that loads missing remote schemas using asynchronous function in options.loadSchema.
+ */
+ compileAsync(schema: any, callback: (error: Error, validate: Ajv.AjvValidate) => void): void;
+ /**
+ * Validate data using passed schema (it will be compiled and cached).
+ */
+ validate(schema: any, data: any): boolean | PromiseLike;
+ errors: Ajv.ValidationError[];
+ /**
+ * Add schema(s) to validator instance.
+ */
+ addSchema(schema: any, key: string): void;
+ /**
+ * Adds meta schema(s) that can be used to validate other schemas.
+ * That function should be used instead of addSchema because there may be instance options that would compile a meta schema incorrectly (at the moment it is removeAdditional option).
+ */
+ addMetaSchema(schema: any, key: string): void;
+ /**
+ * Validates schema.
+ * This method should be used to validate schemas rather than validate due to the inconsistency of uri format in JSON-Schema standard.
+ */
+ validateSchema(schema: any): Boolean;
+ /**
+ * Retrieve compiled schema previously added with addSchema by the key passed to addSchema or by its full reference (id).
+ * Returned validating function has schema property with the reference to the original schema.
+ */
+ getSchema(key: string): Ajv.AjvValidate;
+ /**
+ * Remove added/cached schema.
+ * Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references.
+ */
+ removeSchema(schema: any): void;
+ /**
+ * Add custom format to validate strings. It can also be used to replace pre-defined formats for Ajv instance.
+ */
+ addFormat(name: string, format: any): void;
+ /**
+ * Add custom validation keyword to Ajv instance.
+ */
+ addKeyword(keyword: string, definition: Ajv.AjxKeywordDefinition): void;
+ errorsText(): any;
+ static ValidationError: Function;
+}
+declare namespace Ajv {
+ type AjvOptions = {
+ v5?: boolean;
+ allErrors?: boolean;
+ verbose?: boolean;
+ jsonPointers?: boolean;
+ uniqueItems?: boolean;
+ unicode?: boolean;
+ format?: string;
+ formats?: any;
+ schemas?: any;
+ missingRefs?: boolean;
+ loadSchema?(uri: string, callback: (error: Error, body: any) => void): void;
+ removeAdditional?: boolean;
+ useDefaults?: boolean;
+ coerceTypes?: boolean;
+ async?: any;
+ transpile?: string;
+ meta?: boolean;
+ validateSchema?: boolean;
+ addUsedSchema?: boolean;
+ inlineRefs?: boolean;
+ passContext?: boolean;
+ loopRequired?: number;
+ ownProperties?: boolean;
+ multipleOfPrecision?: boolean;
+ errorDataPath?: string,
+ messages?: boolean;
+ beautify?: boolean;
+ cache?: any;
+ }
+ type AjvValidate = ((data: any) => boolean | PromiseLike) & {
+ errors: ValidationError[];
+ }
+ type AjxKeywordDefinition = {
+ async?: boolean;
+ type: string;
+ compile?: (schema: any, parentsSchema: any) => ((data: any) => boolean | PromiseLike);
+ validate?: (schema: any, data: any) => boolean;
+ }
+ type ValidationError = {
+ keyword: string;
+ dataPath: string;
+ schemaPath: string;
+ params: any;
+ message: string;
+ schema: any;
+ parentSchema: any;
+ data: any;
+ }
+}
+
+export = Ajv;
+
diff --git a/ajv/tsconfig.json b/ajv/tsconfig.json
new file mode 100644
index 0000000000..01bf5ed1da
--- /dev/null
+++ b/ajv/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "ajv-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/alexa-sdk/alexa-sdk-tests.ts b/alexa-sdk/alexa-sdk-tests.ts
index e161c5bf38..34eb88d5e2 100644
--- a/alexa-sdk/alexa-sdk-tests.ts
+++ b/alexa-sdk/alexa-sdk-tests.ts
@@ -1,5 +1,4 @@
-///
-///
+///
import * as Alexa from "alexa-sdk";
diff --git a/alexa-sdk/alexa-sdk.d.ts b/alexa-sdk/alexa-sdk.d.ts
deleted file mode 100644
index 5866d8c4ee..0000000000
--- a/alexa-sdk/alexa-sdk.d.ts
+++ /dev/null
@@ -1,132 +0,0 @@
-// Type definitions for Alexa SDK for Node.js v1.0.3
-// Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs
-// Definitions by: Pete Beegle
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
-declare module 'alexa-sdk' {
- export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject;
- export function CreateStateHandler(state: string, obj: any): any;
- export var StateString: string;
-
- interface AlexaObject {
- _event: any;
- _context: any;
- _callback: any;
- state: any;
- appId: any;
- response: any;
- dynamoDBTableName: any;
- saveBeforeResponse: boolean;
- registerHandlers: (...handlers: Handlers[]) => any;
- execute: () => void;
- }
-
- interface Handlers {
- [intent: string]: () => void;
- }
-
- interface Handler {
- on: any;
- emit(event: string, ...args: any[]): boolean;
- emitWithState: any;
- state: any;
- handler: any;
- event: RequestBody;
- attributes: any;
- context: any;
- name: any;
- isOverriden: any;
- }
-
- interface Context {
- callbackWaitsForEmptyEventLoop: boolean;
- logGroupName: string;
- logStreamName: string;
- functionName: string;
- memoryLimitInMB: string;
- functionVersion: string;
- invokeid: string;
- awsRequestId: string;
- }
-
- interface RequestBody {
- version: string;
- session: Session;
- request: LaunchRequest | IntentRequest | SessionEndedRequest;
- }
-
- interface Session {
- new: boolean;
- sessionId: string;
- attributes: any;
- application: SessionApplication;
- user: SessionUser;
- }
-
- interface SessionApplication {
- applicationId: string;
- }
-
- interface SessionUser {
- userId: string;
- accessToken: string;
- }
-
- interface LaunchRequest extends IRequest {}
-
- interface IntentRequest extends IRequest {
- intent: Intent;
- }
-
- interface Intent {
- name: string;
- slots: any;
- }
-
- interface SessionEndedRequest extends IRequest{
- reason: string;
- }
-
- interface IRequest {
- type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest";
- requestId: string;
- timeStamp: string;
- }
-
- interface ResponseBody {
- version: string;
- sessionAttributes?: any;
- response: Response;
- }
-
- interface Response {
- outputSpeech?: OutputSpeech;
- card?: Card;
- reprompt?: Reprompt;
- shouldEndSession: boolean;
- }
-
- interface OutputSpeech {
- type: "PlainText" | "SSML";
- text?: string;
- ssml?: string;
- }
-
- interface Card {
- type: "Simple" | "Standard" | "LinkAccount";
- title?: string;
- content?: string;
- text?: string;
- image?: Image;
- }
-
- interface Image {
- smallImageUrl: string;
- largeImageUrl: string;
- }
-
- interface Reprompt {
- outputSpeech: OutputSpeech;
- }
-}
-
diff --git a/alexa-sdk/index.d.ts b/alexa-sdk/index.d.ts
new file mode 100644
index 0000000000..5c420ec1d3
--- /dev/null
+++ b/alexa-sdk/index.d.ts
@@ -0,0 +1,131 @@
+// Type definitions for Alexa SDK for Node.js v1.0.3
+// Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs
+// Definitions by: Pete Beegle
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject;
+export function CreateStateHandler(state: string, obj: any): any;
+export var StateString: string;
+
+interface AlexaObject {
+ _event: any;
+ _context: any;
+ _callback: any;
+ state: any;
+ appId: any;
+ response: any;
+ dynamoDBTableName: any;
+ saveBeforeResponse: boolean;
+ registerHandlers: (...handlers: Handlers[]) => any;
+ execute: () => void;
+}
+
+interface Handlers {
+ [intent: string]: () => void;
+}
+
+interface Handler {
+ on: any;
+ emit(event: string, ...args: any[]): boolean;
+ emitWithState: any;
+ state: any;
+ handler: any;
+ event: RequestBody;
+ attributes: any;
+ context: any;
+ name: any;
+ isOverriden: any;
+}
+
+interface Context {
+ callbackWaitsForEmptyEventLoop: boolean;
+ logGroupName: string;
+ logStreamName: string;
+ functionName: string;
+ memoryLimitInMB: string;
+ functionVersion: string;
+ invokeid: string;
+ awsRequestId: string;
+}
+
+interface RequestBody {
+ version: string;
+ session: Session;
+ request: LaunchRequest | IntentRequest | SessionEndedRequest;
+}
+
+interface Session {
+ new: boolean;
+ sessionId: string;
+ attributes: any;
+ application: SessionApplication;
+ user: SessionUser;
+}
+
+interface SessionApplication {
+ applicationId: string;
+}
+
+interface SessionUser {
+ userId: string;
+ accessToken: string;
+}
+
+interface LaunchRequest extends IRequest { }
+
+interface IntentRequest extends IRequest {
+ intent: Intent;
+}
+
+interface Intent {
+ name: string;
+ slots: any;
+}
+
+interface SessionEndedRequest extends IRequest {
+ reason: string;
+}
+
+interface IRequest {
+ type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest";
+ requestId: string;
+ timeStamp: string;
+}
+
+interface ResponseBody {
+ version: string;
+ sessionAttributes?: any;
+ response: Response;
+}
+
+interface Response {
+ outputSpeech?: OutputSpeech;
+ card?: Card;
+ reprompt?: Reprompt;
+ shouldEndSession: boolean;
+}
+
+interface OutputSpeech {
+ type: "PlainText" | "SSML";
+ text?: string;
+ ssml?: string;
+}
+
+interface Card {
+ type: "Simple" | "Standard" | "LinkAccount";
+ title?: string;
+ content?: string;
+ text?: string;
+ image?: Image;
+}
+
+interface Image {
+ smallImageUrl: string;
+ largeImageUrl: string;
+}
+
+interface Reprompt {
+ outputSpeech: OutputSpeech;
+}
+
+
diff --git a/alexa-sdk/tsconfig.json b/alexa-sdk/tsconfig.json
new file mode 100644
index 0000000000..834836e163
--- /dev/null
+++ b/alexa-sdk/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "alexa-sdk-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/angular-localForage/angular-localForage-tests.ts b/angular-localforage/angular-localForage-tests.ts
similarity index 100%
rename from angular-localForage/angular-localForage-tests.ts
rename to angular-localforage/angular-localForage-tests.ts
diff --git a/angular-localForage/index.d.ts b/angular-localforage/index.d.ts
similarity index 100%
rename from angular-localForage/index.d.ts
rename to angular-localforage/index.d.ts
diff --git a/angular-localForage/tsconfig.json b/angular-localforage/tsconfig.json
similarity index 100%
rename from angular-localForage/tsconfig.json
rename to angular-localforage/tsconfig.json
diff --git a/angularLocalStorage/angularLocalStorage-tests.ts b/angularlocalstorage/angularLocalStorage-tests.ts
similarity index 100%
rename from angularLocalStorage/angularLocalStorage-tests.ts
rename to angularlocalstorage/angularLocalStorage-tests.ts
diff --git a/angularLocalStorage/index.d.ts b/angularlocalstorage/index.d.ts
similarity index 100%
rename from angularLocalStorage/index.d.ts
rename to angularlocalstorage/index.d.ts
diff --git a/angularLocalStorage/tsconfig.json b/angularlocalstorage/tsconfig.json
similarity index 100%
rename from angularLocalStorage/tsconfig.json
rename to angularlocalstorage/tsconfig.json
diff --git a/aphrodite/aphrodite-tests.tsx b/aphrodite/aphrodite-tests.tsx
index 76d28ca43f..f3c51f899e 100644
--- a/aphrodite/aphrodite-tests.tsx
+++ b/aphrodite/aphrodite-tests.tsx
@@ -1,6 +1,3 @@
-///
-///
-
import * as React from "react";
import { StyleSheet, css, StyleSheetServer, StyleSheetTestUtils } from "aphrodite";
diff --git a/aphrodite/aphrodite.d.ts b/aphrodite/aphrodite.d.ts
deleted file mode 100644
index 89d8646e54..0000000000
--- a/aphrodite/aphrodite.d.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-// Type definitions for Aphrodite 0.5.0
-// Project: https://github.com/Khan/aphrodite
-// Definitions by: Alexey Svetliakov
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
-///
-
-declare module "aphrodite" {
- import * as React from "react";
-
- /**
- * Aphrodite style declaration
- */
- export interface StyleDeclaration {
- [key: string]: React.CSSProperties;
- }
-
- interface StyleSheetStatic {
- /**
- * Create style sheet
- */
- create(styles: T): T;
- /**
- * Rehydrate class names from server renderer
- */
- rehydrate(renderedClassNames: string[]): void;
- }
-
- export var StyleSheet: StyleSheetStatic;
- /**
- * Get class names from passed styles
- */
- export function css(...styles: any[]): string;
-
- interface StaticRendererResult {
- html: string;
- css: {
- content: string;
- renderedClassNames: string[];
- }
- }
-
- /**
- * Utilities for using Aphrodite server-side.
- */
- interface StyleSheetServerStatic {
- renderStatic(renderFunc: () => string): StaticRendererResult;
- }
-
- export var StyleSheetServer: StyleSheetServerStatic;
-
- interface StyleSheetTestUtilsStatic {
- /**
- * Prevent styles from being injected into the DOM.
- *
- * This is useful in situations where you'd like to test rendering UI
- * components which use Aphrodite without any of the side-effects of
- * Aphrodite happening. Particularly useful for testing the output of
- * components when you have no DOM, e.g. testing in Node without a fake DOM.
- *
- * Should be paired with a subsequent call to
- * clearBufferAndResumeStyleInjection.
- */
- suppressStyleInjection(): void;
- /**
- * Opposite method of preventStyleInject.
- */
- clearBufferAndResumeStyleInjection(): void;
- }
-
- export var StyleSheetTestUtils: StyleSheetTestUtilsStatic;
-}
-
-declare module "aphrodite/no-important" {
- export * from "aphrodite";
-}
diff --git a/aphrodite/index.d.ts b/aphrodite/index.d.ts
new file mode 100644
index 0000000000..2f53e133fd
--- /dev/null
+++ b/aphrodite/index.d.ts
@@ -0,0 +1,69 @@
+// Type definitions for Aphrodite 0.5.0
+// Project: https://github.com/Khan/aphrodite
+// Definitions by: Alexey Svetliakov
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+import * as React from "react";
+
+/**
+ * Aphrodite style declaration
+ */
+export interface StyleDeclaration {
+ [key: string]: React.CSSProperties;
+}
+
+interface StyleSheetStatic {
+ /**
+ * Create style sheet
+ */
+ create(styles: T): T;
+ /**
+ * Rehydrate class names from server renderer
+ */
+ rehydrate(renderedClassNames: string[]): void;
+}
+
+export var StyleSheet: StyleSheetStatic;
+/**
+ * Get class names from passed styles
+ */
+export function css(...styles: any[]): string;
+
+interface StaticRendererResult {
+ html: string;
+ css: {
+ content: string;
+ renderedClassNames: string[];
+ }
+}
+
+/**
+ * Utilities for using Aphrodite server-side.
+ */
+interface StyleSheetServerStatic {
+ renderStatic(renderFunc: () => string): StaticRendererResult;
+}
+
+export var StyleSheetServer: StyleSheetServerStatic;
+
+interface StyleSheetTestUtilsStatic {
+ /**
+ * Prevent styles from being injected into the DOM.
+ *
+ * This is useful in situations where you'd like to test rendering UI
+ * components which use Aphrodite without any of the side-effects of
+ * Aphrodite happening. Particularly useful for testing the output of
+ * components when you have no DOM, e.g. testing in Node without a fake DOM.
+ *
+ * Should be paired with a subsequent call to
+ * clearBufferAndResumeStyleInjection.
+ */
+ suppressStyleInjection(): void;
+ /**
+ * Opposite method of preventStyleInject.
+ */
+ clearBufferAndResumeStyleInjection(): void;
+}
+
+export var StyleSheetTestUtils: StyleSheetTestUtilsStatic;
+
diff --git a/aphrodite/no-important/index.d.ts b/aphrodite/no-important/index.d.ts
new file mode 100644
index 0000000000..8dcf552fe8
--- /dev/null
+++ b/aphrodite/no-important/index.d.ts
@@ -0,0 +1,6 @@
+// Type definitions for Aphrodite 0.5.0
+// Project: https://github.com/Khan/aphrodite
+// Definitions by: Alexey Svetliakov
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+export * from "aphrodite";
\ No newline at end of file
diff --git a/aphrodite/tsconfig.json b/aphrodite/tsconfig.json
new file mode 100644
index 0000000000..d32f7a3aac
--- /dev/null
+++ b/aphrodite/tsconfig.json
@@ -0,0 +1,21 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true,
+ "jsx": "preserve"
+ },
+ "files": [
+ "index.d.ts",
+ "no-important/index.d.ts",
+ "aphrodite-tests.tsx"
+ ]
+}
\ No newline at end of file
diff --git a/apigee-access/apigee-access-tests.ts b/apigee-access/apigee-access-tests.ts
index 99baec8021..c023be51c9 100644
--- a/apigee-access/apigee-access-tests.ts
+++ b/apigee-access/apigee-access-tests.ts
@@ -1,4 +1,3 @@
-///
import apigee from "apigee-access";
//Sample code from
diff --git a/apigee-access/apigee-access.d.ts b/apigee-access/index.d.ts
similarity index 95%
rename from apigee-access/apigee-access.d.ts
rename to apigee-access/index.d.ts
index af34724023..e3c2157857 100644
--- a/apigee-access/apigee-access.d.ts
+++ b/apigee-access/index.d.ts
@@ -3,7 +3,7 @@
// Definitions by: Casper Skydt
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-declare module ApigeeAccess {
+declare namespace ApigeeAccess {
function getVariable(request: any, name: string): string | number | boolean;
function setVariable(request: any, name: string, value: string | number | boolean ): void;
@@ -53,6 +53,4 @@ declare module ApigeeAccess {
}
}
-declare module "apigee-access"{
- export default ApigeeAccess;
-}
\ No newline at end of file
+export default ApigeeAccess;
diff --git a/apigee-access/tsconfig.json b/apigee-access/tsconfig.json
new file mode 100644
index 0000000000..4e7f02b30c
--- /dev/null
+++ b/apigee-access/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "apigee-access-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/app-root-path/app-root-path-tests.ts b/app-root-path/app-root-path-tests.ts
index 64d8cdab6b..ababb8113e 100644
--- a/app-root-path/app-root-path-tests.ts
+++ b/app-root-path/app-root-path-tests.ts
@@ -1,4 +1,3 @@
-///
import * as root from 'app-root-path';
let resolvedPath: string;
diff --git a/app-root-path/app-root-path.d.ts b/app-root-path/app-root-path.d.ts
deleted file mode 100644
index 7cccc59e01..0000000000
--- a/app-root-path/app-root-path.d.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-// Type definitions for app-root-path 1.2.1
-// Project: https://github.com/inxilpro/node-app-root-path
-// Definitions by: Shant Marouti
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
-declare module 'app-root-path' {
- interface RootPath {
-
- /**
- * Application root directory absolute path
- * @type {string}
- */
- path: string;
-
- /**
- * Resolves relative path from root to absolute path
- * @param {string} pathToModule
- * @returns {string}
- */
- resolve(pathToModule: string): string;
-
- /**
- * Resolve module by relative addressing from root
- * @param {string} pathToModule
- * @returns {*}
- */
- require(pathToModule: string): any;
-
- /**
- * Explicitly set root path
- * @param {string} explicitlySetPath
- */
- setPath(explicitlySetPath: string): void;
-
- toString(): string;
- }
- var RootPath: RootPath;
- export = RootPath;
-}
\ No newline at end of file
diff --git a/app-root-path/index.d.ts b/app-root-path/index.d.ts
new file mode 100644
index 0000000000..7cec6494c1
--- /dev/null
+++ b/app-root-path/index.d.ts
@@ -0,0 +1,37 @@
+// Type definitions for app-root-path 1.2.1
+// Project: https://github.com/inxilpro/node-app-root-path
+// Definitions by: Shant Marouti
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+interface RootPath {
+
+ /**
+ * Application root directory absolute path
+ * @type {string}
+ */
+ path: string;
+
+ /**
+ * Resolves relative path from root to absolute path
+ * @param {string} pathToModule
+ * @returns {string}
+ */
+ resolve(pathToModule: string): string;
+
+ /**
+ * Resolve module by relative addressing from root
+ * @param {string} pathToModule
+ * @returns {*}
+ */
+ require(pathToModule: string): any;
+
+ /**
+ * Explicitly set root path
+ * @param {string} explicitlySetPath
+ */
+ setPath(explicitlySetPath: string): void;
+
+ toString(): string;
+}
+declare const RootPath: RootPath;
+export = RootPath;
diff --git a/app-root-path/tsconfig.json b/app-root-path/tsconfig.json
new file mode 100644
index 0000000000..9025308aca
--- /dev/null
+++ b/app-root-path/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "app-root-path-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/argv/argv-tests.ts b/argv/argv-tests.ts
index 6d73c53ec7..b9f8c47d59 100644
--- a/argv/argv-tests.ts
+++ b/argv/argv-tests.ts
@@ -1,4 +1,3 @@
-///
import argv = require('argv');
argv.version( 'v1.0' );
argv.info( 'Special script info' );
diff --git a/argv/argv.d.ts b/argv/argv.d.ts
deleted file mode 100644
index 182ffde861..0000000000
--- a/argv/argv.d.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-// Type definitions for argv
-// Project: https://www.npmjs.com/package/argv
-// Definitions by: Hookclaw
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-declare module "argv" {
- // argv module
- type args = {
- targets:string[],
- options:{[key:string]:any}
- };
-
- type helpOption = {
- name: string,
- type: string,
- short?: string,
- description?: string,
- example?: string
- };
-
- type module = {
- mod: string,
- description: string,
- options: {[key:string]:helpOption}
- };
-
- type typeFunction = (value:any, ...arglist:any[]) => any;
-
- type argv = {
-
- // Runs the arguments parser
- run: ( argv?:string[] ) => args,
-
- // Adding options to definitions list
- option: ( mod:helpOption|helpOption[] ) => argv,
-
- // Creating module
- mod: ( object:module|module[] ) => argv,
-
- // Creates custom type function
- type: ( name:string|{[key:string]:typeFunction}, callback?:typeFunction ) => any,
-
- // Setting version number, and auto setting version option
- version: ( v:string ) => argv,
-
- // Description setup
- info: ( mod:string, description?:module ) => argv,
-
- // Cleans out current options
- clear: () => argv,
-
- // Prints out the help doc
- help: ( mod?:string ) => argv
-
- };
-
- var argv:argv;
-
- export = argv;
-}
diff --git a/argv/index.d.ts b/argv/index.d.ts
new file mode 100644
index 0000000000..9b355b33a3
--- /dev/null
+++ b/argv/index.d.ts
@@ -0,0 +1,59 @@
+// Type definitions for argv
+// Project: https://www.npmjs.com/package/argv
+// Definitions by: Hookclaw
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+// argv module
+type args = {
+ targets: string[],
+ options: { [key: string]: any }
+};
+
+type helpOption = {
+ name: string,
+ type: string,
+ short?: string,
+ description?: string,
+ example?: string
+};
+
+type module = {
+ mod: string,
+ description: string,
+ options: { [key: string]: helpOption }
+};
+
+type typeFunction = (value: any, ...arglist: any[]) => any;
+
+type argv = {
+
+ // Runs the arguments parser
+ run: (argv?: string[]) => args,
+
+ // Adding options to definitions list
+ option: (mod: helpOption | helpOption[]) => argv,
+
+ // Creating module
+ mod: (object: module | module[]) => argv,
+
+ // Creates custom type function
+ type: (name: string | { [key: string]: typeFunction }, callback?: typeFunction) => any,
+
+ // Setting version number, and auto setting version option
+ version: (v: string) => argv,
+
+ // Description setup
+ info: (mod: string, description?: module) => argv,
+
+ // Cleans out current options
+ clear: () => argv,
+
+ // Prints out the help doc
+ help: (mod?: string) => argv
+
+};
+
+declare const argv: argv;
+
+export = argv;
+
diff --git a/argv/tsconfig.json b/argv/tsconfig.json
new file mode 100644
index 0000000000..bd2065e5a2
--- /dev/null
+++ b/argv/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "argv-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/array-find-index/array-find-index-tests.ts b/array-find-index/array-find-index-tests.ts
index 8c69a531e2..467e3e0fa4 100644
--- a/array-find-index/array-find-index-tests.ts
+++ b/array-find-index/array-find-index-tests.ts
@@ -1,5 +1,3 @@
-///
-
import * as arrayFindIndex from 'array-find-index';
arrayFindIndex(['rainbow', 'unicorn', 'pony'], x => x === 'unicorn');
diff --git a/array-find-index/array-find-index.d.ts b/array-find-index/index.d.ts
similarity index 55%
rename from array-find-index/array-find-index.d.ts
rename to array-find-index/index.d.ts
index 650cac2a16..cda81cf07a 100644
--- a/array-find-index/array-find-index.d.ts
+++ b/array-find-index/index.d.ts
@@ -3,11 +3,11 @@
// Definitions by: Sam Verschueren
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-declare module "array-find-index" {
+declare namespace arrayFindIndex {
type Predicate = (element: any, index: number, array: any[]) => boolean;
-
- function arrayFindIndex(arr: any[], predicate: Predicate): number;
- function arrayFindIndex(arr: any[], predicate: Predicate, ctx: any): number;
- namespace arrayFindIndex {}
- export = arrayFindIndex;
}
+declare function arrayFindIndex(arr: any[], predicate: arrayFindIndex.Predicate): number;
+declare function arrayFindIndex(arr: any[], predicate: arrayFindIndex.Predicate, ctx: any): number;
+
+export = arrayFindIndex;
+
diff --git a/array-find-index/tsconfig.json b/array-find-index/tsconfig.json
new file mode 100644
index 0000000000..f69a237654
--- /dev/null
+++ b/array-find-index/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "array-find-index-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/auth0-js/auth0-js-tests.ts b/auth0-js/auth0-js-tests.ts
new file mode 100644
index 0000000000..197256ddd5
--- /dev/null
+++ b/auth0-js/auth0-js-tests.ts
@@ -0,0 +1,23 @@
+///
+
+var auth0 = new Auth0({
+ domain: 'mine.auth0.com',
+ clientID: 'dsa7d77dsa7d7',
+ callbackURL: 'http://my-app.com/callback',
+ callbackOnLocationHash: true
+});
+
+auth0.login({
+ connection: 'google-oauth2',
+ popup: true,
+ popupOptions: {
+ width: 450,
+ height: 800
+ }
+}, (err, profile, idToken, accessToken, state) => {
+ if (err) {
+ alert("something went wrong: " + err.message);
+ return;
+ }
+ alert('hello ' + profile.name);
+ });
diff --git a/auth0-js/index.d.ts b/auth0-js/index.d.ts
new file mode 100644
index 0000000000..50041bb5d1
--- /dev/null
+++ b/auth0-js/index.d.ts
@@ -0,0 +1,132 @@
+// Type definitions for Auth0.js
+// Project: https://github.com/auth0/auth0.js
+// Definitions by: Robert McLaws
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+/** Extensions to the browser Window object. */
+interface Window {
+ /** Allows you to pass the id_token to other APIs, as specified in https://docs.auth0.com/apps-apis */
+ token: string;
+}
+
+/** This is the interface for the main Auth0 client. */
+interface Auth0Static {
+
+ new(options: Auth0ClientOptions): Auth0Static;
+ changePassword(options: any, callback?: Function): void;
+ decodeJwt(jwt: string): any;
+ login(options: any, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
+ loginWithPopup(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
+ loginWithResourceOwner(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: any) => any): void;
+ loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
+ logout(query: string): void;
+ getConnections(callback?: Function): void;
+ refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
+ getDelegationToken(targetClientId: string, id_token: string, options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
+ getProfile(id_token: string, callback?: Function): Auth0UserProfile;
+ getSSOData(withActiveDirectories: any, callback?: Function): void;
+ parseHash(hash: string): Auth0DecodedHash;
+ signup(options: Auth0SignupOptions, callback: Function): void;
+ validateUser(options: any, callback: (error?: Auth0Error, valid?: any) => any): void;
+}
+
+/** Represents constructor options for the Auth0 client. */
+interface Auth0ClientOptions {
+ clientID: string;
+ callbackURL: string;
+ callbackOnLocationHash?: boolean;
+ domain: string;
+ forceJSONP?: boolean;
+}
+
+/** Represents a normalized UserProfile. */
+interface Auth0UserProfile {
+ email: string;
+ family_name: string;
+ gender: string;
+ given_name: string;
+ locale: string;
+ name: string;
+ nickname: string;
+ picture: string;
+ user_id: string;
+ /** Represents one or more Identities that may be associated with the User. */
+ identities: Auth0Identity[];
+ user_metadata?: any;
+ app_metadata?: any;
+}
+
+/** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */
+interface MicrosoftUserProfile extends Auth0UserProfile {
+ emails: string[];
+}
+
+/** Represents an Auth0UserProfile that has an Office365 account as the primary identity. */
+interface Office365UserProfile extends Auth0UserProfile {
+ tenantid: string;
+ upn: string;
+}
+
+/** Represents an Auth0UserProfile that has an Active Directory account as the primary identity. */
+interface AdfsUserProfile extends Auth0UserProfile {
+ issuer: string;
+}
+
+/** Represents multiple identities assigned to a user. */
+interface Auth0Identity {
+ access_token: string;
+ connection: string;
+ isSocial: boolean;
+ provider: string;
+ user_id: string;
+}
+
+interface Auth0DecodedHash {
+ access_token: string;
+ id_token: string;
+ profile: Auth0UserProfile;
+ state: any;
+}
+
+interface Auth0PopupOptions {
+ width: number;
+ height: number;
+}
+
+interface Auth0LoginOptions {
+ auto_login?: boolean;
+ connection?: string;
+ email?: string;
+ username?: string;
+ password?: string;
+ popup?: boolean;
+ popupOptions?: Auth0PopupOptions;
+}
+
+interface Auth0SignupOptions extends Auth0LoginOptions {
+ auto_login: boolean;
+}
+
+interface Auth0Error {
+ code: any;
+ details: any;
+ name: string;
+ message: string;
+ status: any;
+}
+
+/** Represents the response from an API Token Delegation request. */
+interface Auth0DelegationToken {
+ /** The length of time in seconds the token is valid for. */
+ expires_in: string;
+ /** The JWT for delegated access. */
+ id_token: string;
+ /** The type of token being returned. Possible values: "Bearer" */
+ token_type: string;
+}
+
+declare const Auth0: Auth0Static;
+
+declare module "auth0" {
+ export = Auth0
+}
diff --git a/auth0-js/tsconfig.json b/auth0-js/tsconfig.json
new file mode 100644
index 0000000000..7a0a649c3b
--- /dev/null
+++ b/auth0-js/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "auth0-js-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/auth0-lock/auth0.lock-tests.ts b/auth0-lock/auth0.lock-tests.ts
index e62cd4ba2d..bba2fc8228 100644
--- a/auth0-lock/auth0.lock-tests.ts
+++ b/auth0-lock/auth0.lock-tests.ts
@@ -1,4 +1,4 @@
-///
+///
const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID";
diff --git a/auth0-lock/index.d.ts b/auth0-lock/index.d.ts
index da99744841..10ee3aac0d 100644
--- a/auth0-lock/index.d.ts
+++ b/auth0-lock/index.d.ts
@@ -3,7 +3,7 @@
// Definitions by: Brian Caruso
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-///
+///
interface Auth0LockAdditionalSignUpFieldOption {
value: string;
diff --git a/auth0.widget/auth0.widget-tests.ts b/auth0.widget/auth0.widget-tests.ts
index 79f1a2a7a7..ec5502ca7e 100644
--- a/auth0.widget/auth0.widget-tests.ts
+++ b/auth0.widget/auth0.widget-tests.ts
@@ -1,4 +1,4 @@
-///
+///
var widget: Auth0WidgetStatic = new Auth0Widget({
diff --git a/auth0.widget/index.d.ts b/auth0.widget/index.d.ts
index ed6a2f341b..24d978ab9d 100644
--- a/auth0.widget/index.d.ts
+++ b/auth0.widget/index.d.ts
@@ -3,7 +3,7 @@
// Definitions by: Robert McLaws
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-///
+///
interface Auth0WidgetStatic {
diff --git a/auth0/auth0-tests.ts b/auth0/auth0-tests.ts
index 7f48274eaf..391dee655a 100644
--- a/auth0/auth0-tests.ts
+++ b/auth0/auth0-tests.ts
@@ -1,23 +1,51 @@
///
-var auth0 = new Auth0({
- domain: 'mine.auth0.com',
- clientID: 'dsa7d77dsa7d7',
- callbackURL: 'http://my-app.com/callback',
- callbackOnLocationHash: true
+import * as auth0 from 'auth0';
+
+const management = new auth0.ManagementClient({
+ token: '{YOUR_API_V2_TOKEN}',
+ domain: '{YOUR_ACCOUNT}.auth0.com'
});
-auth0.login({
- connection: 'google-oauth2',
- popup: true,
- popupOptions: {
- width: 450,
- height: 800
- }
-}, (err, profile, idToken, accessToken, state) => {
- if (err) {
- alert("something went wrong: " + err.message);
- return;
- }
- alert('hello ' + profile.name);
- });
+const auth = new auth0.AuthenticationClient({
+ domain: '{YOUR_ACCOUNT}.auth0.com',
+ clientId: '{OPTIONAL_CLIENT_ID}'
+});
+
+// Using a callback.
+management.getUsers((err: Error, users: auth0.User[]) => {
+ if (err) {
+ // Handle error.
+ }
+ console.log(users);
+});
+
+// Using a Promise.
+management
+ .getUsers()
+ .then((users) => {
+ console.log(users);
+ })
+ .catch((err) => {
+ // Handle the error.
+ });
+
+management
+ .createUser({
+ connection: 'My-Connection',
+ email: 'hi@me.co',
+ }).then((user) => {
+ console.log(user);
+ }).catch((err) => {
+ // Handle the error.
+ });
+
+auth
+ .requestChangePasswordEmail({
+ connection: 'My-Connection',
+ email: 'hi@me.co',
+ }).then((response) => {
+ console.log(response);
+ }).catch((err) => {
+ // Handle the error.
+ });
diff --git a/auth0/index.d.ts b/auth0/index.d.ts
index 5ca8487f85..019d9edc38 100644
--- a/auth0/index.d.ts
+++ b/auth0/index.d.ts
@@ -1,132 +1,89 @@
-// Type definitions for Auth0.js
-// Project: http://auth0.com
-// Definitions by: Robert McLaws
+// Type definitions for auth0 v2.3.1
+// Project: https://github.com/auth0/node-auth0
+// Definitions by: Seth Westphal
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-/** Extensions to the browser Window object. */
-interface Window {
- /** Allows you to pass the id_token to other APIs, as specified in https://docs.auth0.com/apps-apis */
- token: string;
+import * as Promise from 'bluebird';
+
+export interface ManagementClientOptions {
+ token: string;
+ domain?: string;
}
-/** This is the interface for the main Auth0 client. */
-interface Auth0Static {
-
- new(options: Auth0ClientOptions): Auth0Static;
- changePassword(options: any, callback?: Function): void;
- decodeJwt(jwt: string): any;
- login(options: any, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
- loginWithPopup(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
- loginWithResourceOwner(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: any) => any): void;
- loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
- logout(query: string): void;
- getConnections(callback?: Function): void;
- refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
- getDelegationToken(targetClientId: string, id_token: string, options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
- getProfile(id_token: string, callback?: Function): Auth0UserProfile;
- getSSOData(withActiveDirectories: any, callback?: Function): void;
- parseHash(hash: string): Auth0DecodedHash;
- signup(options: Auth0SignupOptions, callback: Function): void;
- validateUser(options: any, callback: (error?: Auth0Error, valid?: any) => any): void;
+export interface UserData {
+ connection: string;
+ email?: string;
+ username?: string;
+ password?: string;
+ phone_number?: string;
+ user_metadata?: {};
+ email_verified?: boolean;
+ app_metadata?: {};
}
-/** Represents constructor options for the Auth0 client. */
-interface Auth0ClientOptions {
- clientID: string;
- callbackURL: string;
- callbackOnLocationHash?: boolean;
- domain: string;
- forceJSONP?: boolean;
+export interface GetUsersData {
+ per_page?: number;
+ page?: number;
+ include_totals?: boolean;
+ sort?: string;
+ connection?: string;
+ fields?: string;
+ include_fields?: boolean;
+ q?: string;
+ search_engine?: string;
}
-/** Represents a normalized UserProfile. */
-interface Auth0UserProfile {
- email: string;
- family_name: string;
- gender: string;
- given_name: string;
- locale: string;
- name: string;
- nickname: string;
- picture: string;
- user_id: string;
- /** Represents one or more Identities that may be associated with the User. */
- identities: Auth0Identity[];
- user_metadata?: any;
- app_metadata?: any;
+export interface User {
+ email?: string;
+ email_verified?: boolean;
+ username?: string;
+ phone_number?: string;
+ phone_verified?: boolean;
+ user_id?: string;
+ created_at?: string;
+ updated_at?: string;
+ identities?: Identity[];
+ app_metadata?: {};
+ user_metadata?: {};
+ picture?: string;
+ name?: string;
+ nickname?: string;
+ multifactor?: string[];
+ last_ip?: string;
+ last_login?: string;
+ logins_count?: number;
+ blocked?: boolean;
}
-/** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */
-interface MicrosoftUserProfile extends Auth0UserProfile {
- emails: string[];
+export interface Identity {
+ connection: string;
+ user_id: string;
+ provider: string;
+ isSocial: boolean;
}
-/** Represents an Auth0UserProfile that has an Office365 account as the primary identity. */
-interface Office365UserProfile extends Auth0UserProfile {
- tenantid: string;
- upn: string;
+export class ManagementClient {
+ constructor(options: ManagementClientOptions);
+
+ getUsers(params?: GetUsersData): Promise;
+ getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void;
+ createUser(data: UserData): Promise;
+ createUser(data: UserData, cb: (err: Error, data: User) => void): void;
}
-/** Represents an Auth0UserProfile that has an Active Directory account as the primary identity. */
-interface AdfsUserProfile extends Auth0UserProfile {
- issuer: string;
+export interface AuthenticationClientOptions {
+ clientId?: string;
+ domain: string;
}
-/** Represents multiple identities assigned to a user. */
-interface Auth0Identity {
- access_token: string;
- connection: string;
- isSocial: boolean;
- provider: string;
- user_id: string;
+export interface RequestChangePasswordEmailData {
+ connection: string;
+ email: string;
}
-interface Auth0DecodedHash {
- access_token: string;
- id_token: string;
- profile: Auth0UserProfile;
- state: any;
-}
+export class AuthenticationClient {
+ constructor(options: AuthenticationClientOptions);
-interface Auth0PopupOptions {
- width: number;
- height: number;
-}
-
-interface Auth0LoginOptions {
- auto_login?: boolean;
- connection?: string;
- email?: string;
- username?: string;
- password?: string;
- popup?: boolean;
- popupOptions?: Auth0PopupOptions;
-}
-
-interface Auth0SignupOptions extends Auth0LoginOptions {
- auto_login: boolean;
-}
-
-interface Auth0Error {
- code: any;
- details: any;
- name: string;
- message: string;
- status: any;
-}
-
-/** Represents the response from an API Token Delegation request. */
-interface Auth0DelegationToken {
- /** The length of time in seconds the token is valid for. */
- expires_in: string;
- /** The JWT for delegated access. */
- id_token: string;
- /** The type of token being returned. Possible values: "Bearer" */
- token_type: string;
-}
-
-declare var Auth0: Auth0Static;
-
-declare module "auth0" {
- export = Auth0
-}
+ requestChangePasswordEmail(data: RequestChangePasswordEmailData): Promise;
+ requestChangePasswordEmail(data: RequestChangePasswordEmailData, cb: (err: Error, message: string) => void): void;
+}
\ No newline at end of file
diff --git a/autosize/autosize-tests.ts b/autosize/autosize-tests.ts
index 23686fbd88..74be703a94 100644
--- a/autosize/autosize-tests.ts
+++ b/autosize/autosize-tests.ts
@@ -1,4 +1,4 @@
-///
+///
// from a NodeList
autosize(document.querySelectorAll('textarea'));
diff --git a/autosize/autosize.d.ts b/autosize/index.d.ts
similarity index 88%
rename from autosize/autosize.d.ts
rename to autosize/index.d.ts
index 0a8a696c3d..5ea76d0472 100644
--- a/autosize/autosize.d.ts
+++ b/autosize/index.d.ts
@@ -12,6 +12,5 @@ declare namespace autosize {
declare var autosize: autosize.AutosizeStatic;
-declare module 'autosize' {
- export = autosize;
-}
+export = autosize;
+export as namespace autosize;
diff --git a/autosize/tsconfig.json b/autosize/tsconfig.json
new file mode 100644
index 0000000000..09535bc88d
--- /dev/null
+++ b/autosize/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "autosize-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/aws-lambda/aws-lambda-tests.ts b/aws-lambda/aws-lambda-tests.ts
index fd289dcb7f..794a74adec 100644
--- a/aws-lambda/aws-lambda-tests.ts
+++ b/aws-lambda/aws-lambda-tests.ts
@@ -1,5 +1,3 @@
-///
-
import lambda = require('aws-lambda');
var str: string;
diff --git a/aws-lambda/aws-lambda.d.ts b/aws-lambda/aws-lambda.d.ts
deleted file mode 100644
index cdd8e2f506..0000000000
--- a/aws-lambda/aws-lambda.d.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-// Type definitions for AWS Lambda
-// Project: http://docs.aws.amazon.com/lambda
-// Definitions by: Michael Skarum
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
-declare module "aws-lambda" {
-
- export interface Records {
- Records: Record[];
- }
- interface Record {
- EventVersion: string;
- EventSubscriptionArn: string;
- EnventSource: string;
- Sns: SNS;
- kinesis: Kinesis;
- }
- interface SNS {
- Type: string;
- MessageId: string;
- TopicArn: string;
- Subject: string;
- Message: string;
- Timestamp: Date;
- }
-
- interface Kinesis {
- data: string;
- }
-
- export interface Context {
- log(message: string, object: any): void;
- fail(message: string): void;
- succeed(message: string): void;
- succeed(object: any): void;
- succeed(message: string, object: any): void;
- awsRequestId: string;
- getRemainingTimeInMillis(): number;
- }
-
-
- export type Callback = (error?: Error, message?: string) => void;
-}
\ No newline at end of file
diff --git a/aws-lambda/index.d.ts b/aws-lambda/index.d.ts
new file mode 100644
index 0000000000..fe94eac335
--- /dev/null
+++ b/aws-lambda/index.d.ts
@@ -0,0 +1,39 @@
+// Type definitions for AWS Lambda
+// Project: http://docs.aws.amazon.com/lambda
+// Definitions by: Michael Skarum
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+export interface Records {
+ Records: Record[];
+}
+interface Record {
+ EventVersion: string;
+ EventSubscriptionArn: string;
+ EnventSource: string;
+ Sns: SNS;
+ kinesis: Kinesis;
+}
+interface SNS {
+ Type: string;
+ MessageId: string;
+ TopicArn: string;
+ Subject: string;
+ Message: string;
+ Timestamp: Date;
+}
+
+interface Kinesis {
+ data: string;
+}
+
+export interface Context {
+ log(message: string, object: any): void;
+ fail(message: string): void;
+ succeed(message: string): void;
+ succeed(object: any): void;
+ succeed(message: string, object: any): void;
+ awsRequestId: string;
+ getRemainingTimeInMillis(): number;
+}
+
+export type Callback = (error?: Error, message?: string) => void;
diff --git a/aws-lambda/tsconfig.json b/aws-lambda/tsconfig.json
new file mode 100644
index 0000000000..66d22dcfd7
--- /dev/null
+++ b/aws-lambda/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "aws-lambda-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/babelify/babelify-tests.ts b/babelify/babelify-tests.ts
index 6ace8462a9..107c8bddd6 100644
--- a/babelify/babelify-tests.ts
+++ b/babelify/babelify-tests.ts
@@ -1,5 +1,3 @@
-///
-
import babelify = require("babelify");
module BabelifyTest {
diff --git a/babelify/babelify.d.ts b/babelify/babelify.d.ts
deleted file mode 100644
index 2637814a64..0000000000
--- a/babelify/babelify.d.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-// Type definitions for babelify v7.3.0
-// Project: https://github.com/babel/babelify
-// Definitions by: TeamworkGuy2
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
-///
-///
-
-/** Browserify transform for Babel
- */
-declare module 'babelify' {
- import stream = require("stream");
- import babel = require("babel-core");
-
-
- function Babelify(filename: string, opts?: Babelify.BabelifyOptions): Babelify.BabelifyObject;
-
- module Babelify {
-
- export interface BabelifyConstructor {
- (filename: string, opts: Babelify.BabelifyOptions): Babelify.BabelifyObject;
- }
-
- /** In addition to the various purposes documented here, all of the babelify options are passed to babel which passes them on to babel.transform() when each file is transformed */
- export interface BabelifyOptions extends babel.TransformOptions {
- /** These are passed to babel.util.canCompile() for each filename
- * default: null
- */
- extensions?: string | string[];
-
- /** if true, a 'sourceFileName' property with a value equal to the current file being transformed is included with the options passed to babel.transform()
- * default: false
- */
- sourceMapsAbsolute?: boolean;
- }
-
- export class BabelifyObject extends stream.Transform {
- _transform(buf: string | Buffer, encoding: string, callback: () => void): void;
- _flush(callback: () => void): void;
- }
-
- export function configure(opts: Babelify.BabelifyOptions): (filename: string) => Babelify.BabelifyObject;
- }
-
- export = Babelify;
-}
diff --git a/babelify/index.d.ts b/babelify/index.d.ts
new file mode 100644
index 0000000000..c69eef42b2
--- /dev/null
+++ b/babelify/index.d.ts
@@ -0,0 +1,43 @@
+// Type definitions for babelify v7.3.0
+// Project: https://github.com/babel/babelify
+// Definitions by: TeamworkGuy2
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+/** Browserify transform for Babel
+ */
+import stream = require("stream");
+import babel = require("babel-core");
+
+declare function Babelify(filename: string, opts?: Babelify.BabelifyOptions): Babelify.BabelifyObject;
+
+declare namespace Babelify {
+
+ export interface BabelifyConstructor {
+ (filename: string, opts: Babelify.BabelifyOptions): Babelify.BabelifyObject;
+ }
+
+ /** In addition to the various purposes documented here, all of the babelify options are passed to babel which passes them on to babel.transform() when each file is transformed */
+ export interface BabelifyOptions extends babel.TransformOptions {
+ /** These are passed to babel.util.canCompile() for each filename
+ * default: null
+ */
+ extensions?: string | string[];
+
+ /** if true, a 'sourceFileName' property with a value equal to the current file being transformed is included with the options passed to babel.transform()
+ * default: false
+ */
+ sourceMapsAbsolute?: boolean;
+ }
+
+ export class BabelifyObject extends stream.Transform {
+ _transform(buf: string | Buffer, encoding: string, callback: () => void): void;
+ _flush(callback: () => void): void;
+ }
+
+ export function configure(opts: Babelify.BabelifyOptions): (filename: string) => Babelify.BabelifyObject;
+}
+
+export = Babelify;
+
diff --git a/babelify/tsconfig.json b/babelify/tsconfig.json
new file mode 100644
index 0000000000..bbeccefdbd
--- /dev/null
+++ b/babelify/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "babelify-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/bazinga-translator/bazinga-translator-tests.ts b/bazinga-translator/bazinga-translator-tests.ts
index 2401641815..8c5d1dafa8 100644
--- a/bazinga-translator/bazinga-translator-tests.ts
+++ b/bazinga-translator/bazinga-translator-tests.ts
@@ -1,4 +1,4 @@
-///
+///
Translator.fallback = 'en';
Translator.defaultDomain = 'messages';
diff --git a/bazinga-translator/bazinga-translator.d.ts b/bazinga-translator/index.d.ts
similarity index 98%
rename from bazinga-translator/bazinga-translator.d.ts
rename to bazinga-translator/index.d.ts
index 5467fbfd85..06a9ef3858 100644
--- a/bazinga-translator/bazinga-translator.d.ts
+++ b/bazinga-translator/index.d.ts
@@ -96,4 +96,4 @@ interface BazingaTranslator {
reset(): void;
}
-declare var Translator: BazingaTranslator;
\ No newline at end of file
+declare const Translator: BazingaTranslator;
\ No newline at end of file
diff --git a/bazinga-translator/tsconfig.json b/bazinga-translator/tsconfig.json
new file mode 100644
index 0000000000..23a0f9abdb
--- /dev/null
+++ b/bazinga-translator/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "bazinga-translator-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/bezier-js/bezier-js-tests.ts b/bezier-js/bezier-js-tests.ts
index a3efa04858..5776ffd307 100644
--- a/bezier-js/bezier-js-tests.ts
+++ b/bezier-js/bezier-js-tests.ts
@@ -1,3 +1,5 @@
+///
+
function test() {
var bezierjs: typeof BezierJs;
diff --git a/bezier-js/index.d.ts b/bezier-js/index.d.ts
index 8ee85790b1..2c283c4e98 100644
--- a/bezier-js/index.d.ts
+++ b/bezier-js/index.d.ts
@@ -2,7 +2,8 @@
// Project: https://github.com/Pomax/bezierjs
// Definitions by: Dan Marshall
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-declare module BezierJs {
+
+declare namespace BezierJs {
interface Point {
x: number;
y: number;
@@ -143,7 +144,8 @@ declare module BezierJs {
virtual: boolean;
}
}
-declare module BezierJs.utils {
+
+declare namespace BezierJs.utils {
var Tvalues: number[];
var Cvalues: number[];
function arcfn(t: number, derivativeFn: Function): number;
@@ -178,7 +180,8 @@ declare module BezierJs.utils {
function pairiteration(c1: Bezier, c2: Bezier, curveIntersectionThreshold?: number): string[];
function getccenter(p1: Point, p2: Point, p3: Point): Arc;
}
-declare module BezierJs {
+
+declare namespace BezierJs {
/**
* Poly Bezier
* @param {[type]} curves [description]
diff --git a/bezier-js/tsconfig.json b/bezier-js/tsconfig.json
new file mode 100644
index 0000000000..e86d3238a7
--- /dev/null
+++ b/bezier-js/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "bezier-js-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/blessed/blessed-tests.ts b/blessed/blessed-tests.ts
new file mode 100644
index 0000000000..612fb14b0c
--- /dev/null
+++ b/blessed/blessed-tests.ts
@@ -0,0 +1 @@
+import * as blessed from 'blessed'
\ No newline at end of file
diff --git a/blessed/blessed.d.ts b/blessed/blessed.d.ts
deleted file mode 100644
index 6746afe5f5..0000000000
--- a/blessed/blessed.d.ts
+++ /dev/null
@@ -1,1269 +0,0 @@
-// Type definitions for blessed 0.1.5
-// Project: https://github.com/chjj/blessed
-// Definitions by: bryn austin bellomy
-// Definitions: https://github.com/borisyankov/DefinitelyTyped
-
-///
-
-declare module "blessed"
-{
- import events = require('events');
- import buffer = require('buffer');
- import child_process = require('child_process');
-
- module Blessed
- {
- export var colors: Colors;
-
- export interface GenericCallback {
- (...args:any[]): void;
- }
-
- export interface ColorPair {
- /** background, must be number (-1 for default). */
- bg?: number;
- /** foreground, must be number (-1 for default). */
- fg?: number;
- }
-
- export interface Style extends ColorPair {
- bold?: boolean;
- underline?: boolean;
- border: Border;
- hover: ColorPair;
- }
-
- export interface Border extends ColorPair {
- /** type of border ('line' or 'bg'). */
- type?: string; //'line'|'bg';
- /** character to use if bg type, default is space. */
- ch?: string;
- }
-
- export interface Padding {
- top?:number;
- right?:number;
- bottom?:number;
- left?:number;
- }
-
- export interface Position {
- /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
- top?:number|string;
- /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
- right?:number|string;
- /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
- bottom?:number|string;
- /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
- left?:number|string;
- /** width of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
- width?:number|string;
- /** height of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
- height?:number|string;
- }
-
- export interface KeyCode {
- name: string;
- ctrl: boolean;
- meta: boolean;
- shift: boolean;
- sequence: string;
- full: string;
- }
-
- export class Program
- {
- /**
- Wrap the given text in terminal formatting codes corresponding to the given attribute
- name. The `attr` string can be of the form `red fg` or `52 bg` where `52` is a 0-255
- integer color number.
- */
- text (text:string, attr:string): string;
- }
-
- export interface Colors {
- /** Either pass a hex string, an array of 3 numbers, or three separate numbers representing an RGB value. This returns the 0-255 color number for that color. */
- match (r:string|number[]|number, g?:number, b?:number): number;
-
- /** An array of the 255 colors as hex strings. */
- colors: string[];
- }
-
- export interface NodeOptions
- {
- screen?: Screen;
- parent?: Node;
- children?: Node[];
- }
-
- export class Node extends events.EventEmitter
- {
- constructor(options?:NodeOptions);
-
- type : string;
- options : NodeOptions;
- parent : Node;
- screen : Screen;
- children : Node[];
- data : any;
- _ : any;
- $ : any;
- index : number;
-
- // on(event:string, callback:() => void);
- // on(event:'adopt', callback:() => void);
- // on(event:'remove', callback:() => void);
- // on(event:'reparent', callback:() => void);
- // on(event:'attach', callback:() => void);
- // on(event:'detach', callback:() => void);
-
- prepend(node:Node): void;
- append(node:Node): void;
- remove(node:Node): void;
- insert(node:Node, index:number): void;
- insertBefore(node:Node, refNode:Node): void;
- insertAfter(node:Node, refNode:Node): void;
- detach(): void;
- // emitDescendants(): void;
- // get(key:string): any;
- // get(key:string, default:any): any;
- // set(key:string, value:any): void;
- }
-
- export interface ScreenOptions extends NodeOptions
- {
- /** the blessed Program to be associated with. will be automatically instantiated if none is provided. */
- program?: any;
- /** attempt to perform CSR optimization on all possible elements (not just full-width ones, elements with uniform cells to their sides). this is known to cause flickering with elements that are not full-width, however, it is more optimal for terminal rendering. */
- smartCSR?: boolean;
- /** do CSR on any element within 20 cols of the screen edge on either side. faster than smartCSR, but may cause flickering depending on what is on each side of the element. */
- fastCSR?: boolean;
- /** attempt to perform back_color_erase optimizations for terminals that support it. it will also work with terminals that don't support it, but only on lines with the default background color. as it stands with the current implementation, it's uncertain how much terminal performance this adds at the cost of overhead within node. */
- useBCE?: boolean;
- /** amount of time (in ms) to redraw the screen after the terminal is resized (default: 300). */
- resizeTimeout?: number;
- /** the width of tabs within an element's content. */
- tabSize?: number;
- /** automatically position child elements with border and padding in mind. */
- autoPadding?: boolean;
- /** the name of the logfile to use. if specified but the file does not exist, it will be created. see log method. */
- log?: string;
- /** dump all output and input to desired file. can be used together with log option if set as a boolean. */
- dump?: any;
- /** debug mode. enables usage of the `debug` method. also creates a debug console which will display when pressing F12. it will display all log and debug messages. */
- debug?: boolean;
- /** Array of keys in their full format (e.g. C-c) to ignore when keys are locked. Useful for creating a key that will always exit no matter whether the keys are locked. */
- ignoreLocked?: string[];
-
- /** Do not clear the screen, only scroll down enough to make room for the elements on the screen. do not use the alternate screenbuffer. useful for writing a CLI tool or some kind of prompt (experimental - see test/widget-noalt.js) */
- noAlt?: boolean;
-
- /** Options for the cursor. */
- cursor?: CursorOptions;
- }
-
- export interface CursorOptions {
- /** have blessed draw a custom cursor and hide the terminal cursor (experimental). */
- artificial?: boolean;
- /** shape of the artificial cursor. can be: block, underline, or line. */
- shape?: string; //'block'|'underline'|'line';
- /** whether the artificial cursor blinks. */
- blink?: boolean;
- /** color of the artificial cursor. accepts any valid color value (null is default). */
- color?: string;
- }
-
- export interface ScreenEventCallback {
- (character:string, keyCode:KeyCode): void;
- }
-
- export class Screen extends Node
- {
- constructor(options?:ScreenOptions);
-
- /** the blessed Program object. */
- program: any;
- /** the blessed Tput object (only available if you passed tput: true to the Program constructor.) */
- tput: any;
- /** top of the focus history stack. */
- focused: any;
- /** width of the screen (same as program.cols). */
- width: number;
- /** height of the screen (same as program.rows). */
- height: number;
- /** same as screen.width. */
- cols: number;
- /** same as screen.height. */
- rows: number;
-
- /** calculated relative left offset. */
- left: number;
- /** calculated relative right offset. */
- right: number;
- /** calculated relative top offset. */
- top: number;
- /** calculated relative bottom offset. */
- bottom: number;
- /** calculated absolute left offset. */
- aleft: number;
- /** calculated absolute right offset. */
- aright: number;
- /** calculated absolute top offset. */
- atop: number;
- /** calculated absolute bottom offset. */
- abottom: number;
-
-
- /** whether the focused element grabs all keypresses. */
- grabKeys: boolean;
- /** prevent keypresses from being received by any element. */
- lockKeys: boolean;
- /** the currently hovered element. only set if mouse events are bound. */
- hover: Element;
- /** set or get window title. */
- title: string;
-
- /** write string to the log file if one was created. */
- log(...msg:any[]): void;
- /** same as the log method, but only gets called if the debug option was set. */
- debug(...msg:string[]): void;
- /** allocate a new pending screen buffer and a new output screen buffer. */
- alloc(): void;
- /** draw the screen based on the contents of the screen buffer. */
- draw(start:number, end:number): void;
- /** render all child elements, writing all data to the screen buffer and drawing the screen. */
- render(): void;
- /** clear any region on the screen. */
- clearRegion(x1:number, x2:number, y1:number, y2:number): void;
- /** fill any region with a character of a certain attribute. */
- fillRegion(attr:number, ch:string, x1:number, x2:number, y1:number, y2:number): void;
- /** focus element by offset of focusable elements. */
- focusOffset(offset:number): void;
- /** focus previous element in the index. */
- focusPrevious(): void;
- /** focus next element in the index. */
- focusNext(): void;
- /** push element on the focus stack (equivalent to screen.focused = el). */
- focusPush(element:Element): void;
- /** pop element off the focus stack. */
- focusPop(): void;
- /** save the focused element. */
- saveFocus(): void;
- /** restore the saved focused element. */
- restoreFocus(): void;
- /** "rewind" focus to the last visible and attached element. */
- rewindFocus(): void;
- /** bind a keypress listener for a specific key. */
- key(keyEvents:string|string[], callback:ScreenEventCallback): void;
- /** bind a keypress listener for a specific key once. */
- onceKey(keyEvents:string|string[], callback:ScreenEventCallback): void;
- /** remove a keypress listener for a specific key. */
- unkey(name:string, listener:ScreenEventCallback): void;
- /** spawn a process in the foreground, return to blessed app after exit. */
- spawn(file:string, args:string[], options:NodeChildProcessExecOptions): child_process.ChildProcess;
- /** spawn a process in the foreground, return to blessed app after exit. executes callback on error or exit. */
- exec(file:string, args:string[], options:NodeChildProcessExecOptions, callback:GenericCallback): child_process.ChildProcess;
- /** read data from text editor. */
- readEditor(options:{}, callback:GenericCallback): void;
- /** set effects based on two events and attributes. */
- setEffects(el:Element, fel:Element, over:string, out:string, effects:Style, temp?:string): void;
- /** insert a line into the screen (using csr: this bypasses the output buffer). */
- insertLine(n:number, y:number, top:number, bottom:number): void;
- /** delete a line from the screen (using csr: this bypasses the output buffer). */
- deleteLine(n:number, y:number, top:number, bottom:number): void;
- /** insert a line at the bottom of the screen. */
- insertBottom(top:number, bottom:number): void;
- /** insert a line at the top of the screen. */
- insertTop(top:number, bottom:number): void;
- /** delete a line at the bottom of the screen. */
- deleteBottom(top:number, bottom:number): void;
- /** delete a line at the top of the screen. */
- deleteTop(top:number, bottom:number): void;
-
- /** enable mouse events for the screen and optionally an element (automatically called when a form of on('mouse') is bound). */
- enableMouse(el?:Element): void;
- /** enable keypress events for the screen and optionally an element (automatically called when a form of on('keypress') is bound). */
- enableKeys(el?:Element): void;
- /** enable key and mouse events. calls bot enableMouse and enableKeys. */
- enableInput(el?:Element): void;
-
- /** attempt to copy text to clipboard using iTerm2's propriety sequence. returns true if successful. */
- copyToClipboard(text:string): boolean;
- /** attempt to change cursor shape. will not work in all terminals (see artificial cursors for a solution to this). returns true if successful. */
- cursorShape(shape:string, blink:boolean): boolean;
- /** attempt to change cursor color. returns true if successful. */
- cursorColor(color: string): boolean;
- /** attempt to reset cursor. returns true if successful. */
- cursorReset(): boolean;
-
- }
-
- export interface ElementOptions extends NodeOptions
- {
- fg?: string;
- bg?: string;
- scrollbar?: ColorPair;
- focus?: Style;
- hover?: Style;
-
- /** border object, see below. */
- border?: Border;
- /** positioning options. */
- position?: Position;
- /** amount of padding on the inside of the element. can be a number or an object containing the properties: left, right, top, and bottom. */
- padding?: number|Padding;
- /** element's text content. */
- content?: string;
- /** element is clickable. */
- clickable?: boolean;
- /** element is focusable and can receive key input. */
- input?: boolean;
- /** element is focused. */
- focused?: boolean;
- /** whether the element is hidden. */
- hidden?: boolean;
- /** a simple text label for the element. */
- label?: string;
- /** a floating text label for the element which appears on mouseover. */
- hoverText?: string;
- /** text alignment: left, center, or right. */
- align?: string;
- /** vertical text alignment: top, middle, or bottom. */
- valign?: string;
- /** shrink/flex/grow to content and child elements. width/height during render. */
- shrink?: any;
- /** width of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
- width?: number|string;
- /** height of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
- height?: number|string;
- /** whether the element is scrollable or not. */
- scrollable?: boolean;
- /** background character (default is whitespace ). */
- ch?: string;
- /** allow the element to be dragged with the mouse. */
- draggable?: boolean;
- }
-
- export class Element extends Node
- {
- constructor(options?:ElementOptions);
-
- /** name of the element. useful for form submission. */
- name: string;
- /** border object. */
- border: Border;
- /** contains attributes (e.g. fg/bg/underline). see above. */
- style: Style;
- /** raw width, height, and offsets. */
- position: Position;
- /** type of border (line or bg). bg by default. */
- type: string; //'line'|'bg';
- /** character to use if bg type, default is space. */
- ch: string;
- /** raw text content. */
- content: string;
- /** whether the element is hidden or not. */
- hidden: boolean;
- /** whether the element is visible or not. */
- visible: boolean;
- /** whether the element is attached to a screen in its ancestry somewhere. */
- detached: boolean;
- /** calculated width. */
- width: number;
- /** calculated height. */
- height: number;
- /** whether the element is draggable. set to true to allow dragging. */
- draggable: boolean;
-
-
-
- /** calculated relative left offset. */
- left: number;
- /** calculated relative right offset. */
- right: number;
- /** calculated relative top offset. */
- top: number;
- /** calculated relative bottom offset. */
- bottom: number;
- /** calculated absolute left offset. */
- aleft: number;
- /** calculated absolute right offset. */
- aright: number;
- /** calculated absolute top offset. */
- atop: number;
- /** calculated absolute bottom offset. */
- abottom: number;
-
-
- /** write content and children to the screen buffer. */
- render(): void;
- /** hide element. */
- hide(): void;
- /** show element. */
- show(): void;
- /** toggle hidden/shown. */
- toggle(): void;
- /** focus element. */
- focus(): void;
- /** bind a keypress listener for a specific key. */
- key(name:string|string[], listener:(character?:any, keyCode?:any) => void): void;
- /** bind a keypress listener for a specific key once. */
- onceKey(name:string, listener:() => void): void;
- /** remove a keypress listener for a specific key. */
- unkey(name:string, listener:() => void): void;
- /** same as el.on('screen', ...) except this will automatically cleanup listeners after the element is detached. */
- onScreenEvent(event:string, listener:(...args:any[]) => void): void;
- /** set the z-index of the element (changes rendering order). */
- setIndex(z:number): void;
- /** put the element in front of its siblings. */
- setFront(): void;
- /** put the element in back of its siblings. */
- setBack(): void;
- /** set the label text for the top-left corner. example options: {text:'foo',side:'left'} */
- setLabel(textOrOptions:string|{}): void;
- /** remove the label completely. */
- removeLabel(): void;
- /** set the hover text for the bottom-right corner. example options: {text:'foo'} */
- setHover(textOrOptions:string|{}): void;
- /** remove the hover label completely. */
- removeHover(): void;
- /** set the content. note: when text is input, it will be stripped of all non-SGR escape codes, tabs will be replaced with 8 spaces, and tags will be replaced with SGR codes (if enabled). */
- setContent(text:string): void;
- /** return content, slightly different from el.content. assume the above formatting. */
- getContent(): void;
- /** similar to setContent, but ignore tags and remove escape codes. */
- setText(text:string): void;
- /** similar to getContent, but return content with tags and escape codes removed. */
- getText(): void;
- /** insert a line into the box's content. */
- insertLine(index:number, lines:string|string[]): void;
- /** delete a line from the box's content. */
- deleteLine(index:number, numLines:number): void;
- /** get a line from the box's content. */
- getLine(index:number): void;
- /** get a line from the box's content from the visible top. */
- getBaseLine(index:number): void;
- /** set a line in the box's content. */
- setLine(index:number, line:string): void;
- /** set a line in the box's content from the visible top. */
- setBaseLine(index:number, line:string): void;
- /** clear a line from the box's content. */
- clearLine(index:number): void;
- /** clear a line from the box's content from the visible top. */
- clearBaseLine(index:number): void;
- /** insert a line at the top of the box. */
- insertTop(lines:string|string[]): void;
- /** insert a line at the bottom of the box. */
- insertBottom(lines:string|string[]): void;
- /** delete a line at the top of the box. */
- deleteTop(): void;
- /** delete a line at the bottom of the box. */
- deleteBottom(): void;
- /** unshift a line onto the top of the content. */
- unshiftLine(lines:string|string[]): void;
- /** shift a line off the top of the content. */
- shiftLine(index:number): void;
- /** push a line onto the bottom of the content. */
- pushLine(lines:string|string[]): void;
- /** pop a line off the bottom of the content. */
- popLine(index:number): void;
- /** an array containing the content lines. */
- getLines(): void;
- /** an array containing the lines as they are displayed on the screen. */
- getScreenLines(): void;
- /** get a string's real length, taking into account tags. */
- textLength(text:string): number;
-
- /** enable dragging of the element. */
- enableDrag(): void;
- /** disable dragging of the element. */
- disableDrag(): void;
- }
-
-
- //
- // Box
- //
-
- export interface BoxOptions extends ElementOptions {
- // intentionally empty
- }
-
- export class Box extends Element {
- constructor(options?:BoxOptions);
- // intentionally empty
- }
-
-
- //
- // ScrollableBox
- //
-
- export interface ScrollableBoxOptions extends BoxOptions {
- /** a limit to the childBase. default is `Infinity`. */
- baseLimit: number;
- /** a option which causes the ignoring of `childOffset`. this in turn causes the childBase to change every time the element is scrolled. */
- alwaysScroll: boolean;
- /** object enabling a scrollbar. */
- scrollbar: ScrollBar;
- }
-
- /** A box with scrollable content. */
- export class ScrollableBox extends Box {
- constructor(options?:ScrollableBoxOptions);
-
- /** the offset of the top of the scroll content. */
- childBase: number;
- /** the offset of the chosen item/line. */
- childOffset: number;
- /** scroll the content by a relative offset. */
- scroll(offset:number): void;
- /** scroll the content to an absolute index. */
- scrollTo(index:number): void;
- /** same as `scrollTo`. */
- setScroll(index:number): void;
- /** set the current scroll index in percentage (0-100). */
- setScrollPerc(perc:number): void;
- /** get the current scroll index in lines. */
- getScroll(): number;
- /** get the actual height of the scrolling area. */
- getScrollHeight(): number;
- /** get the current scroll index in percentage. */
- getScrollPerc(): number;
- /** reset the scroll index to its initial state. */
- resetScroll(): void;
-
- }
-
- export interface ScrollBar {
- /** style of the scrollbar. */
- style: Style;
- /** style of the scrollbar track if present (takes regular style options). */
- track: Style;
- }
-
-
- //
- // ScrollableText
- //
-
- export interface ScrollableTextOptions extends ScrollableBoxOptions {
- /** whether to enable automatic mouse support for this element. */
- mouse: boolean;
- /** use predefined keys for navigating the text. */
- keys: boolean;
- /** use vi keys with the `keys` option. */
- vi: boolean;
- }
-
- /** __DEPRECATED__ - Use Box with the `scrollable` and `alwaysScroll` options instead. A scrollable text box which can display and scroll text, as well as handle pre-existing newlines and escape codes. */
- export class ScrollableText extends ScrollableBox {
- constructor(options?:ScrollableTextOptions);
- }
-
-
-
- //
- // Text
- //
-
- export interface TextOptions extends ElementOptions {
- align?: string; //'left'|'center'|'right';
- }
-
- export class Text extends Element {
- constructor(options?:TextOptions);
- // intentionally empty
- }
-
-
- //
- // Line
- //
-
- export interface LineOptions extends BoxOptions {
- orientation?: string; //'vertical'|'horizontal';
- style?: Style;
- }
-
- export class Line extends Box {
- constructor(options?:LineOptions);
- // intentionally empty
- }
-
-
- //
- // List
- //
-
- export interface ListStyle extends Style {
- selected?: Style;
- item?: Style;
- }
-
- export interface ListOptions extends BoxOptions
- {
- style?: ListStyle;
-
- /** whether to automatically enable mouse support for this list (allows clicking items). */
- mouse?: boolean;
- /** use predefined keys for navigating the list. */
- keys?: any;
- /** use vi keys with the keys option. */
- vi?: boolean;
- /** an array of strings which become the list's items. */
- items?: string[];
- /** a function that is called when vi mode is enabled and the key / is pressed. This function accepts a callback function which should be called with the search string. The search string is then used to jump to an item that is found in items. */
- search?: (callback:(searchString:string) => void) => void;
- /** whether the list is interactive and can have items selected (default: true). */
- interactive?: boolean;
- }
-
- export class List extends Box
- {
- constructor(options?:ListOptions);
-
- /** The text of the currently selected item. */
- value:string;
- /** The items in the list. */
- items:string[];
- /** The items in the list. */
- ritems:string[];
- /** The index of the current selection. */
- selected:number;
-
- /** add an item based on a string. */
- addItem(text:string): void;
- /** returns the item index from the list. child can be an element, index, or string. */
- getItemIndex(child:Element|number|string): void;
- /** returns the item element. child can be an element, index, or string. */
- getItem(child:Element|number|string): void;
- /** removes an item from the list. child can be an element, index, or string. */
- removeItem(child:Element|number|string): void;
- /** clears all items from the list. */
- clearItems(): void;
- /** sets the list items to multiple strings. */
- setItems(items:string[]): void;
- /** Sets the current selection by absolute index. */
- select(index:number): void;
- /** Changes the current selection based on current offset. */
- move(offset:number): void;
- /** select item above selected. */
- up(amount:number): void;
- /** select item below selected. */
- down(amount:number): void;
- /** show/focus list and pick an item. the callback is executed with the result. */
- pick(cwd:string, callback:(err:any, file:string) => void): void;
-
- /** show/focus list and pick an item. the callback is executed with the result. */
- pick(callback:(err:any, file:string) => void): void;
- }
-
- //
- // Input
- //
-
- export interface InputOptions extends BoxOptions {
- // intentionally empty
- }
-
- export class Input extends Box {
- constructor(options?:InputOptions);
- // intentionally empty
- }
-
- export interface InputOptions extends BoxOptions {
- // intentionally empty
- }
-
- //
- // Textarea
- //
-
- export interface TextareaOptions extends InputOptions
- {
- /** use pre-defined keys (`i` or `enter` for insert, `e` for editor, `C-e` for editor while inserting). */
- keys?: boolean;
- /** use pre-defined mouse events (right-click for editor). */
- mouse?: boolean;
- /** call `readInput()` when the element is focused. automatically unfocus. */
- inputOnFocus?: boolean;
- }
-
- /** A box which allows multiline text input. */
- export class Textarea extends Input
- {
- constructor(options?:TextareaOptions);
-
- /** the input text. __read-only__. */
- value: string;
-
- /** submit the textarea (emits `submit`). */
- submit(): void;
- /** cancel the textarea (emits `cancel`). */
- cancel(): void;
- /** grab key events and start reading text from the keyboard. takes a callback which receives the final value. */
- readInput(callback:GenericCallback): void;
- /** open text editor in `$EDITOR`, read the output from the resulting file. takes a callback which receives the final value. */
- readEditor(callback:GenericCallback): void;
- /** the same as `this.value`, for now. */
- getValue(): string;
- /** clear input. */
- clearValue(): void;
- /** set value. */
- setValue(text:string): void;
- }
-
-
- //
- // Textbox
- //
-
- export interface TextboxOptions extends TextareaOptions {
- /** completely hide text. */
- secret?: boolean;
- /** replace text with asterisks (`*`). */
- censor?: boolean;
- }
-
- /** A box which allows text input. */
- export class Textbox extends Textarea {
- constructor(options?:TextboxOptions);
-
- /** completely hide text. */
- secret: boolean;
- /** replace text with asterisks (`*`). */
- censor: boolean;
- }
-
-
- //
- // Button
- //
-
- export interface ButtonOptions extends InputOptions {
- }
-
- /** A button which can be focused and allows key and mouse input. */
- export class Button extends Input {
- constructor(options?:ButtonOptions);
-
- // on(event:string, callback:() => void): void;
- // on(event:'press', callback:() => void);
-
- /** press button. emits 'press'. */
- press(): void;
- }
-
-
- //
- // ProgressBar
- //
-
- export interface ProgressBarOptions extends InputOptions {
- /** can be `horizontal` or `vertical`. */
- orientation: string;
- /** the character to fill the bar with (default is space). */
- pch: string;
- /** the amount filled (0 - 100). */
- filled: number;
- /** same as `filled`. */
- value: number;
- /** enable key support. */
- keys: boolean;
- /** enable mouse support. */
- mouse: boolean;
-
- /** contains the extra key 'bar', which defines the style of the bar contents itself. */
- style: ProgressBarStyle;
- }
-
- export interface ProgressBarStyle extends Style {
- /** style of the bar contents itself. */
- bar: Style;
- }
-
-
- export class ProgressBar extends Input {
- constructor(options?:ProgressBarOptions);
-
- /** progress the bar by a fill amount. */
- progress(amount:number): void;
- /** set progress to specific amount. */
- setProgress(amount:number): void;
- /** reset the bar. */
- reset(): void;
- }
-
- //
- // Checkbox
- //
-
- export interface CheckboxOptions extends InputOptions {
- /** whether the element is checked or not. */
- checked: boolean;
- /** enable mouse support. */
- mouse: boolean;
- }
-
-
- /** A checkbox which can be used in a form element. */
- export class Checkbox extends Input
- {
- constructor(options?:CheckboxOptions);
-
- /** the text next to the checkbox (do not use setcontent, use `check.text = ''`). */
- text: string;
- /** whether the element is checked or not. */
- checked: boolean;
- /** same as `checked`. */
- value: boolean;
-
- /** check the element. */
- check(): void;
- /** uncheck the element. */
- uncheck(): void;
- /** toggle checked state. */
- toggle(): void;
- }
-
-
- //
- // RadioSet
- //
-
- export interface RadioSetOptions extends BoxOptions {
- }
-
-
- export class RadioSet extends Box {
- constructor(options?:RadioSetOptions);
- }
-
-
- //
- // RadioButton
- //
-
- export interface RadioButtonOptions extends CheckboxOptions {
- }
-
-
- /** A radio button which can be used in a form element. */
- export class RadioButton extends Checkbox {
- constructor(options?:RadioButtonOptions);
- }
-
-
-
- //
- // Prompt
- //
-
- export interface PromptOptions extends BoxOptions {
- }
-
-
- /** A prompt box containing a text input, okay, and cancel buttons (automatically hidden). */
- export class Prompt extends Box
- {
- constructor(options?:PromptOptions);
-
- /** show the prompt and wait for the result of the textbox. set text and initial value */
- input(text:string, value:any, callback:(val:any) => void): void;
- /** show the prompt and wait for the result of the textbox. set text and initial value */
- setInput(text:string, value:any, callback:(val:any) => void): void;
- /** show the prompt and wait for the result of the textbox. set text and initial value */
- readInput(text:string, value:any, callback:(val:any) => void): void;
- }
-
-
- //
- // Question
- //
-
- export interface QuestionOptions extends BoxOptions {
- }
-
-
- /** A question box containing okay and cancel buttons (automatically hidden). */
- export class Question extends Box
- {
- constructor(options?:QuestionOptions);
-
- /** ask a `question`. `callback` will yield the result. */
- ask(question:string, callback:(result:any) => void): void;
- }
-
-
- //
- // Message
- //
-
- export interface MessageOptions extends BoxOptions {
- }
-
-
- /** A box containing a message to be displayed (automatically hidden). */
- export class Message extends Box
- {
- constructor(options?:MessageOptions);
-
- /** display a message for a time (default is 3 seconds). set time to 0 for a perpetual message that is dismissed on keypress. */
- log(text:string, timeOrCallback:number|MessageCallback, callback?:MessageCallback): void;
- /** display a message for a time (default is 3 seconds). set time to 0 for a perpetual message that is dismissed on keypress. */
- display(text:string, timeOrCallback:number|MessageCallback, callback?:MessageCallback): void;
- /** display an error in the same way. */
- error(text:string, timeOrCallback:number|MessageCallback, callback?:MessageCallback): void;
- }
-
- export interface MessageCallback {
- (): void;
- }
-
-
- //
- // Loading
- //
-
- export interface LoadingOptions extends BoxOptions {
- }
-
- /** A box with a spinning line to denote loading (automatically hidden). */
- export class Loading extends Box
- {
- constructor(options?:LoadingOptions);
-
- /** display the loading box with a message. will lock keys until `stop` is called. */
- load(text:string): void;
- /** hide loading box. unlock keys. */
- stop(): void;
- }
-
-
- //
- // Listbar
- //
-
- export interface ListbarOptions extends BoxOptions
- {
- /** Listbar's `style` object includes sub-styles for `selected` and `item`. */
- style?: ListbarStyle;
-
- /** set buttons using an object with keys as titles of buttons, containing of objects containing keys of `keys` and `callback`. */
- items?: ListbarItemSet;
- /** set buttons using an object with keys as titles of buttons, containing of objects containing keys of `keys` and `callback`. */
- commands?: ListbarItemSet;
- /** automatically bind list buttons to keys 0-9. */
- autoCommandKeys?: boolean;
- }
-
- export interface ListbarItemSet {
- [name: string]: ListbarItem;
- }
-
- export interface ListbarItem {
- keys: string[];
- callback: GenericCallback;
- }
-
- export interface ListbarStyle extends Style
- {
- /** style for a selected item. */
- selected: Style;
- /** style for an unselected item. */
- item: Style;
- }
-
- /** A horizontal list. Useful for a main menu bar. */
- export class Listbar extends Box
- {
- constructor(options?:ListbarOptions);
-
- /** append an item to the bar. */
- add(item:ListbarItem, callback:GenericCallback): void;
- /** append an item to the bar. */
- addItem(item:ListbarItem, callback:GenericCallback): void;
- /** append an item to the bar. */
- appendItem(item:ListbarItem, callback:GenericCallback): void;
-
- /** select button and execute its callback. */
- selectTab(index: number): void;
-
- /** set commands (see `commands` option above). */
- setItems(commands: ListbarItemSet): void;
- /** select an item on the bar. */
- select(offset: number): void;
- /** remove item from the bar. */
- removeItem(child:ListbarItem): void;
- /** move focus relatively across the bar. */
- move(offset: number): void;
- /** move focus left relatively across the bar. */
- moveLeft(offset: number): void;
- /** move focus right relatively across the bar. */
- moveRight(offset: number): void;
- }
-
-
- //
- // Log
- //
-
- export interface LogOptions extends ScrollableTextOptions {
- /** amount of scrollback allowed. default: Infinity. */
- scrollback?: number;
- /** scroll to bottom on input even if the user has scrolled up. default: false. */
- scrollOnInput?: boolean;
- }
-
-
- /** A log permanently scrolled to the bottom. */
- export class Log extends ScrollableText
- {
- constructor(options?:LogOptions);
-
- /** amount of scrollback allowed. default: Infinity. */
- scrollback: number;
- /** scroll to bottom on input even if the user has scrolled up. default: false. */
- scrollOnInput: boolean;
-
- /** add a log line. */
- log(text:string): void;
- /** add a log line. */
- add(text:string): void;
- }
-
-
- //
- // Table
- //
-
- export interface TableOptions extends BoxOptions
- {
- /** array of array of strings representing rows (same as `data`). */
- rows?: string[][];
- /** array of array of strings representing rows (same as `rows`). */
- data?: string[][];
- /** spaces to attempt to pad on the sides of each cell. `2` by default: one space on each side (only useful if the width is shrunken). */
- pad?: number;
- /** do not draw inner cells. */
- noCellBorders?: boolean;
- /** fill cell borders with the adjacent background color. */
- fillCellBorders?: boolean;
-
- /** includes `header` and `cell` substyles. */
- style?: TableStyle;
- }
-
- export interface TableStyle extends Style {
- /** header style. */
- header: Style;
- /** cell style. */
- cell: Style;
- }
-
- /** A stylized table of text elements. */
- export class Table extends Box
- {
- /** includes `header` and `cell` substyles. */
- style: TableStyle;
-
- /** set rows in table. array of arrays of strings. */
- setData(rows: string[][]): void;
- /** set rows in table. array of arrays of strings. */
- setRows(rows: string[][]): void;
- }
-
-
- //
- // ListTable
- //
-
- export interface ListTableOptions extends ListOptions
- {
- /** array of array of strings representing rows (same as `data`). */
- rows?: string[][];
- /** array of array of strings representing rows (same as `rows`). */
- data?: string[][];
- /** spaces to attempt to pad on the sides of each cell. `2` by default: one space on each side (only useful if the width is shrunken). */
- pad?: number;
-
- /** do not draw inner cells. */
- noCellBorders?: boolean;
-
- /** includes `header` and `cell` substyles. */
- style?: TableStyle;
- }
-
- export interface ListTableStyle extends TableStyle {
- }
-
-
- /** A stylized table of text elements with a list. */
- export class ListTable extends List
- {
- constructor(options?:ListTableOptions);
-
- /** set rows in table. array of arrays of strings. */
- setData(rows: string[][]): void;
- /** set rows in table. array of arrays of strings. */
- setRows(rows: string[][]): void;
- }
-
- //
- // Image
- //
-
- export interface ImageOptions extends BoxOptions {
- /** path to image. */
- file: string;
- /** path to w3mimgdisplay. if a proper w3mimgdisplay path is not given, blessed will search the entire disk for the binary. */
- w3m: string;
- }
-
-
- /** Display an image in the terminal (jpeg, png, gif) using w3mimgdisplay. Requires w3m to be installed. X11 required: works in xterm, urxvt, and possibly other terminals. */
- export class Image extends Box
- {
- constructor(options?:ImageOptions);
-
- /** set the image in the box to a new path. */
- setImage (img:string, callback:GenericCallback): void;
- /** clear the current image. */
- clearImage (callback:GenericCallback): void;
- /** get the size of an image file in pixels. */
- imageSize (img:string, callback:GenericCallback): void;
- /** get the size of the terminal in pixels. */
- termSize (callback:GenericCallback): void;
- /** get the pixel to cell ratio for the terminal. */
- getPixelRatio (callback:GenericCallback): void;
- }
-
-
- //
- // Form
- //
-
- export interface FormOptions extends BoxOptions {
- /** allow default keys (tab, vi keys, enter). */
- keys?:boolean;
- /** allow vi keys. */
- vi?:boolean;
- }
-
- export class Form extends Box
- {
- constructor(options?:FormOptions);
-
- /** last submitted data. */
- submission: any;
-
- // on(event:string, callback:() => void): void;
- // on(event:'submit', callback:(data) => void): void;
- // on(event:'cancel', callback:() => void): void;
- // on(event:'reset', callback:() => void): void;
-
- next(): void;
- previous(): void;
-
- resetSelected(): void;
- /** focus first form element. */
- focusFirst(): void;
- /** focus last form element. */
- focusLast(): void;
- /** focus next form element. */
- focusNext(): void;
- /** focus previous form element. */
- focusPrevious(): void;
- /** submit the form. */
- submit(): void;
- /** discard the form. */
- cancel(): void;
- /** clear the form. */
- reset(): void;
- }
-
-
- //
- // FileManager
- //
-
- export interface FileManagerOptions extends ListOptions {
- cwd?: string;
- }
-
- export interface DirectoryEntry {
- name: string;
- text: string;
- dir: boolean;
- symlink: boolean;
- }
-
- export class FileManager extends List
- {
- constructor(options?:FileManagerOptions);
-
- cwd: string;
-
- useFormatter (formatterFn:(entry:DirectoryEntry) => DirectoryEntry): void;
-
- /** refresh the file list (perform a readdir on cwd and update the list items). */
- refresh (cwd?:string, callback?:() => void): void;
-
- /** refresh the file list. */
- refresh (callback?:() => void): void;
-
- /** reset back to original cwd. */
- reset (cwd?:string, callback?:() => void): void;
- }
-
-
- //
- // Terminal
- //
-
- export interface TerminalOptions extends BoxOptions
- {
- /** handler for input data. */
- handler?: (userInput:Buffer) => void;
- /** name of shell. $SHELL by default. */
- shell?:string;
- /** args for shell. */
- args?:any;
- /** can be line, underline, and block. */
- cursor?:string; //'line'|'underline'|'block';
- }
-
- export class Terminal extends Box
- {
- /** reference to the headless term.js terminal. */
- term: any;
- /** reference to the pty.js pseudo terminal. */
- pty: any;
-
- /** write data to the terminal. */
- write(data:string): void;
-
- /** nearly identical to `element.screenshot`, however, the specified region includes the terminal's _entire_ scrollback, rather than just what is visible on the screen. */
- screenshot(xi?:number, xl?:number, yi?:number, yl?:number): string;
- }
-
-
- export interface NodeChildProcessExecOptions
- {
- cwd?: string;
- stdio?: any;
- customFds?: any;
- env?: any;
- encoding?: string;
- timeout?: number;
- maxBuffer?: number;
- killSignal?: string;
- }
- }
-
- export = Blessed;
-}
-
-
-
diff --git a/blessed/index.d.ts b/blessed/index.d.ts
new file mode 100644
index 0000000000..3eaf18eb4c
--- /dev/null
+++ b/blessed/index.d.ts
@@ -0,0 +1,1232 @@
+// Type definitions for blessed 0.1.5
+// Project: https://github.com/chjj/blessed
+// Definitions by: bryn austin bellomy
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+import events = require('events');
+import buffer = require('buffer');
+import child_process = require('child_process');
+
+declare namespace Blessed {
+ export var colors: Colors;
+
+ export interface GenericCallback {
+ (...args: any[]): void;
+ }
+
+ export interface ColorPair {
+ /** background, must be number (-1 for default). */
+ bg?: number;
+ /** foreground, must be number (-1 for default). */
+ fg?: number;
+ }
+
+ export interface Style extends ColorPair {
+ bold?: boolean;
+ underline?: boolean;
+ border: Border;
+ hover: ColorPair;
+ }
+
+ export interface Border extends ColorPair {
+ /** type of border ('line' or 'bg'). */
+ type?: string; //'line'|'bg';
+ /** character to use if bg type, default is space. */
+ ch?: string;
+ }
+
+ export interface Padding {
+ top?: number;
+ right?: number;
+ bottom?: number;
+ left?: number;
+ }
+
+ export interface Position {
+ /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
+ top?: number | string;
+ /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
+ right?: number | string;
+ /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
+ bottom?: number | string;
+ /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */
+ left?: number | string;
+ /** width of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
+ width?: number | string;
+ /** height of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
+ height?: number | string;
+ }
+
+ export interface KeyCode {
+ name: string;
+ ctrl: boolean;
+ meta: boolean;
+ shift: boolean;
+ sequence: string;
+ full: string;
+ }
+
+ export class Program {
+ /**
+ Wrap the given text in terminal formatting codes corresponding to the given attribute
+ name. The `attr` string can be of the form `red fg` or `52 bg` where `52` is a 0-255
+ integer color number.
+ */
+ text(text: string, attr: string): string;
+ }
+
+ export interface Colors {
+ /** Either pass a hex string, an array of 3 numbers, or three separate numbers representing an RGB value. This returns the 0-255 color number for that color. */
+ match(r: string | number[] | number, g?: number, b?: number): number;
+
+ /** An array of the 255 colors as hex strings. */
+ colors: string[];
+ }
+
+ export interface NodeOptions {
+ screen?: Screen;
+ parent?: Node;
+ children?: Node[];
+ }
+
+ export class Node extends events.EventEmitter {
+ constructor(options?: NodeOptions);
+
+ type: string;
+ options: NodeOptions;
+ parent: Node;
+ screen: Screen;
+ children: Node[];
+ data: any;
+ _: any;
+ $: any;
+ index: number;
+
+ // on(event:string, callback:() => void);
+ // on(event:'adopt', callback:() => void);
+ // on(event:'remove', callback:() => void);
+ // on(event:'reparent', callback:() => void);
+ // on(event:'attach', callback:() => void);
+ // on(event:'detach', callback:() => void);
+
+ prepend(node: Node): void;
+ append(node: Node): void;
+ remove(node: Node): void;
+ insert(node: Node, index: number): void;
+ insertBefore(node: Node, refNode: Node): void;
+ insertAfter(node: Node, refNode: Node): void;
+ detach(): void;
+ // emitDescendants(): void;
+ // get(key:string): any;
+ // get(key:string, default:any): any;
+ // set(key:string, value:any): void;
+ }
+
+ export interface ScreenOptions extends NodeOptions {
+ /** the blessed Program to be associated with. will be automatically instantiated if none is provided. */
+ program?: any;
+ /** attempt to perform CSR optimization on all possible elements (not just full-width ones, elements with uniform cells to their sides). this is known to cause flickering with elements that are not full-width, however, it is more optimal for terminal rendering. */
+ smartCSR?: boolean;
+ /** do CSR on any element within 20 cols of the screen edge on either side. faster than smartCSR, but may cause flickering depending on what is on each side of the element. */
+ fastCSR?: boolean;
+ /** attempt to perform back_color_erase optimizations for terminals that support it. it will also work with terminals that don't support it, but only on lines with the default background color. as it stands with the current implementation, it's uncertain how much terminal performance this adds at the cost of overhead within node. */
+ useBCE?: boolean;
+ /** amount of time (in ms) to redraw the screen after the terminal is resized (default: 300). */
+ resizeTimeout?: number;
+ /** the width of tabs within an element's content. */
+ tabSize?: number;
+ /** automatically position child elements with border and padding in mind. */
+ autoPadding?: boolean;
+ /** the name of the logfile to use. if specified but the file does not exist, it will be created. see log method. */
+ log?: string;
+ /** dump all output and input to desired file. can be used together with log option if set as a boolean. */
+ dump?: any;
+ /** debug mode. enables usage of the `debug` method. also creates a debug console which will display when pressing F12. it will display all log and debug messages. */
+ debug?: boolean;
+ /** Array of keys in their full format (e.g. C-c) to ignore when keys are locked. Useful for creating a key that will always exit no matter whether the keys are locked. */
+ ignoreLocked?: string[];
+
+ /** Do not clear the screen, only scroll down enough to make room for the elements on the screen. do not use the alternate screenbuffer. useful for writing a CLI tool or some kind of prompt (experimental - see test/widget-noalt.js) */
+ noAlt?: boolean;
+
+ /** Options for the cursor. */
+ cursor?: CursorOptions;
+ }
+
+ export interface CursorOptions {
+ /** have blessed draw a custom cursor and hide the terminal cursor (experimental). */
+ artificial?: boolean;
+ /** shape of the artificial cursor. can be: block, underline, or line. */
+ shape?: string; //'block'|'underline'|'line';
+ /** whether the artificial cursor blinks. */
+ blink?: boolean;
+ /** color of the artificial cursor. accepts any valid color value (null is default). */
+ color?: string;
+ }
+
+ export interface ScreenEventCallback {
+ (character: string, keyCode: KeyCode): void;
+ }
+
+ export class Screen extends Node {
+ constructor(options?: ScreenOptions);
+
+ /** the blessed Program object. */
+ program: any;
+ /** the blessed Tput object (only available if you passed tput: true to the Program constructor.) */
+ tput: any;
+ /** top of the focus history stack. */
+ focused: any;
+ /** width of the screen (same as program.cols). */
+ width: number;
+ /** height of the screen (same as program.rows). */
+ height: number;
+ /** same as screen.width. */
+ cols: number;
+ /** same as screen.height. */
+ rows: number;
+
+ /** calculated relative left offset. */
+ left: number;
+ /** calculated relative right offset. */
+ right: number;
+ /** calculated relative top offset. */
+ top: number;
+ /** calculated relative bottom offset. */
+ bottom: number;
+ /** calculated absolute left offset. */
+ aleft: number;
+ /** calculated absolute right offset. */
+ aright: number;
+ /** calculated absolute top offset. */
+ atop: number;
+ /** calculated absolute bottom offset. */
+ abottom: number;
+
+
+ /** whether the focused element grabs all keypresses. */
+ grabKeys: boolean;
+ /** prevent keypresses from being received by any element. */
+ lockKeys: boolean;
+ /** the currently hovered element. only set if mouse events are bound. */
+ hover: Element;
+ /** set or get window title. */
+ title: string;
+
+ /** write string to the log file if one was created. */
+ log(...msg: any[]): void;
+ /** same as the log method, but only gets called if the debug option was set. */
+ debug(...msg: string[]): void;
+ /** allocate a new pending screen buffer and a new output screen buffer. */
+ alloc(): void;
+ /** draw the screen based on the contents of the screen buffer. */
+ draw(start: number, end: number): void;
+ /** render all child elements, writing all data to the screen buffer and drawing the screen. */
+ render(): void;
+ /** clear any region on the screen. */
+ clearRegion(x1: number, x2: number, y1: number, y2: number): void;
+ /** fill any region with a character of a certain attribute. */
+ fillRegion(attr: number, ch: string, x1: number, x2: number, y1: number, y2: number): void;
+ /** focus element by offset of focusable elements. */
+ focusOffset(offset: number): void;
+ /** focus previous element in the index. */
+ focusPrevious(): void;
+ /** focus next element in the index. */
+ focusNext(): void;
+ /** push element on the focus stack (equivalent to screen.focused = el). */
+ focusPush(element: Element): void;
+ /** pop element off the focus stack. */
+ focusPop(): void;
+ /** save the focused element. */
+ saveFocus(): void;
+ /** restore the saved focused element. */
+ restoreFocus(): void;
+ /** "rewind" focus to the last visible and attached element. */
+ rewindFocus(): void;
+ /** bind a keypress listener for a specific key. */
+ key(keyEvents: string | string[], callback: ScreenEventCallback): void;
+ /** bind a keypress listener for a specific key once. */
+ onceKey(keyEvents: string | string[], callback: ScreenEventCallback): void;
+ /** remove a keypress listener for a specific key. */
+ unkey(name: string, listener: ScreenEventCallback): void;
+ /** spawn a process in the foreground, return to blessed app after exit. */
+ spawn(file: string, args: string[], options: NodeChildProcessExecOptions): child_process.ChildProcess;
+ /** spawn a process in the foreground, return to blessed app after exit. executes callback on error or exit. */
+ exec(file: string, args: string[], options: NodeChildProcessExecOptions, callback: GenericCallback): child_process.ChildProcess;
+ /** read data from text editor. */
+ readEditor(options: {}, callback: GenericCallback): void;
+ /** set effects based on two events and attributes. */
+ setEffects(el: Element, fel: Element, over: string, out: string, effects: Style, temp?: string): void;
+ /** insert a line into the screen (using csr: this bypasses the output buffer). */
+ insertLine(n: number, y: number, top: number, bottom: number): void;
+ /** delete a line from the screen (using csr: this bypasses the output buffer). */
+ deleteLine(n: number, y: number, top: number, bottom: number): void;
+ /** insert a line at the bottom of the screen. */
+ insertBottom(top: number, bottom: number): void;
+ /** insert a line at the top of the screen. */
+ insertTop(top: number, bottom: number): void;
+ /** delete a line at the bottom of the screen. */
+ deleteBottom(top: number, bottom: number): void;
+ /** delete a line at the top of the screen. */
+ deleteTop(top: number, bottom: number): void;
+
+ /** enable mouse events for the screen and optionally an element (automatically called when a form of on('mouse') is bound). */
+ enableMouse(el?: Element): void;
+ /** enable keypress events for the screen and optionally an element (automatically called when a form of on('keypress') is bound). */
+ enableKeys(el?: Element): void;
+ /** enable key and mouse events. calls bot enableMouse and enableKeys. */
+ enableInput(el?: Element): void;
+
+ /** attempt to copy text to clipboard using iTerm2's propriety sequence. returns true if successful. */
+ copyToClipboard(text: string): boolean;
+ /** attempt to change cursor shape. will not work in all terminals (see artificial cursors for a solution to this). returns true if successful. */
+ cursorShape(shape: string, blink: boolean): boolean;
+ /** attempt to change cursor color. returns true if successful. */
+ cursorColor(color: string): boolean;
+ /** attempt to reset cursor. returns true if successful. */
+ cursorReset(): boolean;
+
+ }
+
+ export interface ElementOptions extends NodeOptions {
+ fg?: string;
+ bg?: string;
+ scrollbar?: ColorPair;
+ focus?: Style;
+ hover?: Style;
+
+ /** border object, see below. */
+ border?: Border;
+ /** positioning options. */
+ position?: Position;
+ /** amount of padding on the inside of the element. can be a number or an object containing the properties: left, right, top, and bottom. */
+ padding?: number | Padding;
+ /** element's text content. */
+ content?: string;
+ /** element is clickable. */
+ clickable?: boolean;
+ /** element is focusable and can receive key input. */
+ input?: boolean;
+ /** element is focused. */
+ focused?: boolean;
+ /** whether the element is hidden. */
+ hidden?: boolean;
+ /** a simple text label for the element. */
+ label?: string;
+ /** a floating text label for the element which appears on mouseover. */
+ hoverText?: string;
+ /** text alignment: left, center, or right. */
+ align?: string;
+ /** vertical text alignment: top, middle, or bottom. */
+ valign?: string;
+ /** shrink/flex/grow to content and child elements. width/height during render. */
+ shrink?: any;
+ /** width of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
+ width?: number | string;
+ /** height of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */
+ height?: number | string;
+ /** whether the element is scrollable or not. */
+ scrollable?: boolean;
+ /** background character (default is whitespace ). */
+ ch?: string;
+ /** allow the element to be dragged with the mouse. */
+ draggable?: boolean;
+ }
+
+ export class Element extends Node {
+ constructor(options?: ElementOptions);
+
+ /** name of the element. useful for form submission. */
+ name: string;
+ /** border object. */
+ border: Border;
+ /** contains attributes (e.g. fg/bg/underline). see above. */
+ style: Style;
+ /** raw width, height, and offsets. */
+ position: Position;
+ /** type of border (line or bg). bg by default. */
+ type: string; //'line'|'bg';
+ /** character to use if bg type, default is space. */
+ ch: string;
+ /** raw text content. */
+ content: string;
+ /** whether the element is hidden or not. */
+ hidden: boolean;
+ /** whether the element is visible or not. */
+ visible: boolean;
+ /** whether the element is attached to a screen in its ancestry somewhere. */
+ detached: boolean;
+ /** calculated width. */
+ width: number;
+ /** calculated height. */
+ height: number;
+ /** whether the element is draggable. set to true to allow dragging. */
+ draggable: boolean;
+
+
+
+ /** calculated relative left offset. */
+ left: number;
+ /** calculated relative right offset. */
+ right: number;
+ /** calculated relative top offset. */
+ top: number;
+ /** calculated relative bottom offset. */
+ bottom: number;
+ /** calculated absolute left offset. */
+ aleft: number;
+ /** calculated absolute right offset. */
+ aright: number;
+ /** calculated absolute top offset. */
+ atop: number;
+ /** calculated absolute bottom offset. */
+ abottom: number;
+
+
+ /** write content and children to the screen buffer. */
+ render(): void;
+ /** hide element. */
+ hide(): void;
+ /** show element. */
+ show(): void;
+ /** toggle hidden/shown. */
+ toggle(): void;
+ /** focus element. */
+ focus(): void;
+ /** bind a keypress listener for a specific key. */
+ key(name: string | string[], listener: (character?: any, keyCode?: any) => void): void;
+ /** bind a keypress listener for a specific key once. */
+ onceKey(name: string, listener: () => void): void;
+ /** remove a keypress listener for a specific key. */
+ unkey(name: string, listener: () => void): void;
+ /** same as el.on('screen', ...) except this will automatically cleanup listeners after the element is detached. */
+ onScreenEvent(event: string, listener: (...args: any[]) => void): void;
+ /** set the z-index of the element (changes rendering order). */
+ setIndex(z: number): void;
+ /** put the element in front of its siblings. */
+ setFront(): void;
+ /** put the element in back of its siblings. */
+ setBack(): void;
+ /** set the label text for the top-left corner. example options: {text:'foo',side:'left'} */
+ setLabel(textOrOptions: string | {}): void;
+ /** remove the label completely. */
+ removeLabel(): void;
+ /** set the hover text for the bottom-right corner. example options: {text:'foo'} */
+ setHover(textOrOptions: string | {}): void;
+ /** remove the hover label completely. */
+ removeHover(): void;
+ /** set the content. note: when text is input, it will be stripped of all non-SGR escape codes, tabs will be replaced with 8 spaces, and tags will be replaced with SGR codes (if enabled). */
+ setContent(text: string): void;
+ /** return content, slightly different from el.content. assume the above formatting. */
+ getContent(): void;
+ /** similar to setContent, but ignore tags and remove escape codes. */
+ setText(text: string): void;
+ /** similar to getContent, but return content with tags and escape codes removed. */
+ getText(): void;
+ /** insert a line into the box's content. */
+ insertLine(index: number, lines: string | string[]): void;
+ /** delete a line from the box's content. */
+ deleteLine(index: number, numLines: number): void;
+ /** get a line from the box's content. */
+ getLine(index: number): void;
+ /** get a line from the box's content from the visible top. */
+ getBaseLine(index: number): void;
+ /** set a line in the box's content. */
+ setLine(index: number, line: string): void;
+ /** set a line in the box's content from the visible top. */
+ setBaseLine(index: number, line: string): void;
+ /** clear a line from the box's content. */
+ clearLine(index: number): void;
+ /** clear a line from the box's content from the visible top. */
+ clearBaseLine(index: number): void;
+ /** insert a line at the top of the box. */
+ insertTop(lines: string | string[]): void;
+ /** insert a line at the bottom of the box. */
+ insertBottom(lines: string | string[]): void;
+ /** delete a line at the top of the box. */
+ deleteTop(): void;
+ /** delete a line at the bottom of the box. */
+ deleteBottom(): void;
+ /** unshift a line onto the top of the content. */
+ unshiftLine(lines: string | string[]): void;
+ /** shift a line off the top of the content. */
+ shiftLine(index: number): void;
+ /** push a line onto the bottom of the content. */
+ pushLine(lines: string | string[]): void;
+ /** pop a line off the bottom of the content. */
+ popLine(index: number): void;
+ /** an array containing the content lines. */
+ getLines(): void;
+ /** an array containing the lines as they are displayed on the screen. */
+ getScreenLines(): void;
+ /** get a string's real length, taking into account tags. */
+ textLength(text: string): number;
+
+ /** enable dragging of the element. */
+ enableDrag(): void;
+ /** disable dragging of the element. */
+ disableDrag(): void;
+ }
+
+
+ //
+ // Box
+ //
+
+ export interface BoxOptions extends ElementOptions {
+ // intentionally empty
+ }
+
+ export class Box extends Element {
+ constructor(options?: BoxOptions);
+ // intentionally empty
+ }
+
+
+ //
+ // ScrollableBox
+ //
+
+ export interface ScrollableBoxOptions extends BoxOptions {
+ /** a limit to the childBase. default is `Infinity`. */
+ baseLimit: number;
+ /** a option which causes the ignoring of `childOffset`. this in turn causes the childBase to change every time the element is scrolled. */
+ alwaysScroll: boolean;
+ /** object enabling a scrollbar. */
+ scrollbar: ScrollBar;
+ }
+
+ /** A box with scrollable content. */
+ export class ScrollableBox extends Box {
+ constructor(options?: ScrollableBoxOptions);
+
+ /** the offset of the top of the scroll content. */
+ childBase: number;
+ /** the offset of the chosen item/line. */
+ childOffset: number;
+ /** scroll the content by a relative offset. */
+ scroll(offset: number): void;
+ /** scroll the content to an absolute index. */
+ scrollTo(index: number): void;
+ /** same as `scrollTo`. */
+ setScroll(index: number): void;
+ /** set the current scroll index in percentage (0-100). */
+ setScrollPerc(perc: number): void;
+ /** get the current scroll index in lines. */
+ getScroll(): number;
+ /** get the actual height of the scrolling area. */
+ getScrollHeight(): number;
+ /** get the current scroll index in percentage. */
+ getScrollPerc(): number;
+ /** reset the scroll index to its initial state. */
+ resetScroll(): void;
+
+ }
+
+ export interface ScrollBar {
+ /** style of the scrollbar. */
+ style: Style;
+ /** style of the scrollbar track if present (takes regular style options). */
+ track: Style;
+ }
+
+
+ //
+ // ScrollableText
+ //
+
+ export interface ScrollableTextOptions extends ScrollableBoxOptions {
+ /** whether to enable automatic mouse support for this element. */
+ mouse: boolean;
+ /** use predefined keys for navigating the text. */
+ keys: boolean;
+ /** use vi keys with the `keys` option. */
+ vi: boolean;
+ }
+
+ /** __DEPRECATED__ - Use Box with the `scrollable` and `alwaysScroll` options instead. A scrollable text box which can display and scroll text, as well as handle pre-existing newlines and escape codes. */
+ export class ScrollableText extends ScrollableBox {
+ constructor(options?: ScrollableTextOptions);
+ }
+
+
+
+ //
+ // Text
+ //
+
+ export interface TextOptions extends ElementOptions {
+ align?: string; //'left'|'center'|'right';
+ }
+
+ export class Text extends Element {
+ constructor(options?: TextOptions);
+ // intentionally empty
+ }
+
+
+ //
+ // Line
+ //
+
+ export interface LineOptions extends BoxOptions {
+ orientation?: string; //'vertical'|'horizontal';
+ style?: Style;
+ }
+
+ export class Line extends Box {
+ constructor(options?: LineOptions);
+ // intentionally empty
+ }
+
+
+ //
+ // List
+ //
+
+ export interface ListStyle extends Style {
+ selected?: Style;
+ item?: Style;
+ }
+
+ export interface ListOptions extends BoxOptions {
+ style?: ListStyle;
+
+ /** whether to automatically enable mouse support for this list (allows clicking items). */
+ mouse?: boolean;
+ /** use predefined keys for navigating the list. */
+ keys?: any;
+ /** use vi keys with the keys option. */
+ vi?: boolean;
+ /** an array of strings which become the list's items. */
+ items?: string[];
+ /** a function that is called when vi mode is enabled and the key / is pressed. This function accepts a callback function which should be called with the search string. The search string is then used to jump to an item that is found in items. */
+ search?: (callback: (searchString: string) => void) => void;
+ /** whether the list is interactive and can have items selected (default: true). */
+ interactive?: boolean;
+ }
+
+ export class List extends Box {
+ constructor(options?: ListOptions);
+
+ /** The text of the currently selected item. */
+ value: string;
+ /** The items in the list. */
+ items: string[];
+ /** The items in the list. */
+ ritems: string[];
+ /** The index of the current selection. */
+ selected: number;
+
+ /** add an item based on a string. */
+ addItem(text: string): void;
+ /** returns the item index from the list. child can be an element, index, or string. */
+ getItemIndex(child: Element | number | string): void;
+ /** returns the item element. child can be an element, index, or string. */
+ getItem(child: Element | number | string): void;
+ /** removes an item from the list. child can be an element, index, or string. */
+ removeItem(child: Element | number | string): void;
+ /** clears all items from the list. */
+ clearItems(): void;
+ /** sets the list items to multiple strings. */
+ setItems(items: string[]): void;
+ /** Sets the current selection by absolute index. */
+ select(index: number): void;
+ /** Changes the current selection based on current offset. */
+ move(offset: number): void;
+ /** select item above selected. */
+ up(amount: number): void;
+ /** select item below selected. */
+ down(amount: number): void;
+ /** show/focus list and pick an item. the callback is executed with the result. */
+ pick(cwd: string, callback: (err: any, file: string) => void): void;
+
+ /** show/focus list and pick an item. the callback is executed with the result. */
+ pick(callback: (err: any, file: string) => void): void;
+ }
+
+ //
+ // Input
+ //
+
+ export interface InputOptions extends BoxOptions {
+ // intentionally empty
+ }
+
+ export class Input extends Box {
+ constructor(options?: InputOptions);
+ // intentionally empty
+ }
+
+ export interface InputOptions extends BoxOptions {
+ // intentionally empty
+ }
+
+ //
+ // Textarea
+ //
+
+ export interface TextareaOptions extends InputOptions {
+ /** use pre-defined keys (`i` or `enter` for insert, `e` for editor, `C-e` for editor while inserting). */
+ keys?: boolean;
+ /** use pre-defined mouse events (right-click for editor). */
+ mouse?: boolean;
+ /** call `readInput()` when the element is focused. automatically unfocus. */
+ inputOnFocus?: boolean;
+ }
+
+ /** A box which allows multiline text input. */
+ export class Textarea extends Input {
+ constructor(options?: TextareaOptions);
+
+ /** the input text. __read-only__. */
+ value: string;
+
+ /** submit the textarea (emits `submit`). */
+ submit(): void;
+ /** cancel the textarea (emits `cancel`). */
+ cancel(): void;
+ /** grab key events and start reading text from the keyboard. takes a callback which receives the final value. */
+ readInput(callback: GenericCallback): void;
+ /** open text editor in `$EDITOR`, read the output from the resulting file. takes a callback which receives the final value. */
+ readEditor(callback: GenericCallback): void;
+ /** the same as `this.value`, for now. */
+ getValue(): string;
+ /** clear input. */
+ clearValue(): void;
+ /** set value. */
+ setValue(text: string): void;
+ }
+
+
+ //
+ // Textbox
+ //
+
+ export interface TextboxOptions extends TextareaOptions {
+ /** completely hide text. */
+ secret?: boolean;
+ /** replace text with asterisks (`*`). */
+ censor?: boolean;
+ }
+
+ /** A box which allows text input. */
+ export class Textbox extends Textarea {
+ constructor(options?: TextboxOptions);
+
+ /** completely hide text. */
+ secret: boolean;
+ /** replace text with asterisks (`*`). */
+ censor: boolean;
+ }
+
+
+ //
+ // Button
+ //
+
+ export interface ButtonOptions extends InputOptions {
+ }
+
+ /** A button which can be focused and allows key and mouse input. */
+ export class Button extends Input {
+ constructor(options?: ButtonOptions);
+
+ // on(event:string, callback:() => void): void;
+ // on(event:'press', callback:() => void);
+
+ /** press button. emits 'press'. */
+ press(): void;
+ }
+
+
+ //
+ // ProgressBar
+ //
+
+ export interface ProgressBarOptions extends InputOptions {
+ /** can be `horizontal` or `vertical`. */
+ orientation: string;
+ /** the character to fill the bar with (default is space). */
+ pch: string;
+ /** the amount filled (0 - 100). */
+ filled: number;
+ /** same as `filled`. */
+ value: number;
+ /** enable key support. */
+ keys: boolean;
+ /** enable mouse support. */
+ mouse: boolean;
+
+ /** contains the extra key 'bar', which defines the style of the bar contents itself. */
+ style: ProgressBarStyle;
+ }
+
+ export interface ProgressBarStyle extends Style {
+ /** style of the bar contents itself. */
+ bar: Style;
+ }
+
+
+ export class ProgressBar extends Input {
+ constructor(options?: ProgressBarOptions);
+
+ /** progress the bar by a fill amount. */
+ progress(amount: number): void;
+ /** set progress to specific amount. */
+ setProgress(amount: number): void;
+ /** reset the bar. */
+ reset(): void;
+ }
+
+ //
+ // Checkbox
+ //
+
+ export interface CheckboxOptions extends InputOptions {
+ /** whether the element is checked or not. */
+ checked: boolean;
+ /** enable mouse support. */
+ mouse: boolean;
+ }
+
+
+ /** A checkbox which can be used in a form element. */
+ export class Checkbox extends Input {
+ constructor(options?: CheckboxOptions);
+
+ /** the text next to the checkbox (do not use setcontent, use `check.text = ''`). */
+ text: string;
+ /** whether the element is checked or not. */
+ checked: boolean;
+ /** same as `checked`. */
+ value: boolean;
+
+ /** check the element. */
+ check(): void;
+ /** uncheck the element. */
+ uncheck(): void;
+ /** toggle checked state. */
+ toggle(): void;
+ }
+
+
+ //
+ // RadioSet
+ //
+
+ export interface RadioSetOptions extends BoxOptions {
+ }
+
+
+ export class RadioSet extends Box {
+ constructor(options?: RadioSetOptions);
+ }
+
+
+ //
+ // RadioButton
+ //
+
+ export interface RadioButtonOptions extends CheckboxOptions {
+ }
+
+
+ /** A radio button which can be used in a form element. */
+ export class RadioButton extends Checkbox {
+ constructor(options?: RadioButtonOptions);
+ }
+
+
+
+ //
+ // Prompt
+ //
+
+ export interface PromptOptions extends BoxOptions {
+ }
+
+
+ /** A prompt box containing a text input, okay, and cancel buttons (automatically hidden). */
+ export class Prompt extends Box {
+ constructor(options?: PromptOptions);
+
+ /** show the prompt and wait for the result of the textbox. set text and initial value */
+ input(text: string, value: any, callback: (val: any) => void): void;
+ /** show the prompt and wait for the result of the textbox. set text and initial value */
+ setInput(text: string, value: any, callback: (val: any) => void): void;
+ /** show the prompt and wait for the result of the textbox. set text and initial value */
+ readInput(text: string, value: any, callback: (val: any) => void): void;
+ }
+
+
+ //
+ // Question
+ //
+
+ export interface QuestionOptions extends BoxOptions {
+ }
+
+
+ /** A question box containing okay and cancel buttons (automatically hidden). */
+ export class Question extends Box {
+ constructor(options?: QuestionOptions);
+
+ /** ask a `question`. `callback` will yield the result. */
+ ask(question: string, callback: (result: any) => void): void;
+ }
+
+
+ //
+ // Message
+ //
+
+ export interface MessageOptions extends BoxOptions {
+ }
+
+
+ /** A box containing a message to be displayed (automatically hidden). */
+ export class Message extends Box {
+ constructor(options?: MessageOptions);
+
+ /** display a message for a time (default is 3 seconds). set time to 0 for a perpetual message that is dismissed on keypress. */
+ log(text: string, timeOrCallback: number | MessageCallback, callback?: MessageCallback): void;
+ /** display a message for a time (default is 3 seconds). set time to 0 for a perpetual message that is dismissed on keypress. */
+ display(text: string, timeOrCallback: number | MessageCallback, callback?: MessageCallback): void;
+ /** display an error in the same way. */
+ error(text: string, timeOrCallback: number | MessageCallback, callback?: MessageCallback): void;
+ }
+
+ export interface MessageCallback {
+ (): void;
+ }
+
+
+ //
+ // Loading
+ //
+
+ export interface LoadingOptions extends BoxOptions {
+ }
+
+ /** A box with a spinning line to denote loading (automatically hidden). */
+ export class Loading extends Box {
+ constructor(options?: LoadingOptions);
+
+ /** display the loading box with a message. will lock keys until `stop` is called. */
+ load(text: string): void;
+ /** hide loading box. unlock keys. */
+ stop(): void;
+ }
+
+
+ //
+ // Listbar
+ //
+
+ export interface ListbarOptions extends BoxOptions {
+ /** Listbar's `style` object includes sub-styles for `selected` and `item`. */
+ style?: ListbarStyle;
+
+ /** set buttons using an object with keys as titles of buttons, containing of objects containing keys of `keys` and `callback`. */
+ items?: ListbarItemSet;
+ /** set buttons using an object with keys as titles of buttons, containing of objects containing keys of `keys` and `callback`. */
+ commands?: ListbarItemSet;
+ /** automatically bind list buttons to keys 0-9. */
+ autoCommandKeys?: boolean;
+ }
+
+ export interface ListbarItemSet {
+ [name: string]: ListbarItem;
+ }
+
+ export interface ListbarItem {
+ keys: string[];
+ callback: GenericCallback;
+ }
+
+ export interface ListbarStyle extends Style {
+ /** style for a selected item. */
+ selected: Style;
+ /** style for an unselected item. */
+ item: Style;
+ }
+
+ /** A horizontal list. Useful for a main menu bar. */
+ export class Listbar extends Box {
+ constructor(options?: ListbarOptions);
+
+ /** append an item to the bar. */
+ add(item: ListbarItem, callback: GenericCallback): void;
+ /** append an item to the bar. */
+ addItem(item: ListbarItem, callback: GenericCallback): void;
+ /** append an item to the bar. */
+ appendItem(item: ListbarItem, callback: GenericCallback): void;
+
+ /** select button and execute its callback. */
+ selectTab(index: number): void;
+
+ /** set commands (see `commands` option above). */
+ setItems(commands: ListbarItemSet): void;
+ /** select an item on the bar. */
+ select(offset: number): void;
+ /** remove item from the bar. */
+ removeItem(child: ListbarItem): void;
+ /** move focus relatively across the bar. */
+ move(offset: number): void;
+ /** move focus left relatively across the bar. */
+ moveLeft(offset: number): void;
+ /** move focus right relatively across the bar. */
+ moveRight(offset: number): void;
+ }
+
+
+ //
+ // Log
+ //
+
+ export interface LogOptions extends ScrollableTextOptions {
+ /** amount of scrollback allowed. default: Infinity. */
+ scrollback?: number;
+ /** scroll to bottom on input even if the user has scrolled up. default: false. */
+ scrollOnInput?: boolean;
+ }
+
+
+ /** A log permanently scrolled to the bottom. */
+ export class Log extends ScrollableText {
+ constructor(options?: LogOptions);
+
+ /** amount of scrollback allowed. default: Infinity. */
+ scrollback: number;
+ /** scroll to bottom on input even if the user has scrolled up. default: false. */
+ scrollOnInput: boolean;
+
+ /** add a log line. */
+ log(text: string): void;
+ /** add a log line. */
+ add(text: string): void;
+ }
+
+
+ //
+ // Table
+ //
+
+ export interface TableOptions extends BoxOptions {
+ /** array of array of strings representing rows (same as `data`). */
+ rows?: string[][];
+ /** array of array of strings representing rows (same as `rows`). */
+ data?: string[][];
+ /** spaces to attempt to pad on the sides of each cell. `2` by default: one space on each side (only useful if the width is shrunken). */
+ pad?: number;
+ /** do not draw inner cells. */
+ noCellBorders?: boolean;
+ /** fill cell borders with the adjacent background color. */
+ fillCellBorders?: boolean;
+
+ /** includes `header` and `cell` substyles. */
+ style?: TableStyle;
+ }
+
+ export interface TableStyle extends Style {
+ /** header style. */
+ header: Style;
+ /** cell style. */
+ cell: Style;
+ }
+
+ /** A stylized table of text elements. */
+ export class Table extends Box {
+ /** includes `header` and `cell` substyles. */
+ style: TableStyle;
+
+ /** set rows in table. array of arrays of strings. */
+ setData(rows: string[][]): void;
+ /** set rows in table. array of arrays of strings. */
+ setRows(rows: string[][]): void;
+ }
+
+
+ //
+ // ListTable
+ //
+
+ export interface ListTableOptions extends ListOptions {
+ /** array of array of strings representing rows (same as `data`). */
+ rows?: string[][];
+ /** array of array of strings representing rows (same as `rows`). */
+ data?: string[][];
+ /** spaces to attempt to pad on the sides of each cell. `2` by default: one space on each side (only useful if the width is shrunken). */
+ pad?: number;
+
+ /** do not draw inner cells. */
+ noCellBorders?: boolean;
+
+ /** includes `header` and `cell` substyles. */
+ style?: TableStyle;
+ }
+
+ export interface ListTableStyle extends TableStyle {
+ }
+
+
+ /** A stylized table of text elements with a list. */
+ export class ListTable extends List {
+ constructor(options?: ListTableOptions);
+
+ /** set rows in table. array of arrays of strings. */
+ setData(rows: string[][]): void;
+ /** set rows in table. array of arrays of strings. */
+ setRows(rows: string[][]): void;
+ }
+
+ //
+ // Image
+ //
+
+ export interface ImageOptions extends BoxOptions {
+ /** path to image. */
+ file: string;
+ /** path to w3mimgdisplay. if a proper w3mimgdisplay path is not given, blessed will search the entire disk for the binary. */
+ w3m: string;
+ }
+
+
+ /** Display an image in the terminal (jpeg, png, gif) using w3mimgdisplay. Requires w3m to be installed. X11 required: works in xterm, urxvt, and possibly other terminals. */
+ export class Image extends Box {
+ constructor(options?: ImageOptions);
+
+ /** set the image in the box to a new path. */
+ setImage(img: string, callback: GenericCallback): void;
+ /** clear the current image. */
+ clearImage(callback: GenericCallback): void;
+ /** get the size of an image file in pixels. */
+ imageSize(img: string, callback: GenericCallback): void;
+ /** get the size of the terminal in pixels. */
+ termSize(callback: GenericCallback): void;
+ /** get the pixel to cell ratio for the terminal. */
+ getPixelRatio(callback: GenericCallback): void;
+ }
+
+
+ //
+ // Form
+ //
+
+ export interface FormOptions extends BoxOptions {
+ /** allow default keys (tab, vi keys, enter). */
+ keys?: boolean;
+ /** allow vi keys. */
+ vi?: boolean;
+ }
+
+ export class Form extends Box {
+ constructor(options?: FormOptions);
+
+ /** last submitted data. */
+ submission: any;
+
+ // on(event:string, callback:() => void): void;
+ // on(event:'submit', callback:(data) => void): void;
+ // on(event:'cancel', callback:() => void): void;
+ // on(event:'reset', callback:() => void): void;
+
+ next(): void;
+ previous(): void;
+
+ resetSelected(): void;
+ /** focus first form element. */
+ focusFirst(): void;
+ /** focus last form element. */
+ focusLast(): void;
+ /** focus next form element. */
+ focusNext(): void;
+ /** focus previous form element. */
+ focusPrevious(): void;
+ /** submit the form. */
+ submit(): void;
+ /** discard the form. */
+ cancel(): void;
+ /** clear the form. */
+ reset(): void;
+ }
+
+
+ //
+ // FileManager
+ //
+
+ export interface FileManagerOptions extends ListOptions {
+ cwd?: string;
+ }
+
+ export interface DirectoryEntry {
+ name: string;
+ text: string;
+ dir: boolean;
+ symlink: boolean;
+ }
+
+ export class FileManager extends List {
+ constructor(options?: FileManagerOptions);
+
+ cwd: string;
+
+ useFormatter(formatterFn: (entry: DirectoryEntry) => DirectoryEntry): void;
+
+ /** refresh the file list (perform a readdir on cwd and update the list items). */
+ refresh(cwd?: string, callback?: () => void): void;
+
+ /** refresh the file list. */
+ refresh(callback?: () => void): void;
+
+ /** reset back to original cwd. */
+ reset(cwd?: string, callback?: () => void): void;
+ }
+
+
+ //
+ // Terminal
+ //
+
+ export interface TerminalOptions extends BoxOptions {
+ /** handler for input data. */
+ handler?: (userInput: Buffer) => void;
+ /** name of shell. $SHELL by default. */
+ shell?: string;
+ /** args for shell. */
+ args?: any;
+ /** can be line, underline, and block. */
+ cursor?: string; //'line'|'underline'|'block';
+ }
+
+ export class Terminal extends Box {
+ /** reference to the headless term.js terminal. */
+ term: any;
+ /** reference to the pty.js pseudo terminal. */
+ pty: any;
+
+ /** write data to the terminal. */
+ write(data: string): void;
+
+ /** nearly identical to `element.screenshot`, however, the specified region includes the terminal's _entire_ scrollback, rather than just what is visible on the screen. */
+ screenshot(xi?: number, xl?: number, yi?: number, yl?: number): string;
+ }
+
+
+ export interface NodeChildProcessExecOptions {
+ cwd?: string;
+ stdio?: any;
+ customFds?: any;
+ env?: any;
+ encoding?: string;
+ timeout?: number;
+ maxBuffer?: number;
+ killSignal?: string;
+ }
+}
+
+export = Blessed;
\ No newline at end of file
diff --git a/blessed/tsconfig.json b/blessed/tsconfig.json
new file mode 100644
index 0000000000..4bd9b84009
--- /dev/null
+++ b/blessed/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "blessed-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/browser-pack/browser-pack-tests.ts b/browser-pack/browser-pack-tests.ts
index 4cf20249e8..b6b7446d31 100644
--- a/browser-pack/browser-pack-tests.ts
+++ b/browser-pack/browser-pack-tests.ts
@@ -1,11 +1,9 @@
-///
-
import browserPack = require("browser-pack");
module BrowserPackTest {
- export function packIt(opts?: BrowserPack.Options) {
- var packOpts: BrowserPack.Options = {
+ export function packIt(opts?: browserPack.Options) {
+ var packOpts: browserPack.Options = {
basedir: opts.basedir || "./",
externalRequireName: opts.externalRequireName || "require",
hasExports: opts.hasExports || false,
diff --git a/browser-pack/browser-pack.d.ts b/browser-pack/index.d.ts
similarity index 86%
rename from browser-pack/browser-pack.d.ts
rename to browser-pack/index.d.ts
index 52b96ce134..4006eb4f3f 100644
--- a/browser-pack/browser-pack.d.ts
+++ b/browser-pack/index.d.ts
@@ -3,11 +3,11 @@
// Definitions by: TeamworkGuy2
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-///
+///
/** pack node-style source files from a json stream into a browser bundle
*/
-declare module BrowserPack {
+declare namespace browserPack {
export interface Options {
/** Whether the bundle should include require= (or the opts.externalRequireName) so that
@@ -50,12 +50,10 @@ declare module BrowserPack {
*/
sourceMapPrefix?: string;
}
-
}
-declare module "browser-pack" {
- /** pack node-style source files from a json stream into a browser bundle
- */
- function browserPack(opts?: BrowserPack.Options): NodeJS.ReadWriteStream;
- export = browserPack;
-}
\ No newline at end of file
+/** pack node-style source files from a json stream into a browser bundle
+ */
+declare function browserPack(opts?: browserPack.Options): NodeJS.ReadWriteStream;
+export = browserPack;
+export as namespace browserPack;
\ No newline at end of file
diff --git a/browser-pack/tsconfig.json b/browser-pack/tsconfig.json
new file mode 100644
index 0000000000..aa0bdc75fd
--- /dev/null
+++ b/browser-pack/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "browser-pack-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cache-manager/cache-manager-tests.ts b/cache-manager/cache-manager-tests.ts
index 36eeb4c141..30a8472a8b 100644
--- a/cache-manager/cache-manager-tests.ts
+++ b/cache-manager/cache-manager-tests.ts
@@ -1,5 +1,3 @@
-///
-
import * as cacheManager from 'cache-manager'
const memoryCache = cacheManager.caching({ store: 'memory', max: 100, ttl: 10/*seconds*/ });
diff --git a/cache-manager/cache-manager.d.ts b/cache-manager/cache-manager.d.ts
deleted file mode 100644
index 9570857f01..0000000000
--- a/cache-manager/cache-manager.d.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-// Type definitions for cache-manager v1.2.0
-// Project: https://github.com/BryanDonovan/node-cache-manager
-// Definitions by: Simon Gausmann
-// Definitions: https://github.com/borisyankov/DefinitelyTyped
-declare module 'cache-manager' {
-
-
- interface CachingConfig {
- ttl: number;
- }
- interface StoreConfig extends CachingConfig {
- store: string;
- max?: number;
- isCacheableValue?: (value: any) => boolean;
- }
- interface Cache {
- set(key: string, value: T, options: CachingConfig, callback?: (error: any) => void): void;
- set(key: string, value: T, ttl: number, callback?: (error: any) => void): void;
-
- wrap(key: string, wrapper: (callback: (error: any, result: T) => void) => void, options: CachingConfig, callback: (error: any, result: T) => void): void;
- wrap(key: string, wrapper: (callback: (error: any, result: T) => void) => void, callback: (error: any, result: T) => void): void;
-
- get(key: string, callback: (error: any, result: T) => void): void;
-
- del(key: string, callback?: (error: any) => void): void;
- }
-
-
-
- module cacheManager {
- function caching(ICongig: StoreConfig): Cache;
- function multiCaching(Caches: Cache[]): Cache;
- }
-
- export = cacheManager;
-}
diff --git a/cache-manager/index.d.ts b/cache-manager/index.d.ts
new file mode 100644
index 0000000000..42b91858ce
--- /dev/null
+++ b/cache-manager/index.d.ts
@@ -0,0 +1,36 @@
+// Type definitions for cache-manager v1.2.0
+// Project: https://github.com/BryanDonovan/node-cache-manager
+// Definitions by: Simon Gausmann
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+interface CachingConfig {
+ ttl: number;
+}
+
+interface StoreConfig extends CachingConfig {
+ store: string;
+ max?: number;
+ isCacheableValue?: (value: any) => boolean;
+}
+
+interface Cache {
+ set(key: string, value: T, options: CachingConfig, callback?: (error: any) => void): void;
+ set(key: string, value: T, ttl: number, callback?: (error: any) => void): void;
+
+ wrap(key: string, wrapper: (callback: (error: any, result: T) => void) => void, options: CachingConfig, callback: (error: any, result: T) => void): void;
+ wrap(key: string, wrapper: (callback: (error: any, result: T) => void) => void, callback: (error: any, result: T) => void): void;
+
+ get(key: string, callback: (error: any, result: T) => void): void;
+
+ del(key: string, callback?: (error: any) => void): void;
+}
+
+
+
+declare namespace cacheManager {
+ function caching(ICongig: StoreConfig): Cache;
+ function multiCaching(Caches: Cache[]): Cache;
+}
+
+export = cacheManager;
+
diff --git a/cache-manager/tsconfig.json b/cache-manager/tsconfig.json
new file mode 100644
index 0000000000..c96d6c485c
--- /dev/null
+++ b/cache-manager/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "cache-manager-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cachefactory/cachefactory-tests.ts b/cachefactory/cachefactory-tests.ts
index 0c859e749d..73397dd8bf 100644
--- a/cachefactory/cachefactory-tests.ts
+++ b/cachefactory/cachefactory-tests.ts
@@ -1,4 +1,4 @@
-///
+///
CacheFactory.get('test');
diff --git a/cachefactory/cachefactory.d.ts b/cachefactory/index.d.ts
similarity index 98%
rename from cachefactory/cachefactory.d.ts
rename to cachefactory/index.d.ts
index ac416e6837..658a2660f4 100644
--- a/cachefactory/cachefactory.d.ts
+++ b/cachefactory/index.d.ts
@@ -3,7 +3,7 @@
// Definitions by: Vaggelis Mparmpas , Daniel Massa
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-declare module CacheFactory {
+declare namespace CacheFactory {
export interface IStoreImplementation {
getItem(key: string): string;
@@ -436,8 +436,6 @@ declare module CacheFactory {
}
}
-declare var CacheFactory: CacheFactory.ICacheFactory;
-
-declare module "cachefactory" {
- export = CacheFactory;
-}
\ No newline at end of file
+declare const CacheFactory: CacheFactory.ICacheFactory;
+export = CacheFactory;
+export as namespace CacheFactory;
diff --git a/cachefactory/tsconfig.json b/cachefactory/tsconfig.json
new file mode 100644
index 0000000000..41bb03d433
--- /dev/null
+++ b/cachefactory/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "cachefactory-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cliff/cliff-tests.ts b/cliff/cliff-tests.ts
new file mode 100644
index 0000000000..9217d9a38a
--- /dev/null
+++ b/cliff/cliff-tests.ts
@@ -0,0 +1 @@
+///
\ No newline at end of file
diff --git a/cliff/cliff.d.ts b/cliff/cliff.d.ts
deleted file mode 100644
index e0db79c986..0000000000
--- a/cliff/cliff.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-// Type definitions for cliff 0.1.10
-// Project: https://github.com/flatiron/cliff
-// Definitions by: bryn austin bellomy
-// Definitions: https://github.com/borisyankov/DefinitelyTyped
-
-
-declare module "cliff" {
- export function inspect(obj:any): string;
- export function stringifyRows(rows:string[][], colors?:string[]): string;
- export function stringifyObjectRows(rows:Array<{}>, keys:string[], colors?:string[]): string;
- export function putRows(level:string, rows:string[][], colors?:string[]): void;
- export function putObjectRows(level:string, rows:Array<{}>, keys:string[], colors?:string[]): void;
- export function putObject(level:string, object:any, rewriters?:any, padding?:any): void;
-}
diff --git a/cliff/index.d.ts b/cliff/index.d.ts
new file mode 100644
index 0000000000..446e63517a
--- /dev/null
+++ b/cliff/index.d.ts
@@ -0,0 +1,11 @@
+// Type definitions for cliff 0.1.10
+// Project: https://github.com/flatiron/cliff
+// Definitions by: bryn austin bellomy
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+export function inspect(obj: any): string;
+export function stringifyRows(rows: string[][], colors?: string[]): string;
+export function stringifyObjectRows(rows: Array<{}>, keys: string[], colors?: string[]): string;
+export function putRows(level: string, rows: string[][], colors?: string[]): void;
+export function putObjectRows(level: string, rows: Array<{}>, keys: string[], colors?: string[]): void;
+export function putObject(level: string, object: any, rewriters?: any, padding?: any): void;
\ No newline at end of file
diff --git a/cliff/tsconfig.json b/cliff/tsconfig.json
new file mode 100644
index 0000000000..3543a3aa8d
--- /dev/null
+++ b/cliff/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "cliff-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts b/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts
new file mode 100644
index 0000000000..4dafa2e966
--- /dev/null
+++ b/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts
@@ -0,0 +1,7 @@
+///
+
+window.addEventListener('batterystatus',
+ (ev: BatteryStatusEvent) => { console.log('Battery level is ' + ev.level); });
+
+window.addEventListener('batterycritical',
+ () => { alert('Battery is critical low!'); });
\ No newline at end of file
diff --git a/cordova/plugins/BatteryStatus.d.ts b/cordova-plugin-battery-status/index.d.ts
similarity index 97%
rename from cordova/plugins/BatteryStatus.d.ts
rename to cordova-plugin-battery-status/index.d.ts
index 11250e41b7..9baedc8cb0 100644
--- a/cordova/plugins/BatteryStatus.d.ts
+++ b/cordova-plugin-battery-status/index.d.ts
@@ -1,9 +1,9 @@
-// Type definitions for Apache Cordova BatteryStatus plugin.
+// Type definitions for Apache Cordova BatteryStatus plugin
// Project: https://github.com/apache/cordova-plugin-battery-status
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
+// Copyright (c) Microsoft Open Technologies Inc
// Licensed under the MIT license.
interface Window {
diff --git a/cordova-plugin-battery-status/tsconfig.json b/cordova-plugin-battery-status/tsconfig.json
new file mode 100644
index 0000000000..b781800488
--- /dev/null
+++ b/cordova-plugin-battery-status/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-battery-status-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-camera/cordova-plugin-camera-tests.ts b/cordova-plugin-camera/cordova-plugin-camera-tests.ts
new file mode 100644
index 0000000000..00edf02b0a
--- /dev/null
+++ b/cordova-plugin-camera/cordova-plugin-camera-tests.ts
@@ -0,0 +1,13 @@
+///
+
+navigator.camera.getPicture(
+ (data: string) => { alert('Got photo!'); },
+ (message: string)=> { alert('Failed!: ' + message); },
+ {
+ allowEdit: true,
+ cameraDirection: Camera.Direction.BACK,
+ destinationType: Camera.DestinationType.FILE_URI,
+ encodingType: Camera.EncodingType.JPEG,
+ sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
+ quality: 80
+ });
diff --git a/cordova/plugins/Camera.d.ts b/cordova-plugin-camera/index.d.ts
similarity index 96%
rename from cordova/plugins/Camera.d.ts
rename to cordova-plugin-camera/index.d.ts
index cf20d16ae8..48c8f8ae5c 100644
--- a/cordova/plugins/Camera.d.ts
+++ b/cordova-plugin-camera/index.d.ts
@@ -1,9 +1,9 @@
-// Type definitions for Apache Cordova Camera plugin.
+// Type definitions for Apache Cordova Camera plugin
// Project: https://github.com/apache/cordova-plugin-camera
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
+// Copyright (c) Microsoft Open Technologies Inc
// Licensed under the MIT license.
interface Navigator {
diff --git a/cordova-plugin-camera/tsconfig.json b/cordova-plugin-camera/tsconfig.json
new file mode 100644
index 0000000000..fd82d2283c
--- /dev/null
+++ b/cordova-plugin-camera/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-camera-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-contacts/cordova-plugin-contacts-tests.ts b/cordova-plugin-contacts/cordova-plugin-contacts-tests.ts
new file mode 100644
index 0000000000..c50912c3ba
--- /dev/null
+++ b/cordova-plugin-contacts/cordova-plugin-contacts-tests.ts
@@ -0,0 +1,18 @@
+///
+
+var contact: Contact = navigator.contacts.create({
+ nickname: 'John Smith',
+ displayName: 'John Smith',
+ phoneNumbers: [{ pref: true, type: "work", value: "+185642556856" }]
+});
+
+navigator.contacts.find(["phoneNumbers"],
+ (contacts: Contact[])=> { alert('Find ' + contacts.length + ' contacts'); },
+ (error: ContactError) => { alert('Error: ' + error.message); },
+ new ContactFindOptions("+1", true)
+);
+
+navigator.contacts.pickContact(
+ (contact: Contact)=> { console.log(contact); },
+ (err: ContactError)=> { console.log(err.message); }
+);
diff --git a/cordova/plugins/Contacts.d.ts b/cordova-plugin-contacts/index.d.ts
similarity index 97%
rename from cordova/plugins/Contacts.d.ts
rename to cordova-plugin-contacts/index.d.ts
index d940fccd77..e1faa7a2cd 100644
--- a/cordova/plugins/Contacts.d.ts
+++ b/cordova-plugin-contacts/index.d.ts
@@ -1,10 +1,10 @@
-// Type definitions for Apache Cordova Contacts plugin.
+// Type definitions for Apache Cordova Contacts plugin
// Project: https://github.com/apache/cordova-plugin-contacts
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
-// Licensed under the MIT license.
+// Copyright (c) Microsoft Open Technologies Inc
+// Licensed under the MIT license
interface Navigator {
/** Provides access to the device contacts database. */
diff --git a/cordova-plugin-contacts/tsconfig.json b/cordova-plugin-contacts/tsconfig.json
new file mode 100644
index 0000000000..150cbbc01b
--- /dev/null
+++ b/cordova-plugin-contacts/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-contacts-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-device-motion/cordova-plugin-device-motion-tests.ts b/cordova-plugin-device-motion/cordova-plugin-device-motion-tests.ts
new file mode 100644
index 0000000000..17b1e49930
--- /dev/null
+++ b/cordova-plugin-device-motion/cordova-plugin-device-motion-tests.ts
@@ -0,0 +1,12 @@
+///
+
+navigator.accelerometer.getCurrentAcceleration(
+ (acc: Acceleration) => { console.log('X: ' + acc.x + 'Y: ' + acc.y + 'Z: ' + acc.z); },
+ () => { alert('Error!'); });
+
+var acchandle: WatchHandle = navigator.accelerometer.watchAcceleration(
+ (acc: Acceleration)=> { console.log('X: ' + acc.x + 'Y: ' + acc.y + 'Z: ' + acc.z); },
+ () => { alert('Error!'); },
+ { frequency: 10 });
+
+navigator.accelerometer.clearWatch(acchandle);
diff --git a/cordova/plugins/DeviceMotion.d.ts b/cordova-plugin-device-motion/index.d.ts
similarity index 94%
rename from cordova/plugins/DeviceMotion.d.ts
rename to cordova-plugin-device-motion/index.d.ts
index 803579e66a..ae38803fd2 100644
--- a/cordova/plugins/DeviceMotion.d.ts
+++ b/cordova-plugin-device-motion/index.d.ts
@@ -1,9 +1,9 @@
-// Type definitions for Apache Cordova Device Motion plugin.
+// Type definitions for Apache Cordova Device Motion plugin
// Project: https://github.com/apache/cordova-plugin-device-motion
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
+// Copyright (c) Microsoft Open Technologies Inc
// Licensed under the MIT license.
interface Navigator {
diff --git a/cordova-plugin-device-motion/tsconfig.json b/cordova-plugin-device-motion/tsconfig.json
new file mode 100644
index 0000000000..38d054da74
--- /dev/null
+++ b/cordova-plugin-device-motion/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-device-motion-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-device-orientation/cordova-plugin-media-device-orientation-tests.ts b/cordova-plugin-device-orientation/cordova-plugin-media-device-orientation-tests.ts
new file mode 100644
index 0000000000..097a66e99e
--- /dev/null
+++ b/cordova-plugin-device-orientation/cordova-plugin-media-device-orientation-tests.ts
@@ -0,0 +1,13 @@
+///
+
+navigator.compass.getCurrentHeading(
+ (heading: CompassHeading)=> { console.log('Got heading to ' + heading.magneticHeading); },
+ (error: CompassError)=> { alert('Error! ' + error.code); },
+ { frequency: 10 });
+
+var accelhandle = navigator.compass.watchHeading(
+ (heading: CompassHeading) => { console.log('Got heading to ' + heading.magneticHeading); },
+ (error: CompassError) => { alert('Error! ' + error.code); },
+ { frequency: 10 });
+
+navigator.compass.clearWatch(accelhandle);
diff --git a/cordova/plugins/DeviceOrientation.d.ts b/cordova-plugin-device-orientation/index.d.ts
similarity index 96%
rename from cordova/plugins/DeviceOrientation.d.ts
rename to cordova-plugin-device-orientation/index.d.ts
index 322d25ca9c..dcd9654efa 100644
--- a/cordova/plugins/DeviceOrientation.d.ts
+++ b/cordova-plugin-device-orientation/index.d.ts
@@ -1,9 +1,9 @@
-// Type definitions for Apache Cordova Device Orientation plugin.
+// Type definitions for Apache Cordova Device Orientation plugin
// Project: https://github.com/apache/cordova-plugin-device-orientation
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
+// Copyright (c) Microsoft Open Technologies Inc
// Licensed under the MIT license.
interface Navigator {
diff --git a/cordova-plugin-device-orientation/tsconfig.json b/cordova-plugin-device-orientation/tsconfig.json
new file mode 100644
index 0000000000..8af4fd1451
--- /dev/null
+++ b/cordova-plugin-device-orientation/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-device-orientation-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-device/cordova-plugin-device-tests.ts b/cordova-plugin-device/cordova-plugin-device-tests.ts
new file mode 100644
index 0000000000..450eadb1f0
--- /dev/null
+++ b/cordova-plugin-device/cordova-plugin-device-tests.ts
@@ -0,0 +1,3 @@
+///
+
+console.log(JSON.stringify(device));
\ No newline at end of file
diff --git a/cordova/plugins/Device.d.ts b/cordova-plugin-device/index.d.ts
similarity index 83%
rename from cordova/plugins/Device.d.ts
rename to cordova-plugin-device/index.d.ts
index b9aebbefd2..494b04f1e2 100644
--- a/cordova/plugins/Device.d.ts
+++ b/cordova-plugin-device/index.d.ts
@@ -1,10 +1,10 @@
-// Type definitions for Apache Cordova Device plugin.
+// Type definitions for Apache Cordova Device plugin
// Project: https://github.com/apache/cordova-plugin-device
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
-// Licensed under the MIT license.
+// Copyright (c) Microsoft Open Technologies Inc
+// Licensed under the MIT license
/**
* This plugin defines a global device object, which describes the device's hardware and software.
diff --git a/cordova-plugin-device/tsconfig.json b/cordova-plugin-device/tsconfig.json
new file mode 100644
index 0000000000..2382a3c48b
--- /dev/null
+++ b/cordova-plugin-device/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-device-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-dialogs/cordova-plugin-dialogs-tests.ts b/cordova-plugin-dialogs/cordova-plugin-dialogs-tests.ts
new file mode 100644
index 0000000000..dd9396f36f
--- /dev/null
+++ b/cordova-plugin-dialogs/cordova-plugin-dialogs-tests.ts
@@ -0,0 +1,4 @@
+///
+
+navigator.notification.alert('Alert!', () => { alert('You\'re alerted'); }, 'Alert', 'Ok');
+navigator.notification.confirm('Are you ok?', (choice: number) => { alert('Your choice is ' + choice); });
diff --git a/cordova/plugins/Dialogs.d.ts b/cordova-plugin-dialogs/index.d.ts
similarity index 93%
rename from cordova/plugins/Dialogs.d.ts
rename to cordova-plugin-dialogs/index.d.ts
index c6753bbfeb..8a4035bf01 100644
--- a/cordova/plugins/Dialogs.d.ts
+++ b/cordova-plugin-dialogs/index.d.ts
@@ -1,9 +1,9 @@
-// Type definitions for Apache Cordova Dialogs plugin.
+// Type definitions for Apache Cordova Dialogs plugin
// Project: https://github.com/apache/cordova-plugin-dialogs
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
+// Copyright (c) Microsoft Open Technologies Inc
// Licensed under the MIT license.
interface Navigator {
diff --git a/cordova-plugin-dialogs/tsconfig.json b/cordova-plugin-dialogs/tsconfig.json
new file mode 100644
index 0000000000..8a06fc75a3
--- /dev/null
+++ b/cordova-plugin-dialogs/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-dialogs-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-file-transfer/cordova-plugin-file-transfer-tests.ts b/cordova-plugin-file-transfer/cordova-plugin-file-transfer-tests.ts
new file mode 100644
index 0000000000..4050b2c4aa
--- /dev/null
+++ b/cordova-plugin-file-transfer/cordova-plugin-file-transfer-tests.ts
@@ -0,0 +1,39 @@
+///
+
+var file = new FileTransfer();
+
+file.onprogress = (ev: ProgressEvent) => {
+ if (ev.lengthComputable) {
+ console.log(ev.loaded + '/' + ev.total);
+ }
+};
+
+file.download('http://some.server.com/download.php',
+ 'cdvfile://localhost/persistent/path/to/downloads/',
+ (file: FileEntry)=> { console.log('File Downloaded to ' + file.fullPath); },
+ (err: FileTransferError) => {
+ console.error('Error ' + err.code);
+ if (err.exception) {
+ console.error('Failed with exception ' + err.exception);
+ }
+ },
+ true,
+ {
+ headers: {
+ "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
+ }
+ });
+
+file.upload('cdvfile://localhost/persistent/path/to/downloads/',
+ 'http://some.server.com/download.php',
+ (result: FileUploadResult)=> { console.log('File uploaded. Bytes uploaded: ' + result.bytesSent); },
+ (err: FileTransferError) => {
+ console.error('Error ' + err.code);
+ if (err.exception) {
+ console.error('Failed with exception ' + err.exception);
+ }
+ },
+ { headers: {"X-Email": "user@mail.com", 'X-Token': "asdf3w234"}, httpMethod: "PUT" },
+ true);
+
+file.abort();
diff --git a/cordova/plugins/FileTransfer.d.ts b/cordova-plugin-file-transfer/index.d.ts
similarity index 95%
rename from cordova/plugins/FileTransfer.d.ts
rename to cordova-plugin-file-transfer/index.d.ts
index 40829668aa..4644dddd42 100644
--- a/cordova/plugins/FileTransfer.d.ts
+++ b/cordova-plugin-file-transfer/index.d.ts
@@ -1,12 +1,12 @@
-// Type definitions for Apache Cordova FileTransfer plugin.
+// Type definitions for Apache Cordova FileTransfer plugin
// Project: https://github.com/apache/cordova-plugin-file-transfer
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc.
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
-// Licensed under the MIT license.
+// Copyright (c) Microsoft Open Technologies Inc
+// Licensed under the MIT license
-///
+///
/**
* The FileTransfer object provides a way to upload files using an HTTP multi-part POST request,
diff --git a/cordova-plugin-file-transfer/tsconfig.json b/cordova-plugin-file-transfer/tsconfig.json
new file mode 100644
index 0000000000..0e88ebb590
--- /dev/null
+++ b/cordova-plugin-file-transfer/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-file-transfer-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-file/cordova-plugin-file-tests.ts b/cordova-plugin-file/cordova-plugin-file-tests.ts
new file mode 100644
index 0000000000..a95872a229
--- /dev/null
+++ b/cordova-plugin-file/cordova-plugin-file-tests.ts
@@ -0,0 +1,40 @@
+///
+///
+
+function fsaccessor(fs: FileSystem) {
+ console.log('FS root is: ' + fs.root.name);
+ var fsreader: DirectoryReader = fs.root.createReader();
+ fsreader.readEntries(
+ (entries: Entry[]) => { console.log(fs.root.name + ' has ' + entries.length + ' child elements'); },
+ (err: FileError)=> { alert('Error: ' + err.code); });
+}
+
+window.requestFileSystem(
+ window.TEMPORARY,
+ 1024 * 1024 * 5,
+ fsaccessor,
+ (err: FileError) => { alert('Error: ' + err.code); }
+);
+
+window.resolveLocalFileSystemURI(cordova.file.applicationDirectory,
+ (entry: Entry)=> {
+ if (entry.isDirectory) {
+ console.log('successfully resolved ' + entry.fullPath + 'directory');
+ console.log(entry.toURL());
+ console.log(entry.toInternalURL());
+ } else {
+ var fentry = entry;
+ fentry.file((f: File) => { console.log(f.slice(f.size - 10, f.size)); });
+ fentry.createWriter((writer: FileWriter)=> {
+ if (writer.readyState == FileWriter.INIT) {
+ console.log('Init FileWriter');
+ writer.write(new Blob(['sdfdsfsdf']));
+ writer.onprogress = function(ev: ProgressEvent) {
+ console.log('Writing ' + ev.target);
+ };
+ }
+ });
+ }
+ },
+ (error: FileError) => { console.log(error.code); }
+);
\ No newline at end of file
diff --git a/cordova/plugins/FileSystem.d.ts b/cordova-plugin-file/index.d.ts
similarity index 98%
rename from cordova/plugins/FileSystem.d.ts
rename to cordova-plugin-file/index.d.ts
index 66a6014dea..765426db50 100644
--- a/cordova/plugins/FileSystem.d.ts
+++ b/cordova-plugin-file/index.d.ts
@@ -1,9 +1,9 @@
-// Type definitions for Apache Cordova File System plugin.
+// Type definitions for Apache Cordova File System plugin
// Project: https://github.com/apache/cordova-plugin-file
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
+// Copyright (c) Microsoft Open Technologies Inc
// Licensed under the MIT license.
interface Window {
diff --git a/cordova-plugin-file/tsconfig.json b/cordova-plugin-file/tsconfig.json
new file mode 100644
index 0000000000..ffc80437fa
--- /dev/null
+++ b/cordova-plugin-file/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-file-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-globalization/cordova-plugin-globalization-tests.ts b/cordova-plugin-globalization/cordova-plugin-globalization-tests.ts
new file mode 100644
index 0000000000..0a58703a32
--- /dev/null
+++ b/cordova-plugin-globalization/cordova-plugin-globalization-tests.ts
@@ -0,0 +1,13 @@
+///
+
+navigator.globalization.dateToString(new Date(),
+ (date) => { console.log(JSON.stringify(date)); },
+ (error) => { alert(error.message); },
+ { formatLength: "short", selector: "date" });
+
+navigator.globalization.getDateNames(
+ (names) => {
+ names.value.forEach((name) => { console.log(name); });
+ },
+ (error) => { alert(error.message); },
+ { item: "months", type: "wide" });
\ No newline at end of file
diff --git a/cordova/plugins/Globalization.d.ts b/cordova-plugin-globalization/index.d.ts
similarity index 98%
rename from cordova/plugins/Globalization.d.ts
rename to cordova-plugin-globalization/index.d.ts
index 911127357f..5894bd27d0 100644
--- a/cordova/plugins/Globalization.d.ts
+++ b/cordova-plugin-globalization/index.d.ts
@@ -1,9 +1,9 @@
-// Type definitions for Apache Cordova Globalization plugin.
+// Type definitions for Apache Cordova Globalization plugin
// Project: https://github.com/apache/cordova-plugin-globalization
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
+// Copyright (c) Microsoft Open Technologies Inc
// Licensed under the MIT license.
interface Navigator {
diff --git a/cordova-plugin-globalization/tsconfig.json b/cordova-plugin-globalization/tsconfig.json
new file mode 100644
index 0000000000..c743a2a3ee
--- /dev/null
+++ b/cordova-plugin-globalization/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-globalization-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts b/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts
new file mode 100644
index 0000000000..43b0d28153
--- /dev/null
+++ b/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts
@@ -0,0 +1,15 @@
+///
+
+// InAppBrowser plugin
+//----------------------------------------------------------------------
+
+// signature of window.open() added by InAppBrowser plugin
+// is similar to native window.open signature, so the compiler can's
+// select proper overload, but we cast result to InAppBrowser manually.
+var iab = window.open('google.com', '_self');
+iab.addEventListener('loadstart', (ev: InAppBrowserEvent) => { console.log('Start opening ' + ev.url); });
+iab.show();
+iab.executeScript(
+ { code: "console.log('Injected script in action')" },
+ ()=> { console.log('Script is executed'); }
+);
\ No newline at end of file
diff --git a/cordova/plugins/InAppBrowser.d.ts b/cordova-plugin-inappbrowser/index.d.ts
similarity index 98%
rename from cordova/plugins/InAppBrowser.d.ts
rename to cordova-plugin-inappbrowser/index.d.ts
index 2e52068e16..d5e221ba42 100644
--- a/cordova/plugins/InAppBrowser.d.ts
+++ b/cordova-plugin-inappbrowser/index.d.ts
@@ -1,9 +1,9 @@
-// Type definitions for Apache Cordova InAppBrowser plugin.
+// Type definitions for Apache Cordova InAppBrowser plugin
// Project: https://github.com/apache/cordova-plugin-inappbrowser
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
+// Copyright (c) Microsoft Open Technologies Inc
// Licensed under the MIT license.
interface Window {
diff --git a/cordova-plugin-inappbrowser/tsconfig.json b/cordova-plugin-inappbrowser/tsconfig.json
new file mode 100644
index 0000000000..171d99407e
--- /dev/null
+++ b/cordova-plugin-inappbrowser/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-inappbrowser-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts b/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts
new file mode 100644
index 0000000000..3dce2776bf
--- /dev/null
+++ b/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts
@@ -0,0 +1,25 @@
+///
+
+Keyboard.shrinkView(true);
+Keyboard.shrinkView(false);
+Keyboard.hideFormAccessoryBar(true);
+Keyboard.hideFormAccessoryBar(false);
+Keyboard.disableScrollingInShrinkView(true);
+Keyboard.disableScrollingInShrinkView(false);
+if (Keyboard.isVisible) {
+ console.log('Keyboard is visible');
+}
+Keyboard.automaticScrollToTopOnHiding = true;
+Keyboard.onshow = function () {
+ console.log('onshow');
+};
+Keyboard.onhide = function () {
+ console.log('onhide');
+};
+Keyboard.onshowing = function () {
+ console.log('onshowing');
+};
+Keyboard.onhiding= function () {
+ console.log('onhiding');
+};
+
diff --git a/cordova/plugins/Keyboard.d.ts b/cordova-plugin-keyboard/index.d.ts
similarity index 100%
rename from cordova/plugins/Keyboard.d.ts
rename to cordova-plugin-keyboard/index.d.ts
diff --git a/cordova-plugin-keyboard/tsconfig.json b/cordova-plugin-keyboard/tsconfig.json
new file mode 100644
index 0000000000..00a8c3f7c5
--- /dev/null
+++ b/cordova-plugin-keyboard/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-keyboard-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-media-capture/cordova-plugin-capture-tests.ts b/cordova-plugin-media-capture/cordova-plugin-capture-tests.ts
new file mode 100644
index 0000000000..8bd56c714f
--- /dev/null
+++ b/cordova-plugin-media-capture/cordova-plugin-capture-tests.ts
@@ -0,0 +1,13 @@
+///
+
+console.log('Supported audio modes are: ' + JSON.stringify(navigator.device.capture.supportedAudioModes));
+
+navigator.device.capture.captureAudio(
+ (captures: MediaFile[]) => { console.log(captures.length + ' captured'); },
+ (err: CaptureError) => { alert('Error ' + err.message); },
+ {
+ limit: 3,
+ duration: 10
+ }
+);
+
diff --git a/cordova/plugins/MediaCapture.d.ts b/cordova-plugin-media-capture/index.d.ts
similarity index 96%
rename from cordova/plugins/MediaCapture.d.ts
rename to cordova-plugin-media-capture/index.d.ts
index b7c2c9abdf..726c5dac88 100644
--- a/cordova/plugins/MediaCapture.d.ts
+++ b/cordova-plugin-media-capture/index.d.ts
@@ -1,10 +1,10 @@
-// Type definitions for Apache Cordova MediaCapture plugin.
+// Type definitions for Apache Cordova MediaCapture plugin
// Project: https://github.com/apache/cordova-plugin-media-capture
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
-// Licensed under the MIT license.
+// Copyright (c) Microsoft Open Technologies Inc
+// Licensed under the MIT license
interface Navigator {
device: Device;
diff --git a/cordova-plugin-media-capture/tsconfig.json b/cordova-plugin-media-capture/tsconfig.json
new file mode 100644
index 0000000000..807c41c402
--- /dev/null
+++ b/cordova-plugin-media-capture/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-media-capture-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-media/cordova-plugin-media-tests.ts b/cordova-plugin-media/cordova-plugin-media-tests.ts
new file mode 100644
index 0000000000..76e39c8d7b
--- /dev/null
+++ b/cordova-plugin-media/cordova-plugin-media-tests.ts
@@ -0,0 +1,11 @@
+///
+
+// Media and Media Capture
+//----------------------------------------------------------------------
+
+var media = new Media('',
+ () => { console.log('Media opened'); },
+ (err: MediaError) => { alert('Error: ' + err.code); });
+media.play();
+media.setVolume(10);
+
diff --git a/cordova/plugins/Media.d.ts b/cordova-plugin-media/index.d.ts
similarity index 93%
rename from cordova/plugins/Media.d.ts
rename to cordova-plugin-media/index.d.ts
index e99db687c7..77f14d4e0b 100644
--- a/cordova/plugins/Media.d.ts
+++ b/cordova-plugin-media/index.d.ts
@@ -1,10 +1,10 @@
-// Type definitions for Apache Cordova Media plugin.
+// Type definitions for Apache Cordova Media plugin
// Project: https://github.com/apache/cordova-plugin-media
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
-// Licensed under the MIT license.
+// Copyright (c) Microsoft Open Technologies Inc
+// Licensed under the MIT license
declare var Media: {
new (
diff --git a/cordova-plugin-media/tsconfig.json b/cordova-plugin-media/tsconfig.json
new file mode 100644
index 0000000000..7875dd04a0
--- /dev/null
+++ b/cordova-plugin-media/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-media-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-network-information/cordova-plugin-device-motion-tests.ts b/cordova-plugin-network-information/cordova-plugin-device-motion-tests.ts
new file mode 100644
index 0000000000..702aeb5714
--- /dev/null
+++ b/cordova-plugin-network-information/cordova-plugin-device-motion-tests.ts
@@ -0,0 +1,8 @@
+///
+
+var connType = navigator.connection.type;
+if (connType == Connection.WIFI) {
+ console.log('Congratulations, you\'re with fast Internet!');
+}
+
+document.addEventListener('offline', () => { alert('You\'re offline!'); });
diff --git a/cordova/plugins/NetworkInformation.d.ts b/cordova-plugin-network-information/index.d.ts
similarity index 92%
rename from cordova/plugins/NetworkInformation.d.ts
rename to cordova-plugin-network-information/index.d.ts
index 0d49597e3a..4e9457efbd 100644
--- a/cordova/plugins/NetworkInformation.d.ts
+++ b/cordova-plugin-network-information/index.d.ts
@@ -1,10 +1,10 @@
-// Type definitions for Apache Cordova Network Information plugin.
+// Type definitions for Apache Cordova Network Information plugin
// Project: https://github.com/apache/cordova-plugin-network-information
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
-// Licensed under the MIT license.
+// Copyright (c) Microsoft Open Technologies Inc
+// Licensed under the MIT license
interface Navigator {
/**
diff --git a/cordova-plugin-network-information/tsconfig.json b/cordova-plugin-network-information/tsconfig.json
new file mode 100644
index 0000000000..3c31bfbd8e
--- /dev/null
+++ b/cordova-plugin-network-information/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-network-information-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-splashscreen/cordova-plugin-splashscreen-tests.ts b/cordova-plugin-splashscreen/cordova-plugin-splashscreen-tests.ts
new file mode 100644
index 0000000000..d24720eb1d
--- /dev/null
+++ b/cordova-plugin-splashscreen/cordova-plugin-splashscreen-tests.ts
@@ -0,0 +1,4 @@
+///
+
+navigator.splashscreen.show();
+navigator.splashscreen.hide();
\ No newline at end of file
diff --git a/cordova/plugins/Splashscreen.d.ts b/cordova-plugin-splashscreen/index.d.ts
similarity index 69%
rename from cordova/plugins/Splashscreen.d.ts
rename to cordova-plugin-splashscreen/index.d.ts
index cf2f803762..968b340067 100644
--- a/cordova/plugins/Splashscreen.d.ts
+++ b/cordova-plugin-splashscreen/index.d.ts
@@ -1,9 +1,9 @@
-// Type definitions for Apache Cordova Splashscreen plugin.
+// Type definitions for Apache Cordova Splashscreen plugin
// Project: https://github.com/apache/cordova-plugin-splashscreen
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
+// Copyright (c) Microsoft Open Technologies Inc
// Licensed under the MIT license.
interface Navigator {
diff --git a/cordova-plugin-splashscreen/tsconfig.json b/cordova-plugin-splashscreen/tsconfig.json
new file mode 100644
index 0000000000..032aed70bc
--- /dev/null
+++ b/cordova-plugin-splashscreen/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-splashscreen-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova/plugins/StatusBar-tests.ts b/cordova-plugin-statusbar/cordova-plugin-statusbar-tests.ts
similarity index 91%
rename from cordova/plugins/StatusBar-tests.ts
rename to cordova-plugin-statusbar/cordova-plugin-statusbar-tests.ts
index 01ab0bf945..9d22ca912c 100644
--- a/cordova/plugins/StatusBar-tests.ts
+++ b/cordova-plugin-statusbar/cordova-plugin-statusbar-tests.ts
@@ -1,5 +1,4 @@
-// Licensed under the MIT license.
-
+///
var statusBar: StatusBar = window.StatusBar;
diff --git a/cordova/plugins/StatusBar.d.ts b/cordova-plugin-statusbar/index.d.ts
similarity index 97%
rename from cordova/plugins/StatusBar.d.ts
rename to cordova-plugin-statusbar/index.d.ts
index d5feeaf0ea..8e211f3530 100644
--- a/cordova/plugins/StatusBar.d.ts
+++ b/cordova-plugin-statusbar/index.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for Apache Cordova StatusBar plugin.
+// Type definitions for Apache Cordova StatusBar plugin
// Project: https://github.com/apache/cordova-plugin-statusbar
// Definitions by: Xinkai Chen
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
diff --git a/cordova-plugin-statusbar/tsconfig.json b/cordova-plugin-statusbar/tsconfig.json
new file mode 100644
index 0000000000..c464e89096
--- /dev/null
+++ b/cordova-plugin-statusbar/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-statusbar-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-vibration/cordova-plugin-vibration-tests.ts b/cordova-plugin-vibration/cordova-plugin-vibration-tests.ts
new file mode 100644
index 0000000000..b34cd23675
--- /dev/null
+++ b/cordova-plugin-vibration/cordova-plugin-vibration-tests.ts
@@ -0,0 +1,8 @@
+///
+
+var notification: Notification;
+
+notification.vibrate(100);
+notification.vibrateWithPattern([100, 200, 200, 150, 50], 3);
+setTimeout(notification.cancelVibration, 1000);
+
diff --git a/cordova/plugins/Vibration.d.ts b/cordova-plugin-vibration/index.d.ts
similarity index 87%
rename from cordova/plugins/Vibration.d.ts
rename to cordova-plugin-vibration/index.d.ts
index a9371841ea..192c4781f5 100644
--- a/cordova/plugins/Vibration.d.ts
+++ b/cordova-plugin-vibration/index.d.ts
@@ -1,9 +1,9 @@
-// Type definitions for Apache Cordova Vibration plugin.
+// Type definitions for Apache Cordova Vibration plugin
// Project: https://github.com/apache/cordova-plugin-vibration
-// Definitions by: Microsoft Open Technologies, Inc. , Louis Lagrange
+// Definitions by: Microsoft Open Technologies Inc , Louis Lagrange
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
+// Copyright (c) Microsoft Open Technologies Inc
// Licensed under the MIT license.
interface Navigator {
diff --git a/cordova-plugin-vibration/tsconfig.json b/cordova-plugin-vibration/tsconfig.json
new file mode 100644
index 0000000000..8835563a00
--- /dev/null
+++ b/cordova-plugin-vibration/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-vibration-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-websql/cordova-plugin-websql-tests.ts b/cordova-plugin-websql/cordova-plugin-websql-tests.ts
new file mode 100644
index 0000000000..8679b3d5c3
--- /dev/null
+++ b/cordova-plugin-websql/cordova-plugin-websql-tests.ts
@@ -0,0 +1,16 @@
+///
+
+
+var db = window.openDatabase('Test', '0.1', 'test', 1024 * 1024 * 5);
+db.transaction(
+ (tx: SqlTransaction) => {
+ tx.executeSql('CREATE TABLE Sample IF NOT EXIST...');
+ tx.executeSql('INSERT INTO Sample VALUES...');
+ },
+ (err: SqlError) => {
+ if (err.code = SqlError.SYNTAX_ERR) {
+ alert('Error ' + err.message);
+ }
+ },
+ () => { console.log('Transaction completed successfully'); }
+);
\ No newline at end of file
diff --git a/cordova/plugins/WebSQL.d.ts b/cordova-plugin-websql/index.d.ts
similarity index 94%
rename from cordova/plugins/WebSQL.d.ts
rename to cordova-plugin-websql/index.d.ts
index f51f30cb6b..cb2a0e00e4 100644
--- a/cordova/plugins/WebSQL.d.ts
+++ b/cordova-plugin-websql/index.d.ts
@@ -1,9 +1,9 @@
-// Type definitions for Apache Cordova WebSQL plugin.
+// Type definitions for Apache Cordova WebSQL plugin
// Project: https://github.com/MSOpenTech/cordova-plugin-websql
-// Definitions by: Microsoft Open Technologies, Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
+// Copyright (c) Microsoft Open Technologies Inc
// Licensed under the MIT license.
interface Window {
diff --git a/cordova-plugin-websql/tsconfig.json b/cordova-plugin-websql/tsconfig.json
new file mode 100644
index 0000000000..36e7e41481
--- /dev/null
+++ b/cordova-plugin-websql/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": false,
+ "strictNullChecks": false,
+ "noEmit": true
+ },
+ "files": [
+ "index.d.ts",
+ "cordova-plugin-websql-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/cordova-plugin-x-socialsharing/cordova-plugin-x-socialsharing-tests.ts b/cordova-plugin-x-socialsharing/cordova-plugin-x-socialsharing-tests.ts
index 1d52b13646..fa1589c04f 100755
--- a/cordova-plugin-x-socialsharing/cordova-plugin-x-socialsharing-tests.ts
+++ b/cordova-plugin-x-socialsharing/cordova-plugin-x-socialsharing-tests.ts
@@ -1,6 +1,5 @@
///
-
window.plugins.socialsharing.iPadPopupCoordinates = function () {
return "100,100,200,300";
};
diff --git a/cordova-plugin-x-socialsharing/index.d.ts b/cordova-plugin-x-socialsharing/index.d.ts
index d498a981be..e99aa3a44f 100644
--- a/cordova-plugin-x-socialsharing/index.d.ts
+++ b/cordova-plugin-x-socialsharing/index.d.ts
@@ -3,6 +3,10 @@
// Definitions by: Markus Wagner
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+interface Window {
+ plugins: Plugins;
+}
+
interface Plugins {
socialsharing: SocialSharingPlugin.SocialSharing;
}
diff --git a/cordova/cordova-tests.ts b/cordova/cordova-tests.ts
index 6ab730af11..8b578b8a15 100644
--- a/cordova/cordova-tests.ts
+++ b/cordova/cordova-tests.ts
@@ -4,6 +4,9 @@
// Apache Cordova core
//----------------------------------------------------------------------
+///
+///
+
console.log('cordova.version: ' + cordova.version + ', cordova.platformId: ' + cordova.platformId);
console.log(typeof window.cordova);
@@ -30,301 +33,6 @@ declare var app: Application;
document.addEventListener('deviceready', () => { app.start(); });
document.addEventListener('pause', ()=> { app.pause(); });
-// Battery status plugin
-//----------------------------------------------------------------------
-window.addEventListener('batterystatus',
- (ev: BatteryStatusEvent) => { console.log('Battery level is ' + ev.level); });
-
-window.addEventListener('batterycritical',
- () => { alert('Battery is critical low!'); });
-
-// Camera plugin
-//----------------------------------------------------------------------
-
-navigator.camera.getPicture(
- (data: string) => { alert('Got photo!'); },
- (message: string)=> { alert('Failed!: ' + message); },
- {
- allowEdit: true,
- cameraDirection: Camera.Direction.BACK,
- destinationType: Camera.DestinationType.FILE_URI,
- encodingType: Camera.EncodingType.JPEG,
- sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
- quality: 80
- });
-
-// Contacts plugin
-//----------------------------------------------------------------------
-
-var contact: Contact = navigator.contacts.create({
- nickname: 'John Smith',
- displayName: 'John Smith',
- phoneNumbers: [{ pref: true, type: "work", value: "+185642556856" }]
-});
-
-navigator.contacts.find(["phoneNumbers"],
- (contacts: Contact[])=> { alert('Find ' + contacts.length + ' contacts'); },
- (error: ContactError) => { alert('Error: ' + error.message); },
- new ContactFindOptions("+1", true)
-);
-
-navigator.contacts.pickContact(
- (contact: Contact)=> { console.log(contact); },
- (err: ContactError)=> { console.log(err.message); }
-);
-
-// Device API
-//----------------------------------------------------------------------
-
-console.log(JSON.stringify(device));
-
-// DeviceMotion plugin
-//----------------------------------------------------------------------
-
-navigator.accelerometer.getCurrentAcceleration(
- (acc: Acceleration) => { console.log('X: ' + acc.x + 'Y: ' + acc.y + 'Z: ' + acc.z); },
- () => { alert('Error!'); });
-
-var acchandle: WatchHandle = navigator.accelerometer.watchAcceleration(
- (acc: Acceleration)=> { console.log('X: ' + acc.x + 'Y: ' + acc.y + 'Z: ' + acc.z); },
- () => { alert('Error!'); },
- { frequency: 10 });
-
-navigator.accelerometer.clearWatch(acchandle);
-
-// DeviceOrientation plugin
-//----------------------------------------------------------------------
-
-navigator.compass.getCurrentHeading(
- (heading: CompassHeading)=> { console.log('Got heading to ' + heading.magneticHeading); },
- (error: CompassError)=> { alert('Error! ' + error.code); },
- { frequency: 10 });
-
-var accelhandle = navigator.compass.watchHeading(
- (heading: CompassHeading) => { console.log('Got heading to ' + heading.magneticHeading); },
- (error: CompassError) => { alert('Error! ' + error.code); },
- { frequency: 10 });
-
-navigator.compass.clearWatch(accelhandle);
-
-// Dialogs plugin
-//----------------------------------------------------------------------
-
-navigator.notification.alert('Alert!', () => { alert('You\'re alerted'); }, 'Alert', 'Ok');
-navigator.notification.confirm('Are you ok?', (choice: number) => { alert('Your choice is ' + choice); });
-
-// FileSystem plugin
-//----------------------------------------------------------------------
-
-function fsaccessor(fs: FileSystem) {
- console.log('FS root is: ' + fs.root.name);
- var fsreader: DirectoryReader = fs.root.createReader();
- fsreader.readEntries(
- (entries: Entry[]) => { console.log(fs.root.name + ' has ' + entries.length + ' child elements'); },
- (err: FileError)=> { alert('Error: ' + err.code); });
-}
-
-window.requestFileSystem(
- window.TEMPORARY,
- 1024 * 1024 * 5,
- fsaccessor,
- (err: FileError) => { alert('Error: ' + err.code); }
-);
-
-window.resolveLocalFileSystemURI(cordova.file.applicationDirectory,
- (entry: Entry)=> {
- if (entry.isDirectory) {
- console.log('successfully resolved ' + entry.fullPath + 'directory');
- console.log(entry.toURL());
- console.log(entry.toInternalURL());
- } else {
- var fentry = entry;
- fentry.file((f: File) => { console.log(f.slice(f.size - 10, f.size)); });
- fentry.createWriter((writer: FileWriter)=> {
- if (writer.readyState == FileWriter.INIT) {
- console.log('Init FileWriter');
- writer.write(new Blob(['sdfdsfsdf']));
- writer.onprogress = function(ev: ProgressEvent) {
- console.log('Writing ' + ev.target);
- };
- }
- });
- }
- },
- (error: FileError) => { console.log(error.code); }
-);
-
-// FileTransfer plugin
-//----------------------------------------------------------------------
-
-var file = new FileTransfer();
-
-file.onprogress = (ev: ProgressEvent) => {
- if (ev.lengthComputable) {
- console.log(ev.loaded + '/' + ev.total);
- }
-};
-
-file.download('http://some.server.com/download.php',
- 'cdvfile://localhost/persistent/path/to/downloads/',
- (file: FileEntry)=> { console.log('File Downloaded to ' + file.fullPath); },
- (err: FileTransferError) => {
- console.error('Error ' + err.code);
- if (err.exception) {
- console.error('Failed with exception ' + err.exception);
- }
- },
- true,
- {
- headers: {
- "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
- }
- });
-
-file.upload('cdvfile://localhost/persistent/path/to/downloads/',
- 'http://some.server.com/download.php',
- (result: FileUploadResult)=> { console.log('File uploaded. Bytes uploaded: ' + result.bytesSent); },
- (err: FileTransferError) => {
- console.error('Error ' + err.code);
- if (err.exception) {
- console.error('Failed with exception ' + err.exception);
- }
- },
- { headers: {"X-Email": "user@mail.com", 'X-Token': "asdf3w234"}, httpMethod: "PUT" },
- true);
-
-file.abort();
-
-file.abort();
-// InAppBrowser plugin
-//----------------------------------------------------------------------
-// signature of window.open() added by InAppBrowser plugin
-// is similar to native window.open signature, so the compiler can's
-// select proper overload, but we cast result to InAppBrowser manually.
-var iab = window.open('google.com', '_self');
-iab.addEventListener('loadstart', (ev: InAppBrowserEvent) => { console.log('Start opening ' + ev.url); });
-iab.show();
-iab.executeScript(
- { code: "console.log('Injected script in action')" },
- ()=> { console.log('Script is executed'); }
-);
-
-// Globalization plugin
-//----------------------------------------------------------------------
-
-navigator.globalization.dateToString(new Date(),
- (date) => { console.log(JSON.stringify(date)); },
- (error) => { alert(error.message); },
- { formatLength: "short", selector: "date" });
-
-navigator.globalization.getDateNames(
- (names) => {
- names.value.forEach((name) => { console.log(name); });
- },
- (error) => { alert(error.message); },
- { item: "months", type: "wide" });
-
-// Media and Media Capture
-//----------------------------------------------------------------------
-
-var media = new Media('',
- () => { console.log('Media opened'); },
- (err: MediaError) => { alert('Error: ' + err.code); });
-media.play();
-media.setVolume(10);
-
-console.log('Supported audio modes are: ' + JSON.stringify(navigator.device.capture.supportedAudioModes));
-
-navigator.device.capture.captureAudio(
- (captures: MediaFile[])=> { console.log(captures.length + ' captured'); },
- (err: CaptureError)=> { alert('Error ' + err.message); },
- {
- limit: 3,
- duration: 10
- });
-
-// Push Notifications
-//----------------------------------------------------------------------
-
-var pushNotification = window.plugins.pushNotification;
-pushNotification.register(
- (regId: string) => { console.log('Successfully registered'); },
- (err: any) => { alert('Error!'); },
- {
- channelName: "your_channel_name",
- ecb: "onNotification"
- });
-
-function onNotification(e: any) {
- navigator.notification.alert(e.text2, () => { }, e.text1);
-}
-
-window.plugins.pushNotification.unregister(() => { }, () => { });
-
-// Network Plugin
-//----------------------------------------------------------------------
-
-var connType = navigator.connection.type;
-if (connType == Connection.WIFI) {
- console.log('Congratulations, you\'re with fast Internet!');
-}
-
-document.addEventListener('offline', () => { alert('You\'re offline!'); });
-
-// SplashScreen plugin
-//----------------------------------------------------------------------
-
-navigator.splashscreen.show();
-navigator.splashscreen.hide();
-
-
-// WebSQL plugin
-//----------------------------------------------------------------------
-
-var db = window.openDatabase('Test', '0.1', 'test', 1024 * 1024 * 5);
-db.transaction(
- (tx: SqlTransaction) => {
- tx.executeSql('CREATE TABLE Sample IF NOT EXIST...');
- tx.executeSql('INSERT INTO Sample VALUES...');
- },
- (err: SqlError) => {
- if (err.code = SqlError.SYNTAX_ERR) {
- alert('Error ' + err.message);
- }
- },
- () => { console.log('Transaction completed successfully'); }
-);
-
-// Vibration plugin
-//----------------------------------------------------------------------
-navigator.notification.vibrate(100);
-navigator.notification.vibrateWithPattern([100, 200, 200, 150, 50], 3);
-setTimeout(navigator.notification.cancelVibration, 1000);
-
-// Keyboard plugin
-//----------------------------------------------------------------------
-Keyboard.shrinkView(true);
-Keyboard.shrinkView(false);
-Keyboard.hideFormAccessoryBar(true);
-Keyboard.hideFormAccessoryBar(false);
-Keyboard.disableScrollingInShrinkView(true);
-Keyboard.disableScrollingInShrinkView(false);
-if (Keyboard.isVisible) {
- console.log('Keyboard is visible');
-}
-Keyboard.automaticScrollToTopOnHiding = true;
-Keyboard.onshow = function () {
- console.log('onshow');
-};
-Keyboard.onhide = function () {
- console.log('onhide');
-};
-Keyboard.onshowing = function () {
- console.log('onshowing');
-};
-Keyboard.onhiding= function () {
- console.log('onhiding');
-};
diff --git a/cordova/index.d.ts b/cordova/index.d.ts
index a830fa4881..30a827ed93 100644
--- a/cordova/index.d.ts
+++ b/cordova/index.d.ts
@@ -1,31 +1,12 @@
// Type definitions for Apache Cordova
// Project: http://cordova.apache.org
-// Definitions by: Microsoft Open Technologies Inc.
+// Definitions by: Microsoft Open Technologies Inc
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
-// Copyright (c) Microsoft Open Technologies, Inc.
+// Copyright (c) Microsoft Open Technologies Inc
// Licensed under the MIT license.
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
-///
+
interface Cordova {
/** Invokes native functionality by specifying corresponding service name, action and optional parameters.
diff --git a/cordova/plugins/Push.d.ts b/cordova/plugins/Push.d.ts
deleted file mode 100644
index 631cb7f008..0000000000
--- a/cordova/plugins/Push.d.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-// Type definitions for Apache Cordova Push plugin.
-// Project: https://github.com/phonegap-build/PushPlugin
-// Definitions by: Microsoft Open Technologies, Inc.
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-//
-// Copyright (c) Microsoft Open Technologies, Inc.
-// Licensed under the MIT license.
-
-interface Window {
- plugins: Plugins
-}
-
-interface Plugins {
- /**
- * This plugin allows to receive push notifications. The Android implementation uses
- * Google's GCM (Google Cloud Messaging) service,
- * whereas the iOS version is based on Apple APNS Notifications
- */
- pushNotification: PushNotification
-}
-
-/**
- * This plugin allows to receive push notifications. The Android implementation uses
- * Google's GCM (Google Cloud Messaging) service,
- * whereas the iOS version is based on Apple APNS Notifications
- */
-interface PushNotification {
- /**
- * Registers as push notification receiver.
- * @param successCallback Called when a plugin method returns without error.
- * @param errorCallback Called when the plugin returns an error.
- * @param registrationOptions Options for registration process.
- */
- register(
- successCallback: (registrationId: string) => void,
- errorCallback: (error: any) => void,
- registrationOptions: RegistrationOptions): void;
- /**
- * Unregisters as push notification receiver.
- * @param successCallback Called when a plugin method returns without error.
- * @param errorCallback Called when the plugin returns an error.
- */
- unregister(
- successCallback: (result: any) => void,
- errorCallback: (error: any) => void): void;
- /**
- * Sets the badge count visible when the app is not running. iOS only.
- * @param successCallback Called when a plugin method returns without error.
- * @param errorCallback Called when the plugin returns an error.
- * @param badgeCount An integer indicating what number should show up in the badge. Passing 0 will clear the badge.
- */
- setApplicationIconBadgeNumber(
- successCallback: (result: any) => void,
- errorCallback: (error: any) => void,
- badgeCount: number): void;
-}
-
-/** Options for registration process. */
-interface RegistrationOptions {
- /** This is the Google project ID you need to obtain by registering your application for GCM. Android only */
- senderID?: string;
- /** WP8 only */
- channelName?: string;
- /** Callback, that is fired when notification arrived */
- ecb?: string;
- badge?: boolean;
- sound?: boolean;
- alert?: boolean
-}
-
diff --git a/cordova/tsconfig.json b/cordova/tsconfig.json
index e70b5ee0a5..b09d75d7b1 100644
--- a/cordova/tsconfig.json
+++ b/cordova/tsconfig.json
@@ -2,15 +2,9 @@
"compilerOptions": {
"module": "commonjs",
"target": "es6",
- "noImplicitAny": true,
+ "noImplicitAny": false,
"strictNullChecks": false,
- "baseUrl": "../",
- "typeRoots": [
- "../"
- ],
- "types": [],
- "noEmit": true,
- "forceConsistentCasingInFileNames": true
+ "noEmit": true
},
"files": [
"index.d.ts",
diff --git a/CybozuLabs-md5/CybozuLabs-md5-tests.ts b/cybozulabs-md5/CybozuLabs-md5-tests.ts
similarity index 83%
rename from CybozuLabs-md5/CybozuLabs-md5-tests.ts
rename to cybozulabs-md5/CybozuLabs-md5-tests.ts
index 16dd05b059..7572ed9124 100644
--- a/CybozuLabs-md5/CybozuLabs-md5-tests.ts
+++ b/cybozulabs-md5/CybozuLabs-md5-tests.ts
@@ -1,4 +1,4 @@
-///
+///
var hash: string;
hash = CybozuLabs.MD5.calc("abc");
diff --git a/CybozuLabs-md5/CybozuLabs-md5.d.ts b/cybozulabs-md5/index.d.ts
similarity index 100%
rename from CybozuLabs-md5/CybozuLabs-md5.d.ts
rename to cybozulabs-md5/index.d.ts
diff --git a/cybozulabs-md5/tsconfig.json b/cybozulabs-md5/tsconfig.json
new file mode 100644
index 0000000000..eeac3d87b3
--- /dev/null
+++ b/cybozulabs-md5/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "CybozuLabs-md5-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/d3-array/d3-array-tests.ts b/d3-array/d3-array-tests.ts
index 3ec1a8fcfd..7183320b71 100644
--- a/d3-array/d3-array-tests.ts
+++ b/d3-array/d3-array-tests.ts
@@ -6,7 +6,7 @@
* are not intended as functional tests.
*/
-import * as d3 from 'd3-array';
+import * as d3Array from 'd3-array';
import { scaleTime } from 'd3-scale';
import { timeYear } from 'd3-time';
@@ -47,8 +47,8 @@ let date: Date;
let extentNum: [number, number];
let extentStr: [string, string];
let extentNumeric: [NumCoercible, NumCoercible];
-let extentDateMixed: [d3.Primitive, d3.Primitive];
-let extentMixed: [d3.Primitive | NumCoercible, d3.Primitive | NumCoercible];
+let extentDateMixed: [d3Array.Primitive, d3Array.Primitive];
+let extentMixed: [d3Array.Primitive | NumCoercible, d3Array.Primitive | NumCoercible];
let extentDate: [Date, Date];
let numbersArray = [10, 20, 30, 40, 50];
@@ -72,35 +72,35 @@ let mixedObjectArray = [
// without accessors
-num = d3.max(numbersArray);
-str = d3.max(stringyNumbersArray);
-numeric = d3.max(numericArray);
-date = d3.max(dateArray);
+num = d3Array.max(numbersArray);
+str = d3Array.max(stringyNumbersArray);
+numeric = d3Array.max(numericArray);
+date = d3Array.max(dateArray);
// with accessors
-num = d3.max(mixedObjectArray, function (datum, index, array) {
+num = d3Array.max(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
return datum.num;
});
-str = d3.max(mixedObjectArray, function (datum, index, array) {
+str = d3Array.max(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
return datum.str;
});
-numeric = d3.max(mixedObjectArray, function (datum, index, array) {
+numeric = d3Array.max(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
return datum.numeric;
});
-date = d3.max(mixedObjectArray, function (datum, index, array) {
+date = d3Array.max(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
@@ -111,35 +111,35 @@ date = d3.max(mixedObjectArray, function (datum, index, array) {
// without accessors
-num = d3.min(numbersArray);
-str = d3.min(stringyNumbersArray);
-numeric = d3.min(numericArray);
-date = d3.min(dateArray);
+num = d3Array.min(numbersArray);
+str = d3Array.min(stringyNumbersArray);
+numeric = d3Array.min(numericArray);
+date = d3Array.min(dateArray);
// with accessors
-num = d3.min(mixedObjectArray, function (datum, index, array) {
+num = d3Array.min(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
return datum.num;
});
-str = d3.min(mixedObjectArray, function (datum, index, array) {
+str = d3Array.min(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
return datum.str;
});
-numeric = d3.min(mixedObjectArray, function (datum, index, array) {
+numeric = d3Array.min(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
return datum.numeric;
});
-date = d3.min(mixedObjectArray, function (datum, index, array) {
+date = d3Array.min(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
@@ -150,36 +150,36 @@ date = d3.min(mixedObjectArray, function (datum, index, array) {
// without accessors
-extentNum = d3.extent(numbersArray);
-extentStr = d3.extent(stringyNumbersArray);
-extentNumeric = d3.extent(numericArray);
-extentDate = d3.extent(dateArray);
-extentMixed = d3.extent([new NumCoercible(10), 13, '12', true]);
+extentNum = d3Array.extent(numbersArray);
+extentStr = d3Array.extent(stringyNumbersArray);
+extentNumeric = d3Array.extent(numericArray);
+extentDate = d3Array.extent(dateArray);
+extentMixed = d3Array.extent([new NumCoercible(10), 13, '12', true]);
// with accessors
-extentNum = d3.extent(mixedObjectArray, function (datum, index, array) {
+extentNum = d3Array.extent(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
return datum.num;
});
-extentStr = d3.extent(mixedObjectArray, function (datum, index, array) {
+extentStr = d3Array.extent(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
return datum.str;
});
-extentMixed = d3.extent(mixedObjectArray, function (datum, index, array) {
+extentMixed = d3Array.extent(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
return datum.numeric;
});
-extentDateMixed = d3.extent(mixedObjectArray, function (datum, index, array) {
+extentDateMixed = d3Array.extent(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
@@ -188,9 +188,9 @@ extentDateMixed = d3.extent(mixedObjectArray, function (datum, index, array) {
// mean() ----------------------------------------------------------------------
-num = d3.mean(numbersArray);
+num = d3Array.mean(numbersArray);
-num = d3.mean(mixedObjectArray, function (datum, index, array) {
+num = d3Array.mean(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
@@ -199,9 +199,9 @@ num = d3.mean(mixedObjectArray, function (datum, index, array) {
// median() --------------------------------------------------------------------
-num = d3.median(numbersArray);
+num = d3Array.median(numbersArray);
-num = d3.median(mixedObjectArray, function (datum, index, array) {
+num = d3Array.median(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
@@ -210,9 +210,9 @@ num = d3.median(mixedObjectArray, function (datum, index, array) {
// quantile() ------------------------------------------------------------------
-num = d3.quantile(numbersArray, 0.5);
+num = d3Array.quantile(numbersArray, 0.5);
-num = d3.quantile(mixedObjectArray, 0.5, function (datum, index, array) {
+num = d3Array.quantile(mixedObjectArray, 0.5, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
@@ -222,9 +222,9 @@ num = d3.quantile(mixedObjectArray, 0.5, function (datum, index, array) {
// sum() -----------------------------------------------------------------------
-num = d3.sum(numbersArray);
+num = d3Array.sum(numbersArray);
-num = d3.sum(mixedObjectArray, function (datum, index, array) {
+num = d3Array.sum(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
@@ -233,9 +233,9 @@ num = d3.sum(mixedObjectArray, function (datum, index, array) {
// deviation() -----------------------------------------------------------------
-num = d3.deviation(numbersArray);
+num = d3Array.deviation(numbersArray);
-num = d3.deviation(mixedObjectArray, function (datum, index, array) {
+num = d3Array.deviation(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
@@ -244,9 +244,9 @@ num = d3.deviation(mixedObjectArray, function (datum, index, array) {
// variance() ------------------------------------------------------------------
-num = d3.variance(numbersArray);
+num = d3Array.variance(numbersArray);
-num = d3.variance(mixedObjectArray, function (datum, index, array) {
+num = d3Array.variance(mixedObjectArray, function (datum, index, array) {
let d: MixedObject = datum;
let i: number = index;
let arr: Array = array;
@@ -259,65 +259,65 @@ num = d3.variance(mixedObjectArray, function (datum, index, array) {
// scan() ----------------------------------------------------------------------
-num = d3.scan(mixedObjectArray, function (a, b) {
+num = d3Array.scan(mixedObjectArray, function (a, b) {
return a.num - b.num; // a and b are of type MixedObject
});
// bisectLeft() ----------------------------------------------------------------
-num = d3.bisectLeft([0, 2, 3, 4, 7, 8], 4);
-num = d3.bisectLeft([0, 2, 3, 4, 7, 8], 4, 1);
-num = d3.bisectLeft([0, 2, 3, 4, 7, 8], 4, 1, 4);
+num = d3Array.bisectLeft([0, 2, 3, 4, 7, 8], 4);
+num = d3Array.bisectLeft([0, 2, 3, 4, 7, 8], 4, 1);
+num = d3Array.bisectLeft([0, 2, 3, 4, 7, 8], 4, 1, 4);
-num = d3.bisectLeft(['0', '2', '3', '4', '7', '8'], '21');
-num = d3.bisectLeft(['0', '2', '3', '4', '7', '8'], '21', 1);
-num = d3.bisectLeft(['0', '2', '3', '4', '7', '8'], '21', 1, 4);
+num = d3Array.bisectLeft(['0', '2', '3', '4', '7', '8'], '21');
+num = d3Array.bisectLeft(['0', '2', '3', '4', '7', '8'], '21', 1);
+num = d3Array.bisectLeft(['0', '2', '3', '4', '7', '8'], '21', 1, 4);
-num = d3.bisectLeft([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1));
-num = d3.bisectLeft([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1);
-num = d3.bisectLeft([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1, 2);
+num = d3Array.bisectLeft([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1));
+num = d3Array.bisectLeft([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1);
+num = d3Array.bisectLeft([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1, 2);
// bisectRight() ---------------------------------------------------------------
-num = d3.bisectRight([0, 2, 3, 4, 7, 8], 4);
-num = d3.bisectRight([0, 2, 3, 4, 7, 8], 4, 1);
-num = d3.bisectRight([0, 2, 3, 4, 7, 8], 4, 1, 4);
+num = d3Array.bisectRight([0, 2, 3, 4, 7, 8], 4);
+num = d3Array.bisectRight([0, 2, 3, 4, 7, 8], 4, 1);
+num = d3Array.bisectRight([0, 2, 3, 4, 7, 8], 4, 1, 4);
-num = d3.bisectRight(['0', '2', '3', '4', '7', '8'], '21');
-num = d3.bisectRight(['0', '2', '3', '4', '7', '8'], '21', 1);
-num = d3.bisectRight(['0', '2', '3', '4', '7', '8'], '21', 1, 4);
+num = d3Array.bisectRight(['0', '2', '3', '4', '7', '8'], '21');
+num = d3Array.bisectRight(['0', '2', '3', '4', '7', '8'], '21', 1);
+num = d3Array.bisectRight(['0', '2', '3', '4', '7', '8'], '21', 1, 4);
-num = d3.bisectRight([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1));
-num = d3.bisectRight([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1);
-num = d3.bisectRight([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1, 2);
+num = d3Array.bisectRight([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1));
+num = d3Array.bisectRight([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1);
+num = d3Array.bisectRight([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1, 2);
// bisect() --------------------------------------------------------------------
-num = d3.bisect([0, 2, 3, 4, 7, 8], 4);
-num = d3.bisect([0, 2, 3, 4, 7, 8], 4, 1);
-num = d3.bisect([0, 2, 3, 4, 7, 8], 4, 1, 4);
+num = d3Array.bisect([0, 2, 3, 4, 7, 8], 4);
+num = d3Array.bisect([0, 2, 3, 4, 7, 8], 4, 1);
+num = d3Array.bisect([0, 2, 3, 4, 7, 8], 4, 1, 4);
-num = d3.bisect(['0', '2', '3', '4', '7', '8'], '21');
-num = d3.bisect(['0', '2', '3', '4', '7', '8'], '21', 1);
-num = d3.bisect(['0', '2', '3', '4', '7', '8'], '21', 1, 4);
+num = d3Array.bisect(['0', '2', '3', '4', '7', '8'], '21');
+num = d3Array.bisect(['0', '2', '3', '4', '7', '8'], '21', 1);
+num = d3Array.bisect(['0', '2', '3', '4', '7', '8'], '21', 1, 4);
-num = d3.bisect([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1));
-num = d3.bisect([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1);
-num = d3.bisect([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1, 2);
+num = d3Array.bisect([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1));
+num = d3Array.bisect([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1);
+num = d3Array.bisect([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1, 2);
// bisector() ------------------------------------------------------------------
mixedObjectArray.sort(function (a, b) { return a.date.valueOf() - b.date.valueOf(); });
-let mixedObjectDateBisectorObject: d3.Bisector;
+let mixedObjectDateBisectorObject: d3Array.Bisector;
// define using accessor
-mixedObjectDateBisectorObject = d3.bisector(function (el) {
+mixedObjectDateBisectorObject = d3Array.bisector(function (el) {
return el.date;
});
// define using comparator
-mixedObjectDateBisectorObject = d3.bisector(function (el, x) {
+mixedObjectDateBisectorObject = d3Array.bisector(function (el, x) {
return el.date.valueOf() - x.valueOf();
});
@@ -334,15 +334,15 @@ num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14
// ascending() -----------------------------------------------------------------
-num = d3.ascending(10, 20);
-num = d3.ascending('10', '20');
-num = d3.ascending(new Date(2016, 6, 13), new Date(2016, 6, 14));
+num = d3Array.ascending(10, 20);
+num = d3Array.ascending('10', '20');
+num = d3Array.ascending(new Date(2016, 6, 13), new Date(2016, 6, 14));
// descending() ----------------------------------------------------------------
-num = d3.descending(10, 20);
-num = d3.descending('10', '20');
-num = d3.descending(new Date(2016, 6, 13), new Date(2016, 6, 14));
+num = d3Array.descending(10, 20);
+num = d3Array.descending('10', '20');
+num = d3Array.descending(new Date(2016, 6, 13), new Date(2016, 6, 14));
// -----------------------------------------------------------------------------
// Test Transforming Arrays
@@ -367,20 +367,20 @@ let testArrays: MixedObject[][] = [
let mergedArray: MixedObject[];
-mergedArray = d3.merge(testArrays); // inferred type
-mergedArray = d3.merge(testArrays); // explicit type
+mergedArray = d3Array.merge(testArrays); // inferred type
+mergedArray = d3Array.merge(testArrays); // explicit type
// mergedArray = d3.merge([[10, 40, 30], [15, 30]]); // fails, type mismatch
// pairs() ---------------------------------------------------------------------
let pairs: Array<[MixedObject, MixedObject]>;
-pairs = d3.pairs(mergedArray);
+pairs = d3Array.pairs(mergedArray);
// permute() -------------------------------------------------------------------
// getting a permutation of array elements
-mergedArray = d3.permute(mergedArray, [1, 0, 2, 5, 3, 4, 6]);
+mergedArray = d3Array.permute(mergedArray, [1, 0, 2, 5, 3, 4, 6]);
// Getting an ordered array with object properties
@@ -391,35 +391,35 @@ let testObject = {
more: [10, 30, 40]
};
-let x: Array = d3.permute(testObject, ['name', 'val', 'when', 'more']);
+let x: Array = d3Array.permute(testObject, ['name', 'val', 'when', 'more']);
// range() ---------------------------------------------------------------------
-numbersArray = d3.range(10);
-numbersArray = d3.range(1, 10);
-numbersArray = d3.range(1, 10, 0.5);
+numbersArray = d3Array.range(10);
+numbersArray = d3Array.range(1, 10);
+numbersArray = d3Array.range(1, 10, 0.5);
// shuffle() -------------------------------------------------------------------
-mergedArray = d3.shuffle(mergedArray);
+mergedArray = d3Array.shuffle(mergedArray);
-mergedArray = d3.shuffle(mergedArray, 1);
+mergedArray = d3Array.shuffle(mergedArray, 1);
-mergedArray = d3.shuffle(mergedArray, 1, 3);
+mergedArray = d3Array.shuffle(mergedArray, 1, 3);
// ticks() ---------------------------------------------------------------------
-numbersArray = d3.ticks(1, 10, 5);
+numbersArray = d3Array.ticks(1, 10, 5);
// tickStep() ------------------------------------------------------------------
-numbersArray = d3.tickStep(1, 10, 5);
+numbersArray = d3Array.tickStep(1, 10, 5);
// transpose() -----------------------------------------------------------------
-testArrays = d3.transpose([
+testArrays = d3Array.transpose([
[
new MixedObject(10, new Date(2016, 6, 1)),
new MixedObject(50, new Date(2017, 4, 15))
@@ -432,7 +432,7 @@ testArrays = d3.transpose([
// zip() -----------------------------------------------------------------------
-testArrays = d3.zip(
+testArrays = d3Array.zip(
[
new MixedObject(10, new Date(2016, 6, 1)),
new MixedObject(20, new Date(2016, 7, 30)),
@@ -454,11 +454,11 @@ let tScale = scaleTime();
// Create histogram generator ==================================================
-let defaultHistogram: d3.HistogramGenerator;
-defaultHistogram = d3.histogram();
+let defaultHistogram: d3Array.HistogramGenerator;
+defaultHistogram = d3Array.histogram();
-let testHistogram: d3.HistogramGenerator;
-testHistogram = d3.histogram();
+let testHistogram: d3Array.HistogramGenerator;
+testHistogram = d3Array.histogram();
// Configure histogram generator ===============================================
@@ -501,7 +501,7 @@ domainAccessorFn = testHistogram.domain();
defaultHistogram = defaultHistogram.thresholds(3);
// with threshold count generator
-defaultHistogram = defaultHistogram.thresholds(d3.thresholdScott);
+defaultHistogram = defaultHistogram.thresholds(d3Array.thresholdScott);
// with thresholds value array
@@ -518,10 +518,10 @@ testHistogram = testHistogram.thresholds(tScale.ticks(timeYear));
// Use histogram generator =====================================================
-let defaultBins: Array>;
+let defaultBins: Array>;
defaultBins = defaultHistogram([-1, 0, 1, 1, 3, 20, 234]);
-let defaultBin: d3.Bin;
+let defaultBin: d3Array.Bin;
defaultBin = defaultBins[0];
num = defaultBin.length; // defaultBin is array
@@ -529,10 +529,10 @@ num = defaultBin[0]; // with element type number
num = defaultBin.x0; // bin lower bound is number
num = defaultBin.x1; // bin upper bound is number
-let testBins: Array>;
+let testBins: Array>;
testBins = testHistogram(mixedObjectArray);
-let testBin: d3.Bin;
+let testBin: d3Array.Bin;
testBin = testBins[0];
num = testBin.length; // defaultBin is array
@@ -544,8 +544,8 @@ date = testBin.x1; // bin upper bound is Date
// Histogram Tresholds =========================================================
-num = d3.thresholdFreedmanDiaconis([-1, 0, 1, 1, 3, 20, 234], -1, 234);
+num = d3Array.thresholdFreedmanDiaconis([-1, 0, 1, 1, 3, 20, 234], -1, 234);
-num = d3.thresholdScott([-1, 0, 1, 1, 3, 20, 234], -1, 234);
+num = d3Array.thresholdScott([-1, 0, 1, 1, 3, 20, 234], -1, 234);
-num = d3.thresholdSturges([-1, 0, 1, 1, 3, 20, 234]);
+num = d3Array.thresholdSturges([-1, 0, 1, 1, 3, 20, 234]);
diff --git a/d3-array/index.d.ts b/d3-array/index.d.ts
index 40563fa880..933f59e5a6 100644
--- a/d3-array/index.d.ts
+++ b/d3-array/index.d.ts
@@ -157,7 +157,7 @@ export function sum(array: T[], accessor: (datum: T, index: number, array: T[
export function deviation(array: number[]): number | undefined;
/**
- * Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array,
+ * Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array,
* using the given accessor to convert values to numbers.
*/
export function deviation(array: T[], accessor: (datum: T, index: number, array: T[]) => number): number | undefined;
@@ -255,7 +255,7 @@ export function range(start: number, stop: number, step?: number): number[];
export function shuffle(array: T[], lo?: number, hi?: number): T[];
/**
- * Generate an array of approximately count + 1 uniformly-spaced, nicely-rounded values between start and stop (inclusive).
+ * Generate an array of approximately count + 1 uniformly-spaced, nicely-rounded values between start and stop (inclusive).
*/
export function ticks(start: number, stop: number, count: number): number[];
@@ -274,7 +274,7 @@ export function transpose(matrix: T[][]): T[][];
/**
* Returns an array of arrays, where the ith array contains the ith element from each of the argument arrays.
- * The returned array is truncated in length to the shortest array in arrays. If arrays contains only a single array, the returned array
+ * The returned array is truncated in length to the shortest array in arrays. If arrays contains only a single array, the returned array
* contains one-element arrays. With no arguments, the returned array is empty.
*/
export function zip(...arrays: T[][]): T[][];
@@ -311,7 +311,7 @@ export interface HistogramGenerator {
/**
* Divide the domain uniformly into approximately count bins. IMPORTANT: This threshold
* setting approach only works, when the materialized values are numbers!
- *
+ *
* @param count The desired number of uniform bins.
*/
thresholds(count: number): this;
@@ -319,10 +319,10 @@ export interface HistogramGenerator {
* Set a threshold accessor function, which returns the desired number of bins.
* Divides the domain uniformly into approximately count bins. IMPORTANT: This threshold
* setting approach only works, when the materialized values are numbers!
- *
+ *
* @param count A function which accepts as arguments the array of materialized values, and
* optionally the domain minimum and maximum. The function calcutates and returns the suggested
- * number of bins.
+ * number of bins.
*/
thresholds(count: ThresholdCountGenerator): this;
/**
@@ -332,12 +332,12 @@ export interface HistogramGenerator {
*/
thresholds(thresholds: Value[]): this;
/**
- * Set a threshold accessor function, which returns the array of values to be used as
+ * Set a threshold accessor function, which returns the array of values to be used as
* thresholds in determining the bins.
- *
+ *
* @param thresholds A function which accepts as arguments the array of materialized values, and
- * optionally the domain minimum and maximum. The function calcutates and returns the array of values to be used as
- * thresholds in determining the bins.
+ * optionally the domain minimum and maximum. The function calcutates and returns the array of values to be used as
+ * thresholds in determining the bins.
*/
thresholds(thresholds: ThresholdArrayGenerator): this;
}
@@ -354,4 +354,3 @@ export function thresholdFreedmanDiaconis(values: number[], min: number, max: nu
export function thresholdScott(values: number[], min: number, max: number): number; // of type ThresholdCountGenerator
export function thresholdSturges(values: number[]): number; // of type ThresholdCountGenerator
-
diff --git a/d3-axis/d3-axis-tests.ts b/d3-axis/d3-axis-tests.ts
index 54fa6479c5..a95c58c8b3 100644
--- a/d3-axis/d3-axis-tests.ts
+++ b/d3-axis/d3-axis-tests.ts
@@ -13,6 +13,7 @@ import {
scaleOrdinal,
ScaleOrdinal,
scalePow,
+ ScalePower,
scaleTime,
ScaleTime,
} from 'd3-scale';
@@ -70,11 +71,17 @@ let leftAxis: d3Axis.Axis = d3Axis.axisLeft(scal
// scale(...) ----------------------------------------------------------------
leftAxis = leftAxis.scale(scalePow());
+let powerScale: ScalePower = leftAxis.scale>();
+// powerScale = leftAxis.scale(); // fails, without casting as AxisScale is purposely generic
+
+
+bottomAxis = bottomAxis.scale(scaleOrdinal());
// bottomAxis = bottomAxis.scale(scalePow()) // fails, domain of scale incompatible with domain of axis
let axisScale: d3Axis.AxisScale = bottomAxis.scale();
-// let ordinalScale: ScaleOrdinal = bottomAxis.scale(); // fails, without casting as AxisScale is purposely generic
+let ordinalScale: ScaleOrdinal = bottomAxis.scale>();
+// ordinalScale = bottomAxis.scale(); // fails, without casting as AxisScale is purposely generic
// ticks(...) ----------------------------------------------------------------
diff --git a/d3-axis/index.d.ts b/d3-axis/index.d.ts
index 33c3b2927f..233dd5f40d 100644
--- a/d3-axis/index.d.ts
+++ b/d3-axis/index.d.ts
@@ -1,11 +1,10 @@
// Type definitions for D3JS d3-axis module 1.0.0
// Project: https://github.com/d3/d3-axis/
-// Definitions by: Alex Ford , Boris Yankov , Tom Wanzek
+// Definitions by: Tom Wanzek , Alex Ford , Boris Yankov
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Selection, TransitionLike } from 'd3-selection';
-
// --------------------------------------------------------------------------
// Shared Types and Interfaces
// --------------------------------------------------------------------------
@@ -67,14 +66,14 @@ export interface Axis {
/**
* Gets the current scale underlying the axis.
*/
- scale(): AxisScale;
+ scale>(): A;
/**
* Sets the scale and returns the axis.
*
* @param scale The scale to be used for axis generation
*/
- scale(scale: AxisScale): Axis;
+ scale(scale: AxisScale): this;
/**
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
@@ -82,7 +81,7 @@ export interface Axis {
* @param count Number of ticks that should be rendered
* @param specifier An optional format specifier to customize how the tick values are formatted.
*/
- ticks(count: number, specifier?: string): Axis;
+ ticks(count: number, specifier?: string): this;
/**
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
@@ -92,12 +91,12 @@ export interface Axis {
* in d3-time. E.g. as obtained by passing in d3.timeMinute.every(15).
* @param specifier An optional format specifier to customize how the tick values are formatted.
*/
- ticks(interval: AxisTimeInterval, specifier?: string): Axis;
+ ticks(interval: AxisTimeInterval, specifier?: string): this;
/**
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
*/
- ticks(arg0: any, ...args: any[]): Axis;
+ ticks(arg0: any, ...args: any[]): this;
/**
* Get an array containing the currently set arguments to be passed into scale.ticks and scale.tickFormat.
@@ -109,7 +108,7 @@ export interface Axis {
*
* @param args An array containing a single element representing the count, i.e. number of ticks to be rendered.
*/
- tickArguments(args: [number]): Axis;
+ tickArguments(args: [number]): this;
/**
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
@@ -117,7 +116,7 @@ export interface Axis {
* @param args An array containing two elements. The first element represents the count, i.e. number of ticks to be rendered. The second
* element is a string representing the format specifier to customize how the tick values are formatted.
*/
- tickArguments(args: [number, string]): Axis;
+ tickArguments(args: [number, string]): this;
/**
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
@@ -126,7 +125,7 @@ export interface Axis {
* @param args An array containing a single element representing a time interval used to generate date-based ticks.
* This is typically a TimeInterval/CountableTimeInterval as defined in d3-time. E.g. as obtained by passing in d3.timeMinute.every(15).
*/
- tickArguments(args: [AxisTimeInterval]): Axis;
+ tickArguments(args: [AxisTimeInterval]): this;
/**
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
@@ -136,14 +135,14 @@ export interface Axis {
* This is typically a TimeInterval/CountableTimeInterval as defined in d3-time. E.g. as obtained by passing in d3.timeMinute.every(15).
* The second element is a string representing the format specifier to customize how the tick values are formatted.
*/
- tickArguments(args: [AxisTimeInterval, string]): Axis;
+ tickArguments(args: [AxisTimeInterval, string]): this;
/**
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
*
* @param args An array with arguments suitable for the scale to be used for tick generation
*/
- tickArguments(args: any[]): Axis;
+ tickArguments(args: any[]): this;
/**
* Returns the current tick values, which defaults to null.
@@ -158,14 +157,14 @@ export interface Axis {
*
* @param values An array with values from the Domain of the scale underlying the axis.
*/
- tickValues(values: Domain[]): Axis;
+ tickValues(values: Domain[]): this;
/**
* Clears any previously-set explicit tick values and reverts back to the scale’s tick generator.
*
* @param values null
*/
- tickValues(values: null): Axis;
+ tickValues(values: null): this;
/**
@@ -179,7 +178,7 @@ export interface Axis {
* @param format A function mapping a value from the axis Domain to a formatted string
* for display purposes.
*/
- tickFormat(format: (domainValue: Domain) => string): Axis;
+ tickFormat(format: (domainValue: Domain) => string): this;
/**
* Reset the tick format function. A null format indicates that the scale’s
@@ -189,7 +188,7 @@ export interface Axis {
*
* @param format null
*/
- tickFormat(format: null): Axis;
+ tickFormat(format: null): this;
/**
* Get the current inner tick size, which defaults to 6.
@@ -200,7 +199,7 @@ export interface Axis {
*
* @param size Tick size in pixels (Default is 6).
*/
- tickSize(size: number): Axis;
+ tickSize(size: number): this;
/**
* Get the current inner tick size, which defaults to 6.
@@ -216,7 +215,7 @@ export interface Axis {
*
* @param size Tick size in pixels (Default is 6).
*/
- tickSizeInner(size: number): Axis;
+ tickSizeInner(size: number): this;
/**
* Get the current outer tick size, which defaults to 6.
@@ -240,7 +239,7 @@ export interface Axis {
*
* @param size Tick size in pixels (Default is 6).
*/
- tickSizeOuter(size: number): Axis;
+ tickSizeOuter(size: number): this;
/**
* Get the current padding, which defaults to 3.
@@ -252,7 +251,7 @@ export interface Axis {
*
* @param padding Padding in pixels (Default is 3).
*/
- tickPadding(padding: number): Axis;
+ tickPadding(padding: number): this;
}
diff --git a/d3-brush/index.d.ts b/d3-brush/index.d.ts
index a91946b5c9..bfca8da856 100644
--- a/d3-brush/index.d.ts
+++ b/d3-brush/index.d.ts
@@ -1,9 +1,9 @@
// Type definitions for D3JS d3-brush module 1.0.1
// Project: https://github.com/d3/d3-brush/
-// Definitions by: Alex Ford , Boris Yankov , Tom Wanzek
+// Definitions by: Tom Wanzek , Alex Ford , Boris Yankov
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-import { ArrayLike, Selection, TransitionLike } from 'd3-selection';
+import { ArrayLike, Selection, TransitionLike, ValueFn } from 'd3-selection';
/**
* Type alias for a BrushSelection. For a two-dimensional brush, it must be defined as [[x0, y0], [x1, y1]],
@@ -15,20 +15,20 @@ export type BrushSelection = [[number, number], [number, number]] | [number, num
export interface BrushBehavior {
(group: Selection, ...args: any[]): void;
- move(group: Selection, selection: BrushSelection): BrushBehavior;
- move(group: Selection, selection: (this: SVGGElement, d?: Datum, i?: number, group?: Array | ArrayLike) => BrushSelection): BrushBehavior;
- move(group: TransitionLike, selection: BrushSelection): BrushBehavior;
- move(group: TransitionLike, selection: (this: SVGGElement, d?: Datum, i?: number, group?: Array | ArrayLike) => BrushSelection): BrushBehavior;
- extent(): (this: SVGGElement, d: Datum, i: number, group: Array | ArrayLike) => [[number, number], [number, number]];
- extent(extent: [[number, number], [number, number]]): BrushBehavior;
- extent(extent: (this: SVGGElement, d: Datum, i: number, group: Array | ArrayLike) => [[number, number], [number, number]]): BrushBehavior;
- filter(): (this: SVGGElement, datum: Datum, index: number, group: Array | ArrayLike) => boolean;
- filter(filterFn: (this: SVGGElement, datum: Datum, index: number, group: Array | ArrayLike) => boolean): BrushBehavior;
+ move(group: Selection, selection: BrushSelection): void;
+ move(group: Selection, selection: ValueFn): void;
+ move(group: TransitionLike, selection: BrushSelection): void;
+ move(group: TransitionLike, selection: ValueFn): void;
+ extent(): ValueFn;
+ extent(extent: [[number, number], [number, number]]): this;
+ extent(extent: ValueFn): this;
+ filter(): ValueFn;
+ filter(filterFn: ValueFn): this;
handleSize(): number;
- handleSize(size: number): BrushBehavior;
- on(typenames: string): (this: SVGGElement, datum: Datum, index: number, group: Array | ArrayLike) => void;
- on(typenames: string, callback: null): BrushBehavior;
- on(typenames: string, callback: (this: SVGGElement, datum: Datum, index: number, group: Array | ArrayLike) => void): BrushBehavior;
+ handleSize(size: number): this;
+ on(typenames: string): ValueFn;
+ on(typenames: string, callback: null): this;
+ on(typenames: string, callback: ValueFn): this;
}
diff --git a/d3-chord/index.d.ts b/d3-chord/index.d.ts
index 3c232c15a6..f78cb62b78 100644
--- a/d3-chord/index.d.ts
+++ b/d3-chord/index.d.ts
@@ -1,6 +1,6 @@
// Type definitions for D3JS d3-chord module 1.0.0
// Project: https://github.com/d3/d3-chord/
-// Definitions by: Alex Ford , Boris Yankov , Tom Wanzek
+// Definitions by: Tom Wanzek , Alex Ford , Boris Yankov
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// ---------------------------------------------------------------------
@@ -34,16 +34,16 @@ export interface Chords extends Array {
export interface ChordLayout {
(matrix: number[][]): Chords;
padAngle(): number;
- padAngle(angle: number): ChordLayout;
+ padAngle(angle: number): this;
sortGroups(): ((a: number, b: number) => number) | null;
- sortGroups(compare: null): ChordLayout;
- sortGroups(compare: (a: number, b: number) => number): ChordLayout;
+ sortGroups(compare: null): this;
+ sortGroups(compare: (a: number, b: number) => number): this;
sortSubgroups(): ((a: number, b: number) => number) | null;
- sortSubgroups(compare: null): ChordLayout;
- sortSubgroups(compare: (a: number, b: number) => number): ChordLayout;
+ sortSubgroups(compare: null): this;
+ sortSubgroups(compare: (a: number, b: number) => number): this;
sortChords(): ((a: number, b: number) => number) | null;
- sortChords(compare: null): ChordLayout;
- sortChords(compare: (a: number, b: number) => number): ChordLayout;
+ sortChords(compare: null): this;
+ sortChords(compare: (a: number, b: number) => number): this;
}
export function chord(): ChordLayout;
@@ -56,21 +56,21 @@ export function chord(): ChordLayout;
export interface RibbonGenerator {
(this: This, d: ChordDatum, ...args: any[]): string | undefined;
source(): (this: This, d: ChordDatum, ...args: any[]) => ChordSubgroupDatum;
- source(source: (this: This, d: ChordDatum, ...args: any[]) => ChordSubgroupDatum): RibbonGenerator;
+ source(source: (this: This, d: ChordDatum, ...args: any[]) => ChordSubgroupDatum): this;
target(): (this: This, d: ChordDatum, ...args: any[]) => ChordSubgroupDatum;
- target(target: (this: This, d: ChordDatum, ...args: any[]) => ChordSubgroupDatum): RibbonGenerator;
+ target(target: (this: This, d: ChordDatum, ...args: any[]) => ChordSubgroupDatum): this;
radius(): (this: This, d: ChordSubgroupDatum, ...args: any[]) => number;
- radius(radius: number): RibbonGenerator;
- radius(radius: (this: This, d: ChordSubgroupDatum, ...args: any[]) => number): RibbonGenerator;
+ radius(radius: number): this;
+ radius(radius: (this: This, d: ChordSubgroupDatum, ...args: any[]) => number): this;
startAngle(): (this: This, d: ChordSubgroupDatum, ...args: any[]) => number;
- startAngle(angle: number): RibbonGenerator