Merge pull request #15421 from DefinitelyTyped/dtslint-ready-2

Apply new lint rules to more files
This commit is contained in:
Nathan Shively-Sanders
2017-03-27 11:11:08 -07:00
committed by GitHub
82 changed files with 519 additions and 890 deletions
+5 -5
View File
@@ -1,11 +1,11 @@
import { BloomFilter } from './index';
import { BloomFilter } from 'bloomfilter';
function test_bloomfilter() {
const m: number = 10;
const k: number = 2;
let bloomFilter = new BloomFilter(m, k);
let array: Array<Int32Array> = bloomFilter.buckets;
let length: number = bloomFilter.buckets.length;
const bloomFilter = new BloomFilter(m, k);
const array: Int32Array[] = bloomFilter.buckets;
const length: number = bloomFilter.buckets.length;
bloomFilter.add('someString');
let test: boolean = bloomFilter.test('someString');
const test: boolean = bloomFilter.test('someString');
}
+2 -2
View File
@@ -3,8 +3,8 @@
// Definitions by: slawiko <https://github.com/slawiko>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export declare class BloomFilter {
buckets: Array<Int32Array>;
export class BloomFilter {
buckets: Int32Array[];
constructor(m: number, k: number);
@@ -1,8 +1,6 @@
import blackhole = require("bunyan-blackhole");
var logsLaboursLost = blackhole("lost");
const logsLaboursLost = blackhole("lost");
const rotten = new Error("Something is rotten in the state of Denmark");
@@ -20,7 +18,5 @@ logsLaboursLost.info({play: "Much Ado About Nothing"}, "Let me be that I am and
logsLaboursLost.warn({play: "All's Well That Ends Well"}, "Love all, trust a few, do wrong to none");
logsLaboursLost.error({play: "All's Well That Ends Well"}, "Love all, trust a few, do wrong to none");
var hamlet = logsLaboursLost.child({play: "Hamlet"});
const hamlet = logsLaboursLost.child({play: "Hamlet"});
hamlet.info({character: "Polonius"}, "Though this be madness, yet there is method in't");
+5 -8
View File
@@ -1,14 +1,11 @@
import chai = require('chai');
import chaiSubset = require('chai-subset');
chai.use(chaiSubset);
var expect = chai.expect;
var assert = chai.assert;
const { assert, expect } = chai;
function test_containSubset() {
var obj = {
const obj = {
a: 'b',
c: 'd',
e: {
@@ -34,7 +31,7 @@ function test_containSubset() {
}
function test_notContainSubset() {
var obj = {
const obj = {
a: 'b',
c: 'd',
e: {
@@ -50,7 +47,7 @@ function test_notContainSubset() {
}
function test_arrayContainSubset() {
var list = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ];
const list = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ];
expect(list).to.containSubset([{a: 'a', b: 'b'}]);
list.should.containSubset([{a: 'a', b: 'b'}]);
@@ -58,7 +55,7 @@ function test_arrayContainSubset() {
}
function test_arrayNotContainSubset() {
var list = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ];
const list = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ];
expect(list).not.to.containSubset([{a: 'a', b: 'bd'}]);
list.should.not.containSubset([{a: 'a', b: 'bd'}]);
+5 -6
View File
@@ -1,16 +1,16 @@
import * as Clipboard from 'clipboard';
var cb1 = new Clipboard('.btn');
var cb2 = new Clipboard(document.getElementById('id'), {
const cb1 = new Clipboard('.btn');
const cb2 = new Clipboard(document.getElementById('id'), {
action: elem => 'copy'
});
var cb3 = new Clipboard(document.querySelectorAll('query'), {
const cb3 = new Clipboard(document.querySelectorAll('query'), {
text: elem => null
});
var cb4 = new Clipboard('.btn', {
const cb4 = new Clipboard('.btn', {
target: elem => null
});
var cb5 = new Clipboard('.btn', {
const cb5 = new Clipboard('.btn', {
action: elem => 'copy',
target: elem => null
});
@@ -25,4 +25,3 @@ cb2.on('success', e => {
e.clearSelection();
});
cb2.on('error', e => { });
+1 -1
View File
@@ -54,4 +54,4 @@ declare namespace Clipboard {
export = Clipboard;
export as namespace Clipboard;
export as namespace Clipboard;
@@ -1,33 +1,21 @@
// examples taken from https://github.com/litehelpers/Cordova-sqlite-storage
function echoTestFunction() {
function successCallback(value: string) {
}
function errorCallback() {
}
function successCallback(value: string) {}
function errorCallback() {}
window.sqlitePlugin.echoTest(successCallback, errorCallback);
}
function selfTestFunction() {
function successCallback() {
}
function errorCallback() {
}
function successCallback() {}
function errorCallback() {}
window.sqlitePlugin.selfTest(successCallback, errorCallback);
}
function openingDatabase() {
function successcb(db: SQLitePlugin.Database) {
function successcb(db: SQLitePlugin.Database) {}
function errorcb(err: Error) {}
}
function errorcb(err: Error) {
}
var db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}, successcb, errorcb);
var db = window.sqlitePlugin.openDatabase({name: 'my.db', iosDatabaseLocation: 'Library'}, successcb, errorcb);
let db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}, successcb, errorcb);
db = window.sqlitePlugin.openDatabase({name: 'my.db', iosDatabaseLocation: 'Library'}, successcb, errorcb);
}
function openingDatabase2() {
@@ -104,7 +92,7 @@ function sampleWithPRAGMA() {
// Cordova is ready
function onDeviceReady() {
var db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'});
const db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'});
db.transaction(tx => {
tx.executeSql('DROP TABLE IF EXISTS test_table');
@@ -134,14 +122,13 @@ function sampleWithPRAGMA() {
}
}
function sampleWithTransactionLevelNesting() {
// Wait for Cordova to load
document.addEventListener('deviceready', onDeviceReady, false);
// Cordova is ready
function onDeviceReady() {
var db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'});
const db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'});
db.transaction(tx => {
tx.executeSql('DROP TABLE IF EXISTS test_table');
@@ -155,7 +142,6 @@ function sampleWithTransactionLevelNesting() {
console.log("res.rows.length: " + res.rows.length + " -- should be 1");
console.log("res.rows.item(0).cnt: " + res.rows.item(0).cnt + " -- should be 1");
});
}, (tx, e) => {
console.log("ERROR: " + e.message);
});
@@ -163,18 +149,12 @@ function sampleWithTransactionLevelNesting() {
}
}
function dbClose(db: SQLitePlugin.Database) {
function successcb() {
}
function errorcb(err: Error) {
}
function successcb() {}
function errorcb(err: Error) {}
db.close(successcb, errorcb);
db.transaction(tx => {
tx.executeSql("SELECT LENGTH('tenletters') AS stringlength", [], (tx, res) => {
console.log('got stringlength: ' + res.rows.item(0).stringlength);
@@ -193,21 +173,16 @@ function dbClose(db: SQLitePlugin.Database) {
}
function deleteDatabase() {
function successcb() {
}
function errorcb(err: Error) {
}
function successcb() {}
function errorcb(err: Error) {}
window.sqlitePlugin.deleteDatabase({name: 'my.db', location: 'default'}, successcb, errorcb);
}
function quickInstallationTest() {
window.sqlitePlugin.openDatabase({ name: 'hello-world.db', location: 'default' }, db => {
db.executeSql("select length('tenletters') as stringlength", [], res => {
var stringlength = res.rows.item(0).stringlength;
const stringlength = res.rows.item(0).stringlength;
console.log('got stringlength: ' + stringlength);
// document.getElementById('deviceready').querySelector('.received').innerHTML = 'stringlength: ' + stringlength;
});
-1
View File
@@ -65,4 +65,3 @@ declare namespace SQLitePlugin {
echoTest(ok?: (value: string) => void, error?: (msg: string) => void): void;
}
}
+13 -13
View File
@@ -1,20 +1,21 @@
import parse = require('csv-parse');
function callbackAPITest() {
var input = '#Welcome\n"1","2","3","4"\n"a","b","c","d"';
const input = '#Welcome\n"1","2","3","4"\n"a","b","c","d"';
parse(input, {comment: '#'}, (err, output) => {
output.should.eql([ [ '1', '2', '3', '4' ], [ 'a', 'b', 'c', 'd' ] ]);
});
}
function streamAPITest() {
let output: string[][] = [];
const output: string[][] = [];
// Create the parser
var parser = parse({delimiter: ':'});
let record: string[];
const parser = parse({delimiter: ':'});
// Use the writable stream api
parser.on('readable', () => {
while (record = parser.read()) {
while (true) {
const record = parser.read();
if (!record) break;
output.push(record);
}
});
@@ -35,12 +36,12 @@ function streamAPITest() {
import fs = require('fs');
function pipeFunctionTest() {
var transform = require('stream-transform');
const transform = require('stream-transform');
var output: any = [];
var parser = parse({delimiter: ':'})
var input = fs.createReadStream('/etc/passwd');
var transformer = transform((record: any[], callback: any) => {
const output: any = [];
const parser = parse({delimiter: ':'});
const input = fs.createReadStream('/etc/passwd');
const transformer = transform((record: any[], callback: any) => {
setTimeout(() => {
callback(null, record.join(' ') + '\n');
}, 500);
@@ -51,8 +52,7 @@ function pipeFunctionTest() {
import parseSync = require('csv-parse/lib/sync');
function syncApiTest() {
var input = '"key_1","key_2"\n"value 1","value 2"';
var records = parseSync(input, {columns: true});
const input = '"key_1","key_2"\n"value 1","value 2"';
const records = parseSync(input, {columns: true});
records.should.eql([{ key_1: 'value 1', key_2: 'value 2' }]);
}
+14 -14
View File
@@ -33,16 +33,16 @@ declare namespace parse {
* special constants are 'auto', 'unix', 'mac', 'windows', 'unicode';
* defaults to 'auto' (discovered in source or 'unix' if no source is specified).
*/
rowDelimiter?: string;
rowDelimiter?: string;
/**
* Optional character surrounding a field, one character only, defaults to double quotes.
*/
quote?: string
quote?: string;
/**
* Set the escape character, one character only, defaults to double quotes.
*/
escape?: string
escape?: string;
/**
* List of fields as an array,
@@ -55,62 +55,62 @@ declare namespace parse {
/**
* Treat all the characters after this one as a comment, default to '' (disabled).
*/
comment?: string
comment?: string;
/**
* Name of header-record title to name objects by.
*/
objname?: string
objname?: string;
/**
* Preserve quotes inside unquoted field.
*/
relax?: boolean
relax?: boolean;
/**
* Discard inconsistent columns count, default to false.
*/
relax_column_count?: boolean
relax_column_count?: boolean;
/**
* Dont generate empty values for empty lines.
*/
skip_empty_lines?: boolean
skip_empty_lines?: boolean;
/**
* Maximum numer of characters to be contained in the field and line buffers before an exception is raised,
* used to guard against a wrong delimiter or rowDelimiter,
* default to 128000 characters.
*/
max_limit_on_data_read?: number
max_limit_on_data_read?: number;
/**
* If true, ignore whitespace immediately around the delimiter, defaults to false.
* Does not remove whitespace in a quoted field.
*/
trim?: boolean
trim?: boolean;
/**
* If true, ignore whitespace immediately following the delimiter (i.e. left-trim all fields), defaults to false.
* Does not remove whitespace in a quoted field.
*/
ltrim?: boolean
ltrim?: boolean;
/**
* If true, ignore whitespace immediately preceding the delimiter (i.e. right-trim all fields), defaults to false.
* Does not remove whitespace in a quoted field.
*/
rtrim?: boolean
rtrim?: boolean;
/**
* If true, the parser will attempt to convert read data types to native types.
*/
auto_parse?: boolean
auto_parse?: boolean;
/**
* If true, the parser will attempt to convert read data types to dates. It requires the "auto_parse" option.
*/
auto_parse_date?: boolean
auto_parse_date?: boolean;
}
// TODO: what is this for?
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "../tslint.json" }
{
"extends": "../tslint.json",
"rules": {
"no-empty-interface": false
}
}
-8
View File
@@ -12,7 +12,6 @@ import * as d3Dsv from 'd3-dsv';
// Preperatory Steps
// ------------------------------------------------------------------------------------------
const csvTestString: string = '1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38';
const tsvTestString: string = '1997\tFord\tE350\t2.34\n2000\tMercury\tCougar\t2.38';
const pipedTestString: string = '1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38';
@@ -34,7 +33,6 @@ let parseMappedArray: d3Dsv.DSVParsedArray<ParsedTestObject>;
let parseRowsArray: string[][];
let parseRowsMappedArray: ParsedTestObject[];
let columns: string[];
let num: number;
let date: Date;
@@ -77,14 +75,12 @@ str = parseMappedArray[0].make;
str = parseMappedArray[0].model;
num = parseMappedArray[0].length;
// csvParseRows(...) ============================================================================
// without row mapper -----------------------------------------------------------------------
parseRowsArray = d3Dsv.csvParseRows(csvTestString);
str = parseRowsArray[0][0]; // 'Year' of first row
// date = parseRowsArray[0][0]; // fails, return value is string
@@ -158,14 +154,12 @@ str = parseMappedArray[0].make;
str = parseMappedArray[0].model;
num = parseMappedArray[0].length;
// tsvParseRows(...) ============================================================================
// without row mapper -----------------------------------------------------------------------
parseRowsArray = d3Dsv.tsvParseRows(tsvTestString);
str = parseRowsArray[0][0]; // 'Year' of first row
// date = parseRowsArray[0][0]; // fails, return value is string
@@ -244,14 +238,12 @@ str = parseMappedArray[0].make;
str = parseMappedArray[0].model;
num = parseMappedArray[0].length;
// parseRows(...) ============================================================================
// without row mapper -----------------------------------------------------------------------
parseRowsArray = dsv.parseRows(pipedTestString);
str = parseRowsArray[0][0]; // 'Year' of first row
// date = parseRowsArray[0][0]; // fails, return value is string
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+2 -5
View File
@@ -1,8 +1,5 @@
import d3dsv = require("d3-dsv");
var csv = d3dsv(",");
var rows = csv.parse("a,b,c\n1,2,3\n4,5,6");
const csv = d3dsv(",");
const rows = csv.parse("a,b,c\n1,2,3\n4,5,6");
-35
View File
@@ -1,4 +1,3 @@
/**
* Typescript definition tests for d3/d3-selection module
*
@@ -9,7 +8,6 @@
import * as d3Selection from 'd3-selection';
// ---------------------------------------------------------------------------------------
// Some preparatory work for definition testing below
// ---------------------------------------------------------------------------------------
@@ -56,7 +54,6 @@ interface CircleDatumAlternative {
// Tests of Top-Level Selection Functions
// ---------------------------------------------------------------------------------------
// test top-level .selection() -----------------------------------------------------------
const topSelection: d3Selection.Selection<HTMLElement, any, null, undefined> = d3Selection.selection();
@@ -101,16 +98,13 @@ maybeSVG2 = d3Selection.select<SVGSVGElement | null, any>(maybeSVG1.node());
// fails, as node type mismatches selection type
// let body7: d3Selection.Selection<HTMLBodyElement | null, any, HTMLElement, undefined> = d3Selection.select<HTMLBodyElement | null, any>(maybeSVG1.node());
// test "special case DOM objects"
d3Selection.select(xDoc);
d3Selection.select(xWindow);
// test top-level selectAll() -------------------------------------------------------------
// Using selectAll(), selectAll(null) or selectAll(undefined) creates an empty selection
let emptyRootSelection: d3Selection.Selection<null, undefined, null, undefined> = d3Selection.selectAll();
@@ -137,7 +131,6 @@ const baseTypeElements2: d3Selection.Selection<d3Selection.BaseType, any, null,
// element types match, but datum is of type 'any' as it cannot be inferred from .nodes()
const divElements3: d3Selection.Selection<HTMLDivElement, any, null, undefined> = d3Selection.selectAll(divElements.nodes());
// Using selectAll(...) with node array argument and type parameters creates selection
// with Group element of type HTMLDivElement and datum of DivDatum type. The parent element is of type 'null' with datum of type 'undefined'
@@ -145,10 +138,8 @@ const divElements4: d3Selection.Selection<HTMLDivElement, DivDatum, null, undefi
// d3Selection.selectAll<HTMLDivElement, DivDatum>(baseTypeElements.nodes()); // fails as baseTypeEl.node() is not of type HTMLBodyElement
// selectAll(...) accepts NodeListOf<...> argument
const xSVGCircleElementList: NodeListOf<SVGCircleElement> = document.querySelectorAll('circle');
const circleSelection: d3Selection.Selection<SVGCircleElement, any, null, undefined> = d3Selection.selectAll(xSVGCircleElementList);
@@ -156,14 +147,10 @@ const circleSelection: d3Selection.Selection<SVGCircleElement, any, null, undefi
const documentLinks: d3Selection.Selection<HTMLAnchorElement | HTMLAreaElement, any, null, undefined> = d3Selection.selectAll(document.links);
// ---------------------------------------------------------------------------------------
// Tests of Sub-Selection Functions
// ---------------------------------------------------------------------------------------
// select(...) sub-selection --------------------------------------------------------------
// Expected: datum propagates down from selected element to sub-selected descendant element
@@ -211,12 +198,10 @@ firstG = svgEl.select(function(d, i, g) {
return this.querySelector('g')!; // this of type SVGSVGElement by type inference
});
// firstG = svgEl.select(function() {
// return this.querySelector('a'); // fails, return type HTMLAnchorElement is not compatible with SVGGElement expected by firstG
// });
// selectAll(...) sub-selection --------------------------------------------------------------
// Expected: datum from selected element(s) does not propagate down to sub-selected descendant elements.
@@ -234,14 +219,12 @@ let elementsUnknownData: d3Selection.Selection<d3Selection.BaseType, any, SVGSVG
let gElementsOldData: d3Selection.Selection<SVGGElement, CircleDatum, SVGSVGElement, SVGDatum> = svgEl.selectAll<SVGGElement, CircleDatum>('g');
// gElementsOldData = svgEl.selectAll('g'); // fails default type parameters of selectAll for group element type and datum type do not match
// Using selectAll(...) sub-selection with a selector function argument.
function svgGroupSelectorAll(this: SVGSVGElement, d: SVGDatum, i: number, groups: SVGSVGElement[]): NodeListOf<SVGGElement> {
return this.querySelectorAll('g'); // this-type compatible with group element-type to which the selector function will be appplied
}
gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(svgGroupSelectorAll);
function wrongSvgGroupSelectorAll(this: HTMLElement, d: SVGDatum, i: number, groups: HTMLElement[]): NodeListOf<SVGGElement> {
@@ -305,7 +288,6 @@ maybeG.selectAll(function(d, i, g) {
// selector(...) and selectorAll(...) ----------------------------------------------------
// d3Selection.select<SVGGElement>(d3Selection.selector<SVGGElement>('g')); // fails, selector as argument to top-level select not supported
// supported on sub-selection
@@ -352,12 +334,10 @@ filterdGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filt
// return that.tagName === 'g'|| that.tagName === 'G';
// }); // fails without using narrowing generic on filter method
// matcher() -----------------------------------------------------------------------------
filterdGElements = gElementsOldData.filter(d3Selection.matcher('.top-level'));
// ---------------------------------------------------------------------------------------
// Tests of Modification
// ---------------------------------------------------------------------------------------
@@ -377,7 +357,6 @@ str = body.html();
// Setters tests -------------------------------------------------------------------------
let circles: d3Selection.Selection<SVGCircleElement, CircleDatumAlternative, HTMLElement, any>;
let divs: d3Selection.Selection<HTMLDivElement, DivDatum, HTMLElement, any>;
@@ -425,7 +404,6 @@ divs = divs
return d.padding === '0px'; // boolean return value
});
// style(...) Tests
divs = divs
@@ -451,7 +429,6 @@ divs = divs
// .style('color', function() { return 'green'; }, 'test') // fails, test: invalid priority value
.style('color', () => 'green', 'important'); // boolean return + test: priority = 'important';
// property(...) Tests
circles = circles
@@ -514,7 +491,6 @@ body = body
// Tests of Datum and Data Join
// ---------------------------------------------------------------------------------------
const data: CircleDatum[] = [
{ nodeId: 'c1', cx: 10, cy: 10, r: 5, name: 'foo', label: 'Foo' },
{ nodeId: 'c2', cx: 20, cy: 20, r: 5, name: 'bar', label: 'Bar' },
@@ -527,7 +503,6 @@ const data2: CircleDatumAlternative[] = [
{ nodeId: 'c4', cx: 10, cy: 15, r: 10, name: 'newbie', label: 'Newbie', color: 'red' }
];
// Tests of Datum -----------------------------------------------------------------------
// TEST GETTER
@@ -564,7 +539,6 @@ newBodyDatum = body.datum(function(d, i, g) {
// return { newFoo: 'new foo' };
// }).datum(); // inferred type
// SCENARIO 1: Fully type-parameterized
// object-based
@@ -616,10 +590,8 @@ d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in la
return d.length > 0 && d[0].color === 'green';
});
// Tests of Data Join --------------------------------------------------------------------
const dimensions: SVGDatum = {
width: 500,
height: 300
@@ -741,7 +713,6 @@ circles2 = enterCircles.merge(circles2); // merge enter and update selections
// FURTHER DATA-JOIN TESTs (function argument, changes in data type between old and new data)
const matrix = [
[11975, 5871, 8916, 2868],
[1951, 10048, 2060, 6171],
@@ -876,7 +847,6 @@ newParagraph2 = body.insert(typeValueFunction, 'p.second-paragraph');
newParagraph2 = body.insert(typeValueFunction, beforeValueFunction);
newParagraph2 = body.insert(typeValueFunction);
// sort(...) -----------------------------------------------------------------------------
// NB: Return new selection of same type
@@ -932,12 +902,10 @@ circles = circles.each(function(d, i, g) { // check chaining return type by re-
// call() -------------------------------------------------------------------------------
function enforceMinRadius(selection: d3Selection.Selection<SVGCircleElement, CircleDatumAlternative, any, any>, minRadius: number): void {
selection.attr('r', function(d) {
const r: number = +d3Selection.select(this).attr('r');
return Math.max(r, minRadius);
});
}
// returns 'this' selection
@@ -959,7 +927,6 @@ circles = circles.call(enforceMinRadius, 40); // check chaining return type by r
let listener: undefined | ((this: HTMLBodyElement, datum: BodyDatum, index: number, group: HTMLBodyElement[] | ArrayLike<HTMLBodyElement>) => void);
body = body.on('click', function(d, i, g) {
const that: HTMLBodyElement = this;
// const that2: SVGElement = this; // fails, type mismatch
@@ -981,7 +948,6 @@ if (listener) {
// remove listener
body = body.on('click', null); // check chaining return type by re-assigning
// dispatch(...) -------------------------------------------------------------------------
const fooEventParam: d3Selection.CustomEventParameters = {
@@ -1009,7 +975,6 @@ body = body.dispatch('fooEvent', function(d, i, g) { // re-assign for chaining t
return eParam;
});
// event and customEvent() ----------------------------------------------------------------
// TODO: Tests of event are related to issue #3 (https://github.com/tomwanzek/d3-v4-definitelytyped/issues/3)
+3 -18
View File
@@ -44,7 +44,6 @@ export interface EnterElement {
*/
export type ContainerElement = HTMLElement | SVGSVGElement | SVGGElement;
/**
* Interface for optional parameters map, when dispatching custom events
* on a selection
@@ -69,7 +68,6 @@ export interface CustomEventParameters {
*/
export type ValueFn<T extends BaseType, Datum, Result> = (this: T, datum: Datum, index: number, groups: T[] | ArrayLike<T>) => Result;
/**
* TransitionLike is a helper interface to represent a quasi-Transition, without specifying the full Transition interface in this file.
* For example, whereever d3-zoom allows a Transition to be passed in as an argument, it internally immediately invokes its `selection()`
@@ -88,8 +86,6 @@ export interface TransitionLike<GElement extends BaseType, Datum> {
tween(name: string, tweenFn: ValueFn<GElement, Datum, ((t: number) => void)>): TransitionLike<GElement, Datum>;
}
// --------------------------------------------------------------------------
// All Selection related interfaces and function
// --------------------------------------------------------------------------
@@ -155,7 +151,6 @@ export function selectAll<GElement extends BaseType, OldDatum>(nodes: GElement[]
*/
export function selectAll<GElement extends BaseType, OldDatum>(nodes: ArrayLike<GElement>): Selection<GElement, OldDatum, null, undefined>;
/**
* A D3 Selection of elements.
*
@@ -165,7 +160,6 @@ export function selectAll<GElement extends BaseType, OldDatum>(nodes: ArrayLike<
* The fourth generic "PDatum" refers to the type of the datum of the parent element(s).
*/
interface Selection<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
// Sub-selection -------------------------
/**
@@ -625,7 +619,6 @@ interface Selection<GElement extends BaseType, Datum, PElement extends BaseType,
*/
lower(): this;
// Data Join ---------------------------------
/**
@@ -853,8 +846,6 @@ interface Selection<GElement extends BaseType, Datum, PElement extends BaseType,
* Returns the total number of elements in this selection.
*/
size(): number;
}
/**
@@ -867,8 +858,7 @@ type SelectionFn = () => Selection<HTMLElement, any, null, undefined>;
* Selects the root element, document.documentElement. This function can also be used to test for selections
* (instanceof d3.selection) or to extend the selection prototype.
*/
export var selection: SelectionFn;
export const selection: SelectionFn;
// ---------------------------------------------------------------------------
// on.js event and customEvent related
@@ -899,7 +889,7 @@ interface BaseEvent {
* rather than from the generated UMD bundle; not all bundlers observe jsnext:main.
* Also beware of conflicts with the window.event global.
*/
export var event: any; // Could be of all sorts of types, too general: BaseEvent | Event | MouseEvent | TouchEvent | ... | OwnCustomEventType;
export const event: any; // Could be of all sorts of types, too general: BaseEvent | Event | MouseEvent | TouchEvent | ... | OwnCustomEventType;
/**
* Invokes the specified listener, using the specified "that" as "this" context and passing the specified arguments, if any.
@@ -984,7 +974,6 @@ export function touches(container: ContainerElement, touches?: TouchList): Array
// local.js related
// ---------------------------------------------------------------------------
export interface Local<T> {
/**
* Retrieves a local variable stored on the node (or one of its parents).
@@ -1050,7 +1039,6 @@ export interface NamespaceLocalObject {
*/
export function namespace(prefixedLocal: string): NamespaceLocalObject | string;
// ---------------------------------------------------------------------------
// namespaces.js related
// ---------------------------------------------------------------------------
@@ -1063,8 +1051,7 @@ export interface NamespaceMap { [prefix: string]: string; }
/**
* Map of namespace prefixes to corresponding fully qualified namespace strings
*/
export var namespaces: NamespaceMap;
export const namespaces: NamespaceMap;
// ---------------------------------------------------------------------------
// window.js related
@@ -1078,13 +1065,11 @@ export var namespaces: NamespaceMap;
*/
export function window(DOMNode: Window | Document | Element): Window;
// ---------------------------------------------------------------------------
// creator.js and matcher.js Complex helper closure generating functions
// for explicit bound-context dependent use
// ---------------------------------------------------------------------------
/**
* Given the specified element name, returns a function which creates an element of the given name,
* assuming that "this" is the parent element.
-1
View File
@@ -1,4 +1,3 @@
namespace DagreD3Tests {
const gDagre = new dagreD3.graphlib.Graph();
const graph = gDagre.graph();
-1
View File
@@ -1,4 +1,3 @@
import deepEqual = require("deep-equal");
const isDeepEqual1: boolean = deepEqual({}, {});
+9 -11
View File
@@ -1,32 +1,30 @@
const headertmpl = "<h1>{{=it.title}}</h1>";
var headertmpl = "<h1>{{=it.title}}</h1>";
var pagetmpl = "<h2>Here is the page using a header template< / h2 >\n"
const pagetmpl = "<h2>Here is the page using a header template< / h2 >\n"
+ "{{#def.header}}\n"
+ "{{=it.name}}";
var customizableheadertmpl = "{{#def.header}}"
const customizableheadertmpl = "{{#def.header}}"
+ "\n{{#def.mycustominjectionintoheader || ''} }";
var pagetmplwithcustomizableheader = "<h2>Here is the page with customized header template</h2>\n"
const pagetmplwithcustomizableheader = "<h2>Here is the page with customized header template</h2>\n"
+ "{{##def.mycustominjectionintoheader:\n"
+ " <div>{{=it.title}} is not {{=it.name}}</div>\n"
+ "#}}\n"
+ "{{#def.customheader}}\n"
+ "{{=it.name}}";
var def = {
const def = {
header: headertmpl,
customheader: customizableheadertmpl
};
var data = {
const data = {
title: "My title",
name: "My name"
};
var pagefn = doT.template(pagetmpl, undefined, def);
var content = pagefn(data);
let pagefn = doT.template(pagetmpl, undefined, def);
const content = pagefn(data);
pagefn = doT.template(pagetmplwithcustomizableheader, undefined, def);
var contentcustom = pagefn(data);
const contentcustom = pagefn(data);
-7
View File
@@ -41,26 +41,22 @@ export {
* DataSources may retrieve JSON Graph information from anywhere, including device memory, a remote machine, or even a lazily-run computation.
**/
export abstract class DataSource {
/**
* The get method retrieves values from the DataSource's associated JSONGraph object.
**/
get(pathSets: PathSet[]): Observable<JSONGraphEnvelope>;
/**
* The set method accepts values to set in the DataSource's associated JSONGraph object.
**/
set(jsonGraphEnvelope: JSONGraphEnvelope): Observable<JSONGraphEnvelope>;
/**
* Invokes a function in the DataSource's JSONGraph object.
**/
call(functionPath: Path, args?: any[], refSuffixes?: PathSet[], thisPaths?: PathSet[]): Observable<JSONGraphEnvelope>;
}
/////////////////////////////////////////////////////
// Model
/////////////////////////////////////////////////////
@@ -215,7 +211,6 @@ export class Model {
getPath(): Path;
}
/////////////////////////////////////////////////////
// ModelResponse
/////////////////////////////////////////////////////
@@ -232,13 +227,11 @@ interface Thenable<T> {
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U> | void): Thenable<U>;
}
/////////////////////////////////////////////////////
// Observable
/////////////////////////////////////////////////////
export class Observable<T>{
/**
* The forEach method is a synonym for {@link Observable.prototype.subscribe} and triggers the execution of the Observable, causing the values within to be pushed to a callback.
* An Observable is like a pipe of water that is closed.
+1 -4
View File
@@ -1,6 +1,4 @@
var model = new falcor.Model({source: new falcor.HttpDataSource('/model.json')});
const model = new falcor.Model({source: new falcor.HttpDataSource('/model.json')});
model.get('greeting').then(response => {
document.write(response.json.greeting);
@@ -15,4 +13,3 @@ model.set({
});
model.set(falcor.pathValue('greeting', 'Hello, world'));
-1
View File
@@ -127,4 +127,3 @@ subscription.dispose();
modelResponse.then(res => res.json.items.length);
modelResponse.then(res => res, error => console.error.bind(error));
modelResponse.then<number>(res => res.json.items.length).then((l: number) => l + 1);
+16 -16
View File
@@ -4,45 +4,45 @@ import * as fetchJsonp from 'fetch-jsonp';
fetchJsonp('/users.jsonp')
.then(function(response) {
return response.json()
return response.json();
}).then(function(json) {
console.log('parsed json', json)
console.log('parsed json', json);
}).catch(function(ex) {
console.log('parsing failed', ex)
})
console.log('parsing failed', ex);
});
fetchJsonp('/users.jsonp', {
jsonpCallback: 'custom_callback'
})
.then(function(response) {
return response.json()
return response.json();
}).then(function(json) {
console.log('parsed json', json)
console.log('parsed json', json);
}).catch(function(ex) {
console.log('parsing failed', ex)
})
console.log('parsing failed', ex);
});
fetchJsonp('/users.jsonp', {
timeout: 3000,
jsonpCallback: 'custom_callback'
})
.then(function(response) {
return response.json()
return response.json();
}).then(function(json) {
console.log('parsed json', json)
console.log('parsed json', json);
}).catch(function(ex) {
console.log('parsing failed', ex)
})
console.log('parsing failed', ex);
});
// Taken from https://github.com/camsong/fetch-jsonp/blob/v1.0.2/examples/index.html
var result = fetchJsonp('http://www.flickr.com/services/feeds/photos_public.gne?format=json', {
const result = fetchJsonp('http://www.flickr.com/services/feeds/photos_public.gne?format=json', {
jsonpCallback: 'jsoncallback',
timeout: 3000
})
});
result.then(function(response) {
return response.json()
return response.json();
}).then(function(json) {
document.body.innerHTML = JSON.stringify(json);
})['catch'](function(ex) {
document.body.innerHTML = 'failed:' + ex;
})
});
+13 -22
View File
@@ -1,42 +1,33 @@
import * as Board from 'firmata'
import * as Board from 'firmata';
function test_basic_board()
{
let board = new Board('');
function test_basic_board() {
const board = new Board('');
}
function test_board_with_callback()
{
let board = new Board('', (error: any) =>
{
function test_board_with_callback() {
const board = new Board('', (error: any) => {
board.pinMode(13, board.MODES.OUTPUT);
board.pinMode(12, Board.PIN_MODE.OUTPUT);
});
}
function test_board_with_listener()
{
let board = new Board('');
function test_board_with_listener() {
const board = new Board('');
board.on('ready', () =>
{
board.on('ready', () => {
board.pinMode(13, board.MODES.OUTPUT);
board.pinMode(12, Board.PIN_MODE.OUTPUT);
});
}
function test_class_extension()
{
class MyBoard extends Board
{
Disconnect()
{
function test_class_extension() {
class MyBoard extends Board {
Disconnect() {
this.transport.close((error: any) => {});
}
}
let myBoard: MyBoard = new MyBoard('', () =>
{
const myBoard: MyBoard = new MyBoard('', () => {
myBoard.Disconnect();
});
}
}
+134 -90
View File
@@ -5,7 +5,7 @@
/// <reference types="node" />
import * as SerialPort from 'serialport'
import * as SerialPort from 'serialport';
export = Board;
@@ -15,8 +15,7 @@ export = Board;
* This is a starting point that appeared to work fine for months within a project of my company, but I give no
* guarantee that it cannot be improved.
*/
declare class Board extends NodeJS.EventEmitter
{
declare class Board extends NodeJS.EventEmitter {
constructor(serialPort: string, callback?: (error: any) => void)
MODES: Board.PinModes;
STEPPER: Board.StepperConstants;
@@ -84,7 +83,11 @@ declare class Board extends NodeJS.EventEmitter
// TODO untested --- TWW
sendOneWireDelay(pin: number, delay: number): void
// TODO untested --- TWW
sendOneWireWriteAndRead(pin: number, device: number, data: number|number[], numBytesToRead: number,
sendOneWireWriteAndRead(
pin: number,
device: number,
data: number|number[],
numBytesToRead: number,
callback: (error?: Error, data?: number) => void): void
setSamplingInterval(interval: number): void
getSamplingInterval(): number
@@ -92,124 +95,165 @@ declare class Board extends NodeJS.EventEmitter
reportDigitalPin(pin: number, value: Board.REPORTING): void
// TODO untested/incomplete --- TWW
pingRead(opts: any, callback: () => void): void
stepperConfig(deviceNum: number, type: number, stepsPerRev: number, dirOrMotor1Pin: number,
stepOrMotor2Pin: number, motor3Pin?: number, motor4Pin?: number): void
stepperStep(deviceNum: number, direction: Board.STEPPER_DIRECTION, steps: number, speed: number,
accel: number|((bool?: boolean) => void), decel?: number, callback?: (bool?: boolean) => void): void
stepperConfig(
deviceNum: number,
type: number,
stepsPerRev: number,
dirOrMotor1Pin: number,
stepOrMotor2Pin: number,
motor3Pin?: number,
motor4Pin?: number): void
stepperStep(
deviceNum: number,
direction: Board.STEPPER_DIRECTION,
steps: number,
speed: number,
accel: number|((bool?: boolean) => void),
decel?: number,
callback?: (bool?: boolean) => void): void;
// TODO untested --- TWW
serialConfig(options: { portId: Board.SERIAL_PORT_ID, baud: number, rxPin?: number, txPin?: number }): void
serialConfig(options: { portId: Board.SERIAL_PORT_ID, baud: number, rxPin?: number, txPin?: number }): void;
// TODO untested --- TWW
serialWrite(portId: Board.SERIAL_PORT_ID, inBytes: number[]): void
serialWrite(portId: Board.SERIAL_PORT_ID, inBytes: number[]): void;
// TODO untested --- TWW
serialRead(portId: Board.SERIAL_PORT_ID, maxBytesToRead: number, callback: () => void): void
serialRead(portId: Board.SERIAL_PORT_ID, maxBytesToRead: number, callback: () => void): void;
// TODO untested --- TWW
serialStop(portId: Board.SERIAL_PORT_ID): void
serialStop(portId: Board.SERIAL_PORT_ID): void;
// TODO untested --- TWW
serialClose(portId: Board.SERIAL_PORT_ID): void
serialClose(portId: Board.SERIAL_PORT_ID): void;
// TODO untested --- TWW
serialFlush(portId: Board.SERIAL_PORT_ID): void
serialFlush(portId: Board.SERIAL_PORT_ID): void;
// TODO untested --- TWW
serialListen(portId: Board.SERIAL_PORT_ID): void
serialListen(portId: Board.SERIAL_PORT_ID): void;
// TODO untested --- TWW
sysexResponse(commandByte: number, handler: (data: number[]) => void): void
sysexResponse(commandByte: number, handler: (data: number[]) => void): void;
// TODO untested --- TWW
sysexCommand(message: number[]): void
reset(): void
static isAcceptablePort(port: Board.Port): boolean
static requestPort(callback: (error: any, port: Board.Port) => any): void
sysexCommand(message: number[]): void;
reset(): void;
static isAcceptablePort(port: Board.Port): boolean;
static requestPort(callback: (error: any, port: Board.Port) => any): void;
// TODO untested --- TWW
static encode(data: number[]): number[]
static encode(data: number[]): number[];
// TODO untested --- TWW
static decode(data: number[]): number[]
static decode(data: number[]): number[];
// TODO untested/incomplete --- TWW
protected _sendOneWireSearch(type: any, event: any, pin: number, callback: () => void): void
protected _sendOneWireSearch(type: any, event: any, pin: number, callback: () => void): void;
// TODO untested/incomplete --- TWW
protected _sendOneWireRequest(pin: number, subcommand: any, device: any, numBytesToRead: any, correlationId: any,
delay: number, dataToWrite: any, event: any, callback: () => void): void
protected _sendOneWireRequest(
pin: number,
subcommand: any,
device: any,
numBytesToRead: any,
correlationId: any,
delay: number,
dataToWrite: any,
event: any, callback: () => void): void;
}
declare namespace Board
{
export interface PinModes
{
INPUT: PIN_MODE, OUTPUT: PIN_MODE, ANALOG: PIN_MODE, PWM: PIN_MODE, SERVO: PIN_MODE, SHIFT: PIN_MODE,
I2C: PIN_MODE, ONEWIRE: PIN_MODE, STEPPER: PIN_MODE, SERIAL: PIN_MODE, PULLUP: PIN_MODE, IGNORE: PIN_MODE,
PING_READ: PIN_MODE, UNKOWN: PIN_MODE
declare namespace Board {
interface PinModes {
INPUT: PIN_MODE;
OUTPUT: PIN_MODE;
ANALOG: PIN_MODE;
PWM: PIN_MODE;
SERVO: PIN_MODE;
SHIFT: PIN_MODE;
I2C: PIN_MODE;
ONEWIRE: PIN_MODE;
STEPPER: PIN_MODE;
SERIAL: PIN_MODE;
PULLUP: PIN_MODE;
IGNORE: PIN_MODE;
PING_READ: PIN_MODE;
UNKOWN: PIN_MODE;
}
export interface StepperConstants
{
TYPE: { DRIVER: STEPPER_TYPE, TWO_WIRE: STEPPER_TYPE, FOUR_WIRE: STEPPER_TYPE },
interface StepperConstants {
TYPE: {
DRIVER: STEPPER_TYPE,
TWO_WIRE: STEPPER_TYPE,
FOUR_WIRE: STEPPER_TYPE,
};
RUNSTATE: {
STOP: STEPPER_RUN_STATE, ACCEL: STEPPER_RUN_STATE, DECEL: STEPPER_RUN_STATE, RUN: STEPPER_RUN_STATE
},
DIRECTION: { CCW: STEPPER_DIRECTION, CW: STEPPER_DIRECTION }
STOP: STEPPER_RUN_STATE,
ACCEL: STEPPER_RUN_STATE,
DECEL: STEPPER_RUN_STATE,
RUN: STEPPER_RUN_STATE,
};
DIRECTION: { CCW: STEPPER_DIRECTION, CW: STEPPER_DIRECTION };
}
// tslint:disable-next-line interface-name
export interface I2cModes
{
WRITE: I2C_MODE, READ: I2C_MODE, CONTINUOUS_READ: I2C_MODE, STOP_READING: I2C_MODE
interface I2cModes {
WRITE: I2C_MODE;
READ: I2C_MODE;
CONTINUOUS_READ: I2C_MODE;
STOP_READING: I2C_MODE;
}
export interface SerialModes
{
CONTINUOUS_READ: SERIAL_MODE, STOP_READING: SERIAL_MODE
interface SerialModes {
CONTINUOUS_READ: SERIAL_MODE;
STOP_READING: SERIAL_MODE;
}
export interface SerialPortIds
{
HW_SERIAL0: SERIAL_PORT_ID, HW_SERIAL1: SERIAL_PORT_ID, HW_SERIAL2: SERIAL_PORT_ID,
HW_SERIAL3: SERIAL_PORT_ID, SW_SERIAL0: SERIAL_PORT_ID, SW_SERIAL1: SERIAL_PORT_ID,
SW_SERIAL2: SERIAL_PORT_ID, SW_SERIAL3: SERIAL_PORT_ID, DEFAULT: SERIAL_PORT_ID,
interface SerialPortIds {
HW_SERIAL0: SERIAL_PORT_ID;
HW_SERIAL1: SERIAL_PORT_ID;
HW_SERIAL2: SERIAL_PORT_ID;
HW_SERIAL3: SERIAL_PORT_ID;
SW_SERIAL0: SERIAL_PORT_ID;
SW_SERIAL1: SERIAL_PORT_ID;
SW_SERIAL2: SERIAL_PORT_ID;
SW_SERIAL3: SERIAL_PORT_ID;
DEFAULT: SERIAL_PORT_ID;
}
export interface SerialPinTypes
{
RES_RX0: SERIAL_PIN_TYPE, RES_TX0: SERIAL_PIN_TYPE, RES_RX1: SERIAL_PIN_TYPE, RES_TX1: SERIAL_PIN_TYPE,
RES_RX2: SERIAL_PIN_TYPE, RES_TX2: SERIAL_PIN_TYPE, RES_RX3: SERIAL_PIN_TYPE, RES_TX3: SERIAL_PIN_TYPE,
interface SerialPinTypes {
RES_RX0: SERIAL_PIN_TYPE;
RES_TX0: SERIAL_PIN_TYPE;
RES_RX1: SERIAL_PIN_TYPE;
RES_TX1: SERIAL_PIN_TYPE;
RES_RX2: SERIAL_PIN_TYPE;
RES_TX2: SERIAL_PIN_TYPE;
RES_RX3: SERIAL_PIN_TYPE;
RES_TX3: SERIAL_PIN_TYPE;
}
export interface Pins
{
mode: PIN_MODE,
value: PIN_STATE|number,
supportedModes: PIN_MODE[],
analogChannel: number,
report: REPORTING,
state: PIN_STATE|PULLUP_STATE, // TODO not sure if this exists anymore... --- TWW
interface Pins {
mode: PIN_MODE;
value: PIN_STATE | number;
supportedModes: PIN_MODE[];
analogChannel: number;
report: REPORTING;
state: PIN_STATE | PULLUP_STATE; // TODO not sure if this exists anymore... --- TWW
}
export interface Firmware
{
name: string,
version: Version,
interface Firmware {
name: string;
version: Version;
}
export interface Settings
{
reportVersionTimeout: number,
samplingInterval: number,
interface Settings {
reportVersionTimeout: number;
samplingInterval: number;
serialport: {
baudRate: number,
bufferSize: number
}
bufferSize: number,
};
}
export interface Port
{
comName: string,
interface Port {
comName: string;
}
export interface Version
{
major: number,
minor: number
interface Version {
major: number;
minor: number;
}
// TODO these enums could actually be non-const in the future (provides some benefits) --- TWW
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L449-L464
export const enum PIN_MODE {
const enum PIN_MODE {
INPUT = 0x00,
OUTPUT = 0x01,
ANALOG = 0x02,
@@ -226,30 +270,30 @@ declare namespace Board
UNKNOWN = 0x10,
}
export const enum PIN_STATE {
const enum PIN_STATE {
LOW = 0,
HIGH = 1
}
export const enum REPORTING {
const enum REPORTING {
ON = 1,
OFF = 0,
}
export const enum PULLUP_STATE {
const enum PULLUP_STATE {
ENABLED = 1,
DISABLED = 0,
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L474-L478
export const enum STEPPER_TYPE {
const enum STEPPER_TYPE {
DRIVER = 1,
TWO_WIRE = 2,
FOUR_WIRE = 4,
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L479-L484
export const enum STEPPER_RUN_STATE {
const enum STEPPER_RUN_STATE {
STOP = 0,
ACCEL = 1,
DECEL = 2,
@@ -257,13 +301,13 @@ declare namespace Board
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L485-L488
export const enum STEPPER_DIRECTION {
const enum STEPPER_DIRECTION {
CCW = 0,
CW = 1,
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L466-L471
export const enum I2C_MODE {
const enum I2C_MODE {
WRITE = 0,
READ = 1,
CONTINUOUS_READ = 2,
@@ -271,13 +315,13 @@ declare namespace Board
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L491-L494
export const enum SERIAL_MODE {
const enum SERIAL_MODE {
CONTINUOUS_READ = 0x00,
STOP_READING = 0x01,
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L497-L512
export const enum SERIAL_PORT_ID {
const enum SERIAL_PORT_ID {
HW_SERIAL0 = 0x00,
HW_SERIAL1 = 0x01,
HW_SERIAL2 = 0x02,
@@ -290,7 +334,7 @@ declare namespace Board
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L515-L524
export const enum SERIAL_PIN_TYPE {
const enum SERIAL_PIN_TYPE {
RES_RX0 = 0x00,
RES_TX0 = 0x01,
RES_RX1 = 0x02,
@@ -300,4 +344,4 @@ declare namespace Board
RES_RX3 = 0x06,
RES_TX3 = 0x07,
}
}
}
-1
View File
@@ -12,4 +12,3 @@ if (input != null) {
}
picker1.destroy();
-1
View File
@@ -1,4 +1,3 @@
import freeport = require('freeport');
let num: number,
+2 -4
View File
@@ -4,9 +4,7 @@ FusionCharts.addEventListener('ready', (eventObject) => {
eventObject.stopPropagation();
});
FusionCharts.ready((fusioncharts) => {
});
FusionCharts.ready((fusioncharts) => {});
FusionCharts.version;
@@ -48,4 +46,4 @@ chart.clone();
chart.zoomTo(0, 3);
chart.zoomOut();
chart.setJSONData(chartData);
chart.ref;
chart.ref;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var charts: (H: FusionChartStatic) => FusionChartStatic;
export = charts;
export as namespace charts;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var gantt: (H: FusionChartStatic) => FusionChartStatic;
export = gantt;
export as namespace gantt;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var maps: (H: FusionChartStatic) => FusionChartStatic;
export = maps;
export as namespace maps;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var powercharts: (H: FusionChartStatic) => FusionChartStatic;
export = powercharts;
export as namespace powercharts;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var ssgrid: (H: FusionChartStatic) => FusionChartStatic;
export = ssgrid;
export as namespace ssgrid;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var treemap: (H: FusionChartStatic) => FusionChartStatic;
export = treemap;
export as namespace treemap;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var widgets: (H: FusionChartStatic) => FusionChartStatic;
export = widgets;
export as namespace widgets;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var zoomscatter: (H: FusionChartStatic) => FusionChartStatic;
export = zoomscatter;
export as namespace zoomscatter;
-7
View File
@@ -3,9 +3,7 @@
// Definitions by: Rohit Kumar <https://github.com/rohitkr>, Shivaraj KV <https://github.com/shivarajkv>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace FusionCharts {
type ChartDataFormats = 'json' | 'jsonurl' | 'csv' | 'xml' | 'xmlurl';
type ImageHAlign = 'left' | 'right' | 'middle';
@@ -33,7 +31,6 @@ declare namespace FusionCharts {
}
interface ChartObject {
type?: string;
id?: string;
@@ -251,7 +248,6 @@ declare namespace FusionCharts {
configure(options: {}): void;
ref: {};
}
interface FusionChartStatic {
@@ -286,10 +282,7 @@ declare namespace FusionCharts {
options: {};
debugger: Debugger;
}
}
declare var FusionCharts: FusionCharts.FusionChartStatic;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var usa: (H: FusionChartStatic) => FusionChartStatic;
export = usa;
export as namespace usa;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var world: (H: FusionChartStatic) => FusionChartStatic;
export = world;
export as namespace world;
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var carbon: (H: FusionChartStatic) => FusionChartStatic;
export = carbon;
export as namespace carbon;
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var fint: (H: FusionChartStatic) => FusionChartStatic;
export = fint;
export as namespace fint;
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var ocean: (H: FusionChartStatic) => FusionChartStatic;
export = ocean;
export as namespace ocean;
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var zune: (H: FusionChartStatic) => FusionChartStatic;
export = zune;
export as namespace zune;
-1
View File
@@ -25,4 +25,3 @@ const dest = mappings[0].dest;
mappings = globule.mapping(['*.js'], { srcBase: '/home/code' });
mappings = globule.mapping(['*.js', '*.less']);
mappings = globule.mapping(['*.js'], ['*.less']);
-1
View File
@@ -84,4 +84,3 @@ interface GlobuleStatic {
declare var globule: GlobuleStatic;
export = globule;
-1
View File
@@ -34,4 +34,3 @@ interface Options {
}
export function klawSync(root: string, options?: Options): ReadonlyArray<Item>
-1
View File
@@ -3,7 +3,6 @@
// Definitions by: jKey Lu <https://github.com/jkeylu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function compose<T>(middleware: Array<compose.Middleware<T>>): compose.ComposedMiddleware<T>;
declare namespace compose {
+3 -5
View File
@@ -1,15 +1,13 @@
import compose = require('koa-compose');
var fn1: compose.Middleware<any> = (context: any, next: () => Promise<void>): Promise<any> =>
const fn1: compose.Middleware<any> = (context: any, next: () => Promise<void>): Promise<any> =>
Promise
.resolve(console.log('in fn1'))
.then(() => next());
var fn2: compose.Middleware<any> = (context: any, next: () => Promise<void>): Promise<any> =>
const fn2: compose.Middleware<any> = (context: any, next: () => Promise<void>): Promise<any> =>
Promise
.resolve(console.log('in fn2'))
.then(() => next());
var fn = compose([fn1, fn2]);
const fn = compose([fn1, fn2]);
+1 -2
View File
@@ -1,8 +1,7 @@
import leven = require('leven');
leven('baz', 'bar');
// => "1"
leven('foo', 'bar');
// => "3"
// => "3"
@@ -1,4 +1,3 @@
declare const cordovaSQLiteDriver: LocalForageDriver;
() => {
-200
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -16,4 +16,4 @@ class Server {
// start the web server
};
}
}
}
+5 -7
View File
@@ -1,9 +1,7 @@
var input = "Someting to compress";
var encoded: string;
var decoded: string;
var encodedU8: Uint8Array;
const input = "Someting to compress";
let encoded: string;
let decoded: string;
let encodedU8: Uint8Array;
encoded = LZString.compress(input);
decoded = LZString.decompress(encoded);
@@ -14,4 +12,4 @@ decoded = LZString.decompressFromBase64(encoded);
encoded = LZString.compressToEncodedURIComponent(input);
decoded = LZString.compressToEncodedURIComponent(encoded);
encodedU8 = LZString.compressToUint8Array(input);
decoded = LZString.decompressFromUint8Array(encodedU8);
decoded = LZString.decompressFromUint8Array(encodedU8);
+14 -17
View File
@@ -1,13 +1,11 @@
declare var $: any;
declare const $: any;
window.alert = (thing?: string) => {
$('#content').append('<div>' + thing + '</div>');
};
$(() => {
var audio = new Audio();
const audio = new Audio();
audio.src = Modernizr.audio.ogg ? 'background.ogg' :
Modernizr.audio.mp3 ? 'background.mp3' :
'background.m4a';
@@ -15,13 +13,13 @@ $(() => {
if (Modernizr.webgl) {
// loadAllWebGLScripts();
} else {
var msg = 'With a different browser you’ll get to see the WebGL experience here: get.webgl.org.';
const msg = 'With a different browser you’ll get to see the WebGL experience here: get.webgl.org.';
document.getElementById('#notice').innerHTML = msg;
}
Modernizr.prefixed('boxSizing');
Modernizr.prefixed('requestAnimationFrame', window);
var ms = Modernizr.prefixed("matchesSelector", HTMLElement.prototype, true);
const ms = Modernizr.prefixed("matchesSelector", HTMLElement.prototype, true);
Modernizr.prefixed('requestAnimationFrame', window, false);
Modernizr.mq('only all and (max-width: 400px)');
@@ -29,7 +27,7 @@ $(() => {
Modernizr.mq('only screen and (max-width: 768px)');
Modernizr.addTest('track', () => {
var video = document.createElement('video');
const video = document.createElement('video');
return typeof video.addTextTrack === 'function';
});
@@ -45,7 +43,7 @@ $(() => {
Modernizr.testAllProps('boxSizing');
var elem: Element;
const elem: Element = null as any;
Modernizr.hasEvent('gesturestart', elem);
if (!Modernizr.input.autofocus) {
@@ -53,7 +51,6 @@ $(() => {
}
});
Modernizr.on('flash', result => {
if (result) {
// the browser has flash
@@ -63,22 +60,22 @@ Modernizr.on('flash', result => {
});
Modernizr.addTest('itsTuesday', () => {
var d = new Date();
const d = new Date();
return d.getDay() === 2;
});
Modernizr.addTest('hasJquery', 'jQuery' in window);
var detects = {
const detects = {
hasjquery: 'jQuery' in window,
itstuesday: () => {
var d = new Date();
const d = new Date();
return d.getDay() === 2;
}
};
Modernizr.addTest(detects);
var keyframes = Modernizr.atRule('@keyframes');
const keyframes = Modernizr.atRule('@keyframes');
if (keyframes) {
// keyframes are supported
// could be `@-webkit-keyframes` or `@keyframes`
@@ -92,25 +89,25 @@ Modernizr.hasEvent('blur'); // true;
Modernizr.hasEvent('devicelight', window); // true;
var query = Modernizr.mq('(min-width: 900px)');
const query = Modernizr.mq('(min-width: 900px)');
if (query) {
// the browser window is larger than 900px
}
Modernizr.prefixed('boxSizing');
var raf = Modernizr.prefixed('requestAnimationFrame', window);
const raf = Modernizr.prefixed('requestAnimationFrame', window);
raf(() => {
});
var rAFProp = Modernizr.prefixed('requestAnimationFrame', window, false);
const rAFProp = Modernizr.prefixed('requestAnimationFrame', window, false);
rAFProp === 'WebkitRequestAnimationFrame'; // in older webkit
Modernizr.prefixedCSS('transition'); // '-moz-transition' in old Firefox
Modernizr.prefixedCSSValue('background', 'linear-gradient(left, red, red)');
var rule = Modernizr._prefixes.join('transform: rotate(20deg); ');
let rule = Modernizr._prefixes.join('transform: rotate(20deg); ');
rule === 'transform: rotate(20deg); webkit-transform: rotate(20deg); moz-transform: rotate(20deg); o-transform: rotate(20deg); ms-transform: rotate(20deg);';
rule = 'display:' + Modernizr._prefixes.join('flex; display:') + 'flex';
-1
View File
@@ -104,4 +104,3 @@ export class Server extends EventEmitter {
export function eslSetLogLevel(level: any): void;
export function setLogLevel(level: any): void;
-2
View File
@@ -4,7 +4,6 @@ const freeswitchListener = new modesl.Server(() => {
// console.log('Server listening on localhost at port 8022');
});
const freeswitchConnection = new modesl.Connection("freeswitch-host", 8021, 'password', () => {
// console.log('connection initialized');
@@ -31,4 +30,3 @@ const freeswitchConnection = new modesl.Connection("freeswitch-host", 8021, 'pas
});
});
});
+8 -10
View File
@@ -2,14 +2,12 @@
// Project: https://github.com/jmeas/moment-business
// Definitions by: Greg Sieranski <https://github.com/wonbyte/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as moment from "moment";
declare module "moment-business" {
export function weekDays(startMoment: moment.Moment, endMoment: moment.Moment): number
export function weekendDays(startMoment: moment.Moment, endMoment: moment.Moment): number
export function addWeekDays(moment: moment.Moment, amount: number): moment.Moment
export function subtractWeekDays(moment: moment.Moment, amount: number): moment.Moment
export function isWeekDay(moment: moment.Moment): boolean
export function isWeekendDay(moment: moment.Moment): boolean
}
export function weekDays(startMoment: moment.Moment, endMoment: moment.Moment): number;
export function weekendDays(startMoment: moment.Moment, endMoment: moment.Moment): number;
export function addWeekDays(moment: moment.Moment, amount: number): moment.Moment;
export function subtractWeekDays(moment: moment.Moment, amount: number): moment.Moment;
export function isWeekDay(moment: moment.Moment): boolean;
export function isWeekendDay(moment: moment.Moment): boolean;
@@ -1,9 +1,9 @@
import * as moment from "moment";
import * as mb from "moment-business";
let a = mb.isWeekDay(moment())
let b = mb.isWeekendDay(moment());
let c = mb.addWeekDays(moment(), 1);
let d = mb.subtractWeekDays(moment(), 1);
let e = mb.weekDays(moment(), moment());
let f = mb.weekendDays(moment(), moment());
mb.isWeekDay(moment());
mb.isWeekendDay(moment());
mb.addWeekDays(moment(), 1);
mb.subtractWeekDays(moment(), 1);
mb.weekDays(moment(), moment());
mb.weekendDays(moment(), moment());
+9 -12
View File
@@ -1,18 +1,16 @@
import moment = require('moment-timezone');
var june = moment("2014-06-01T12:00:00Z");
const june = moment("2014-06-01T12:00:00Z");
june.tz('America/Los_Angeles').format('ha z');
var a = moment.tz("2013-11-18 11:55", "America/Toronto");
var b = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", "America/Toronto");
var c = moment.tz(1403454068850, "America/Toronto");
var d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toronto");
const a = moment.tz("2013-11-18 11:55", "America/Toronto");
const b = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", "America/Toronto");
const c = moment.tz(1403454068850, "America/Toronto");
const d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toronto");
a.tz();
var num = 1367337600000,
const num = 1367337600000,
arr = [2013, 5, 1],
str = "2013-12-01",
date = new Date(2013, 4, 1),
@@ -53,7 +51,7 @@ moment.tz(obj, "America/Los_Angeles");
moment.tz.zone('America/Los_Angeles').abbr(1403465838805);
moment.tz.zone('America/Los_Angeles').offset(1403465838805);
var zone = moment.tz.zone('America/New_York');
const zone = moment.tz.zone('America/New_York');
zone.parse(Date.UTC(2012, 2, 19, 8, 30)); // 240
moment.tz.add('America/Los_Angeles|PST PDT|80 70|0101|1Lzm0 1zb0 Op0');
@@ -80,7 +78,6 @@ moment.tz.setDefault('America/Los_Angeles');
moment.tz.guess();
var zoneAbbr: string = moment.tz('America/Los_Angeles').zoneAbbr();
var zoneName: string = moment.tz('America/Los_Angeles').zoneName();
const zoneAbbr: string = moment.tz('America/Los_Angeles').zoneAbbr();
const zoneName: string = moment.tz('America/Los_Angeles').zoneName();
-1
View File
@@ -21,7 +21,6 @@ export interface WavesConfig {
}
export interface RippleOptions {
/**
* Specify how long to wait between starting and stopping the ripple.
*
-1
View File
@@ -1,4 +1,3 @@
import { init, ripple, attach, calm } from "node-waves";
init({ delay: 300 });
+29 -30
View File
@@ -8,16 +8,16 @@
/**
* JavaScript API
* The JavaScript API allows you to create an HTML/JavaScript application that has access to the native windowing environment,
* The JavaScript API allows you to create an HTML/JavaScript application that has access to the native windowing environment,
* can communicate with other applications and has access to sandboxed system-level features.
*
* API Ready
* When using the OpenFin API, it is important to ensure that it has been fully loaded before making any API calls. To verify
* that the API is in fact ready, be sure to make any API calls either from within the fin.desktop.main() method or explicitly
* When using the OpenFin API, it is important to ensure that it has been fully loaded before making any API calls. To verify
* that the API is in fact ready, be sure to make any API calls either from within the fin.desktop.main() method or explicitly
* after it has returned. This avoids the situation of trying to access methods that are not yet fully injected.
*
* Overview
* When running within the OpenFin Runtime your web applications have access to the "fin" namespace and all the modules within the API
* When running within the OpenFin Runtime your web applications have access to the "fin" namespace and all the modules within the API
* without the need to include additional source files. You can treat the "fin" namespace as you would the "window", "navigator" or "document" objects.
**/
declare namespace fin {
@@ -136,8 +136,8 @@ declare namespace fin {
*/
scheduleRestart(callback?: () => void, errorCallback?: (reason: string) => void): void;
/**
* Sets new shortcut configuration for current application.
* Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest to
* Sets new shortcut configuration for current application.
* Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest to
* be able to change shortcut states.
*/
setShortcuts(config: ShortCutConfig, callback?: () => void, errorCallback?: (reason: string) => void): void;
@@ -150,7 +150,7 @@ declare namespace fin {
*/
terminate(callback?: () => void, errorCallback?: (reason: string) => void): void;
/**
* Waits for a hanging application. This method can be called in response to an application "not-responding" to allow the application
* Waits for a hanging application. This method can be called in response to an application "not-responding" to allow the application
* to continue and to generate another "not-responding" message after a certain period of time.
*/
wait(callback?: () => void, errorCallback?: (reason: string) => void): void;
@@ -244,8 +244,8 @@ declare namespace fin {
*/
customData?: any;
/**
* Specifies that the window will be positioned in the center of the primary monitor when loaded for the first time on a machine.
* When the window corresponding to that id is loaded again, the position from before the window was closed is used.
* Specifies that the window will be positioned in the center of the primary monitor when loaded for the first time on a machine.
* When the window corresponding to that id is loaded again, the position from before the window was closed is used.
* This option overrides defaultLeft and defaultTop. Default: false.
*/
defaultCentered?: boolean;
@@ -260,12 +260,12 @@ declare namespace fin {
*/
defaultWidth?: number;
/**
* The default top position of the window. Specifies the position of the top of the window when loaded for the first time on a machine.
* The default top position of the window. Specifies the position of the top of the window when loaded for the first time on a machine.
* When the window corresponding to that id is loaded again, the value of top is taken to be the last value before the window was closed. Default: 100.
*/
defaultTop?: number;
/**
* The default width of the window. Specifies the width of the window when loaded for the first time on a machine.
* The default width of the window. Specifies the width of the window when loaded for the first time on a machine.
* When the window corresponding to that id is loaded again, the width is taken to be the last width of the window before it was closed. Default: 800.
*/
defaultLeft?: number;
@@ -364,7 +364,7 @@ declare namespace fin {
*/
url?: string;
/**
* When set to false, the window will render before the "load" event is fired on the content's window.
* When set to false, the window will render before the "load" event is fired on the content's window.
* Caution, when false you will see an initial empty white window. Default: true.
*/
waitForPageLoad?: boolean;
@@ -463,7 +463,7 @@ declare namespace fin {
send(destinationUuid: string, name: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void;
send(destinationUuid: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void;
/**
* Subscribes to messages from the specified application on the specified topic. If the subscription is for a uuid, [name],
* Subscribes to messages from the specified application on the specified topic. If the subscription is for a uuid, [name],
* topic combination that has already been published to upon subscription you will receive the last 20 missed messages in the order they were published.
*/
subscribe(senderUuid: string, name: string, topic: string, listener: (message: any, uuid: string, name: string) => void,
@@ -492,8 +492,8 @@ declare namespace fin {
/**
* Notification
* Notification represents a window on OpenFin Runtime which is shown briefly to the user on the bottom-right corner of the primary monitor.
* A notification is typically used to alert the user of some important event which requires his or her attention.
* Notification represents a window on OpenFin Runtime which is shown briefly to the user on the bottom-right corner of the primary monitor.
* A notification is typically used to alert the user of some important event which requires his or her attention.
* Notifications are a child or your application that are controlled by the runtime.
*/
interface OpenFinNotification {
@@ -533,8 +533,8 @@ declare namespace fin {
*/
onClick?(callback: () => void): void;
/**
* Invoked when the notification is closed via .close() method on the created notification instance
* or the by the notification itself via fin.desktop.Notification.getCurrent().close().
* Invoked when the notification is closed via .close() method on the created notification instance
* or the by the notification itself via fin.desktop.Notification.getCurrent().close().
* NOTE: this is not invoked when the notification is dismissed via a swipe. For the swipe dismissal callback see onDismiss
*/
onClose?(callback: () => void): void;
@@ -559,7 +559,7 @@ declare namespace fin {
/**
* System
* An object representing the core of OpenFin Runtime.
* An object representing the core of OpenFin Runtime.
* Allows the developer to perform system-level actions, such as accessing logs, viewing processes, clearing the cache and exiting the runtime.
*/
interface OpenFinSystem {
@@ -574,7 +574,7 @@ declare namespace fin {
listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void,
callback?: () => void, errorCallback?: (reason: string) => void): void;
/**
* Clears cached data containing window state/positions,
* Clears cached data containing window state/positions,
* application resource files (images, HTML, JavaScript files), cookies, and items stored in the Local Storage.
*/
clearCache(options: CacheOptions, callback?: () => void, errorCallback?: (reason: string) => void): void;
@@ -636,7 +636,7 @@ declare namespace fin {
*/
getMousePosition(callback?: (mousePosition: VirtualScreenCoordinates) => void, errorCallback?: (reason: string) => void): void;
/**
* Retrieves an array of all of the runtime processes that are currently running.
* Retrieves an array of all of the runtime processes that are currently running.
* Each element in the array is an object containing the uuid and the name of the application to which the process belongs.
*/
getProcessList(callback?: (processInfoList: ProcessInfo[]) => void, errorCallback?: (reason: string) => void): void;
@@ -706,7 +706,6 @@ declare namespace fin {
* Update the OpenFin Runtime Proxy settings.
*/
updateProxySettings(type: string, address: string, port: number, callback?: () => void, errorCallback?: (reason: string) => void): void;
}
interface CacheOptions {
@@ -999,8 +998,8 @@ declare namespace fin {
*
* Creates a new OpenFin Window
*
* A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize,
* maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually.
* A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize,
* maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually.
* The new window appears in the same process as the parent window.
* @param {any} options - The options of the window
* @param {Function} [callback] - Called if the window creation was successful
@@ -1021,8 +1020,8 @@ declare namespace fin {
/**
* Window
* A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize,
* maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually.
* A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize,
* maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually.
* The new window appears in the same process as the parent window.
*/
interface OpenFinWindow {
@@ -1031,9 +1030,9 @@ declare namespace fin {
*/
name: string;
/**
* Returns the native JavaScript "window" object for the window. This method can only be used by the parent application or the window itself,
* otherwise it will return undefined. The same Single-Origin-Policy (SOP) rules apply for child windows created by window.open(url) in that the
* contents of the window object are only accessible if the URL has the same origin as the invoking window. See example below.
* Returns the native JavaScript "window" object for the window. This method can only be used by the parent application or the window itself,
* otherwise it will return undefined. The same Single-Origin-Policy (SOP) rules apply for child windows created by window.open(url) in that the
* contents of the window object are only accessible if the URL has the same origin as the invoking window. See example below.
* Also, will not work with fin.desktop.Window objects created with fin.desktop.Window.wrap().
* @returns {Window} Native window
*/
@@ -1109,7 +1108,7 @@ declare namespace fin {
*/
getBounds(callback?: (bounds: WindowBounds) => void, errorCallback?: (reason: string) => void): void;
/**
* Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this window. If a window is not in a group an empty array is returned.
* Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this window. If a window is not in a group an empty array is returned.
* Please note that calling window is included in the result array.
*/
getGroup(callback?: (group: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void;
@@ -1686,4 +1685,4 @@ declare namespace fin {
| "top-right"
| "bottom-left"
| "bottom-right";
}
}
+3 -3
View File
@@ -46,7 +46,7 @@ function test_application() {
application.getGroups(allGroups => {
console.log("There are a total of " + allGroups.length + " groups.");
var groupCounter = 1;
let groupCounter = 1;
allGroups.forEach(windowGroup => {
console.log("Group " + groupCounter + " contains " +
windowGroup.length + " windows.");
@@ -548,7 +548,7 @@ function test_window() {
resizable: false,
state: "normal"
}, () => {
var _win = finWindow.getNativeWindow();
const _win = finWindow.getNativeWindow();
_win.addEventListener("DOMContentLoaded", () => { finWindow.show(); });
}, error => {
console.log("Error creating window:", error);
@@ -725,4 +725,4 @@ function test_window() {
frame: false,
maxWidth: 500
});
}
}
+4 -4
View File
@@ -1,4 +1,4 @@
import parse = require('parse-unit')
let [number, length] = parse('10px')
number === 50
length === 'px'
import parse = require('parse-unit');
const [number, length] = parse('10px');
number === 50;
length === 'px';
+59 -59
View File
@@ -42,9 +42,9 @@
declare function Parsimmon<T>(fn: (input: string, i: number) => Parsimmon.Result<T>): Parsimmon.Parser<T>;
declare namespace Parsimmon {
export type StreamType = string;
type StreamType = string;
export interface Index {
interface Index {
/** zero-based character offset */
offset: number;
/** one-based line offset */
@@ -53,26 +53,26 @@ declare namespace Parsimmon {
column: number;
}
export interface Mark<T> {
interface Mark<T> {
start: Index;
end: Index;
value: T;
}
export type Result<T> = Success<T> | Failure;
type Result<T> = Success<T> | Failure;
export interface Success<T> {
interface Success<T> {
status: true;
value: T;
}
export interface Failure {
interface Failure {
status: false;
expected: string[];
index: Index;
}
export interface Parser<T> {
interface Parser<T> {
/**
* parse the string
*/
@@ -155,41 +155,41 @@ declare namespace Parsimmon {
/**
* Alias of `Parsimmon(fn)` for backwards compatibility.
*/
export function Parser<T>(fn: (input: string, i: number) => Parsimmon.Result<T>): Parser<T>;
function Parser<T>(fn: (input: string, i: number) => Parsimmon.Result<T>): Parser<T>;
/**
* To be used inside of Parsimmon(fn). Generates an object describing how
* far the successful parse went (index), and what value it created doing
* so. See documentation for Parsimmon(fn).
*/
export function makeSuccess<T>(index: number, value: T): Success<T>;
function makeSuccess<T>(index: number, value: T): Success<T>;
/**
* To be used inside of Parsimmon(fn). Generates an object describing how
* far the unsuccessful parse went (index), and what kind of syntax it
* expected to see (expectation). See documentation for Parsimmon(fn).
*/
export function makeFailure(furthest: number, expectation: string): Failure;
function makeFailure(furthest: number, expectation: string): Failure;
/**
* Returns true if obj is a Parsimmon parser, otherwise false.
*/
export function isParser(obj: any): boolean;
function isParser(obj: any): boolean;
/**
* is a parser that expects to find "my-string", and will yield the same.
*/
export function string(string: string): Parser<string>;
function string(string: string): Parser<string>;
/**
* Returns a parser that looks for exactly one character from string, and yields that character.
*/
export function oneOf(string: string): Parser<string>;
function oneOf(string: string): Parser<string>;
/**
* Returns a parser that looks for exactly one character NOT from string, and yields that character.
*/
export function noneOf(string: string): Parser<string>;
function noneOf(string: string): Parser<string>;
/**
* Returns a parser that looks for a match to the regexp and yields the given match group
@@ -197,145 +197,145 @@ declare namespace Parsimmon {
* parse location. The regexp may only use the following flags: imu. Any other flag will
* result in an error being thrown.
*/
export function regexp(myregex: RegExp, group?: number): Parser<string>;
function regexp(myregex: RegExp, group?: number): Parser<string>;
/**
* This was the original name for Parsimmon.regexp, but now it is just an alias.
*/
export function regex(myregex: RegExp, group?: number): Parser<string>;
function regex(myregex: RegExp, group?: number): Parser<string>;
/**
* Returns a parser that doesn't consume any of the string, and yields result.
*/
export function succeed<U>(result: U): Parser<U>;
function succeed<U>(result: U): Parser<U>;
/**
* This is an alias for Parsimmon.succeed(result).
*/
export function of<U>(result: U): Parser<U>;
function of<U>(result: U): Parser<U>;
/**
* accepts a variable number of parsers that it expects to find in order, yielding an array of the results.
*/
export function seq<T>(p1: Parser<T>): Parser<[T]>;
export function seq<T, U>(p1: Parser<T>, p2: Parser<U>): Parser<[T, U]>;
export function seq<T, U, V>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>): Parser<[T, U, V]>;
export function seq<T, U, V, W>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>): Parser<[T, U, V, W]>;
export function seq<T, U, V, W, X>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>): Parser<[T, U, V, W, X]>;
export function seq<T, U, V, W, X, Y>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>): Parser<[T, U, V, W, X, Y]>;
export function seq<T, U, V, W, X, Y, Z>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, p7: Parser<Z>): Parser<[T, U, V, W, X, Y, Z]>;
export function seq<T>(...parsers: Array<Parser<T>>): Parser<T[]>;
export function seq(...parsers: Array<Parser<any>>): Parser<any[]>;
function seq<T>(p1: Parser<T>): Parser<[T]>;
function seq<T, U>(p1: Parser<T>, p2: Parser<U>): Parser<[T, U]>;
function seq<T, U, V>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>): Parser<[T, U, V]>;
function seq<T, U, V, W>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>): Parser<[T, U, V, W]>;
function seq<T, U, V, W, X>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>): Parser<[T, U, V, W, X]>;
function seq<T, U, V, W, X, Y>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>): Parser<[T, U, V, W, X, Y]>;
function seq<T, U, V, W, X, Y, Z>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, p7: Parser<Z>): Parser<[T, U, V, W, X, Y, Z]>;
function seq<T>(...parsers: Array<Parser<T>>): Parser<T[]>;
function seq(...parsers: Array<Parser<any>>): Parser<any[]>;
/**
* Takes the string passed to parser.parse(string) and the error returned from
* parser.parse(string) and turns it into a human readable error message string.
* Note that there are certainly better ways to format errors, so feel free to write your own.
*/
export function formatError<T>(string: string, error: Result<T>): string;
function formatError<T>(string: string, error: Result<T>): string;
/**
* Matches all parsers sequentially, and passes their results as the arguments to a function.
* Similar to calling Parsimmon.seq and then .map, but the values are not put in an array.
*/
export function seqMap<T, U>(p1: Parser<T>, cb: (a1: T) => U): Parser<U>;
export function seqMap<T, U, V>(p1: Parser<T>, p2: Parser<U>, cb: (a1: T, a2: U) => V): Parser<V>;
export function seqMap<T, U, V, W>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, cb: (a1: T, a2: U, a3: V) => W): Parser<W>;
export function seqMap<T, U, V, W, X>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, cb: (a1: T, a2: U, a3: V, a4: W) => X): Parser<X>;
export function seqMap<T, U, V, W, X, Y>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, cb: (a1: T, a2: U, a3: V, a4: W, a5: X) => Y): Parser<Y>;
export function seqMap<T, U, V, W, X, Y, Z>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, cb: (a1: T, a2: U, a3: V, a4: W, a5: X, a6: Y) => Z): Parser<Z>;
export function seqMap<T, U, V, W, X, Y, Z, A>(
function seqMap<T, U>(p1: Parser<T>, cb: (a1: T) => U): Parser<U>;
function seqMap<T, U, V>(p1: Parser<T>, p2: Parser<U>, cb: (a1: T, a2: U) => V): Parser<V>;
function seqMap<T, U, V, W>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, cb: (a1: T, a2: U, a3: V) => W): Parser<W>;
function seqMap<T, U, V, W, X>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, cb: (a1: T, a2: U, a3: V, a4: W) => X): Parser<X>;
function seqMap<T, U, V, W, X, Y>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, cb: (a1: T, a2: U, a3: V, a4: W, a5: X) => Y): Parser<Y>;
function seqMap<T, U, V, W, X, Y, Z>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, cb: (a1: T, a2: U, a3: V, a4: W, a5: X, a6: Y) => Z): Parser<Z>;
function seqMap<T, U, V, W, X, Y, Z, A>(
p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, p7: Parser<Z>,
cb: (a1: T, a2: U, a3: V, a4: W, a5: X, a6: Y, a7: Z) => A): Parser<A>;
export function seqMap<T, U, V, W, X, Y, Z, A, B>(
function seqMap<T, U, V, W, X, Y, Z, A, B>(
p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, p7: Parser<Z>, p8: Parser<A>,
cb: (a1: T, a2: U, a3: V, a4: W, a5: X, a6: Y, a7: Z, a8: A) => B): Parser<B>;
export type SuccessFunctionType<U> = (index: number, result: U) => Result<U>;
export type FailureFunctionType<U> = (index: number, msg: string) => Result<U>;
export type ParseFunctionType<U> = (stream: StreamType, index: number) => Result<U>;
type SuccessFunctionType<U> = (index: number, result: U) => Result<U>;
type FailureFunctionType<U> = (index: number, msg: string) => Result<U>;
type ParseFunctionType<U> = (stream: StreamType, index: number) => Result<U>;
/**
* allows to add custom primitive parsers.
*/
export function custom<U>(parsingFunction: (success: SuccessFunctionType<U>, failure: FailureFunctionType<U>) => ParseFunctionType<U>): Parser<U>;
function custom<U>(parsingFunction: (success: SuccessFunctionType<U>, failure: FailureFunctionType<U>) => ParseFunctionType<U>): Parser<U>;
/**
* accepts a variable number of parsers, and yields the value of the first one that succeeds,
* backtracking in between.
*/
export function alt<U>(...parsers: Array<Parser<U>>): Parser<U>;
export function alt(...parsers: Array<Parser<any>>): Parser<any>;
function alt<U>(...parsers: Array<Parser<U>>): Parser<U>;
function alt(...parsers: Array<Parser<any>>): Parser<any>;
/**
* Accepts two parsers, and expects zero or more matches for content, separated by separator, yielding an array.
*/
export function sepBy<T, U>(content: Parser<T>, separator: Parser<U>): Parser<T[]>;
function sepBy<T, U>(content: Parser<T>, separator: Parser<U>): Parser<T[]>;
/**
* This is the same as Parsimmon.sepBy, but matches the content parser at least once.
*/
export function sepBy1<T, U>(content: Parser<T>, separator: Parser<U>): Parser<T[]>;
function sepBy1<T, U>(content: Parser<T>, separator: Parser<U>): Parser<T[]>;
/**
* accepts a function that returns a parser, which is evaluated the first time the parser is used.
* This is useful for referencing parsers that haven't yet been defined.
*/
export function lazy<U>(f: () => Parser<U>): Parser<U>;
export function lazy<U>(description: string, f: () => Parser<U>): Parser<U>;
function lazy<U>(f: () => Parser<U>): Parser<U>;
function lazy<U>(description: string, f: () => Parser<U>): Parser<U>;
/**
* fail paring with a message
*/
export function fail(message: string): Parser<never>;
function fail(message: string): Parser<never>;
/**
* is equivalent to Parsimmon.regex(/[a-z]/i)
*/
export var letter: Parser<string>;
const letter: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/[a-z]*`/i)
*/
export var letters: Parser<string>;
const letters: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/[0-9]/)
*/
export var digit: Parser<string>;
const digit: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/[0-9]*`/)
*/
export var digits: Parser<string>;
const digits: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/\s+/)
*/
export var whitespace: Parser<string>;
const whitespace: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/\s*`/)
*/
export var optWhitespace: Parser<string>;
const optWhitespace: Parser<string>;
/**
* consumes and yields the next character of the stream.
*/
export var any: Parser<string>;
const any: Parser<string>;
/**
* consumes and yields the entire remainder of the stream.
*/
export var all: Parser<string>;
const all: Parser<string>;
/**
* expects the end of the stream.
*/
export var eof: Parser<undefined>;
const eof: Parser<undefined>;
/**
* is a parser that yields the current index of the parse.
*/
export var index: Parser<Index>;
const index: Parser<Index>;
/**
* Returns a parser that yield a single character if it passes the predicate
*/
export function test(predicate: (char: string) => boolean): Parser<string>;
function test(predicate: (char: string) => boolean): Parser<string>;
/**
* Returns a parser yield a string containing all the next characters that pass the predicate
*/
export function takeWhile(predicate: (char: string) => boolean): Parser<string>;
function takeWhile(predicate: (char: string) => boolean): Parser<string>;
}
export = Parsimmon;
+22 -32
View File
@@ -1,4 +1,3 @@
import P = require('parsimmon');
import { Parser, Mark, Result, Index } from "parsimmon";
@@ -14,43 +13,35 @@ class Bar {
// -- -- -- -- -- -- -- -- -- -- -- -- --
var str: string;
var strArr: string[];
var bool: boolean;
var num: number;
var index: Index;
var regex: RegExp;
let str: string;
let strArr: string[];
let bool: boolean;
let num: number;
let index: Index;
var foo: Foo;
var bar: Bar;
var strArr: string[];
var fooArr: Foo[];
var barArr: Bar[];
let foo: Foo;
declare const bar: Bar;
// -- -- -- -- -- -- -- -- -- -- -- -- --
var strPar: Parser<string>;
var numPar: Parser<number>;
var voidPar: Parser<void>;
var anyPar: Parser<any>;
var indexPar: Parser<Index>;
let strPar: Parser<string>;
let numPar: Parser<number>;
let voidPar: Parser<void>;
let anyPar: Parser<any>;
let indexPar: Parser<Index>;
var fooPar: Parser<Foo>;
var barPar: Parser<Bar>;
var fooOrBarPar: Parser<Foo | Bar>;
let fooPar: Parser<Foo>;
let barPar: Parser<Bar>;
let fooOrBarPar: Parser<Foo | Bar>;
// -- -- -- -- -- -- -- -- -- -- -- -- --
var anyArrPar: Parser<any[]>;
var strArrPar: Parser<string[]>;
var fooArrPar: Parser<Foo[]>;
var barArrPar: Parser<Bar[]>;
let strArrPar: Parser<string[]>;
let fooArrPar: Parser<Foo[]>;
// -- -- -- -- -- -- -- -- -- -- -- -- --
var fooMarkPar: Parser<Mark<Foo>>;
let fooMarkPar: Parser<Mark<Foo>>;
const result = fooMarkPar.parse(str);
if (result.status) {
@@ -61,7 +52,7 @@ if (result.status) {
// -- -- -- -- -- -- -- -- -- -- -- -- --
var fooResult: Result<Foo>;
let fooResult: Result<Foo>;
// https://github.com/Microsoft/TypeScript/issues/12882
if (fooResult.status === true) {
@@ -126,13 +117,13 @@ fooPar = fooPar.desc(str);
// -- -- -- -- -- -- -- -- -- -- -- -- --
strPar = P.string(str);
strPar = P.regex(regex);
strPar = P.regex(/rgx/);
fooPar = P.succeed(foo);
fooArrPar = P.seq(fooPar, fooPar);
var par: Parser<[Bar, Foo, number]> = P.seq(barPar, fooPar, numPar);
var par2: Parser<number> = P.seq(barPar, fooPar, numPar).map(([a, b, c]: [Bar, Foo, number]) => 42);
const par: Parser<[Bar, Foo, number]> = P.seq(barPar, fooPar, numPar);
const par2: Parser<number> = P.seq(barPar, fooPar, numPar).map(([a, b, c]: [Bar, Foo, number]) => 42);
fooPar = P.custom<Foo>((success, failure) => (stream, i) => { str = stream; num = i; return success(num, foo); });
fooPar = P.custom<Foo>((success, failure) => (stream, i) => failure(num, str));
@@ -140,7 +131,6 @@ fooPar = P.custom<Foo>((success, failure) => (stream, i) => failure(num, str));
fooPar = P.alt(fooPar, fooPar);
anyPar = P.alt(barPar, fooPar, numPar);
fooPar = P.lazy(() => {
return fooPar;
});
+19 -22
View File
@@ -226,7 +226,7 @@ declare namespace BackendAPI {
* Validation error.
* REF(NxValidationError)
*/
//?Type = REF(NxValidationError)?
// ?Type = REF(NxValidationError)?
qError: INxValidationError;
}
@@ -2235,11 +2235,7 @@ declare namespace VisualizationAPI {
}
declare namespace ExtensionAPI {
interface IExtensionModel {
}
interface IExtensionModel {}
interface IExtensionComponent {
model: IExtensionModel;
@@ -2249,13 +2245,12 @@ declare namespace ExtensionAPI {
component: IExtensionComponent;
}
//ExtensionAPI
// ExtensionAPI
type SelectionModeType = "CONFIRM" | "QUICK";
interface IInitialProperties {
qHyperCubeDef?: any; //IHyperCubeDef;
qListObjectDef?: any; //IListObjectDef;
qHyperCubeDef?: any; // IHyperCubeDef;
qListObjectDef?: any; // IListObjectDef;
fixed?: boolean;
width?: number;
percent?: boolean;
@@ -2287,7 +2282,7 @@ declare namespace ExtensionAPI {
// qHyperCubeDef: IVisualizationHyperCubeDef;
// qListObjectDef: IVis
//[""]:
// [""]:
}
//#region IDefinition
@@ -2451,7 +2446,7 @@ declare namespace ExtensionAPI {
items: any;
}
//?Das selbe wie Appearance?
// ?Das selbe wie Appearance?
interface ISettings {
uses: "settings";
min?: number;
@@ -2468,16 +2463,17 @@ declare namespace ExtensionAPI {
}
declare module "qlik" {
var e: RootAPI.IRoot; export = e;
const e: RootAPI.IRoot;
export = e;
}
interface IQVAngular {
/**
* Register a new directive with the compiler.
*
* @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
* @param directiveFactory An injectable directive factory function.
*/
* Register a new directive with the compiler.
*
* @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
* @param directiveFactory An injectable directive factory function.
*/
directive(name: string, directiveFactory: ng.Injectable<ng.IDirectiveFactory>): void;
directive(object: { [directiveName: string]: ng.Injectable<ng.IDirectiveFactory> }): void;
@@ -2496,10 +2492,11 @@ interface IQVAngular {
service<T>(name: string, serviceConstructor: ng.Injectable<Function>): T;
service<T>(object: { [name: string]: ng.Injectable<Function> }): T;
//provider(name: string, serviceProviderFactory: ng.IServiceProviderFactory): void;
//provider(name: string, serviceProviderConstructor: ng.IServiceProviderClass): void;
// provider(name: string, serviceProviderFactory: ng.IServiceProviderFactory): void;
// provider(name: string, serviceProviderConstructor: ng.IServiceProviderClass): void;
}
declare module "qvangular" {
var e: IQVAngular; export = e;
}
const e: IQVAngular;
export = e;
}
@@ -1,3 +1,3 @@
import qlik = require("qlik");
const t = qlik.currApp();
const t = qlik.currApp();
+4 -6
View File
@@ -7,11 +7,11 @@
import * as React from 'react';
declare namespace RcSliderClass {
export interface Marks {
interface Marks {
[number: number]: JSX.Element | string | { style: any, label: string | JSX.Element };
}
export interface CommonApiProps {
interface CommonApiProps {
/**
* Additional CSS class for the root DOM node
* @default ''
@@ -100,8 +100,7 @@ declare namespace RcSliderClass {
value?: number;
}
export interface RangeProps extends CommonApiProps {
interface RangeProps extends CommonApiProps {
/**
* Set initial positions of handles.
* @default [0,0]
@@ -128,7 +127,7 @@ declare namespace RcSliderClass {
pushable?: boolean;
}
export interface HandleProps extends CommonApiProps {
interface HandleProps extends CommonApiProps {
/**
* Class name
*/
@@ -152,5 +151,4 @@ declare namespace RcSliderClass {
class Handle extends React.Component<RcSliderClass.HandleProps, {}> { }
}
export = RcSliderClass;
+2 -2
View File
@@ -24,7 +24,7 @@ ReactDOM.render(
marks={{ 1: "1" }}
step={0.01}
vertical={true}
handle={() => { return <Slider /> }}
handle={() => <Slider />}
included={true}
disabled={false}
dots={true}
@@ -45,4 +45,4 @@ ReactDOM.render(
allowCross={false}
pushable={true} />,
document.querySelector('.app')
);
);
@@ -16,4 +16,3 @@ export interface EditableInputProps extends ClassAttributes<EditableInput> {
}
export default class EditableInput extends Component<EditableInputProps, any> {}
+27 -27
View File
@@ -1,22 +1,22 @@
import * as React from "react"
import { StatelessComponent } from "react"
import { render } from "react-dom"
import * as React from "react";
import { StatelessComponent } from "react";
import { render } from "react-dom";
import {
AlphaPicker, BlockPicker, ChromePicker, CirclePicker,
CompactPicker, GithubPicker, HuePicker, MaterialPicker,
PhotoshopPicker, SketchPicker, SliderPicker, SwatchesPicker,
TwitterPicker, CustomPicker, InjectedColorProps, ColorResult,
Color
} from "react-color"
import { Alpha, Checkboard, EditableInput, Hue, Saturation } from "react-color/lib/components/common"
} from "react-color";
import { Alpha, Checkboard, EditableInput, Hue, Saturation } from "react-color/lib/components/common";
interface CustomProps extends InjectedColorProps {
color?: Color
color?: Color;
}
var CustomComponent: StatelessComponent<CustomProps> = (props: CustomProps) => {
function onChange (color: ColorResult) {
console.log(color)
const CustomComponent: StatelessComponent<CustomProps> = (props: CustomProps) => {
function onChange(color: ColorResult) {
console.log(color);
}
return (
@@ -27,23 +27,23 @@ var CustomComponent: StatelessComponent<CustomProps> = (props: CustomProps) => {
<Hue color={ props.color } direction="horizontal" onChange={ onChange } />
<Saturation color={ props.color } onChange={ onChange } />
</div>
)
}
var Custom = CustomPicker(CustomComponent)
);
};
const Custom = CustomPicker(CustomComponent);
var colors: Array<string> = ["#000", "#333"]
const colors = ["#000", "#333"];
render(<AlphaPicker height="100px" width="100px" />, document.getElementById("main"))
render(<BlockPicker colors={ colors } width="100px" />, document.getElementById("main"))
render(<ChromePicker disableAlpha />, document.getElementById("main"))
render(<CirclePicker colors={ colors } width="100px" />, document.getElementById("main"))
render(<CompactPicker colors={ colors } />, document.getElementById("main"))
render(<GithubPicker colors={ colors } width="100px" />, document.getElementById("main"))
render(<HuePicker height="100px" width="100px" />, document.getElementById("main"))
render(<MaterialPicker />, document.getElementById("main"))
render(<PhotoshopPicker header="Test" />, document.getElementById("main"))
render(<SketchPicker disableAlpha presetColors={ colors } />, document.getElementById("main"))
render(<SliderPicker />, document.getElementById("main"))
render(<SwatchesPicker colors={ [colors] } height={ 100 } width={ 100 } />, document.getElementById("main"))
render(<TwitterPicker />, document.getElementById("main"))
render(<Custom />, document.getElementById("main"))
render(<AlphaPicker height="100px" width="100px" />, document.getElementById("main"));
render(<BlockPicker colors={ colors } width="100px" />, document.getElementById("main"));
render(<ChromePicker disableAlpha />, document.getElementById("main"));
render(<CirclePicker colors={ colors } width="100px" />, document.getElementById("main"));
render(<CompactPicker colors={ colors } />, document.getElementById("main"));
render(<GithubPicker colors={ colors } width="100px" />, document.getElementById("main"));
render(<HuePicker height="100px" width="100px" />, document.getElementById("main"));
render(<MaterialPicker />, document.getElementById("main"));
render(<PhotoshopPicker header="Test" />, document.getElementById("main"));
render(<SketchPicker disableAlpha presetColors={ colors } />, document.getElementById("main"));
render(<SliderPicker />, document.getElementById("main"));
render(<SwatchesPicker colors={ [colors] } height={ 100 } width={ 100 } />, document.getElementById("main"));
render(<TwitterPicker />, document.getElementById("main"));
render(<Custom />, document.getElementById("main"));
+3 -6
View File
@@ -11,20 +11,17 @@ export as namespace CopyToClipboard;
export = CopyToClipboard;
declare namespace CopyToClipboard {
export interface Options {
interface Options {
debug: boolean;
message: string;
}
export interface Props {
interface Props {
text: string;
onCopy?: (a: string) => void,
onCopy?: (a: string) => void;
options?: Options;
}
}
declare class CopyToClipboard extends React.Component<CopyToClipboard.Props, {}> {
}
@@ -1,4 +1,3 @@
import * as React from "react";
import * as CopyToClipboard from "react-copy-to-clipboard";
+14 -16
View File
@@ -7,7 +7,7 @@
import * as React from 'react';
declare namespace DayPicker {
export interface LocaleUtils {
interface LocaleUtils {
formatDay(day: Date, locale: string): string;
formatMonthTitle(month: Date, locale: string): string;
formatWeekdayLong(weekday: number, locale: string): string;
@@ -16,7 +16,7 @@ declare namespace DayPicker {
getMonths(locale: string): [string, string, string, string, string, string, string, string, string, string, string, string];
}
export interface DateUtils {
interface DateUtils {
addMonths(d: Date, n: number): Date;
clone(d: Date): Date;
isSameDay(d1: Date, d2: Date): Date;
@@ -27,16 +27,16 @@ declare namespace DayPicker {
isDayInRange(day: Date, range: RangeModifier): boolean;
}
export interface CaptionElementProps {
interface CaptionElementProps {
date: Date;
classNames: ClassNames,
classNames: ClassNames;
localeUtils: LocaleUtils;
locale: string;
months: undefined;
onClick?: React.MouseEventHandler<HTMLElement>;
}
export interface NavbarElementProps {
interface NavbarElementProps {
className: string;
classNames: ClassNames;
previousMonth: Date;
@@ -51,14 +51,14 @@ declare namespace DayPicker {
locale: string;
}
export interface WeekdayElementProps {
interface WeekdayElementProps {
weekday: number;
className: string;
localeUtils: LocaleUtils;
locale: string;
}
export interface ClassNames {
interface ClassNames {
container: string;
interactionDisabled: string;
navBar: string;
@@ -80,28 +80,26 @@ declare namespace DayPicker {
outside: string;
}
export interface RangeModifier {
interface RangeModifier {
from: Date;
to: Date;
}
export interface BeforeModifier {
interface BeforeModifier {
before: Date;
}
export interface AfterModifier {
interface AfterModifier {
after: Date;
}
export interface FunctionModifier {
(date: Date): boolean;
}
export type Modifier = Date | RangeModifier | BeforeModifier | AfterModifier | FunctionModifier;
type FunctionModifier = (date: Date) => boolean;
type Modifier = Date | RangeModifier | BeforeModifier | AfterModifier | FunctionModifier;
export interface Modifiers {
interface Modifiers {
today: Modifier | Modifier[];
outside: Modifier | Modifier[];
[other: string]: Modifier | Modifier[] | undefined;
}
export interface Props {
interface Props {
canChangeMonth?: boolean;
captionElement?: React.ReactElement<Partial<CaptionElementProps>> |
React.ComponentClass<CaptionElementProps> |
@@ -16,6 +16,7 @@ DayPicker.DateUtils.clone(new Date());
DayPicker.DateUtils.isDayInRange(new Date(), { from: new Date(), to: new Date(2050) });
interface MyCaptionProps extends DayPicker.CaptionElementProps {
myProp: number;
}
class Caption extends React.Component<MyCaptionProps, {}> {
render() {
@@ -32,8 +33,7 @@ class Caption extends React.Component<MyCaptionProps, {}> {
);
}
}
<DayPicker captionElement={ Caption }/>
<DayPicker captionElement={ Caption }/>;
type CaptionElementProps = Partial<DayPicker.CaptionElementProps>;
class CaptionElement extends React.Component<CaptionElementProps, {}> {
@@ -46,7 +46,7 @@ class CaptionElement extends React.Component<CaptionElementProps, {}> {
<div onClick={ onClick }>
{ localeUtils.formatMonthTitle(date, locale) }
</div>
)
}
);
};
}
<DayPicker captionElement={ <CaptionElement /> }/>
<DayPicker captionElement={ <CaptionElement /> }/>;
+5 -8
View File
@@ -7,8 +7,7 @@
import * as React from "react";
declare namespace ReactFacebookLogin {
export interface ReactFacebookLoginProps {
interface ReactFacebookLoginProps {
appId: string;
callback: (userInfo: ReactFacebookLoginInfo) => void;
@@ -33,19 +32,17 @@ declare namespace ReactFacebookLogin {
xfbml?: boolean;
}
export interface ReactFacebookLoginInfo {
interface ReactFacebookLoginInfo {
id: string;
name: string;
}
export interface ReactFacebookLoginState {
interface ReactFacebookLoginState {
isSdkLoaded?: boolean;
isProcessing?: boolean;
}
}
declare class ReactFacebookLogin extends React.Component<ReactFacebookLogin.ReactFacebookLoginProps, ReactFacebookLogin.ReactFacebookLoginState> {
}
declare class ReactFacebookLogin extends React.Component<ReactFacebookLogin.ReactFacebookLoginProps, ReactFacebookLogin.ReactFacebookLoginState> {}
export = ReactFacebookLogin;
export = ReactFacebookLogin;
@@ -22,7 +22,6 @@ ReactDOM.render(
document.getElementById('demo')
);
ReactDOM.render(
<FacebookLogin
appId="1088597931155576"
@@ -60,7 +59,6 @@ ReactDOM.render(
);
class MyComponent extends React.Component<any, any> {
private responseFacebook(response: ReactFacebookLoginInfo) {
console.log(response);
}
@@ -78,9 +76,7 @@ class MyComponent extends React.Component<any, any> {
}
}
class MyComponent2 extends React.Component<any, any> {
private responseFacebook(response: ReactFacebookLoginInfo) {
console.log(response);
}
@@ -96,4 +92,3 @@ class MyComponent2 extends React.Component<any, any> {
);
}
}
@@ -52,4 +52,3 @@ class NewComponent extends React.Component<undefined, undefined> {
});
}
}
+23 -31
View File
@@ -66,7 +66,6 @@ interface LeafletDraggingEvents {
onmoveend?: (event: Leaflet.Event) => void;
}
interface MapProps extends React.HTMLProps<Map>,
LeafletLayerEvents, LeafletMapStateChangeEvents, LeafletPopupEvents, LeafletTooltipEvents, LeafletLocationEvents, LeafletInteractionEvents, LeafletOtherEvents, Leaflet.MapOptions {
animate?: boolean;
@@ -78,20 +77,18 @@ interface MapProps extends React.HTMLProps<Map>,
id?: string;
}
declare type Map = React.ComponentClass<MapProps>;
declare const Map: Map;
type Map = React.ComponentClass<MapProps>;
export const Map: Map;
interface MapInstance extends React.Component<MapProps, {}> {
leafletElement: Leaflet.Map;
}
interface PaneProps {
name?: string;
style?: React.CSSProperties;
className?: string;
}
declare const Pane: React.ComponentClass<PaneProps>;
export const Pane: React.ComponentClass<PaneProps>;
// There is no Layer class, these are the base props for all layers on the map
interface LayerProps extends LeafletInteractionEvents {
@@ -107,7 +104,6 @@ interface LayerProps extends LeafletInteractionEvents {
ontooltipclose?: (event: Leaflet.TooltipEvent) => void;
}
interface MarkerProps extends LayerProps, LeafletDraggingEvents {
position: Leaflet.LatLngExpression;
draggable?: boolean;
@@ -115,7 +111,7 @@ interface MarkerProps extends LayerProps, LeafletDraggingEvents {
zIndexOffset?: number;
opacity?: number;
}
declare const Marker: React.ComponentClass<MarkerProps>;
export const Marker: React.ComponentClass<MarkerProps>;
interface MarkerInstance extends React.Component<MarkerProps, {}> {
leafletElement: Leaflet.Marker;
}
@@ -123,11 +119,11 @@ interface MarkerInstance extends React.Component<MarkerProps, {}> {
interface PopupProps extends LayerProps, Leaflet.PopupOptions {
position?: Leaflet.LatLngExpression;
}
declare const Popup: React.ComponentClass<PopupProps>;
export const Popup: React.ComponentClass<PopupProps>;
// tslint:disable-next-line:no-empty-interface
interface TooltipProps extends LayerProps, Leaflet.TooltipOptions { }
declare const Tooltip: React.ComponentClass<TooltipProps>;
export const Tooltip: React.ComponentClass<TooltipProps>;
interface GridLayerProps extends LayerProps {
opacity?: number;
@@ -140,84 +136,80 @@ interface GridLayerProps extends LayerProps {
ontileload?: (event: Leaflet.TileEvent) => void;
onload?: (event: Leaflet.Event) => void;
}
declare const GridLayer: React.ComponentClass<GridLayerProps>;
export const GridLayer: React.ComponentClass<GridLayerProps>;
interface TileLayerProps extends GridLayerProps, Leaflet.TileLayerOptions {
url: string;
}
declare const TileLayer: React.ComponentClass<TileLayerProps>;
export const TileLayer: React.ComponentClass<TileLayerProps>;
interface ImageOverlayProps extends LayerProps, LeafletInteractionEvents {
url: string;
opacity?: string;
}
declare const ImageOverlay: React.ComponentClass<ImageOverlayProps>;
export const ImageOverlay: React.ComponentClass<ImageOverlayProps>;
interface WMSTileLayerProps extends TileLayerProps {
url: string;
}
declare const WMSTileLayer: React.ComponentClass<WMSTileLayerProps>;
export const WMSTileLayer: React.ComponentClass<WMSTileLayerProps>;
// Path is an abstract class
// tslint:disable-next-line:no-empty-interface
interface PathProps extends LeafletLayerEvents, LeafletInteractionEvents, Leaflet.PathOptions {
}
interface CircleProps extends PathProps {
center: Leaflet.LatLngExpression;
radius?: number;
}
declare const Circle: React.ComponentClass<CircleProps>;
export const Circle: React.ComponentClass<CircleProps>;
interface CircleMarkerProps extends PathProps {
center: Leaflet.LatLngExpression;
radius?: number;
}
declare const CircleMarker: React.ComponentClass<CircleMarkerProps>;
export const CircleMarker: React.ComponentClass<CircleMarkerProps>;
interface PolylineProps extends PathProps {
positions: Leaflet.LatLngExpression[] | Leaflet.LatLngExpression[][];
}
declare const Polyline: React.ComponentClass<PolylineProps>;
export const Polyline: React.ComponentClass<PolylineProps>;
interface PolygonProps extends PathProps {
positions: Leaflet.LatLngExpression[] | Leaflet.LatLngExpression[][] | Leaflet.LatLngExpression[][][];
}
declare const Polygon: React.ComponentClass<PolygonProps>;
export const Polygon: React.ComponentClass<PolygonProps>;
interface RectangleProps extends PathProps {
bounds: Leaflet.LatLngBoundsExpression;
}
declare const Rectangle: React.ComponentClass<RectangleProps>;
export const Rectangle: React.ComponentClass<RectangleProps>;
// tslint:disable-next-line:no-empty-interface
interface LayerGroupProps extends LayerProps { }
declare const LayerGroup: React.ComponentClass<LayerGroupProps>;
export const LayerGroup: React.ComponentClass<LayerGroupProps>;
// tslint:disable-next-line:no-empty-interface
interface FeatureGroupProps extends LayerGroupProps, Leaflet.PathOptions { }
declare const FeatureGroup: React.ComponentClass<FeatureGroupProps>;
export const FeatureGroup: React.ComponentClass<FeatureGroupProps>;
interface GeoJSONProps extends FeatureGroupProps {
data: GeoJSON.GeoJsonObject;
}
declare const GeoJSON: React.ComponentClass<GeoJSONProps>;
export const GeoJSON: React.ComponentClass<GeoJSONProps>;
interface AttributionControlProps {
position?: Leaflet.ControlPosition;
}
declare const AttributionControl: React.ComponentClass<AttributionControlProps>;
export const AttributionControl: React.ComponentClass<AttributionControlProps>;
interface LayersControlProps {
position?: Leaflet.ControlPosition;
}
declare const LayersControl: React.ComponentClass<LayersControlProps> & { BaseLayer: LayersControl.BaseLayer, Overlay: LayersControl.Overlay };
export const LayersControl: React.ComponentClass<LayersControlProps> & { BaseLayer: LayersControl.BaseLayer, Overlay: LayersControl.Overlay };
declare namespace LayersControl {
export namespace LayersControl {
interface LayersControlLayerProps {
name: string;
checked?: boolean;
@@ -229,9 +221,9 @@ declare namespace LayersControl {
interface ScaleControlProps {
position: Leaflet.ControlPosition;
}
declare const ScaleControl: React.ComponentClass<ScaleControlProps>;
export const ScaleControl: React.ComponentClass<ScaleControlProps>;
interface ZoomControlProps {
position: Leaflet.ControlPosition;
}
declare const ZoomControl: React.ComponentClass<ZoomControlProps>;
export const ZoomControl: React.ComponentClass<ZoomControlProps>;
+1 -1
View File
@@ -187,7 +187,7 @@ export class MarkerWithDivIconExample extends Component<any, any> {
new Leaflet.DivIcon({})
}/>
</Map>
)
);
}
}
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../node_modules/types-publisher/tslint-definitions.json" }
{ "extends": "../node_modules/types-publisher/tslint-definitions.json" }