mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-18 20:37:14 +08:00
Merge pull request #13343 from DefinitelyTyped/merge_dec14
Merge from `types-2.0` to `master`
This commit is contained in:
9
acorn/README.md
Normal file
9
acorn/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
This file exists for reminding contributors that this definition is **WIP**.
|
||||
|
||||
### Note
|
||||
|
||||
There are a **large** number of methods of class `Parser` and `LooseParser` haven't been declared.
|
||||
|
||||
However, these methods may not be useful for common users. So, I hang the job util it worth continuing.
|
||||
|
||||
Of course, volunteers are welcomed to spend time extracting these things.
|
||||
@@ -14,7 +14,7 @@ var string: string;
|
||||
// acorn
|
||||
string = acorn.version;
|
||||
program = acorn.parse('code');
|
||||
program = acorn.parse('code', {ranges: true, onToken: tokens, onComment: comments});
|
||||
program = acorn.parse('code', { ranges: true, onToken: tokens, onComment: comments });
|
||||
program = acorn.parse('code', {
|
||||
ranges: true,
|
||||
onToken: (token) => tokens.push(token),
|
||||
@@ -28,3 +28,42 @@ any = token.value;
|
||||
|
||||
// Comment
|
||||
string = comment.value;
|
||||
|
||||
const parser = new acorn.Parser({}, 'export default ""', 0);
|
||||
|
||||
const node = new acorn.Node(parser, 1, 1);
|
||||
|
||||
class LooseParser {
|
||||
constructor(input: string, options = {}) {
|
||||
|
||||
}
|
||||
|
||||
// this means you can extend LooseParser
|
||||
test() {
|
||||
|
||||
}
|
||||
}
|
||||
acorn.addLooseExports(function () {
|
||||
return {
|
||||
type: 'Program',
|
||||
sourceType: 'script',
|
||||
body: [
|
||||
{
|
||||
type: 'EmptyStatement'
|
||||
}
|
||||
]
|
||||
}
|
||||
}, LooseParser, {});
|
||||
|
||||
acorn.parseExpressionAt('string', 2);
|
||||
|
||||
acorn.isNewLine(56);
|
||||
|
||||
acorn.isIdentifierStart(56);
|
||||
|
||||
acorn.isIdentifierChar(56);
|
||||
|
||||
acorn.getLineInfo('string', 56);
|
||||
|
||||
acorn.plugins['test'] = function (p: acorn.Parser, config: any) {
|
||||
}
|
||||
|
||||
258
acorn/index.d.ts
vendored
258
acorn/index.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Acorn v1.0.1
|
||||
// Type definitions for Acorn v4.0.3
|
||||
// Project: https://github.com/marijnh/acorn
|
||||
// Definitions by: RReverser <https://github.com/RReverser>
|
||||
// Definitions by: RReverser <https://github.com/RReverser>, e-cloud <https://github.com/e-cloud>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="estree" />
|
||||
@@ -10,13 +10,89 @@ export = acorn;
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
declare namespace acorn {
|
||||
var version: string;
|
||||
function parse(input: string, options?: Options): ESTree.Program;
|
||||
function parseExpressionAt(input: string, pos: number, options?: Options): ESTree.Expression;
|
||||
function getLineInfo(input: string, offset: number): ESTree.Position;
|
||||
var defaultOptions: Options;
|
||||
interface PlainObject {
|
||||
[name: string]: any;
|
||||
}
|
||||
|
||||
interface TokenType {
|
||||
interface PluginsObject {
|
||||
[name: string]: (p: Parser, config: any) => void;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 2015 | 2016 | 2017;
|
||||
sourceType?: 'script' | 'module';
|
||||
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: ESTree.Position) => void;
|
||||
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: ESTree.Position) => void;
|
||||
allowReserved?: boolean;
|
||||
allowReturnOutsideFunction?: boolean;
|
||||
allowImportExportEverywhere?: boolean;
|
||||
allowHashBang?: boolean;
|
||||
locations?: boolean;
|
||||
onToken?: ((token: Token) => any) | Token[];
|
||||
onComment?: ((
|
||||
isBlock: boolean, text: string, start: number, end: number, startLoc?: ESTree.Position,
|
||||
endLoc?: ESTree.Position
|
||||
) => void) | Comment[];
|
||||
ranges?: boolean;
|
||||
program?: ESTree.Program;
|
||||
sourceFile?: string;
|
||||
directSourceFile?: string;
|
||||
preserveParens?: boolean;
|
||||
plugins?: PlainObject;
|
||||
}
|
||||
|
||||
class Parser {
|
||||
constructor(options: Options, input: string, startPos?: number);
|
||||
|
||||
parse(): ESTree.Program;
|
||||
}
|
||||
|
||||
const plugins: PluginsObject;
|
||||
|
||||
const defaultOptions: Options;
|
||||
|
||||
class Position implements ESTree.Position {
|
||||
line: number;
|
||||
column: number;
|
||||
|
||||
constructor(line: number, col: number);
|
||||
|
||||
offset(n: number): Position;
|
||||
}
|
||||
|
||||
class SourceLocation implements ESTree.SourceLocation {
|
||||
start: Position;
|
||||
end: Position;
|
||||
source?: string;
|
||||
|
||||
constructor(p: Parser, start: Position, end: Position);
|
||||
}
|
||||
|
||||
function getLineInfo(input: string, offset: number): ESTree.Position;
|
||||
|
||||
class Node {
|
||||
type: string;
|
||||
start: number;
|
||||
end: number;
|
||||
loc?: ESTree.SourceLocation;
|
||||
sourceFile?: string;
|
||||
range?: [number, number];
|
||||
|
||||
constructor(parser: Parser, pos: number, loc: number);
|
||||
}
|
||||
|
||||
interface TokeTypeConfig {
|
||||
keyword: string;
|
||||
beforeExpr?: boolean;
|
||||
startsExpr?: boolean;
|
||||
isLoop?: boolean;
|
||||
isAssign?: boolean;
|
||||
prefix?: boolean;
|
||||
postfix?: boolean;
|
||||
binop?: number;
|
||||
}
|
||||
|
||||
class TokenType {
|
||||
label: string;
|
||||
keyword: string;
|
||||
beforeExpr: boolean;
|
||||
@@ -26,19 +102,110 @@ declare namespace acorn {
|
||||
prefix: boolean;
|
||||
postfix: boolean;
|
||||
binop: number;
|
||||
updateContext: (prevType: TokenType) => any;
|
||||
updateContext: (prevType: TokenType) => void;
|
||||
|
||||
constructor(label: string, conf?: TokeTypeConfig);
|
||||
}
|
||||
|
||||
const tokTypes: {
|
||||
num: TokenType;
|
||||
regexp: TokenType;
|
||||
string: TokenType;
|
||||
name: TokenType;
|
||||
eof: TokenType;
|
||||
bracketL: TokenType;
|
||||
bracketR: TokenType;
|
||||
braceL: TokenType;
|
||||
braceR: TokenType;
|
||||
parenL: TokenType;
|
||||
parenR: TokenType;
|
||||
comma: TokenType;
|
||||
semi: TokenType;
|
||||
colon: TokenType;
|
||||
dot: TokenType;
|
||||
question: TokenType;
|
||||
arrow: TokenType;
|
||||
template: TokenType;
|
||||
ellipsis: TokenType;
|
||||
backQuote: TokenType;
|
||||
dollarBraceL: TokenType;
|
||||
eq: TokenType;
|
||||
assign: TokenType;
|
||||
incDec: TokenType;
|
||||
prefix: TokenType;
|
||||
logicalOR: TokenType;
|
||||
logicalAND: TokenType;
|
||||
bitwiseOR: TokenType;
|
||||
bitwiseXOR: TokenType;
|
||||
bitwiseAND: TokenType;
|
||||
equality: TokenType;
|
||||
relational: TokenType;
|
||||
bitShift: TokenType;
|
||||
plusMin: TokenType;
|
||||
modulo: TokenType;
|
||||
star: TokenType;
|
||||
slash: TokenType;
|
||||
starstar: TokenType;
|
||||
_break: TokenType;
|
||||
_case: TokenType;
|
||||
_catch: TokenType;
|
||||
_continue: TokenType;
|
||||
_debugger: TokenType;
|
||||
_default: TokenType;
|
||||
_do: TokenType;
|
||||
_else: TokenType;
|
||||
_finally: TokenType;
|
||||
_for: TokenType;
|
||||
_function: TokenType;
|
||||
_if: TokenType;
|
||||
_return: TokenType;
|
||||
_switch: TokenType;
|
||||
_throw: TokenType;
|
||||
_try: TokenType;
|
||||
_var: TokenType;
|
||||
_const: TokenType;
|
||||
_while: TokenType;
|
||||
_with: TokenType;
|
||||
_new: TokenType;
|
||||
_this: TokenType;
|
||||
_super: TokenType;
|
||||
_class: TokenType;
|
||||
_extends: TokenType;
|
||||
_export: TokenType;
|
||||
_import: TokenType;
|
||||
_null: TokenType;
|
||||
_true: TokenType;
|
||||
_false: TokenType;
|
||||
_in: TokenType;
|
||||
_instanceof: TokenType;
|
||||
_typeof: TokenType;
|
||||
_void: TokenType;
|
||||
_delete: TokenType;
|
||||
}
|
||||
|
||||
class TokContext {
|
||||
constructor(token: string, isExpr: boolean, preserveSpace: boolean, override: (p: Parser) => void);
|
||||
}
|
||||
|
||||
const tokContexts: {
|
||||
b_stat: TokContext;
|
||||
b_expr: TokContext;
|
||||
b_tmpl: TokContext;
|
||||
p_stat: TokContext;
|
||||
p_expr: TokContext;
|
||||
q_tmpl: TokContext;
|
||||
f_expr: TokContext;
|
||||
};
|
||||
|
||||
function isIdentifierStart(code: number, astral?: boolean): boolean;
|
||||
|
||||
function isIdentifierChar(code: number, astral?: boolean): boolean;
|
||||
|
||||
interface AbstractToken {
|
||||
start: number;
|
||||
end: number;
|
||||
loc: ESTree.SourceLocation;
|
||||
range: [number, number];
|
||||
}
|
||||
|
||||
interface Token extends AbstractToken {
|
||||
type: TokenType;
|
||||
value: any;
|
||||
loc?: SourceLocation;
|
||||
range?: [number, number];
|
||||
}
|
||||
|
||||
interface Comment extends AbstractToken {
|
||||
@@ -46,23 +213,46 @@ declare namespace acorn {
|
||||
value: string;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
ecmaVersion?: number;
|
||||
sourceType?: string;
|
||||
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: ESTree.Position) => any;
|
||||
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: ESTree.Position) => any;
|
||||
allowReserved?: boolean;
|
||||
allowReturnOutsideFunction?: boolean;
|
||||
allowImportExportEverywhere?: boolean;
|
||||
allowHashBang?: boolean;
|
||||
locations?: boolean;
|
||||
onToken?: ((token: Token) => any) | Token[];
|
||||
onComment?: ((isBlock: boolean, text: string, start: number, end: number, startLoc?: ESTree.Position, endLoc?: ESTree.Position) => any) | Comment[];
|
||||
ranges?: boolean;
|
||||
program?: ESTree.Program;
|
||||
sourceFile?: string;
|
||||
directSourceFile?: string;
|
||||
preserveParens?: boolean;
|
||||
plugins?: { [name: string]: Function; };
|
||||
class Token {
|
||||
constructor(p: Parser);
|
||||
}
|
||||
|
||||
interface Token extends AbstractToken {
|
||||
type: TokenType;
|
||||
value: any;
|
||||
}
|
||||
|
||||
function isNewLine(code: number): boolean;
|
||||
|
||||
const lineBreak: RegExp;
|
||||
|
||||
const lineBreakG: RegExp;
|
||||
|
||||
const version: string;
|
||||
|
||||
interface IParse {
|
||||
(input: string, options?: Options): ESTree.Program;
|
||||
}
|
||||
|
||||
const parse: IParse;
|
||||
|
||||
function parseExpressionAt(input: string, pos?: number, options?: Options): ESTree.Expression;
|
||||
|
||||
// todo: here the tokenizer function returns a Parser instance, that is targeting the detail of
|
||||
// Parser prototype. Someone need this please reade README.md first.
|
||||
// function tokenizer(options: Options, input: string): Parser;
|
||||
|
||||
let parse_dammit: IParse | undefined;
|
||||
let LooseParser: ILooseParserClass | undefined;
|
||||
let pluginsLoose: PluginsObject | undefined;
|
||||
|
||||
interface ILooseParserClass {
|
||||
new (input: string, options?: Options): ILooseParser
|
||||
}
|
||||
|
||||
interface ILooseParser {
|
||||
|
||||
}
|
||||
|
||||
function addLooseExports(parse: IParse, parser: ILooseParserClass, plugins: PluginsObject): void;
|
||||
}
|
||||
|
||||
23
angular-ui-bootstrap/index.d.ts
vendored
23
angular-ui-bootstrap/index.d.ts
vendored
@@ -7,6 +7,29 @@
|
||||
|
||||
import * as angular from 'angular';
|
||||
|
||||
export type IAccordionConfig = angular.ui.bootstrap.IAccordionConfig;
|
||||
export type IButtonConfig = angular.ui.bootstrap.IButtonConfig;
|
||||
export type IDatepickerConfig = angular.ui.bootstrap.IDatepickerConfig;
|
||||
export type IDatepickerPopupConfig = angular.ui.bootstrap.IDatepickerPopupConfig;
|
||||
export type IModalProvider = angular.ui.bootstrap.IModalProvider;
|
||||
export type IModalService = angular.ui.bootstrap.IModalService;
|
||||
export type IModalServiceInstance = angular.ui.bootstrap.IModalServiceInstance;
|
||||
export type IModalScope = angular.ui.bootstrap.IModalScope;
|
||||
export type IModalSettings = angular.ui.bootstrap.IModalSettings;
|
||||
export type IModalStackService = angular.ui.bootstrap.IModalStackService;
|
||||
export type IModalStackedMapKeyValuePair = angular.ui.bootstrap.IModalStackedMapKeyValuePair;
|
||||
export type IPaginationConfig = angular.ui.bootstrap.IPaginationConfig;
|
||||
export type IPagerConfig = angular.ui.bootstrap.IPagerConfig;
|
||||
export type IPositionCoordinates = angular.ui.bootstrap.IPositionCoordinates;
|
||||
export type IPositionService = angular.ui.bootstrap.IPositionService;
|
||||
export type IProgressConfig = angular.ui.bootstrap.IProgressConfig;
|
||||
export type IRatingConfig = angular.ui.bootstrap.IRatingConfig;
|
||||
export type ITimepickerConfig = angular.ui.bootstrap.ITimepickerConfig;
|
||||
export type ITooltipOptions = angular.ui.bootstrap.ITooltipOptions;
|
||||
export type ITooltipProvider = angular.ui.bootstrap.ITooltipProvider;
|
||||
export type ITransitionService = angular.ui.bootstrap.ITransitionService;
|
||||
export type ITransitionServiceOptions = angular.ui.bootstrap.ITransitionServiceOptions;
|
||||
|
||||
declare module 'angular' {
|
||||
export namespace ui.bootstrap {
|
||||
|
||||
|
||||
@@ -648,7 +648,7 @@ async.mapValues<number, string, Error>({
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err: Error, results: string[]): void {
|
||||
}, function(err: Error, results: Dictionary<string>): void {
|
||||
|
||||
console.log("async.mapValues: done with results", results);
|
||||
|
||||
@@ -668,7 +668,7 @@ async.mapValuesSeries<number, string, Error>({
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err: Error, results: string[]): void {
|
||||
}, function(err: Error, results: Dictionary<string>): void {
|
||||
|
||||
console.log("async.mapValuesSeries: done with results", results);
|
||||
|
||||
|
||||
4
async/index.d.ts
vendored
4
async/index.d.ts
vendored
@@ -111,8 +111,8 @@ interface Async {
|
||||
mapSeries: typeof async.map;
|
||||
mapLimit<T, R, E>(arr: T[], limit: number, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
mapLimit<T, R, E>(arr: Dictionary<T>, limit: number, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
mapValuesLimit<T, R, E>(obj: Dictionary<T>, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultCallback<R[], E>): void;
|
||||
mapValues<T, R, E>(obj: Dictionary<T>, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultCallback<R[], E>): void;
|
||||
mapValuesLimit<T, R, E>(obj: Dictionary<T>, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultObjectCallback<R, E>): void;
|
||||
mapValues<T, R, E>(obj: Dictionary<T>, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultObjectCallback<R, E>): void;
|
||||
mapValuesSeries: typeof async.mapValues;
|
||||
filter<T, E>(arr: T[], iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
filter<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
|
||||
15
inert/index.d.ts
vendored
Normal file
15
inert/index.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// Type definitions for inert 4.0
|
||||
// Project: https://github.com/hapijs/inert/
|
||||
// Definitions by: Steve Ognibene <http://github.com/nycdotnet>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Note: this definition contains only enough to make TypeScript happy (hapi?) when
|
||||
// importing inert. The functionality that importing inert adds to the reply
|
||||
// object and its other features are implemented in the hapi definition on
|
||||
// DefinitelyTyped. The inert object is never actually used in practice except to
|
||||
// be passed as an extension to the server.register() method which already takes
|
||||
// an `any` argument, so just using `any` here is fine.
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export var inert: any;
|
||||
7
inert/inert-tests-es6.ts
Normal file
7
inert/inert-tests-es6.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
import * as HapiES6 from 'hapi';
|
||||
import * as InertES6 from 'inert';
|
||||
|
||||
|
||||
const server = new HapiES6.Server({});
|
||||
server.register(InertES6, () => {});
|
||||
9
inert/inert-tests.ts
Normal file
9
inert/inert-tests.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
const Inert = require('inert');
|
||||
const Hapi = require('hapi');
|
||||
|
||||
|
||||
const server = new Hapi.Server({});
|
||||
server.register(Inert, () => {});
|
||||
|
||||
export var makeThisAModule: any;
|
||||
20
inert/tsconfig.json
Normal file
20
inert/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"inert-tests.ts",
|
||||
"inert-tests-es6.ts"
|
||||
]
|
||||
}
|
||||
1
inert/tslint.json
Normal file
1
inert/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
25
jqueryui/index.d.ts
vendored
25
jqueryui/index.d.ts
vendored
@@ -320,6 +320,14 @@ declare namespace JQueryUI {
|
||||
* Additional text to display after the year in the month headers.
|
||||
*/
|
||||
yearSuffix?: string;
|
||||
/**
|
||||
* Set to true to automatically hide the datepicker.
|
||||
*/
|
||||
autohide?: boolean;
|
||||
/**
|
||||
* Set to date to automatically enddate the datepicker.
|
||||
*/
|
||||
endDate?: Date;
|
||||
}
|
||||
|
||||
interface DatepickerFormatDateOptions {
|
||||
@@ -1341,6 +1349,23 @@ interface JQuery {
|
||||
* @param optionName 'buttonText'
|
||||
*/
|
||||
datepicker(methodName: 'option', optionName: 'buttonText'): string;
|
||||
|
||||
/**
|
||||
* Get the autohide option, after initialization
|
||||
*
|
||||
* @param methodName 'option'
|
||||
* @param optionName 'autohide'
|
||||
*/
|
||||
datepicker(methodName: 'option', optionName: 'autohide'): boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Get the endDate after initialization
|
||||
*
|
||||
* @param methodName 'option'
|
||||
* @param optionName 'endDate'
|
||||
*/
|
||||
datepicker(methodName: 'option', optionName: 'endDate'): Date;
|
||||
/**
|
||||
* Set the buttonText option, after initialization
|
||||
*
|
||||
|
||||
126
leaflet/index.d.ts
vendored
126
leaflet/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Leaflet.js 1.0.0
|
||||
// Type definitions for Leaflet.js 1.0.2
|
||||
// Project: https://github.com/Leaflet/Leaflet
|
||||
// Definitions by: Alejandro Sánchez <https://github.com/alejo90>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -9,10 +9,38 @@ type NativeMouseEvent = MouseEvent;
|
||||
|
||||
declare namespace L {
|
||||
export class Class {
|
||||
static extend(props:any):any/* how to return constructor of self extended type ? */;
|
||||
static include(props:any):any /* how to return self extended type ? */;
|
||||
static mergeOptions(props:any): any /* how to return self extended type ? */;
|
||||
static addInitHook(initHookFn: ()=> void): any/* how to return self extended type ? */;
|
||||
static extend(props: any): any/* how to return constructor of self extended type ? */;
|
||||
static include(props: any): any /* how to return self extended type ? */;
|
||||
static mergeOptions(props: any): any /* how to return self extended type ? */;
|
||||
static addInitHook(initHookFn: () => void): any/* how to return self extended type ? */;
|
||||
}
|
||||
|
||||
export class Transformation {
|
||||
constructor(a: number, b: number, c: number, d: number);
|
||||
|
||||
transform(point: Point, scale?: number): Point;
|
||||
|
||||
untransform(point: Point, scale?: number): Point;
|
||||
}
|
||||
|
||||
export namespace LineUtil {
|
||||
export function simplify(points: Array<Point>, tolerance: number): Array<Point>;
|
||||
|
||||
export function simplify(points: Array<PointTuple>, tolerance: number): Array<Point>;
|
||||
|
||||
export function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number;
|
||||
|
||||
export function pointToSegmentDistance(p: PointTuple, p1: PointTuple, p2: PointTuple): number;
|
||||
|
||||
export function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point;
|
||||
|
||||
export function closestPointOnSegment(p: PointTuple, p1: PointTuple, p2: PointTuple): Point;
|
||||
}
|
||||
|
||||
export namespace PolyUtil {
|
||||
export function clipPolygon(points: Array<Point>, bounds: Bounds, round?: boolean): Array<Point>;
|
||||
|
||||
export function clipPolygon(points: Array<PointTuple>, bounds: BoundsLiteral, round?: boolean): Array<Point>;
|
||||
}
|
||||
|
||||
export class DomUtil {
|
||||
@@ -33,13 +61,13 @@ declare namespace L {
|
||||
static testProp(props: String[]): String|boolean/*=false*/;
|
||||
static setTransform(el: HTMLElement, offset: Point, scale?: Number):void;
|
||||
static setPosition(el: HTMLElement, position: Point):void;
|
||||
static getPosition(el: HTMLElement): Point
|
||||
static disableTextSelection(): void
|
||||
static enableTextSelection(): void
|
||||
static disableImageDrag(): void
|
||||
static enableImageDrag(): void
|
||||
static preventOutline(el: HTMLElement): void
|
||||
static restoreOutline(): void
|
||||
static getPosition(el: HTMLElement): Point;
|
||||
static disableTextSelection(): void;
|
||||
static enableTextSelection(): void;
|
||||
static disableImageDrag(): void;
|
||||
static enableImageDrag(): void;
|
||||
static preventOutline(el: HTMLElement): void;
|
||||
static restoreOutline(): void;
|
||||
}
|
||||
|
||||
export interface CRS {
|
||||
@@ -154,7 +182,7 @@ declare namespace L {
|
||||
round(): Point;
|
||||
floor(): Point;
|
||||
ceil(): Point;
|
||||
distanceTo(otherPoint: PointExpression): Point;
|
||||
distanceTo(otherPoint: PointExpression): number;
|
||||
equals(otherPoint: PointExpression): boolean;
|
||||
contains(otherPoint: PointExpression): boolean;
|
||||
toString(): string;
|
||||
@@ -203,14 +231,14 @@ declare namespace L {
|
||||
* with an object (e.g. the user clicks on the map, causing the map to fire
|
||||
* 'click' event).
|
||||
*/
|
||||
export interface Evented extends Class {
|
||||
export abstract class Evented extends Class {
|
||||
/**
|
||||
* Adds a listener function (fn) to a particular event type of the object.
|
||||
* You can optionally specify the context of the listener (object the this
|
||||
* keyword will point to). You can also pass several space-separated types
|
||||
* (e.g. 'click dblclick').
|
||||
*/
|
||||
on(type: string, fn: EventHandlerFn, context?: Object): this;
|
||||
on(type: string, fn: EventHandlerFn, context?: any): this;
|
||||
|
||||
/**
|
||||
* Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
|
||||
@@ -223,7 +251,7 @@ declare namespace L {
|
||||
* Note that if you passed a custom context to on, you must pass the same context
|
||||
* to off in order to remove the listener.
|
||||
*/
|
||||
off(type: string, fn?: EventHandlerFn, context?: Object): this;
|
||||
off(type: string, fn?: EventHandlerFn, context?: any): this;
|
||||
|
||||
/**
|
||||
* Removes a set of type/listener pairs.
|
||||
@@ -240,7 +268,7 @@ declare namespace L {
|
||||
* object — the first argument of the listener function will contain its properties.
|
||||
* The event might can optionally be propagated to event parents.
|
||||
*/
|
||||
fire(type: string, data?: Object, propagate?: boolean): this;
|
||||
fire(type: string, data?: any, propagate?: boolean): this;
|
||||
|
||||
/**
|
||||
* Returns true if a particular event type has any listeners attached to it.
|
||||
@@ -250,7 +278,7 @@ declare namespace L {
|
||||
/**
|
||||
* Behaves as on(...), except the listener will only get fired once and then removed.
|
||||
*/
|
||||
once(type: string, fn: EventHandlerFn, context?: Object): this;
|
||||
once(type: string, fn: EventHandlerFn, context?: any): this;
|
||||
|
||||
/**
|
||||
* Behaves as on(...), except the listener will only get fired once and then removed.
|
||||
@@ -275,7 +303,7 @@ declare namespace L {
|
||||
* keyword will point to). You can also pass several space-separated types
|
||||
* (e.g. 'click dblclick').
|
||||
*/
|
||||
addEventListener(type: string, fn: EventHandlerFn, context?: Object): this;
|
||||
addEventListener(type: string, fn: EventHandlerFn, context?: any): this;
|
||||
|
||||
/**
|
||||
* Alias for on(...)
|
||||
@@ -292,7 +320,7 @@ declare namespace L {
|
||||
* Note that if you passed a custom context to on, you must pass the same context
|
||||
* to off in order to remove the listener.
|
||||
*/
|
||||
removeEventListener(type: string, fn: EventHandlerFn, context?: Object): this;
|
||||
removeEventListener(type: string, fn: EventHandlerFn, context?: any): this;
|
||||
|
||||
/**
|
||||
* Alias for off(...)
|
||||
@@ -313,7 +341,7 @@ declare namespace L {
|
||||
*
|
||||
* Behaves as on(...), except the listener will only get fired once and then removed.
|
||||
*/
|
||||
addOneTimeEventListener(type: string, fn: EventHandlerFn, context?: Object): this;
|
||||
addOneTimeEventListener(type: string, fn: EventHandlerFn, context?: any): this;
|
||||
|
||||
/**
|
||||
* Alias for once(...)
|
||||
@@ -329,7 +357,7 @@ declare namespace L {
|
||||
* object — the first argument of the listener function will contain its properties.
|
||||
* The event might can optionally be propagated to event parents.
|
||||
*/
|
||||
fireEvent(type: string, data?: Object, propagate?: boolean): this;
|
||||
fireEvent(type: string, data?: any, propagate?: boolean): this;
|
||||
|
||||
/**
|
||||
* Alias for listens(...)
|
||||
@@ -339,6 +367,21 @@ declare namespace L {
|
||||
hasEventListeners(type: string): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A class for making DOM elements draggable (including touch support).
|
||||
* Used internally for map and marker dragging. Only works for elements
|
||||
* that were positioned with [`L.DomUtil.setPosition`](#domutil-setposition).
|
||||
*/
|
||||
export class Draggable extends Evented {
|
||||
constructor(element: HTMLElement, dragStartTarget?: HTMLElement, preventOutline?: boolean);
|
||||
|
||||
enable(): void;
|
||||
|
||||
disable(): void;
|
||||
|
||||
finishDrag(): void;
|
||||
}
|
||||
|
||||
interface LayerOptions {
|
||||
pane?: string;
|
||||
}
|
||||
@@ -455,7 +498,7 @@ declare namespace L {
|
||||
}
|
||||
|
||||
export interface WMS extends TileLayer {
|
||||
setParams(params: Object, noRedraw?: boolean): this;
|
||||
setParams(params: any, noRedraw?: boolean): this;
|
||||
}
|
||||
|
||||
export namespace tileLayer {
|
||||
@@ -475,6 +518,15 @@ declare namespace L {
|
||||
bringToFront(): this;
|
||||
bringToBack(): this;
|
||||
setUrl(url: string): this;
|
||||
|
||||
/** Update the bounds that this ImageOverlay covers */
|
||||
setBounds(bounds: LatLngBounds): this;
|
||||
|
||||
/** Get the bounds that this ImageOverlay covers */
|
||||
getBounds(): LatLngBounds;
|
||||
|
||||
/** Get the img element that represents the ImageOverlay on the map */
|
||||
getElement(): HTMLImageElement;
|
||||
}
|
||||
|
||||
export function imageOverlay(imageUrl: string, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions): ImageOverlay;
|
||||
@@ -640,7 +692,7 @@ declare namespace L {
|
||||
* Iterates over the layers of the group,
|
||||
* optionally specifying context of the iterator function.
|
||||
*/
|
||||
eachLayer(fn: (layer: Layer) => void, context?: Object): this;
|
||||
eachLayer(fn: (layer: Layer) => void, context?: any): this;
|
||||
|
||||
/**
|
||||
* Returns the layer with the given internal ID.
|
||||
@@ -1065,7 +1117,7 @@ declare namespace L {
|
||||
|
||||
export interface Event {
|
||||
type: string;
|
||||
target: any; // should this be Object and have users cast?
|
||||
target: any;
|
||||
}
|
||||
|
||||
export interface MouseEvent extends Event {
|
||||
@@ -1115,7 +1167,7 @@ declare namespace L {
|
||||
|
||||
export interface GeoJSONEvent extends Event {
|
||||
layer: Layer;
|
||||
properties: any; // any or Object?
|
||||
properties: any;
|
||||
geometryType: string;
|
||||
id: string;
|
||||
}
|
||||
@@ -1133,13 +1185,13 @@ declare namespace L {
|
||||
}
|
||||
|
||||
export namespace DomEvent {
|
||||
export function on(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: Object): typeof DomEvent;
|
||||
export function on(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: any): typeof DomEvent;
|
||||
|
||||
export function on(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: Object): typeof DomEvent;
|
||||
export function on(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: any): typeof DomEvent;
|
||||
|
||||
export function off(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: Object): typeof DomEvent;
|
||||
export function off(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: any): typeof DomEvent;
|
||||
|
||||
export function off(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: Object): typeof DomEvent;
|
||||
export function off(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: any): typeof DomEvent;
|
||||
|
||||
export function stopPropagation(ev: Event): typeof DomEvent;
|
||||
|
||||
@@ -1155,13 +1207,13 @@ declare namespace L {
|
||||
|
||||
export function getWheelDelta(ev: Event): number;
|
||||
|
||||
export function addListener(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: Object): typeof DomEvent;
|
||||
export function addListener(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: any): typeof DomEvent;
|
||||
|
||||
export function addListener(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: Object): typeof DomEvent;
|
||||
export function addListener(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: any): typeof DomEvent;
|
||||
|
||||
export function removeListener(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: Object): typeof DomEvent;
|
||||
export function removeListener(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: any): typeof DomEvent;
|
||||
|
||||
export function removeListener(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: Object): typeof DomEvent;
|
||||
export function removeListener(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: any): typeof DomEvent;
|
||||
}
|
||||
|
||||
interface DefaultMapPanes {
|
||||
@@ -1183,7 +1235,7 @@ declare namespace L {
|
||||
addLayer(layer: Layer): this;
|
||||
removeLayer(layer: Layer): this;
|
||||
hasLayer(layer: Layer): boolean;
|
||||
eachLayer(fn: (layer: Layer) => void, context?: Object): this;
|
||||
eachLayer(fn: (layer: Layer) => void, context?: any): this;
|
||||
openPopup(popup: Popup): this;
|
||||
openPopup(content: string, latlng: LatLngExpression, options?: PopupOptions): this;
|
||||
openPopup(content: HTMLElement, latlng: LatLngExpression, options?: PopupOptions): this;
|
||||
@@ -1222,7 +1274,7 @@ declare namespace L {
|
||||
getPane(pane: HTMLElement): HTMLElement;
|
||||
getPanes(): {[name: string]: HTMLElement} & DefaultMapPanes;
|
||||
getContainer(): HTMLElement;
|
||||
whenReady(fn: () => void, context?: Object): this;
|
||||
whenReady(fn: () => void, context?: any): this;
|
||||
|
||||
// Methods for getting map state
|
||||
getCenter(): LatLng;
|
||||
@@ -1292,7 +1344,7 @@ declare namespace L {
|
||||
export interface IconDefault extends Icon {
|
||||
imagePath: string;
|
||||
}
|
||||
|
||||
|
||||
export namespace Icon {
|
||||
export const Default: IconDefault;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
import L = require('leaflet');
|
||||
|
||||
const latLngLiteral: L.LatLngLiteral = {lat: 12, lng: 13};
|
||||
@@ -28,6 +26,16 @@ point = L.point(12, 13, true);
|
||||
point = L.point(pointTuple);
|
||||
point = L.point({x: 12, y: 13});
|
||||
|
||||
let distance: number;
|
||||
point.distanceTo(point);
|
||||
point.distanceTo(pointTuple);
|
||||
|
||||
const transformation = new L.Transformation(1, 2, 3, 4);
|
||||
point = transformation.transform(point);
|
||||
point = transformation.transform(point, 2);
|
||||
point = transformation.untransform(point);
|
||||
point = transformation.untransform(point, 2);
|
||||
|
||||
const boundsLiteral: L.BoundsLiteral = [[1, 1], pointTuple];
|
||||
|
||||
let bounds: L.Bounds;
|
||||
@@ -36,11 +44,26 @@ bounds = L.bounds(pointTuple, pointTuple);
|
||||
bounds = L.bounds([point, point]);
|
||||
bounds = L.bounds(boundsLiteral);
|
||||
|
||||
let points: Array<L.Point>;
|
||||
points = L.LineUtil.simplify([point, point], 1);
|
||||
points = L.LineUtil.simplify([pointTuple, pointTuple], 2);
|
||||
|
||||
distance = L.LineUtil.pointToSegmentDistance(point, point, point);
|
||||
distance = L.LineUtil.pointToSegmentDistance(pointTuple, pointTuple, pointTuple);
|
||||
|
||||
point = L.LineUtil.closestPointOnSegment(point, point, point);
|
||||
point = L.LineUtil.closestPointOnSegment(pointTuple, pointTuple, pointTuple);
|
||||
|
||||
points = L.PolyUtil.clipPolygon(points, bounds);
|
||||
points = L.PolyUtil.clipPolygon(points, bounds, true);
|
||||
points = L.PolyUtil.clipPolygon([pointTuple, pointTuple], boundsLiteral);
|
||||
points = L.PolyUtil.clipPolygon([pointTuple, pointTuple], boundsLiteral, true);
|
||||
|
||||
let mapOptions: L.MapOptions = {};
|
||||
mapOptions = {
|
||||
preferCanvas: true,
|
||||
attributionControl: false,
|
||||
zoomControl: true,
|
||||
zoomControl: true,
|
||||
closePopupOnClick: false,
|
||||
zoomSnap: 1,
|
||||
zoomDelta: 1,
|
||||
@@ -51,11 +74,11 @@ mapOptions = {
|
||||
zoom: 12,
|
||||
minZoom: 10,
|
||||
maxZoom: 14,
|
||||
fadeAnimation: true,
|
||||
fadeAnimation: true,
|
||||
markerZoomAnimation: false,
|
||||
transform3DLimit: 123,
|
||||
zoomAnimation: false,
|
||||
zoomAnimationThreshold: 4,
|
||||
zoomAnimationThreshold: 4,
|
||||
inertia: false,
|
||||
inertiaDeceleration: 2000,
|
||||
inertiaMaxSpeed: 1000,
|
||||
@@ -326,3 +349,9 @@ map = map
|
||||
.remove()
|
||||
.whenReady(() => {})
|
||||
.whenReady(() => {}, {});
|
||||
|
||||
let elementToDrag = document.createElement('div');
|
||||
let draggable = new L.Draggable(elementToDrag);
|
||||
draggable.enable();
|
||||
draggable.disable();
|
||||
draggable.on('drag', () => {});
|
||||
5
leaflet/package.json
Normal file
5
leaflet/package.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@types/geojson": "0.0.31"
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"node_modules/@types",
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
@@ -16,4 +17,4 @@
|
||||
"index.d.ts",
|
||||
"leaflet-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
93
navigation-react/index.d.ts
vendored
Normal file
93
navigation-react/index.d.ts
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
// Type definitions for NavigationReact 2.0
|
||||
// Project: http://grahammendick.github.io/navigation/
|
||||
// Definitions by: Graham Mendick <https://github.com/grahammendick>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
import { StateNavigator } from 'navigation';
|
||||
import { Component, HTMLProps } from 'react';
|
||||
|
||||
export = NavigationReact;
|
||||
|
||||
declare namespace NavigationReact {
|
||||
/**
|
||||
* Defines the Link Props contract
|
||||
*/
|
||||
interface LinkProps extends HTMLProps<HTMLAnchorElement> {
|
||||
/**
|
||||
* Indicates whether Links listen for navigate events
|
||||
*/
|
||||
lazy?: boolean;
|
||||
/**
|
||||
* Determines the effect on browser history
|
||||
*/
|
||||
historyAction?: 'add' | 'replace' | 'none';
|
||||
/**
|
||||
* Handles Link click events
|
||||
*/
|
||||
navigating?: (e: MouseEvent, domId: string, link: string) => boolean;
|
||||
/**
|
||||
* The State Navigator
|
||||
*/
|
||||
stateNavigator?: StateNavigator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the Refresh Link Props contract
|
||||
*/
|
||||
interface RefreshLinkProps extends LinkProps {
|
||||
/**
|
||||
* The NavigationData to pass
|
||||
*/
|
||||
navigationData?: any;
|
||||
/**
|
||||
* Indicates whether to include all the current NavigationData
|
||||
*/
|
||||
includeCurrentData?: boolean;
|
||||
/**
|
||||
* The data to add from the current NavigationData
|
||||
*/
|
||||
currentDataKeys?: string;
|
||||
/**
|
||||
* The Css Class to display when the Link is active
|
||||
*/
|
||||
activeCssClass?: string;
|
||||
/**
|
||||
* Indicates whether the Link is disabled when active
|
||||
*/
|
||||
disableActive?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hyperlink Component the navigates to the current State
|
||||
*/
|
||||
class RefreshLink extends Component<RefreshLinkProps, any> { }
|
||||
|
||||
/**
|
||||
* Defines the Navigation Link Props contract
|
||||
*/
|
||||
interface NavigationLinkProps extends RefreshLinkProps {
|
||||
/**
|
||||
* The key of the State to navigate to
|
||||
*/
|
||||
stateKey: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hyperlink Component the navigates to a State
|
||||
*/
|
||||
class NavigationLink extends Component<NavigationLinkProps, any> { }
|
||||
|
||||
/**
|
||||
* Defines the Navigation Back Link Props contract
|
||||
*/
|
||||
interface NavigationBackLinkProps extends RefreshLinkProps {
|
||||
/**
|
||||
* Starting at 1, The number of Crumb steps to go back
|
||||
*/
|
||||
distance: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hyperlink Component the navigates back along the crumb trail
|
||||
*/
|
||||
class NavigationBackLink extends Component<NavigationBackLinkProps, any> { }
|
||||
}
|
||||
78
navigation-react/navigation-react-tests.tsx
Normal file
78
navigation-react/navigation-react-tests.tsx
Normal file
@@ -0,0 +1,78 @@
|
||||
import { StateNavigator } from 'navigation';
|
||||
import { NavigationBackLink, NavigationLink, RefreshLink } from 'navigation-react';
|
||||
import * as React from 'react';
|
||||
|
||||
var stateNavigator = new StateNavigator([
|
||||
{ key: 'people', route: 'people/{page}' },
|
||||
{ key: 'person', route: 'person/{id}', trackCrumbTrail: true }
|
||||
]);
|
||||
|
||||
// Refresh Link
|
||||
var RefreshLinkTest = function() {
|
||||
return <RefreshLink>People</RefreshLink>;
|
||||
}
|
||||
|
||||
RefreshLinkTest = function() {
|
||||
return (
|
||||
<RefreshLink
|
||||
navigationData={{ page: 2 }}
|
||||
includeCurrentData={true}
|
||||
currentDataKeys="sort"
|
||||
activeCssClass="active"
|
||||
disableActive={true}
|
||||
lazy={false}
|
||||
historyAction="replace"
|
||||
navigating= {(e: MouseEvent, domId: string, link: string) => true}
|
||||
stateNavigator={stateNavigator}
|
||||
target="_blank"
|
||||
aria-label="Go to the second page of people">
|
||||
People
|
||||
</RefreshLink>
|
||||
);
|
||||
}
|
||||
|
||||
// Navigation Link
|
||||
var NavigationLinkTest = function() {
|
||||
return <NavigationLink stateKey="person">Person</NavigationLink>;
|
||||
}
|
||||
|
||||
NavigationLinkTest = function() {
|
||||
return (
|
||||
<NavigationLink
|
||||
stateKey="person"
|
||||
navigationData={{ id: 12 }}
|
||||
includeCurrentData={false}
|
||||
currentDataKeys=""
|
||||
activeCssClass=""
|
||||
disableActive={false}
|
||||
lazy={false}
|
||||
historyAction="add"
|
||||
navigating= {(e: MouseEvent, domId: string, link: string) => true}
|
||||
stateNavigator={stateNavigator}
|
||||
target="_blank"
|
||||
aria-label="View the person's details">
|
||||
Person
|
||||
</NavigationLink>
|
||||
);
|
||||
}
|
||||
|
||||
// Navigation Back Link
|
||||
var NavigationBackLinkTest = function() {
|
||||
return <NavigationBackLink distance={1}>People</NavigationBackLink>;
|
||||
}
|
||||
|
||||
NavigationBackLinkTest = function() {
|
||||
return (
|
||||
<NavigationBackLink
|
||||
distance={1}
|
||||
lazy={false}
|
||||
historyAction="none"
|
||||
navigating= {(e: MouseEvent, domId: string, link: string) => true}
|
||||
stateNavigator={stateNavigator}
|
||||
target="_blank"
|
||||
aria-label="Go back to the list of people">
|
||||
People
|
||||
</NavigationBackLink>
|
||||
);
|
||||
}
|
||||
|
||||
20
navigation-react/tsconfig.json
Normal file
20
navigation-react/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"navigation-react-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
navigation-react/tslint.json
Normal file
1
navigation-react/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
3
tether/index.d.ts
vendored
3
tether/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Tether v1.1
|
||||
// Type definitions for Tether v1.4
|
||||
// Project: http://github.hubspot.com/tether/
|
||||
// Definitions by: Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -22,6 +22,7 @@ declare class Tether {
|
||||
declare namespace Tether {
|
||||
interface ITetherOptions {
|
||||
attachment?: string;
|
||||
bodyElement?: HTMLElement;
|
||||
classes?: {[className: string]: boolean};
|
||||
classPrefix?: string;
|
||||
constraints?: ITetherConstraint[];
|
||||
|
||||
64
whatwg-fetch/index.d.ts
vendored
64
whatwg-fetch/index.d.ts
vendored
@@ -6,9 +6,9 @@
|
||||
/// <reference types="whatwg-streams" />
|
||||
|
||||
interface Window {
|
||||
fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
|
||||
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
||||
}
|
||||
declare var fetch: typeof window.fetch;
|
||||
declare let fetch: typeof window.fetch;
|
||||
|
||||
declare type HeadersInit = Headers | string[][] | { [key: string]: string };
|
||||
declare class Headers {
|
||||
@@ -16,7 +16,7 @@ declare class Headers {
|
||||
|
||||
append(name: string, value: string): void;
|
||||
delete(name: string): void;
|
||||
get(name: string): string; // | null; (TS 2.0 strict null check)
|
||||
get(name: string): string | null;
|
||||
has(name: string): boolean;
|
||||
set(name: string, value: string): void;
|
||||
|
||||
@@ -29,32 +29,35 @@ declare class Headers {
|
||||
}
|
||||
|
||||
declare type BodyInit = Blob | ArrayBufferView | ArrayBuffer | FormData /* | URLSearchParams */ | string;
|
||||
declare type ResponseBodyInit = BodyInit | ReadableStream;
|
||||
interface Body {
|
||||
bodyUsed: boolean;
|
||||
readonly bodyUsed: boolean;
|
||||
arrayBuffer(): Promise<ArrayBuffer>;
|
||||
blob(): Promise<Blob>;
|
||||
formData(): Promise<FormData>;
|
||||
json(): Promise<any>;
|
||||
json<T>(): Promise<T>;
|
||||
text(): Promise<string>;
|
||||
}
|
||||
|
||||
declare type RequestInfo = Request | string;
|
||||
declare class Request {
|
||||
constructor(input: RequestInfo, init?: RequestInit);
|
||||
|
||||
method: string;
|
||||
url: string;
|
||||
headers: Headers;
|
||||
constructor(input: RequestInfo, init?: RequestInit);
|
||||
|
||||
type: RequestType
|
||||
destination: RequestDestination;
|
||||
referrer: string;
|
||||
referrerPolicy: ReferrerPolicy;
|
||||
mode: RequestMode;
|
||||
credentials: RequestCredentials;
|
||||
cache: RequestCache;
|
||||
redirect: RequestRedirect;
|
||||
integrity: string;
|
||||
readonly method: string;
|
||||
readonly url: string;
|
||||
readonly headers: Headers;
|
||||
|
||||
readonly type: RequestType
|
||||
readonly destination: RequestDestination;
|
||||
readonly referrer: string;
|
||||
readonly referrerPolicy: ReferrerPolicy;
|
||||
readonly mode: RequestMode;
|
||||
readonly credentials: RequestCredentials;
|
||||
readonly cache: RequestCache;
|
||||
readonly redirect: RequestRedirect;
|
||||
readonly integrity: string;
|
||||
readonly keepalive: boolean;
|
||||
|
||||
clone(): Request;
|
||||
}
|
||||
@@ -70,7 +73,7 @@ interface RequestInit {
|
||||
cache?: RequestCache;
|
||||
redirect?: RequestRedirect;
|
||||
integrity?: string;
|
||||
window?: any;
|
||||
window?: null; // can only be set to null
|
||||
}
|
||||
|
||||
type RequestType = "" | "audio" | "font" | "image" | "script" | "style" | "track" | "video";
|
||||
@@ -79,27 +82,30 @@ type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors";
|
||||
type RequestCredentials = "omit" | "same-origin" | "include";
|
||||
type RequestCache = "default" | "no-store" | "reload" | "no-cache" | "force-cache" | "only-if-cached";
|
||||
type RequestRedirect = "follow" | "error" | "manual";
|
||||
|
||||
type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
|
||||
|
||||
declare class Response {
|
||||
constructor(body?: BodyInit, init?: ResponseInit);
|
||||
constructor(body?: ResponseBodyInit, init?: ResponseInit);
|
||||
|
||||
static error(): Response;
|
||||
static redirect(url: string, status?: number): Response;
|
||||
|
||||
type: ResponseType;
|
||||
url: string;
|
||||
redirected: boolean;
|
||||
status: number;
|
||||
ok: boolean;
|
||||
statusText: string;
|
||||
headers: Headers;
|
||||
body: ReadableStream; // | null;
|
||||
trailer: Promise<Headers>;
|
||||
readonly type: ResponseType;
|
||||
|
||||
readonly url: string;
|
||||
readonly redirected: boolean;
|
||||
readonly status: number;
|
||||
readonly ok: boolean;
|
||||
readonly statusText: string;
|
||||
readonly headers: Headers;
|
||||
readonly body: ReadableStream | null;
|
||||
readonly trailer: Promise<Headers>;
|
||||
|
||||
clone(): Response;
|
||||
}
|
||||
interface Response extends Body {}
|
||||
|
||||
interface ResponseInit {
|
||||
status?: number;
|
||||
statusText?: string;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
@@ -68,4 +68,43 @@ function handlePromise(promise: Promise<Response>) {
|
||||
}).then((text) => {
|
||||
console.log(text);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function test_Body_json() {
|
||||
interface FooBar {
|
||||
foo: string;
|
||||
bar: string;
|
||||
}
|
||||
|
||||
fetch('http://test.com')
|
||||
.then(response => response.json<FooBar>())
|
||||
.then(fooBar => {
|
||||
console.log(fooBar.foo);
|
||||
console.log(fooBar.bar);
|
||||
});
|
||||
|
||||
fetch('http://test.com')
|
||||
.then(response => <Promise<FooBar>> response.json())
|
||||
.then(fooBar => {
|
||||
console.log(fooBar.foo);
|
||||
console.log(fooBar.bar);
|
||||
});
|
||||
|
||||
fetch('http://test.com')
|
||||
.then(response => response.json() as Promise<FooBar>)
|
||||
.then(fooBar => {
|
||||
console.log(fooBar.foo);
|
||||
console.log(fooBar.bar);
|
||||
});
|
||||
|
||||
fetch('http://test.com')
|
||||
.then(response => response.json())
|
||||
.then(fooBar => {
|
||||
// fooBar is of type any, not of type FooBar
|
||||
|
||||
// FIXME Was behaving properly with TypeScript 2.0.10, not anymore with 2.1.4
|
||||
// See Wrong type with Promise chaining and 2.1.4 https://github.com/Microsoft/TypeScript/issues/12409
|
||||
//console.log(fooBar.foo);
|
||||
//console.log(fooBar.bar);
|
||||
});
|
||||
}
|
||||
|
||||
27
whatwg-streams/index.d.ts
vendored
27
whatwg-streams/index.d.ts
vendored
@@ -15,11 +15,18 @@ interface ReadableByteStreamSource {
|
||||
cancel?(reason: string): void | Promise<void>;
|
||||
|
||||
type: "bytes";
|
||||
autoAllocateChunkSize?: number;
|
||||
}
|
||||
|
||||
interface QueuingStrategy {
|
||||
highWaterMark?: number;
|
||||
size?(chunk: ArrayBufferView): number;
|
||||
highWaterMark?: number;
|
||||
}
|
||||
|
||||
interface PipeOptions {
|
||||
preventClose?: boolean;
|
||||
preventAbort?: boolean;
|
||||
preventCancel?: boolean;
|
||||
}
|
||||
|
||||
declare class ReadableStream {
|
||||
@@ -31,8 +38,8 @@ declare class ReadableStream {
|
||||
cancel(reason: string): Promise<void>;
|
||||
getReader(): ReadableStreamDefaultReader;
|
||||
getReader({ mode }: { mode: "byob" }): ReadableStreamBYOBReader;
|
||||
pipeThrough<T extends ReadableStream>({ writable, readable }: { writable: WritableStream, readable: T }): T;
|
||||
pipeTo(dest: WritableStream, { preventClose, preventAbort, preventCancel }: { preventClose?: boolean, preventAbort?: boolean, preventCancel?: boolean }): Promise<void>;
|
||||
pipeThrough<T extends ReadableStream>({ writable, readable }: { writable: WritableStream, readable: T }, options?: PipeOptions): T;
|
||||
pipeTo(dest: WritableStream, options?: PipeOptions): Promise<void>;
|
||||
tee(): [ReadableStream, ReadableStream];
|
||||
}
|
||||
|
||||
@@ -49,7 +56,7 @@ declare class ReadableStreamDefaultReader {
|
||||
declare class ReadableStreamBYOBReader {
|
||||
constructor(stream: ReadableStream);
|
||||
|
||||
closed: Promise<boolean>;
|
||||
closed: Promise<void>;
|
||||
|
||||
cancel(reason: string): Promise<void>;
|
||||
read(view: ArrayBufferView): Promise<IteratorResult<ArrayBufferView>>;
|
||||
@@ -88,8 +95,8 @@ declare class ReadableStreamBYOBRequest {
|
||||
|
||||
interface WritableStreamSink {
|
||||
start?(controller: WritableStreamDefaultController): void | Promise<void>;
|
||||
write?(chunk: any): void | Promise<void>;
|
||||
close?(): void | Promise<void>;
|
||||
write?(chunk: any, controller?: WritableStreamDefaultController): void | Promise<any>;
|
||||
close?(controller: WritableStreamDefaultController): void | Promise<void>;
|
||||
abort?(reason: string): void | Promise<void>;
|
||||
}
|
||||
|
||||
@@ -106,7 +113,7 @@ declare class WritableStreamDefaultWriter {
|
||||
constructor(stream: WritableStream);
|
||||
|
||||
closed: Promise<void>;
|
||||
desiredSize: number;
|
||||
desiredSize: number | null;
|
||||
ready: Promise<void>;
|
||||
|
||||
abort(reason: string): Promise<void>;
|
||||
@@ -124,11 +131,11 @@ declare class WritableStreamDefaultController {
|
||||
declare class ByteLengthQueuingStrategy {
|
||||
constructor({ highWaterMark }: { highWaterMark: number });
|
||||
|
||||
size(chunk: ArrayBufferView): number;
|
||||
size(chunk: ArrayBufferView): number | undefined;
|
||||
}
|
||||
|
||||
declare class CountQueuingStrategy {
|
||||
constructor({ highWaterMark }: { highWaterMark: number });
|
||||
|
||||
size(): number; // 1;
|
||||
}
|
||||
size(): 1;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
@@ -1,20 +1,39 @@
|
||||
function makeReadableWebSocketStream(url: string, protocols: string[]) {
|
||||
const ws = new WebSocket(url, protocols);
|
||||
ws.binaryType = "arraybuffer";
|
||||
/// <reference types="node" />
|
||||
|
||||
return new ReadableStream({
|
||||
start(controller) {
|
||||
ws.onmessage = event => controller.enqueue(event.data);
|
||||
ws.onclose = () => controller.close();
|
||||
ws.onerror = () => controller.error(new Error("The WebSocket errored!"));
|
||||
},
|
||||
// Examples taken from https://streams.spec.whatwg.org/#creating-examples
|
||||
|
||||
cancel() {
|
||||
ws.close();
|
||||
}
|
||||
});
|
||||
// 8.1. A readable stream with an underlying push source (no backpressure support)
|
||||
|
||||
{
|
||||
function makeReadableWebSocketStream(url: string, protocols: string | string[]) {
|
||||
const ws = new WebSocket(url, protocols);
|
||||
ws.binaryType = "arraybuffer";
|
||||
|
||||
return new ReadableStream({
|
||||
start(controller) {
|
||||
ws.onmessage = event => controller.enqueue(event.data);
|
||||
ws.onclose = () => controller.close();
|
||||
ws.onerror = () => controller.error(new Error("The WebSocket errored!"));
|
||||
},
|
||||
|
||||
cancel() {
|
||||
ws.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const writableStream = new WritableStream();
|
||||
|
||||
const webSocketStream = makeReadableWebSocketStream("wss://example.com:443/", "protocol");
|
||||
|
||||
webSocketStream.pipeTo(writableStream)
|
||||
.then(() => console.log("All data successfully written!"))
|
||||
.catch(e => console.error("Something went wrong!", e));
|
||||
}
|
||||
|
||||
|
||||
// 8.2. A readable stream with an underlying push source and backpressure support
|
||||
|
||||
function makeReadableBackpressureSocketStream(host: string, port: number) {
|
||||
const socket = createBackpressureSocket(host, port);
|
||||
|
||||
@@ -49,6 +68,9 @@ function makeReadableBackpressureSocketStream(host: string, port: number) {
|
||||
function createBackpressureSocket(host: string, port: number): any { };
|
||||
}
|
||||
|
||||
|
||||
// 8.3. A readable byte stream with an underlying push source (no backpressure support)
|
||||
|
||||
const DEFAULT_CHUNK_SIZE = 65536;
|
||||
|
||||
function makeUDPSocketStream(host: string, port: number) {
|
||||
@@ -93,7 +115,100 @@ function makeUDPSocketStream(host: string, port: number) {
|
||||
function createUDPSocket(host: string, port: number): any { };
|
||||
}
|
||||
|
||||
function makeWritableWebSocketStream(url: string, protocols: string[]) {
|
||||
|
||||
// 8.4. A readable stream with an underlying pull source
|
||||
|
||||
//const fs = require("pr/fs"); // https://github.com/jden/pr
|
||||
interface fs {
|
||||
open(path: string | Buffer, flags: string | number): Promise<number>;
|
||||
read(fd: number, buffer: Buffer, offset: number, length: number, position: number): Promise<number>;
|
||||
write(fd: number, buffer: Buffer, offset: number, length: number): Promise<number>;
|
||||
close(fd: number): Promise<void>;
|
||||
}
|
||||
let fs: fs;
|
||||
|
||||
{
|
||||
const CHUNK_SIZE = 1024;
|
||||
|
||||
function makeReadableFileStream(filename: string) {
|
||||
let fd: number;
|
||||
let position = 0;
|
||||
|
||||
return new ReadableStream({
|
||||
start() {
|
||||
return fs.open(filename, "r").then(result => {
|
||||
fd = result;
|
||||
});
|
||||
},
|
||||
|
||||
pull(controller) {
|
||||
const buffer = new ArrayBuffer(CHUNK_SIZE);
|
||||
|
||||
return fs.read(fd, <any> buffer, 0, CHUNK_SIZE, position).then(bytesRead => {
|
||||
if (bytesRead === 0) {
|
||||
return fs.close(fd).then(() => controller.close());
|
||||
} else {
|
||||
position += bytesRead;
|
||||
controller.enqueue(new Uint8Array(buffer, 0, bytesRead));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
cancel() {
|
||||
return fs.close(fd);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 8.5. A readable byte stream with an underlying pull source
|
||||
|
||||
{
|
||||
//const fs = require("pr/fs"); // https://github.com/jden/pr
|
||||
const DEFAULT_CHUNK_SIZE = 1024;
|
||||
|
||||
function makeReadableByteFileStream(filename: string) {
|
||||
let fd: number;
|
||||
let position = 0;
|
||||
|
||||
return new ReadableStream({
|
||||
type: "bytes",
|
||||
|
||||
start() {
|
||||
return fs.open(filename, "r").then(result => {
|
||||
fd = result;
|
||||
});
|
||||
},
|
||||
|
||||
pull(controller) {
|
||||
// Even when the consumer is using the default reader, the auto-allocation
|
||||
// feature allocates a buffer and passes it to us via byobRequest.
|
||||
const v = controller.byobRequest.view;
|
||||
|
||||
return fs.read(fd, <any> v.buffer, v.byteOffset, v.byteLength, position).then(bytesRead => {
|
||||
if (bytesRead === 0) {
|
||||
return fs.close(fd).then(() => controller.close());
|
||||
} else {
|
||||
position += bytesRead;
|
||||
controller.byobRequest.respond(bytesRead);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
cancel() {
|
||||
return fs.close(fd);
|
||||
},
|
||||
|
||||
autoAllocateChunkSize: DEFAULT_CHUNK_SIZE
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 8.6. A writable stream with no backpressure or success signals
|
||||
|
||||
function makeWritableWebSocketStream(url: string, protocols: string | string[]) {
|
||||
const ws = new WebSocket(url, protocols);
|
||||
|
||||
return new WritableStream({
|
||||
@@ -117,71 +232,123 @@ function makeWritableWebSocketStream(url: string, protocols: string[]) {
|
||||
});
|
||||
}
|
||||
|
||||
function streamifyWebSocket(url: string, protocol: string) {
|
||||
const ws = new WebSocket(url, protocol);
|
||||
ws.binaryType = "arraybuffer";
|
||||
{
|
||||
const readableStream = new ReadableStream();
|
||||
|
||||
return {
|
||||
readable: new ReadableStream(new WebSocketSource(ws)),
|
||||
writable: new WritableStream(new WebSocketSink(ws))
|
||||
};
|
||||
const webSocketStream = makeWritableWebSocketStream("wss://example.com:443/", "protocol");
|
||||
|
||||
readableStream.pipeTo(webSocketStream)
|
||||
.then(() => console.log("All data successfully written!"))
|
||||
.catch(e => console.error("Something went wrong!", e));
|
||||
}
|
||||
|
||||
class WebSocketSource implements ReadableStreamSource {
|
||||
private _ws: WebSocket
|
||||
|
||||
constructor(ws: WebSocket) {
|
||||
this._ws = ws;
|
||||
}
|
||||
// 8.7. A writable stream with backpressure and success signals
|
||||
|
||||
start(controller: ReadableStreamDefaultController) {
|
||||
this._ws.onmessage = event => controller.enqueue(event.data);
|
||||
this._ws.onclose = () => controller.close();
|
||||
{
|
||||
//const fs = require("pr/fs"); // https://github.com/jden/pr
|
||||
|
||||
this._ws.addEventListener("error", () => {
|
||||
controller.error(new Error("The WebSocket errored!"));
|
||||
function makeWritableFileStream(filename: string) {
|
||||
let fd: number;
|
||||
|
||||
return new WritableStream({
|
||||
start() {
|
||||
return fs.open(filename, "w").then(result => {
|
||||
fd = result;
|
||||
});
|
||||
},
|
||||
|
||||
write(chunk) {
|
||||
return fs.write(fd, chunk, 0, chunk.length);
|
||||
},
|
||||
|
||||
close() {
|
||||
return fs.close(fd);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cancel() {
|
||||
this._ws.close();
|
||||
}
|
||||
const fileStream = makeWritableFileStream("/example/path/on/fs.txt");
|
||||
const writer = fileStream.getWriter();
|
||||
|
||||
writer.write("To stream, or not to stream\n");
|
||||
writer.write("That is the question\n");
|
||||
|
||||
writer.close()
|
||||
.then(() => console.log("chunks written and stream closed successfully!"))
|
||||
.catch(e => console.error(e));
|
||||
}
|
||||
|
||||
class WebSocketSink implements WritableStreamSink {
|
||||
private _ws: WebSocket
|
||||
|
||||
constructor(ws: WebSocket) {
|
||||
this._ws = ws;
|
||||
// 8.8. A { readable, writable } stream pair wrapping the same underlying resource
|
||||
|
||||
{
|
||||
function streamifyWebSocket(url: string, protocol: string) {
|
||||
const ws = new WebSocket(url, protocol);
|
||||
ws.binaryType = "arraybuffer";
|
||||
|
||||
return {
|
||||
readable: new ReadableStream(new WebSocketSource(ws)),
|
||||
writable: new WritableStream(new WebSocketSink(ws))
|
||||
};
|
||||
}
|
||||
|
||||
start(controller: WritableStreamDefaultController) {
|
||||
this._ws.addEventListener("error", () => {
|
||||
controller.error(new Error("The WebSocket errored!"));
|
||||
});
|
||||
class WebSocketSource implements ReadableStreamSource {
|
||||
private _ws: WebSocket;
|
||||
|
||||
return new Promise<void>(resolve => this._ws.onopen = () => resolve());
|
||||
}
|
||||
constructor(ws: WebSocket) {
|
||||
this._ws = ws;
|
||||
}
|
||||
|
||||
write(chunk: any) {
|
||||
this._ws.send(chunk);
|
||||
}
|
||||
start(controller: ReadableStreamDefaultController) {
|
||||
this._ws.onmessage = event => controller.enqueue(event.data);
|
||||
this._ws.onclose = () => controller.close();
|
||||
|
||||
close() {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
this._ws.onclose = () => resolve();
|
||||
this._ws.addEventListener("error", () => {
|
||||
controller.error(new Error("The WebSocket errored!"));
|
||||
});
|
||||
}
|
||||
|
||||
cancel() {
|
||||
this._ws.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class WebSocketSink implements WritableStreamSink {
|
||||
private _ws: WebSocket;
|
||||
|
||||
constructor(ws: WebSocket) {
|
||||
this._ws = ws;
|
||||
}
|
||||
|
||||
start(controller: WritableStreamDefaultController) {
|
||||
this._ws.addEventListener("error", () => {
|
||||
controller.error(new Error("The WebSocket errored!"));
|
||||
});
|
||||
|
||||
return new Promise<void>(resolve => this._ws.onopen = () => resolve());
|
||||
}
|
||||
|
||||
write(chunk: any) {
|
||||
this._ws.send(chunk);
|
||||
}
|
||||
|
||||
close() {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
this._ws.onclose = () => resolve();
|
||||
this._ws.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const streamyWS = streamifyWebSocket("wss://example.com:443/", "protocol");
|
||||
const writer = streamyWS.writable.getWriter();
|
||||
const reader = streamyWS.readable.getReader();
|
||||
|
||||
writer.write("Hello");
|
||||
writer.write("web socket!");
|
||||
|
||||
reader.read().then(({ value, done }) => {
|
||||
console.log("The web socket says: ", value);
|
||||
});
|
||||
}
|
||||
|
||||
const streamyWS = streamifyWebSocket("wss://example.com:443/", "protocol");
|
||||
const writer = streamyWS.writable.getWriter();
|
||||
const reader = streamyWS.readable.getReader();
|
||||
|
||||
writer.write("Hello");
|
||||
writer.write("web socket!");
|
||||
|
||||
reader.read().then(({ value, done }) => {
|
||||
console.log("The web socket says: ", value);
|
||||
});
|
||||
2
wordcloud/index.d.ts
vendored
2
wordcloud/index.d.ts
vendored
@@ -47,7 +47,7 @@ declare namespace WordCloud {
|
||||
/** origin of the “cloud” in [x, y]. */
|
||||
origin?: [number, number];
|
||||
/** set to true to allow word being draw partly outside of the canvas. Allow word bigger than the size of the canvas to be drawn. */
|
||||
drawOutOfBounds?: boolean;
|
||||
drawOutOfBound?: boolean;
|
||||
|
||||
/** visualize the grid by draw squares to mask the drawn areas. */
|
||||
drawMask?: boolean;
|
||||
|
||||
Reference in New Issue
Block a user