Merge remote-tracking branch 'upstream/master' into twitter-stream-channels

This commit is contained in:
Adi Bardan
2017-10-05 09:55:05 +02:00
3163 changed files with 42223 additions and 10009 deletions
+2 -3
View File
@@ -12,9 +12,8 @@ declare class sequence<T = any> {
private typekey: sequence<T>;
}
declare class SafeArray<T = any> {
private typekey: SafeArray<T>;
}
// tslint:disable-next-line no-empty-interface
interface SafeArray<T = any> {}
declare namespace com.sun.star {
namespace accessibility {
+1
View File
@@ -3,6 +3,7 @@ import * as amqp from 'amqp';
async function connect() {
const promise = new Promise<amqp.AMQPClient>((resolve, reject) => {
const client = amqp.createConnection({
clientProperties: { applicationName: 'typing' },
url: 'amqp://admin:password@localhost:5672'
});
+15 -1
View File
@@ -1,6 +1,7 @@
// Type definitions for amqp 0.2
// Project: https://github.com/postwait/node-amqp
// Definitions by: Carl Winkler <https://github.com/seikho>
// Mark Line <https://github.com/jonnysparkplugs>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -90,7 +91,7 @@ export interface ConnectionOptions {
url?: string;
port?: number;
login?: string;
passowrd?: string;
password?: string;
connectionTimeout?: number;
authMechanism?: string;
vhost?: string;
@@ -125,6 +126,19 @@ export interface ConnectionOptions {
/** Default: 1000 */
reconnectBackoffTime?: number;
clientProperties?: {
applicationName?: string;
capabilities?: {
consumer_cancel_notify?: boolean
}
/** Default: 'node-' + process.version */
platform?: string;
/** Default: node-amqp */
product?: string;
/** Default: 'nodeAMQPVersion' */
version?: string;
};
}
export interface QueueOptions {
@@ -13,13 +13,12 @@ class TestController {
app.controller('TestController', TestController);
var barConfig: angular.loadingBar.ILoadingBarProvider[] = [];
barConfig.push({
includeSpinner: true,
includeBar: true,
spinnerTemplate: 'template',
latencyThreshold: 100,
startSize: 0.02,
loadingBarTemplate: '',
autoIncrement: true
});
var barConfig: angular.loadingBar.ILoadingBarProvider;
barConfig.includeSpinner = false;
barConfig.includeBar = false;
barConfig.spinnerTemplate = 'someOtherTemplateString';
barConfig.latencyThreshold = 70;
barConfig.startSize = 0.05;
barConfig.loadingBarTemplate = 'anotherTemplateString';
barConfig.autoIncrement = false;
+27
View File
@@ -54,6 +54,33 @@ declare module 'angular' {
* Give illusion that there's always progress
*/
autoIncrement?: boolean;
/**
* Broadcast the start event
*/
start(): void;
/**
* Set the percentage completed
* @param {number} n - number between 0 and 1
*/
set(n: number): void;
/**
* Get the percentage completed
* @returns {number}
*/
status(): number;
/**
* Increment the loading bar
*/
inc(): void;
/**
* Complete the loading bar
*/
complete(): void;
}
}
+84 -82
View File
@@ -1,9 +1,11 @@
import $ = require('jquery');
import * as angular from 'angular';
// Fix TODOs once https://github.com/Microsoft/TypeScript/issues/18910 is fixed
function JQuery() {
function indexSignature() {
$('p')[0]; // $ExpectType HTMLElement
$('p')[0]; // TODO: $ExpectType HTMLElement
}
function addClass() {
@@ -12,7 +14,7 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('p').addClass(function(index, currentClassName) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType number
index;
@@ -35,7 +37,7 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('#greatphoto').attr('alt', function(index, attr) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType number
index;
@@ -47,7 +49,7 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('#greatphoto').attr('width', function(index, attr) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType number
index;
@@ -59,7 +61,7 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('#greatphoto').attr('title', function(index, attr) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType number
index;
@@ -69,7 +71,7 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('#greatphoto').attr('title', function(index, attr) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType number
index;
@@ -96,9 +98,9 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('p').bind('myEvent', 'myData', function(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
@@ -106,15 +108,15 @@ function JQuery() {
$('p').bind('myEvent', 'myData', function(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
// $ExpectType JQuery<HTMLElement>
$('p').bind('myEvent', function(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
@@ -122,7 +124,7 @@ function JQuery() {
$('p').bind('myEvent', function(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
@@ -133,15 +135,15 @@ function JQuery() {
$('p').bind({
myEvent1: false,
myEvent2(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
}
});
@@ -162,13 +164,13 @@ function JQuery() {
}
function off() {
function defaultContext_defaultData(this: HTMLElement, event: JQuery.Event<HTMLElement>) { }
function defaultContext_defaultData(this: HTMLElement, event: JQueryEventObject) { }
function defaultContext_customData(this: HTMLElement, event: JQuery.Event<HTMLElement, string>) { }
function defaultContext_customData(this: HTMLElement, event: JQueryEventObject) { }
function customContext_defaultData(this: I1, event: JQuery.Event<HTMLElement>) { }
function customContext_defaultData(this: I1, event: JQueryEventObject) { }
function customContext_customData(this: I1, event: JQuery.Event<HTMLElement, string>) { }
function customContext_customData(this: I1, event: JQueryEventObject) { }
interface I1 { kind: 'I1'; }
@@ -238,9 +240,9 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', 'td', 'myData', function(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
@@ -248,15 +250,15 @@ function JQuery() {
$('table').on('myEvent', 'td', 'myData', function(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', null, 'myData', function(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
@@ -264,15 +266,15 @@ function JQuery() {
$('table').on('myEvent', null, 'myData', function(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', 'td', function(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
@@ -280,7 +282,7 @@ function JQuery() {
$('table').on('myEvent', 'td', function(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
@@ -289,9 +291,9 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', 3, function(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, number>
// TODO: $ExpectType Event<HTMLElement, number>
event;
});
@@ -299,15 +301,15 @@ function JQuery() {
$('table').on('myEvent', 3, function(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, number>
// TODO: $ExpectType Event<HTMLElement, number>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', function(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
@@ -315,7 +317,7 @@ function JQuery() {
$('table').on('myEvent', function(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
@@ -326,15 +328,15 @@ function JQuery() {
$('table').on({
myEvent1: false,
myEvent2(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
}
}, 'td', 'myData');
@@ -343,15 +345,15 @@ function JQuery() {
$('table').on({
myEvent1: false,
myEvent2(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
}
}, null, 'myData');
@@ -360,15 +362,15 @@ function JQuery() {
$('table').on({
myEvent1: false,
myEvent2(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
}
}, 'td');
@@ -377,15 +379,15 @@ function JQuery() {
$('table').on({
myEvent1: false,
myEvent2(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, number>
// TODO: $ExpectType Event<HTMLElement, number>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, number>
// TODO: $ExpectType Event<HTMLElement, number>
event;
}
}, 3);
@@ -394,15 +396,15 @@ function JQuery() {
$('table').on({
myEvent1: false,
myEvent2(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
}
});
@@ -413,9 +415,9 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', 'td', 'myData', function(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
@@ -423,15 +425,15 @@ function JQuery() {
$('table').one('myEvent', 'td', 'myData', function(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', null, 'myData', function(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
@@ -439,15 +441,15 @@ function JQuery() {
$('table').one('myEvent', null, 'myData', function(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', 'td', function(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
@@ -455,7 +457,7 @@ function JQuery() {
$('table').one('myEvent', 'td', function(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
@@ -464,9 +466,9 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', 3, function(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, number>
// TODO: $ExpectType Event<HTMLElement, number>
event;
});
@@ -474,15 +476,15 @@ function JQuery() {
$('table').one('myEvent', 3, function(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, number>
// TODO: $ExpectType Event<HTMLElement, number>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', function(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
@@ -490,7 +492,7 @@ function JQuery() {
$('table').one('myEvent', function(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
@@ -501,15 +503,15 @@ function JQuery() {
$('table').one({
myEvent1: false,
myEvent2(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
}
}, 'td', 'myData');
@@ -518,15 +520,15 @@ function JQuery() {
$('table').one({
myEvent1: false,
myEvent2(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, string>
// TODO: $ExpectType Event<HTMLElement, string>
event;
}
}, null, 'myData');
@@ -535,15 +537,15 @@ function JQuery() {
$('table').one({
myEvent1: false,
myEvent2(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
}
}, 'td');
@@ -552,15 +554,15 @@ function JQuery() {
$('table').one({
myEvent1: false,
myEvent2(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, number>
// TODO: $ExpectType Event<HTMLElement, number>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, number>
// TODO: $ExpectType Event<HTMLElement, number>
event;
}
}, 3);
@@ -569,15 +571,15 @@ function JQuery() {
$('table').one({
myEvent1: false,
myEvent2(event) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// $ExpectType Event<HTMLElement, null>
// TODO: $ExpectType Event<HTMLElement, null>
event;
}
});
@@ -589,7 +591,7 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('p').removeClass(function(index, currentClassName) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType number
index;
@@ -609,7 +611,7 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('p').toggleClass(function(index, className, state) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType number
index;
@@ -626,7 +628,7 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('p').toggleClass(function(index, className, state) {
// $ExpectType HTMLElement
// TODO: $ExpectType HTMLElement
this;
// $ExpectType number
index;
+1
View File
@@ -14,6 +14,7 @@
"max-line-length": false,
"no-empty-interface": false,
"no-namespace": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-void-expression": false,
"unified-signatures": false,
@@ -0,0 +1,30 @@
import {
downloadSchema,
generate,
introspectSchema,
printSchema
} from "apollo-codegen";
async function main() {
await downloadSchema(
"http://example.com/graphql",
"schema.json",
{},
false,
"POST"
);
generate(["input.ts"], "schema.json", "types.ts", "typescript", "gql", {
passthroughCustomScalars: false,
customScalarsPrefix: "S",
addTypename: false,
namespace: "",
operationIdsPath: null,
generateOperationIds: false,
mergeInFieldsFromFragmentSpreads: false
});
await introspectSchema("schema.json", "schema.gql");
await printSchema("schema.in", "schema.out");
}
+40
View File
@@ -0,0 +1,40 @@
// Type definitions for apollo-codegen 0.16
// Project: https://github.com/apollographql/apollo-codegen
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export function downloadSchema(
url: string,
outputPath: string,
additionalHeaders: { [name: string]: string },
insecure: boolean,
method: string
): Promise<void>;
export function introspectSchema(
schemaPath: string,
outputPath: string
): Promise<void>;
export function printSchema(
schemaPath: string,
outputPath: string
): Promise<void>;
export function generate(
inputPaths: string[],
schemaPath: string,
outputPath: string,
target: "json" | "swift" | "ts" | "typescript" | "flow" | "scala",
tagName: string,
options: {
passthroughCustomScalars: boolean;
customScalarsPrefix: string;
addTypename: boolean;
namespace: string;
operationIdsPath: string | null;
generateOperationIds: boolean;
mergeInFieldsFromFragmentSpreads: boolean;
}
): void;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"apollo-codegen-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+6964 -6220
View File
File diff suppressed because it is too large Load Diff
+96 -36
View File
@@ -1,4 +1,4 @@
// Type definitions for ArcGIS API for JavaScript 3.21
// Type definitions for ArcGIS API for JavaScript 3.22
// Project: https://developers.arcgis.com/javascript/3/
// Definitions by: Esri <https://github.com/Esri>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -284,6 +284,8 @@ declare module "esri" {
columnDelimiter?: string;
/** Copyright information for the layer. */
copyright?: string;
/** Enables feature reduction (for example clustering) on point layers. */
featureReduction?: any;
/** The fields property contains objects with "name", "alias" and "type" String properties. */
fields?: any[];
/** The latitude field name. */
@@ -608,13 +610,13 @@ declare module "esri" {
locationProvider: LocationProviderBase;
}
export interface DataBrowserOptions {
/** Whether or not to display the hierarchy dropdown for countries with multiple hierarchies (e.g. */
/** Whether or not to display the hierarchy dropdown for countries with multiple hierarchies (for example USA has both Census and Landscape, Germany has both Census and Nexiga). */
allowHierarchies?: boolean;
/** Show/hide country drop down. */
countryBox?: boolean;
/** Two-digit country code selected in the country drop down. */
countryID?: string;
/** The hierarchy to load for a country (e.g. */
/** The hierarchy to load for a country (for example 'Census' or 'Landscape' for USA). */
hierarchyID?: string;
/** Text string to display on the back button on the second and third pages of the Data Browser. */
pageBackButton?: string;
@@ -896,6 +898,8 @@ declare module "esri" {
displayOnPan?: boolean;
/** Set a callback function that will be invoked by FeatureLayer.getEditSummary. */
editSummaryCallback?: Function;
/** Enables feature reduction (for example clustering) on point layers. */
featureReduction?: any;
/** Specify the geodatabase version to display. */
gdbVersion?: string;
/** Unique ID to assign to the layer. */
@@ -1172,7 +1176,7 @@ declare module "esri" {
remove(): void;
}
export interface HeatmapRendererOptions {
/** The radius (in pixels) of the circle over which the majority of each points value is spread out over. */
/** The radius (in pixels) of the circle over which the majority of each point's value is spread out. */
blurRadius?: number;
/** An array of CSS color strings (#RGB, #RRGGBB, rgb(r,g,b), rgba(r,g,b,a)). */
colors: string[];
@@ -1718,7 +1722,7 @@ declare module "esri" {
pixels: number[][];
/** Pixel type. */
pixelType?: string;
/** Array of objects containing numeric statistical properties (e.g. */
/** Array of objects containing numeric statistical properties (for example minValue, maxValue, noDataValue, etc.). */
statistics?: any[];
/** Number of columns. */
width: number;
@@ -1856,7 +1860,7 @@ declare module "esri" {
primaryHandle?: number;
/** Toggle for showing the black handle bars. */
showHandles?: boolean;
/** Flexible toggle for showing labels (e.g. */
/** Flexible toggle for showing labels (for example ["data", "handle"]). */
showLabels?: boolean | string[];
/** Toggle for showing the horizontal line indicators from the center of the handle. */
showTicks?: boolean;
@@ -2153,7 +2157,7 @@ declare module "esri" {
}
export interface TemplatePickerOptions {
/** Number of visible columns. */
columns?: number;
columns?: number | string;
/** Defines the text to be displayed when the template picker does not have any templates to display. */
emptyMessage?: string;
/** Array of input feature layers. */
@@ -2165,7 +2169,7 @@ declare module "esri" {
/** Length of label description. */
maxLabelLength?: number;
/** Number of visible rows. */
rows?: number;
rows?: number | string;
/** Tooltip content contains the template name and description. */
showTooltip?: boolean;
/** HTML style attributes for the widget. */
@@ -3488,7 +3492,7 @@ declare module "esri/dijit/BasemapGallery" {
basemaps: Basemap[];
/** This value is true after the BasemapGallery retrieves the ArcGIS.com basemaps. */
loaded: boolean;
/** Optional parameter to pass in a portal URL, including the instance name, used to access the group containing the basemap gallery items. */
/** Optional parameter to pass in a portal URL, including the instance name, used to access the group containing the basemap gallery items, for example www.myportal.com/myInstance or http://www.myportal.com/myInstance. */
portalUrl: string;
/**
* Creates a new BasemapGallery dijit.
@@ -4567,8 +4571,8 @@ declare module "esri/dijit/InfoWindow" {
/** Determines whether the InfoWindow is currently shown on the map. */
isShowing: boolean;
/**
* Create a new Info Window.
* @param params Optional parameters.
* Create a new InfoWindow.
* @param params Specify optional parameters used to create the InfoWindow.
* @param srcNodeRef Reference or id of the HTML element where the widget should be rendered.
*/
constructor(params: any, srcNodeRef: Node | string);
@@ -4633,6 +4637,12 @@ declare module "esri/dijit/InfoWindowLite" {
fixedAnchor: string;
/** Determines whether the InfoWindowLite is currently shown on the map. */
isShowing: boolean;
/**
* Create a new InfoWindowLite.
* @param params Specify optional parameters used to create the InfoWindowLite.
* @param srcNodeRef Reference or id of the HTML element where the widget should be rendered.
*/
constructor(params: any, srcNodeRef: Node | string);
/** Hides the InfoWindow. */
hide(): void;
/**
@@ -5117,8 +5127,8 @@ declare module "esri/dijit/OverviewMap" {
declare module "esri/dijit/Popup" {
import esri = require("esri");
import InfoWindowBase = require("esri/InfoWindowBase");
import Graphic = require("esri/graphic");
import FillSymbol = require("esri/symbols/FillSymbol");
import Graphic = require("esri/graphic");
import LineSymbol = require("esri/symbols/LineSymbol");
import Point = require("esri/geometry/Point");
import MarkerSymbol = require("esri/symbols/MarkerSymbol");
@@ -5127,6 +5137,8 @@ declare module "esri/dijit/Popup" {
class Popup extends InfoWindowBase {
/** Controls the placement of the popup window with respect to the geographic location. */
anchor: string;
/** Visualizes the extent of the points summarized by the cluster graphic when the user selects the "Browse Features" action in the cluster popup. */
clusterFillSymbol: FillSymbol;
/** The number of features associated with the info window. */
count: number;
/** An array of pending deferreds, null if there are not any pending deferreds. */
@@ -5179,16 +5191,28 @@ declare module "esri/dijit/Popup" {
* @param srcNodeRef Reference or id of the HTML element where the widget should be rendered.
*/
constructor(options: esri.PopupOptions, srcNodeRef: Node | string);
/**
* Creates links for the specified actions at the bottom of the popup window.
* @param actions An array of action objects that define the behavior for actions included in the popup.
*/
addActions(actions: any[]): any[];
/** Removes all features and destroys any pending deferreds. */
clearFeatures(): void;
/** Destroy the popup. */
destroy(): void;
/** Returns the current placement of the popup window. */
getCurrentAnchor(): string;
/** Get the currently selected feature. */
getSelectedFeature(): Graphic;
/** Hide the info window. */
hide(): void;
/** Maximize the info window. */
maximize(): void;
/**
* Removes the specified actions from the popup window.
* @param actionInfos An array of objects that describe actions created with addActions().
*/
removeActions(actionInfos: any[]): void;
/** Re-calculates the popup's position with respect to the map location it is pointing to. */
reposition(): void;
/**
@@ -5222,8 +5246,9 @@ declare module "esri/dijit/Popup" {
/**
* Associate an array of features or an array of deferreds that return features with the info window.
* @param features An array of features or deferreds.
* @param options Additional options for setting features in the popup.
*/
setFeatures(features: Graphic[] | any[]): void;
setFeatures(features: Graphic[] | any[], options?: any): void;
/**
* Sets the info window title.
* @param title The text for the title.
@@ -5332,8 +5357,6 @@ declare module "esri/dijit/PopupTemplate" {
/** The PopupTemplate class extends esri/InfoTemplate and provides support for defining a layout. */
class PopupTemplate extends InfoTemplate {
/** An array of objects that reference Arcade expressions. */
expressionInfos: any[];
/** The popup definition defined as a JavaScript object. */
info: any;
/**
@@ -5399,7 +5422,7 @@ declare module "esri/dijit/RendererSlider" {
precision: number;
/** Toggle for showing the black handle bars. */
showHandles: boolean;
/** Flexible toggle for showing labels e.g. */
/** Flexible toggle for showing labels, for example ["data","handle"]. */
showLabels: boolean | string[];
/** Toggle for showing the horizontal line indicators from the center of the handle. */
showTicks: boolean;
@@ -7991,10 +8014,10 @@ declare module "esri/geometry/geometryEngine" {
clip(geometry: Geometry, envelope: Extent): Geometry;
/**
* Indicates if one geometry contains another geometry.
* @param geometry1 The geometry that is tested for the contains relationship to the other geometry.
* @param geometry2 The geometry that is tested for within relationship to the other geometry.
* @param containerGeometry The geometry that is tested for the "contains" relationship to the other geometry.
* @param insideGeometry The geometry that is tested for the "within" relationship to the containerGeometry.
*/
contains(geometry1: Geometry, geometry2: Geometry): boolean;
contains(containerGeometry: Geometry, insideGeometry: Geometry): boolean;
/**
* Calculates the convex hull of the input geometry.
* @param geometry The input geometry.
@@ -8200,10 +8223,10 @@ declare module "esri/geometry/geometryEngine" {
union(geometries: Geometry[]): Geometry;
/**
* Indicates if one geometry is within another geometry.
* @param geometry1 The base geometry that is tested for within relationship to the other geometry.
* @param geometry2 The comparison geometry that is tested for the contains relationship to the other geometry.
* @param innerGeometry The base geometry that is tested for within relationship to the other geometry.
* @param outerGeometry The comparison geometry that is tested for the contains relationship to the other geometry.
*/
within(geometry1: Geometry, geometry2: Geometry): boolean;
within(innerGeometry: Geometry, outerGeometry: Geometry): boolean;
};
export = geometryEngine;
}
@@ -8234,10 +8257,10 @@ declare module "esri/geometry/geometryEngineAsync" {
clip(geometry: Geometry, envelope: Extent): any;
/**
* Indicates if one geometry contains another geometry.
* @param geometry1 The geometry that is tested for the contains relationship to the other geometry.
* @param geometry2 The geometry that is tested for within relationship to the other geometry.
* @param containerGeometry The geometry that is tested for the "contains" relationship to the other geometry.
* @param insideGeometry The geometry that is tested for the "within" relationship to the containerGeometry.
*/
contains(geometry1: Geometry, geometry2: Geometry): any;
contains(containerGeometry: Geometry, insideGeometry: Geometry): any;
/**
* Calculates the convex hull of the input geometry.
* @param geometry The input geometry.
@@ -8443,10 +8466,10 @@ declare module "esri/geometry/geometryEngineAsync" {
union(geometries: Geometry[]): any;
/**
* Indicates if one geometry is within another geometry.
* @param geometry1 The base geometry that is tested for within relationship to the other geometry.
* @param geometry2 The comparison geometry that is tested for the contains relationship to the other geometry.
* @param innerGeometry The base geometry that is tested for within relationship to the other geometry.
* @param outerGeometry The comparison geometry that is tested for the contains relationship to the other geometry.
*/
within(geometry1: Geometry, geometry2: Geometry): any;
within(innerGeometry: Geometry, outerGeometry: Geometry): any;
};
export = geometryEngineAsync;
}
@@ -8664,8 +8687,15 @@ declare module "esri/graphic" {
* @param value The value of the attribute.
*/
attr(name: string, value: string): Graphic;
/** Creates a deep clone of the graphic object. */
clone(): Graphic;
/** Draws the graphic. */
draw(): Graphic;
/**
* Returns the graphics summarized by the given aggregate graphic in a clustering or feature reduction visualization.
* @param aggregateGraphic A graphic representing the aggregation (or reduction) of several individual graphics in a layer.
*/
getChildGraphics(aggregateGraphic: Graphic): Graphic[];
/** Returns the content string based on attributes and infoTemplate values. */
getContent(): string;
/** Returns the dojo/gfx/shape.Shape of the Esri graphic. */
@@ -8688,6 +8718,8 @@ declare module "esri/graphic" {
getTitle(): string;
/** Hides the graphic. */
hide(): void;
/** Indicates if the graphic represents a cluster of features. */
isAggregate(): boolean;
/**
* Defines the attributes of the graphic.
* @param attributes The name value pairs of fields and field values associated with the graphic.
@@ -9055,7 +9087,7 @@ declare module "esri/layers/ArcGISImageServiceLayer" {
timeInfo: TimeInfo;
/** By default, images are exported in MIME format, and the image is streamed to the client. */
useMapImage: boolean;
/** The version of ArcGIS Server the image service is published to, e.g. */
/** The version of ArcGIS Server the image service is published to, such as 9.3, 9.31, 10, 10.41. */
version: number;
/**
* Creates a new ArcGISImageServiceLayer object.
@@ -9073,7 +9105,7 @@ declare module "esri/layers/ArcGISImageServiceLayer" {
getDefinitionExpression(): string;
/** Get key properties of an ImageService including information such as the band names associated with the imagery. */
getKeyProperties(): any;
/** Asynchronously returns the raster attribute table of an ImageService which returns categorical mapping of pixel values (e.g. */
/** Asynchronously returns the raster attribute table of an ImageService which returns categorical mapping of pixel values (for example a class, group, category, or membership). */
getRasterAttributeTable(): any;
/** Gets the currently visible rasters. */
getVisibleRasters(): Graphic[];
@@ -9651,6 +9683,12 @@ declare module "esri/layers/FeatureLayer" {
* @param errback An error object is returned if an error occurs.
*/
deleteAttachments(objectId: number, attachmentIds: number[], callback?: Function, errback?: Function): any;
/** Disables feature reduction (for example clustering) on the layer. */
disableFeatureReduction(): void;
/** Enables feature reduction (for example clustering) on the layer using the options set in setFeatureReduction(). */
enableFeatureReduction(): void;
/** Returns graphics representing the aggregation of several point features clustered together. */
getAggregateGraphics(): Graphic[];
/** Asynchrously returns custom data for the layer when available. */
getAttributionData(): any;
/** Returns the current definition expression. */
@@ -9678,6 +9716,8 @@ declare module "esri/layers/FeatureLayer" {
* @param options See the object specifications table below for the structure of the options object.
*/
getEditSummary(feature: Graphic, options?: any): string;
/** Returns the options used to reduce the number of features visualized by the layer (for example clustering). */
getFeatureReduction(): any;
/**
* Returns the Field given the specified field name.
* @param fieldName Name of the attribute field.
@@ -9691,6 +9731,8 @@ declare module "esri/layers/FeatureLayer" {
getSelectedFeatures(): Graphic[];
/** Gets the current selection symbol. */
getSelectionSymbol(): Symbol;
/** Returns graphics from the layer that are not represented by aggregate graphics when feature reduction (such as clustering) is enabled. */
getSingleGraphics(): Graphic[];
/** Get the current time definition applied to the feature layer. */
getTimeDefinition(): TimeExtent;
/**
@@ -9702,6 +9744,10 @@ declare module "esri/layers/FeatureLayer" {
hasXYFootprint(): boolean;
/** Returns true if the FeatureLayer is editable. */
isEditable(): boolean;
/** Indicates if feature reduction (for example clustering) is active in the view. */
isFeatureReductionActive(): boolean;
/** Indicates if feature reduction (for example clustering) is enabled. */
isFeatureReductionEnabled(): boolean;
/**
* Returns true if the layer is visible at the given scale.
* @param scale The scale at which to check if the layer is visible.
@@ -9778,6 +9824,11 @@ declare module "esri/layers/FeatureLayer" {
* @param editable When true, the layer will be set as editable.
*/
setEditable(editable: boolean): FeatureLayer;
/**
* Sets feature reduction options on the layer (for example clustering options).
* @param options Options for reducing (or aggregating) the features in the map.
*/
setFeatureReduction(options: any): void;
/**
* Set the layer's data source to the specified geodatabase version.
* @param versionName The name of the geodatabase version to use as the layer's data source.
@@ -10340,6 +10391,8 @@ declare module "esri/layers/KMLLayer" {
* @param isVisible The visibility of the folder and all kml features within the folder.
*/
setFolderVisibility(folder: KMLFolder, isVisible: boolean): void;
/** Fires when one or more of the layer's network link children fail to load. */
on(type: "network-link-error", listener: (event: { error: Error; target: KMLLayer }) => void): esri.Handle;
/** Fired after the layer is refreshed. */
on(type: "refresh", listener: (event: { target: KMLLayer }) => void): esri.Handle;
on(type: string, listener: (event: any) => void): esri.Handle;
@@ -10692,11 +10745,11 @@ declare module "esri/layers/PixelBlock" {
height: number;
/** An array of nodata mask. */
mask: any[];
/** A two dimensional array. */
/** A two dimensional array representing the pixels from the Image Service displayed on the client. */
pixels: number[][];
/** Pixel type. */
pixelType: string;
/** Array of objects containing numeric statistical properties (e.g. */
/** Array of objects containing numeric statistical properties (for example minValue, maxValue, noDataValue, etc.). */
statistics: any[];
/** Number of columns. */
width: number;
@@ -10710,7 +10763,7 @@ declare module "esri/layers/PixelBlock" {
* @param planeData Must have two properties set: pixels and statistics.
*/
addData(planeData: any): void;
/** Returns pixels and masks using a single array in bip format (e.g. */
/** Returns pixels and masks using a single array in bip format (for example [p_00_r, p_00_g, p_00_b, p_00_a, p_10_r, p_10_g, p_10_b, p_10_a, .....]). */
getAsRGBA(): any[];
/** Similar to getAsRGBA, but returns floating point data. */
getAsRGBAFloat(): any[];
@@ -12026,7 +12079,7 @@ declare module "esri/map" {
resize(immediate?: boolean): void;
/**
* Change the background color of the map.
* @param color Color specified using either a named string (e.g.
* @param color Color specified using either a named string (for example red), hex string (for example #FF0000), array of rgba values with "a" in the 0-1 range (for example [255,0,0,0.75]), or an instance of esri/Color.
*/
setBackgroundColor(color: Color | string): void;
/**
@@ -13023,7 +13076,7 @@ declare module "esri/renderers/HeatmapRenderer" {
/** The HeatmapRenderer renders feature layer point data into a raster visualization that emphasizes areas of higher density or weighted values. */
class HeatmapRenderer extends Renderer {
/** The radius (in pixels) of the circle over which the majority of each points value is spread out over. */
/** The radius (in pixels) of the circle over which the majority of each point's value is spread out. */
blurRadius: number;
/** An array of CSS color strings (#RGB, #RRGGBB, rgb(r,g,b), rgba(r,g,b,a)). */
colors: string[];
@@ -13336,6 +13389,7 @@ declare module "esri/renderers/TimeRampAger" {
declare module "esri/renderers/UniqueValueRenderer" {
import Renderer = require("esri/renderers/Renderer");
import FillSymbol = require("esri/symbols/FillSymbol");
import Symbol = require("esri/symbols/Symbol");
import Graphic = require("esri/graphic");
@@ -13347,6 +13401,8 @@ declare module "esri/renderers/UniqueValueRenderer" {
attributeField2: string;
/** If needed, specify an additional attribute field the renderer uses to match values. */
attributeField3: string;
/** A symbol used for polygon features as a background if the renderer uses point symbols, for example for bivariate types & size rendering. */
backgroundFillSymbol: FillSymbol;
/** Label for the default symbol used to draw unspecified values. */
defaultLabel: string;
/** Default symbol used when a value or break cannot be matched. */
@@ -13506,7 +13562,7 @@ declare module "esri/renderers/smartMapping" {
*/
createTypeRenderer(params: any): any;
/**
* Searches the fields of an input layer or array of field objects for field names commonly used in rendering based on usage (e.g.
* Searches the fields of an input layer or array of field objects for field names commonly used in rendering based on usage (e.g., RANK, TOTAL, AVERAGE, NAME, etc).
* @param params See the object specifications table below for details about the params object.
*/
getSuggestedField(params: any): any;
@@ -15247,8 +15303,12 @@ declare module "esri/tasks/IdentifyParameters" {
mapExtent: Extent;
/** The maximum allowable offset used for generalizing geometries returned by the identify operation. */
maxAllowableOffset: number;
/** If true, field names will be returned instead of field aliases. */
returnFieldName: boolean;
/** If "true", the result set includes the geometry associated with each result. */
returnGeometry: boolean;
/** If true, the values in the result will not be formatted i.e. */
returnUnformattedValues: boolean;
/** The spatial reference of the input and output geometries as well as of the mapExtent. */
spatialReference: SpatialReference;
/** Specify the time extent used by the identify task. */
@@ -0,0 +1,46 @@
var socket = atmosphere;
var request1:Atmosphere.Request = new atmosphere.AtmosphereRequest();
request1.url = document.location.toString() + 'chat';
request1.contentType = "application/json";
request1.transport = 'websocket';
request1.fallbackTransport = 'long-polling';
var request2:Atmosphere.Request = {
url: 'http://localhost:8080/chat',
contentType: "application/json",
logLevel: 'debug',
transport: 'websocket',
fallbackTransport: 'long-polling'
};
request1.onError = function (response?:Atmosphere.Response) {};
request1.onClose = function (response?:Atmosphere.Response) {};
request1.onOpen = function (response?:Atmosphere.Response) {};
request1.onMessage = function (response:Atmosphere.Response) {};
request1.onReopen = function (request?:Atmosphere.Request, response?:Atmosphere.Response) {};
request1.onReconnect = function (request?:Atmosphere.Request, response?:Atmosphere.Response) {};
request1.onMessagePublished = function (response?:Atmosphere.Response) {};
request1.onTransportFailure = function (reason?:string, response?:Atmosphere.Response) {};
request1.onLocalMessage = function (request?:Atmosphere.Request) {};
request1.onFailureToReconnect = function (request?:Atmosphere.Request, response?:Atmosphere.Response) {};
request1.onClientTimeout = function (request?:Atmosphere.Request) {};
request1.subscribe = function (options:Atmosphere.Request) {};
request1.execute = function () {};
request1.close = function () {};
request1.disconnect = function () {};
request1.getUrl = function ():string { return "http://www.toedter.com" };
request1.push = function (message:string, dispatchUrl?:string) {};
request1.getUUID = function () {};
request1.pushLocal = function (message:string) {};
var subSocket:Atmosphere.Request = socket.subscribe(request1);
var subSocket2:Atmosphere.Request = socket.subscribe('http://chat.com', function() {}, request2);
subSocket2.close();
subSocket.push("test");
socket.unsubscribe();
+110
View File
@@ -0,0 +1,110 @@
// Type definitions for Atmosphere v2.1.5
// Project: https://github.com/Atmosphere/atmosphere-javascript
// Definitions by: Kai Toedter <https://github.com/toedter>
// Fedor Kirpichev <https://github.com/Mory1879>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Use this typings in future instead of deprecated 'atmosphere'.
declare namespace Atmosphere {
interface Atmosphere {
/**
* The atmosphere API is a little bit special here: the first parameter can either be
* a URL string or a Request object. If it is a URL string, then the additional parameters are expected.
*/
subscribe?: (requestOrUrl:any, callback?:Function, request?:Request) => Request;
unsubscribe?: () => void;
AtmosphereRequest?: AtmosphereRequest;
}
// needed to fit JavaScript "new atmosphere.AtmosphereRequest()"
// and compile with --noImplicitAny
interface AtmosphereRequest {
new(): Request;
}
interface Request {
timeout?: number;
method?: string;
headers?: any;
contentType?: string;
callback?: Function;
url?: string;
data?: string;
suspend?: boolean;
maxRequest?: number;
reconnect?: boolean;
maxStreamingLength?: number;
lastIndex?: number;
logLevel?: string;
requestCount?: number;
fallbackMethod?: string;
fallbackTransport?: string;
transport?: string;
webSocketImpl?: any;
webSocketBinaryType?: any;
dispatchUrl?: string;
webSocketPathDelimiter?: string;
enableXDR?: boolean;
rewriteURL?: boolean;
attachHeadersAsQueryString?: boolean;
executeCallbackBeforeReconnect?: boolean;
readyState?: number;
lastTimestamp?: number;
withCredentials?: boolean;
trackMessageLength?: boolean;
messageDelimiter?: string;
connectTimeout?: number;
reconnectInterval?: number;
dropHeaders?: boolean;
uuid?: string;
async?: boolean;
shared?: boolean;
readResponsesHeaders?: boolean;
maxReconnectOnClose?: number;
enableProtocol?: boolean;
pollingInterval?: number;
onError?: (response?:Response) => void;
onClose?: (response?:Response) => void;
onOpen?: (response?:Response) => void;
onMessage?: (response:Response) => void;
onReopen?: (request?:Request, response?:Response) => void;
onReconnect?: (request?:Request, response?:Response) => void;
onMessagePublished?: (response?:Response) => void;
onTransportFailure?: (reason?:string, response?:Response) => void;
onLocalMessage?: (request?:Request) => void;
onFailureToReconnect?: (request?:Request, response?:Response) => void;
onClientTimeout?: (request?:Request) => void;
subscribe?: (options:Request) => void;
execute?: () => void;
close?: () => void;
disconnect?: () => void;
getUrl?: () => string;
push?: (message:string, dispatchUrl?:string) => void;
getUUID?: () => void;
pushLocal?: (message:string) => void;
}
interface Response {
status?: number;
reasonPhrase?: string;
responseBody?: string;
messages?: string[];
headers?: string[];
state?: string;
transport?: string;
error?: string;
request?: Request;
partialMessage?: string;
errorHandled?: boolean;
closedByClientTimeout?: boolean;
}
}
declare var atmosphere:Atmosphere.Atmosphere;
declare module 'atmosphere.js' {
export = atmosphere;
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"atmosphere.js-tests.ts"
]
}
+4 -1
View File
@@ -1,8 +1,11 @@
// Type definitions for Atmosphere v2.1.5
// Project: https://github.com/Atmosphere/atmosphere-javascript
// Definitions by: Kai Toedter <https://github.com/toedter>
// Definitions by: Kai Toedter <https://github.com/toedter>
// Fedor Kirpichev <https://github.com/Mory1879>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// This is deprecated due to module name change. Please use 'atmosphere.js' for future development..
declare namespace Atmosphere {
interface Atmosphere {
/**
+1 -1
View File
@@ -1,3 +1,3 @@
[*.ts]
indent_style = tab
indent_size = 4
indent_size = 2
+21
View File
@@ -0,0 +1,21 @@
## Atom Keymap Type Definitions
TypeScript type definitions for [Atom Keymap](https://github.com/atom/atom-keymap), which is published as "[atom-keymap](https://www.npmjs.com/package/atom-keymap)" on NPM.
### Usage Notes
#### Exports
This module has a single entity as its export: the [KeymapManager](https://github.com/atom/atom-keymap/blob/master/src/keymap-manager.coffee) class. The require syntax is typically used to import modules like this.
```ts
import KeymapManager = require("atom-keymap");
```
#### The AtomKeymap Namespace
Many of the types used by Atom Keymap can be referenced from the AtomKeymap namespace.
```ts
function example(keybind: AtomKeymap.KeyBinding) {}
```
+84 -13
View File
@@ -1,20 +1,91 @@
import KeymapManager = require("atom-keymap");
import * as ImportTest from "atom-keymap";
declare const element: HTMLElement;
declare let sub: EventKit.Disposable;
declare const event: KeyboardEvent;
import { KeymapManager, ICompleteMatchEvent } from "atom-keymap";
// NPM Examples ===============================================================
const keymaps = new KeymapManager();
keymaps.defaultTarget = document.body;
var manager = new KeymapManager();
manager.add('some/unique/path', {
'.workspace': {
'ctrl-x': 'package:do-something',
'ctrl-y': 'package:do-something-else'
},
'.mini.editor': {
'enter': 'core:confirm'
}
// Pass all the window's keydown events to the KeymapManager
document.addEventListener("keydown", (event): void => {
keymaps.handleKeyboardEvent(event);
});
manager.onDidMatchBinding((event: ICompleteMatchEvent): void => {
console.log(event.binding.command);
})
// Add some keymaps. It can also be a directory of json / cson files.
keymaps.loadKeymap("/path/to/keymap-file.json");
// OR
keymaps.add("/key/for/these/keymaps", {
body: {
up: "core:move-up",
down: "core:move-down",
},
});
// When a keybinding is triggered, it will dispatch it on the node that was focused
window.addEventListener("core:move-up", (event) => console.log("up", event));
window.addEventListener("core:move-down", (event) => console.log("down", event));
// General Usage ==============================================================
const manager = new KeymapManager();
manager.add("some/unique/path", {
".workspace": {
"ctrl-x": "package:do-something",
"ctrl-y": "package:do-something-else",
},
".test": {
enter: "core:confirm",
},
});
manager.onDidMatchBinding((event): void => {
console.log(event.binding.command);
});
manager.destroy();
// Atom API Testing ===========================================================
// Class Methods
KeymapManager.buildKeydownEvent("a");
KeymapManager.buildKeydownEvent("a", { alt: true });
// Construction and Destruction
new KeymapManager({ defaultTarget: element });
manager.clear();
manager.destroy();
// Event Subscription
sub = manager.onDidMatchBinding((event): void => { event.keystrokes; });
sub = manager.onDidPartiallyMatchBindings((event): void => { event.partiallyMatchedBindings; });
sub = manager.onDidFailToMatchBinding((event): void => { event.keystrokes; });
sub = manager.onDidFailToReadFile((event): void => { event.stack; });
// Adding and Removing Bindings
sub = manager.add("a", {}, 0);
// Accessing Bindings
let bindings: AtomKeymap.KeyBinding[] = manager.getKeyBindings();
bindings = manager.findKeyBindings();
bindings = manager.findKeyBindings({ command: "a" });
bindings = manager.findKeyBindings({ keystrokes: "a" });
bindings = manager.findKeyBindings({ target: element });
bindings = manager.findKeyBindings({ command: "a", keystrokes: "b"});
bindings = manager.findKeyBindings({ command: "a", keystrokes: "b", target: element });
// Managing Keymap Files
manager.loadKeymap("Test.file");
manager.loadKeymap("Test.file", { watch: true });
manager.loadKeymap("Test.file", { watch: true, priority: 0});
// Managing Keyboard Events
manager.handleKeyboardEvent(event);
manager.keystrokeForKeyboardEvent(event);
sub = manager.addKeystrokeResolver((event): string => {
event.layoutName;
return "Test";
});
const num: number = manager.getPartialMatchTimeout();
+208 -107
View File
@@ -1,135 +1,236 @@
// Type definitions for atom-keymap v5.1.5
// Project: https://github.com/atom/atom-keymap/
// Definitions by: Vadim Macagon <https://github.com/enlight>
// Type definitions for atom-keymap 8.x
// Project: https://github.com/atom/atom-keymap
// Definitions by: GlenCFL <https://github.com/GlenCFL>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="event-kit" />
import * as AtomEventKit from 'event-kit';
declare global {
namespace AtomKeymap {
/** Objects that appear as parameters to callbacks. */
namespace Events {
interface FullKeybindingMatch {
/** The string of keystrokes that matched the binding. */
keystrokes: string;
export = AtomKeymap;
/** The KeyBinding that the keystrokes matched. */
binding: KeyBinding;
declare namespace AtomKeymap {
type Disposable = AtomEventKit.Disposable;
/** The DOM element that was the target of the most recent keyboard event. */
keyboardEventTarget: Element;
}
/** Instance side of KeyBinding class. */
interface KeyBinding {
enabled: boolean;
source: string;
command: string;
keystrokes: string;
keystrokeCount: number;
selector: string;
specificity: number;
interface PartialKeybindingMatch {
/** The string of keystrokes that matched the binding. */
keystrokes: string;
matches(keystroke: string): boolean;
compare(keyBinding: KeyBinding): number;
}
/** The KeyBindings that the keystrokes partially matched. */
partiallyMatchedBindings: KeyBinding[];
interface ICompleteMatchEvent {
/** Keystrokes that matched the binding. */
keystrokes: string;
/** Binding that was matched to the keystrokes. */
binding: KeyBinding;
/** DOM element that was the target of the most recent `KeyboardEvent`. */
keyboardEventTarget: Element;
}
/** DOM element that was the target of the most recent keyboard event. */
keyboardEventTarget: Element;
}
interface IPartialMatchEvent {
/** Keystrokes that matched the binding. */
keystrokes: string;
/** Bindings that were partially matched to the keystrokes. */
partiallyMatchedBindings: KeyBinding[];
/** DOM element that was the target of the most recent `KeyboardEvent`. */
keyboardEventTarget: Element;
}
interface FailedKeybindingMatch {
/** The string of keystrokes that failed to match the binding. */
keystrokes: string;
interface IFailedMatchEvent {
/** Keystrokes that failed to match a binding. */
keystrokes: string;
/** DOM element that was the target of the most recent `KeyboardEvent`. */
keyboardEventTarget: Element;
}
/** The DOM element that was the target of the most recent keyboard event. */
keyboardEventTarget: Element;
}
interface IKeymapLoadEvent {
/** Path to a keymap file. */
path: string;
}
interface FailedKeymapFileRead {
/** The error message. */
message: string;
/** Static side of KeymapManager class. */
interface KeymapManagerStatic {
prototype: KeymapManager;
new (options?: { defaultTarget?: Element }): KeymapManager;
}
/** The error stack trace. */
stack: string;
}
/** Instance side of KeymapManager class. */
interface KeymapManager {
constructor: KeymapManagerStatic;
/** Unwatches all watched paths. */
destroy(): void;
interface KeymapLoaded {
/** The path of the keymap file. */
path: string;
}
// Event Subscription
interface AddedKeystrokeResolver {
/** The currently resolved keystroke string. If your function returns a falsy
* value, this is how Atom will resolve your keystroke.
*/
keystroke: string;
/** Sets callback to invoke when one or more keystrokes completely match a key binding. */
onDidMatchBinding(callback: (event: ICompleteMatchEvent) => void): Disposable;
/** Sets callback to invoke when one or more keystrokes partially match a binding. */
onDidPartiallyMatchBindings(callback: (event: IPartialMatchEvent) => void): Disposable;
/** Sets callback to invoke when one or more keystrokes fail to match any bindings. */
onDidFailToMatchBinding(callback: (event: IFailedMatchEvent) => void): Disposable;
/** Sets callback to invoke when a keymap file is reloaded. */
onDidReloadKeymap(callback: (event: IKeymapLoadEvent) => void): Disposable;
/** Sets callback to invoke when a keymap file is unloaded. */
onDidUnloadKeymap(callback: (event: IKeymapLoadEvent) => void): Disposable;
/** Sets callback to invoke when a keymap file could not to be loaded. */
onDidFailToReadFile(callback: (error: Error) => void): Disposable;
/** The raw DOM 3 `KeyboardEvent` being resolved. See the DOM API documentation
* for more details.
*/
event: KeyboardEvent;
// Adding and Removing Bindings
/** The OS-specific name of the current keyboard layout. */
layoutName: string;
/** Adds sets of key bindings grouped by CSS selector. */
add(source: string, keyBindingsBySelector: any): Disposable;
/** An object mapping DOM 3 `KeyboardEvent.code` values to objects with the
* typed character for that key in each modifier state, based on the current
* operating system layout.
*/
keymap: object;
}
}
// Accessing Bindings
/** Objects that appear as parameters to functions. */
namespace Options {
interface BuildKeyEvent {
ctrl?: boolean;
alt?: boolean;
shift?: boolean;
cmd?: boolean;
which?: number;
target?: Element;
}
}
getKeyBindings(): KeyBinding[];
findKeyBindings(params?: {
keystrokes: string; // e.g. 'ctrl-x ctrl-s'
command: string; // e.g. 'editor:backspace'
target?: Element;
}): KeyBinding[];
/** The static side to each exported class. Should generally only be used internally. */
namespace Statics {
/* tslint:disable:no-unnecessary-qualifier */
/** The static side to the KeymapManager class. */
interface KeymapManager {
/** Create a keydown DOM event. */
buildKeydownEvent(key: string, options?: AtomKeymap.Options.BuildKeyEvent): void;
// Managing Keymap Files
/** Create a keyup DOM event. */
buildKeyupEvent(key: string, options?: AtomKeymap.Options.BuildKeyEvent): void;
/**
* Loads the key bindings from the given path.
*
* @param bindingsPath A path to a file or a directory. If the path is a directory all files
* inside it will be loaded.
/** Create a new KeymapManager. */
new (options?: { defaultTarget?: HTMLElement }): AtomKeymap.KeymapManager;
}
/* tslint:enable:no-unnecessary-qualifier */
}
/** This custom subclass of CustomEvent exists to provide the ::abortKeyBinding
* method, as well as versions of the ::stopPropagation methods that record the
* intent to stop propagation so event bubbling can be properly simulated for
* detached elements.
*/
loadKeymap(bindingsPath: string, options?: { watch: boolean }): void;
/**
* Starts watching the given file/directory for changes, reloading any keymaps at that location
* when changes are detected.
*
* @param filePath A path to a file or a directory.
*/
watchKeymap(filePath: string): void;
interface CommandEvent extends CustomEvent {
keyBindingAborted: boolean;
propagationStopped: boolean;
// Managing Keyboard Events
abortKeyBinding(): void;
stopPropagation(): CustomEvent;
stopImmediatePropagation(): CustomEvent;
}
/**
* Dispatches a custom event associated with the matching key binding for the given
* `KeyboardEvent` if one can be found.
interface KeyBinding {
// Properties
enabled: boolean;
source: string;
command: string;
keystrokes: string;
keystrokeArray: string[];
keystrokeCount: number;
selector: string;
specificity: number;
// Comparison
/** Determines whether the given keystroke matches any contained within this binding. */
matches(keystroke: string): boolean;
/** Compare another KeyBinding to this instance.
* Returns <= -1 if the argument is considered lesser or of lower priority.
* Returns 0 if this binding is equivalent to the argument.
* Returns >= 1 if the argument is considered greater or of higher priority.
*/
compare(other: KeyBinding): number;
}
/** Allows commands to be associated with keystrokes in a context-sensitive way.
* In Atom, you can access a global instance of this object via `atom.keymaps`.
*/
handleKeyboardEvent(event: KeyboardEvent): void;
/** Translates a keydown event to a keystroke string. */
keystrokeForKeyboardEvent(event: KeyboardEvent): string;
/**
* @return The number of milliseconds allowed before pending states caused by partial matches of
* multi-keystroke bindings are terminated.
*/
getPartialMatchTimeout(): number;
/** Instance side of KeymapManager class. */
interface KeymapManager {
defaultTarget: HTMLElement;
partialMatchTimeout: number;
/** Clear all registered key bindings and enqueued keystrokes. For use in tests. */
clear(): void;
/** Unwatch all watched paths. */
destroy(): void;
// Event Subscription
/** Invoke the given callback when one or more keystrokes completely match a key binding. */
onDidMatchBinding(callback: (event: Events.FullKeybindingMatch) => void):
EventKit.Disposable;
/** Invoke the given callback when one or more keystrokes partially match a binding. */
onDidPartiallyMatchBindings(callback: (event: Events.PartialKeybindingMatch) =>
void): EventKit.Disposable;
/** Invoke the given callback when one or more keystrokes fail to match any bindings. */
onDidFailToMatchBinding(callback: (event: Events.FailedKeybindingMatch) =>
void): EventKit.Disposable;
/** Invoke the given callback when a keymap file is reloaded. */
onDidReloadKeymap(callback: (event: Events.KeymapLoaded) => void):
EventKit.Disposable;
/** Invoke the given callback when a keymap file is unloaded. */
onDidUnloadKeymap(callback: (event: Events.KeymapLoaded) => void):
EventKit.Disposable;
/** Invoke the given callback when a keymap file not able to be loaded. */
onDidFailToReadFile(callback: (error: Events.FailedKeymapFileRead) => void):
EventKit.Disposable;
// Adding and Removing Bindings
/** Construct KeyBindings from an object grouping them by CSS selector. */
build(source: string, bindings: { [key: string]: { [key: string]: string }},
priority?: number): KeyBinding[];
/** Add sets of key bindings grouped by CSS selector. */
add(source: string, bindings: { [key: string]: { [key: string]: string }},
priority?: number): EventKit.Disposable;
// Accessing Bindings
/** Get all current key bindings. */
getKeyBindings(): KeyBinding[];
/** Get the key bindings for a given command and optional target. */
findKeyBindings(params?: {
keystrokes?: string, // e.g. 'ctrl-x ctrl-s'
command?: string, // e.g. 'editor:backspace'
target?: Element,
}): KeyBinding[];
// Managing Keymap Files
/** Load the key bindings from the given path. */
loadKeymap(bindingsPath: string, options?: { watch?: boolean, priority?: number }):
void;
/** Cause the keymap to reload the key bindings file at the given path whenever
* it changes.
*/
watchKeymap(filePath: string, options?: { priority: number }): void;
// Managing Keyboard Events
/** Dispatch a custom event associated with the matching key binding for the
* given `KeyboardEvent` if one can be found.
*/
handleKeyboardEvent(event: KeyboardEvent): void;
/** Translates a keydown event to a keystroke string. */
keystrokeForKeyboardEvent(event: KeyboardEvent): string;
/** Customize translation of raw keyboard events to keystroke strings. */
addKeystrokeResolver(resolver: (event: Events.AddedKeystrokeResolver) => string):
EventKit.Disposable;
/** Get the number of milliseconds allowed before pending states caused by
* partial matches of multi-keystroke bindings are terminated.
*/
getPartialMatchTimeout(): number;
}
}
/** Allows commands to be associated with keystrokes in a context-sensitive way.*/
var KeymapManager: KeymapManagerStatic;
}
declare const KeymapManager: AtomKeymap.Statics.KeymapManager;
export = KeymapManager;
+2 -2
View File
@@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -20,4 +20,4 @@
"index.d.ts",
"atom-keymap-tests.ts"
]
}
}
+38
View File
@@ -0,0 +1,38 @@
{
"extends": "dtslint/dt.json",
"rules": {
// Custom rules.
"class-name": true,
"indent": [true, "tabs"],
"jsdoc-format": true,
"linebreak-style": [true, "LF"],
"max-line-length": [true, 100],
"quotemark": [true, "double", "avoid-escape"],
"trailing-comma": [true, {
"multiline": { "objects": "always", "arrays": "always", "functions": "never" },
"singleline": { "objects": "never", "arrays": "never", "functions": "never" }
}],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type",
"check-typecast",
"check-rest-spread",
"check-preblock"
],
// Soon to be defaults.
"arrow-return-shorthand": [true, "multiline"],
"no-any": true,
"no-floating-promises": true,
"no-unbound-method": true,
"no-unsafe-any": true,
"number-literal-format": true,
"restrict-plus-operands": true,
"return-undefined": true,
"switch-final-break": true
}
}
+3
View File
@@ -0,0 +1,3 @@
[*.ts]
indent_style = tab
indent_size = 4
+20
View File
@@ -0,0 +1,20 @@
import { KeymapManager, ICompleteMatchEvent } from "atom-keymap";
var manager = new KeymapManager();
manager.add('some/unique/path', {
'.workspace': {
'ctrl-x': 'package:do-something',
'ctrl-y': 'package:do-something-else'
},
'.mini.editor': {
'enter': 'core:confirm'
}
});
manager.onDidMatchBinding((event: ICompleteMatchEvent): void => {
console.log(event.binding.command);
})
manager.destroy();
+133
View File
@@ -0,0 +1,133 @@
// Type definitions for atom-keymap v5.1.5
// Project: https://github.com/atom/atom-keymap/
// Definitions by: Vadim Macagon <https://github.com/enlight>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as AtomEventKit from 'event-kit';
export = AtomKeymap;
declare namespace AtomKeymap {
type Disposable = AtomEventKit.Disposable;
/** Instance side of KeyBinding class. */
interface KeyBinding {
enabled: boolean;
source: string;
command: string;
keystrokes: string;
keystrokeCount: number;
selector: string;
specificity: number;
matches(keystroke: string): boolean;
compare(keyBinding: KeyBinding): number;
}
interface ICompleteMatchEvent {
/** Keystrokes that matched the binding. */
keystrokes: string;
/** Binding that was matched to the keystrokes. */
binding: KeyBinding;
/** DOM element that was the target of the most recent `KeyboardEvent`. */
keyboardEventTarget: Element;
}
interface IPartialMatchEvent {
/** Keystrokes that matched the binding. */
keystrokes: string;
/** Bindings that were partially matched to the keystrokes. */
partiallyMatchedBindings: KeyBinding[];
/** DOM element that was the target of the most recent `KeyboardEvent`. */
keyboardEventTarget: Element;
}
interface IFailedMatchEvent {
/** Keystrokes that failed to match a binding. */
keystrokes: string;
/** DOM element that was the target of the most recent `KeyboardEvent`. */
keyboardEventTarget: Element;
}
interface IKeymapLoadEvent {
/** Path to a keymap file. */
path: string;
}
/** Static side of KeymapManager class. */
interface KeymapManagerStatic {
prototype: KeymapManager;
new (options?: { defaultTarget?: Element }): KeymapManager;
}
/** Instance side of KeymapManager class. */
interface KeymapManager {
constructor: KeymapManagerStatic;
/** Unwatches all watched paths. */
destroy(): void;
// Event Subscription
/** Sets callback to invoke when one or more keystrokes completely match a key binding. */
onDidMatchBinding(callback: (event: ICompleteMatchEvent) => void): Disposable;
/** Sets callback to invoke when one or more keystrokes partially match a binding. */
onDidPartiallyMatchBindings(callback: (event: IPartialMatchEvent) => void): Disposable;
/** Sets callback to invoke when one or more keystrokes fail to match any bindings. */
onDidFailToMatchBinding(callback: (event: IFailedMatchEvent) => void): Disposable;
/** Sets callback to invoke when a keymap file is reloaded. */
onDidReloadKeymap(callback: (event: IKeymapLoadEvent) => void): Disposable;
/** Sets callback to invoke when a keymap file is unloaded. */
onDidUnloadKeymap(callback: (event: IKeymapLoadEvent) => void): Disposable;
/** Sets callback to invoke when a keymap file could not to be loaded. */
onDidFailToReadFile(callback: (error: Error) => void): Disposable;
// Adding and Removing Bindings
/** Adds sets of key bindings grouped by CSS selector. */
add(source: string, keyBindingsBySelector: any): Disposable;
// Accessing Bindings
getKeyBindings(): KeyBinding[];
findKeyBindings(params?: {
keystrokes: string; // e.g. 'ctrl-x ctrl-s'
command: string; // e.g. 'editor:backspace'
target?: Element;
}): KeyBinding[];
// Managing Keymap Files
/**
* Loads the key bindings from the given path.
*
* @param bindingsPath A path to a file or a directory. If the path is a directory all files
* inside it will be loaded.
*/
loadKeymap(bindingsPath: string, options?: { watch: boolean }): void;
/**
* Starts watching the given file/directory for changes, reloading any keymaps at that location
* when changes are detected.
*
* @param filePath A path to a file or a directory.
*/
watchKeymap(filePath: string): void;
// Managing Keyboard Events
/**
* Dispatches a custom event associated with the matching key binding for the given
* `KeyboardEvent` if one can be found.
*/
handleKeyboardEvent(event: KeyboardEvent): void;
/** Translates a keydown event to a keystroke string. */
keystrokeForKeyboardEvent(event: KeyboardEvent): string;
/**
* @return The number of milliseconds allowed before pending states caused by partial matches of
* multi-keystroke bindings are terminated.
*/
getPartialMatchTimeout(): number;
}
/** Allows commands to be associated with keystrokes in a context-sensitive way.*/
var KeymapManager: KeymapManagerStatic;
}
+27
View File
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"paths": {
"atom-keymap": [ "atom-keymap/v5" ],
"event-kit": [ "event-kit/v1" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"atom-keymap-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
[*.ts]
indent_style = tab
indent_size = 2
+42
View File
@@ -0,0 +1,42 @@
## Atom API Type Definitions
TypeScript type definitions for the [Atom Text Editor](https://atom.io/) public API, which is used to develop packages for the editor. Documentation for the public API can be found [here](https://atom.io/docs/api/v1.21.0/).
### Exports
#### The "atom" Variable
These definitions declare a global static variable named "atom" as ambient. Once these definitions have been referenced within your project, you will be able to access properties and member functions from the [AtomEnvironment](https://atom.io/docs/api/v1.21.0/AtomEnvironment) class off of this variable, as it is an instance of that class.
```ts
if (atom.inDevMode()) {}
```
#### The Atom Namespace
All of the types used by or referenced by the Atom public API have been pulled into the Atom namespace, providing a consistent and easy way to access each of them, without having to care about where that type actually lives within the Atom codebase.
```ts
function example(buffer: Atom.TextBuffer) {}
```
#### The AtomCore Namespace
All classes which are core to Atom itself have been provided under the AtomCore namespace.
```ts
function example(cursor: AtomCore.Cursor) {}
```
### Service Type Definitions
There are many services provided by other Atom packages that you may want to use within your own Atom package. We bundle type definitions for several of these services with these type definitions.
```ts
/// <reference types="atom/services" />
let completionProvider: Atom.Services.Autocomplete.Provider;
```
The currently supported services are:
- [Autocomplete](https://github.com/atom/autocomplete-plus)
- [Status Bar](https://github.com/atom/status-bar)
+2117 -50
View File
File diff suppressed because it is too large Load Diff
+4110 -1876
View File
File diff suppressed because it is too large Load Diff
+190
View File
@@ -0,0 +1,190 @@
/* tslint:disable:no-unnecessary-qualifier */
declare namespace Atom {
namespace Services {
/** Type definitions for autocomplete+ 2 */
namespace Autocomplete {
/** Objects that appear as parameters to callbacks. */
namespace Events {
/** The parameters passed into getSuggestions by Autocomplete+. */
interface SuggestionsRequested {
/** The current TextEditor. */
editor: Atom.TextEditor;
/** The position of the cursor. */
bufferPosition: Atom.Point;
/** The scope descriptor for the current cursor position. */
scopeDescriptor: Atom.ScopeDescriptor;
/** The prefix for the word immediately preceding the current cursor position. */
prefix: string;
/** Whether the autocomplete request was initiated by the user. */
activatedManually: boolean;
}
/** The parameters passed into onDidInsertSuggestion by Autocomplete+. */
interface SuggestionInserted {
editor: Atom.TextEditor;
triggerPosition: Atom.Point;
suggestion: TextSuggestion|SnippetSuggestion;
}
}
/** An autocompletion suggestion for the user.
* Primary data type for the Atom Autocomplete+ service.
*/
interface Suggestion {
/** A string that will show in the UI for this suggestion.
* When not set, snippet || text is displayed.
*/
displayText?: string;
/** The text immediately preceding the cursor, which will be replaced by the text.
* If not provided, the prefix passed into getSuggestions will be used.
*/
replacementPrefix?: string;
/** The suggestion type. It will be converted into an icon shown against the suggestion. */
type?: string;
/** This is shown before the suggestion. Useful for return values. */
leftLabel?: string;
/** Use this instead of leftLabel if you want to use html for the left label. */
leftLabelHTML?: string;
/** An indicator (e.g. function, variable) denoting the "kind" of suggestion this represents. */
rightLabel?: string;
/** Use this instead of rightLabel if you want to use html for the right label. */
rightLabelHTML?: string;
/** Class name for the suggestion in the suggestion list. Allows you to style your suggestion
* via CSS, if desired.
*/
className?: string;
/** If you want complete control over the icon shown against the suggestion. e.g. iconHTML:
* <i class="icon-move-right"></i>
*/
iconHTML?: string;
/** A doc-string summary or short description of the suggestion. When specified, it will be
* displayed at the bottom of the suggestions list.
*/
description?: string;
/** A url to the documentation or more information about this suggestion. When specified,
* a More.. link will be displayed in the description area.
*/
descriptionMoreURL?: string;
}
interface TextSuggestion extends Suggestion {
/** The text which will be inserted into the editor, in place of the prefix. */
text: string;
}
interface SnippetSuggestion extends Suggestion {
/** A snippet string. This will allow users to tab through function arguments or other
* options.
*/
snippet: string;
}
type Suggestions = Array<TextSuggestion|SnippetSuggestion>;
interface Provider {
/** Defines the scope selector(s) (can be comma-separated) for which your provider
* should receive suggestion requests.
*/
selector: string;
/** Is called when a suggestion request has been dispatched by autocomplete+ to your
* provider. Return an array of suggestions (if any) in the order you would like them
* displayed to the user. Returning a Promise of an array of suggestions is also
* supported.
*/
getSuggestions(params: Events.SuggestionsRequested): Suggestions|Promise<Suggestions>;
/** Defines the scope selector(s) (can be comma-separated) for which your provider
* should not be used.
*/
disableForSelector?: string;
/** A number to indicate its priority to be included in a suggestions request.
* The default provider has an inclusion priority of 0. Higher priority providers
* can suppress lower priority providers with excludeLowerPriority.
*/
inclusionPriority?: number;
/** Will not use lower priority providers when this provider is used. */
excludeLowerPriority?: boolean;
/** A number to determine the sort order of suggestions. The default provider has
* an suggestion priority of 1.
*/
suggestionPriority?: number;
/** Function that is called when a suggestion from your provider was inserted
* into the buffer.
*/
onDidInsertSuggestion?(params: Events.SuggestionInserted): void;
/** Will be called if your provider is being destroyed by autocomplete+ */
dispose?(): void;
}
}
/** Type definitions for status-bar 1.8 */
namespace StatusBar {
/** Objects that appear as parameters to functions. */
namespace Options {
interface AddTile {
/** A DOM element, a jQuery object, or a model object for which a view provider
* has been registered in the the view registry.
*/
item: object;
/** Determines the placement of the tile within the status bar. Lower priority
* will result in closer placement to the anchor.
*/
priority: number;
}
}
interface Tile {
/** Retrieve the priority that was assigned to the Tile when it was created. */
getPriority(): number;
/** Retrieve the Tile's item. */
getItem(): object;
/** Remove the Tile from the status bar. */
destroy(): void;
}
interface StatusBar {
/** Add a tile to the left side of the status bar. Lower priority tiles are placed
* further to the left.
*/
addLeftTile(options: Options.AddTile): Tile;
/** Add a tile to the right side of the status bar. Lower priority tiles are placed
* further to the right.
*/
addRightTile(options: Options.AddTile): Tile;
/** Retrieve all of the tiles on the left side of the status bar. */
getLeftTiles(): Tile[];
/** Retrieve all of the tiles on the right side of the status bar. */
getRightTiles(): Tile[];
}
type Consumer = (statusBar: StatusBar) => void;
}
}
}
/* tslint:enable:no-unnecessary-qualifier */
+4 -7
View File
@@ -7,21 +7,18 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"paths": {
"q": [ "q/v0" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"api-docs.d.ts",
"atom-tests.ts"
"atom-tests.ts",
"services/index.d.ts"
]
}
}
+39
View File
@@ -0,0 +1,39 @@
{
"extends": "dtslint/dt.json",
"rules": {
// Custom rules.
"await-promise": [true, "CancellablePromise"],
"class-name": true,
"indent": [true, "tabs"],
"jsdoc-format": true,
"linebreak-style": [true, "LF"],
"max-line-length": [true, 100],
"no-any": false,
"quotemark": [true, "double", "avoid-escape"],
"trailing-comma": [true, {
"multiline": { "objects": "always", "arrays": "always", "functions": "never" },
"singleline": { "objects": "never", "arrays": "never", "functions": "never" }
}],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type",
"check-typecast",
"check-rest-spread",
"check-preblock"
],
// Soon to be defaults.
"arrow-return-shorthand": [true, "multiline"],
"no-floating-promises": true,
"no-unbound-method": true,
"no-unsafe-any": true,
"number-literal-format": true,
"restrict-plus-operands": true,
"return-undefined": true,
"switch-final-break": true
}
}
+70
View File
@@ -0,0 +1,70 @@
import path = require("path");
import _atom = require("atom");
import PathWatcher = require("pathwatcher");
var File = PathWatcher.File;
const jq: JQuery = $("selector");
class SampleView extends _atom.ScrollView {
editorId:string;
file:PathWatcher.IFile;
editor:AtomCore.IEditor;
static deserialize(state:any):SampleView {
return new SampleView(state);
}
static content():any {
return this.div({class: 'sample native-key-bindings', tabindex: -1});
}
constructor(params:{editorId?:string; filePath?:string;} = {}) {
super();
this.editorId = params.editorId;
if (this.editorId) {
this.resolveEditor(this.editorId);
} else {
this.file = new File(params.filePath);
}
}
serialize() {
return {
deserializer: 'SampleView',
editorId: this.editorId
};
}
destroy() {
this.unsubscribe();
}
resolveEditor(editorId:string) {
var resolve = ()=> {
if (this.editor) {
jq.trigger("title-changed");
} else {
var view = jq.parents('.pane').view();
if (view) {
view.destroyItem(this);
}
}
};
if (atom.workspace) {
resolve();
} else {
atom.packages.once("activated", ()=> {
resolve();
});
}
}
}
atom.deserializers.add(SampleView);
export = SampleView;
+1977
View File
File diff suppressed because it is too large Load Diff
+29
View File
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"paths": {
"atom": [ "atom/v0" ],
"pathwatcher": [ "pathwatcher/v0" ],
"q": [ "q/v0" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"api-docs.d.ts",
"atom-tests.ts"
]
}
+1 -1
View File
@@ -187,7 +187,7 @@ export class WebAuth {
*
* @param {AuthorizeOptions} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
*/
authorize(options: AuthorizeOptions): void;
authorize(options?: AuthorizeOptions): void;
/**
* Parse the url hash and extract the returned tokens depending on the transaction.
@@ -68,6 +68,8 @@ const thingShadows = new awsIot.thingShadow({
(err: Error, failedTopics: mqtt.Granted[]) => { }
);
thingShadows.subscribe("topic", {}, (error: any, granted: mqtt.Granted) => {});
thingShadows.on("connect", function() {
console.log("connected to AWS IoT");
});
+5 -8
View File
@@ -1,6 +1,7 @@
// Type definitions for aws-iot-device-sdk 1.0.13
// Project: https://github.com/aws/aws-iot-device-sdk-js
// Definitions by: Markus Olsson <https://github.com/niik>
// Margus Lamp <https://github.com/mlamp>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -100,7 +101,7 @@ export interface DeviceOptions extends mqtt.ClientOptions {
* additional options to the underlying WebSocket object;
* these options are documented here.
*/
websocketOptions?: WebSocket.IClientOptions;
websocketOptions?: WebSocket.ClientOptions;
/**
* used to specify the Access Key ID when protocol is set to "wss".
@@ -333,8 +334,7 @@ export class thingShadow extends NodeJS.EventEmitter {
* @param options
* @param callback
*/
publish(topic: string, message: Buffer, options?: mqtt.ClientPublishOptions, callback?: Function): mqtt.Client;
publish(topic: string, message: string, options?: mqtt.ClientPublishOptions, callback?: Function): mqtt.Client;
publish(topic: string, message: Buffer | string, options?: mqtt.ClientPublishOptions, callback?: Function): mqtt.Client;
/**
* Subscribe to a topic or topics
@@ -342,9 +342,7 @@ export class thingShadow extends NodeJS.EventEmitter {
* @param the options to subscribe with
* @param callback fired on suback
*/
subscribe(topic: string, options?: mqtt.ClientSubscribeOptions, callback?: mqtt.ClientSubscribeCallback): mqtt.Client;
subscribe(topic: string[], options?: mqtt.ClientSubscribeOptions, callback?: mqtt.ClientSubscribeCallback): mqtt.Client;
subscribe(topic: mqtt.Topic, options?: mqtt.ClientSubscribeOptions, callback?: mqtt.ClientSubscribeCallback): mqtt.Client;
subscribe(topic: string | string[] | mqtt.Topic, options?: mqtt.ClientSubscribeOptions, callback?: mqtt.ClientSubscribeCallback): mqtt.Client;
/**
* Unsubscribe from a topic or topics
@@ -353,8 +351,7 @@ export class thingShadow extends NodeJS.EventEmitter {
* @param options
* @param callback fired on unsuback
*/
unsubscribe(topic: string, options?: mqtt.ClientSubscribeOptions, callback?: mqtt.ClientSubscribeCallback): mqtt.Client;
unsubscribe(topic: string[], options?: mqtt.ClientSubscribeOptions, callback?: mqtt.ClientSubscribeCallback): mqtt.Client;
unsubscribe(topic: string | string[], options?: mqtt.ClientSubscribeOptions, callback?: mqtt.ClientSubscribeCallback): mqtt.Client;
/**
* end - close connection
+1 -1
View File
@@ -219,7 +219,7 @@ declare namespace Backbone {
/**
* Specify a model attribute name (string) or function that will be used to sort the collection.
*/
comparator: string | ((element: TModel) => number | string) | ((compare: TModel, to?: TModel) => number);
comparator: string | { bivarianceHack(element: TModel): number | string }["bivarianceHack"] | { bivarianceHack(compare: TModel, to?: TModel): number }["bivarianceHack"];
add(model: {}|TModel, options?: AddOptions): TModel;
add(models: ({}|TModel)[], options?: AddOptions): TModel[];
+5
View File
@@ -8,6 +8,11 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
+3 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for big.js 3.2
// Type definitions for big.js 4.0
// Project: https://github.com/MikeMcl/big.js/
// Definitions by: Steve Ognibene <https://github.com/nycdotnet>
// Miika Hänninen <https://github.com/googol>
@@ -89,14 +89,14 @@ export interface BigConstructor {
* -1e+6 to 0 inclusive
* Default value: -7
*/
E_NEG: number;
NE: number;
/**
* The positive exponent value at and above which toString returns exponential notation.
*
* 0 to 1e+6 inclusive
* Default value: 21
*/
E_POS: number;
PE: number;
}
export interface Big {
+5 -3
View File
@@ -839,10 +839,12 @@ obj = Promise.promisifyAll(obj, {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//TODO enable generator
/*
func = Promise.coroutine(f);
const generator = function* (a: number, b: string) {return "string"}
const coroutine = Promise.coroutine<string, number, string>(generator);
coroutine(5, "foo").then((x: string) => {});
const coroutineCustomYield = Promise.coroutine(generator, { yieldHandler: (value) => "whatever" })
/*
barProm = Promise.spawn<number>(f);
*/
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+19 -3
View File
@@ -695,6 +695,11 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
* Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function.
* This method is convenient when a function can sometimes return synchronously or throw synchronously.
*/
static method<R, A1>(fn: (arg1: A1) => R | PromiseLike<R>): (arg1: A1) => Bluebird<R>
static method<R, A1, A2>(fn: (arg1: A1, arg2: A2) => R | PromiseLike<R>): (arg1: A1, arg2: A2) => Bluebird<R>
static method<R, A1, A2, A3>(fn: (arg1: A1, arg2: A2, arg3: A3) => R | PromiseLike<R>): (arg1: A1, arg2: A2, arg3: A3) => Bluebird<R>
static method<R, A1, A2, A3, A4>(fn: (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => R | PromiseLike<R>): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Bluebird<R>
static method<R, A1, A2, A3, A4, A5>(fn: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => R | PromiseLike<R>): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Bluebird<R>
static method<R>(fn: (...args: any[]) => R | PromiseLike<R>): (...args: any[]) => Bluebird<R>;
/**
@@ -776,9 +781,17 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
/**
* Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.
*/
// TODO fix coroutine GeneratorFunction
static coroutine(generatorFunction: (...args: any[]) => IterableIterator<any>): (...args: any[]) => Bluebird<any>;
// TODO: After https://github.com/Microsoft/TypeScript/issues/2983 is implemented, we can use
// the return type propagation of generators to automatically infer the return type T.
static coroutine<T>(generatorFunction: () => IterableIterator<any>, options?: Bluebird.CoroutineOptions): () => Bluebird<T>;
static coroutine<T, A1>(generatorFunction: (a1: A1) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1) => Bluebird<T>;
static coroutine<T, A1, A2>(generatorFunction: (a1: A1, a2: A2) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2) => Bluebird<T>;
static coroutine<T, A1, A2, A3>(generatorFunction: (a1: A1, a2: A2, a3: A3) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3) => Bluebird<T>;
static coroutine<T, A1, A2, A3, A4>(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4) => Bluebird<T>;
static coroutine<T, A1, A2, A3, A4, A5>(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => Bluebird<T>;
static coroutine<T, A1, A2, A3, A4, A5, A6>(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => Bluebird<T>;
static coroutine<T, A1, A2, A3, A4, A5, A6, A7>(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => Bluebird<T>;
static coroutine<T, A1, A2, A3, A4, A5, A6, A7, A8>(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => Bluebird<T>;
/**
* Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers.
*
@@ -1021,6 +1034,9 @@ declare namespace Bluebird {
// The promisifier gets a reference to the original method and should return a function which returns a promise
promisifier?: (originalMethod: (...args: any[]) => any, defaultPromisifer: (...args: any[]) => (...args: any[]) => Bluebird<any>) => () => PromiseLike<any>;
}
export interface CoroutineOptions {
yieldHandler: (value: any) => any;
}
/**
* Represents an error is an explicit promise rejection as opposed to a thrown error.
+1 -1
View File
@@ -19,4 +19,4 @@
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}
}
+29
View File
@@ -0,0 +1,29 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"ban-types": false,
"comment-format": false,
"dt-header": false,
"max-line-length": false,
"member-access": false,
"no-consecutive-blank-lines": false,
"no-padding": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-generics": false,
"no-var-keyword": false,
"no-void-expression": false,
"one-line": false,
"only-arrow-functions": false,
"prefer-const": false,
"prefer-method-signature": false,
"semicolon": false,
"space-before-function-paren": false,
"strict-export-declare-modifiers": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
}
+7 -7
View File
@@ -7,9 +7,9 @@
/// <reference types="jquery" />
/** Bootbox options shared by all modal types */
interface BootboxBaseOptions {
interface BootboxBaseOptions<T = any> {
title?: string | Element;
callback?: (result: boolean | string) => any;
callback?: (result: T) => any;
onEscape?: (() => any) | boolean;
show?: boolean;
backdrop?: boolean;
@@ -22,24 +22,24 @@ interface BootboxBaseOptions {
}
/** Bootbox options available for custom modals */
interface BootboxDialogOptions extends BootboxBaseOptions {
interface BootboxDialogOptions<T = any> extends BootboxBaseOptions<T> {
message: string | Element;
}
/** Bootbox options available for alert modals */
interface BootboxAlertOptions extends BootboxDialogOptions {
interface BootboxAlertOptions extends BootboxDialogOptions<void> {
callback?: () => any;
buttons?: BootboxAlertButtonMap;
}
/** Bootbox options available for confirm modals */
interface BootboxConfirmOptions extends BootboxDialogOptions {
interface BootboxConfirmOptions extends BootboxDialogOptions<boolean> {
callback: (result: boolean) => any;
buttons?: BootboxConfirmPromptButtonMap;
}
/** Bootbox options available for prompt modals */
interface BootboxPromptOptions extends BootboxBaseOptions {
interface BootboxPromptOptions extends BootboxBaseOptions<string> {
title: string;
value?: string;
inputType?: "text" | "textarea" | "email" | "select" | "checkbox" | "date" | "time" | "number" | "password";
@@ -93,7 +93,7 @@ interface BootboxStatic {
prompt(message: string, callback: (result: string) => void): JQuery;
prompt(options: BootboxPromptOptions): JQuery;
dialog(message: string, callback?: (result: string) => void): JQuery;
dialog(options: BootboxDialogOptions): JQuery;
dialog(options: BootboxDialogOptions<string>): JQuery;
setDefaults(options: BootboxDefaultOptions): void;
hideAll(): void;
+1 -1
View File
@@ -20,4 +20,4 @@
"index.d.ts",
"bootbox-tests.ts"
]
}
}
+1 -1
View File
@@ -318,7 +318,7 @@ declare namespace Chart {
lineWidth?: number;
drawBorder?: boolean;
drawOnChartArea?: boolean;
drawticks?: boolean;
drawTicks?: boolean;
tickMarkLength?: number;
zeroLineWidth?: number;
zeroLineColor?: ChartColor;
+139 -122
View File
@@ -1,6 +1,6 @@
// Type definitions for Chartist v0.9.6
// Type definitions for Chartist v0.9.7
// Project: https://github.com/gionkunz/chartist-js
// Definitions by: Matt Gibbs <https://github.com/mtgibbs>, Simon Pfeifer <https://github.com/psimonski>
// Definitions by: Matt Gibbs <https://github.com/mtgibbs>, Simon Pfeifer <https://github.com/psimonski>, Cassey Lottman <https://github.com/clottman>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Chartist {
@@ -187,11 +187,17 @@ declare namespace Chartist {
* If specified the donut CSS classes will be used and strokes will be drawn instead of pie slices.
*/
donut?: boolean;
/**
* If specified the donut segments will be drawn as shapes instead of strokes.
*/
donutSolid?: boolean;
/**
* Specify the donut stroke width, currently done in javascript for convenience.
* Specify the donut stroke width, currently done in javascript for convenience. May move to CSS styles in the future.
* This option can be set as number or string to specify a relative width (i.e. 100 or '30%').
*/
donutWidth?: number;
donutWidth?: number | string;
/**
* Specify if a label should be shown or not
@@ -217,6 +223,16 @@ declare namespace Chartist {
* Label direction can be 'neutral', 'explode' or 'implode'. Default is 'neutral'. The labels anchor will be positioned based on those settings as well as the fact if the labels are on the right or left side of the center of the chart. Usually explode is useful when labels are positioned far away from the center.
*/
labelDirection?: string;
/**
* If true the whole data is reversed including labels, the series order as well as the whole series data arrays.
*/
reverseData?: boolean;
/**
* If true empty values will be ignored to avoid drawing unncessary slices and labels
*/
ignoreEmptyValues?: boolean;
}
interface IChartPadding {
@@ -357,123 +373,124 @@ declare namespace Chartist {
end?: string;
}
interface ICandleChartOptions extends IChartOptions {
/**
* Options for X-Axis
*/
axisX?: ICandleChartAxis;
/**
* Options for Y-Axis
*/
axisY?: ICandleChartAxis;
/**
* Specify a fixed width for the chart as a string (i.e. '100px' or '50%')
*/
width?: number | string;
/**
* Specify a fixed height for the chart as a string (i.e. '100px' or '50%')
*/
height?: number | string;
/**
* Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value
*/
hight?: number | string;
/**
* Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value
*/
low?: number | string;
/**
* Width of candle body in pixel (IMO is 2 px best minimum value)
*/
candleWidth?: number | string;
/**
* Width of candle wick in pixel (IMO is 1 px best minimum value)
*/
candleWickWidth?: number | string;
/**
* Use calculated x-axis step length, depending on the number of quotes to display, as candle width. Otherwise the candleWidth is being used.
*/
useStepLengthAsCandleWidth?: boolean | string;
/**
* Use 1/3 of candle body width as width for the candle wick, otherwise the candleWickWidth is being used.
*/
useOneThirdAsCandleWickWidth?: boolean | string;
/**
* Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5}
*/
chartPadding?: IChartPadding | number;
/**
* When set to true, the last grid line on the x-axis is not drawn and the chart elements will expand to the full available width of the chart. For the last label to be drawn correctly you might need to add chart padding or offset the last label with a draw event handler.
*/
fullWidth?: boolean | string;
/**
* Override the class names that get used to generate the SVG structure of the chart
*/
classNames?: ICandleChartClasses;
}
interface ICandleChartAxis {
/**
* The offset of the chart drawing area to the border of the container
*/
offset?: number;
/**
* Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis.
*/
position?: string;
/**
* Allows you to correct label positioning on this axis by positive or negative x and y offset.
*/
labelOffset?: {
x?: number;
y?: number;
};
/**
* If labels should be shown or not
*/
showLabel?: boolean;
/**
* If the axis grid should be drawn or not
*/
showGrid?: boolean;
/**
* Interpolation function that allows you to intercept the value from the axis label
*/
labelInterpolationFnc?: Function;
/**
* Set the axis type to be used to project values on this axis. If not defined, Chartist.StepAxis will be used for the X-Axis, where the ticks option will be set to the labels in the data and the stretch option will be set to the global fullWidth option. This type can be changed to any axis constructor available (e.g. Chartist.FixedScaleAxis), where all axis options should be present here.
*/
type?: any;
}
interface ICandleChartClasses {
chart?: string;
label?: string;
labelGroup?: string;
series?: string;
candlePositive?: string;
candleNegative?: string,
grid?: string,
gridGroup?: string,
gridBackground?: string,
vertical?: string,
horizontal?: string,
start?: string,
end?: string,
}
interface ICandleChartOptions extends IChartOptions {
/**
* Options for X-Axis
*/
axisX?: ICandleChartAxis;
/**
* Options for Y-Axis
*/
axisY?: ICandleChartAxis;
/**
* Specify a fixed width for the chart as a string (i.e. '100px' or '50%')
*/
width?: number | string;
/**
* Specify a fixed height for the chart as a string (i.e. '100px' or '50%')
*/
height?: number | string;
/**
* Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value
*/
hight?: number | string;
/**
* Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value
*/
low?: number | string;
/**
* Width of candle body in pixel (IMO is 2 px best minimum value)
*/
candleWidth?: number | string;
/**
* Width of candle wick in pixel (IMO is 1 px best minimum value)
*/
candleWickWidth?: number | string;
/**
* Use calculated x-axis step length, depending on the number of quotes to display, as candle width. Otherwise the candleWidth is being used.
*/
useStepLengthAsCandleWidth?: boolean | string;
/**
* Use 1/3 of candle body width as width for the candle wick, otherwise the candleWickWidth is being used.
*/
useOneThirdAsCandleWickWidth?: boolean | string;
/**
* Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5}
*/
chartPadding?: IChartPadding | number;
/**
* When set to true, the last grid line on the x-axis is not drawn and the chart elements will expand to the full available width of the chart. For the last label to be drawncorrectly you might need to add chart padding or offset the last label with a draw event handler.
*/
fullWidth?: boolean | string;
/**
* Override the class names that get used to generate the SVG structure of the chart
*/
classNames?: ICandleChartClasses;
}
interface ICandleChartAxis {
/**
* The offset of the chart drawing area to the border of the container
*/
offset?: number;
/**
* Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis.
*/
position?: string;
/**
* Allows you to correct label positioning on this axis by positive or negative x and y offset.
*/
labelOffset?: {
x?: number;
y?: number;
};
/**
* If labels should be shown or not
*/
showLabel?: boolean;
/**
* If the axis grid should be drawn or not
*/
showGrid?: boolean;
/**
* Interpolation function that allows you to intercept the value from the axis label
*/
labelInterpolationFnc?: Function;
/**
* Set the axis type to be used to project values on this axis. If not defined, Chartist.StepAxis will be used for the X-Axis, where the ticks option will be set to the labels in the data and the stretch option will be set to the global fullWidth option. This type can be changed to any axis constructor available (e.g. Chartist.FixedScaleAxis), where all axis options should be present here.
*/
type?: any;
}
interface ICandleChartClasses {
chart?: string;
label?: string;
labelGroup?: string;
series?: string;
candlePositive?: string;
candleNegative?: string,
grid?: string,
gridGroup?: string,
gridBackground?: string,
vertical?: string,
horizontal?: string,
start?: string,
end?: string,
}
interface ChartistSvgStatic {
new (name: HTMLElement | string, attributes: Object, className?: string, parent?: Object, insertFirst?: boolean): IChartistSvg;
@@ -682,4 +699,4 @@ declare namespace Chartist {
declare var Chartist: Chartist.ChartistStatic;
export = Chartist;
export as namespace Chartist;
export as namespace Chartist;
+4
View File
@@ -120,6 +120,10 @@ interface ChartScalesOptions {
interface ScaleTicksOptions {
min?: number;
max?: number;
maxTicksLimit?: number;
suggestedMin?: number;
suggestedMax?: number;
stepSize?: number;
}
interface ChartTitle {
+1 -1
View File
@@ -109,7 +109,7 @@ declare namespace chroma {
* Blends two colors using RGB channel-wise blend functions.
*/
blend(color1: string | Color, color2: string | Color,
blendMode: 'multiply' | 'darken' | 'lighten' | 'screen' | 'overlay' | 'burn' | 'dogde'): Color;
blendMode: 'multiply' | 'darken' | 'lighten' | 'screen' | 'overlay' | 'burn' | 'dodge'): Color;
/**
* Returns a random color.
+23
View File
@@ -0,0 +1,23 @@
import * as http from 'http';
import * as cls from 'cls-hooked';
const session = cls.createNamespace('my session');
const user = { id: 'foo' };
session.set('user', user);
session.run((value: number) => {
session.set('value', value);
});
http.createServer((req, res) => {
session.bindEmitter(req);
session.bindEmitter(res);
});
function bindLater(callback: (x: number) => number) {
return session.bind(callback, session.createContext());
}
bindLater((x: number) => {
return x;
})(123); // passing argument 'abc' should get compile error
const session2 = cls.getNamespace('my session');
session2.get('user');
+25
View File
@@ -0,0 +1,25 @@
// Type definitions for cls-hooked 4.2
// Project: https://github.com/jeff-lewis/cls-hooked
// Definitions by: Leo Liang <https://github.com/aleung>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { EventEmitter } from 'events';
export interface Namespace {
active: any;
set<T>(key: string, value: T): T;
get(key: string): any;
run(fn: (...args: any[]) => void): void;
runAndReturn<T>(fn: (...args: any[]) => T): T;
bind<F extends Function>(fn: F, context?: any): F; // tslint:disable-line: ban-types
bindEmitter(emitter: EventEmitter): void;
createContext(): any;
}
export function createNamespace(name: string): Namespace;
export function getNamespace(name: string): Namespace;
export function destroyNamespace(name: string): void;
export function reset(): void;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"cls-hooked-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+6 -3
View File
@@ -1,13 +1,16 @@
import * as program from "commander";
import * as program from 'commander';
interface ExtendedOptions extends program.CommandOptions {
isNew: any;
}
const commandInstance = new program.Command("-f");
const optionsInstance = new program.Option("-f");
const commandInstance = new program.Command('-f');
const optionsInstance = new program.Option('-f');
const name = program.name();
program
.name('set name')
.version('0.0.1')
.option('-p, --peppers', 'Add peppers')
.option('-P, --pineapple', 'Add pineapple')
+11 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for commander 2.9
// Type definitions for commander 2.11
// Project: https://github.com/visionmedia/commander.js
// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -248,6 +248,14 @@ declare class Command extends NodeJS.EventEmitter {
usage(str: string): Command;
usage(): string;
/**
* Set the name of the command.
*
* @param {string} str
* @return {Command}
*/
name(str: string): Command;
/**
* Get the name of the command.
*
@@ -258,9 +266,9 @@ declare class Command extends NodeJS.EventEmitter {
/**
* Output help information for this command.
*
* @param {() => void} [cb] Callback method
* @param {(str: string) => string} [cb]
*/
outputHelp(cb?: () => void): void;
outputHelp(cb?: (str: string) => string): void;
/** Output help information and exit. */
help(): void;
@@ -43,3 +43,11 @@ app.use(session({
secret: 'secret',
store: new MongoStore({db: mongoDb})
}));
// NativeMongoPromiseOptions
var Client = mongodb.MongoClient;
var mongoDbPromise = Client.connect('mongodb://localhost/test');
app.use(session({
secret: 'secret',
store: new MongoStore({ dbPromise: mongoDbPromise})
}));
+6 -4
View File
@@ -91,14 +91,16 @@ declare namespace connectMongo {
mongooseConnection: mongoose.Connection;
}
export interface NaitiveMongoOptions extends DefaultOptions {
export interface NativeMongoOptions extends DefaultOptions {
db: mongodb.Db;
}
export interface NativeMongoPromiseOptions extends DefaultOptions {
dbPromise: Promise<mongodb.Db>;
}
export interface MongoStoreFactory {
new (options: MongoUrlOptions): MongoStore;
new (options: MogooseConnectionOptions): MongoStore;
new (options: NaitiveMongoOptions): MongoStore;
new(options: MongoUrlOptions | MogooseConnectionOptions | NativeMongoOptions | NativeMongoPromiseOptions): MongoStore;
}
export class MongoStore extends session.Store {
@@ -0,0 +1,44 @@
import connectPgSimple = require("connect-pg-simple");
import * as session from "express-session";
import * as pg from "pg";
import * as express from "express";
const pgSession = connectPgSimple(session);
const pgPool = new pg.Pool({});
const store1: session.Store = new pgSession({
pool: pgPool,
tableName: "user_sessions",
pruneSessionInterval: 300
});
const app = express();
app.use(session({
store: store1,
secret: "foo"
}));
const store2: session.Store = new pgSession({
conString: "postgres://postgres@localhost:5432/foo",
ttl: 3600,
schemaName: "someschema",
pruneSessionInterval: false,
errorLog: (...args) => console.error(...args)
});
const store3 = new pgSession({
conObject: {
host: "localhost",
user: "database-user",
max: 20,
idleTimeoutMillis: 30000
}
});
const store4 = new pgSession();
store4.close();
store4.pruneSessions();
store4.pruneSessions(err => console.log(err));
+33
View File
@@ -0,0 +1,33 @@
// Type definitions for connect-pg-simple 4.2
// Project: https://github.com/voxpelli/node-connect-pg-simple#readme
// Definitions by: Pasi Eronen <https://github.com/pasieronen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
import { RequestHandler } from "express";
import { Store, SessionOptions } from "express-session";
import { Pool, PoolConfig } from "pg";
declare function connectPgSimple(session: (options?: SessionOptions) => RequestHandler): typeof connectPgSimple.PGStore;
declare namespace connectPgSimple {
class PGStore extends Store {
constructor(options?: PGStoreOptions);
close(): void;
pruneSessions(callback?: (err: Error) => void): void;
}
interface PGStoreOptions {
pool?: Pool;
pgPromise?: object; // not typed to avoid dependency to "pg-promise" module (which includes its own types)
conString?: string;
conObject?: PoolConfig;
ttl?: number;
schemaName?: string;
tableName?: string;
pruneSessionInterval?: false | number;
// tslint:disable-next-line:prefer-method-signature
errorLog?: (...args: any[]) => void;
}
}
export = connectPgSimple;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"connect-pg-simple-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+2 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for convict 4.0
// Type definitions for convict 4.1
// Project: https://github.com/mozilla/node-convict
// Definitions by: Wim Looman <https://github.com/Nemo157>
// Vesa Poikajärvi <https://github.com/vesse>
@@ -118,7 +118,7 @@ declare namespace convict {
interface convict {
addFormat(format: convict.Format): void;
addFormats(formats: { [name: string]: convict.Format }): void;
(config: convict.Schema): convict.Config;
(config: convict.Schema | string): convict.Config;
}
declare var convict: convict;
export = convict;
+1 -1
View File
@@ -25,7 +25,7 @@ interface Window {
* NOTE: The InAppBrowser window behaves like a standard web browser, and can't access Cordova APIs.
*/
interface InAppBrowser extends Window {
onloadstart(type: InAppBrowserEvent): void;
onloadstart(type: Event): void;
onloadstop(type: InAppBrowserEvent): void;
onloaderror(type: InAppBrowserEvent): void;
onexit(type: InAppBrowserEvent): void;
@@ -20,4 +20,4 @@
"index.d.ts",
"cordova-plugin-inappbrowser-tests.ts"
]
}
}
+4
View File
@@ -11,6 +11,10 @@ wordArray = CryptoJS.SHA1('some message', 'some key', { any: true });
wordArray = CryptoJS.format.OpenSSL('some message');
wordArray = CryptoJS.format.OpenSSL('some message', 'some key');
var FR = new FileReader();
FR.onloadend = () => {
var hash = CryptoJS.SHA1(CryptoJS.lib.WordArray.create(FR.result)).toString()
}
// Ciphers
var encrypted: CryptoJS.WordArray;
+10 -1
View File
@@ -8,7 +8,7 @@ export as namespace CryptoJS;
declare var CryptoJS: CryptoJS.Hashes;
declare namespace CryptoJS {
type Hash = (message: string, key?: string, ...options: any[]) => WordArray;
type Hash = (message: string | LibWordArray, key?: string, ...options: any[]) => WordArray;
interface Cipher {
encrypt(message: string, secretPassphrase: string, option?: CipherOption): WordArray;
decrypt(encryptedMessage: string | WordArray, secretPassphrase: string, option?: CipherOption): DecryptedMessage;
@@ -25,6 +25,10 @@ declare namespace CryptoJS {
process(messagePart: string): string;
finalize(): string;
}
interface LibWordArray {
sigBytes: number,
words: number[],
}
export interface WordArray {
iv: string;
salt: string;
@@ -97,6 +101,11 @@ declare namespace CryptoJS {
Utf16LE: Encoder;
Base64: Encoder;
};
lib: {
WordArray: {
create: (v: any) => LibWordArray;
};
};
mode: {
CBC: Mode;
CFB: Mode;
+162
View File
@@ -370,6 +370,168 @@ simNodeNumberAccessor = forcePosY.y();
forcePosY.initialize(graph.nodes);
forcePosY(0.1); // alpha
// ForceRadial ==============================================================================
// create ForceRadial force --------------------------------------------------------------
let forceRadial: d3Force.ForceRadial<SimNode>;
// Radius set only
forceRadial = d3Force.forceRadial<SimNode>(50);
forceRadial = d3Force.forceRadial<SimNode>((node, index, nodes) => {
const n: SimNode = node;
const i: number = index;
const ns: SimNode[] = nodes;
return 50 * n.group;
});
// Radius and x-coordinate of center set only
forceRadial = d3Force.forceRadial<SimNode>(50, 10);
forceRadial = d3Force.forceRadial<SimNode>(
50, // radius
(node, index, nodes) => {
const n: SimNode = node;
const i: number = index;
const ns: SimNode[] = nodes;
return 10 * n.group;
} // center-x
);
// Radius and center set
forceRadial = d3Force.forceRadial<SimNode>(50, 10, 10);
forceRadial = d3Force.forceRadial<SimNode>(
50, // radius
10, // center-x
(node, index, nodes) => {
const n: SimNode = node;
const i: number = index;
const ns: SimNode[] = nodes;
return 10 * n.group;
} // center-y
);
forceRadial = d3Force.forceRadial<SimNode>(
(node, index, nodes) => {
const n: SimNode = node;
const i: number = index;
const ns: SimNode[] = nodes;
return 50 * n.group;
}, // radius
(node, index, nodes) => {
const n: SimNode = node;
const i: number = index;
const ns: SimNode[] = nodes;
return 10 * n.group;
}, // center-x
(node, index, nodes) => {
const n: SimNode = node;
const i: number = index;
const ns: SimNode[] = nodes;
return 10 * n.group;
} // center-y
);
// Configure ForceRadial force -----------------------------------------------------------
// strength
forceRadial = forceRadial.strength(0.2);
forceRadial = forceRadial.strength((node, index, nodes) => {
const n: SimNode = node;
const i: number = index;
const ns: SimNode[] = nodes;
return 0.1 * n.group;
});
simNodeNumberAccessor = forceRadial.strength();
// radius
forceRadial = forceRadial.radius(100);
forceRadial = forceRadial.radius((node, index, nodes) => {
const n: SimNode = node;
const i: number = index;
const ns: SimNode[] = nodes;
let target: number;
switch (n.group) {
case 1:
target = 100;
break;
case 2:
target = 200;
break;
case 3:
target = 300;
break;
default:
target = 0;
break;
}
return target;
});
simNodeNumberAccessor = forceRadial.radius();
// x
forceRadial = forceRadial.x(100);
forceRadial = forceRadial.x((node, index, nodes) => {
const n: SimNode = node;
const i: number = index;
const ns: SimNode[] = nodes;
let target: number;
switch (n.group) {
case 1:
target = 100;
break;
case 2:
target = 200;
break;
case 3:
target = 300;
break;
default:
target = 0;
break;
}
return target;
});
simNodeNumberAccessor = forceRadial.x();
// y
forceRadial = forceRadial.y(100);
forceRadial = forceRadial.y((node, index, nodes) => {
const n: SimNode = node;
const i: number = index;
const ns: SimNode[] = nodes;
let target: number;
switch (n.group) {
case 1:
target = 100;
break;
case 2:
target = 200;
break;
case 3:
target = 300;
break;
default:
target = 0;
break;
}
return target;
});
simNodeNumberAccessor = forceRadial.y();
// Use ForceRadial force -----------------------------------------------------------------
forceRadial.initialize(graph.nodes);
forceRadial(0.1); // alpha
// -------------------------------------------------------------------------------------
// Test Force Simulation
// -------------------------------------------------------------------------------------
+173 -5
View File
@@ -1,9 +1,9 @@
// Type definitions for D3JS d3-force module 1.0
// Type definitions for D3JS d3-force module 1.1
// Project: https://github.com/d3/d3-force/
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.0.4
// Last module patch version validated against: 1.1.0
// -----------------------------------------------------------------------
// Force Simulation
@@ -66,14 +66,18 @@ export interface SimulationNodeDatum {
export interface SimulationLinkDatum<NodeDatum extends SimulationNodeDatum> {
/**
* Link’s source node.
* For convenience, a link’s source property may be initialized using numeric or string identifiers rather than object references; see link.id.
* For convenience, a link’s source and target properties may be initialized using numeric or string identifiers rather than object references; see link.id.
* When the link force is initialized (or re-initialized, as when the nodes or links change), any link.source or link.target property which is not an object
* is replaced by an object reference to the corresponding node with the given identifier.
* After initialization, the source property represents the source node object.
*/
source: NodeDatum | string | number;
/**
* Link’s source link
* For convenience, a link’s target property may be initialized using numeric or string identifiers rather than object references; see link.id.
* After initialization, the target property represents the source node object.
* For convenience, a link’s source and target properties may be initialized using numeric or string identifiers rather than object references; see link.id.
* When the link force is initialized (or re-initialized, as when the nodes or links change), any link.source or link.target property which is not an object
* is replaced by an object reference to the corresponding node with the given identifier.
* After initialization, the target property represents the target node object.
*/
target: NodeDatum | string | number;
/**
@@ -565,6 +569,8 @@ export interface ForceLink<NodeDatum extends SimulationNodeDatum, LinkDatum exte
* * index - the zero-based index into links, assigned by this method
*
* For convenience, a link’s source and target properties may be initialized using numeric or string identifiers rather than object references; see link.id.
* When the link force is initialized (or re-initialized, as when the nodes or links change), any link.source or link.target property which is not an object
* is replaced by an object reference to the corresponding node with the given identifier.
* If the specified array of links is modified, such as when links are added to or removed from the simulation,
* this method must be called again with the new (or changed) array to notify the force of the change;
* the force does not make a defensive copy of the specified array.
@@ -1072,3 +1078,165 @@ export function forceY<NodeDatum extends SimulationNodeDatum>(y: number): ForceY
* The function returns the y-coordinate.
*/
export function forceY<NodeDatum extends SimulationNodeDatum>(y: (d: NodeDatum, i: number, data: NodeDatum[]) => number): ForceY<NodeDatum>;
/**
* The radial force is similar to the x- and y-positioning forces, except it pushes nodes towards the closest point on a given circle.
* The circle is of the specified radius centered at ⟨x,y⟩. If x and y are not specified, they default to ⟨0,0⟩.
* The strength of the force is proportional to the one-dimensional distance between the node’s position and the target position.
* While this force can be used to position individual nodes, it is intended primarily for global forces that apply to all (or most) nodes.
*
* The generic refers to the type of data for a node.
*/
export interface ForceRadial<NodeDatum extends SimulationNodeDatum> extends Force<NodeDatum, any> {
/**
* Assign the array of nodes to this force. This method is called when a force is bound to a simulation via simulation.force
* and when the simulation’s nodes change via simulation.nodes.
*
* A force may perform necessary work during initialization, such as evaluating per-node parameters, to avoid repeatedly performing work during each application of the force.
*/
initialize(nodes: NodeDatum[]): void;
/**
* Returns the current strength accessor, which defaults to a constant strength for all nodes of 0.1.
*/
strength(): (d: NodeDatum, i: number, data: NodeDatum[]) => number;
/**
* Set the strength accessor to the specified constant strength for all nodes, re-evaluates the strength accessor for each node, and returns this force.
*
* The strength determines how much to increment the node’s x-velocity: (x - node.x) × strength.
*
* For example, a value of 0.1 indicates that the node should move a tenth of the way from its current x-position to the target x-position with each application.
* Higher values moves nodes more quickly to the target position, often at the expense of other forces or constraints.
*
* A value outside the range [0,1] is not recommended.
*
* The constant is internally wrapped into a strength accessor function.
*
* The strength accessor is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes.
* The resulting number is then stored internally, such that the strength of each node is only recomputed when the force is initialized or
* when this method is called with a new strength, and not on every application of the force.
*
* @param strength Constant value of strength to be used for all nodes.
*/
strength(strength: number): this;
/**
* Set the strength accessor to the specified function, re-evaluates the strength accessor for each node, and returns this force.
*
* The strength determines how much to increment the node’s x-velocity: (x - node.x) × strength.
*
* For example, a value of 0.1 indicates that the node should move a tenth of the way from its current x-position to the target x-position with each application.
* Higher values moves nodes more quickly to the target position, often at the expense of other forces or constraints.
*
* A value outside the range [0,1] is not recommended.
*
* The strength accessor is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes.
* The resulting number is then stored internally, such that the strength of each node is only recomputed when the force is initialized or
* when this method is called with a new strength, and not on every application of the force.
*
* @param strength A strength accessor function which is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes.
* The function returns the strength.
*/
strength(strength: (d: NodeDatum, i: number, data: NodeDatum[]) => number): this;
/**
* Return the current radius accessor for the circle.
*/
radius(): (d: NodeDatum, i: number, data: NodeDatum[]) => number;
/**
* Set the radius accessor for the circle to the specified number, re-evaluates the radius accessor for each node,
* and returns this force.
*
* The constant is internally wrapped into a radius accessor function.
*
* The radius accessor is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes.
* The resulting number is then stored internally, such that radius of the circle for each node is only recomputed when the force is initialized or
* when this method is called with a new radius, and not on every application of the force.
*
* @param radius Constant radius of the circle to be used for all nodes.
*/
radius(radius: number): this;
/**
* Set the radius accessor for the circle to the specified function, re-evaluates the radius accessor for each node,
* and returns this force.
*
* The radius accessor is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes.
* The resulting number is then stored internally, such that radius of the circle for each node is only recomputed when the force is initialized or
* when this method is called with a new radius, and not on every application of the force.
*
* @param radius A radius accessor function for the circle which is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes.
* The function returns the radius of the circle.
*/
radius(radius: (d: NodeDatum, i: number, data: NodeDatum[]) => number): this;
/**
* Return the current x-accessor for the circle center, which defaults to a function returning 0 for all nodes.
*/
x(): (d: NodeDatum, i: number, data: NodeDatum[]) => number;
/**
* Set the x-coordinate accessor for the circle center to the specified number, re-evaluates the x-accessor for each node,
* and returns this force.
*
* The constant is internally wrapped into an x-coordinate accessor function.
*
* The x-accessor is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes.
* The resulting number is then stored internally, such that the x-coordinate of the circle center for each node is only recomputed when the force is initialized or
* when this method is called with a new x, and not on every application of the force.
*
* @param x Constant x-coordinate of the circle center to be used for all nodes.
*/
x(x: number): this;
/**
* Set the x-coordinate accessor to the specified function, re-evaluates the x-accessor for each node,
* and returns this force.
*
* The x-accessor is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes.
* The resulting number is then stored internally, such that the x-coordinate of the circle center for each node is only recomputed when the force is initialized or
* when this method is called with a new x, and not on every application of the force.
*
* @param x A x-coordinate accessor function for the circle center which is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes.
* The function returns the x-coordinate of the circle center.
*/
x(x: (d: NodeDatum, i: number, data: NodeDatum[]) => number): this;
/**
* Return the current y-accessor for the circle center, which defaults to a function returning 0 for all nodes.
*/
y(): (d: NodeDatum, i: number, data: NodeDatum[]) => number;
/**
* Set the y-coordinate accessor for the circle center to the specified number, re-evaluates the y-accessor for each node,
* and returns this force.
*
* The constant is internally wrapped into an y-coordinate accessor function.
*
* The y-accessor is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes.
* The resulting number is then stored internally, such that the y-coordinate of the circle center for each node is only recomputed when the force is initialized or
* when this method is called with a new y, and not on every application of the force.
*
* @param y Constant y-coordinate of the circle center to be used for all nodes.
*/
y(y: number): this;
/**
* Set the y-coordinate accessor to the specified function, re-evaluates the y-accessor for each node,
* and returns this force.
*
* The y-accessor is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes.
* The resulting number is then stored internally, such that the y-coordinate of the circle center for each node is only recomputed when the force is initialized or
* when this method is called with a new y, and not on every application of the force.
*
* @param y A y-coordinate accessor function for the circle center which is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes.
* The function returns the y-coordinate of the circle center.
*/
y(y: (d: NodeDatum, i: number, data: NodeDatum[]) => number): this;
}
/**
* Create a new radial positioning force towards a circle of the specified radius centered at ⟨x,y⟩.
* If x and y are not specified, they default to ⟨0,0⟩.
*
* The strength of the force is proportional to the one-dimensional distance between the node’s position and the target position.
* While this force can be used to position individual nodes, it is intended primarily for global forces that apply to all (or most) nodes.
*
* The generic refers to the type of data for a node.
*/
export function forceRadial<NodeDatum extends SimulationNodeDatum>(radius: number | ((d: NodeDatum, i: number, data: NodeDatum[]) => number),
x?: number | ((d: NodeDatum, i: number, data: NodeDatum[]) => number), y?: number | ((d: NodeDatum, i: number, data: NodeDatum[]) => number)): ForceRadial<NodeDatum>;
+17
View File
@@ -371,6 +371,13 @@ const inverted2: [number, number] = constructedProjection.invert([54, 2]);
// TODO ?????
// let stream: d3Geo.Stream = constructedProjection.stream([54, 2]);
const preClip: (stream: d3Geo.GeoStream) => d3Geo.GeoStream = constructedProjection.preclip();
constructedProjection = constructedProjection.preclip(d3Geo.geoClipAntimeridian);
constructedProjection = constructedProjection.preclip(d3Geo.geoClipCircle(45));
const postClip: (stream: d3Geo.GeoStream) => d3Geo.GeoStream = constructedProjection.postclip();
constructedProjection = constructedProjection.postclip(d3Geo.geoClipRectangle(0, 0, 1, 1));
const clipAngle: number = constructedProjection.clipAngle();
constructedProjection = constructedProjection.clipAngle(null);
constructedProjection = constructedProjection.clipAngle(45);
@@ -686,3 +693,13 @@ d3Geo.geoStream(sampleExtendedFeature1, stream);
d3Geo.geoStream(sampleExtendedFeature2, stream);
d3Geo.geoStream(sampleFeatureCollection, stream);
d3Geo.geoStream(sampleExtendedFeatureCollection, stream);
// ----------------------------------------------------------------------
// Clipping Function
// ----------------------------------------------------------------------
let clippingFunction: (stream: d3Geo.GeoStream) => d3Geo.GeoStream;
clippingFunction = d3Geo.geoClipAntimeridian;
clippingFunction = d3Geo.geoClipCircle(45);
clippingFunction = d3Geo.geoClipRectangle(0, 0, 1, 1);
+66 -2
View File
@@ -1,9 +1,9 @@
// Type definitions for D3JS d3-geo module 1.7
// Type definitions for D3JS d3-geo module 1.8
// Project: https://github.com/d3/d3-geo/
// Definitions by: Hugues Stefanski <https://github.com/Ledragon>, Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.7.1
// Last module patch version validated against: 1.8.1
import * as GeoJSON from 'geojson';
@@ -645,6 +645,34 @@ export interface GeoProjection extends GeoStreamWrapper {
*/
center(point: [number, number]): this;
/**
* Returns the current spherical clipping function.
* Pre-clipping occurs in geographic coordinates. Cutting along the antimeridian line,
* or clipping along a small circle are the most common strategies.
*/
preclip(): (stream: GeoStream) => GeoStream;
/**
* Sets the projection’s spherical clipping to the specified function and returns the projection.
* Pre-clipping occurs in geographic coordinates. Cutting along the antimeridian line, or clipping along a small circle are the most common strategies.
*
* @param preclip A spherical clipping function. Clipping functions are implemented as transformations of a projection stream.
* Pre-clipping operates on spherical coordinates, in radians.
*/
preclip(preclip: (stream: GeoStream) => GeoStream): this;
/**
* Returns the current cartesian clipping function.
* Post-clipping occurs on the plane, when a projection is bounded to a certain extent such as a rectangle.
*/
postclip(): (stream: GeoStream) => GeoStream;
/**
* Sets the projection’s cartesian clipping to the specified function and returns the projection.
*
* @param postclip A cartesian clipping function. Clipping functions are implemented as transformations of a projection stream.
* Post-clipping operates on planar coordinates, in pixels.
*/
postclip(postclip: (stream: GeoStream) => GeoStream): this;
/**
* Returns the current clip angle which defaults to null.
*
@@ -653,6 +681,7 @@ export interface GeoProjection extends GeoStreamWrapper {
clipAngle(): number | null;
/**
* Switches to antimeridian cutting rather than small-circle clipping.
* See also projection.preclip, d3.geoClipAntimeridian, d3.geoClipCircle.
*
* @param angle Set to null to switch to antimeridian cutting.
*/
@@ -661,6 +690,8 @@ export interface GeoProjection extends GeoStreamWrapper {
* Sets the projection’s clipping circle radius to the specified angle in degrees and returns the projection.
* Small-circle clipping is independent of viewport clipping via projection.clipExtent.
*
* See also projection.preclip, d3.geoClipAntimeridian, d3.geoClipCircle.
*
* @param angle Angle in degrees.
*/
clipAngle(angle: number): this;
@@ -675,6 +706,8 @@ export interface GeoProjection extends GeoStreamWrapper {
*
* Viewport clipping is independent of small-circle clipping via projection.clipAngle.
*
* See also projection.postclip, d3.geoClipRectangle.
*
* @param extent Set to null to disable viewport clipping.
*/
clipExtent(extent: null): this;
@@ -684,6 +717,8 @@ export interface GeoProjection extends GeoStreamWrapper {
*
* Viewport clipping is independent of small-circle clipping via projection.clipAngle.
*
* See also projection.postclip, d3.geoClipRectangle.
*
* @param extent The extent bounds are specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left-side of the viewport, y₀ is the top, x₁ is the right and y₁ is the bottom.
*/
clipExtent(extent: [[number, number], [number, number]]): this;
@@ -1551,3 +1586,32 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
* Returns the identity transform which can be used to scale, translate and clip planar geometry.
*/
export function geoIdentity(): GeoIdentityTranform;
// ----------------------------------------------------------------------
// Clipping Functions
// ----------------------------------------------------------------------
/**
* A clipping function transforming a stream such that geometries (lines or polygons) that cross the antimeridian line are cut in two, one on each side.
* Typically used for pre-clipping.
*/
export const geoClipAntimeridian: ((stream: GeoStream) => GeoStream);
/**
* Generates a clipping function transforming a stream such that geometries are bounded by a small circle of radius angle around the projection’s center.
* Typically used for pre-clipping.
*
* @param angle
*/
export function geoClipCircle(angle: number): (stream: GeoStream) => GeoStream;
/**
* Generates a clipping function transforming a stream such that geometries are bounded by a rectangle of coordinates [[x0, y0], [x1, y1]].
* Typically used for post-clipping.
*
* @param x0 x0 coordinate.
* @param y0 y0 coordinate.
* @param x1 x1 coordinate.
* @param y1 y1 coordinate.
*/
export function geoClipRectangle(x0: number, y0: number, x1: number, y1: number): (stream: GeoStream) => GeoStream;
+10
View File
@@ -0,0 +1,10 @@
import * as dagre from "dagre-layout";
const graph = new dagre.graphlib.Graph();
graph.setGraph({})
.setDefaultEdgeLabel(() => ({}))
.setNode("a", {})
.setEdge("b", "c")
.setEdge("c", "d", {class: "class"});
dagre.layout(graph);
+51
View File
@@ -0,0 +1,51 @@
// Type definitions for dagre-layout 0.8
// Project: https://github.com/tylingsoft/dagre-layout#readme
// Definitions by: Qinfeng Chen <https://github.com/qinfchen>
// Lisa Vallfors <https://github.com/Frankrike>
// Pete Vilter <https://github.com/vilterp>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// copied from definitions for dagre, since dagre-layout is a drop-in replacement
export namespace graphlib {
class Graph {
edges(): Edge[];
edge(id: any): any;
nodes(): string[];
node(id: any): any;
setDefaultEdgeLabel(callback: string|(() => string|object)): Graph;
setDefaultNodeLabel(callback: string|(() => string|object)): Graph;
setEdge(sourceId: string, targetId: string, options?: { [key: string]: any }, value?: string): Graph;
setEdge(params: {v: string, w: string, name?: string}, value?: string): Graph;
setGraph(label: GraphLabel): Graph;
setNode(id: string, node: { [key: string]: any }): Graph;
graph(): GraphLabel;
constructor(opt?: {directed?: boolean, multigraph?: boolean, compound?: boolean});
setParent(name: string, parentName: string): void;
hasNode(name: string): boolean;
}
}
export interface GraphLabel {
width?: number;
height?: number;
compound?: boolean;
rankdir?: string;
align?: string;
nodesep?: number;
edgesep?: number;
ranksep?: number;
marginx?: number;
marginy?: number;
acyclicer?: string;
ranker?: string;
}
export function layout(graph: graphlib.Graph): void;
export interface Edge {
v: string;
w: string;
name?: string;
}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"dagre-layout-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+3
View File
@@ -4,6 +4,7 @@
// Nicolas Laplante <https://github.com/nlaplante>
// ByeongHun Yoo <https://github.com/isac322>
// Ray Fang <https://github.com/lazarusx>
// Marius Meisenzahl <https://github.com/meisenzahl>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -444,6 +445,7 @@ declare namespace Dockerode {
}
interface HostConfig {
AutoRemove: boolean;
Binds: string[];
ContainerIDFile: string;
LogConfig: {
@@ -593,6 +595,7 @@ declare namespace Dockerode {
ExposedPorts?: { [port: string]: {} };
StopSignal?: string;
HostConfig?: {
AutoRemove?: boolean;
Binds?: string[];
Links?: string[];
Memory?: number;
+1
View File
@@ -31,6 +31,7 @@ declare namespace Dropzone {
url?: string;
method?: string;
withCredentials?: boolean;
timeout?: number;
parallelUploads?: number;
uploadMultiple?: boolean;
maxFilesize?: number;
@@ -0,0 +1,3 @@
import dtsGenerator = require('dts-generator');
dtsGenerator({name: 'foo', out: 'bar'});
+86
View File
@@ -0,0 +1,86 @@
// Type definitions for dts-generator 2.1
// Project: https://github.com/SitePen/dts-generator#readme
// Definitions by: Matt Traynham <https://github.com/mtraynham>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import ts = require('typescript');
import Bluebird = require('bluebird');
export = dtsGenerator;
declare function dtsGenerator(options: dtsGenerator.DtsGeneratorOptions): Bluebird<void>;
declare namespace dtsGenerator {
interface ResolveModuleIdParams {
/** The identifier of the module being declared in the generated d.ts */
currentModuleId: string;
}
interface ResolveModuleImportParams {
/** The identifier of the module currently being imported in the generated d.ts */
importedModuleId: string;
/** The identifier of the enclosing module currently being declared in the generated d.ts */
currentModuleId: string;
/** True if the imported module id is declared as a module in the input files. */
isDeclaredExternalModule: boolean;
}
interface DtsGeneratorOptions {
/**
* The base directory for the package being bundled. Any dependencies discovered outside this directory will be excluded
* from the bundle.
* Note this is no longer the preferred way to configure dts-generator, please see project.
*/
baseDir?: string;
/**
* A list of glob patterns, relative to baseDir, that should be excluded from the bundle.
* Use the --exclude flag one or more times on the command-line. Defaults to [ "node_modules\/**\/*.d.ts" ].
*/
exclude?: string[];
/**
* A list of external module reference paths that should be inserted as reference comments.
* Use the --extern flag one or more times on the command-line.
*/
externs?: string[];
/**
* A list of external @types package dependencies that should be inserted as reference comments.
* Use the --types flag one or more times on the command-line.
*/
types?: string[];
/** A list of files from the baseDir to bundle. */
files?: string[];
/** The end-of-line character that should be used when outputting code. Defaults to os.EOL. */
eol?: string;
/** The character(s) that should be used to indent the declarations in the output. Defaults to \t. */
indent?: string;
/** The module ID that should be used as the exported value of the package’s “main” module. */
main?: string;
/** The type of module resolution to use when generating the bundle. */
moduleResolution?: ts.ModuleResolutionKind;
/** The name of the package. Used to determine the correct exported package name for modules. */
name: string;
/** The filename where the generated bundle will be created. */
out: string;
/**
* The base directory for the project being bundled. It is assumed that this directory contains a
* tsconfig.json which will be parsed to determine the files that should be bundled as well as
* other configuration information like target
*/
project?: string;
/** The target environment for generated code. Defaults to ts.ScriptTarget.Latest. */
target?: ts.ScriptTarget;
/**
* An optional callback provided by the invoker to customize the declared module ids the output d.ts files.
* @see {@link https://github.com/SitePen/dts-generator/blob/master/docs/resolving-module-ids.md Resolving Module Ids}
*/
resolveModuleId?(params: ResolveModuleIdParams): string;
/**
* An optional callback provided by the invoker to customize the imported module ids in the output d.ts files.
* @see {@link https://github.com/SitePen/dts-generator/blob/master/docs/resolving-module-ids.md Resolving Module Ids}
*/
resolveModuleImport?(params: ResolveModuleImportParams): string;
}
}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"dts-generator-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+16
View File
@@ -0,0 +1,16 @@
import duplexify = require("duplexify");
import { Readable, Writable, Duplex } from "stream";
declare var readable: Readable;
declare var writable: Writable;
duplexify(writable, readable);
duplexify(writable);
duplexify(undefined, readable);
const d: duplexify.Duplexify = duplexify();
d.setReadable(readable);
d.setReadable(); // $ExpectError
d.setWritable(writable);
d.setWritable(); // $ExpectError
const f: Duplex = d;
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for duplexify 3.5
// Project: https://github.com/mafintosh/duplexify
// Definitions by: Sami Kukkonen <https://github.com/strax>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import * as stream from "stream";
export = duplexify;
interface DuplexifyConstructor {
(writable?: stream.Writable, readable?: stream.Readable, streamOptions?: stream.DuplexOptions): duplexify.Duplexify;
new (writable?: stream.Writable, readable?: stream.Readable, streamOptions?: stream.DuplexOptions): duplexify.Duplexify;
}
declare var duplexify: DuplexifyConstructor;
declare namespace duplexify {
interface Duplexify extends stream.Duplex {
setWritable(writable: stream.Writable): void;
setReadable(readable: stream.Readable): void;
}
}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"duplexify-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,24 @@
import webpack = require('webpack');
import DuplicatePackageCheckerWebpackPlugin = require('duplicate-package-checker-webpack-plugin');
const a: webpack.Configuration = {
entry: 'test.js',
plugins: [
new DuplicatePackageCheckerWebpackPlugin()
]
};
const b: webpack.Configuration = {
entry: 'test.js',
plugins: [
new DuplicatePackageCheckerWebpackPlugin({})
]
};
const c: webpack.Configuration = {
entry: 'test.js',
plugins: [
new DuplicatePackageCheckerWebpackPlugin({
verbose: true,
emitError: true
})
]
};
@@ -0,0 +1,21 @@
// Type definitions for duplicate-package-checker-webpack-plugin 1.2
// Project: https://github.com/darrenscerri/duplicate-package-checker-webpack-plugin#readme
// Definitions by: Matt Traynham <https://github.com/mtraynham>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import webpack = require('webpack');
export = DuplicatePackageCheckerWebpackPlugin;
declare class DuplicatePackageCheckerWebpackPlugin extends webpack.Plugin {
constructor(options?: DuplicatePackageCheckerWebpackPlugin.Options);
}
declare namespace DuplicatePackageCheckerWebpackPlugin {
interface Options {
// Also show module that is requiring each duplicate package
verbose?: boolean;
// Emit errors instead of warnings
emitError?: boolean;
}
}
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"duplicate-package-checker-webpack-plugin-tests.ts"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+4 -4
View File
@@ -1,6 +1,6 @@
// Type definitions for dygraphs 1.1.2
// Type definitions for dygraphs 1.1.3
// Project: http://dygraphs.com
// Definitions by: Dan Vanderkam <http://danvk.org>
// Definitions by: Dan Vanderkam <https://github.com/danvk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="google.visualization" />
@@ -595,9 +595,9 @@ declare namespace dygraphs {
/**
* When to display the legend. By default, it only appears when a user mouses over the chart.
* Set it to "always" to always display a legend of some sort. When set to "follow", legend
* follows highlighted points.
* follows highlighted points. If set to 'never' then it will not appear at all.
*/
legend?: 'always' | 'follow' | 'onmouseover';
legend?: 'always' | 'follow' | 'onmouseover' | 'never';
/**
* for details see https://github.com/danvk/dygraphs/pull/683
+8 -8
View File
@@ -113,9 +113,9 @@ declare module Elasticsearch {
}
export interface Explanation {
value: number,
description: string,
details: Explanation[]
value: number;
description: string;
details: Explanation[];
}
export interface GenericParams {
@@ -543,7 +543,7 @@ declare module Elasticsearch {
inline: string;
lang: string;
}
}
};
}
export interface ReindexResponse {
@@ -555,7 +555,7 @@ declare module Elasticsearch {
retries: {
bulk: number;
search: number;
}
};
throttled_millis: number;
failures: any[];
}
@@ -1073,7 +1073,7 @@ declare module Elasticsearch {
tokenizer?: string;
explain?: boolean;
attributes?: NameList;
format?: ""
format?: "";
}
export interface IndicesClearCacheParams extends GenericParams {
@@ -1370,7 +1370,7 @@ declare module Elasticsearch {
masterTimeout?: TimeSpan;
body: {
actions: IndicesUpdateAliasesParamsAction[];
}
};
}
export interface IndicesUpdateAliasesParamsAction {
@@ -1386,7 +1386,7 @@ declare module Elasticsearch {
};
remove_index?: {
index: string;
}
};
}
export interface IndicesUpgradeParams extends GenericParams {
+24
View File
@@ -109,6 +109,10 @@ function ShallowWrapperTest() {
const diveWrapper: ShallowWrapper<TmpProps, TmpState> = shallowWrapper.dive<TmpProps, TmpState>({ context: { foobar: 'barfoo' } });
}
function test_hostNodes() {
shallowWrapper.hostNodes();
}
function test_equals() {
boolVal = shallowWrapper.equals(<div className="foo bar" />);
}
@@ -206,6 +210,14 @@ function ShallowWrapperTest() {
reactElements = shallowWrapper.getNodes();
}
function test_getElement() {
reactElement = shallowWrapper.getElement();
}
function test_getElements() {
reactElements = shallowWrapper.getElements();
}
function test_getDOMNode() {
domElement = shallowWrapper.getDOMNode();
}
@@ -417,6 +429,10 @@ function ReactWrapperTest() {
reactWrapper.detach();
}
function test_hostNodes() {
reactWrapper.hostNodes();
}
function test_find() {
elementWrapper = reactWrapper.find('.selector');
reactWrapper = reactWrapper.find(MyComponent);
@@ -545,6 +561,14 @@ function ReactWrapperTest() {
reactElements = reactWrapper.getNodes();
}
function test_getElement() {
reactElement = reactWrapper.getElement();
}
function test_getElements() {
reactElements = reactWrapper.getElements();
}
function test_getDOMNode() {
domElement = reactWrapper.getDOMNode();
}
+34 -1
View File
@@ -23,7 +23,7 @@ export class ElementClass extends Component<any, any> {
* all specified in the implementation. TS chooses the EnzymePropSelector overload and loses the generics
*/
export interface ComponentClass<Props> {
new (props?: Props, context?: any): Component<Props, any>;
new(props?: Props, context?: any): Component<Props, any>;
}
export type StatelessComponent<Props> = (props: Props, context?: any) => JSX.Element;
@@ -148,6 +148,16 @@ export interface CommonWrapper<P = {}, S = {}> {
*/
getNodes(): Array<ReactElement<any>>;
/**
* Returns the wrapper's underlying node.
*/
getElement(): ReactElement<any>;
/**
* Returns the wrapper's underlying node.
*/
getElements(): Array<ReactElement<any>>;
/**
* Returns the outer most DOMComponent of the current wrapper.
*/
@@ -422,6 +432,14 @@ export interface ShallowWrapper<P = {}, S = {}> extends CommonWrapper<P, S> {
*/
dive<P2, S2>(options?: ShallowRendererProps): ShallowWrapper<P2, S2>;
/**
* Strips out all the not host-nodes from the list of nodes
*
* This method is useful if you want to check for the presence of host nodes
* (actually rendered HTML elements) ignoring the React nodes.
*/
hostNodes(): ShallowWrapper<HTMLAttributes>;
/**
* Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node in the
* current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector.
@@ -480,6 +498,14 @@ export interface ReactWrapper<P = {}, S = {}> extends CommonWrapper<P, S> {
*/
detach(): void;
/**
* Strips out all the not host-nodes from the list of nodes
*
* This method is useful if you want to check for the presence of host nodes
* (actually rendered HTML elements) ignoring the React nodes.
*/
hostNodes(): ReactWrapper<HTMLAttributes>;
/**
* Find every node in the render tree that matches the provided selector.
* @param selector The selector to match.
@@ -612,3 +638,10 @@ export function mount<P, S>(node: ReactElement<P>, options?: MountRendererProps)
* @param [options]
*/
export function render<P, S>(node: ReactElement<P>, options?: any): Cheerio;
/**
* Configure enzyme to use the correct adapter for the react verstion
* This is enabling the Enzyme configuration with adapters in TS
* @param options
*/
export function configure(options: { adapter: any }): void;
+1 -1
View File
@@ -1,3 +1,3 @@
[*.ts]
indent_style = tab
indent_size = 4
indent_size = 2
+22
View File
@@ -0,0 +1,22 @@
## Event Kit Type Definitions
TypeScript type definitions for [event-kit](https://github.com/atom/event-kit), which is published [under the same name](https://www.npmjs.com/package/event-kit) on NPM.
### Usage Notes
#### Exports
The three classes exported from this module are: [CompositeDisposable](https://github.com/atom/event-kit/blob/master/src/composite-disposable.coffee), [Disposable](https://github.com/atom/event-kit/blob/master/src/disposable.coffee), and [Emitter](https://github.com/atom/event-kit/blob/master/src/emitter.coffee).
```ts
import { CompositeDisposable, Disposable, Emitter } from "event-kit";
let subscriptions = new CompositeDisposable();
```
#### The EventKit Namespace
All types used by "event-kit" can be referenced from the EventKit namespace.
```ts
function example(disposable: EventKit.DisposableLike) {}
```
+59 -33
View File
@@ -1,57 +1,83 @@
import { Disposable, CompositeDisposable, Emitter } from "event-kit";
// Emitter
declare let bool: boolean;
declare let subscription: EventKit.Disposable;
declare let subscriptions: EventKit.CompositeDisposable;
declare let emitter: EventKit.Emitter;
// NPM Usage Tests ============================================================
class User {
private emitter: Emitter;
private readonly emitter: EventKit.Emitter;
name: string;
constructor() {
this.emitter = new Emitter();
}
onDidChangeName(callback: (name: string) => void): Disposable {
return this.emitter.on('did-change-name', callback);
onDidChangeName(callback: (value: any) => void) {
return this.emitter.on("did-change-name", callback);
}
setName(name: string): void {
if (this.name != name) {
setName(name: string) {
if (name !== this.name) {
this.name = name;
this.emitter.emit('did-change-name', name);
this.emitter.emit("did-change-name", name);
}
return name;
}
destroy(): void {
this.emitter.clear();
destroy() {
this.emitter.dispose();
}
}
// Disposable
var disposable = new Disposable(() => {
// cleanup
});
disposable.dispose();
var user = new User();
var subscription = user.onDidChangeName((name: string) => {
console.log('User name change to: ' + name);
});
if(Disposable.isDisposable(subscription)) {}
const user = new User();
subscription = user.onDidChangeName(name => console.log("My name is #{name}"));
subscription.dispose();
// CompositeDisposable
// Disposable =================================================================
bool = subscription.disposed;
if (subscription.disposalAction) subscription.disposalAction();
subscription.dispose();
// CompositeDisposable ========================================================
// Properties
bool = subscriptions.disposed;
// Construction and Lifecycle
subscriptions = new CompositeDisposable();
new CompositeDisposable(subscription);
new CompositeDisposable(subscription, subscription);
new CompositeDisposable({ dispose() {} });
var subscriptions = new CompositeDisposable();
subscriptions.add(
user.onDidChangeName((name: string) => {
console.log('subscriber #1');
}),
user.onDidChangeName((name: string) => {
console.log('subscriber #2');
})
);
subscriptions.dispose();
// Managing Disposables
subscriptions.add(subscription);
subscriptions.add(
subscription,
{ dispose() {} }
);
subscriptions.remove(subscription);
subscriptions.remove({ dispose() {} });
subscriptions.delete(subscription);
subscriptions.delete({ dispose() {} });
subscriptions.clear();
// Emitter ====================================================================
bool = emitter.disposed;
emitter.clear();
emitter.dispose();
// Event Subscription
subscription = emitter.on("test-event", value => {});
emitter.once("test-event", value => {});
subscription = emitter.preempt("test-event", value => {});
// Event Emission
emitter.emit("test-event");
emitter.emit("test-event", 42);

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