Merge branch 'master' into michelle-officeruntime

This commit is contained in:
Michelle Scharlock
2018-09-21 14:28:58 -07:00
committed by GitHub
567 changed files with 34090 additions and 10130 deletions

View File

@@ -5,5 +5,5 @@ indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
[{*.json,*.yml}]
[{*.json,*.yml,*.ts}]
indent_style = space

9821
.github/CODEOWNERS vendored

File diff suppressed because it is too large Load Diff

View File

@@ -174,6 +174,12 @@
"sourceRepoURL": "https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions",
"asOfVersion": "2.0.15"
},
{
"libraryName": "bitwise",
"typingsPackageName": "bitwise",
"sourceRepoURL": "https://github.com/dodekeract/bitwise",
"asOfVersion": "2.0.0"
},
{
"libraryName": "botvs",
"typingsPackageName": "botvs",

View File

@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"ajv": "*"
}
}

View File

@@ -132,9 +132,8 @@ myApp.controller('sortableController', function ($scope: MySortableControllerSco
$scope.sortableOptions.tolerance = 'pointer';
$scope.sortableOptions.zIndex = 9999;
$scope.sortableOptions['ui-floating'] = undefined;
$scope.sortableOptions['ui-floating'] = null;
$scope.sortableOptions['ui-floating'] = false;
$scope.sortableOptions['ui-floating'] = true;
$scope.sortableOptions['ui-floating'] = "auto";
const sortableFloatingOption0: ng.ui.UISortableOptions<SortableModelInfo> = { 'ui-floating': undefined };
const sortableFloatingOption1: ng.ui.UISortableOptions<SortableModelInfo> = { 'ui-floating': false };
const sortableFloatingOption2: ng.ui.UISortableOptions<SortableModelInfo> = { 'ui-floating': true };
const sortableFloatingOption3: ng.ui.UISortableOptions<SortableModelInfo> = { 'ui-floating': 'auto' };
});

View File

@@ -12,7 +12,7 @@ declare module 'angular' {
export namespace ui {
interface UISortableOptions<T> extends SortableOptions<T> {
'ui-floating'?: string | boolean;
'ui-floating'?: 'auto' | boolean;
}
interface UISortableProperties<T> {

View File

@@ -1316,7 +1316,7 @@ declare namespace angular {
*
* @param key the key of the data to be retrieved
*/
get<T>(key: string): T;
get<T>(key: string): T | undefined;
/**
* Removes an entry from the Cache object.

View File

@@ -27,3 +27,6 @@ const mockContext = {
};
awsServerlessExpress.proxy(server, mockEvent, mockContext);
awsServerlessExpress.proxy(server, mockEvent, mockContext, 'CALLBACK', () => {});
awsServerlessExpress.proxy(server, mockEvent, mockContext, 'CONTEXT_SUCCEED');
awsServerlessExpress.proxy(server, mockEvent, mockContext, 'PROMISE').promise.then((response: awsServerlessExpress.Response) => {}).catch(err => {});

View File

@@ -1,4 +1,4 @@
// Type definitions for aws-serverless-express 3.0
// Type definitions for aws-serverless-express 3.3
// Project: https://github.com/awslabs/aws-serverless-express
// Definitions by: Ben Speakman <https://github.com/threesquared>
// Josh Caffey <https://github.com/jcaffey>
@@ -11,6 +11,16 @@
import * as http from 'http';
import * as lambda from 'aws-lambda';
export interface Response {
statusCode: number;
body: string;
headers: {};
}
export interface ProxyResult {
promise: Promise<Response>;
}
export function createServer(
requestListener: (request: http.IncomingMessage, response: http.ServerResponse) => void,
serverListenCallback?: () => any,
@@ -20,5 +30,27 @@ export function createServer(
export function proxy(
server: http.Server,
event: any,
context: lambda.Context
context: lambda.Context,
): http.Server;
export function proxy(
server: http.Server,
event: any,
context: lambda.Context,
resolutionMode: 'CONTEXT_SUCCEED',
): void;
export function proxy(
server: http.Server,
event: any,
context: lambda.Context,
resolutionMode: 'PROMISE'
): ProxyResult;
export function proxy(
server: http.Server,
event: any,
context: lambda.Context,
resolutionMode: 'CALLBACK',
callback?: (error: any, response: Response) => void
): void;

View File

@@ -3,6 +3,7 @@ import bcryptjs = require("bcryptjs");
let str: string;
let num: number;
let bool: boolean;
let arr: number[];
let error: Error;
str = bcryptjs.genSaltSync();
@@ -63,3 +64,7 @@ bcryptjs.compare("string1", "string2")
num = bcryptjs.getRounds("string");
str = bcryptjs.getSalt("string");
str = bcryptjs.encodeBase64([1, 2, 3, 4, 5], 5);
arr = bcryptjs.decodeBase64("string", 5);

View File

@@ -1,8 +1,10 @@
// Type definitions for bcryptjs v2.4.0
// Project: https://github.com/dcodeIO/bcrypt.js
// Definitions by: Joshua Filby <https://github.com/Joshua-F/>, Rafael Kraut <https://github.com/RafaelKr>
// Definitions by: Joshua Filby <https://github.com/Joshua-F/>
// Rafael Kraut <https://github.com/RafaelKr>
// Branislav Holý <https://github.com/branoholy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/**
@@ -103,3 +105,19 @@ export declare function getRounds(hash: string): number;
* @return Extracted salt part
*/
export declare function getSalt(hash: string): string;
/**
* Encodes a byte array to base64 with up to len bytes of input, using the custom bcrypt alphabet.
* @function
* @param b Byte array
* @param len Maximum input length
*/
export declare function encodeBase64(b: Readonly<ArrayLike<number>>, len: number): string;
/**
* Decodes a base64 encoded string to up to len bytes of output, using the custom bcrypt alphabet.
* @function
* @param s String to decode
* @param len Maximum output length
*/
export declare function decodeBase64(s: string, len: number): number[];

View File

@@ -1,4 +0,0 @@
export default function and(
bits1: ReadonlyArray<number>,
bits2: ReadonlyArray<number>
): ReadonlyArray<number>;

View File

@@ -1,33 +0,0 @@
import bitsAnd from './and';
import bitsNor from './nor';
import bitsNot from './not';
import bitsOr from './or';
import bitsReduceAnd from './reduce-and';
import bitsReduceNand from './reduce-nand';
import bitsReduceNor from './reduce-nor';
import bitsReduceOr from './reduce-or';
import bitsReduceXnor from './reduce-xnor';
import bitsReduceXor from './reduce-xor';
import bitsToBoolean from './to-boolean';
import bitsToString from './to-string';
import bitsXnor from './xnor';
import bitsXor from './xor';
declare namespace bits {
const and: typeof bitsAnd;
const nor: typeof bitsNor;
const not: typeof bitsNot;
const or: typeof bitsOr;
const reduceAnd: typeof bitsReduceAnd;
const reduceNand: typeof bitsReduceNand;
const reduceNor: typeof bitsReduceNor;
const reduceOr: typeof bitsReduceOr;
const reduceXnor: typeof bitsReduceXnor;
const reduceXor: typeof bitsReduceXor;
const toBoolean: typeof bitsToBoolean;
const toString: typeof bitsToString;
const xnor: typeof bitsXnor;
const xor: typeof bitsXor;
}
export default bits;

View File

@@ -1,4 +0,0 @@
export default function nand(
bits1: ReadonlyArray<number>,
bits2: ReadonlyArray<number>
): ReadonlyArray<number>;

View File

@@ -1,4 +0,0 @@
export default function nor(
bits1: ReadonlyArray<number>,
bits2: ReadonlyArray<number>
): ReadonlyArray<number>;

View File

@@ -1,4 +0,0 @@
export default function not(
bits1: ReadonlyArray<number>,
bits2: ReadonlyArray<number>
): ReadonlyArray<number>;

View File

@@ -1,4 +0,0 @@
export default function or(
bits1: ReadonlyArray<number>,
bits2: ReadonlyArray<number>
): ReadonlyArray<number>;

View File

@@ -1 +0,0 @@
export default function reduceAnd(bits: ReadonlyArray<number>): number;

View File

@@ -1 +0,0 @@
export default function reduceNand(bits: ReadonlyArray<number>): number;

View File

@@ -1 +0,0 @@
export default function reduceNor(bits: ReadonlyArray<number>): number;

View File

@@ -1 +0,0 @@
export default function reduceOr(bits: ReadonlyArray<number>): number;

View File

@@ -1 +0,0 @@
export default function reduceXnor(bits: ReadonlyArray<number>): number;

View File

@@ -1 +0,0 @@
export default function reduceXor(bits: ReadonlyArray<number>): number;

View File

@@ -1,3 +0,0 @@
export default function toBoolean(
bits: ReadonlyArray<number>
): ReadonlyArray<boolean>;

View File

@@ -1,5 +0,0 @@
export default function toString(
bit: ReadonlyArray<number>,
spacing?: number,
spacer?: string
): string;

View File

@@ -1,4 +0,0 @@
export default function xnor(
bits1: ReadonlyArray<number>,
bits2: ReadonlyArray<number>
): ReadonlyArray<number>;

View File

@@ -1,4 +0,0 @@
export default function xor(
bits1: ReadonlyArray<number>,
bits2: ReadonlyArray<number>
): ReadonlyArray<number>;

View File

@@ -1,56 +0,0 @@
// Demonstrating cherry-picking
import bitwise from 'bitwise';
import bits from 'bitwise/bits';
import toBoolean from 'bitwise/bits/to-boolean';
import buffer from 'bitwise/buffer';
import create from 'bitwise/buffer/create';
import byte from 'bitwise/byte';
import read from 'bitwise/byte/read';
import integer from 'bitwise/integer';
import setBit from 'bitwise/integer/set-bit';
import nibble from 'bitwise/nibble';
import nibbleRead from 'bitwise/nibble/read';
import string from 'bitwise/string';
import toBits from 'bitwise/string/to-bits';
// Testing basic functions
const testBits = [0, 1, 1, 0, 1];
// $ExpectType string
bitwise.bits.toString(testBits);
// $ExpectType ReadonlyArray<boolean>
bits.toBoolean(testBits);
// $ExpectType ReadonlyArray<boolean>
toBoolean(testBits);
// $ExpectType ReadonlyArray<number>
byte.read(12);
// $ExpectType ReadonlyArray<number>
read(12);
// $ExpectType Buffer
buffer.create(testBits);
// $ExpectType Buffer
create(testBits);
// $ExpectType ReadonlyArray<number>
integer.setBit(12, 1, 0);
// $ExpectType ReadonlyArray<number>
setBit(12, 1, 0);
// $ExpectType ReadonlyArray<number>
nibble.read(15);
// $ExpectType ReadonlyArray<number>
nibbleRead(15);
// $ExpectType ReadonlyArray<number>
string.toBits('10 10 12$%_.0');
// $ExpectType ReadonlyArray<number>
toBits('10 10 12$%_.0');

View File

@@ -1,7 +0,0 @@
/// <reference types= "node" />
export default function and(
buffer1: Buffer,
buffer2: Buffer,
isLooping?: boolean
): Buffer;

View File

@@ -1,3 +0,0 @@
/// <reference types= "node" />
export default function create(bits: ReadonlyArray<number>): Buffer;

View File

@@ -1,31 +0,0 @@
import bufferAnd from './and';
import bufferCreate from './create';
import bufferModify from './modify';
import bufferNand from './nand';
import bufferNor from './nor';
import bufferNot from './not';
import bufferOr from './or';
import bufferRead from './read';
import bufferReadCInt from './read-c-int';
import bufferReadInt from './read-int';
import bufferReadUInt from './read-u-int';
import bufferXnor from './xnor';
import bufferXor from './xor';
declare namespace buffer {
const and: typeof bufferAnd;
const create: typeof bufferCreate;
const modify: typeof bufferModify;
const nand: typeof bufferNand;
const nor: typeof bufferNor;
const not: typeof bufferNot;
const or: typeof bufferOr;
const read: typeof bufferRead;
const readCInt: typeof bufferReadCInt;
const readInt: typeof bufferReadInt;
const readUInt: typeof bufferReadUInt;
const xnor: typeof bufferXnor;
const xor: typeof bufferXor;
}
export default buffer;

View File

@@ -1,7 +0,0 @@
/// <reference types= "node" />
export default function modify(
buffer: Buffer,
newBits: ReadonlyArray<number>,
bitOffset?: number
): void;

View File

@@ -1,7 +0,0 @@
/// <reference types= "node" />
export default function nand(
buffer1: Buffer,
buffer2: Buffer,
isLooping?: boolean
): Buffer;

View File

@@ -1,7 +0,0 @@
/// <reference types= "node" />
export default function nor(
buffer1: Buffer,
buffer2: Buffer,
isLooping: boolean
): Buffer;

View File

@@ -1,3 +0,0 @@
/// <reference types= "node" />
export default function not(buffer: Buffer): Buffer;

View File

@@ -1,7 +0,0 @@
/// <reference types= "node" />
export default function or(
buffer1: Buffer,
buffer2: Buffer,
isLooping?: boolean
): Buffer;

View File

@@ -1,7 +0,0 @@
/// <reference types= "node" />
export default function readCInt(
buffer: Buffer,
bitOffset?: number,
bitLength?: number
): number;

View File

@@ -1,7 +0,0 @@
/// <reference types= "node" />
export default function readInt(
buffer: Buffer,
bitOffset?: number,
bitLength?: number
): number;

View File

@@ -1,7 +0,0 @@
/// <reference types= "node" />
export default function readUInt(
buffer: Buffer,
bitOffset?: number,
bitLength?: number
): number;

View File

@@ -1,7 +0,0 @@
/// <reference types= "node" />
export default function read(
buffer: Buffer,
bitOffset?: number,
bitLength?: number
): ReadonlyArray<number>;

View File

@@ -1,7 +0,0 @@
/// <reference types= "node" />
export default function xnor(
buffer1: Buffer,
buffer2: Buffer,
isLooping?: boolean
): Buffer;

View File

@@ -1,7 +0,0 @@
/// <reference types= "node" />
export default function xor(
buffer1: Buffer,
buffer2: Buffer,
isLooping?: boolean
): Buffer;

View File

@@ -1,9 +0,0 @@
import byteRead from './read';
import byteWrite from './write';
declare namespace byte {
const read: typeof byteRead;
const write: typeof byteWrite;
}
export default byte;

View File

@@ -1 +0,0 @@
export default function read(byte: number): ReadonlyArray<number>;

View File

@@ -1 +0,0 @@
export default function write(bits: ReadonlyArray<number>): number;

View File

@@ -1,22 +0,0 @@
// Type definitions for bitwise 1.5
// Project: https://github.com/dodekeract/bitwise
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import bitwiseBits from './bits';
import bitwiseBuffer from './buffer';
import bitwiseByte from './byte';
import bitwiseInteger from './integer';
import bitwiseNibble from './nibble';
import bitwiseString from './string';
declare namespace bitwise {
const bits: typeof bitwiseBits;
const buffer: typeof bitwiseBuffer;
const byte: typeof bitwiseByte;
const integer: typeof bitwiseInteger;
const nibble: typeof bitwiseNibble;
const string: typeof bitwiseString;
}
export default bitwise;

View File

@@ -1 +0,0 @@
export default function getBit(number: number, position: number): number;

View File

@@ -1,11 +0,0 @@
import integerGetBit from './get-bit';
import integerSetBit from './set-bit';
import integerToggleBit from './toggle-bit';
declare namespace integer {
const getBit: typeof integerGetBit;
const setBit: typeof integerSetBit;
const toggleBit: typeof integerToggleBit;
}
export default integer;

View File

@@ -1,5 +0,0 @@
export default function setBit(
number: number,
position: number,
value: number
): ReadonlyArray<number>;

View File

@@ -1,4 +0,0 @@
export default function toggleBit(
number: number,
position: number
): ReadonlyArray<number>;

View File

@@ -1,9 +0,0 @@
import nibbleRead from './read';
import nibbleWrite from './write';
declare namespace nibble {
const read: typeof nibbleRead;
const write: typeof nibbleWrite;
}
export default nibble;

View File

@@ -1 +0,0 @@
export default function read(nibble: number): ReadonlyArray<number>;

View File

@@ -1 +0,0 @@
export default function write(nibble: ReadonlyArray<number>): number;

View File

@@ -1,7 +0,0 @@
import stringToBits from './to-bits';
declare namespace string {
const toBits: typeof stringToBits;
}
export default string;

View File

@@ -1 +0,0 @@
export default function toBits(string: string): ReadonlyArray<number>;

View File

@@ -1,60 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bitwise-tests.ts",
"bits/and.d.ts",
"bits/index.d.ts",
"bits/nand.d.ts",
"bits/nor.d.ts",
"bits/not.d.ts",
"bits/or.d.ts",
"bits/reduce-and.d.ts",
"bits/reduce-nand.d.ts",
"bits/reduce-nor.d.ts",
"bits/reduce-or.d.ts",
"bits/reduce-xnor.d.ts",
"bits/reduce-xor.d.ts",
"bits/to-boolean.d.ts",
"bits/to-string.d.ts",
"bits/xnor.d.ts",
"bits/xor.d.ts",
"buffer/and.d.ts",
"buffer/create.d.ts",
"buffer/modify.d.ts",
"buffer/nand.d.ts",
"buffer/nor.d.ts",
"buffer/not.d.ts",
"buffer/or.d.ts",
"buffer/read-c-int.d.ts",
"buffer/read-int.d.ts",
"buffer/read-u-int.d.ts",
"buffer/read.d.ts",
"buffer/xnor.d.ts",
"buffer/xor.d.ts",
"byte/index.d.ts",
"byte/read.d.ts",
"byte/write.d.ts",
"integer/get-bit.d.ts",
"integer/index.d.ts",
"integer/set-bit.d.ts",
"integer/toggle-bit.d.ts",
"nibble/index.d.ts",
"nibble/read.d.ts",
"nibble/write.d.ts",
"string/index.d.ts",
"string/to-bits.d.ts"
]
}

View File

@@ -0,0 +1,28 @@
import BloomFilter = require('bloom-filter');
const numElements = 3;
const falsePositiveRate = 0.01;
const filter = BloomFilter.create(numElements, falsePositiveRate);
// elements
const a = Buffer.from('99108ad8ed9bb6274d3980bab5a85c048f0950c8', 'hex');
const c = Buffer.from('b5a2c786d9ef4658287ced5914b37a1b4aa32eee', 'hex');
// insert elements
// $ExpectType void
filter.insert(a);
// $ExpectType boolean
!filter.contains(c);
// reinstantiate from an object
const serialized = filter.toObject();
const woahFilter = new BloomFilter(serialized);
// initialize directly
const newFilter = new BloomFilter({
vData: Buffer.from('123', 'hex'), // the data of the filter
nHashFuncs: 3, // the number of hash functions to use
nTweak: 2147483649, // the seed used for the hash fuctions
nFlags: 0 // flags used to update the filter when matched
});

38
types/bloom-filter/index.d.ts vendored Normal file
View File

@@ -0,0 +1,38 @@
// Type definitions for bloom-filter 0.2
// Project: https://github.com/bitpay/bloom-filter
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare class Filter {
constructor(options: Filter.FilterOptions);
static create(elements: number, falsePositiveRate: number, nTweak?: number, nFlags?: number): Filter;
toObject(): Filter.FilterOptions;
hash(nHashNum: number, vDataToHash: Buffer): number;
insert(data: Buffer): void;
contains(data: Buffer): boolean;
clear(): void;
inspect(): string;
BLOOM_UPDATE_NONE: number;
BLOOM_UPDATE_ALL: number;
BLOOM_UPDATE_P2PUBKEY_ONLY: number;
MAX_BLOOM_FILTER_SIZE: number;
MAX_HASH_FUNCS: number;
MIN_HASH_FUNCS: number;
LN2SQUARED: number;
LN2: number;
}
declare namespace Filter {
interface FilterOptions {
vData: Buffer;
nHashFuncs: number;
nTweak?: number;
nFlags?: number;
}
function MurmurHash3(seed: number, data: Buffer): number;
}
export = Filter;

View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bloom-filter-tests.ts"
]
}

View File

@@ -5,3 +5,6 @@ let bn = new BN(42);
bn = bn.add(bn);
bn.isZero();
bn.byteLength;
bn.toArrayLike(Buffer, 'le', 2);
const test = new BN(1, 'le');

View File

@@ -48,6 +48,10 @@ declare class BN {
base?: number,
endian?: Endianness
);
constructor(
number: number | string | number[] | Buffer | BN,
endian?: Endianness
)
/**
* @description create a reduction context
@@ -64,6 +68,16 @@ declare class BN {
*/
static isBN(b: any): b is BN;
/**
* @description returns the maximum of 2 BN instances.
*/
static max(left: BN, right: BN): BN;
/**
* @description returns the minimum of 2 BN instances.
*/
static min(left: BN, right: BN): BN;
/**
* @description Convert number to red
*/
@@ -98,10 +112,16 @@ declare class BN {
* @description convert to an instance of `type`, which must behave like an Array
*/
toArrayLike(
ArrayType: Buffer | any[],
ArrayType: typeof Buffer,
endian?: Endianness,
length?: number
): Buffer | any[];
): Buffer;
toArrayLike(
ArrayType: any[],
endian?: Endianness,
length?: number
): any[];
/**
* @description convert to Node.js Buffer (if available). For compatibility with browserify and similar tools, use this instead: a.toArrayLike(Buffer, endian, length)

View File

@@ -60,3 +60,6 @@ Object.keys(insertGlobals.vars).forEach((x) => {
var b = browserify('./browser/main.js', {
insertGlobalVars: insertGlobalVars
});
declare const file: string | string[];
b.add(file);

View File

@@ -1,6 +1,9 @@
// Type definitions for Browserify 12.0
// Project: http://browserify.org/
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar>, John Vilk <https://github.com/jvilk>, Leonard Thieu <https://github.com/leonard-thieu>
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar>
// John Vilk <https://github.com/jvilk>
// Leonard Thieu <https://github.com/leonard-thieu>
// Linus Unnebäck <https://github.com/LinusU>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -102,8 +105,7 @@ interface BrowserifyObject extends NodeJS.EventEmitter {
* Add an entry file from file that will be executed when the bundle loads.
* If file is an array, each item in file will be added as an entry file.
*/
add(file: InputFile[], opts?: FileOptions): BrowserifyObject;
add(file: InputFile, opts?: FileOptions): BrowserifyObject;
add(file: InputFile | InputFile[], opts?: FileOptions): BrowserifyObject;
/**
* Make file available from outside the bundle with require(file).
* The file param is anything that can be resolved by require.resolve().

View File

@@ -0,0 +1,10 @@
import bytewise = require('bytewise');
// $ExpectType Buffer
bytewise.encode([1, 2, 3]);
// $ExpectType any
bytewise.decode(bytewise.encode([1, 2 , 3]));
// $ExpectType Buffer
bytewise.encode(bytewise.sorts.array.bound.lower(['123', -1, 0x123, Buffer.from('test')]));

16
types/bytewise/index.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
// Type definitions for bytewise 1.1
// Project: https://github.com/deanlandolt/bytewise
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types= "node" />
interface Bytewise {
encode: (value: any) => Buffer;
decode: (value: Buffer) => any;
[k: string]: any;
}
declare const bytewise: Bytewise;
export = bytewise;

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bytewise-tests.ts"
]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}

View File

@@ -13,6 +13,7 @@ function test() {
expect(testElement).to.have.id('id');
expect(testElement).to.have.html('foo');
expect(testElement).to.have.text('foo');
expect(testElement).to.have.trimmed.text('foo');
expect(testElement).to.have.text(['foo', 'bar']);
expect(testElement).to.have.value('foo');
expect(testElement).to.be.empty;

View File

@@ -35,6 +35,8 @@ declare namespace Chai {
displayed: Assertion;
trimmed: Assertion;
}
interface Include {

View File

@@ -186,6 +186,7 @@ declare namespace Chai {
property: Property;
members: Members;
ordered: Ordered;
nested: Nested;
}
interface Ordered {

View File

@@ -5,8 +5,8 @@ import { Chart, ChartData, Point } from "chart.js";
// => chartjs.Chart
const plugin = {
afterDraw: (chartInstance: Chart, easing: string, options?: any) => {
}
afterDraw: (chartInstance: Chart, easing: string, options?: any) => {
}
};
const chart: Chart = new Chart(new CanvasRenderingContext2D(), {
@@ -82,6 +82,18 @@ if (chart.chartArea) {
console.log(chart.chartArea.left);
}
// Testing custom legends
chart.config.options = {
...chart.config.options,
legend: {
display: false,
},
legendCallback: () => 'legend replacement'
};
chart.update();
const customLegend = chart.generateLegend();
console.log(customLegend === 'legend replacement');
// Testing radial chart
const tickOptions: Chart.LinearTickOptions = {
max: 100,
@@ -107,14 +119,14 @@ const chartConfig: Chart.ChartConfiguration = {
data: {
labels: ['#apples', '#pears', '#apricots', '#acorns', '#amigas', "#orics"],
datasets: [{
label: "test",
lineTension: 0.15,
data: [1, 1, 2, 3, 5],
backgroundColor: '#37738353',
borderColor: '#37738353',
borderWidth: 3,
fill: true
}]
label: "test",
lineTension: 0.15,
data: [1, 1, 2, 3, 5],
backgroundColor: '#37738353',
borderColor: '#37738353',
borderWidth: 3,
fill: true
}]
},
options: radarChartOptions
};

View File

@@ -14,6 +14,7 @@
// Francesco Benedetto <https://github.com/frabnt>
// Alexandros Dorodoulis <https://github.com/alexdor>
// Manuel Heidrich <https://github.com/mahnuh>
// Conrad Holtzhausen <https://github.com/Conrad777>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -163,7 +164,7 @@ interface Model {
}
declare namespace Chart {
type ChartType = 'line' | 'bar' | 'horizontalBar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie';
type ChartType = 'line' | 'bar' | 'horizontalBar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie' | 'scatter';
type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
@@ -264,6 +265,7 @@ declare namespace Chart {
aspectRatio?: number;
maintainAspectRatio?: boolean;
events?: string[];
legendCallback?(chart: Chart): string;
onHover?(this: Chart, event: MouseEvent, activeElements: Array<{}>): any;
onClick?(event?: MouseEvent, activeElements?: Array<{}>): any;
onResize?(this: Chart, newSize: ChartSize): void;

View File

@@ -124,7 +124,7 @@ declare namespace chroma {
* Computes the eucledian distance between two colors in a given color space (default is 'lab').
* {@link https://en.wikipedia.org/wiki/Euclidean_distance#Three_dimensions}
*/
distance(color1: string | Color, color2: string | Color, colorSpace?: keyof ColorSpaces): Color;
distance(color1: string | Color, color2: string | Color, colorSpace?: keyof ColorSpaces): number;
/**
* Computes color difference {@link https://en.wikipedia.org/wiki/Color_difference#CMC_l:c_.281984.29} as
@@ -133,7 +133,7 @@ declare namespace chroma {
* {@link https://web.archive.org/web/20160306044036/http://www.brucelindbloom.com/javascript/ColorDiff.js}
* The parameters L (default 1) and C (default 1) are weighting factors for lightness and chromacity.
*/
deltaE(color1: string | Color, color2: string | Color, L?: number, C?: number): Color;
deltaE(color1: string | Color, color2: string | Color, L?: number, C?: number): number;
/**
* chroma.brewer is an map of ColorBrewer scales that are included in chroma.js for convenience.

View File

@@ -195,6 +195,14 @@ declare namespace chrome.cast {
errorCallback: (error: chrome.cast.Error) => void
): void
/**
* @param {string} escaped A string to unescape.
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.unescape
*/
export function unescape(
escaped: string
): string
export class ApiConfig {
/**
* @param {!chrome.cast.SessionRequest} sessionRequest

View File

@@ -43,7 +43,7 @@ context.requestSession().then(err => {
session.getSessionObj().sessionId === session.getSessionId();
session.getSessionState() === cast.framework.SessionState.SESSION_STARTED;
session.getCastDevice().name;
session.getCastDevice().friendlyName;
session.getApplicationMetadata().applicationId;
session.getApplicationStatus() === "";
session.getActiveInputState() ===

View File

@@ -1,14 +1,12 @@
function test_CKEDITOR() {
CKEDITOR.basePath = 'test';
CKEDITOR.replaceClass = 'rich_editor';
CKEDITOR.skinName = 'moono';
CKEDITOR.skinName = 'myskin,/customstuff/myskin/';
var editor = new CKEDITOR.editor();
if (editor.getSelection(true).getType() == CKEDITOR.SELECTION_ELEMENT)
if (editor.getSelection(false).getType() == CKEDITOR.SELECTION_NONE)
if (editor.getSelection(true).getType() == CKEDITOR.SELECTION_TEXT)
var editor: CKEDITOR.editor = new CKEDITOR.editor();
if (editor.getSelection(true).getType() === CKEDITOR.SELECTION_ELEMENT)
if (editor.getSelection(false).getType() === CKEDITOR.SELECTION_NONE)
if (editor.getSelection(true).getType() === CKEDITOR.SELECTION_TEXT)
alert(CKEDITOR.basePath);
if (CKEDITOR.currentInstance)
alert(CKEDITOR.currentInstance.name);
@@ -17,7 +15,7 @@ function test_CKEDITOR() {
CKEDITOR.loadFullCoreTimeout = 5;
alert(CKEDITOR.revision);
alert(CKEDITOR.rnd);
if (CKEDITOR.status == 'loaded') {
if (CKEDITOR.status === 'loaded') {
CKEDITOR.loadFullCore();
}
alert(CKEDITOR.timestamp);
@@ -29,15 +27,16 @@ function test_CKEDITOR() {
CKEDITOR.inline('content');
if (CKEDITOR.loadFullCore)
CKEDITOR.loadFullCore();
CKEDITOR.replace('myfield');
var textarea = document.createElement('textarea');
CKEDITOR.replace('myfield');
CKEDITOR.replace(textarea);
CKEDITOR.replaceAll();
CKEDITOR.replaceAll('myClassName');
CKEDITOR.replaceAll((textarea, config) => false);
var editor: CKEDITOR.editor = CKEDITOR.appendTo('append here', CKEDITOR.config, 'data');
var editor: CKEDITOR.editor = CKEDITOR.appendTo(document.createElement('div'));
editor = CKEDITOR.appendTo('append here', CKEDITOR.config, 'data');
editor = CKEDITOR.appendTo(document.createElement('div'));
CKEDITOR.error('code');
CKEDITOR.error('500', { moreData: true });
CKEDITOR.warn('danger');
@@ -45,7 +44,7 @@ function test_CKEDITOR() {
}
function test_CKEDITOR_events() {
CKEDITOR.on('instanceCreated', function(event) {
CKEDITOR.on('instanceCreated', (event) => {
// $ExpectType editor
event.editor;
});
@@ -82,7 +81,7 @@ function test_config() {
{ name: 'styles', groups: [ 'styles' ] },
{ name: 'colors', groups: [ 'colors' ] },
],
}
};
}
function test_dom_comment() {
@@ -96,13 +95,13 @@ function test_dom_comment() {
function test_dom_document() {
var document = new CKEDITOR.dom.document(window.document);
var type = CKEDITOR.NODE_DOCUMENT;
var type: number = CKEDITOR.NODE_DOCUMENT;
CKEDITOR.document.appendStyleSheet('/mystyles.css');
var element = CKEDITOR.document.getBody();
var element: CKEDITOR.dom.element = CKEDITOR.document.getBody();
alert(element.getName());
var element2 = CKEDITOR.document.getById('myElement');
element = CKEDITOR.document.getById('myElement');
alert(element.getId());
var element3 = CKEDITOR.document.getHead();
element = CKEDITOR.document.getHead();
alert(element.getName());
var selection = CKEDITOR.instances[0].document.getSelection();
alert(selection.getType());
@@ -113,10 +112,10 @@ function test_dom_document() {
'</html>'
);
var styles: CSSStyleSheet = document.appendStyleText('some styles');
var element: CKEDITOR.dom.element = document.createElement('div');
var element2: CKEDITOR.dom.element = document.createElement('div', { styles: { height: '1234' } });
var element3: CKEDITOR.dom.element = document.createElement('div', { attributes: { id: '1234' } });
var element4: CKEDITOR.dom.element = document.createElement('div', { attributes: { tabIndex: '1234' }, styles: { width: '1234' } });
element = document.createElement('div');
element = document.createElement('div', { styles: { height: '1234' } });
element = document.createElement('div', { attributes: { id: '1234' } });
element = document.createElement('div', { attributes: { tabIndex: '1234' }, styles: { width: '1234' } });
}
function test_dom_documentFragment() {
@@ -130,7 +129,7 @@ function test_dom_domObject() {
var nativeElement = element.$;
var doc = new CKEDITOR.dom.document(document);
alert(doc.equals(CKEDITOR.document));
alert(doc == CKEDITOR.document);
alert(doc === CKEDITOR.document);
var element2 = new CKEDITOR.dom.element('span');
alert(element.getCustomData('hasCustomData'));
alert(element.getCustomData('nonExistingKey'));
@@ -153,7 +152,7 @@ function test_dom_element() {
var strong = new CKEDITOR.dom.element('strong');
p.append(strong);
var em = p.append('em');
var p = new CKEDITOR.dom.element('p');
p = new CKEDITOR.dom.element('p');
p.appendText('This is');
p.appendText(' some text');
element.breakParent(strong);
@@ -164,7 +163,7 @@ function test_dom_element() {
element.focus();
element.focusNext();
element.focusPrevious();
element.forEach(node=> {
element.forEach(node => {
console.log(node);
});
var element2 = CKEDITOR.dom.element.createFromHtml('<input type="text" />');
@@ -177,7 +176,7 @@ function test_dom_element() {
alert(element.getHtml());
alert(element.getId());
alert(element.getName());
alert('<b>' + element.getNameAtt() + '</b>');
alert(`<b>${element.getNameAtt()}</b>`);
alert(element.getOuterHtml());
alert(element.getTabIndex());
alert(element.getText());
@@ -198,7 +197,7 @@ function test_dom_element() {
element.setAttribute('class', 'myClass');
element.setAttribute('title', 'This is an example');
element.setAttributes({
'class': 'myClass',
class: 'myClass',
title: 'This is an example'
});
p.setHtml('<b>Inner</b> HTML');
@@ -214,20 +213,20 @@ function test_dom_element() {
element.show();
element.unselectable();
alert(element.getName());
alert(element == CKEDITOR.dom.element.get(element));
alert(element === CKEDITOR.dom.element.get(element));
var htmlElement = document.getElementById('myElement');
alert(CKEDITOR.dom.element.get(htmlElement).getName());
var dtd: CKEDITOR.dtdDefinition = element.getDtd();
var last: CKEDITOR.dom.node = element.getLast();
var last2: CKEDITOR.dom.node = element.getLast((node: CKEDITOR.dom.node) => node.equals(document.body));
if (element.isBlockBoundary({ 'div': 1, 'span': 1 })) {
if (element.isBlockBoundary({ div: 1, span: 1 })) {
element.setState(1, 'hex', false);
}
CKEDITOR.dom.element.clearMarkers({}, element, true);
var element1: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div');
var element2: CKEDITOR.dom.element = CKEDITOR.dom.element.get(document.createElement('div'));
var element6: CKEDITOR.dom.element = CKEDITOR.dom.element.get(document.createElement('div'));
var element3: CKEDITOR.dom.element = CKEDITOR.dom.element.get(element2);
var markedElement: CKEDITOR.dom.element = CKEDITOR.dom.element.setMarker({}, element, 'key', 0);
}
@@ -242,20 +241,20 @@ function test_dom_elementPath() {
function test_dom_event() {
var event = new CKEDITOR.dom.event(new Event(""));
alert(event.getKey());
alert(event.getKeystroke() == 65);
alert(event.getKeystroke() == CKEDITOR.CTRL + 65);
alert(event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
alert(event.getKeystroke() === 65);
alert(event.getKeystroke() === CKEDITOR.CTRL + 65);
alert(event.getKeystroke() === CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
var element = new CKEDITOR.dom.element('div');
element.on('mousemouse', ev=> {
element.on('mousemouse', ev => {
var pageOffset = ev.data.getPageOffset();
alert(pageOffset.x);
alert(pageOffset.y);
});
element.on('click', ev=> {
element.on('click', ev => {
var domEvent = ev.data;
domEvent.getTarget().addClass('clicked');
});
element.on('click', ev=> {
element.on('click', ev => {
var domEvent = ev.data as CKEDITOR.dom.event;
domEvent.preventDefault();
});
@@ -266,7 +265,7 @@ function test_dom_iterator() {
var iterator = range.createIterator();
var paragrah1: CKEDITOR.dom.element = iterator.getNextParagraph();
var paragrah2: CKEDITOR.dom.element = iterator.getNextParagraph('div');
alert(iterator.forceBrBreak === false);
alert(!iterator.forceBrBreak);
var itRange: CKEDITOR.dom.range = iterator.range;
}
@@ -335,7 +334,7 @@ function test_dom_selection() {
element = selection.getSelectedElement();
var text: string = selection.getSelectedText();
element = selection.getStartElement();
var type: number = selection.getType();
var isSomething: boolean = selection.isCollapsed();
@@ -361,18 +360,18 @@ function test_dom_walker() {
var range: CKEDITOR.dom.range = new CKEDITOR.dom.range(element);
var walker: CKEDITOR.dom.walker = new CKEDITOR.dom.walker(range);
var isSomething: boolean = walker.checkBackward();
isSomething = walker.checkForward();
walker.end();
var node: CKEDITOR.dom.node = walker.lastBackward();
node = walker.lastForward();
node = walker.next();
node = walker.previous();
walker.reset();
isSomething = CKEDITOR.dom.walker.blockBoundary({ 'div': 1 })(node);
isSomething = CKEDITOR.dom.walker.blockBoundary({ div: 1 })(node);
isSomething = CKEDITOR.dom.walker.bogus()(node);
isSomething = CKEDITOR.dom.walker.bogus(isSomething)(node);
isSomething = CKEDITOR.dom.walker.bookmark()(node);
@@ -471,8 +470,8 @@ function test_dialog() {
dialog.showPage('1234');
dialog.updateStyle();
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) {
CKEDITOR.dialog.add('abbrDialog', 'PATH/dialogs/abbr.js');
CKEDITOR.dialog.add('abbrDialog', (editor: CKEDITOR.editor) => {
return {
title: 'Abbreviation Properties',
minWidth: 400,
@@ -486,7 +485,7 @@ function test_dialog() {
{
id: 'tab-basic',
label: 'Basic Settings',
elements: <any[]>[]
elements: <any[]> []
},
{
id: 'tab-adv',
@@ -566,7 +565,7 @@ function test_fileTools_fileLoader() {
var loader: CKEDITOR.fileTools.fileLoader = new CKEDITOR.fileTools.fileLoader(editor, 'data');
loader = new CKEDITOR.fileTools.fileLoader(editor, blob);
loader = new CKEDITOR.fileTools.fileLoader(editor, blob, 'name');
loader.abort();
var finished: boolean = loader.isFinished();
loader.load();
@@ -582,7 +581,7 @@ function test_fileTools_uploadRepository() {
var editor: CKEDITOR.editor;
var blob: Blob;
var repo: CKEDITOR.fileTools.uploadRepository = new CKEDITOR.fileTools.uploadRepository(editor);
var loader: CKEDITOR.fileTools.fileLoader = repo.create('data', 'name');
loader = repo.create(blob, 'name', 'type');
@@ -603,7 +602,7 @@ function test_filter() {
filter.addElementCallback((el: CKEDITOR.htmlParser.element) => 4);
filter.addFeature({ allowedContent: style });
filter.addTransformations([ [ 'transform1', { right: (element: CKEDITOR.htmlParser.element, tools: string | CKEDITOR.filter.transformationTools) => true } ] ]);
var allowed: boolean = filter.allow(style);
allowed = filter.allow([style], 'name');
allowed = filter.allow('rule', 'name', false);
@@ -645,7 +644,6 @@ function test_focusManager() {
var bool: boolean = focusManager.hasFocus;
}
function test_htmlParser_basicWriter() {
var writer = new CKEDITOR.htmlParser.basicWriter();
writer.attribute('class', 'MyClass');
@@ -680,12 +678,12 @@ function test_htmlParser_cssStyle() {
style.populate(element);
style.populate(new CKEDITOR.dom.element('div'));
style.populate({ 'width': 1 });
style.populate({ width: 1 });
}
function test_htmlParser_element() {
var element: CKEDITOR.htmlParser.element = new CKEDITOR.htmlParser.element('el', { 'id': '1'});
var element: CKEDITOR.htmlParser.element = new CKEDITOR.htmlParser.element('el', { id: '1'});
var node: CKEDITOR.htmlParser.node;
element.add(node);
element.add(node, 5);
@@ -703,8 +701,8 @@ function test_htmlParser_element() {
element.forEach((el: CKEDITOR.htmlParser.node) => console.log('node'), 1);
element.forEach((el: CKEDITOR.htmlParser.node) => false, 2, true);
var node: CKEDITOR.htmlParser.node = element.getFirst('*');
node = element.getFirst({ 'id': '1' });
node = element.getFirst('*');
node = element.getFirst({ id: '1' });
node = element.getFirst((el: CKEDITOR.htmlParser.node) => true);
var html: string = element.getHtml();
@@ -728,7 +726,7 @@ function test_htmlParser_filter() {
filter = new CKEDITOR.htmlParser.filter();
filter.addRules({ text: 'text' });
filter.addRules({ attributes: { 'id': '1234' }}, 1);
filter.addRules({ attributes: { id: '1234' }}, 1);
filter.addRules({ comment: 'hey', text: 'text' }, { priority: 1 });
filter.addRules({ root: document.body }, { applyToAll: false });
@@ -736,7 +734,6 @@ function test_htmlParser_filter() {
filter.applyTo(node);
}
function test_htmlParser_filterRulesGroup() {
var rules: CKEDITOR.htmlParser.filterRulesGroup = new CKEDITOR.htmlParser.filterRulesGroup();
@@ -786,7 +783,7 @@ function test_htmlParser_node() {
var node: CKEDITOR.htmlParser.node = new CKEDITOR.htmlParser.node();
var el: CKEDITOR.htmlParser.element = node.getAscendant('condition');
el = node.getAscendant({ 'id': '1234' });
el = node.getAscendant({ id: '1234' });
el = node.getAscendant((node: CKEDITOR.htmlParser.element) => false);
var idx: number = node.getIndex();
@@ -795,7 +792,6 @@ function test_htmlParser_node() {
node.remove();
node.replaceWith(node);
el = node.wrapWith(el);
}
function test_htmlParser_text() {
@@ -825,9 +821,9 @@ function test_htmlWriter() {
function test_htmlParser() {
var html = '<div><span>text</span></div>';
var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html);
fragment.forEach(function(node) {
fragment.forEach((node) => {
if (node instanceof CKEDITOR.htmlParser.element) {
node.forEach(function(node) {
node.forEach((node) => {
console.log(node);
});
}
@@ -836,13 +832,13 @@ function test_htmlParser() {
function test_keystrokeHandler() {
var handler: CKEDITOR.keystrokeHandler = new CKEDITOR.keystrokeHandler(CKEDITOR.instances[0]);
handler.attach(new CKEDITOR.dom.domObject(document.body));
handler.attach(new CKEDITOR.dom.domObject(document.body));
}
function test_lang() {
var lang: string = CKEDITOR.lang.detect('en');
lang = CKEDITOR.lang.detect('zh', 'sw');
CKEDITOR.lang.load('tk', 'pr', (code: string, entries: any) => console.log('loaded'));
}
@@ -869,8 +865,8 @@ function test_menu() {
}
function test_plugins() {
CKEDITOR.plugins.add( 'abbr', {
init: function( editor: CKEDITOR.editor ) {
CKEDITOR.plugins.add('abbr', {
init: (editor: CKEDITOR.editor) => {
// empty logic
}
});
@@ -921,7 +917,7 @@ function test_skin() {
}
function test_style() {
var style: CKEDITOR.style = new CKEDITOR.style({ element: 'div' }, { 'key': 'value '});
var style: CKEDITOR.style = new CKEDITOR.style({ element: 'div' }, { key: 'value '});
style.apply(CKEDITOR.instances[0]);
var el: CKEDITOR.dom.element;
@@ -945,7 +941,7 @@ function test_style() {
var def: CKEDITOR.style.definition = style.getDefintion();
style.remove(CKEDITOR.instances[0]);
style.removeFromRange(range, CKEDITOR.instances[0]);
var rules: CKEDITOR.filter.allowedContentRules;
rules = style.toAllowedContentRules();
rules = style.toAllowedContentRules(CKEDITOR.instances[0]);
@@ -955,14 +951,14 @@ function test_adding_command_and_buttons() {
var textarea = document.createElement('textarea');
var instance = CKEDITOR.replace(textarea);
instance.addCommand( 'aCommand', {
exec: function( editor: CKEDITOR.editor ) {
instance.addCommand('aCommand', {
exec: (editor: CKEDITOR.editor) => {
// empty logic
return true;
}
});
instance.ui.addButton( 'firstButton', {
instance.ui.addButton('firstButton', {
icon: 'http://www.example.com/assets/images/icons.png',
iconOffset: -32,
label: 'Label 1',
@@ -970,7 +966,7 @@ function test_adding_command_and_buttons() {
toolbar: 'tools'
});
instance.ui.addButton( 'secondButton', {
instance.ui.addButton('secondButton', {
label: 'Label 2',
command: 'aCommand',
toolbar: 'tools'
@@ -983,7 +979,7 @@ function test_adding_widget() {
button: "Activate widgetty",
template: "<imaginary-element>",
dialog: "widgetty",
init: function() {
init: () => {
// no logic
}
});
@@ -1012,80 +1008,80 @@ function test_editor_instance_event() {
var textarea = document.createElement('textarea');
var instance = CKEDITOR.replace(textarea, {
on: {
activeEnterModeChange: function() {},
activeFilterChange: function() {},
afterCommandExec: function() {},
afterInsertHtml: function() {},
afterPaste: function() {},
afterPasteFromWord: function() {},
afterSetData: function() {},
afterUndoImage: function() {},
ariaEditorHelpLabel: function() {},
ariaWidget: function() {},
autogrow: function() {},
beforeCommandExec: function() {},
beforeDestroy: function() {},
beforeModeUnload: function() {},
beforeSetMode: function() {},
beforeUndoImage: function() {},
blur: function() {},
change: function() {},
configLoaded: function() {},
contentDirChanged: function() {},
contentDom: function() {},
contentDomInvalidated: function() {},
contentDomUnload: function() {},
customConfigLoaded: function() {},
dataFiltered: function() {},
dataReady: function() {},
destroy: function() {},
dialogHide: function() {},
dialogShow: function() {},
dirChanged: function() {},
doubleclick: function() {},
dragend: function() {},
dragstart: function() {},
drop: function() {},
elementsPathUpdate: function() {},
fileUploadRequest: function() {},
fileUploadResponse: function() {},
floatingSpaceLayout: function() {},
focus: function() {},
getData: function() {},
getSnapshot: function() {},
insertElement: function() {},
insertHtml: function() {},
insertText: function() {},
instanceReady: function() {},
key: function() {},
langLoaded: function() {},
loadSnapshot: function() {},
loaded: function() {},
lockSnapshot: function() {},
maximize: function() {},
menuShow: function() {},
mode: function() {},
notificationHide: function() {},
notificationShow: function() {},
notificationUpdate: function() {},
paste: function() {},
pasteFromWord: function() {},
pluginsLoaded: function() {},
readOnly: function() {},
removeFormatCleanup: function() {},
required: function() {},
resize: function() {},
save: function() {},
saveSnapshot: function() {},
selectionChange: function() {},
setData: function() {},
stylesSet: function() {},
template: function() {},
toDataFormat: function() {},
toHtml: function() {},
unlockSnapshot: function() {},
updateSnapshot: function() {},
widgetDefinition: function() {}
activeEnterModeChange: () => {},
activeFilterChange: () => {},
afterCommandExec: () => {},
afterInsertHtml: () => {},
afterPaste: () => {},
afterPasteFromWord: () => {},
afterSetData: () => {},
afterUndoImage: () => {},
ariaEditorHelpLabel: () => {},
ariaWidget: () => {},
autogrow: () => {},
beforeCommandExec: () => {},
beforeDestroy: () => {},
beforeModeUnload: () => {},
beforeSetMode: () => {},
beforeUndoImage: () => {},
blur: () => {},
change: () => {},
configLoaded: () => {},
contentDirChanged: () => {},
contentDom: () => {},
contentDomInvalidated: () => {},
contentDomUnload: () => {},
customConfigLoaded: () => {},
dataFiltered: () => {},
dataReady: () => {},
destroy: () => {},
dialogHide: () => {},
dialogShow: () => {},
dirChanged: () => {},
doubleclick: () => {},
dragend: () => {},
dragstart: () => {},
drop: () => {},
elementsPathUpdate: () => {},
fileUploadRequest: () => {},
fileUploadResponse: () => {},
floatingSpaceLayout: () => {},
focus: () => {},
getData: () => {},
getSnapshot: () => {},
insertElement: () => {},
insertHtml: () => {},
insertText: () => {},
instanceReady: () => {},
key: () => {},
langLoaded: () => {},
loadSnapshot: () => {},
loaded: () => {},
lockSnapshot: () => {},
maximize: () => {},
menuShow: () => {},
mode: () => {},
notificationHide: () => {},
notificationShow: () => {},
notificationUpdate: () => {},
paste: () => {},
pasteFromWord: () => {},
pluginsLoaded: () => {},
readOnly: () => {},
removeFormatCleanup: () => {},
required: () => {},
resize: () => {},
save: () => {},
saveSnapshot: () => {},
selectionChange: () => {},
setData: () => {},
stylesSet: () => {},
template: () => {},
toDataFormat: () => {},
toHtml: () => {},
unlockSnapshot: () => {},
updateSnapshot: () => {},
widgetDefinition: () => {}
}
});
}
@@ -1151,7 +1147,7 @@ function test_tools() {
var str = CKEDITOR.tools.cssStyleToDomStyle('style');
var prefixes: { [cssClass: string]: string | number } = CKEDITOR.tools.cssVendorPrefix('prop', 'val');
prefixes = CKEDITOR.tools.cssVendorPrefix('prop', 'val', true);
var fn: (param: any) => boolean
var fn: (param: any) => boolean;
fn = CKEDITOR.tools.defer<(param: any) => boolean>(fn);
CKEDITOR.tools.enableHtml5Elements(document);
CKEDITOR.tools.enableHtml5Elements(document.createDocumentFragment(), true);
@@ -1172,7 +1168,7 @@ function test_tools() {
str = CKEDITOR.tools.htmlEncode(str);
str = CKEDITOR.tools.htmlEncodeAttr(str);
numb = CKEDITOR.tools.indexOf<string>(['string', 'array'], 'string');
numb = CKEDITOR.tools.indexOf<boolean>([true, false], (val: boolean) => false);
numb = CKEDITOR.tools.indexOf<boolean>([true, false], (val: boolean) => false);
console.log(CKEDITOR.tools.isArray([1])); // true
console.log(CKEDITOR.tools.isArray(obj)); // false
console.log(CKEDITOR.tools.isArray(null)); // false
@@ -1186,8 +1182,8 @@ function test_tools() {
bool = CKEDITOR.tools.objectCompare(obj, obj);
bool = CKEDITOR.tools.objectCompare(obj, obj, true);
var strArr: string[] = CKEDITOR.tools.objectKeys(obj);
CKEDITOR.tools.override(parseInt, function(_parseInt) {
return function(value: any, radix?: number) {
CKEDITOR.tools.override(parseInt, (_parseInt) => {
return (value: any, radix?: number) => {
return _parseInt(value, radix);
};
});

View File

@@ -6,12 +6,12 @@
// WORK-IN-PROGRESS: Any contribution support welcomed.
// See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/1827 for more informations.
interface Window {
CKEDITOR_BASEPATH: string;
}
declare namespace CKEDITOR {
// Config options
var disableAutoInline: boolean;
var replaceClass: string;
@@ -131,12 +131,11 @@ declare namespace CKEDITOR {
function removeAllListeners(): void;
function removeListener(eventName: string, listenerFunction: (eventInfo: eventInfo) => void): void;
type listenerRegistration = {
interface listenerRegistration {
removeListener: () => void;
}
namespace dom {
interface bookmark {
startNode: dom.node | string;
endNode: dom.node | string;
@@ -210,8 +209,7 @@ declare namespace CKEDITOR {
readonly $: HTMLElement;
readonly type: number;
constructor(element: string, ownerDocument?: document);
constructor(element: HTMLElement, ownerDocument?: document);
constructor(element: string | HTMLElement, ownerDocument?: document);
addClass(className: string): void;
append(node: node | string, toStart?: boolean): node;
appendBogus(force: boolean): void;
@@ -273,8 +271,7 @@ declare namespace CKEDITOR {
removeClass(className: string): void;
removeStyle(name: string): void;
renameNode(newTag: string): void;
scrollIntoParent(parent: element, alignToTop: boolean, hscroll: boolean): void;
scrollIntoParent(parent: window, alignToTop: boolean, hscroll: boolean): void;
scrollIntoParent(parent: element | window, alignToTop: boolean, hscroll: boolean): void;
scrollIntoView(alignToTop?: boolean): void;
setAttribute(name: string, value: string): element;
setAttributes(attributesPairs: { [key: string]: string }): element;
@@ -289,7 +286,7 @@ declare namespace CKEDITOR {
show(): void;
unselectable(): void;
//static method
// static method
static clearAllMarkers(database: any): any;
static clearMarkers(database: any, element: dom.element, removeFromDatabase: boolean): void;
static createFromHtml(html: string): element;
@@ -437,8 +434,8 @@ declare namespace CKEDITOR {
}
interface shrinkOptions {
shrinkOnBlockBoundary?: boolean,
skipBogus?: boolean
shrinkOnBlockBoundary?: boolean;
skipBogus?: boolean;
}
class rangeList {
@@ -449,7 +446,6 @@ declare namespace CKEDITOR {
moveToBookmarks(bookmarks: bookmark[]): void;
}
interface rangeListIterator {
getNextRange(mergeConsequent?: boolean): range;
}
@@ -481,7 +477,7 @@ declare namespace CKEDITOR {
removeAllRanges(): void;
reset(): void;
scrollIntoView(): void;
selectBookmarks(bookmarks: (bookmark | bookmark2)[]): selection;
selectBookmarks(bookmarks: Array<bookmark | bookmark2>): selection;
selectElement(element: element): void;
selectRanges(ranges: range[]): void;
unlock(restore: boolean): void;
@@ -547,14 +543,12 @@ declare namespace CKEDITOR {
}
}
namespace ajax {
function load(url: string, callback?: (data: any) => void): string;
function loadXml(url: string, callback?: (data: any) => void): xml;
function post(url: string, data: any, contentType?: string, callback?: (data: any) => void): void;
}
class command extends event implements commandDefinition {
fakeKeystroke: number;
previousState: number;
@@ -570,7 +564,6 @@ declare namespace CKEDITOR {
refresh(editor: editor, path: dom.elementPath): void;
setState(newState: number): boolean;
toggleState(): void;
}
interface commandDefinition {
@@ -737,7 +730,7 @@ declare namespace CKEDITOR {
jqueryOverrideVal?: boolean;
justifyClasses?: string[];
keystrokes?: [number, string][];
keystrokes?: Array<[number, string]>;
language?: string;
language_list?: string[];
@@ -745,7 +738,7 @@ declare namespace CKEDITOR {
linkShowAdvancedTab?: boolean;
linkShowTargetTab?: boolean;
magicline_color?: string
magicline_color?: string;
magicline_everywhere?: boolean;
magicline_holdDistance?: number;
magicline_keystrokeNext?: number;
@@ -822,7 +815,7 @@ declare namespace CKEDITOR {
smiley_images?: string[];
smiley_path?: string;
sourceAreaTabSize?: number;
specialChars?: (string | [string, string])[];
specialChars?: Array<string | [string, string]>;
startupFocus?: string | boolean;
startupMode?: string;
startupOutlineBlocks?: boolean;
@@ -837,10 +830,10 @@ declare namespace CKEDITOR {
templates_files?: { [key: string]: any };
templates_replaceContent?: boolean;
title?: string | boolean;
toolbar?: string | (string | string[] | { name: string, items?: string[], groups?: string[] })[] | null;
toolbar?: string | Array<string | string[] | { name: string, items?: string[], groups?: string[] }> | null;
toolbarCanCollapse?: boolean;
toolbarGroupCycling?: boolean;
toolbarGroups?: (toolbarGroups | string)[];
toolbarGroups?: Array<toolbarGroups | string>;
toolbarLocation?: string;
toolbarStartupExpanded?: boolean;
@@ -914,9 +907,7 @@ declare namespace CKEDITOR {
}
namespace dialog {
namespace definition {
interface button extends uiElement {
disabled?: boolean;
}
@@ -968,13 +959,13 @@ declare namespace CKEDITOR {
interface radio extends labeledElement {
default?: string;
items?: string[] | (string[])[];
items?: string[] | string[][];
validate?: () => boolean;
}
interface select extends labeledElement {
default?: string;
items?: string[] | (string[])[];
items?: string[] | string[][];
multiple?: boolean;
size?: number;
validate?: () => boolean;
@@ -1172,7 +1163,7 @@ declare namespace CKEDITOR {
setActiveFilter(filter: filter): void;
setData(data: string, options?: { internal?: boolean; callback?: () => void; noSnapshot?: boolean; }): void;
setKeystroke(keystroke: number, behavior: string | boolean): void;
setKeystroke(keystroke: [number, string | boolean][]): void;
setKeystroke(keystroke: Array<[number, string | boolean]>): void;
setMode(newMode: string, callback: () => void): void;
setReadOnly(isReadOnly?: boolean): void;
setUiColor(color: string): void;
@@ -1432,7 +1423,7 @@ declare namespace CKEDITOR {
readonly disabled: boolean;
readonly disallowedContent: any[];
readonly editor: editor;
readonly elementCallbacks: ((element: htmlParser.element) => number)[];
readonly elementCallbacks: Array<(element: htmlParser.element) => number>;
readonly id: number;
static instances: { [id: string]: filter };
@@ -1441,7 +1432,7 @@ declare namespace CKEDITOR {
addContentForms(forms: any[]): void;
addElementCallback(callback: (element: htmlParser.element) => number): void;
addFeature(feature: feature): boolean;
addTransformations(transformations: (string | filter.transformation)[][]): void;
addTransformations(transformations: Array<Array<string | filter.transformation>>): void;
allow(newRules: filter.allowedContentRules, featureName?: string, overrideCustom?: boolean): boolean;
applyTo(fragment: htmlParser.fragment | htmlParser.element, toHrml: boolean, transformOnly: boolean, enterMode: number): boolean;
check(test: filter.contentRule, applyTransformations?: boolean, strictCheck?: boolean): boolean;
@@ -1571,10 +1562,10 @@ declare namespace CKEDITOR {
}
class filterRulesGroup {
rules: { value: rule, priority: number, option: ruleOptions }[];
rules: Array<{ value: rule, priority: number, option: ruleOptions }>;
add(rule: rule, priority: number, options: ruleOptions): void;
addMany(rules: { [key: string]: any }[], priority: number, options: ruleOptions): void;
addMany(rules: Array<{ [key: string]: any }>, priority: number, options: ruleOptions): void;
exec(currentValue: htmlParser.node | htmlParser.fragment | string): htmlParser.node | htmlParser.fragment | string;
execOnName(currentName: string): string;
findIndex(priority: number): number;
@@ -1612,8 +1603,8 @@ declare namespace CKEDITOR {
type rule = ((value: htmlParser.node | htmlParser.fragment | string) => boolean) | [string, string];
interface ruleOptions {
applyToAll?: boolean,
excludeNestedEditable?: boolean
applyToAll?: boolean;
excludeNestedEditable?: boolean;
}
class text extends node {
@@ -1682,7 +1673,6 @@ declare namespace CKEDITOR {
}
namespace plugins {
namespace cloudservices {
class cloudServicesLoader extends fileTools.fileLoader {
customToken: string;
@@ -1778,7 +1768,7 @@ declare namespace CKEDITOR {
highlighter: (code: string, lang: string, callback: (highlightedCode: string) => void) => void;
init: (ready: () => void) => void;
languages: { [lang: string]: string };
readonly queue: ((code: string, lang: string, callback: (highlightedCode: string) => void) => void)[];
readonly queue: Array<(code: string, lang: string, callback: (highlightedCode: string) => void) => void>;
readonly ready: boolean;
highlight(code: string, lang: string, callback: (highlightedCode: string) => void): void;
@@ -1809,9 +1799,7 @@ declare namespace CKEDITOR {
}
}
namespace easyimage {
}
namespace easyimage {}
namespace embedBase {
function createWidgetBaseDefinition(editor: editor): baseDefinition;
@@ -1856,9 +1844,7 @@ declare namespace CKEDITOR {
class progressBar extends progressReporter {
bar: dom.element;
constructor();
}
class progressReporter {
@@ -1922,7 +1908,7 @@ declare namespace CKEDITOR {
const synAnchorSelector: boolean;
function getEditorAnchors(editor: editor): dom.element[];
function getLinkAttributes(editor: editor, data: { [key: string]: any }): { set: { [key: string]: string }, removed: string[] }
function getLinkAttributes(editor: editor, data: { [key: string]: any }): { set: { [key: string]: string }, removed: string[] };
function getSelectedLink(editor: editor, returnMultiple?: boolean): dom.element | dom.element[];
function parseLinkAttributes(editor: editor, element: dom.element): { [key: string]: any };
function showDisplayTextForElement(element: dom.element, editor: editor): boolean;
@@ -2057,7 +2043,6 @@ declare namespace CKEDITOR {
setData(data: string): void;
}
interface definition extends feature {
button?: string;
data?: (evt: eventInfo) => void;
@@ -2100,8 +2085,7 @@ declare namespace CKEDITOR {
destroyAll(offline?: boolean): void;
finalizeCreation(container: any): void;
getByElement(element: any, checkWrapperOnly: boolean): plugins.widget;
initOn(element: dom.element, widgetDef?: plugins.widget.definition, startupData?: { [key: string]: any }): plugins.widget;
initOn(element: dom.element, widgetDef?: string, startupData?: { [key: string]: any }): plugins.widget;
initOn(element: dom.element, widgetDef?: string | plugins.widget.definition, startupData?: { [key: string]: any }): plugins.widget;
initOnAll(container?: dom.element): plugins.widget[];
parseElementClasses(classes: string): any;
wrapElement(element: any, widgetName?: string): any;
@@ -2118,7 +2102,7 @@ declare namespace CKEDITOR {
readonly definition: plugins.widget.definition;
readonly editor: editor;
readonly element: dom.element;
readonly focusedEditable: plugins.widget.nestedEditable
readonly focusedEditable: plugins.widget.nestedEditable;
readonly id: number;
readonly inited: boolean;
readonly ready: boolean;
@@ -2147,8 +2131,7 @@ declare namespace CKEDITOR {
updateDragHandlerPosition(): void;
}
function add(name: string, definition: pluginDefinition): void;
function add(name: string): void;
function add(name: string, definition?: pluginDefinition): void;
function addExternal(name: string, path: string, fileName?: string): void;
function get(name: string): any;
function getFilePath(name: string): string;
@@ -2182,6 +2165,7 @@ declare namespace CKEDITOR {
namespace skin {
var icons: { [name: string]: { path: string } };
// tslint:disable-next-line:no-duplicate-variable
var name: string;
var ua: { [name: string]: any };
@@ -2209,11 +2193,11 @@ declare namespace CKEDITOR {
}
interface definition {
attributes?: { [att: string]: string },
element: string,
name?: string,
styles?: { [att: string]: string },
type?: string | number
attributes?: { [att: string]: string };
element: string;
name?: string;
styles?: { [att: string]: string };
type?: string | number;
}
interface customHandler {
@@ -2414,13 +2398,13 @@ declare namespace CKEDITOR {
interface radio {
default: any;
validate?: () => boolean;
items: ([string, string] | [string])[];
items: Array<[string, string] | [string]>;
}
interface select {
default: any;
validate?: () => boolean;
items: ([string, string] | [string])[];
items: Array<[string, string] | [string]>;
multiple?: boolean;
size?: number;
}
@@ -2462,7 +2446,6 @@ declare namespace CKEDITOR {
constructor(dialog: dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: definitions.fieldSet);
}
class file extends ui.dialog.labeledElement {
constructor(dialog: dialog, elementDefinition: definitions.file, htmlList: any[]);
@@ -2473,12 +2456,10 @@ declare namespace CKEDITOR {
submit(): file;
}
class fileButton extends button {
constructor(dialog: dialog, elementDefinition: definitions.fileButton, htmlList: any[]);
}
class hbox extends uiElement {
constructor(dialog: dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: definitions.hbox);
@@ -2486,17 +2467,11 @@ declare namespace CKEDITOR {
getChild(indices: number[]): ui.dialog.uiElement[];
}
class html extends uiElement {
constructor(dialog: dialog, elementDefinition: definitions.html, htmlList: any[]);
}
class iframeElement extends uiElement {
}
class iframeElement extends uiElement {}
class labeledElement extends uiElement {
constructor(dialog: dialog, elementDefinition: definitions.labeledElement, htmlList: any[], contentHtml: () => string);
@@ -2505,7 +2480,6 @@ declare namespace CKEDITOR {
setlabel(label: string): ui.dialog.labeledElement;
}
class radio extends ui.dialog.labeledElement {
constructor(dialog: dialog, elementDefinition: definitions.radio, htmlList: any[]);
@@ -2514,7 +2488,6 @@ declare namespace CKEDITOR {
setValue(value: string, noChangeEvent: boolean): undefined;
}
class select extends uiElement {
constructor(dialog: dialog, elementDefinition: definitions.select, htmlList: any[]);
@@ -2523,12 +2496,10 @@ declare namespace CKEDITOR {
remove(index: number): select;
}
class textarea extends labeledElement {
constructor(dialog: dialog, elementDefinition: definitions.textarea, htmlList: any[]);
}
class textInput extends ui.dialog.labeledElement {
constructor(dialog: dialog, elementDefinition: definitions.textInput, htmlList: any[]);
@@ -2544,7 +2515,16 @@ declare namespace CKEDITOR {
class uiElement {
eventProcessors: any;
constructor(dialog: dialog, elementDefinition: definitions.uiElement, htmlList: any[], nodeNameArg?: () => string | string, stylesArg?: () => { [key: string]: any } | { [key: string]: any }, attributesArg?: () => { [key: string]: any } | { [key: string]: any }, contentsArg?: () => { [key: string]: any } | string); // Not sure that the htmlList array type is right.
// Not sure that the htmlList array type is right.
constructor(
dialog: dialog,
elementDefinition: definitions.uiElement,
htmlList: any[],
nodeNameArg?: () => string | string,
stylesArg?: () => { [key: string]: any } | { [key: string]: any },
attributesArg?: () => { [key: string]: any } | { [key: string]: any },
contentsArg?: () => { [key: string]: any } | string
);
accessKeyDown(dialog: dialog, key: string): void;
accessKeyUp(dialog: dialog, key: string): void;
@@ -2692,9 +2672,7 @@ declare namespace CKEDITOR {
create(definition: { [key: string]: any }): T;
}
class menuButton extends button {
}
class menuButton extends button {}
class panel {
constructor(document: dom.document, definition: { [key: string]: any });
@@ -2713,9 +2691,7 @@ declare namespace CKEDITOR {
const handler: handlerDefinition<panel>;
}
class panelButton extends button {
}
class panelButton extends button {}
class richCombo {
static readonly handler: handlerDefinition<richCombo>;
@@ -2753,11 +2729,11 @@ declare namespace CKEDITOR {
}
interface IMenuItemDefinition {
label: string,
command: string,
icon: string
group: string,
order: number
label: string;
command: string;
icon: string;
group: string;
order: number;
}
interface buttonDefinition {

View File

@@ -6,7 +6,7 @@
"dom"
],
"noImplicitAny": true,
"noImplicitThis": false,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",

View File

@@ -1,79 +1,14 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"prefer-const": false
}
}

View File

@@ -1,14 +1,12 @@
function test_CKEDITOR() {
CKEDITOR.basePath = 'test';
CKEDITOR.replaceClass = 'rich_editor';
CKEDITOR.skinName = 'moono';
CKEDITOR.skinName = 'myskin,/customstuff/myskin/';
var editor = new CKEDITOR.editor();
if (editor.getSelection().getType() == CKEDITOR.SELECTION_ELEMENT)
if (editor.getSelection().getType() == CKEDITOR.SELECTION_NONE)
if (editor.getSelection().getType() == CKEDITOR.SELECTION_TEXT)
if (editor.getSelection().getType() === CKEDITOR.SELECTION_ELEMENT)
if (editor.getSelection().getType() === CKEDITOR.SELECTION_NONE)
if (editor.getSelection().getType() === CKEDITOR.SELECTION_TEXT)
alert(CKEDITOR.basePath);
if (CKEDITOR.currentInstance)
alert(CKEDITOR.currentInstance.name);
@@ -17,7 +15,7 @@ function test_CKEDITOR() {
CKEDITOR.loadFullCoreTimeout = 5;
alert(CKEDITOR.revision);
alert(CKEDITOR.rnd);
if (CKEDITOR.status == 'loaded') {
if (CKEDITOR.status === 'loaded') {
CKEDITOR.loadFullCore();
}
alert(CKEDITOR.timestamp);
@@ -38,7 +36,7 @@ function test_CKEDITOR() {
}
function test_CKEDITOR_events() {
CKEDITOR.on('instanceCreated', function(event) {
CKEDITOR.on('instanceCreated', (event) => {
// $ExpectType editor
event.editor;
});
@@ -75,7 +73,7 @@ function test_config() {
{ name: 'styles', groups: [ 'styles' ] },
{ name: 'colors', groups: [ 'colors' ] },
],
}
};
}
function test_dom_comment() {
@@ -115,7 +113,7 @@ function test_dom_domObject() {
var nativeElement = element.$;
var doc = new CKEDITOR.dom.document(document);
alert(doc.equals(CKEDITOR.document));
alert(doc == CKEDITOR.document);
alert(doc === CKEDITOR.document);
var element2 = new CKEDITOR.dom.element('span');
alert(element.getCustomData('hasCustomData'));
alert(element.getCustomData('nonExistingKey'));
@@ -136,7 +134,7 @@ function test_dom_element() {
var strong = new CKEDITOR.dom.element('strong');
p.append(strong);
var em = p.append('em');
var p = new CKEDITOR.dom.element('p');
p = new CKEDITOR.dom.element('p');
p.appendText('This is');
p.appendText(' some text');
element.breakParent(strong);
@@ -147,7 +145,7 @@ function test_dom_element() {
element.focus();
element.focusNext();
element.focusPrevious();
element.forEach(node=> {
element.forEach(node => {
console.log(node);
});
var element2 = CKEDITOR.dom.element.createFromHtml('<input type="text" />');
@@ -159,7 +157,7 @@ function test_dom_element() {
alert(element.getHtml());
alert(element.getId());
alert(element.getName());
alert('<b>' + element.getNameAtt() + '</b>');
alert(`<b>${element.getNameAtt()}</b>`);
alert(element.getOuterHtml());
alert(element.getTabIndex());
alert(element.getText());
@@ -180,7 +178,7 @@ function test_dom_element() {
element.setAttribute('class', 'myClass');
element.setAttribute('title', 'This is an example');
element.setAttributes({
'class': 'myClass',
class: 'myClass',
title: 'This is an example'
});
p.setHtml('<b>Inner</b> HTML');
@@ -196,7 +194,7 @@ function test_dom_element() {
element.show();
element.unselectable();
alert(element.getName());
alert(element == CKEDITOR.dom.element.get(element));
alert(element === CKEDITOR.dom.element.get(element));
var htmlElement = document.getElementById('myElement');
alert(CKEDITOR.dom.element.get(htmlElement).getName());
}
@@ -204,20 +202,20 @@ function test_dom_element() {
function test_dom_event() {
var event = new CKEDITOR.dom.event(new Event(""));
alert(event.getKey());
alert(event.getKeystroke() == 65);
alert(event.getKeystroke() == CKEDITOR.CTRL + 65);
alert(event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
alert(event.getKeystroke() === 65);
alert(event.getKeystroke() === CKEDITOR.CTRL + 65);
alert(event.getKeystroke() === CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
var element = new CKEDITOR.dom.element('div');
element.on('mousemouse', ev=> {
element.on('mousemouse', ev => {
var pageOffset = ev.data.getPageOffset();
alert(pageOffset.x);
alert(pageOffset.y);
});
element.on('click', ev=> {
element.on('click', ev => {
var domEvent = ev.data;
domEvent.getTarget().addClass('clicked');
});
element.on('click', ev=> {
element.on('click', ev => {
var domEvent = ev.data as CKEDITOR.dom.event;
domEvent.preventDefault();
});
@@ -298,14 +296,14 @@ function test_adding_command_and_buttons() {
var textarea = document.createElement('textarea');
var instance = CKEDITOR.replace(textarea);
instance.addCommand( 'aCommand', {
exec: function( editor: CKEDITOR.editor ) {
instance.addCommand('aCommand', {
exec: (editor: CKEDITOR.editor) => {
// empty logic
return true;
}
});
instance.ui.addButton( 'firstButton', {
instance.ui.addButton('firstButton', {
icon: 'http://www.example.com/assets/images/icons.png',
iconOffset: -32,
label: 'Label 1',
@@ -313,7 +311,7 @@ function test_adding_command_and_buttons() {
toolbar: 'tools'
});
instance.ui.addButton( 'secondButton', {
instance.ui.addButton('secondButton', {
label: 'Label 2',
command: 'aCommand',
toolbar: 'tools'
@@ -321,11 +319,11 @@ function test_adding_command_and_buttons() {
}
function test_adding_dialog_by_path() {
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
CKEDITOR.dialog.add('abbrDialog', 'PATH/dialogs/abbr.js');
}
function test_adding_dialog_by_definition() {
CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) {
CKEDITOR.dialog.add('abbrDialog', (editor: CKEDITOR.editor) => {
return {
title: 'Abbreviation Properties',
minWidth: 400,
@@ -339,7 +337,7 @@ function test_adding_dialog_by_definition() {
{
id: 'tab-basic',
label: 'Basic Settings',
elements: <any[]>[]
elements: <any[]> []
},
{
id: 'tab-adv',
@@ -352,8 +350,8 @@ function test_adding_dialog_by_definition() {
}
function test_plugins() {
CKEDITOR.plugins.add( 'abbr', {
init: function( editor: CKEDITOR.editor ) {
CKEDITOR.plugins.add('abbr', {
init: (editor: CKEDITOR.editor) => {
// empty logic
}
});
@@ -367,7 +365,7 @@ function test_adding_widget() {
button: "Activate widgetty",
template: "<imaginary-element>",
dialog: "widgetty",
init: function() {
init: () => {
// no logic
}
});
@@ -442,80 +440,80 @@ function test_editor_instance_event() {
var textarea = document.createElement('textarea');
var instance = CKEDITOR.replace(textarea, {
on: {
activeEnterModeChange: function() {},
activeFilterChange: function() {},
afterCommandExec: function() {},
afterInsertHtml: function() {},
afterPaste: function() {},
afterPasteFromWord: function() {},
afterSetData: function() {},
afterUndoImage: function() {},
ariaEditorHelpLabel: function() {},
ariaWidget: function() {},
autogrow: function() {},
beforeCommandExec: function() {},
beforeDestroy: function() {},
beforeModeUnload: function() {},
beforeSetMode: function() {},
beforeUndoImage: function() {},
blur: function() {},
change: function() {},
configLoaded: function() {},
contentDirChanged: function() {},
contentDom: function() {},
contentDomInvalidated: function() {},
contentDomUnload: function() {},
customConfigLoaded: function() {},
dataFiltered: function() {},
dataReady: function() {},
destroy: function() {},
dialogHide: function() {},
dialogShow: function() {},
dirChanged: function() {},
doubleclick: function() {},
dragend: function() {},
dragstart: function() {},
drop: function() {},
elementsPathUpdate: function() {},
fileUploadRequest: function() {},
fileUploadResponse: function() {},
floatingSpaceLayout: function() {},
focus: function() {},
getData: function() {},
getSnapshot: function() {},
insertElement: function() {},
insertHtml: function() {},
insertText: function() {},
instanceReady: function() {},
key: function() {},
langLoaded: function() {},
loadSnapshot: function() {},
loaded: function() {},
lockSnapshot: function() {},
maximize: function() {},
menuShow: function() {},
mode: function() {},
notificationHide: function() {},
notificationShow: function() {},
notificationUpdate: function() {},
paste: function() {},
pasteFromWord: function() {},
pluginsLoaded: function() {},
readOnly: function() {},
removeFormatCleanup: function() {},
required: function() {},
resize: function() {},
save: function() {},
saveSnapshot: function() {},
selectionChange: function() {},
setData: function() {},
stylesSet: function() {},
template: function() {},
toDataFormat: function() {},
toHtml: function() {},
unlockSnapshot: function() {},
updateSnapshot: function() {},
widgetDefinition: function() {}
activeEnterModeChange: () => {},
activeFilterChange: () => {},
afterCommandExec: () => {},
afterInsertHtml: () => {},
afterPaste: () => {},
afterPasteFromWord: () => {},
afterSetData: () => {},
afterUndoImage: () => {},
ariaEditorHelpLabel: () => {},
ariaWidget: () => {},
autogrow: () => {},
beforeCommandExec: () => {},
beforeDestroy: () => {},
beforeModeUnload: () => {},
beforeSetMode: () => {},
beforeUndoImage: () => {},
blur: () => {},
change: () => {},
configLoaded: () => {},
contentDirChanged: () => {},
contentDom: () => {},
contentDomInvalidated: () => {},
contentDomUnload: () => {},
customConfigLoaded: () => {},
dataFiltered: () => {},
dataReady: () => {},
destroy: () => {},
dialogHide: () => {},
dialogShow: () => {},
dirChanged: () => {},
doubleclick: () => {},
dragend: () => {},
dragstart: () => {},
drop: () => {},
elementsPathUpdate: () => {},
fileUploadRequest: () => {},
fileUploadResponse: () => {},
floatingSpaceLayout: () => {},
focus: () => {},
getData: () => {},
getSnapshot: () => {},
insertElement: () => {},
insertHtml: () => {},
insertText: () => {},
instanceReady: () => {},
key: () => {},
langLoaded: () => {},
loadSnapshot: () => {},
loaded: () => {},
lockSnapshot: () => {},
maximize: () => {},
menuShow: () => {},
mode: () => {},
notificationHide: () => {},
notificationShow: () => {},
notificationUpdate: () => {},
paste: () => {},
pasteFromWord: () => {},
pluginsLoaded: () => {},
readOnly: () => {},
removeFormatCleanup: () => {},
required: () => {},
resize: () => {},
save: () => {},
saveSnapshot: () => {},
selectionChange: () => {},
setData: () => {},
stylesSet: () => {},
template: () => {},
toDataFormat: () => {},
toHtml: () => {},
unlockSnapshot: () => {},
updateSnapshot: () => {},
widgetDefinition: () => {}
}
});
}
@@ -580,8 +578,8 @@ function test_tools() {
console.log(CKEDITOR.tools.isArray(null)); // false
console.log(CKEDITOR.tools.isArray(undefined)); // false
CKEDITOR.tools.override(parseInt, function(_parseInt) {
return function(value: any, radix?: number) {
CKEDITOR.tools.override(parseInt, (_parseInt) => {
return (value: any, radix?: number) => {
return _parseInt(value, radix);
};
});
@@ -590,9 +588,9 @@ function test_tools() {
function test_htmlParser() {
var html = '<div><span>text</span></div>';
var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html);
fragment.forEach(function(node) {
fragment.forEach((node) => {
if (node instanceof CKEDITOR.htmlParser.element) {
node.forEach(function(node) {
node.forEach((node) => {
console.log(node);
});
}

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@
"dom"
],
"noImplicitAny": true,
"noImplicitThis": false,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../../",

View File

@@ -1,79 +1,14 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"prefer-const": false
}
}

View File

@@ -115,7 +115,7 @@ b = Number.isSafeInteger(i);
i = Number.MAX_SAFE_INTEGER;
i = Number.MIN_SAFE_INTEGER;
i = Number.parseFloat(s);
i = Number.parseInt(s);
i = Number.parseInt(s); // tslint:disable-line radix
i = Number.parseInt(s, i);
i = Math.clz32(i);
i = Math.imul(i, i);

View File

@@ -9,13 +9,12 @@ office-js
Copyright (c) Microsoft Corporation
*/
////////////////////////////////////////////////////////////////
//////////////////// Begin custom-functions-runtime ////////////
////////////////////////////////////////////////////////////////
/*
* Enables you to map your own name that uses lowercase letters to a function.
/*
* Enables you to map your own name that uses lowercase letters to a function.
*/
declare let CustomFunctionMappings: { [key: string]: Function };
@@ -37,7 +36,6 @@ declare namespace CustomFunctions {
}
}
////////////////////////////////////////////////////////////////
//////////////////// End custom-functions-runtime ////////////
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////

View File

@@ -7,7 +7,7 @@
*/
import * as d3Drag from 'd3-drag';
import { event, select, Selection } from 'd3-selection';
import { ArrayLike, event, select, Selection } from 'd3-selection';
// NB: Consider alternative approach to getting live event-binding
// when using webpack as suggested by @ocombe in response to
@@ -62,7 +62,7 @@ circleCustomDrag = d3Drag.drag<SVGCircleElement, CircleDatum, CustomSubject | d3
// set and get container element/accessor ----------------------------
let containerAccessor: (this: SVGCircleElement, d: CircleDatum, i: number, group: SVGCircleElement[] | NodeListOf<SVGCircleElement>) => d3Drag.DragContainerElement;
let containerAccessor: (this: SVGCircleElement, d: CircleDatum, i: number, group: SVGCircleElement[] | ArrayLike<SVGCircleElement>) => d3Drag.DragContainerElement;
containerAccessor = function(d, i, group) {
console.log('Node Id of circle: ', d.nodeId);
@@ -123,7 +123,7 @@ circleDrag = circleDrag.touchable(true);
circleDrag = circleDrag.touchable(function(d, i, group) {
const that: SVGCircleElement = this;
const datum: CircleDatum = d;
const g: SVGCircleElement[] | NodeListOf<SVGCircleElement> = group;
const g: SVGCircleElement[] | ArrayLike<SVGCircleElement> = group;
return "ontouchstart" in this && datum.color === 'green';
});

View File

@@ -8,209 +8,95 @@
import * as d3Hexbin from 'd3-hexbin';
// ----------------------------------------------------------------------------
// Preparatory Steps
// ----------------------------------------------------------------------------
interface Point {
x0: number;
y0: number;
x: number;
y: number;
}
{
// d3.hexbin() has the expected defaults
const b = d3Hexbin.hexbin();
const extent = b.extent(); // [[0, 0], [1, 1]]
extent.map((x: any, y: any) => { });
b.x()([41, 42]); // === 41;
b.y()([41, 42]); // === 42;
b.radius(); // === 1;
let num: number;
let str: string;
let centers: Array<[number, number]>;
let extent: [[number, number], [number, number]];
let size: [number, number];
// hexbin(points) bins the specified points into hexagonal bins
const bins = d3Hexbin.hexbin()([
[0, 0], [0, 1], [0, 2],
[1, 0], [1, 1], [1, 2],
[2, 0], [2, 1], [2, 2]
]);
let hexbin: d3Hexbin.Hexbin<[number, number]>;
let hexbinBins: Array<d3Hexbin.HexbinBin<[number, number]>>;
const data: Array<[number, number]> = [[10, 20], [30, 10]];
bins.map((bin: any) => {});
}
let pointHexbin: d3Hexbin.Hexbin<Point>;
let pointHexbinBins: Array<d3Hexbin.HexbinBin<Point>>;
const pointData: Point[] = [{x: 10, y: 20}, {x: 30, y: 10}];
{
// hexbin(points) observes the current x- and y-accessors
const x = (d: any) => d.x;
const y = (d: any) => d.y;
const bins = d3Hexbin.hexbin<Point>().x(x).y(y)([
{x0: 0, y0: 0}, {x0: 0, y0: 1}, {x0: 0, y0: 2},
{x0: 1, y0: 0}, {x0: 1, y0: 1}, {x0: 1, y0: 2},
{x0: 2, y0: 0}, {x0: 2, y0: 1}, {x0: 2, y0: 2}
]);
bins.map((bin: any) => {});
}
let pointAccessor: (d: Point) => number;
{
// hexbin(points) observes the current radius
const bins = d3Hexbin.hexbin().radius(2)([
[0, 0], [0, 1], [0, 2],
[1, 0], [1, 1], [1, 2],
[2, 0], [2, 1], [2, 2]
]);
bins.map((bin: any) => {});
}
// ----------------------------------------------------------------------------
// Hexbin
// ----------------------------------------------------------------------------
{
interface PointX {
x: number;
[key: number]: number;
}
// Create Hexbin ==============================================================
// hexbin.x(x) sets the x-coordinate accessor
const x = (d: PointX) => d.x;
const b = d3Hexbin.hexbin<PointX>().x(x);
const bins = b([{x: 1, 1: 2}]);
// with default data type [number, number] ------------------------------------
b.x(); // should be x;
bins.length; // should be 1;
bins[0].x; // should be 0.8660254037844386;
bins[0].y; // should be 1.5;
bins[0].length; // should be 1;
}
hexbin = d3Hexbin.hexbin();
{
interface PointY {
y: number;
[key: number]: number;
}
// hexbin.y(y) sets the y-coordinate accessor
const y = (d: PointY) => d.y;
const b = d3Hexbin.hexbin<PointY>().y(y);
const bins = b([{0: 1, y: 2}]);
// with custom data type ------------------------------------------------------
bins.length; // should be 1;
bins[0].x; // should be 0.8660254037844386;
bins[0].y; // should be 1.5;
bins[0].length; // should be 1;
}
pointHexbin = d3Hexbin.hexbin<Point>();
{
// hexbin.hexagon() returns the expected path
const path: string = d3Hexbin.hexbin().hexagon();
}
// Configure Hexbin ===========================================================
{
// hexbin.hexagon() observes the current bin radius
const path: string = d3Hexbin.hexbin().radius(2).hexagon();
}
// x(...) ---------------------------------------------------------------------
{
// hexbin.hexagon(radius) observes the specified radius
const path: string = d3Hexbin.hexbin().hexagon(2);
}
pointHexbin = pointHexbin.x(d => d.x);
{
// hexbin.hexagon(radius) uses the current bin radius if radius is undefined
let path: string = d3Hexbin.hexbin().hexagon();
path = d3Hexbin.hexbin().hexagon(undefined);
}
pointAccessor = pointHexbin.x();
{
// hexbin.centers() returns an array of bin centers
const centers = d3Hexbin.hexbin().centers();
centers.map((x: any, y: any) => { });
}
// y(...) ---------------------------------------------------------------------
{
// hexbin.centers() observes the current bin radius
const centers = d3Hexbin.hexbin().radius(0.5).centers();
centers.map((x: any, y: any) => { });
}
pointHexbin = pointHexbin.y(d => d.y);
{
// hexbin.centers() observes the current extent
const centers = d3Hexbin.hexbin().radius(0.5)
.extent([[-1.1, -1.1], [1.1, 1.1]])
.centers();
centers.map((x, y) => { });
}
pointAccessor = pointHexbin.x();
{
// hexbin.mesh() returns the expected path
const path: string = d3Hexbin.hexbin().mesh();
}
// hexagon(...) ---------------------------------------------------------------
{
// hexbin.mesh() observes the bin radius
const path: string = d3Hexbin.hexbin().radius(0.5).mesh();
}
str = hexbin.hexagon();
{
// hexbin.mesh() observes the extent
const path: string = d3Hexbin.hexbin().radius(0.5)
.extent([[-1.1, -1.1], [1.1, 1.1]])
.mesh();
}
// centers(...) ---------------------------------------------------------------
{
// hexbin.size()
let size: [number, number] = [100, 100];
d3Hexbin.hexbin().size(size);
size = d3Hexbin.hexbin().size();
}
centers = hexbin.centers();
{
let hb: d3Hexbin.Hexbin<Point>;
let bins: Array<d3Hexbin.HexbinBin<Point>>;
// mesh(...) ------------------------------------------------------------------
// Create generator =======================================
str = hexbin.mesh();
hb = d3Hexbin.hexbin<Point>();
// radius(...) ----------------------------------------------------------------
// Configure generator =====================================
hexbin = hexbin.radius(20);
// x Accessor ----------------------------------------------
num = hexbin.radius();
let x: (d: Point) => number;
x = (d: Point) => d.x0;
// extent(...) ----------------------------------------------------------------
// test setter
hb = hb.x(x);
hexbin = hexbin.extent([[0, 0], [1, 1]]);
// test getter
x = hb.x();
extent = hexbin.extent();
// y Accessor ----------------------------------------------
// size(...) ------------------------------------------------------------------
let y: (d: Point) => number;
y = (d: Point) => d.y0;
hexbin = hexbin.size([1, 1]);
// test setter
hb = hb.y(y);
size = hexbin.size();
// test getter
y = hb.y();
// Use Hexbin =================================================================
// Use generator ============================================
hexbinBins = hexbin(data);
num = hexbinBins[0].x;
num = hexbinBins[0].y;
bins = hb([
{ x0: 0, y0: 0 }, { x0: 0, y0: 1 }, { x0: 0, y0: 2 },
{ x0: 1, y0: 0 }, { x0: 1, y0: 1 }, { x0: 1, y0: 2 },
{ x0: 2, y0: 0 }, { x0: 2, y0: 1 }, { x0: 2, y0: 2 }
]);
interface RemappedBin {
binCoordinates: [number, number];
points: Point[];
}
let remappedBins: RemappedBin[];
remappedBins = bins.map(bin => {
const x: number = bin.x; // x-coordinate of bin
const y: number = bin.y; // y-coordinate of bin
const pointsInBin: Point[] = bin.map(p => {
const point: Point = p;
return point;
});
const remapped: RemappedBin = {
binCoordinates: [x, y],
points: pointsInBin
};
return remapped;
});
}
pointHexbinBins = pointHexbin(pointData);
num = pointHexbinBins[0].x;
num = pointHexbinBins[0].y;

View File

@@ -157,7 +157,7 @@ testDatum = quadtree.find(20, 30);
// with radius
testDatum = quadtree.find(20, 30, 10);
// visit() --------------------------------------------------------------------
// visit() -------------------------------------------------------------------
quadtree = quadtree.visit((node, x0, y0, x1, y1) => {
let bound: number;
@@ -199,7 +199,7 @@ quadtree = quadtree.visit((node, x0, y0, x1, y1) => {
return 10; // fails wrong return type
});
// visitAfter() ---------------------------------------------------------------
// visitAfter() --------------------------------------------------------------
quadtree = quadtree.visitAfter((node, x0, y0, x1, y1) => {
let bound: number;
@@ -218,7 +218,7 @@ quadtree = quadtree.visitAfter((node, x0, y0, x1, y1) => {
}
});
// Test QuadtreeLeaf =========================================================
// Test QuadtreeLeaf =========================================================
declare const leaf: d3Quadtree.QuadtreeLeaf<TestDatum>;
let nextLeaf: d3Quadtree.QuadtreeLeaf<TestDatum> | undefined;
@@ -227,7 +227,7 @@ testDatum = leaf.data;
nextLeaf = leaf.next ? leaf.next : undefined;
// Test QuadtreeInternalNode =================================================
// Test QuadtreeInternalNode =================================================
declare const internalNode: d3Quadtree.QuadtreeInternalNode<TestDatum>;
let quadNode: d3Quadtree.QuadtreeInternalNode<TestDatum> | d3Quadtree.QuadtreeLeaf<TestDatum> | undefined;

View File

@@ -350,7 +350,7 @@ let csvRequest: d3Request.DsvRequest = d3Request.csv(url);
// url and callback for response handling
const csvRequestWithCallback: d3Request.DsvRequest = d3Request.csv(url, function(error, data) {
const that: d3Request.Request = this;
const that: d3Request.DsvRequest = this;
const err: any = error;
const d: DSVParsedArray<DSVRowString> = data;
console.log(d);
@@ -369,7 +369,7 @@ const csvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.csv<Respon
return mappedRow;
},
function(error, data) {
const that: d3Request.Request = this;
const that: d3Request.DsvRequest = this;
const err: any = error;
const d: DSVParsedArray<ResponseDatumGET> = data;
console.log(data);
@@ -384,7 +384,7 @@ const tsvRequest: d3Request.DsvRequest = d3Request.tsv(url);
// url and callback for response handling
const tsvRequestWithCallback: d3Request.DsvRequest = d3Request.tsv(url, function(error, data) {
const that: d3Request.Request = this;
const that: d3Request.DsvRequest = this;
const err: any = error;
const d: DSVParsedArray<DSVRowString> = data;
console.log(d);
@@ -403,7 +403,7 @@ const tsvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.tsv<Respon
return mappedRow;
},
function(error, data) {
const that: d3Request.Request = this;
const that: d3Request.DsvRequest = this;
const err: any = error;
const d: DSVParsedArray<ResponseDatumGET> = data;
console.log(data);

View File

@@ -8,7 +8,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"

View File

@@ -125,9 +125,21 @@ colorInterpolator = d3ScaleChromatic.interpolateMagma;
colorInterpolator = d3ScaleChromatic.interpolateInferno;
colorInterpolator = d3ScaleChromatic.interpolatePlasma;
colorInterpolator = d3ScaleChromatic.interpolateRainbow;
colorInterpolator = d3ScaleChromatic.interpolateSinebow;
colorInterpolator = d3ScaleChromatic.interpolateWarm;
colorInterpolator = d3ScaleChromatic.interpolateCool;
colorInterpolator = d3ScaleChromatic.interpolateCubehelixDefault;
const Viridis: string = d3ScaleChromatic.interpolateViridis(0.7);
const Magma: string = d3ScaleChromatic.interpolateMagma(0.7);
const Inferno: string = d3ScaleChromatic.interpolateInferno(0.7);
const Plasma: string = d3ScaleChromatic.interpolatePlasma(0.7);
const Rainbow: string = d3ScaleChromatic.interpolateRainbow(0.7);
const Sinebow: string = d3ScaleChromatic.interpolateSinebow(0.7);
const Warm: string = d3ScaleChromatic.interpolateWarm(0.7);
const Cool: string = d3ScaleChromatic.interpolateCool(0.7);
const CubehelixDefault: string = d3ScaleChromatic.interpolateCubehelixDefault(0.7);
colorInterpolator = d3ScaleChromatic.interpolateBuGn;
colorInterpolator = d3ScaleChromatic.interpolateBuPu;
colorInterpolator = d3ScaleChromatic.interpolateGnBu;

View File

@@ -1,4 +1,4 @@
// Type definitions for D3JS d3-scale-chromatic module 1.2
// Type definitions for D3JS d3-scale-chromatic module 1.3
// Project: https://github.com/d3/d3-scale-chromatic/
// Definitions by: Hugues Stefanski <https://github.com/Ledragon>,
// Alex Ford <https://github.com/gustavderdrache>,
@@ -6,7 +6,7 @@
// Henrique Machado <https://github.com/henriquefm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.2.0
// Last module patch version validated against: 1.3.2
// -----------------------------------------------------------------------
// Categorical
@@ -322,6 +322,13 @@ export function interpolateCool(t: number): string;
*/
export function interpolateRainbow(t: number): string;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “sinebow” color scheme by Jim Bumgardner and Charlie Loyd.
*
* @param t A number in the interval [0, 1].
*/
export function interpolateSinebow(t: number): string;
/**
* Given a number t in the range [0,1], returns the corresponding color from Greens default Cubehelix represented as an RGB string.
*

View File

@@ -1,6 +1,9 @@
// Type definitions for D3JS d3-time module 1.0
// Project: https://github.com/d3/d3-time/
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>
// Alex Ford <https://github.com/gustavderdrache>
// Boris Yankov <https://github.com/borisyankov>
// denisname <https://github.com/denisname>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.0.7
@@ -134,7 +137,7 @@ export interface CountableTimeInterval extends TimeInterval {
* because its purpose is to return the zero-based number of the specified end date relative to the specified start date.
*
* @param start A start date object.
* @param start An end date object.
* @param end An end date object.
*/
count(start: Date, end: Date): number;
/**

View File

@@ -1,6 +1,9 @@
// Type definitions for d3JS d3-timer module 1.0
// Project: https://github.com/d3/d3-timer/
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>
// Alex Ford <https://github.com/gustavderdrache>
// Boris Yankov <https://github.com/borisyankov>
// denisname <https://github.com/denisname>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.0.7

View File

@@ -16,4 +16,5 @@ graph.transition = (selection: d3.Selection<any>) => {
const render = new dagreD3.render();
const svg = d3.select("svg");
render.arrows()["arrowType"] = (parent: d3.Selection<any>, id: string, edge: dagre.Edge, type: string) => {};
render.shapes()["shapeName"] = (parent: d3.Selection<any>, bbox: any, node: dagre.Node) => {};
render(svg, graph);

View File

@@ -11,6 +11,7 @@ export as namespace dagreD3;
export * from "dagre";
export const render: { new(): Render };
export const intersect: { [shapeName: string]: (node: dagre.Node, points: Array<{}>, point: any) => void };
declare module "dagre" {
namespace graphlib {
@@ -32,4 +33,5 @@ export interface Render {
// see http://cpettitt.github.io/project/dagre-d3/latest/demo/user-defined.html for example usage
arrows(): { [arrowStyleName: string]: (parent: d3.Selection<any>, id: string, edge: dagre.Edge, type: string) => void };
(selection: d3.Selection<any>, g: dagre.graphlib.Graph): void;
shapes(): { [shapeStyleName: string]: (parent: d3.Selection<any>, bbox: any, node: dagre.Node) => void };
}

View File

@@ -0,0 +1,47 @@
import * as React from 'react';
import { render } from 'react-dom';
import Dayzed, { DateObj } from 'dayzed';
interface State {
selectedDate: Date;
monthOffset: number;
}
class App extends React.Component<{}, State> {
state = {
selectedDate: new Date(),
monthOffset: 0,
};
handleSetDate = (dateObj: DateObj) => {
this.setState({ selectedDate: dateObj.date });
}
render() {
return (
<Dayzed
selected={this.state.selectedDate}
offset={this.state.monthOffset}
onDateSelected={this.handleSetDate}
>
{({ calendars, ...rp }) => calendars.map(cal => (
<div>
Calendar:
{cal.weeks.map(week => (
<div>
Week:
{week.map(day => day && (
<span {...rp.getDateProps({ dateObj: day })}>Day({day.date.getDate()}):</span>
))}
</div>
))}
</div>
))}
</Dayzed>
);
}
}
render(<App />, document.body);

52
types/dayzed/index.d.ts vendored Normal file
View File

@@ -0,0 +1,52 @@
// Type definitions for dayzed 2.2
// Project: https://github.com/deseretdigital/dayzed
// Definitions by: Sam A. Horvath-Hunt <https://github.com/samhh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import { Component, ReactNode } from 'react';
export interface DateObj {
date: Date;
nextMonth: boolean;
prevMonth: boolean;
selectable: boolean;
selected: boolean;
today: boolean;
}
interface Calendar {
firstDayOfMonth: Date;
lastDayOfMonth: Date;
month: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
weeks: Array<Array<DateObj | ''>>;
year: number;
}
interface RenderProps {
calendars: Calendar[];
getBackProps: (data: { calendars: Calendar[]; offset?: number; }) => Record<string, any>;
getForwardProps: (data: { calendars: Calendar[]; offset?: number; }) => Record<string, any>;
getDateProps: (data: { dateObj: DateObj; }) => Record<string, any>;
}
type RenderFn = (renderProps: RenderProps) => ReactNode;
interface Props {
date?: Date;
maxDate?: Date;
minDate?: Date;
monthsToDisplay?: number;
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
showOutsideDays?: boolean;
selected?: Date | Date[];
children?: RenderFn;
render?: RenderFn;
offset?: number;
onOffsetChanged?(offset: number): void;
onDateSelected(selectedDate: DateObj): void;
}
declare class Dayzed extends Component<Props> { }
export default Dayzed;

View File

@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"jsx": "react",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"dayzed-tests.tsx"
]
}

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