From cfe2a21973c9851917035df55c9722692f545d84 Mon Sep 17 00:00:00 2001 From: Patricio Zavolinsky Date: Sat, 14 Jan 2017 15:21:58 +0000 Subject: [PATCH 001/140] React: add typed target for change events --- react/index.d.ts | 21 ++++++++++++++------- react/test/index.ts | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/react/index.d.ts b/react/index.d.ts index 2a5e737c58..e59234ae6c 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -270,10 +270,9 @@ declare namespace React { // // Event System // ---------------------------------------------------------------------- - - interface SyntheticEvent { + interface SyntheticEventBase { bubbles: boolean; - currentTarget: EventTarget & T; + currentTarget: EventTarget & CURRENT; cancelable: boolean; defaultPrevented: boolean; eventPhase: number; @@ -284,12 +283,16 @@ declare namespace React { stopPropagation(): void; isPropagationStopped(): boolean; persist(): void; - // If you thought this should be `EventTarget & T`, see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/12239 - target: EventTarget; + target: EventTarget & TARGET; timeStamp: Date; type: string; } + interface SyntheticEvent extends SyntheticEventBase { + // If you thought target should be `EventTarget & T`, + // see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/12239 + } + interface ClipboardEvent extends SyntheticEvent { clipboardData: DataTransfer; } @@ -309,6 +312,9 @@ declare namespace React { interface FormEvent extends SyntheticEvent { } + interface ChangeEvent extends SyntheticEventBase { + } + interface KeyboardEvent extends SyntheticEvent { altKey: boolean; charCode: number; @@ -391,6 +397,7 @@ declare namespace React { type DragEventHandler = EventHandler>; type FocusEventHandler = EventHandler>; type FormEventHandler = EventHandler>; + type ChangeEventHandler = EventHandler>; type KeyboardEventHandler = EventHandler>; type MouseEventHandler = EventHandler>; type TouchEventHandler = EventHandler>; @@ -458,7 +465,7 @@ declare namespace React { onBlurCapture?: FocusEventHandler; // Form Events - onChange?: FormEventHandler; + onChange?: ChangeEventHandler; onChangeCapture?: FormEventHandler; onInput?: FormEventHandler; onInputCapture?: FormEventHandler; @@ -2142,7 +2149,7 @@ declare namespace React { unselectable?: boolean; } - // this list is "complete" in that it contains every SVG attribute + // this list is "complete" in that it contains every SVG attribute // that React supports, but the types can be improved. // Full list here: https://facebook.github.io/react/docs/dom-elements.html // diff --git a/react/test/index.ts b/react/test/index.ts index ab23c65532..0900926cf6 100644 --- a/react/test/index.ts +++ b/react/test/index.ts @@ -672,3 +672,19 @@ class ConstructorSpreadArgsPureComponent extends React.PureComponent<{}, {}> { super(...args); } } + +// +// The SyntheticEvent.target.value should be accessible for onChange +// -------------------------------------------------------------------------- +class SyntheticEventTargetValue extends React.Component<{}, { value: string }> { + constructor(props:{}) { + super(props); + this.state = { value: 'a' }; + } + render() { + return React.DOM.textarea({ + value: this.state.value, + onChange: e => this.setState({value: e.target.value}) + }); + } +} From 696932988ba91464f1940d36f144103a92409a02 Mon Sep 17 00:00:00 2001 From: Alexander Trefz Date: Fri, 20 Jan 2017 05:51:07 +0100 Subject: [PATCH 002/140] Fix Headers.get of isomorphic-fetch (#14113) * Fix isomorphic-fetch IHeaders.get signature According to the specification, get can return null, so this should be explicit, since TS 2.0. * Remove trailing whitespace * Fix Lint --- backlog-js/index.d.ts | 18 ++--- isomorphic-fetch/index.d.ts | 88 +++++++++++----------- isomorphic-fetch/isomorphic-fetch-tests.ts | 38 +++++----- 3 files changed, 72 insertions(+), 72 deletions(-) diff --git a/backlog-js/index.d.ts b/backlog-js/index.d.ts index b15602f958..b548241e2f 100644 --- a/backlog-js/index.d.ts +++ b/backlog-js/index.d.ts @@ -23,9 +23,9 @@ declare class Request { method: string; path: string; params?: Params | FormData; - }): Promise; - checkStatus(response: IResponse): Promise; - parseJSON(response: IResponse): Promise; + }): Promise; + checkStatus(response: ResponseInterface): Promise; + parseJSON(response: ResponseInterface): Promise; private toFormData(params); private toQueryString(params); webAppBaseURL: string; @@ -49,7 +49,7 @@ export class Backlog extends Request { putSpaceNotification(params: Option.Space.PutSpaceNotificationParams): Promise; getSpaceDiskUsage(): Promise; getSpaceIcon(): Promise; - postSpaceAttachment(form: FormData): Promise; + postSpaceAttachment(form: FormData): Promise; getUsers(): Promise; getUser(userId: number): Promise; postUser(params: Option.User.PostUserParams): Promise; @@ -656,7 +656,7 @@ export namespace Error { private _status; private _body; private _response; - constructor(name: BacklogErrorNameType, response: IResponse, body?: { + constructor(name: BacklogErrorNameType, response: ResponseInterface, body?: { errors: BacklogErrorMessage[]; }); name: BacklogErrorNameType; @@ -665,20 +665,20 @@ export namespace Error { body: { errors: BacklogErrorMessage[]; }; - response: IResponse; + response: ResponseInterface; } export class BacklogApiError extends BacklogError { - constructor(response: IResponse, body?: { + constructor(response: ResponseInterface, body?: { errors: BacklogErrorMessage[]; }); } export class BacklogAuthError extends BacklogError { - constructor(response: IResponse, body?: { + constructor(response: ResponseInterface, body?: { errors: BacklogErrorMessage[]; }); } export class UnexpectedError extends BacklogError { - constructor(response: IResponse); + constructor(response: ResponseInterface); } export interface BacklogErrorMessage { message: string; diff --git a/isomorphic-fetch/index.d.ts b/isomorphic-fetch/index.d.ts index 41b63970b3..452e95e871 100644 --- a/isomorphic-fetch/index.d.ts +++ b/isomorphic-fetch/index.d.ts @@ -1,12 +1,12 @@ -// Type definitions for isomorphic-fetch +// Type definitions for isomorphic-fetch 0.0 // Project: https://github.com/matthew-andrews/isomorphic-fetch // Definitions by: Todd Lucas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -type RequestType = "" | "audio" | "font" | "image" | "script" | "style" | +type RequestType = "" | "audio" | "font" | "image" | "script" | "style" | "track" | "video"; -type RequestDestination = "" | "document" | "embed" | "font" | "image" | - "manifest" | "media" | "object" | "report" | "script" | "serviceworker" | +type RequestDestination = "" | "document" | "embed" | "font" | "image" | + "manifest" | "media" | "object" | "report" | "script" | "serviceworker" | "sharedworker" | "style" | "worker" | "xslt"; type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors"; type RequestCredentials = "omit" | "same-origin" | "include"; @@ -15,44 +15,44 @@ type RequestCache = "only-if-cached"; type RequestRedirect = "follow" | "error" | "manual"; -type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | +type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"; -type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | - "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | +type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | + "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; -interface IHeaders { +interface HeadersInterface { append(name: string, value: string): void; delete(name: string): void; - get(name: string): string; - getAll(name: string): Array; + get(name: string): string | null; + getAll(name: string): string[]; has(name: string): boolean; set(name: string, value: string): void; // TODO: iterable; - forEach(callback: (value: string, index: number, headers: IHeaders) => void, thisArg?: any): void; + forEach(callback: (value: string, index: number, headers: HeadersInterface) => void, thisArg?: any): void; // NOTE: The following are supported by whatwg-fetch but not node-fetch. // entries(): IterableIterator<[string, string]>; // keys(): IterableIterator; - // values(): IterableIterator; + // values(): IterableIterator; } -type HeadersInit = Headers | Array | { [index: string]: string }; +type HeadersInit = Headers | string[] | { [index: string]: string }; -declare class Headers implements IHeaders { +declare class Headers implements HeadersInterface { constructor(init?: HeadersInit); append(name: string, value: string): void; delete(name: string): void; - get(name: string): string; - getAll(name: string): Array; + get(name: string): string | null; + getAll(name: string): string[]; has(name: string): boolean; set(name: string, value: string): void; - forEach(callback: (value: string, index: number, headers: IHeaders) => void, thisArg?: any): void; + forEach(callback: (value: string, index: number, headers: HeadersInterface) => void, thisArg?: any): void; } -interface IBody { +interface BodyInterface { bodyUsed: boolean; arrayBuffer(): Promise; blob(): Promise; @@ -62,7 +62,7 @@ interface IBody { text(): Promise; } -declare class Body implements IBody { +declare class Body implements BodyInterface { bodyUsed: boolean; arrayBuffer(): Promise; blob(): Promise; @@ -72,22 +72,22 @@ declare class Body implements IBody { text(): Promise; } -interface IRequest extends IBody { +interface RequestInterface extends BodyInterface { method: string; url: string; - headers: IHeaders; + headers: HeadersInterface; type: RequestType; destination: RequestDestination; referrer?: string; - referrerPolicy?: ReferrerPolicy; + referrerPolicy?: ReferrerPolicy; mode: RequestMode; credentials: RequestCredentials; cache: RequestCache; redirect?: RequestRedirect; integrity?: string; - - clone(): IRequest; + + clone(): RequestInterface; } type BodyInit = Blob | ArrayBufferView | ArrayBuffer | FormData /* | URLSearchParams */ | string; @@ -97,7 +97,7 @@ interface RequestInit { headers?: HeadersInit; body?: BodyInit; referrer?: string; - referrerPolicy?: ReferrerPolicy; + referrerPolicy?: ReferrerPolicy; mode?: RequestMode; credentials?: RequestCredentials; cache?: RequestCache; @@ -106,29 +106,29 @@ interface RequestInit { window?: any; // can only be set to null } -type RequestInfo = IRequest | string; +type RequestInfo = RequestInterface | string; -declare class Request extends Body implements IRequest { +declare class Request extends Body implements RequestInterface { constructor(input: RequestInfo, init?: RequestInit); - + method: string; url: string; - headers: IHeaders; + headers: HeadersInterface; - type: RequestType + type: RequestType; destination: RequestDestination; referrer: string; - referrerPolicy: ReferrerPolicy; + referrerPolicy: ReferrerPolicy; mode: RequestMode; credentials: RequestCredentials; cache: RequestCache; redirect: RequestRedirect; integrity: string; - clone(): IRequest; + clone(): RequestInterface; } -interface IResponse extends IBody { +interface ResponseInterface extends BodyInterface { type: ResponseType; url: string; @@ -136,13 +136,13 @@ interface IResponse extends IBody { status: number; statusText: string; ok: boolean; - headers: IHeaders; + headers: HeadersInterface; // size: number; // timeout: number; body: any; - trailer: Promise; + trailer: Promise; - clone(): IResponse; + clone(): ResponseInterface; } type ResponseBodyInit = BodyInit; @@ -153,28 +153,28 @@ interface ResponseInit { headers?: HeadersInit; } -declare class Response extends Body implements IResponse { +declare class Response extends Body implements ResponseInterface { constructor(body?: ResponseBodyInit, init?: ResponseInit); - static redirect(url: string, status?: number): IResponse; - static error(): IResponse; + static redirect(url: string, status?: number): ResponseInterface; + static error(): ResponseInterface; - type: ResponseType + type: ResponseType; url: string; redirected: boolean; status: number; statusText: string; ok: boolean; - headers: IHeaders; + headers: HeadersInterface; body: any; - trailer: Promise; + trailer: Promise; - clone(): IResponse; + clone(): ResponseInterface; } interface Window { - fetch(url: RequestInfo, init?: RequestInit): Promise; + fetch(url: RequestInfo, init?: RequestInit): Promise; } declare var fetch: typeof window.fetch; diff --git a/isomorphic-fetch/isomorphic-fetch-tests.ts b/isomorphic-fetch/isomorphic-fetch-tests.ts index 2457a9b39b..78f0da930a 100644 --- a/isomorphic-fetch/isomorphic-fetch-tests.ts +++ b/isomorphic-fetch/isomorphic-fetch-tests.ts @@ -4,9 +4,9 @@ import * as fetchImportedViaES6Module from 'isomorphic-fetch'; function test_isomorphicFetchTestCases_ambient() { expectSuccess(fetch('http://localhost:3000/good'), 'Good response'); - + fetch('http://localhost:3000/bad') - .then((response: IResponse) => { + .then((response: ResponseInterface) => { return response.text(); }) .catch((err) => { @@ -15,9 +15,9 @@ function test_isomorphicFetchTestCases_ambient() { function test_isomorphicFetchTestCases_commonjs() { expectSuccess(fetchImportedViaCommonJS('http://localhost:3000/good'), 'Good response'); - + fetchImportedViaCommonJS('http://localhost:3000/bad') - .then((response: IResponse) => { + .then((response: ResponseInterface) => { return response.text(); }) .catch((err) => { @@ -26,9 +26,9 @@ function test_isomorphicFetchTestCases_commonjs() { function test_isomorphicFetchTestCases_es6() { expectSuccess(fetchImportedViaES6Module('http://localhost:3000/good'), 'Good response'); - + fetchImportedViaES6Module('http://localhost:3000/bad') - .then((response: IResponse) => { + .then((response: ResponseInterface) => { return response.text(); }) .catch((err) => { @@ -48,16 +48,16 @@ function test_whatwgTestCases_ambient() { }; expectSuccess(fetch('http://localhost:3000/poster', requestOptions), 'Post response:'); - + var requestOptions: RequestInit = { method: "POST", headers: { 'Content-Type': 'application/json' } }; - + expectSuccess(fetch('http://localhost:3000/poster', requestOptions), 'Post response:'); - + var requestOptions: RequestInit = { method: "POST", headers: { @@ -68,7 +68,7 @@ function test_whatwgTestCases_ambient() { expectSuccess(fetch(request), 'Post response:'); } - + function test_whatwgTestCases_commonjs() { var headers = new Headers(); headers.append("Content-Type", "application/json"); @@ -81,16 +81,16 @@ function test_whatwgTestCases_commonjs() { }; expectSuccess(fetchImportedViaCommonJS('http://localhost:3000/poster', requestOptions), 'Post response:'); - + var requestOptions: RequestInit = { method: "POST", headers: { 'Content-Type': 'application/json' } }; - + expectSuccess(fetchImportedViaCommonJS('http://localhost:3000/poster', requestOptions), 'Post response:'); - + var requestOptions: RequestInit = { method: "POST", headers: { @@ -114,16 +114,16 @@ function test_whatwgTestCases_es6() { }; expectSuccess(fetchImportedViaES6Module('http://localhost:3000/poster', requestOptions), 'Post response:'); - + var requestOptions: RequestInit = { method: "POST", headers: { 'Content-Type': 'application/json' } }; - + expectSuccess(fetchImportedViaES6Module('http://localhost:3000/poster', requestOptions), 'Post response:'); - + var requestOptions: RequestInit = { method: "POST", headers: { @@ -134,9 +134,9 @@ function test_whatwgTestCases_es6() { expectSuccess(fetchImportedViaES6Module(request), 'Post response:'); } - -function expectSuccess(promise: Promise, responseText: string) { - promise.then((response: IResponse) => { + +function expectSuccess(promise: Promise, responseText: string) { + promise.then((response: ResponseInterface) => { return response.text(); }) .then((text: string) => { From 0b6077514219b1f530ca10869bb8e91b95d5be03 Mon Sep 17 00:00:00 2001 From: Shun Takahashi Date: Thu, 19 Jan 2017 20:52:18 -0800 Subject: [PATCH 003/140] Add strong-cluster-control typing files (#14128) --- strong-cluster-control/index.d.ts | 98 +++++++++++++++++++ .../strong-cluster-control-tests.ts | 30 ++++++ strong-cluster-control/tsconfig.json | 20 ++++ strong-cluster-control/tslint.json | 1 + 4 files changed, 149 insertions(+) create mode 100644 strong-cluster-control/index.d.ts create mode 100644 strong-cluster-control/strong-cluster-control-tests.ts create mode 100644 strong-cluster-control/tsconfig.json create mode 100644 strong-cluster-control/tslint.json diff --git a/strong-cluster-control/index.d.ts b/strong-cluster-control/index.d.ts new file mode 100644 index 0000000000..e0bb92b82f --- /dev/null +++ b/strong-cluster-control/index.d.ts @@ -0,0 +1,98 @@ +// Type definitions for strong-cluster-control 2.2 +// Project: https://github.com/strongloop/strong-cluster-control +// Definitions by: Shun Takahashi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + +declare namespace StrongClusterControl { + type pid = number; + + export interface StartOptions { + size?: number; + env?: {}; + shutdownTimeout?: number; + terminateTimeout?: number; + throttleDelay?: number; + } + + export interface ClusterMaster { + pid: number; + setSize?: number; + startTime: number; + } + + export interface ClusterWorker extends ClusterMaster { + id: number; + } + + export interface ClusterStatus { + master: ClusterMaster; + workers: ClusterWorker[]; + } + + interface CMD { + SHUTDOWN: "CLUSTER_CONTROL_shutdown"; + } + + export interface Control extends NodeJS.EventEmitter { + readonly cmd: CMD; + readonly CPUS: number; + readonly options: StartOptions; + + /** + * @description Start the controller + * @param [options] - An options object, no default, and options object is not required. + * @param [options.size] - Number of workers that should be running, the default is to not control the number of workers + * @param [options.env=null] - Environment properties object passed to cluster.fork() if the controller has to start a worker to resize the cluster, default is null. + * @param [options.shutdownTimeout=5000] - Number of milliseconds to wait after shutdown before terminating a worker, the default is 5 seconds + * @param [options.terminateTimeout=5000] - Number of milliseconds to wait after terminate before killing a worker, the default is 5 seconds + * @param [options.throttoleDelay] - Number of milliseconds to delay restarting workers after they are exiting abnormally. Abnormal is defined as as not suicide. + */ + start(options?: StartOptions, callback?: () => any): this; + start(callback?: () => any): this; + + /** + * @description Stop the controller, after stopping workers (if the size is being controlled, see setSize()). + * @param callback + */ + stop(callback?: () => any): this; + + /** + * @description Restart workers one by one, until all current workers have been restarted. + */ + restart(): this; + + /** + * @description Returns the current cluster status + */ + status(): ClusterStatus; + + /** + * @description Set the size of the cluster. + * @param N - The size of the cluster is the number of workers that should be maintained online. + */ + setSize(N?: number): this; + + /** + * @description Disconnect worker id and take increasingly agressive action until it exits. + * @param id - Cluster worker ID, + */ + shutdown(id: number): this; + + /** + * @description Disconnect worker id and take increasingly agressive action until it exits. + * @param id - Cluster worker ID, + */ + terminate(id: number): this; + + on(event: "start" | "stop" | "restart", handler: () => any): this; + on(event: "setSize" | "resize", handler: (size: number) => any): this; + on(event: "startWorker", handler: (worker: ClusterWorker) => any): this; + on(event: "startRestart", handler: (workers: pid[]) => any): this; + on(event: "stopWorker", handler: (worker: ClusterWorker, code: number, signal: string) => any): this; + on(event: "error", handler: (error: Error | Error[]) => any): this; + } +} + +declare const control: StrongClusterControl.Control; +export = control; diff --git a/strong-cluster-control/strong-cluster-control-tests.ts b/strong-cluster-control/strong-cluster-control-tests.ts new file mode 100644 index 0000000000..9fefd005b8 --- /dev/null +++ b/strong-cluster-control/strong-cluster-control-tests.ts @@ -0,0 +1,30 @@ +import * as control from "strong-cluster-control"; + +control.start({ size: control.CPUS}, (): void => { console.log("starting"); }) + .on("error", (err: Error): void => { + console.error(err); + }); + +control.start((): void => { console.log("staring"); }) + .on("error", (err: Error): void => { + console.error(err); + }); + +control.stop() + .on("stop", (): void => { + console.log("stopped"); + }); + +control.setSize(2) + .on("setSize", (size) => console.log(size)) + .on("resize", (size) => console.log(size)); + +control.restart() + .on("startRestart", (pids) => console.log(`Restarting ${pids.length} workers`)) + .on("restart", () => console.log("restarted")); + +control.shutdown(123) + .on("stopWorker", (worker) => console.log(`Worker ${worker.pid} stopped`)); + +control.terminate(123) + .on("stopWorker", (worker) => console.log(`Worker ${worker.pid} stopped`)); diff --git a/strong-cluster-control/tsconfig.json b/strong-cluster-control/tsconfig.json new file mode 100644 index 0000000000..3623adaea2 --- /dev/null +++ b/strong-cluster-control/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "strong-cluster-control-tests.ts" + ] +} diff --git a/strong-cluster-control/tslint.json b/strong-cluster-control/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/strong-cluster-control/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From ab1f759aa100aa31585ee882f4a19f4b0f49d365 Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Fri, 20 Jan 2017 00:05:02 -0500 Subject: [PATCH 004/140] Add route-parser type declarations (#14013) --- route-parser/index.d.ts | 39 ++++++++++++++++++++++++++++++ route-parser/route-parser-tests.ts | 5 ++++ route-parser/tsconfig.json | 20 +++++++++++++++ route-parser/tslint.json | 3 +++ 4 files changed, 67 insertions(+) create mode 100644 route-parser/index.d.ts create mode 100644 route-parser/route-parser-tests.ts create mode 100644 route-parser/tsconfig.json create mode 100644 route-parser/tslint.json diff --git a/route-parser/index.d.ts b/route-parser/index.d.ts new file mode 100644 index 0000000000..2f5dd84e8d --- /dev/null +++ b/route-parser/index.d.ts @@ -0,0 +1,39 @@ +// Type definitions for route-parser 0.0 +// Project: https://github.com/rcs/route-parser +// Definitions by: Ian Ker-Seymer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class Route { + /** + * Represents a route + * @example + * var route = new Route('/:foo/:bar'); + * @example + * var route = new Route('/:foo/:bar'); + */ + constructor(spec: string); + + /** + * Match a path against this route, returning the matched parameters if + * it matches, false if not. + * @example + * var route = new Route('/this/is/my/route') + * route.match('/this/is/my/route') // -> {} + * @example + * var route = new Route('/:one/:two') + * route.match('/foo/bar/') // -> {one: 'foo', two: 'bar'} + */ + match(pathname: string): { [i: string]: string } | boolean; + + /** + * Reverse a route specification to a path, returning false if it can't be + * fulfilled + * @example + * var route = new Route('/:one/:two') + * route.reverse({one: 'foo', two: 'bar'}) -> '/foo/bar' + */ + reverse(params: { [i: string]: any } ): string | boolean; +} + +declare namespace Route {} +export = Route; diff --git a/route-parser/route-parser-tests.ts b/route-parser/route-parser-tests.ts new file mode 100644 index 0000000000..e521008291 --- /dev/null +++ b/route-parser/route-parser-tests.ts @@ -0,0 +1,5 @@ +import * as Route from 'route-parser'; + +const route = new Route('/users/:id'); +const matched = route.match('/users/42'); // => { id: '42' } +const reversed = route.reverse({ id: 42 }); diff --git a/route-parser/tsconfig.json b/route-parser/tsconfig.json new file mode 100644 index 0000000000..6f14fe510c --- /dev/null +++ b/route-parser/tsconfig.json @@ -0,0 +1,20 @@ +{ + "files": [ + "index.d.ts", + "route-parser-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/route-parser/tslint.json b/route-parser/tslint.json new file mode 100644 index 0000000000..192203ab54 --- /dev/null +++ b/route-parser/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} \ No newline at end of file From db23448a5d67585098041dd585ddca1db5fe42bf Mon Sep 17 00:00:00 2001 From: Linda_pp Date: Fri, 20 Jan 2017 14:50:30 +0900 Subject: [PATCH 005/140] Add 'jump.js' module (#14129) --- jump.js/index.d.ts | 16 ++++++++++++++++ jump.js/jump.js-tests.ts | 16 ++++++++++++++++ jump.js/tsconfig.json | 20 ++++++++++++++++++++ jump.js/tslint.json | 1 + 4 files changed, 53 insertions(+) create mode 100644 jump.js/index.d.ts create mode 100644 jump.js/jump.js-tests.ts create mode 100644 jump.js/tsconfig.json create mode 100644 jump.js/tslint.json diff --git a/jump.js/index.d.ts b/jump.js/index.d.ts new file mode 100644 index 0000000000..fdef97c712 --- /dev/null +++ b/jump.js/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for jump.js 1.0 +// Project: https://github.com/callmecavs/jump.js +// Definitions by: rhysd +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare type TransitionFunc = (t: number, b: number, c: number, d: number) => number; +declare interface JumpOptions { + duration?: number; + offset?: number; + callback?: () => void; + easing?: TransitionFunc; + a11y?: boolean; +} +declare type Jump = (target: string | Element | number, opts?: JumpOptions) => void; +declare const jump: Jump; +export = jump; diff --git a/jump.js/jump.js-tests.ts b/jump.js/jump.js-tests.ts new file mode 100644 index 0000000000..4ae48074b2 --- /dev/null +++ b/jump.js/jump.js-tests.ts @@ -0,0 +1,16 @@ +import jump = require('jump.js'); + +const node = document.querySelector('.target'); +jump(node); +jump('.target'); +jump('.target', { + duration: 1000, +}); +jump('.target', { + duration: 200, + offset: 10 +}); +jump(100); +jump(-100, { + callback: () => { console.log('Done!') } +}); diff --git a/jump.js/tsconfig.json b/jump.js/tsconfig.json new file mode 100644 index 0000000000..0c6ab6d7c8 --- /dev/null +++ b/jump.js/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jump.js-tests.ts" + ] +} diff --git a/jump.js/tslint.json b/jump.js/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/jump.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 567657e3fab839bdeb535ea23c6593cbc8ce7588 Mon Sep 17 00:00:00 2001 From: Kir Dergachev Date: Thu, 19 Jan 2017 15:29:50 +0300 Subject: [PATCH 006/140] Added types for SIP.js --- SIP.js/SIP.js-tests.ts | 99 ++++++++++++ SIP.js/index.d.ts | 354 +++++++++++++++++++++++++++++++++++++++++ SIP.js/tsconfig.json | 23 +++ SIP.js/tslint.json | 1 + 4 files changed, 477 insertions(+) create mode 100644 SIP.js/SIP.js-tests.ts create mode 100644 SIP.js/index.d.ts create mode 100644 SIP.js/tsconfig.json create mode 100644 SIP.js/tslint.json diff --git a/SIP.js/SIP.js-tests.ts b/SIP.js/SIP.js-tests.ts new file mode 100644 index 0000000000..f688fe67ae --- /dev/null +++ b/SIP.js/SIP.js-tests.ts @@ -0,0 +1,99 @@ +import SIP = require("./index"); + +let ua: SIP.UA = new SIP.UA(); + +const mediaHandler = (session: SIP.Session, options: SIP.WebRTC.Options) => new SIP.WebRTC.MediaHandler(); +const logConnector = (level: string, category: string, label: string, content: string) => null; + +const uaWithConfig: SIP.UA = new SIP.UA({ + uri: "wss://uri", + wsServers: ["s1", "s2"], + allowLegacyNotifications: true, + authenticationFactory: mediaHandler, + authorizationUser: "user", + autostart: true, + connectionRecoveryMaxInterval: 1, + connectionRecoveryMinInterval: 1, + displayName: "name", + hackCleanJitsiSdpImageattr: true, + hackStripTcp: true, + hackIpInContact: true, + hackViaTcp: true, + hackWssInTransport: true, + iceCheckingTimeout: 1, + instanceId: "id", + log: { + builtinEnabled: true, + level: 1, + connector: logConnector + }, + mediaHandlerFactory: mediaHandler, + noAnswerTimeout: 1, + password: "", + register: true, + registerExpires: 1, + registrarServer: "sip:registrar.mydomain.com", + rel100: "", + replaces: "", + stunServers: ["", ""], + turnServers: [ + { + password: "", + username: "", + urls: ["", ""] + } + ], + usePreloadedRoute: true, + userAgentString: "", + wsServerMaxReconnection: 1, + wsServerReconnectionTimeout: 1 +}); + +ua.start(); +ua.stop(); + +ua.register(); +ua = ua.register({ extraHeaders: [""] }); + +ua.unregister() +ua.unregister({ extraHeaders: [""], all: true }); + +const isConnected: boolean = ua.isConnected(); +const isRegistered: boolean = ua.isRegistered(); + +const message: SIP.Message = ua.message("", "", { contentType: "" }); + +ua.subscribe("", "", { expires: 1, extraHeaders: [""]}); +const subscription: SIP.Subscription = ua.subscribe(new SIP.URI(), "", { expires: 1, extraHeaders: [""]}); + +let session = ua.invite("", new HTMLVideoElement()); + +const inviteOptions: SIP.InviteOptions = { + media: { + constraints: { audio: true, video: false }, + stream: new MediaStream(), + render: { remote: new Element(), local: new Element() }, + }, + anonymous: true, + rel100: "", + inviteWithoutSdp: true, + RTCConstraints: new RTCPeerConnection() +} + +session = ua.invite("", inviteOptions); + +ua.on('connected', (args: SIP.UA.EventArgs.ConnectedArgs) => {}); +ua.on('disconnected', () => {}); +ua.on('registered', () => {}); +ua.on('unregistered', (args: SIP.UA.EventArgs.UnregisteredArgs) => {}); +ua.on('registrationFailed', (args: SIP.UA.EventArgs.RegistrationFailedArgs) => {}); +ua.on('invite', (session: SIP.Session) => { + session.on('progress', (response) => { + }); + session.on('accepted', (response) => { + }); + session.on('rejected', (response) => { + }); + +}); +ua.on('message', (message: SIP.Message) => {}); diff --git a/SIP.js/index.d.ts b/SIP.js/index.d.ts new file mode 100644 index 0000000000..0eaabb9b48 --- /dev/null +++ b/SIP.js/index.d.ts @@ -0,0 +1,354 @@ +// Type definitions for SIP.js v0.7.6 +// Project: https://sipjs.com/ +// Definitions by: Kir Dergachev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = SIP; + +declare namespace SIP { + + class URI { + constructor( + scheme?: string, + user?: string, + host?: string, + port?: number, + parameters?: string[], + headers?: string[]); + + scheme?: string; + user?: string; + host?: string; + port?: number; + + setParam(key: string, value?: string): void; + getParam(key: string): string; + hasParam(key: string): string; + deleteParam(key: string): string; + clearParams(): void; + setHeader(name: string, value: string): void; + getHeader(name: string): string[]; + hasHeader(name: string): boolean; + deleteHeader(name: string): string[]; + clearHeaders(): void; + clone(): URI; + toString(): string; + + static parse(uri: string): URI; + } + + namespace UA.EventArgs { + interface ConnectedArgs { attempts: number } + interface UnregisteredArgs { response: string; cause: string; } + interface RegistrationFailedArgs extends UnregisteredArgs { } + } + + class UA { + constructor(configuration?: ConfigurationParameters); + start(): void; + stop(): void; + register(options?: ExtraHeadersOptions): UA; + unregister(options?: UnregisterOptions): void; + isRegistered(): boolean; + isConnected(): boolean; + message(target: string | URI, body: string, options?: MessageOptions): Message; + subscribe(target: string | URI, event: string, options?: SubscribeOptions): Subscription; + invite(target: string | URI, options?: InviteOptions): Session; + invite(target: string | URI, element?: HTMLAudioElement | HTMLVideoElement): Session; + request(method: string, target: string | URI, options?: RequestOptions): ClientContext; + + on(name: 'connected', callback: (args: UA.EventArgs.ConnectedArgs) => void): void; + on(name: 'disconnected' | 'registered', callback: () => void): void; + on(name: 'unregistered', callback: (args: UA.EventArgs.UnregisteredArgs) => void): void; + on(name: 'registrationFailed', callback: (args: UA.EventArgs.RegistrationFailedArgs) => void): void; + on(name: 'invite', callback: (session: Session) => void): void; + on(name: 'message', callback: (message: Message) => void): void; + } + + namespace UA.C { + class supported { + REQUIRED: string; + SUPPORTED: string; + UNSUPPORTED: string; + } + + class causes { + INVALID_TARGET: string; + CONNECTION_ERROR: string; + REQUEST_TIMEOUT: string; + SIP_FAILURE_CODE: string; + } + } + + class Session { + startTime?: Date; + endTime?: Date; + ua?: UA; + method?: string; + mediaHandler?: WebRTC.MediaHandler; + request?: IncomingRequest | OutgoingRequest; + localIdentity?: NameAddrHeader; + remoteIdentity?: NameAddrHeader; + data: ClientContext | ServerContext; + + dtmf(tone: string | number, options?: Session.DtmfOptions): Session; + terminate(options?: Session.CommonOptions): Session; + bye(options?: Session.CommonOptions): Session; + getLocalStreams(): MediaStream[]; + getRemoteStreams(): MediaStream[]; + refer(target: string | Session, options?: ExtraHeadersOptions): Session; + mute(options?: ExtraHeadersOptions): void; + unmute(options?: ExtraHeadersOptions): void; + cancel(options?: Session.CommonOptions): void; + progress(options?: Session.ProgressOptions): void; + accept(options?: Session.AcceptOptions): void; + reject(options?: Session.CommonOptions): void; + reply(options?: Session.CommonOptions): void; + followRefer(callback: Function): void; + + on(name: 'progress', callback: (response: IncomingResponse) => void): void; + on(name: 'accepted', callback: (data: { code: number, response: IncomingResponse }) => void): void; + on(name: 'rejected', callback: (response: IncomingResponse, cause: string) => void): void; + on(name: 'failed', callback: (response: IncomingResponse, cause: string) => void): void; + on(name: 'terminated', callback: (message: IncomingResponse, cause: string) => void): void; + on(name: 'refer', callback: (request: IncomingRequest) => void): void; + on(name: 'cancel', callback: () => void): void; + on(name: 'replaced', callback: (newSession: Session) => void): void; + on(name: 'dtmf', callback: (request: IncomingRequest, dtmf: Session.DTMF) => void): void; + on(name: 'muted', callback: (data: Session.Muted) => void): void; + on(name: 'unmuted', callback: (data: Session.Muted) => void): void; + on(name: 'bye', callback: (request: IncomingRequest) => void): void; + } + + namespace Session { + interface DtmfOptions extends ExtraHeadersOptions { + duration?: number; + interToneGap?: number; + } + + interface CommonOptions extends ExtraHeadersOptions { + status_code?: number; + reason_phrase?: string; + body?: string; + } + + interface ProgressOptions extends ExtraHeadersOptions { + rel100?: boolean; + media?: MediaConstraints; + } + + interface AcceptOptions { + RTCConstraints?: RTCPeerConnection; + media?: MediaOptions; + } + + interface DTMF { + } + + interface Muted { + audio?: boolean; + video?: boolean + } + } + + interface RenderHint { + remote?: Element; + local?: Element + } + + interface MediaConstraints { + audio: boolean; + video: boolean; + } + + interface TurnServer { + urls?: string | string[]; + username?: string; + password?: string; + } + + namespace WebRTC { + + interface Options { + stunServers?: string | string[]; + turnServers?: TurnServer | TurnServer[]; + RTCConstraints?: RTCPeerConnection; + } + + type MediaHandlerFactory = (session: Session, options: Options) => MediaHandler; + + class MediaHandler { + getLocalStreams(): MediaStream[]; + getRemoteStreams(): MediaStream[]; + render(renderHint: RenderHint): void; + + on(name: 'userMediaRequest', callback: (constraints: MediaConstraints) => void): void; + on(name: 'userMedia', callback: (stream: MediaStream) => void): void; + on(name: 'userMediaFailed', callback: (error: string) => void): void; + on(name: 'iceGathering', callback: () => void): void; + on(name: 'iceCandidate', callback: (candidate: RTCIceCandidate) => void): void; + on(name: 'iceGatheringComplete', callback: () => void): void; + on(name: 'iceConnection', callback: () => void): void; + on(name: 'iceConnectionChecking', callback: () => void): void; + on(name: 'iceConnectionConnected', callback: () => void): void; + on(name: 'iceConnectionCompleted', callback: () => void): void; + on(name: 'iceConnectionFailed', callback: () => void): void; + on(name: 'iceConnectionDisconnected', callback: () => void): void; + on(name: 'iceConnectionClosed', callback: () => void): void; + on(name: 'getDescription', callback: (sdpWrapper: { type: string, sdp: string }) => void): void; + on(name: 'setDescription', callback: (sdpWrapper: { type: string, sdp: string }) => void): void; + on(name: 'dataChannel', callback: () => void): void; + on(name: 'addStream', callback: (stream: MediaStream) => void): void; + } + } + + /* Parameters */ + interface ConfigurationParameters { + uri?: string; + wsServers?: string | string[] | { ws_uri: string; weigth: number }[]; + allowLegacyNotifications?: boolean; + authenticationFactory?: WebRTC.MediaHandlerFactory; + authorizationUser?: string; + autostart?: boolean; + connectionRecoveryMaxInterval?: number; + connectionRecoveryMinInterval?: number; + displayName?: string; + hackCleanJitsiSdpImageattr?: boolean; + hackStripTcp?: boolean; + hackIpInContact?: boolean; + hackViaTcp?: boolean; + hackWssInTransport?: boolean; + iceCheckingTimeout?: number; + instanceId?: string; + log?: { + builtinEnabled?: boolean; + level?: number | string; + connector?: (level: string, category: string, label: string, content: string) => void; + }; + mediaHandlerFactory?: WebRTC.MediaHandlerFactory; + noAnswerTimeout?: number; + password?: string; + register?: boolean; + registerExpires?: number; + registrarServer?: string; + rel100?: string; + replaces?: string; + stunServers?: string | string[]; + traceSip?: boolean; + turnServers?: TurnServer | TurnServer[]; + usePreloadedRoute?: boolean; + userAgentString?: string; + wsServerMaxReconnection?: number; + wsServerReconnectionTimeout?: number; + } + + /* Options */ + interface ExtraHeadersOptions { + extraHeaders?: string[]; + } + + interface UnregisterOptions extends ExtraHeadersOptions { + all?: boolean; + } + + interface MessageOptions extends ExtraHeadersOptions { + contentType?: string; + } + + interface SubscribeOptions extends ExtraHeadersOptions { + expires?: number; + } + + interface MediaOptions { + constraints?: MediaConstraints; + stream?: MediaStream; + render?: RenderHint; + } + + interface InviteOptions extends ExtraHeadersOptions { + media?: MediaOptions; + anonymous?: boolean; + rel100?: string; + inviteWithoutSdp?: boolean; + RTCConstraints?: RTCPeerConnection; + } + + interface RequestOptions extends ExtraHeadersOptions { + body?: string; + } + + /* Contexts */ + interface Message extends ClientContext { + body: string; + } + + interface Subscription extends ClientContext { + id: string; + state: string; + event: string; + dialog: string; + timers: Object; + errorCodes: number[]; + subscribe(): Subscription; + unsubscribe(): void; + close(): void; + } + + /* Context */ + interface Context { + ua: UA; + method: string; + request: OutgoingRequest; + localIdentity: NameAddrHeader; + remoteIdentity: NameAddrHeader; + data: {}; + + on(name: 'progress', callback: (response: IncomingMessage, cause: string) => void): void; + on(name: 'accepted', callback: (response: IncomingMessage, cause: string) => void): void; + on(name: 'rejected', callback: (response: IncomingMessage, cause: string) => void): void; + on(name: 'failed', callback: (response: IncomingMessage, cause: string) => void): void; + on(name: 'notify', callback: (request: IncomingRequest) => void): void; + } + + interface ClientContext extends Context { + cancel(options?: { status_code?: number, reason_phrase?: string }): ClientContext; + } + + interface ServerContext extends Context { + progress(options?: Session.ProgressOptions): void; + accept(options?: Session.AcceptOptions): void; + reject(options?: Session.CommonOptions): void; + reply(options?: Session.CommonOptions): void; + } + + /* Request */ + interface Request extends Context { + } + + interface IncomingRequest extends Request { + } + + interface OutgoingRequest extends Request { + } + + interface IncomingResponse extends Request { + } + + interface IncomingMessage extends Request { + } + + /* Header */ + class NameAddrHeader { + constructor(uri: string | URI, displayName: string, parameters: { key: string, value: string }[]); + + uri: string | URI; + displayName: string; + + setParam(key: string, value?: string): void; + getParam(key: string): string; + deleteParam(key: string): string; + clearParams(): void; + + static parse(name_addr_header: string): NameAddrHeader; + } +} diff --git a/SIP.js/tsconfig.json b/SIP.js/tsconfig.json new file mode 100644 index 0000000000..93cce57ffb --- /dev/null +++ b/SIP.js/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": ["webrtc"], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "SIP.js-tests.ts" + ] +} diff --git a/SIP.js/tslint.json b/SIP.js/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/SIP.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 3de4a245bdc0dab48b91b51c3937391d04ef2902 Mon Sep 17 00:00:00 2001 From: Kir Dergachev Date: Fri, 20 Jan 2017 12:14:28 +0300 Subject: [PATCH 007/140] Fixed package case --- {SIP.js => sip.js}/index.d.ts | 0 SIP.js/SIP.js-tests.ts => sip.js/sip.js-tests.ts | 0 {SIP.js => sip.js}/tsconfig.json | 2 +- {SIP.js => sip.js}/tslint.json | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename {SIP.js => sip.js}/index.d.ts (100%) rename SIP.js/SIP.js-tests.ts => sip.js/sip.js-tests.ts (100%) rename {SIP.js => sip.js}/tsconfig.json (94%) rename {SIP.js => sip.js}/tslint.json (100%) diff --git a/SIP.js/index.d.ts b/sip.js/index.d.ts similarity index 100% rename from SIP.js/index.d.ts rename to sip.js/index.d.ts diff --git a/SIP.js/SIP.js-tests.ts b/sip.js/sip.js-tests.ts similarity index 100% rename from SIP.js/SIP.js-tests.ts rename to sip.js/sip.js-tests.ts diff --git a/SIP.js/tsconfig.json b/sip.js/tsconfig.json similarity index 94% rename from SIP.js/tsconfig.json rename to sip.js/tsconfig.json index 93cce57ffb..8c84c6273e 100644 --- a/SIP.js/tsconfig.json +++ b/sip.js/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "SIP.js-tests.ts" + "sip.js-tests.ts" ] } diff --git a/SIP.js/tslint.json b/sip.js/tslint.json similarity index 100% rename from SIP.js/tslint.json rename to sip.js/tslint.json From f0f803116b25f321fca2755a4e6c96129e6c4a7a Mon Sep 17 00:00:00 2001 From: Kir Dergachev Date: Fri, 20 Jan 2017 12:52:59 +0300 Subject: [PATCH 008/140] Move references from tsconfig --- sip.js/index.d.ts | 2 ++ sip.js/tsconfig.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sip.js/index.d.ts b/sip.js/index.d.ts index 0eaabb9b48..3af04495c9 100644 --- a/sip.js/index.d.ts +++ b/sip.js/index.d.ts @@ -3,6 +3,8 @@ // Definitions by: Kir Dergachev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + export = SIP; declare namespace SIP { diff --git a/sip.js/tsconfig.json b/sip.js/tsconfig.json index 8c84c6273e..b6532e5674 100644 --- a/sip.js/tsconfig.json +++ b/sip.js/tsconfig.json @@ -12,7 +12,7 @@ "typeRoots": [ "../" ], - "types": ["webrtc"], + "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, From cb6ec66ca995549337896b3e38dc79a097b50c08 Mon Sep 17 00:00:00 2001 From: Kir Dergachev Date: Fri, 20 Jan 2017 13:22:30 +0300 Subject: [PATCH 009/140] Fix lint error --- sip.js/index.d.ts | 48 ++++++++++++++-------------------------------- sip.js/tslint.json | 7 ++++++- 2 files changed, 20 insertions(+), 35 deletions(-) diff --git a/sip.js/index.d.ts b/sip.js/index.d.ts index 3af04495c9..8c7a297613 100644 --- a/sip.js/index.d.ts +++ b/sip.js/index.d.ts @@ -40,7 +40,7 @@ declare namespace SIP { } namespace UA.EventArgs { - interface ConnectedArgs { attempts: number } + interface ConnectedArgs { attempts: number; } interface UnregisteredArgs { response: string; cause: string; } interface RegistrationFailedArgs extends UnregisteredArgs { } } @@ -55,8 +55,7 @@ declare namespace SIP { isConnected(): boolean; message(target: string | URI, body: string, options?: MessageOptions): Message; subscribe(target: string | URI, event: string, options?: SubscribeOptions): Subscription; - invite(target: string | URI, options?: InviteOptions): Session; - invite(target: string | URI, element?: HTMLAudioElement | HTMLVideoElement): Session; + invite(target: string | URI, element?: InviteOptions | HTMLAudioElement | HTMLVideoElement): Session; request(method: string, target: string | URI, options?: RequestOptions): ClientContext; on(name: 'connected', callback: (args: UA.EventArgs.ConnectedArgs) => void): void; @@ -110,16 +109,13 @@ declare namespace SIP { on(name: 'progress', callback: (response: IncomingResponse) => void): void; on(name: 'accepted', callback: (data: { code: number, response: IncomingResponse }) => void): void; - on(name: 'rejected', callback: (response: IncomingResponse, cause: string) => void): void; - on(name: 'failed', callback: (response: IncomingResponse, cause: string) => void): void; + on(name: 'failed' | 'rejected', callback: (response: IncomingResponse, cause: string) => void): void; on(name: 'terminated', callback: (message: IncomingResponse, cause: string) => void): void; - on(name: 'refer', callback: (request: IncomingRequest) => void): void; on(name: 'cancel', callback: () => void): void; on(name: 'replaced', callback: (newSession: Session) => void): void; on(name: 'dtmf', callback: (request: IncomingRequest, dtmf: Session.DTMF) => void): void; - on(name: 'muted', callback: (data: Session.Muted) => void): void; - on(name: 'unmuted', callback: (data: Session.Muted) => void): void; - on(name: 'bye', callback: (request: IncomingRequest) => void): void; + on(name: 'muted' | 'unmuted', callback: (data: Session.Muted) => void): void; + on(name: 'refer' | 'bye', callback: (request: IncomingRequest) => void): void; } namespace Session { @@ -144,18 +140,17 @@ declare namespace SIP { media?: MediaOptions; } - interface DTMF { - } + interface DTMF extends Object {} interface Muted { audio?: boolean; - video?: boolean + video?: boolean; } } interface RenderHint { remote?: Element; - local?: Element + local?: Element; } interface MediaConstraints { @@ -185,29 +180,18 @@ declare namespace SIP { render(renderHint: RenderHint): void; on(name: 'userMediaRequest', callback: (constraints: MediaConstraints) => void): void; - on(name: 'userMedia', callback: (stream: MediaStream) => void): void; + on(name: 'addStream' | 'userMedia', callback: (stream: MediaStream) => void): void; on(name: 'userMediaFailed', callback: (error: string) => void): void; - on(name: 'iceGathering', callback: () => void): void; on(name: 'iceCandidate', callback: (candidate: RTCIceCandidate) => void): void; - on(name: 'iceGatheringComplete', callback: () => void): void; - on(name: 'iceConnection', callback: () => void): void; - on(name: 'iceConnectionChecking', callback: () => void): void; - on(name: 'iceConnectionConnected', callback: () => void): void; - on(name: 'iceConnectionCompleted', callback: () => void): void; - on(name: 'iceConnectionFailed', callback: () => void): void; - on(name: 'iceConnectionDisconnected', callback: () => void): void; - on(name: 'iceConnectionClosed', callback: () => void): void; - on(name: 'getDescription', callback: (sdpWrapper: { type: string, sdp: string }) => void): void; - on(name: 'setDescription', callback: (sdpWrapper: { type: string, sdp: string }) => void): void; - on(name: 'dataChannel', callback: () => void): void; - on(name: 'addStream', callback: (stream: MediaStream) => void): void; + on(name: 'iceGathering' | 'iceGatheringComplete' | 'iceConnection' | 'iceConnectionChecking' | 'iceConnectionConnected' | 'iceConnectionCompleted' | 'iceConnectionFailed' | 'iceConnectionDisconnected' | 'iceConnectionClosed', callback: () => void): void; + on(name: 'dataChannel' | 'getDescription' | 'setDescription', callback: (sdpWrapper: { type: string, sdp: string }) => void): void; } } /* Parameters */ interface ConfigurationParameters { uri?: string; - wsServers?: string | string[] | { ws_uri: string; weigth: number }[]; + wsServers?: string | string[] | Array<{ ws_uri: string; weigth: number }>; allowLegacyNotifications?: boolean; authenticationFactory?: WebRTC.MediaHandlerFactory; authorizationUser?: string; @@ -304,11 +288,7 @@ declare namespace SIP { localIdentity: NameAddrHeader; remoteIdentity: NameAddrHeader; data: {}; - - on(name: 'progress', callback: (response: IncomingMessage, cause: string) => void): void; - on(name: 'accepted', callback: (response: IncomingMessage, cause: string) => void): void; - on(name: 'rejected', callback: (response: IncomingMessage, cause: string) => void): void; - on(name: 'failed', callback: (response: IncomingMessage, cause: string) => void): void; + on(name: 'progress' | 'accepted' | 'rejected' | 'failed', callback: (response: IncomingMessage, cause: string) => void): void; on(name: 'notify', callback: (request: IncomingRequest) => void): void; } @@ -341,7 +321,7 @@ declare namespace SIP { /* Header */ class NameAddrHeader { - constructor(uri: string | URI, displayName: string, parameters: { key: string, value: string }[]); + constructor(uri: string | URI, displayName: string, parameters: Array<{ key: string, value: string }>); uri: string | URI; displayName: string; diff --git a/sip.js/tslint.json b/sip.js/tslint.json index 377cc837d4..105f5736e6 100644 --- a/sip.js/tslint.json +++ b/sip.js/tslint.json @@ -1 +1,6 @@ -{ "extends": "../tslint.json" } +{ + "extends": "../tslint.json", + "rules": { + "no-empty-interface": false + } +} From 2cc1c6e25dc4fd757dc98503f985678ebf4a21ef Mon Sep 17 00:00:00 2001 From: Kir Dergachev Date: Fri, 20 Jan 2017 13:58:52 +0300 Subject: [PATCH 010/140] Fix type definition test errors --- sip.js/index.d.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sip.js/index.d.ts b/sip.js/index.d.ts index 8c7a297613..a8d2b3c8db 100644 --- a/sip.js/index.d.ts +++ b/sip.js/index.d.ts @@ -1,13 +1,11 @@ -// Type definitions for SIP.js v0.7.6 +// Type definitions for SIP.js 0.7 // Project: https://sipjs.com/ // Definitions by: Kir Dergachev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -export = SIP; - -declare namespace SIP { +export declare namespace SIP { class URI { constructor( @@ -105,7 +103,7 @@ declare namespace SIP { accept(options?: Session.AcceptOptions): void; reject(options?: Session.CommonOptions): void; reply(options?: Session.CommonOptions): void; - followRefer(callback: Function): void; + followRefer(callback: () => void): void; on(name: 'progress', callback: (response: IncomingResponse) => void): void; on(name: 'accepted', callback: (data: { code: number, response: IncomingResponse }) => void): void; @@ -273,7 +271,7 @@ declare namespace SIP { state: string; event: string; dialog: string; - timers: Object; + timers: {}; errorCodes: number[]; subscribe(): Subscription; unsubscribe(): void; From 1c753b2c69e2df6a45a06cdfa2568a30f7d655ba Mon Sep 17 00:00:00 2001 From: Kir Dergachev Date: Fri, 20 Jan 2017 14:40:08 +0300 Subject: [PATCH 011/140] Fix tslint errors, configure rules --- sip.js/index.d.ts | 10 ++++++---- sip.js/tslint.json | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/sip.js/index.d.ts b/sip.js/index.d.ts index a8d2b3c8db..942a0d22b3 100644 --- a/sip.js/index.d.ts +++ b/sip.js/index.d.ts @@ -1,11 +1,13 @@ -// Type definitions for SIP.js 0.7 -// Project: https://sipjs.com/ -// Definitions by: Kir Dergachev +// Type definitions for sip.js 0.7 +// Project: http://sipjs.com +// Definitions by: Kir Dergachev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -export declare namespace SIP { +export = SIP; + +declare namespace SIP { class URI { constructor( diff --git a/sip.js/tslint.json b/sip.js/tslint.json index 105f5736e6..c78c443ad2 100644 --- a/sip.js/tslint.json +++ b/sip.js/tslint.json @@ -1,6 +1,7 @@ { "extends": "../tslint.json", "rules": { - "no-empty-interface": false + "no-empty-interface": false, + "export-just-namespace": false } } From 71d121fb2b09da2686987e9b68a89bf6d3f17dbd Mon Sep 17 00:00:00 2001 From: Ben Greene Date: Fri, 20 Jan 2017 17:07:09 +0000 Subject: [PATCH 012/140] Remove unnecessary union on extent. (#14133) --- d3-array/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d3-array/index.d.ts b/d3-array/index.d.ts index 1d1aae3b67..e3bd2d549d 100644 --- a/d3-array/index.d.ts +++ b/d3-array/index.d.ts @@ -121,7 +121,7 @@ export function extent(array: T[], accessor: (datum: T, index: number, array: /** * Return the min and max simultaneously. */ -export function extent(array: T[], accessor: (datum: T, index: number, array: T[]) => U): [U | Primitive, U | Primitive] | [undefined, undefined]; +export function extent(array: T[], accessor: (datum: T, index: number, array: T[]) => U): [U, U ] | [undefined, undefined]; /** * Return the mean of an array of numbers From 8afe75320905239826af7bacafd9f6426392abe6 Mon Sep 17 00:00:00 2001 From: Meno Abels Date: Fri, 20 Jan 2017 18:52:43 +0100 Subject: [PATCH 013/140] sshpk: corrected options in toString are optional (#14146) --- sshpk/index.d.ts | 8 ++++---- sshpk/sshpk-tests.ts | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sshpk/index.d.ts b/sshpk/index.d.ts index dd42683527..05d26053b6 100644 --- a/sshpk/index.d.ts +++ b/sshpk/index.d.ts @@ -78,9 +78,9 @@ declare namespace SshPK { static formats: Formats; constructor(opts: any); - toBuffer(format: string, options: any): Buffer; + toBuffer(format: string, options?: any): Buffer; - toString(format: string, options: any): string; + toString(format: string, options?: any): string; fingerprint(algo: string): Fingerprint; @@ -266,8 +266,8 @@ declare namespace SshPK { static formats: Formats; - toBuffer(format: string, options: any): Buffer; - toString(format: string, options: any): string; + toBuffer(format: string, options?: any): Buffer; + toString(format: string, options?: any): string; hash(algo: string): Buffer; fingerprint(algo: string): Fingerprint; defaultHashAlgorithm(): string; diff --git a/sshpk/sshpk-tests.ts b/sshpk/sshpk-tests.ts index 832045549a..301534d908 100644 --- a/sshpk/sshpk-tests.ts +++ b/sshpk/sshpk-tests.ts @@ -4,3 +4,8 @@ import * as sshpk from 'sshpk'; const cert = sshpk.parseCertificate("", "pem"); const fpr = cert.fingerprint("sha256").toString("hex"); const cn = cert.subjects[0].cn; + +const certStr = cert.toString("pem"); + +const key = sshpk.parseKey("", "pem"); +const keyStr = key.toString("pem"); From f20bfbfba3e8b543892828c7733b1d9fc3857557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kov=C3=A1cs?= Date: Fri, 20 Jan 2017 18:55:59 +0100 Subject: [PATCH 014/140] [tether-drop] Improve beforeClose function signature (#14145) beforeClose function in the type definition has no parameters, yet in drop source code (DropInstance class, beforeCloseHandler method) two parameters are passed to this function. First the JavaScript event object, that triggered the close, and then the drop instance object. The signature was updated to reflect this. --- tether-drop/index.d.ts | 2 +- tether-drop/tether-drop-tests.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tether-drop/index.d.ts b/tether-drop/index.d.ts index 64f72d632b..33cdc89e46 100644 --- a/tether-drop/index.d.ts +++ b/tether-drop/index.d.ts @@ -49,7 +49,7 @@ declare namespace Drop { constrainToWindow?: boolean; constrainToScrollParent?: boolean; remove?: boolean; - beforeClose?: () => boolean; + beforeClose?: (event: Event, drop: Drop) => boolean; openDelay?: number; closeDelay?: number; focusDelay?: number; diff --git a/tether-drop/tether-drop-tests.ts b/tether-drop/tether-drop-tests.ts index 8a88bc067a..cdfdf030f4 100644 --- a/tether-drop/tether-drop-tests.ts +++ b/tether-drop/tether-drop-tests.ts @@ -13,6 +13,7 @@ var d = new Drop({ tetherOptions: {}, remove: true, target: yellowBox, + beforeClose: () => true, content: greenBox }); From 9d20b59e9b0c735684367c0e22dc8432a067bba3 Mon Sep 17 00:00:00 2001 From: ysgk Date: Sat, 21 Jan 2017 03:56:09 +0900 Subject: [PATCH 015/140] Fixed google.maps.InfoWindow.setPosition interface (#14115) --- googlemaps/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemaps/index.d.ts b/googlemaps/index.d.ts index df0d9ceb5d..f94b29525c 100644 --- a/googlemaps/index.d.ts +++ b/googlemaps/index.d.ts @@ -784,7 +784,7 @@ declare namespace google.maps { open(map?: Map|StreetViewPanorama, anchor?: MVCObject): void; setContent(content: string|Node): void; setOptions(options: InfoWindowOptions): void; - setPosition(position: LatLng): void; + setPosition(position: LatLng|LatLngLiteral): void; setZIndex(zIndex: number): void; } From 71006850d131d50bb2d5bb46f18ee63ab1ac9147 Mon Sep 17 00:00:00 2001 From: Luca Trazzi Date: Fri, 20 Jan 2017 20:00:08 +0100 Subject: [PATCH 016/140] updated swiper to 3.4.1 (#14070) * moved 2.0.0 version of swiper to V2 * updated swiper to 3.4 * added as contributor to swiper * Added path mapping for itself as old version * tsconfig corrected types root --- CONTRIBUTORS.md | 2 +- swiper/index.d.ts | 329 +++++++++++----- swiper/swiper-tests.ts | 800 ++++++++++++++++++++++++-------------- swiper/tslint.json | 6 + swiper/v2/index.d.ts | 204 ++++++++++ swiper/v2/swiper-tests.ts | 330 ++++++++++++++++ swiper/v2/tsconfig.json | 28 ++ swiper/v2/tslint.json | 7 + 8 files changed, 1323 insertions(+), 383 deletions(-) create mode 100644 swiper/tslint.json create mode 100644 swiper/v2/index.d.ts create mode 100644 swiper/v2/swiper-tests.ts create mode 100644 swiper/v2/tsconfig.json create mode 100644 swiper/v2/tslint.json diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 1036be548d..6e2c883f3a 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1680,7 +1680,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](swig/swig.d.ts) [swig](http://github.com/paularmstrong/swig) by [Peter Harris](https://github.com/CodeAnimal), [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](swig-email-templates/swig-email-templates.d.ts) [swig-email-templates](https://github.com/andrewrk/swig-email-templates) by [Adam Babcock](https://github.com/mrhen) * [:link:](swipe/swipe.d.ts) [Swipe](https://github.com/thebird/Swipe) by [Andrey Kurdyumov](https://github.com/kant2002) -* [:link:](swiper/swiper.d.ts) [Swiper](https://github.com/nolimits4web/Swiper) by [Sebastián Galiano](https://github.com/sgaliano) +* [:link:](swiper/swiper.d.ts) [Swiper](https://github.com/nolimits4web/Swiper) by [Sebastián Galiano](https://github.com/sgaliano), [Luca Trazzi](https://github.com/lucax88x) * [:link:](swipeview/swipeview.d.ts) [SwipeView](http://cubiq.org/swipeview) by [Boris Yankov](https://github.com/borisyankov) * [:link:](switchery/switchery.d.ts) [switchery](https://github.com/abpetkov/switchery) by [Bruno Grieder](https://github.com/bgrieder), [Clayton Lautier](https://github.com/claylaut) * [:link:](swiz/swiz.d.ts) [swiz](https://github.com/racker/node-swiz) by [Jeff Goddard](https://github.com/jedigo) diff --git a/swiper/index.d.ts b/swiper/index.d.ts index cb6ff159f1..99cdc714d9 100644 --- a/swiper/index.d.ts +++ b/swiper/index.d.ts @@ -1,106 +1,216 @@ -// Type definitions for Swiper 2.0.0 +// Type definitions for Swiper 3.4 // Project: https://github.com/nolimits4web/Swiper -// Definitions by: Sebastián Galiano +// Definitions by: Sebastián Galiano , Luca Trazzi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - interface SwiperOptions { - speed?: number; - autoplay?: number; - mode?: string; - loop?: boolean; - loopAdditionalSlides?: number; - slidesPerView?: any; - slidesPerGroup?: number; - calculateHeight?: boolean; - updateOnImagesReady?: boolean; - releaseFormElements?: boolean; - watchActiveIndex?: boolean; - visibilityFullFit?: boolean; - autoResize?: boolean; - resizeReInit?: boolean; - DOMAnimation?: boolean; - resistance?: any; - noSwiping?: boolean; - preventLinks?: boolean; initialSlide?: number; - useCSS3Transforms?: boolean; + direction?: string; + speed?: number; + setWrapperSize?: boolean; + virtualTranslate?: boolean; + width?: number; + height?: number; + autoHeight?: boolean; + roundLengths?: boolean; + nested?: boolean; - // Free Mode and Scroll Container + // Autoplay + autoplay?: number; + autoplayStopOnLast?: boolean; + autoplayDisableOnInteraction?: boolean; + + // Progress + watchSlidesProgress?: boolean; + watchSlidesVisibility?: boolean; + + // Freemode freeMode?: boolean; - freeModeFluid?: boolean; - scrollContainer?: boolean; - momentumRatio?: number; - momentumBounce?: boolean; - momentumBounceRatio?: number; + freeModeMomentum?: boolean; + freeModeMomentumRatio?: number; + freeModeMomentumBounce?: boolean; + freeModeMomentumBounceRatio?: number; + freeModeMinimumVelocity?: number; + freeModeSticky?: boolean; - // Slides offset + // Effects + effect?: string; + fade?: {}; + cube?: {}; + coverflow?: {}; + flip?: {}; + + // Parallax + parallax?: boolean; + + // Slides grid + spaceBetween?: number; + slidesPerView?: number | string; + slidesPerColumn?: number; + slidesPerColumnFill?: string; + slidesPerGroup?: number; centeredSlides?: boolean; - offsetPxBefore?: number; - offsetPxAfter?: number; - offsetSlidesBefore?: number; - offsetSlidesAfter?: number; + slidesOffsetBefore?: number; + slidesOffsetAfter?: number; - // Touch/mouse interactions - touchRatio?: number; - simulateTouch?: boolean; - onlyExternal?: boolean; - followFinger?: boolean; + // Grab Cursor grabCursor?: boolean; - shortSwipes?: boolean; - moveStartThreshold?: number; - // Navigation - keyboardControl?: boolean; - mousewheelControl?: boolean; - nextButton?: string | HTMLElement; - prevButton?: string | HTMLElement; + // Touches + touchEventsTarget?: string; + touchRatio?: number; + touchAngle?: number; + simulateTouch?: boolean; + shortSwipes?: boolean; + longSwipes?: boolean; + longSwipesRatio?: number; + longSwipesMs?: number; + followFinger?: boolean; + onlyExternal?: boolean; + threshold?: number; + touchMoveStopPropagation?: boolean; + iOSEdgeSwipeDetection?: boolean; + iOSEdgeSwipeThreshold?: number; + + // Touch Resistance + resistance?: boolean; + resistanceRatio?: number; + + // Clicks + preventClicks?: boolean; + preventClicksPropagation?: boolean; + slideToClickedSlide?: boolean; + + // Swiping / No swiping + allowSwipeToPrev?: boolean; + allowSwipeToNext?: boolean; + noSwiping?: boolean; + noSwipingClass?: string; + swipeHandler?: string | Element; + + // Navigation Controls + uniqueNavElements?: boolean; // Pagination - pagination?: any; + pagination?: string | Element; + paginationType?: string; + paginationHide?: boolean; paginationClickable?: boolean; - paginationAsRange?: boolean; - createPagination?: boolean; + paginationElement?: string; + paginationBulletRender?: (swiper: Swiper, index: number, className: string) => void; + paginationFractionRender?: (swiper: Swiper, currentClassName: string, totalClassName: string) => void; + paginationProgressRender?: (swiper: Swiper, progressbarClass: string) => void; + paginationCustomRender?: (swiper: Swiper, current: number, total: number) => void; + + // Navigation Buttons + nextButton?: string | Element; + prevButton?: string | Element; + + // Scollbar + scrollbar?: string | Element | SwiperScrollbarOptions; + scrollbarHide?: boolean; + scrollbarDraggable?: boolean; + scrollbarSnapOnRelease?: boolean; + + + // Accessibility + a11y?: boolean; + prevSlideMessage?: string; + nextSlideMessage?: string; + firstSlideMessage?: string; + lastSlideMessage?: string; + paginationBulletMessage?: string; + + + // Keyboard / Mousewheel + keyboardControl?: boolean; + mousewheelControl?: boolean; + mousewheelForceToAxis?: boolean; + mousewheelReleaseOnEdges?: boolean; + mousewheelInvert?: boolean; + mousewheelSensitivity?: number; + + // Hash Navigation + hashnav?: boolean; + hashnavWatchState?: boolean; + history?: string; + + + // Images + preloadImages?: boolean; + updateOnImagesReady?: boolean; + lazyLoading?: boolean; + lazyLoadingInPrevNext?: boolean; + lazyLoadingInPrevNextAmount?: number; + lazyLoadingOnTransitionStart?: boolean; + + // Loop + loop?: boolean; + loopAdditionalSlides?: number; + loopedSlides?: number; + + zoom?: boolean; + + // Controller + control?: Swiper; + controlInverse?: boolean; + controlBy?: string; + + // Observer + observer?: boolean; + observeParents?: boolean; + + // Breakpoints + breakpoints?: {}; + + // Callbacks + runCallbacksOnInit?: boolean; + onInit?: (swiper: Swiper) => void; + onSlideChangeStart?: (swiper: Swiper) => void; + onSlideChangeEnd?: (swiper: Swiper) => void; + onSlideNextStart?: (swiper: Swiper) => void; + onSlideNextEnd?: (swiper: Swiper) => void; + onSlidePrevStart?: (swiper: Swiper) => void; + onSlidePrevEnd?: (swiper: Swiper) => void; + onTransitionStart?: (swiper: Swiper) => void; + onTransitionEnd?: (swiper: Swiper) => void; + onTouchStart?: (swiper: Swiper, event: Event) => void; + onTouchMove?: (swiper: Swiper, event: Event) => void; + onTouchMoveOpposite?: (swiper: Swiper, event: Event) => void; + onSliderMove?: (swiper: Swiper, event: Event) => void; + onTouchEnd?: (swiper: Swiper, event: Event) => void; + onClick?: (swiper: Swiper, event: Event) => void; + onTap?: (swiper: Swiper, event: Event) => void; + onDoubleTap?: (swiper: Swiper, event: Event) => void; + onImagesReady?: (swiper: Swiper) => void; + onProgress?: (swiper: Swiper, progress: number) => void; + onReachBeginning?: (swiper: Swiper) => void; + onReachEnd?: (swiper: Swiper) => void; + onDestroy?: (swiper: Swiper) => void; + onSetTranslate?: (swiper: Swiper, translate: any) => void; + onSetTransition?: (swiper: Swiper, transition: any) => void; + onAutoplay?: (swiper: Swiper) => void; + onAutoplayStart?: (swiper: Swiper) => void; + onAutoplayStop?: (swiper: Swiper) => void; + onLazyImageLoad?: (swiper: Swiper, slide: any, image: any) => void; + onLazyImageReady?: (swiper: Swiper, slide: any, image: any) => void; + onPaginationRendered?: (swiper: Swiper, paginationContainer: any) => void; // Namespace - wrapperClass?: string; slideClass?: string; slideActiveClass?: string; slideVisibleClass?: string; - slideElement?: string; - noSwipingClass?: string; - paginationElement?: string; - paginationElementClass?: string; - paginationActiveClass?: string; - paginationVisibleClass?: string; - - // Callbacks - queueStartCallbacks?: boolean; - queueEndCallbacks?: boolean; - onTouchStart?: (swiper: Swiper) => void; - onTouchMove?: (swiper: Swiper) => void; - onTouchEnd?: (swiper: Swiper) => void; - onSlideReset?: (swiper: Swiper) => void; - onSlideChangeStart?: (swiper: Swiper) => void; - onSlideChangeEnd?: (swiper: Swiper) => void; - onSlideClick?: (swiper: Swiper) => void; - onSlideTouch?: (swiper: Swiper) => void; - onImagesReady?: (swiper: Swiper) => void; - onMomentumBounce?: (swiper: Swiper) => void; - onResistanceBefore?: (swiper: Swiper, distance: any) => void; - onResistanceAfter?: (swiper: Swiper, distance: any) => void; - - // Slides Loader - loader?: { - slides?: any[]; - slidesHTMLType?: string; - surroundGroups?: number; - logic?: string; - loadAllSlides?: boolean; - }; - - // Plugins - scrollbar?: SwiperScrollbarOptions; + slideDuplicateClass?: string; + slideNextClass?: string; + slidePrevClass?: string; + wrapperClass?: string; + bulletClass?: string; + bulletActiveClass?: string; + paginationHiddenClass?: string; + paginationCurrentClass?: string; + paginationTotalClass?: string; + paginationProgressbarClass?: string; + buttonDisabledClass?: string; } interface SwiperScrollbarOptions { @@ -122,7 +232,7 @@ declare class SwiperSlide { } declare class Swiper { - constructor(container: string|Element, options?: SwiperOptions); + constructor(container: string | Element, options?: SwiperOptions); // Properties width: number; @@ -164,7 +274,7 @@ declare class Swiper { wrapperTransitionEnd(callback: () => void, permanent: boolean): void; // Init/reset - destroy(removeResizeEvent?: boolean): void; + destroy(deleteInstance: boolean, cleanupStyles: boolean): void; reInit(forceCalcSlides?: boolean): void; resizeFix(reInit?: boolean): void; @@ -179,27 +289,46 @@ declare class Swiper { setWrapperTransition(duration: any): void; // Slides API + slides: SwiperSlide[]; - createSlide(html: string, slideClassList?: string, element?: string): SwiperSlide; - appendSlide(html: string, slideClassList?: string, element?: string): SwiperSlide; - appendSlide(slideInstance: HTMLElement): SwiperSlide; - prependSlide(html: string, slideClassList?: string, element?: string): SwiperSlide; - prependSlide(slideInstance: HTMLElement): SwiperSlide; - insertSlideAfter(index: number, html: string, slideClassList?: string, element?: string): SwiperSlide; - insertSlideAfter(index: number, slideInstance: HTMLElement): SwiperSlide; - removeSlide(index: number): boolean; - removeLastSlide(): boolean; + + slidePrev(runCallbacks?: boolean, speed?: number): void; + slideNext(runCallbacks?: boolean, speed?: number): void; + slideTo(index: number, runCallbacks?: boolean, speed?: number): void; + update(updateTranslate?: boolean): void; + onResize(): void; + detachEvents(): void; + attachEvents(): void; + + appendSlide(slides: HTMLElement | string | string[]): void; + prependSlide(slides: HTMLElement | string | string[]): void; + removeSlide(slideIndex: number): void; removeAllSlides(): void; - getSlide(index: number): SwiperSlide; - getLastSlide(): SwiperSlide; - getFirstSlide(): SwiperSlide; + + lockSwipeToNext(): void; + unlockSwipeToNext(): void; + lockSwipeToPrev(): void; + unlockSwipeToPrev(): void; + lockSwipes(): void; + unlockSwipes(): void; + disableMousewheelControl(): void; + enableMousewheelControl(): void; + disableKeyboardControl(): void; + enableKeyboardControl(): void; + disableTouchContro(): void; + enableTouchContro(): void; + unsetGrabCursor(): void; + setGrabCursor(): void; + + plugins?: { + debugger?: (swiper: any, params: any) => void; + }; } declare module "swiper" { const swiper: { - new (element: Element, options?: SwiperOptions): Swiper; - new (element: string, options?: SwiperOptions): Swiper; - }; + new (element: Element | string, options?: SwiperOptions): Swiper; + }; export = swiper; } diff --git a/swiper/swiper-tests.ts b/swiper/swiper-tests.ts index 12abcc8944..3fc9b3c185 100644 --- a/swiper/swiper-tests.ts +++ b/swiper/swiper-tests.ts @@ -7,324 +7,560 @@ // 01-default.html function defaultDemo() { - var mySwiper = new Swiper('.swiper-container', { - pagination: '.pagination', - loop: true, - grabCursor: true, + var swiper = new Swiper('.swiper-container'); +} +// 02-responsive.html +function responsive() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', paginationClickable: true }); - - $('.arrow-left').on('click', function (e) { - e.preventDefault(); - mySwiper.swipePrev(); - }); - - $('.arrow-right').on('click', function (e) { - e.preventDefault(); - mySwiper.swipeNext(); - }); } - -// 02-vertical-mode.html -function verticalMode() { - var mySwiper = new Swiper('.swiper-container', { - pagination: '.pagination', +// 03-vertical.html +function vertical() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', paginationClickable: true, - mode: 'vertical' + direction: 'vertical' }); } - -// 03-dynamic-slides.html -function dynamicSlides() { - var mySwiper = new Swiper('.swiper-container', { - pagination: '.pagination', - paginationClickable: true - }); - - function randomColor() { - var colors = ('blue red green orange pink').split(' '); - return colors[Math.floor(Math.random() * colors.length)]; - } - - var count = 4; - - $('.sdl-append').click(function (e) { - e.preventDefault(); - mySwiper.appendSlide('
Slide ' + (++count) + '
', 'swiper-slide ' + randomColor() + '-slide') - }); - - $('.sdl-prepend').click(function (e) { - e.preventDefault(); - mySwiper.prependSlide('
Slide ' + (++count) + '
', 'swiper-slide ' + randomColor() + '-slide') - }); - - $('.sdl-swap').click(function (e) { - e.preventDefault(); - mySwiper - .getFirstSlide() - .insertAfter(1); - }); - - $('.sdl-insert').click(function (e) { - e.preventDefault(); - mySwiper - .createSlide('
Slide ' + (++count) + '
', 'swiper-slide ' + randomColor() + '-slide') - .insertAfter(0); - }); - - $('.sdl-remove1').click(function (e) { - e.preventDefault(); - mySwiper.removeSlide(0); - }); - - $('.sdl-removel').click(function (e) { - e.preventDefault(); - mySwiper.removeLastSlide(); - }); - - $('.sdl-remove2').click(function (e) { - e.preventDefault(); - mySwiper.removeSlide(1); - }); -} - -// 04-scroll-container.html -function scrollContainer() { - var mySwiper = new Swiper('.swiper-container', { - scrollContainer: true, - scrollbar: { - container: '.swiper-scrollbar' - } - }); -} - -// 05-free-mode.html -function freeMode() { - var mySwiper = new Swiper('.swiper-container', { - pagination: '.pagination', +// 04-space-between.html +function spaceBetween() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', paginationClickable: true, - freeMode: true, - freeModeFluid: true + spaceBetween: 30, }); } - -// 06-carousel-mode.html -function carouselMode() { - var mySwiper = new Swiper('.swiper-container', { - pagination: '.pagination', - paginationClickable: true, - slidesPerView: 3 - }); -} - -// 07-carousel-loop.html -function carouselLoop() { - var mySwiper = new Swiper('.swiper-container', { - pagination: '.pagination', - paginationClickable: true, +// 05-slides-per-view.html +function slidesPerView() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', slidesPerView: 3, + paginationClickable: true, + spaceBetween: 30 + }); +} +// 06-slides-per-view-auto.html +function slidesPerViewAuto() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + slidesPerView: 'auto', + paginationClickable: true, + spaceBetween: 30 + }); +} +// 07-centered.html +function centered() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + slidesPerView: 4, + centeredSlides: true, + paginationClickable: true, + spaceBetween: 30 + }); +} +// 08-centered-auto.html +function centeredAuto() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + slidesPerView: 'auto', + centeredSlides: true, + paginationClickable: true, + spaceBetween: 30 + }); +} +// 09-freemode.html +function freemode() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + slidesPerView: 3, + paginationClickable: true, + spaceBetween: 30, + freeMode: true + }); +} +// 10-slides-per-column.html +function slidesPerColumn() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + slidesPerView: 3, + slidesPerColumn: 2, + paginationClickable: true, + spaceBetween: 30 + }); +} +// 11-nested.html +function nested() { + var swiperH = new Swiper('.swiper-container-h', { + pagination: '.swiper-pagination-h', + paginationClickable: true, + spaceBetween: 50 + }); + var swiperV = new Swiper('.swiper-container-v', { + pagination: '.swiper-pagination-v', + paginationClickable: true, + direction: 'vertical', + spaceBetween: 50 + }); +} +// 12-grab-cursor.html +function grabCursor() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + slidesPerView: 4, + centeredSlides: true, + paginationClickable: true, + spaceBetween: 30, + grabCursor: true + }); +} +// 13-scrollbar.html +function scrollbar() { + var swiper = new Swiper('.swiper-container', { + scrollbar: '.swiper-scrollbar', + scrollbarHide: true, + slidesPerView: 'auto', + centeredSlides: true, + spaceBetween: 30, + grabCursor: true + }); +} +// 14-nav-arrows.html +function navArrows() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + paginationClickable: true, + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + spaceBetween: 30 + }); +} +// 15-infinite-loop.html +function infiniteLoop() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + slidesPerView: 1, + paginationClickable: true, + spaceBetween: 30, loop: true }); } - -// 08-nested.html -function nested() { - var swiperParent = new Swiper('.swiper-parent', { - pagination: '.pagination-parent', +// 16-effect-fade.html +function effectFade() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', paginationClickable: true, - slidesPerView: 3 - }); - - var swiperNested1 = new Swiper('.swiper-nested-1', { - mode: 'vertical', - pagination: '.pagination-nested-1', - paginationClickable: true, - slidesPerView: 2 - }); - - var swiperNested2 = new Swiper('.swiper-nested-2', { - mode: 'vertical', - pagination: '.pagination-nested-2', - paginationClickable: true, - slidesPerView: 2 + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + spaceBetween: 30, + effect: 'fade' }); } - -// 09-nested-loop.html -function nestedLoop() { - var swiperParent = new Swiper('.swiper-parent', { - pagination: '.pagination-parent', +// 17-effect-cube.html +function effectCube() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + effect: 'cube', + grabCursor: true, + cube: { + shadow: true, + slideShadows: true, + shadowOffset: 20, + shadowScale: 0.94 + } + }); +} +// 18-effect-coverflow.html +function effectCoverflow() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + effect: 'coverflow', + grabCursor: true, + centeredSlides: true, + slidesPerView: 'auto', + coverflow: { + rotate: 50, + stretch: 0, + depth: 100, + modifier: 1, + slideShadows: true + } + }); +} +// 19-keyboard-control.html +function keyboardControl() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + slidesPerView: 1, paginationClickable: true, + spaceBetween: 30, + keyboardControl: true, + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + }); +} +// 20-mousewheel-control.html +function mousewheelControl() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + direction: 'vertical', + slidesPerView: 1, + paginationClickable: true, + spaceBetween: 30, + mousewheelControl: true + }); +} +// 21-autoplay.html +function autoplay() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + paginationClickable: true, + spaceBetween: 30, + centeredSlides: true, + autoplay: 2500, + autoplayDisableOnInteraction: false + }); +} +// 22-dynamic-slides.html +function dynamicSlides() { + var appendNumber = 4; + var prependNumber = 1; + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + slidesPerView: 3, + centeredSlides: true, + paginationClickable: true, + spaceBetween: 30, + }); + document.querySelector('.prepend-2-slides').addEventListener('click', function (e) { + e.preventDefault(); + swiper.prependSlide([ + '
Slide ' + (--prependNumber) + '
', + '
Slide ' + (--prependNumber) + '
' + ]); + }); + document.querySelector('.prepend-slide').addEventListener('click', function (e) { + e.preventDefault(); + swiper.prependSlide('
Slide ' + (--prependNumber) + '
'); + }); + document.querySelector('.append-slide').addEventListener('click', function (e) { + e.preventDefault(); + swiper.appendSlide('
Slide ' + (++appendNumber) + '
'); + }); + document.querySelector('.append-2-slides').addEventListener('click', function (e) { + e.preventDefault(); + swiper.appendSlide([ + '
Slide ' + (++appendNumber) + '
', + '
Slide ' + (++appendNumber) + '
' + ]); + }); +} +// 23-thumbs-gallery-loop.html +function thumbsGalleryLoop() { + var galleryTop = new Swiper('.gallery-top', { + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + spaceBetween: 10, loop: true, - slidesPerView: 3 + loopedSlides: 5, //looped slides should be the same }); + var galleryThumbs = new Swiper('.gallery-thumbs', { + spaceBetween: 10, + slidesPerView: 4, + touchRatio: 0.2, + loop: true, + loopedSlides: 5, //looped slides should be the same + slideToClickedSlide: true + }); + galleryTop.params.control = galleryThumbs; + galleryThumbs.params.control = galleryTop; - var swiperNested1 = new Swiper('.swiper-nested', { - mode: 'vertical', - pagination: '.pagination-nested', - paginationClickable: true, - slidesPerView: 2 - }); } - -// 10-tabs.html -function tabs() { - var tabsSwiper = new Swiper('.swiper-container', { - onlyExternal: true, - speed: 500 +// 23-thumbs-gallery.html +function thumbsGallery() { + var galleryTop = new Swiper('.gallery-top', { + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + spaceBetween: 10, }); - - $(".tabs a").on('touchstart mousedown', function (e) { - e.preventDefault(); - $(".tabs .active").removeClass('active'); - $(this).addClass('active'); - tabsSwiper.swipeTo($(this).index()); - }); - - $(".tabs a").click(function (e) { - e.preventDefault(); - }); -} - -// 11-tabs-feedback.html -function tabsFeedback() { - var tabsSwiper = new Swiper('.swiper-container', { - speed: 500, - onSlideChangeStart: function () { - $(".tabs .active").removeClass('active'); - $(".tabs a").eq(tabsSwiper.activeIndex).addClass('active'); - } - }); - - $(".tabs a").on('touchstart mousedown', function (e) { - e.preventDefault(); - $(".tabs .active").removeClass('active'); - $(this).addClass('active'); - tabsSwiper.swipeTo($(this).index()); - }); - - $(".tabs a").click(function (e) { - e.preventDefault(); - }); -} - -// 12-partial-display.html -function partialDisplay() { - var mySwiper = new Swiper('.swiper-container', { - pagination: '.pagination', - paginationClickable: true, - slidesPerView: 'auto' - }); -} - -// 13-threshold.html -function threshold() { - var mySwiper = new Swiper('.swiper-container', { - pagination: '.pagination', - paginationClickable: true, - moveStartThreshold: 100 - }); -} - -// 14-different-widths.html -function differentWidths() { - var mySwiper = new Swiper('.swiper-container', { - pagination: '.pagination', - paginationClickable: true, - slidesPerView: 'auto' - }); -} - -// 15-centered-slides.html -function centeredSlides() { - var mySwiper = new Swiper('.swiper-container', { - pagination: '.pagination', - paginationClickable: true, + var galleryThumbs = new Swiper('.gallery-thumbs', { + spaceBetween: 10, centeredSlides: true, - slidesPerView: 'auto' + slidesPerView: 'auto', + touchRatio: 0.2, + slideToClickedSlide: true }); -} + galleryTop.params.control = galleryThumbs; + galleryThumbs.params.control = galleryTop; -// 16-visibility-api.html -function visibilityApi() { - var mySwiper = new Swiper('.swiper-container', { - pagination: '.pagination', +} +// 24-multiple-swipers.html +function multipleSwipers() { + var swiper1 = new Swiper('.swiper1', { + pagination: '.swiper-pagination1', paginationClickable: true, - centeredSlides: true, - slidesPerView: 3, - watchActiveIndex: true + spaceBetween: 30, + }); + var swiper2 = new Swiper('.swiper2', { + pagination: '.swiper-pagination2', + paginationClickable: true, + spaceBetween: 30, + }); + var swiper3 = new Swiper('.swiper3', { + pagination: '.swiper-pagination3', + paginationClickable: true, + spaceBetween: 30, }); } - -// 17 - responsive.html -function responsive() { - var mySwiper = new Swiper('.swiper-container', { - pagination: '.pagination', - paginationClickable: true +// 25-hash-navigation.html +function hashNavigation() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + paginationClickable: true, + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + spaceBetween: 30, + hashnav: true, + hashnavWatchState: true }); } - - -// -// Scrollbar -// - -// demo-1.html -function demo1() { - var mySwiper = new Swiper('.swiper-container', { - scrollbar: { - container: '.swiper-scrollbar', - hide: false, - draggable: false +// 26-rtl.html +function rtl() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + paginationClickable: true, + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev' + }); +} +// 27-jquery.html +function jquery() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + paginationClickable: true, + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev' + }); +} +// 28-parallax.html +function parallax() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + paginationClickable: true, + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + parallax: true, + speed: 600, + }); +} +// 29-custom-pagination.html +function customPagination() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + paginationClickable: true, + paginationBulletRender: function (swiper, index, className) { + return '' + (index + 1) + ''; } }); } - -// demo-2.html -function demo2() { - var mySwiper = new Swiper('.swiper-container', { - scrollbar: { - container: '.swiper-scrollbar', - hide: false, - draggable: true - } +// 30-lazy-load-images.html +function lazyLoadImages() { + var swiper = new Swiper('.swiper-container', { + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + pagination: '.swiper-pagination', + paginationClickable: true, + // Disable preloading of all images + preloadImages: false, + // Enable lazy loading + lazyLoading: true }); } - -// demo-3.html -function demo3() { - var mySwiper = new Swiper('.swiper-container', { - scrollbar: { - container: '.swiper-scrollbar', - hide: true, - draggable: true - } - }); +// 31-custom-plugin.html +function customPlugin() { + /* ======== + Debugger plugin, simple demo plugin to console.log some of callbacks + ======== */ + Swiper.prototype.plugins.debugger = function (swiper: any, params: any) { + if (!params) return; + // Need to return object with properties that names are the same as callbacks + return { + onInit: function (swiper: any) { + console.log('onInit'); + }, + onClick: function (swiper: any, e: any) { + console.log('onClick'); + }, + onTap: function (swiper: any, e: any) { + console.log('onTap'); + }, + onDoubleTap: function (swiper: any, e: any) { + console.log('onDoubleTap'); + }, + onSliderMove: function (swiper: any, e: any) { + console.log('onSliderMove'); + }, + onSlideChangeStart: function (swiper: any) { + console.log('onSlideChangeStart'); + }, + onSlideChangeEnd: function (swiper: any) { + console.log('onSlideChangeEnd'); + }, + onTransitionStart: function (swiper: any) { + console.log('onTransitionStart'); + }, + onTransitionEnd: function (swiper: any) { + console.log('onTransitionEnd'); + }, + onReachBeginning: function (swiper: any) { + console.log('onReachBeginning'); + }, + onReachEnd: function (swiper: any) { + console.log('onReachEnd'); + } + }; + }; } - -// demo-4.html -function demo4() { - var mySwiper = new Swiper('.swiper-container', { - slidesPerView: 3, - scrollbar: { - container: '.swiper-scrollbar', - hide: false, - draggable: true, - snapOnRelease: true - } - }); -} - -// demo-5.html -function demo5() { - var mySwiper = new Swiper('.swiper-container', { - scrollContainer: true, +// 32-scroll-container.html +function scrollContainer() { + var swiper = new Swiper('.swiper-container', { + scrollbar: '.swiper-scrollbar', + direction: 'vertical', + slidesPerView: 'auto', mousewheelControl: true, - mode: 'vertical', - scrollbar: { - container: '.swiper-scrollbar', - hide: true, - draggable: false + freeMode: true + }); +} +// 32-slideable-menu.html +function slideableMenu() { + var toggleMenu = function () { + if (swiper.previousIndex == 0) + swiper.slidePrev() + } + , menuButton = document.getElementsByClassName('menu-button')[0] + , swiper = new Swiper('.swiper-container', { + slidesPerView: 'auto' + , initialSlide: 1 + , resistanceRatio: .00000000000001 + , onSlideChangeStart: function (slider) { + if (slider.activeIndex == 0) { + menuButton.classList.add('cross') + menuButton.removeEventListener('click', toggleMenu, false) + } else + menuButton.classList.remove('cross') + } + , onSlideChangeEnd: function (slider) { + if (slider.activeIndex == 0) + menuButton.removeEventListener('click', toggleMenu, false) + else + menuButton.addEventListener('click', toggleMenu, false) + } + , slideToClickedSlide: true + }) +} +// 33-responsive-breakpoints.html +function responsiveBreakpoints() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + paginationClickable: true, + slidesPerView: 5, + spaceBetween: 50, + breakpoints: { + 1024: { + slidesPerView: 4, + spaceBetween: 40 + }, + 768: { + slidesPerView: 3, + spaceBetween: 30 + }, + 640: { + slidesPerView: 2, + spaceBetween: 20 + }, + 320: { + slidesPerView: 1, + spaceBetween: 10 + } } }); -} \ No newline at end of file +} +// 34-autoheight.html +function autoheight() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + paginationClickable: true, + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + autoHeight: true, //enable auto height + }); +} +// 35-effect-flip.html +function effectFlip() { + var swiper = new Swiper('.swiper-container', { + pagination: '.swiper-pagination', + effect: 'flip', + grabCursor: true, + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev' + }); +} +// 36-pagination-fraction.html +function paginationFraction() { + var swiper = new Swiper('.swiper-container', { + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + pagination: '.swiper-pagination', + paginationType: 'fraction' + }); +} +// 37-pagination-progress.html +function paginationProgress() { + var swiper = new Swiper('.swiper-container', { + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + pagination: '.swiper-pagination', + paginationType: 'progress' + }); +} +// 38-history.html +function historyDemo() { + var swiper = new Swiper('.swiper-container', { + spaceBetween: 50, + slidesPerView: 2, + centeredSlides: true, + slideToClickedSlide: true, + grabCursor: true, + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev', + scrollbar: '.swiper-scrollbar', + pagination: '.swiper-pagination', + history: 'slide', + }); +} +// 38-jquery-ie9-loop.html +function jqueryIe9Loop() { + var swiper = new Swiper('.swiper-container', { + loop: true, + pagination: '.swiper-pagination', + paginationClickable: true, + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev' + }); +} +// 39-zoom.html +function zoom() { + var swiper = new Swiper('.swiper-container', { + zoom: true, + pagination: '.swiper-pagination', + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev' + }); +} diff --git a/swiper/tslint.json b/swiper/tslint.json new file mode 100644 index 0000000000..fd1872c1cb --- /dev/null +++ b/swiper/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "no-single-declare-module": false + } +} \ No newline at end of file diff --git a/swiper/v2/index.d.ts b/swiper/v2/index.d.ts new file mode 100644 index 0000000000..a5a98b691f --- /dev/null +++ b/swiper/v2/index.d.ts @@ -0,0 +1,204 @@ +// Type definitions for Swiper 2.0.0 +// Project: https://github.com/nolimits4web/Swiper +// Definitions by: Sebastián Galiano +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +interface SwiperOptions { + speed?: number; + autoplay?: number; + mode?: string; + loop?: boolean; + loopAdditionalSlides?: number; + slidesPerView?: any; + slidesPerGroup?: number; + calculateHeight?: boolean; + updateOnImagesReady?: boolean; + releaseFormElements?: boolean; + watchActiveIndex?: boolean; + visibilityFullFit?: boolean; + autoResize?: boolean; + resizeReInit?: boolean; + DOMAnimation?: boolean; + resistance?: any; + noSwiping?: boolean; + preventLinks?: boolean; + initialSlide?: number; + useCSS3Transforms?: boolean; + + // Free Mode and Scroll Container + freeMode?: boolean; + freeModeFluid?: boolean; + scrollContainer?: boolean; + momentumRatio?: number; + momentumBounce?: boolean; + momentumBounceRatio?: number; + + // Slides offset + centeredSlides?: boolean; + offsetPxBefore?: number; + offsetPxAfter?: number; + offsetSlidesBefore?: number; + offsetSlidesAfter?: number; + + // Touch/mouse interactions + touchRatio?: number; + simulateTouch?: boolean; + onlyExternal?: boolean; + followFinger?: boolean; + grabCursor?: boolean; + shortSwipes?: boolean; + moveStartThreshold?: number; + + // Navigation + keyboardControl?: boolean; + mousewheelControl?: boolean; + nextButton?: string | HTMLElement; + prevButton?: string | HTMLElement; + + // Pagination + pagination?: any; + paginationClickable?: boolean; + paginationAsRange?: boolean; + createPagination?: boolean; + + // Namespace + wrapperClass?: string; + slideClass?: string; + slideActiveClass?: string; + slideVisibleClass?: string; + slideElement?: string; + noSwipingClass?: string; + paginationElement?: string; + paginationElementClass?: string; + paginationActiveClass?: string; + paginationVisibleClass?: string; + + // Callbacks + queueStartCallbacks?: boolean; + queueEndCallbacks?: boolean; + onTouchStart?: (swiper: Swiper) => void; + onTouchMove?: (swiper: Swiper) => void; + onTouchEnd?: (swiper: Swiper) => void; + onSlideReset?: (swiper: Swiper) => void; + onSlideChangeStart?: (swiper: Swiper) => void; + onSlideChangeEnd?: (swiper: Swiper) => void; + onSlideClick?: (swiper: Swiper) => void; + onSlideTouch?: (swiper: Swiper) => void; + onImagesReady?: (swiper: Swiper) => void; + onMomentumBounce?: (swiper: Swiper) => void; + onResistanceBefore?: (swiper: Swiper, distance: any) => void; + onResistanceAfter?: (swiper: Swiper, distance: any) => void; + + // Slides Loader + loader?: { + slides?: any[]; + slidesHTMLType?: string; + surroundGroups?: number; + logic?: string; + loadAllSlides?: boolean; + }; + + // Plugins + scrollbar?: SwiperScrollbarOptions; +} + +interface SwiperScrollbarOptions { + container: string; // Default: '.swiper-scrollbar' + draggable?: boolean; // Default: true + hide?: boolean; // Default: true + snapOnRelease?: boolean; // Default: false +} + +declare class SwiperSlide { + append(): SwiperSlide; + clone(): SwiperSlide; + getWidth(): number; + getHeight(): number; + getOffset(): { top: number; left: number; }; + insertAfter(index: number): SwiperSlide; + prepend(): SwiperSlide; + remove(): void; +} + +declare class Swiper { + constructor(container: string | Element, options?: SwiperOptions); + + // Properties + width: number; + height: number; + params: any; + positions: any; + + // Feature detection + support: { + touch: boolean; + transforms: boolean; + transforms3d: boolean; + transitions: boolean; + }; + + // Browser detection + browser: { + ie8: boolean; + ie10: boolean; + }; + + // Navigation + activeIndex: number; + activeLoopIndex: number; + activeLoaderIndex: number; + previousIndex: number; + swipeNext(internal?: boolean): boolean; + swipePrev(internal?: boolean): boolean; + swipeReset(): boolean; + swipeTo(index: number, speed?: number, runCallbacks?: boolean): boolean; + activeSlide(): SwiperSlide; + updateActiveSlide(index: number): void; + + // Events + touches: any; + isTouched: boolean; + clickedSlideIndex: number; + clickedSlide: SwiperSlide; + wrapperTransitionEnd(callback: () => void, permanent: boolean): void; + + // Init/reset + destroy(removeResizeEvent?: boolean): void; + reInit(forceCalcSlides?: boolean): void; + resizeFix(reInit?: boolean): void; + + // Autoplaying + autoplay: boolean; + startAutoplay(): void; + stopAutoplay(): void; + + // Other methods + getWrapperTranslate(axis: string): number; // 'x' or 'y' + setWrapperTranslate(x: number, y: number, z: number): void; + setWrapperTransition(duration: any): void; + + // Slides API + slides: SwiperSlide[]; + createSlide(html: string, slideClassList?: string, element?: string): SwiperSlide; + appendSlide(html: string, slideClassList?: string, element?: string): SwiperSlide; + appendSlide(slideInstance: HTMLElement): SwiperSlide; + prependSlide(html: string, slideClassList?: string, element?: string): SwiperSlide; + prependSlide(slideInstance: HTMLElement): SwiperSlide; + insertSlideAfter(index: number, html: string, slideClassList?: string, element?: string): SwiperSlide; + insertSlideAfter(index: number, slideInstance: HTMLElement): SwiperSlide; + removeSlide(index: number): boolean; + removeLastSlide(): boolean; + removeAllSlides(): void; + getSlide(index: number): SwiperSlide; + getLastSlide(): SwiperSlide; + getFirstSlide(): SwiperSlide; +} + +declare module "swiper" { + const swiper: { + new (element: Element | string, options?: SwiperOptions): Swiper; + }; + + export = swiper; +} diff --git a/swiper/v2/swiper-tests.ts b/swiper/v2/swiper-tests.ts new file mode 100644 index 0000000000..12abcc8944 --- /dev/null +++ b/swiper/v2/swiper-tests.ts @@ -0,0 +1,330 @@ + +/// + +// +// Main demos +// + +// 01-default.html +function defaultDemo() { + var mySwiper = new Swiper('.swiper-container', { + pagination: '.pagination', + loop: true, + grabCursor: true, + paginationClickable: true + }); + + $('.arrow-left').on('click', function (e) { + e.preventDefault(); + mySwiper.swipePrev(); + }); + + $('.arrow-right').on('click', function (e) { + e.preventDefault(); + mySwiper.swipeNext(); + }); +} + +// 02-vertical-mode.html +function verticalMode() { + var mySwiper = new Swiper('.swiper-container', { + pagination: '.pagination', + paginationClickable: true, + mode: 'vertical' + }); +} + +// 03-dynamic-slides.html +function dynamicSlides() { + var mySwiper = new Swiper('.swiper-container', { + pagination: '.pagination', + paginationClickable: true + }); + + function randomColor() { + var colors = ('blue red green orange pink').split(' '); + return colors[Math.floor(Math.random() * colors.length)]; + } + + var count = 4; + + $('.sdl-append').click(function (e) { + e.preventDefault(); + mySwiper.appendSlide('
Slide ' + (++count) + '
', 'swiper-slide ' + randomColor() + '-slide') + }); + + $('.sdl-prepend').click(function (e) { + e.preventDefault(); + mySwiper.prependSlide('
Slide ' + (++count) + '
', 'swiper-slide ' + randomColor() + '-slide') + }); + + $('.sdl-swap').click(function (e) { + e.preventDefault(); + mySwiper + .getFirstSlide() + .insertAfter(1); + }); + + $('.sdl-insert').click(function (e) { + e.preventDefault(); + mySwiper + .createSlide('
Slide ' + (++count) + '
', 'swiper-slide ' + randomColor() + '-slide') + .insertAfter(0); + }); + + $('.sdl-remove1').click(function (e) { + e.preventDefault(); + mySwiper.removeSlide(0); + }); + + $('.sdl-removel').click(function (e) { + e.preventDefault(); + mySwiper.removeLastSlide(); + }); + + $('.sdl-remove2').click(function (e) { + e.preventDefault(); + mySwiper.removeSlide(1); + }); +} + +// 04-scroll-container.html +function scrollContainer() { + var mySwiper = new Swiper('.swiper-container', { + scrollContainer: true, + scrollbar: { + container: '.swiper-scrollbar' + } + }); +} + +// 05-free-mode.html +function freeMode() { + var mySwiper = new Swiper('.swiper-container', { + pagination: '.pagination', + paginationClickable: true, + freeMode: true, + freeModeFluid: true + }); +} + +// 06-carousel-mode.html +function carouselMode() { + var mySwiper = new Swiper('.swiper-container', { + pagination: '.pagination', + paginationClickable: true, + slidesPerView: 3 + }); +} + +// 07-carousel-loop.html +function carouselLoop() { + var mySwiper = new Swiper('.swiper-container', { + pagination: '.pagination', + paginationClickable: true, + slidesPerView: 3, + loop: true + }); +} + +// 08-nested.html +function nested() { + var swiperParent = new Swiper('.swiper-parent', { + pagination: '.pagination-parent', + paginationClickable: true, + slidesPerView: 3 + }); + + var swiperNested1 = new Swiper('.swiper-nested-1', { + mode: 'vertical', + pagination: '.pagination-nested-1', + paginationClickable: true, + slidesPerView: 2 + }); + + var swiperNested2 = new Swiper('.swiper-nested-2', { + mode: 'vertical', + pagination: '.pagination-nested-2', + paginationClickable: true, + slidesPerView: 2 + }); +} + +// 09-nested-loop.html +function nestedLoop() { + var swiperParent = new Swiper('.swiper-parent', { + pagination: '.pagination-parent', + paginationClickable: true, + loop: true, + slidesPerView: 3 + }); + + var swiperNested1 = new Swiper('.swiper-nested', { + mode: 'vertical', + pagination: '.pagination-nested', + paginationClickable: true, + slidesPerView: 2 + }); +} + +// 10-tabs.html +function tabs() { + var tabsSwiper = new Swiper('.swiper-container', { + onlyExternal: true, + speed: 500 + }); + + $(".tabs a").on('touchstart mousedown', function (e) { + e.preventDefault(); + $(".tabs .active").removeClass('active'); + $(this).addClass('active'); + tabsSwiper.swipeTo($(this).index()); + }); + + $(".tabs a").click(function (e) { + e.preventDefault(); + }); +} + +// 11-tabs-feedback.html +function tabsFeedback() { + var tabsSwiper = new Swiper('.swiper-container', { + speed: 500, + onSlideChangeStart: function () { + $(".tabs .active").removeClass('active'); + $(".tabs a").eq(tabsSwiper.activeIndex).addClass('active'); + } + }); + + $(".tabs a").on('touchstart mousedown', function (e) { + e.preventDefault(); + $(".tabs .active").removeClass('active'); + $(this).addClass('active'); + tabsSwiper.swipeTo($(this).index()); + }); + + $(".tabs a").click(function (e) { + e.preventDefault(); + }); +} + +// 12-partial-display.html +function partialDisplay() { + var mySwiper = new Swiper('.swiper-container', { + pagination: '.pagination', + paginationClickable: true, + slidesPerView: 'auto' + }); +} + +// 13-threshold.html +function threshold() { + var mySwiper = new Swiper('.swiper-container', { + pagination: '.pagination', + paginationClickable: true, + moveStartThreshold: 100 + }); +} + +// 14-different-widths.html +function differentWidths() { + var mySwiper = new Swiper('.swiper-container', { + pagination: '.pagination', + paginationClickable: true, + slidesPerView: 'auto' + }); +} + +// 15-centered-slides.html +function centeredSlides() { + var mySwiper = new Swiper('.swiper-container', { + pagination: '.pagination', + paginationClickable: true, + centeredSlides: true, + slidesPerView: 'auto' + }); +} + +// 16-visibility-api.html +function visibilityApi() { + var mySwiper = new Swiper('.swiper-container', { + pagination: '.pagination', + paginationClickable: true, + centeredSlides: true, + slidesPerView: 3, + watchActiveIndex: true + }); +} + +// 17 - responsive.html +function responsive() { + var mySwiper = new Swiper('.swiper-container', { + pagination: '.pagination', + paginationClickable: true + }); +} + + +// +// Scrollbar +// + +// demo-1.html +function demo1() { + var mySwiper = new Swiper('.swiper-container', { + scrollbar: { + container: '.swiper-scrollbar', + hide: false, + draggable: false + } + }); +} + +// demo-2.html +function demo2() { + var mySwiper = new Swiper('.swiper-container', { + scrollbar: { + container: '.swiper-scrollbar', + hide: false, + draggable: true + } + }); +} + +// demo-3.html +function demo3() { + var mySwiper = new Swiper('.swiper-container', { + scrollbar: { + container: '.swiper-scrollbar', + hide: true, + draggable: true + } + }); +} + +// demo-4.html +function demo4() { + var mySwiper = new Swiper('.swiper-container', { + slidesPerView: 3, + scrollbar: { + container: '.swiper-scrollbar', + hide: false, + draggable: true, + snapOnRelease: true + } + }); +} + +// demo-5.html +function demo5() { + var mySwiper = new Swiper('.swiper-container', { + scrollContainer: true, + mousewheelControl: true, + mode: 'vertical', + scrollbar: { + container: '.swiper-scrollbar', + hide: true, + draggable: false + } + }); +} \ No newline at end of file diff --git a/swiper/v2/tsconfig.json b/swiper/v2/tsconfig.json new file mode 100644 index 0000000000..963c1c24f6 --- /dev/null +++ b/swiper/v2/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "swiper": [ + "swiper/v2" + ], + "swiper/*": [ + "swiper/v2/*" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "swiper-tests.ts" + ] +} \ No newline at end of file diff --git a/swiper/v2/tslint.json b/swiper/v2/tslint.json new file mode 100644 index 0000000000..506ccb3b24 --- /dev/null +++ b/swiper/v2/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "../tslint.json", + "rules": { + "no-single-declare-module": false, + "dt-header": false + } +} \ No newline at end of file From 33fb4236d603937907383a8ab7b3b4c05a5d3b77 Mon Sep 17 00:00:00 2001 From: Lxxyx Date: Fri, 20 Jan 2017 13:00:52 -0600 Subject: [PATCH 017/140] fix(webview): webview android useraget props missing (#14140) --- react-native/index.d.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/react-native/index.d.ts b/react-native/index.d.ts index edf2822dd6..92b04ef40c 100644 --- a/react-native/index.d.ts +++ b/react-native/index.d.ts @@ -1894,7 +1894,12 @@ declare module "react" { * Used on Android only, controls whether DOM Storage is enabled * or not android */ - domStorageEnabled?: boolean + domStorageEnabled?: boolean, + + /** + * Sets the user-agent for the WebView. + */ + userAgent?: string } export interface WebViewIOSLoadRequestEvent { @@ -2044,7 +2049,7 @@ declare module "react" { /** * Invoked when window.postMessage is called from WebView. */ - onMessage?: ( event: NativeSyntheticEvent ) => void + onMessage?: ( event: NativeSyntheticEvent ) => void /** * Function that is invoked when the `WebView` loading starts or ends. From 632e62aadf4ef6ec48135d82a99bf88e6907ecfd Mon Sep 17 00:00:00 2001 From: Nikita Matrosov Date: Fri, 20 Jan 2017 23:06:47 +0400 Subject: [PATCH 018/140] Add 'hide' method in typing definitions (#14138) --- cordova-plugin-inappbrowser/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cordova-plugin-inappbrowser/index.d.ts b/cordova-plugin-inappbrowser/index.d.ts index d5e221ba42..ea3d3adba8 100644 --- a/cordova-plugin-inappbrowser/index.d.ts +++ b/cordova-plugin-inappbrowser/index.d.ts @@ -168,6 +168,8 @@ interface InAppBrowser extends Window { removeEventListener(type: string, callback: (event: Event) => void): void; /** Closes the InAppBrowser window. */ close(): void; + /** Hides the InAppBrowser window. Calling this has no effect if the InAppBrowser was already hidden. */ + hide(): void; /** * Displays an InAppBrowser window that was opened hidden. Calling this has no effect * if the InAppBrowser was already visible. From ccfe42e5d0d521cb838fbf08145103f0dde02828 Mon Sep 17 00:00:00 2001 From: Luca Trazzi Date: Fri, 20 Jan 2017 20:08:09 +0100 Subject: [PATCH 019/140] Corrected Modernizr breaking change (#14137) * AMD & UMD compatible, following toastr as example * added tslint and contributor * correctly wrapped union type as this is a function --- modernizr/index.d.ts | 751 +++++++++++++++++++++--------------------- modernizr/tslint.json | 7 + 2 files changed, 381 insertions(+), 377 deletions(-) create mode 100644 modernizr/tslint.json diff --git a/modernizr/index.d.ts b/modernizr/index.d.ts index a447f3acea..7fd0ffa316 100644 --- a/modernizr/index.d.ts +++ b/modernizr/index.d.ts @@ -1,382 +1,379 @@ -// Type definitions for Modernizr 3.2.0 +// Type definitions for Modernizr 3.2 // Project: http://modernizr.com/ -// Definitions by: Boris Yankov , Theodore Brown , Leon Yu +// Definitions by: Boris Yankov , Theodore Brown , Leon Yu , Luca Trazzi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export = Modernizr; // support AMD require -export as namespace Modernizr; // keep a global namespace - -declare namespace __Modernizr { - interface AudioBoolean { - ogg: boolean; - mp3: boolean; - wav: boolean; - m4a: boolean; - } - - interface VideoBoolean { - ogg: boolean; - h264: boolean; - webm: boolean; - } - - interface InputBoolean { - autocomplete: boolean; - autofocus: boolean; - list: boolean; - placeholder: boolean; - max: boolean; - min: boolean; - multiple: boolean; - pattern: boolean; - required: boolean; - step: boolean; - } - - interface InputTypesBoolean { - color: boolean; - date: boolean; - datetime: boolean; - "datetime-local": boolean; - email: boolean; - month: boolean; - number: boolean; - range: boolean; - search: boolean; - tel: boolean; - time: boolean; - url: boolean; - week: boolean; - } - - interface FeatureDetects { - // Documented - - ambientlight: boolean; - applicationcache: boolean; - audio: AudioBoolean; - batteryapi: boolean; - blobconstructor: boolean; - canvas: boolean; - canvastext: boolean; - contenteditable: boolean; - contextmenu: boolean; - cookies: boolean; - cors: boolean; - cryptography: boolean; - customprotocolhandler: boolean; - customevent: boolean; - dart: boolean; - dataview: boolean; - emoji: boolean; - eventlistener: boolean; - exiforientation: boolean; - flash: boolean; - forcetouch: boolean; - fullscreen: boolean; - gamepads: boolean; - geolocation: boolean; - hashchange: boolean; - hiddenscroll: boolean; - history: boolean; - htmlimports: boolean; - ie8compat: boolean; - indexeddb: boolean; - indexeddbblob: boolean; - input: InputBoolean; - search: boolean; - inputtypes: InputTypesBoolean; - intl: boolean; - json: boolean; - ligatures: boolean; - olreversed: boolean; - mathml: boolean; - notification: boolean; - pagevisibility: boolean; - performance: boolean; - pointerevents: boolean; - pointerlock: boolean; - postmessage: boolean; - proximity: boolean; - queryselector: boolean; - quotamanagement: boolean; - requestanimationframe: boolean; - serviceworker: boolean; - svg: boolean; - templatestrings: boolean; - touchevents: boolean; - typedarrays: boolean; - unicoderange: boolean; - unicode: boolean; - userdata: boolean; - vibrate: boolean; - video: VideoBoolean; - vml: boolean; - webintents: boolean; - animation: boolean; - webgl: boolean; - websockets: boolean; - xdomainrequest: boolean; - adownload: boolean; - audioloop: boolean; - audiopreload: boolean; - webaudio: boolean; - lowbattery: boolean; - canvasblending: boolean; - todataurljpeg: boolean; - todataurlpng: boolean; - todataurlwebp: boolean; - canvaswinding: boolean; - getrandomvalues: boolean; - cssall: boolean; - cssanimations: boolean; - appearance: boolean; - backdropfilter: boolean; - backgroundblendmode: boolean; - backgroundcliptext: boolean; - bgpositionshorthand: boolean; - bgpositionxy: boolean; - bgrepeatspace: boolean; - bgrepeatround: boolean; - backgroundsize: boolean; - bgsizecover: boolean; - borderimage: boolean; - borderradius: boolean; - boxshadow: boolean; - boxsizing: boolean; - csscalc: boolean; - checked: boolean; - csschunit: boolean; - csscolumns: boolean; - cubicbezierrange: boolean; - "display-runin": boolean; - displaytable: boolean; - ellipsis: boolean; - cssescape: boolean; - cssexunit: boolean; - cssfilters: boolean; - flexbox: boolean; - flexboxlegacy: boolean; - flexboxtweener: boolean; - flexwrap: boolean; - fontface: boolean; - generatedcontent: boolean; - cssgradients: boolean; - csshairline: boolean; - hsla: boolean; - csshyphens: boolean; - softhyphens: boolean; - softhyphensfind: boolean; - cssinvalid: boolean; - lastchild: boolean; - cssmask: boolean; - mediaqueries: boolean; - multiplebgs: boolean; - nthchild: boolean; - objectfit: boolean; - opacity: boolean; - overflowscrolling: boolean; - csspointerevents: boolean; - csspositionsticky: boolean; - csspseudoanimations: boolean; - csspseudotransitions: boolean; - cssreflections: boolean; - regions: boolean; - cssremunit: boolean; - cssresize: boolean; - rgba: boolean; - cssscrollbar: boolean; - scrollsnappoints: boolean; - shapes: boolean; - siblinggeneral: boolean; - subpixelfont: boolean; - supports: boolean; - target: boolean; - textalignlast: boolean; - textshadow: boolean; - csstransforms: boolean; - csstransforms3d: boolean; - preserve3d: boolean; - csstransitions: boolean; - userselect: boolean; - cssvalid: boolean; - cssvhunit: boolean; - cssvmaxunit: boolean; - cssvminunit: boolean; - cssvwunit: boolean; - willchange: boolean; - wrapflow: boolean; - classlist: boolean; - createelementattrs: boolean; - "createelement-attrs": boolean; - dataset: boolean; - documentfragment: boolean; - hidden: boolean; - microdata: boolean; - mutationobserver: boolean; - bdi: boolean; - datalistelem: boolean; - details: boolean; - outputelem: boolean; - picture: boolean; - progressbar: boolean; - meter: boolean; - ruby: boolean; - template: boolean; - time: boolean; - texttrackapi: boolean; - track: boolean; - unknownelements: boolean; - es5array: boolean; - es5date: boolean; - es5function: boolean; - es5object: boolean; - es5: boolean; - strictmode: boolean; - es5string: boolean; - es5syntax: boolean; - es5undefined: boolean; - es6array: boolean; - es6collections: boolean; - contains: boolean; - generators: boolean; - es6math: boolean; - es6number: boolean; - es6object: boolean; - promises: boolean; - es6string: boolean; - devicemotion: boolean; - deviceorientation: boolean; - oninput: boolean; - filereader: boolean; - filesystem: boolean; - capture: boolean; - fileinput: boolean; - directory: boolean; - formattribute: boolean; - localizednumber: boolean; - placeholder: boolean; - requestautocomplete: boolean; - formvalidation: boolean; - sandbox: boolean; - seamless: boolean; - srcdoc: boolean; - apng: boolean; - imgcrossorigin: boolean; - jpeg2000: boolean; - jpegxr: boolean; - sizes: boolean; - srcset: boolean; - webpalpha: boolean; - webpanimation: boolean; - webplossless: boolean; - "webp-lossless": boolean; - webp: boolean; - inputformaction: boolean; - inputformenctype: boolean; - inputformmethod: boolean; - inputformtarget: boolean; - beacon: boolean; - lowbandwidth: boolean; - eventsource: boolean; - fetch: boolean; - xhrresponsetypearraybuffer: boolean; - xhrresponsetypeblob: boolean; - xhrresponsetypedocument: boolean; - xhrresponsetypejson: boolean; - xhrresponsetypetext: boolean; - xhrresponsetype: boolean; - xhr2: boolean; - scriptasync: boolean; - scriptdefer: boolean; - speechrecognition: boolean; - speechsynthesis: boolean; - localstorage: boolean; - sessionstorage: boolean; - websqldatabase: boolean; - stylescoped: boolean; - svgasimg: boolean; - svgclippaths: boolean; - svgfilters: boolean; - svgforeignobject: boolean; - inlinesvg: boolean; - smil: boolean; - textareamaxlength: boolean; - bloburls: boolean; - datauri: boolean; - urlparser: boolean; - videoautoplay: boolean; - videoloop: boolean; - videopreload: boolean; - webglextensions: boolean; - datachannel: boolean; - getusermedia: boolean; - peerconnection: boolean; - websocketsbinary: boolean; - atobbtoa: boolean; - framed: boolean; - matchmedia: boolean; - blobworkers: boolean; - dataworkers: boolean; - sharedworkers: boolean; - transferables: boolean; - webworkers: boolean; - - // Undocumented - usually aliases or new features - - "atob-btoa": boolean; - "battery-api": boolean; - "blob-constructor": boolean; - "display-table": boolean; - "input-formaction": boolean; - "input-formenctype": boolean; - "input-formtarget": boolean; - "object-fit": boolean; - crypto: boolean; - displayrunin: boolean; - fileinputdirectory: boolean; - hairline: boolean; - inputsearchevent: boolean; - raf: boolean; - webanimations: boolean; - } - - interface Dictionary { - [key: string]: T; - } - - interface ModernizrAPI { - on(feature: string, cb: (result: boolean) => any): void; - - addTest(feature: string, test: () => boolean): void; - addTest(feature: string, test: boolean): void; - addTest(feature: Dictionary): void; - - atRule(prop: string): boolean; - - _domPrefixes: string[]; - - hasEvent(eventName: string, element?: EventTarget): boolean; - - mq(mq: string): boolean; - - prefixed(prop: string): string; - prefixed(prop: string, obj: EventTarget, element?: boolean): any; - - prefixedCSS(prop: string): string; - - prefixedCSSValue(prop: string, value: string): string; - - _prefixes: string[]; - - testAllProps(prop: string, value?: string, skipValueTest?: boolean): boolean; - - testProp(prop: string, value?: string, useValue?: boolean): boolean; - - testStyles(rule: string, callback: (elem: HTMLDivElement, rule: string) => void, nodes?: number, testnames?: string[]): boolean; - } - - export interface ModernizrStatic extends ModernizrAPI, FeatureDetects { } +interface AudioBoolean { + ogg: boolean; + mp3: boolean; + wav: boolean; + m4a: boolean; } -declare var Modernizr: __Modernizr.ModernizrStatic; +interface VideoBoolean { + ogg: boolean; + h264: boolean; + webm: boolean; +} + +interface InputBoolean { + autocomplete: boolean; + autofocus: boolean; + list: boolean; + placeholder: boolean; + max: boolean; + min: boolean; + multiple: boolean; + pattern: boolean; + required: boolean; + step: boolean; +} + +interface InputTypesBoolean { + color: boolean; + date: boolean; + datetime: boolean; + "datetime-local": boolean; + email: boolean; + month: boolean; + number: boolean; + range: boolean; + search: boolean; + tel: boolean; + time: boolean; + url: boolean; + week: boolean; +} + +interface FeatureDetects { + // Documented + + ambientlight: boolean; + applicationcache: boolean; + audio: AudioBoolean; + batteryapi: boolean; + blobconstructor: boolean; + canvas: boolean; + canvastext: boolean; + contenteditable: boolean; + contextmenu: boolean; + cookies: boolean; + cors: boolean; + cryptography: boolean; + customprotocolhandler: boolean; + customevent: boolean; + dart: boolean; + dataview: boolean; + emoji: boolean; + eventlistener: boolean; + exiforientation: boolean; + flash: boolean; + forcetouch: boolean; + fullscreen: boolean; + gamepads: boolean; + geolocation: boolean; + hashchange: boolean; + hiddenscroll: boolean; + history: boolean; + htmlimports: boolean; + ie8compat: boolean; + indexeddb: boolean; + indexeddbblob: boolean; + input: InputBoolean; + search: boolean; + inputtypes: InputTypesBoolean; + intl: boolean; + json: boolean; + ligatures: boolean; + olreversed: boolean; + mathml: boolean; + notification: boolean; + pagevisibility: boolean; + performance: boolean; + pointerevents: boolean; + pointerlock: boolean; + postmessage: boolean; + proximity: boolean; + queryselector: boolean; + quotamanagement: boolean; + requestanimationframe: boolean; + serviceworker: boolean; + svg: boolean; + templatestrings: boolean; + touchevents: boolean; + typedarrays: boolean; + unicoderange: boolean; + unicode: boolean; + userdata: boolean; + vibrate: boolean; + video: VideoBoolean; + vml: boolean; + webintents: boolean; + animation: boolean; + webgl: boolean; + websockets: boolean; + xdomainrequest: boolean; + adownload: boolean; + audioloop: boolean; + audiopreload: boolean; + webaudio: boolean; + lowbattery: boolean; + canvasblending: boolean; + todataurljpeg: boolean; + todataurlpng: boolean; + todataurlwebp: boolean; + canvaswinding: boolean; + getrandomvalues: boolean; + cssall: boolean; + cssanimations: boolean; + appearance: boolean; + backdropfilter: boolean; + backgroundblendmode: boolean; + backgroundcliptext: boolean; + bgpositionshorthand: boolean; + bgpositionxy: boolean; + bgrepeatspace: boolean; + bgrepeatround: boolean; + backgroundsize: boolean; + bgsizecover: boolean; + borderimage: boolean; + borderradius: boolean; + boxshadow: boolean; + boxsizing: boolean; + csscalc: boolean; + checked: boolean; + csschunit: boolean; + csscolumns: boolean; + cubicbezierrange: boolean; + "display-runin": boolean; + displaytable: boolean; + ellipsis: boolean; + cssescape: boolean; + cssexunit: boolean; + cssfilters: boolean; + flexbox: boolean; + flexboxlegacy: boolean; + flexboxtweener: boolean; + flexwrap: boolean; + fontface: boolean; + generatedcontent: boolean; + cssgradients: boolean; + csshairline: boolean; + hsla: boolean; + csshyphens: boolean; + softhyphens: boolean; + softhyphensfind: boolean; + cssinvalid: boolean; + lastchild: boolean; + cssmask: boolean; + mediaqueries: boolean; + multiplebgs: boolean; + nthchild: boolean; + objectfit: boolean; + opacity: boolean; + overflowscrolling: boolean; + csspointerevents: boolean; + csspositionsticky: boolean; + csspseudoanimations: boolean; + csspseudotransitions: boolean; + cssreflections: boolean; + regions: boolean; + cssremunit: boolean; + cssresize: boolean; + rgba: boolean; + cssscrollbar: boolean; + scrollsnappoints: boolean; + shapes: boolean; + siblinggeneral: boolean; + subpixelfont: boolean; + supports: boolean; + target: boolean; + textalignlast: boolean; + textshadow: boolean; + csstransforms: boolean; + csstransforms3d: boolean; + preserve3d: boolean; + csstransitions: boolean; + userselect: boolean; + cssvalid: boolean; + cssvhunit: boolean; + cssvmaxunit: boolean; + cssvminunit: boolean; + cssvwunit: boolean; + willchange: boolean; + wrapflow: boolean; + classlist: boolean; + createelementattrs: boolean; + "createelement-attrs": boolean; + dataset: boolean; + documentfragment: boolean; + hidden: boolean; + microdata: boolean; + mutationobserver: boolean; + bdi: boolean; + datalistelem: boolean; + details: boolean; + outputelem: boolean; + picture: boolean; + progressbar: boolean; + meter: boolean; + ruby: boolean; + template: boolean; + time: boolean; + texttrackapi: boolean; + track: boolean; + unknownelements: boolean; + es5array: boolean; + es5date: boolean; + es5function: boolean; + es5object: boolean; + es5: boolean; + strictmode: boolean; + es5string: boolean; + es5syntax: boolean; + es5undefined: boolean; + es6array: boolean; + es6collections: boolean; + contains: boolean; + generators: boolean; + es6math: boolean; + es6number: boolean; + es6object: boolean; + promises: boolean; + es6string: boolean; + devicemotion: boolean; + deviceorientation: boolean; + oninput: boolean; + filereader: boolean; + filesystem: boolean; + capture: boolean; + fileinput: boolean; + directory: boolean; + formattribute: boolean; + localizednumber: boolean; + placeholder: boolean; + requestautocomplete: boolean; + formvalidation: boolean; + sandbox: boolean; + seamless: boolean; + srcdoc: boolean; + apng: boolean; + imgcrossorigin: boolean; + jpeg2000: boolean; + jpegxr: boolean; + sizes: boolean; + srcset: boolean; + webpalpha: boolean; + webpanimation: boolean; + webplossless: boolean; + "webp-lossless": boolean; + webp: boolean; + inputformaction: boolean; + inputformenctype: boolean; + inputformmethod: boolean; + inputformtarget: boolean; + beacon: boolean; + lowbandwidth: boolean; + eventsource: boolean; + fetch: boolean; + xhrresponsetypearraybuffer: boolean; + xhrresponsetypeblob: boolean; + xhrresponsetypedocument: boolean; + xhrresponsetypejson: boolean; + xhrresponsetypetext: boolean; + xhrresponsetype: boolean; + xhr2: boolean; + scriptasync: boolean; + scriptdefer: boolean; + speechrecognition: boolean; + speechsynthesis: boolean; + localstorage: boolean; + sessionstorage: boolean; + websqldatabase: boolean; + stylescoped: boolean; + svgasimg: boolean; + svgclippaths: boolean; + svgfilters: boolean; + svgforeignobject: boolean; + inlinesvg: boolean; + smil: boolean; + textareamaxlength: boolean; + bloburls: boolean; + datauri: boolean; + urlparser: boolean; + videoautoplay: boolean; + videoloop: boolean; + videopreload: boolean; + webglextensions: boolean; + datachannel: boolean; + getusermedia: boolean; + peerconnection: boolean; + websocketsbinary: boolean; + atobbtoa: boolean; + framed: boolean; + matchmedia: boolean; + blobworkers: boolean; + dataworkers: boolean; + sharedworkers: boolean; + transferables: boolean; + webworkers: boolean; + + // Undocumented - usually aliases or new features + + "atob-btoa": boolean; + "battery-api": boolean; + "blob-constructor": boolean; + "display-table": boolean; + "input-formaction": boolean; + "input-formenctype": boolean; + "input-formtarget": boolean; + "object-fit": boolean; + crypto: boolean; + displayrunin: boolean; + fileinputdirectory: boolean; + hairline: boolean; + inputsearchevent: boolean; + raf: boolean; + webanimations: boolean; +} + +interface Dictionary { + [key: string]: T; +} + +interface ModernizrAPI { + on(feature: string, cb: (result: boolean) => any): void; + + addTest(feature: string, test: (() => boolean) | boolean): void; + addTest(feature: Dictionary): void; + + atRule(prop: string): boolean; + + _domPrefixes: string[]; + + hasEvent(eventName: string, element?: EventTarget): boolean; + + mq(mq: string): boolean; + + prefixed(prop: string): string; + prefixed(prop: string, obj: EventTarget, element?: boolean): any; + + prefixedCSS(prop: string): string; + + prefixedCSSValue(prop: string, value: string): string; + + _prefixes: string[]; + + testAllProps(prop: string, value?: string, skipValueTest?: boolean): boolean; + + testProp(prop: string, value?: string, useValue?: boolean): boolean; + + testStyles(rule: string, callback: (elem: HTMLDivElement, rule: string) => void, nodes?: number, testnames?: string[]): boolean; +} + +interface ModernizrStatic extends ModernizrAPI, FeatureDetects { } + +declare var Modernizr: ModernizrStatic; +declare module "Modernizr" { + export = Modernizr; +} diff --git a/modernizr/tslint.json b/modernizr/tslint.json new file mode 100644 index 0000000000..8ba2515dc2 --- /dev/null +++ b/modernizr/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "../tslint.json", + "rules": { + "no-single-declare-module": false, + "no-empty-interface": false + } +} \ No newline at end of file From 59e3f424576e2a909496f6d8f2ebaa8f39339cbc Mon Sep 17 00:00:00 2001 From: Victor Widell Date: Fri, 20 Jan 2017 20:09:01 +0100 Subject: [PATCH 020/140] Added `text` option to `extendTypes`. (#14132) --- koa-bodyparser/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/koa-bodyparser/index.d.ts b/koa-bodyparser/index.d.ts index d3849cf9f9..932a53f7af 100644 --- a/koa-bodyparser/index.d.ts +++ b/koa-bodyparser/index.d.ts @@ -59,6 +59,7 @@ declare function bodyParser(opts?: { extendTypes?: { json?: string[]; form?: string[]; + text?: string[]; } /** From 0705aae93a46216181168fe463fa793a07a9b061 Mon Sep 17 00:00:00 2001 From: Michael Joye Date: Fri, 20 Jan 2017 14:16:54 -0500 Subject: [PATCH 021/140] Change the toSerialized to ToSerialized so it matches what SharePoint SP.Guid has (#14147) --- sharepoint/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sharepoint/index.d.ts b/sharepoint/index.d.ts index 22bed0c0aa..2bc22e9234 100644 --- a/sharepoint/index.d.ts +++ b/sharepoint/index.d.ts @@ -1624,7 +1624,7 @@ declare namespace SP { static isValid(uuid: string): boolean; toString(format?: string): string; equals(uuid: SP.Guid): boolean; - toSerialized(): string; + ToSerialized(): string; } /** Specifies permissions that are used to define user roles. Represents SPBasePermissions class. */ export enum PermissionKind { From a569c59c8fe5f9a614a6c5a70e464557ed9200a2 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Fri, 20 Jan 2017 11:19:03 -0800 Subject: [PATCH 022/140] Add major version upgrade documentation (#14130) * Add major version upgrade documentation * add note about depenencies --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index 4940649a6e..fd34c4ae33 100644 --- a/README.md +++ b/README.md @@ -224,6 +224,38 @@ If the standard is still a draft, it belongs here. Use a name beginning with `dom-` and include a link to the standard as the "Project" link in the header. When it graduates draft mode, we may remove it from DefinitelyTyped and deprecate the associated `@types` package. +#### I want to update a package to a new major version + +Before making your change, please create a new subfolder with the current version e.g. `v2`, and copy existing files to it. You will need to: + +1. Update the relative paths in `tsconfig.json` as well as `tslint.json`. +2. Add path mapping rules to ensure that tests are running against the intended version. + +For example [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/history/v2/tsconfig.json) looks like: + +```json +{ + "compilerOptions": { + "baseUrl": "../../", + "typeRoots": ["../../"], + "paths": { + "history": [ "history/v2" ] + }, + }, + "files": [ + "index.d.ts", + "history-tests.ts" + ] +} +``` + +Please note that unless upgrading something backwards-compatible like `node`, all packages depending of the updated package need a path mapping to it, as well as packages depending on *those*. +For example, `react-router` depends on `history@2`, so [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/react-router/tsconfig.json) has a path mapping to `"history": [ "history/v2" ]`; +transitively `react-router-bootstrap` (which depends on `react-router`) also adds a path mapping in its [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/react-router-bootstrap/tsconfig.json). + +Also, `/// ` will not work with path mapping, so dependencies must use `import`. + + ## License This project is licensed under the MIT license. From 26857897650290c60cf75d3ed28b3f80d52f9942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20C=C3=B4t=C3=A9?= Date: Fri, 20 Jan 2017 14:24:33 -0500 Subject: [PATCH 023/140] Add collapsible callback function (#14142) --- materialize-css/index.d.ts | 12 ++++++++++++ materialize-css/materialize-css-tests.ts | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/materialize-css/index.d.ts b/materialize-css/index.d.ts index 14e68a7c21..ea844d959f 100644 --- a/materialize-css/index.d.ts +++ b/materialize-css/index.d.ts @@ -16,6 +16,18 @@ declare namespace Materialize { * A setting that changes the collapsible behavior to expandable instead of the default accordion style */ accordion: boolean; + + /** + * Callback for Collapsible section close. + * Default: function() { alert('Closed'); } + */ + onClose?: Function; + + /** + * Callback for Collapsible section open. + * Default: function() { alert('Opened'); } + */ + onOpen?: Function; } interface TooltipOptions { diff --git a/materialize-css/materialize-css-tests.ts b/materialize-css/materialize-css-tests.ts index 45c9c84a76..15189e1b8f 100644 --- a/materialize-css/materialize-css-tests.ts +++ b/materialize-css/materialize-css-tests.ts @@ -44,8 +44,8 @@ var collapseHtml = '
    ' + '' + '
'; -$(collapseHtml).collapsible({ accordion : false }); -$(collapseHtml).collapsible({ accordion : true }); +$(collapseHtml).collapsible({ accordion : false, onClose : function() { alert('Closed'); } }); +$(collapseHtml).collapsible({ accordion : true, onOpen : function() { alert('Opened'); } }); // Dialogs - Toasts Materialize.toast('I am a toast!', 4000); From a5a560b3e1dee1782450abae2a8e7f9e2b605609 Mon Sep 17 00:00:00 2001 From: Danny Cochran Date: Fri, 20 Jan 2017 13:28:33 -0800 Subject: [PATCH 024/140] Update webViewStatic to include postMessage API (#14151) --- react-native/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/react-native/index.d.ts b/react-native/index.d.ts index 92b04ef40c..d63a339d0a 100644 --- a/react-native/index.d.ts +++ b/react-native/index.d.ts @@ -2106,6 +2106,11 @@ declare module "react" { */ goForward: () => void + /** + * Post a message to the WebView in the form of a string. + */ + postMessage: (message: string) => void + /** * Reloads the current page. */ From 138e095da4620b43dd4f738498589d36e596a56d Mon Sep 17 00:00:00 2001 From: durad Date: Fri, 20 Jan 2017 13:31:50 -0800 Subject: [PATCH 025/140] Added definition for globule (#14153) * Implemented match, isMath and find * Added all functions * Made options optional. * Added tslint.json and fixed lint errors * Fixed definition for mapping function * Fixed issue with strict nulls --- globule/globule-tests.ts | 28 +++++++++++++ globule/index.d.ts | 87 ++++++++++++++++++++++++++++++++++++++++ globule/tsconfig.json | 20 +++++++++ globule/tslint.json | 1 + 4 files changed, 136 insertions(+) create mode 100644 globule/globule-tests.ts create mode 100644 globule/index.d.ts create mode 100644 globule/tsconfig.json create mode 100644 globule/tslint.json diff --git a/globule/globule-tests.ts b/globule/globule-tests.ts new file mode 100644 index 0000000000..d0e1eb3ccb --- /dev/null +++ b/globule/globule-tests.ts @@ -0,0 +1,28 @@ +import * as globule from 'globule'; + +let filepaths: string[]; + +filepaths = globule.find('**/*.js'); +filepaths = globule.find(['**/*.js']); +filepaths = globule.find('**/*.js', '**/*.less'); +filepaths = globule.find('*.js', { matchBase: true }); +filepaths = globule.find('**/*.js', '**/*.less', { filter: 'isFile' }); +filepaths = globule.find('**/*.js', '**/*.less', { filter: /jQuery/i.test }); +filepaths = globule.find({ src: '**/*.js' }); + +filepaths = globule.match('*.js', '/home/code'); +filepaths = globule.match('*.js', '/home/code', { matchBase: true }); + +let bResult: boolean; +bResult = globule.isMatch('*.js', '/home/code'); +bResult = globule.isMatch('*.js', '/home/code', { matchBase: true }); + +let mappings = globule.mapping(['*.js']); +let len = mappings.length; +let src = mappings[0].src; +let dest = mappings[0].dest; + +mappings = globule.mapping(['*.js'], { srcBase: '/home/code' }); +mappings = globule.mapping(['*.js', '*.less']); +mappings = globule.mapping(['*.js'], ['*.less']); + diff --git a/globule/index.d.ts b/globule/index.d.ts new file mode 100644 index 0000000000..595a4d2aec --- /dev/null +++ b/globule/index.d.ts @@ -0,0 +1,87 @@ +// Type definitions for globule 1.1 +// Project: https://github.com/cowboy/node-globule +// Definitions by: Dusan Radovanovic +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import minimatch = require('minimatch'); +import glob = require('glob'); + +interface FindOptions extends glob.IOptions { + src?: string; + filter?: string | ((filepath?: string, options?: any) => boolean); + nonull?: boolean; + matchBase?: boolean; + srcBase?: string; + prefixBase?: boolean; +} + +interface MappingOptions extends FindOptions { + srcBase?: string; + destBase?: string; + ext?: string; + extDot?: 'first' | 'last'; + flatten?: boolean; + rename?: (p: string) => string; +} + +interface OneMapping { + src: string[]; + dest: string; +} + +interface GlobuleStatic { + /** + * Match one or more globbing patterns against one or more file paths. + * Returns a uniqued array of all file paths that match any of the specified globbing patterns. + */ + match(patterns: string | string[], filepaths: string | string[], options?: minimatch.IOptions): string[]; + + /** + * Tests pattern(s) against against one or more file paths and returns true if any files were matched, otherwise false. + */ + isMatch(patterns: string | string[], filepaths: string | string[], options?: minimatch.IOptions): boolean; + + /** + * Returns a unique array of all file or directory paths that match the given globbing pattern(s) + */ + find(pattern: string | string[], options?: FindOptions): string[]; + + /** + * Returns a unique array of all file or directory paths that match the given globbing pattern(s) + */ + find(options: FindOptions): string[]; + + /** + * Returns a unique array of all file or directory paths that match the given globbing pattern(s) + */ + find(pattern: string | string[], pattern2: string | string[], options?: FindOptions): string[]; + + /** + * Returns a unique array of all file or directory paths that match the given globbing pattern(s) + */ + find(pattern: string, pattern2: string, pattern3: string | string[], options?: FindOptions): string[]; + + /** + * Given a set of source file paths, returns an array of src-dest file mapping objects + */ + mapping(filepaths: string[], options?: MappingOptions): OneMapping[]; + + /** + * Given a set of source file paths, returns an array of src-dest file mapping objects + */ + mapping(options: MappingOptions): OneMapping[]; + + /** + * Given a set of source file paths, returns an array of src-dest file mapping objects + */ + mapping(filepaths: string[], filepaths2: string[], options?: MappingOptions): OneMapping[]; + + /** + * Given a set of source file paths, returns an array of src-dest file mapping objects + */ + mapping(filepaths: string[], filepaths2: string[], filepaths3: string[], options?: MappingOptions): OneMapping[]; +} + +declare var globule: GlobuleStatic; +export = globule; + diff --git a/globule/tsconfig.json b/globule/tsconfig.json new file mode 100644 index 0000000000..ec155b8b0f --- /dev/null +++ b/globule/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "globule-tests.ts" + ] +} \ No newline at end of file diff --git a/globule/tslint.json b/globule/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/globule/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 8b6b40ad3521b1bab78d1e88a8ed79bcbb003d20 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 20 Jan 2017 16:33:34 -0800 Subject: [PATCH 026/140] ecmarkup: Provides its own types (#14150) --- ecmarkup/ecmarkup-tests.ts | 21 --------------------- ecmarkup/index.d.ts | 32 -------------------------------- ecmarkup/tsconfig.json | 22 ---------------------- notNeededPackages.json | 6 ++++++ 4 files changed, 6 insertions(+), 75 deletions(-) delete mode 100644 ecmarkup/ecmarkup-tests.ts delete mode 100644 ecmarkup/index.d.ts delete mode 100644 ecmarkup/tsconfig.json diff --git a/ecmarkup/ecmarkup-tests.ts b/ecmarkup/ecmarkup-tests.ts deleted file mode 100644 index f6cb6a6fb6..0000000000 --- a/ecmarkup/ecmarkup-tests.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// - -import * as emu from "ecmarkup"; - -emu.build("string", (path: string) => Promise.resolve("string"), { - contributors: "string", - copyright: true, - date: new Date(), - location: "string", - oldToc: true, - toc: true, - shortname: "string", - stage: "string", - status: "proposal", - title: "string", - version: "string", - verbose: true -}).then((spec: emu.Spec) => { - const output = spec.toHTML(); - const biblio = spec.exportBiblio(); -}); \ No newline at end of file diff --git a/ecmarkup/index.d.ts b/ecmarkup/index.d.ts deleted file mode 100644 index 79a84c63a7..0000000000 --- a/ecmarkup/index.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Type definitions for emarkup v3.3.2 -// Project: http://github.com/bterlson/ecmarkup -// Definitions by: Ron Buckton -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export interface Spec { - spec: this; - location: string; - opts: Options; - rootPath: string; - rootDir: string; - namespace: string; - toHTML(): string; - exportBiblio(): any; -} - -export interface Options { - status?: "proposal" | "draft" | "standard"; - version?: string; - title?: string; - shortname?: string; - stage?: string | null; - copyright?: boolean; - date?: Date; - location?: string; - contributors?: string; - toc?: boolean; - oldToc?: boolean; - verbose?: boolean; -} - -export function build(path: string, fetch: (path: string) => PromiseLike, opts?: Options): PromiseLike; \ No newline at end of file diff --git a/ecmarkup/tsconfig.json b/ecmarkup/tsconfig.json deleted file mode 100644 index 2a9343d5ec..0000000000 --- a/ecmarkup/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "ecmarkup-tests.ts" - ] -} \ No newline at end of file diff --git a/notNeededPackages.json b/notNeededPackages.json index e6fc627970..482436bc9e 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -281,6 +281,12 @@ "typingsPackageName": "vue-router", "sourceRepoURL": "https://github.com/vuejs/vue-router", "asOfVersion": "2.0.0" + }, + { + "libraryName": "ecmarkup", + "typingsPackageName": "ecmarkup", + "sourceRepoURL": "https://github.com/bterlson/ecmarkup", + "asOfVersion": "3.4.0" } ] } \ No newline at end of file From d568404f00bf57c1f00c9cdb71545d77d1480471 Mon Sep 17 00:00:00 2001 From: Vu Tran Date: Fri, 20 Jan 2017 16:39:37 -0800 Subject: [PATCH 027/140] react-virtualized: Add interfaces for Table and Column (#14156) --- react-virtualized/index.d.ts | 63 +++++++++++++++++++ react-virtualized/react-virtualized-tests.tsx | 33 +++++++++- 2 files changed, 95 insertions(+), 1 deletion(-) diff --git a/react-virtualized/index.d.ts b/react-virtualized/index.d.ts index ab43deb8b7..cff271ae5f 100644 --- a/react-virtualized/index.d.ts +++ b/react-virtualized/index.d.ts @@ -71,6 +71,69 @@ declare module "react-virtualized" { } export class List extends React.Component { } + // https://github.com/bvaughn/react-virtualized/blob/master/docs/Column.md + interface ColumnProps { + cellDataGetter?: (info: { columnData: any, dataKey: string, rowData: any }) => any; + cellRenderer?: (info: { cellData: any, columnData: any, dataKey: string, isScrolling: boolean, rowData: any, rowIndex: number }) => any; + className?: string; + columnData?: any; + dataKey: any; + disableSort?: boolean; + flexGrow?: number; + flexShrink?: number; + headerClassName?: string; + headerRenderer?: (info: { columnData: any, dataKey: string, disableSort: boolean, label: string, sortBy: string, sortDirection: string }) => any; + label?: string; + maxWidth?: number; + minWidth?: number; + style?: React.CSSProperties; + width: number; + } + + export class Column extends React.Component { } + + // ref: https://github.com/bvaughn/react-virtualized/blob/master/docs/Table.md + interface TableProps { + autoHeight?: boolean; + children?: React.ReactNode; + className?: string; + disableHeader?: boolean; + estimatedRowSize?: number; + gridClassName?: string; + gridStyle?: any; + headerClassName?: string; + headerHeight: number; + headerStyle?: any; + height: number; + id?: string; + noRowsRender?: () => void; + onHeaderClick?: (dataKey: string, columnData: any) => void; + onRowClick?: (info: { index: number }) => void; + onRowDoubleClick?: (info: { index: number }) => void; + onRowMouseOut?: (info: { index: number }) => void; + onRowMouseOver?: (info: { index: number }) => void; + onRowsRendered?: (info: { index: number }) => void; + overscanRowCount?: number; + onScroll?: (info: { clientHeight: number, scrollHeight: number, scrollTop: number }) => void; + rowClassName?: string | ((info: { index: number }) => string); + rowCount: number; + rowGetter?: (info: { index: number }) => any; + rowHeight: number | ((info: { index: number }) => number); + rowRenderer?: (info: { index: number, isScrolling: boolean }) => React.ReactNode; + rowStyle?: React.CSSProperties | ((info: { index: number }) => React.CSSProperties); + scrollToAlignment?: string; + scrollToIndex?: number; + scrollTop?: number; + sort?: (info: { sortBy: string, sortDirection: 'ASC' | 'DESC' }) => void; + sortBy?: string; + sortDirection?: 'ASC' | 'DESC'; + style?: React.CSSProperties; + tabIndex?: number; + width: number; + } + + export class Table extends React.Component { } + /* * Higher-Order Components */ diff --git a/react-virtualized/react-virtualized-tests.tsx b/react-virtualized/react-virtualized-tests.tsx index 791e4df9a0..7da7e26c88 100644 --- a/react-virtualized/react-virtualized-tests.tsx +++ b/react-virtualized/react-virtualized-tests.tsx @@ -19,7 +19,9 @@ import { InfiniteLoader, ScrollSync, WindowScroller, - List + List, + Column, + Table, } from "react-virtualized"; /* @@ -128,6 +130,35 @@ function ListTest() { ); } +function TableTest() { + const list = [ + { name: 'Brian Vaughn', description: 'Software engineer' } + // And so on... + ]; + ReactDOM.render( + list[index]} + > + + +
, + document.getElementById('example') + ); +} + function VirtualScrollTest() { // List data as an array of strings const list = [ From 00aa560a49892cd736758f9a7a121097c95a84cd Mon Sep 17 00:00:00 2001 From: asankaf Date: Sat, 21 Jan 2017 12:58:53 +0530 Subject: [PATCH 028/140] Updates in the worksheet row type enum - Since couple of releases, worksheet row type enum values used for groupHeader and groupFooter were updated to group-header and group-footer. - New values are used in src\js\kendo.excel.js (lines 180 and 226) - v2017.1.118 --- kendo-ui/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kendo-ui/index.d.ts b/kendo-ui/index.d.ts index 5d6e4ec0a8..ecdbffae66 100644 --- a/kendo-ui/index.d.ts +++ b/kendo-ui/index.d.ts @@ -18307,7 +18307,7 @@ declare namespace kendo.ooxml { cells?: WorkbookSheetRowCell[]; index?: number; height?: number; - type?: "header" | "footer" | "groupHeader" | "groupFooter" | "data"; + type?: "header" | "footer" | "group-header" | "group-footer" | "data"; } interface WorkbookSheet { From a8f925e787e17df0ae5a4727de7fefbd8df7390d Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Sat, 21 Jan 2017 21:14:25 +0800 Subject: [PATCH 029/140] add cannon,rsvp,wonder-commonlib,wonder-frp dts file --- cannon/index.d.ts | 989 +++++++++++++++++++++++++++++++++ cannon/tsconfig.json | 21 + rsvp/index.d.ts | 315 +++++++++++ rsvp/tsconfig.json | 21 + wonder-commonlib/index.d.ts | 258 +++++++++ wonder-commonlib/tsconfig.json | 21 + wonder-frp/index.d.ts | 718 ++++++++++++++++++++++++ wonder-frp/tsconfig.json | 21 + 8 files changed, 2364 insertions(+) create mode 100644 cannon/index.d.ts create mode 100644 cannon/tsconfig.json create mode 100644 rsvp/index.d.ts create mode 100644 rsvp/tsconfig.json create mode 100644 wonder-commonlib/index.d.ts create mode 100644 wonder-commonlib/tsconfig.json create mode 100644 wonder-frp/index.d.ts create mode 100644 wonder-frp/tsconfig.json diff --git a/cannon/index.d.ts b/cannon/index.d.ts new file mode 100644 index 0000000000..90493d5edd --- /dev/null +++ b/cannon/index.d.ts @@ -0,0 +1,989 @@ +declare module CANNON { + + export interface IAABBOptions { + + upperBound?: Vec3; + lowerBound?: Vec3; + + } + + export class AABB { + + lowerBound: Vec3; + upperBound: Vec3; + + constructor(options?: IAABBOptions); + + setFromPoints(points: Vec3[], position?: Vec3, quaternion?: Quaternion, skinSize?: number): void; + copy(aabb: AABB): void; + extend(aabb: AABB): void; + overlaps(aabb: AABB): boolean; + + } + + export class ArrayCollisionMatrix { + + matrix: Mat3[]; + + get(i: number, j: number): number; + set(i: number, j: number, value?: number): void; + reset(): void; + setNumObjects(n: number): void; + + } + + export class BroadPhase { + + world: World; + useBoundingBoxes: boolean; + dirty: boolean; + + collisionPairs(world: World, p1: Body[], p2: Body[]): void; + needBroadphaseCollision(bodyA: Body, bodyB: Body): boolean; + intersectionTest(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void; + doBoundingSphereBroadphase(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void; + doBoundingBoxBroadphase(bodyA: Body, bodyB: Body, pairs1: Body[], pairs2: Body[]): void; + makePairsUnique(pairs1: Body[], pairs2: Body[]): void; + setWorld(world: World): void; + boundingSphereCheck(bodyA: Body, bodyB: Body): boolean; + aabbQuery(world: World, aabb: AABB, result: Body[]): Body[]; + + } + + export class GridBroadphase extends BroadPhase { + + nx: number; + ny: number; + nz: number; + aabbMin: Vec3; + aabbMax: Vec3; + bins: any[]; + + constructor(aabbMin?: Vec3, aabbMax?: Vec3, nx?: number, ny?: number, nz?: number); + + } + + export class NaiveBroadphase extends BroadPhase { + } + + export class ObjectCollisionMatrix { + + matrix: number[]; + + get(i: number, j: number): number; + set(i: number, j: number, value: number): void; + reset(): void; + setNumObjects(n: number): void; + + } + + export class Ray { + + from: Vec3; + to: Vec3; + precision: number; + checkCollisionResponse: boolean; + + constructor(from?: Vec3, to?: Vec3); + + getAABB(result: RaycastResult): void; + + } + + export class RaycastResult { + + rayFromWorld: Vec3; + rayToWorld: Vec3; + hitNormalWorld: Vec3; + hitPointWorld: Vec3; + hasHit: boolean; + shape: Shape; + body: Body; + distance: number; + + reset(): void; + set(rayFromWorld: Vec3, rayToWorld: Vec3, hitNormalWorld: Vec3, hitPointWorld: Vec3, shape: Shape, body: Body, distance: number): void; + + } + + export class SAPBroadphase extends BroadPhase { + + static insertionSortX(a: any[]): any[]; + static insertionSortY(a: any[]): any[]; + static insertionSortZ(a: any[]): any[]; + static checkBounds(bi: Body, bj: Body, axisIndex?: number): boolean; + + axisList: any[]; + world: World; + axisIndex: number; + + constructor(world?: World); + + autoDetectAxis(): void; + aabbQuery(world: World, aabb: AABB, result?: Body[]): Body[]; + + } + + export interface IConstraintOptions { + + collideConnected?: boolean; + wakeUpBodies?: boolean; + + } + + export class Constraint { + + equations: any[]; + bodyA: Body; + bodyB: Body; + id: number; + collideConnected: boolean; + + constructor(bodyA: Body, bodyB: Body, options?: IConstraintOptions); + + update(): void; + + } + + export class DistanceConstraint extends Constraint { + + constructor(bodyA: Body, bodyB: Body, distance: number, maxForce?: number); + + } + + export interface IHingeConstraintOptions { + + pivotA?: Vec3; + axisA?: Vec3; + pivotB?: Vec3; + axisB?: Vec3; + maxForce?: number; + + } + + export class HingeConstraint extends Constraint { + + motorEnabled: boolean; + motorTargetVelocity: number; + motorMinForce: number; + motorMaxForce: number; + motorEquation: RotationalMotorEquation; + + constructor(bodyA: Body, bodyB: Body, options?: IHingeConstraintOptions); + + enableMotor(): void; + disableMotor(): void; + + } + + export class PointToPointConstraint extends Constraint { + + constructor(bodyA: Body, pivotA: Vec3, bodyB: Body, pivotB: Vec3, maxForce?: number); + + } + + + export class LockConstraint extends Constraint { + constructor(bodyA: Body, bodyB: Body, options?:any); + } + + + + export class Equation { + + id: number; + minForce: number; + maxForce: number; + bi: Body; + bj: Body; + a: number; + b: number; + eps: number; + jacobianElementA: JacobianElement; + jacobianElementB: JacobianElement; + enabled: boolean; + + constructor(bi: Body, bj: Body, minForce?: number, maxForce?: number); + + setSpookParams(stiffness: number, relaxation: number, timeStep: number): void; + computeB(a: number, b: number, h: number): number; + computeGq(): number; + computeGW(): number; + computeGWlamda(): number; + computeGiMf(): number; + computeGiMGt(): number; + addToWlamda(deltalambda: number): number; + computeC(): number; + + } + + export class FrictionEquation extends Equation { + + constructor(bi: Body, bj: Body, slipForce: number); + + } + + export class RotationalEquation extends Equation { + + ni: Vec3; + nj: Vec3; + nixnj: Vec3; + njxni: Vec3; + invIi: Mat3; + invIj: Mat3; + relVel: Vec3; + relForce: Vec3; + + constructor(bodyA: Body, bodyB: Body); + + } + + export class RotationalMotorEquation extends Equation { + + axisA: Vec3; + axisB: Vec3; + invLi: Mat3; + invIj: Mat3; + targetVelocity: number; + + constructor(bodyA: Body, bodyB: Body, maxForce?: number); + + } + + export class ContactEquation extends Equation { + + restitution: number; + ri: Vec3; + rj: Vec3; + penetrationVec: Vec3; + ni: Vec3; + rixn: Vec3; + rjxn: Vec3; + invIi: Mat3; + invIj: Mat3; + biInvInertiaTimesRixn: Vec3; + bjInvInertiaTimesRjxn: Vec3; + + constructor(bi: Body, bj: Body); + + } + + export interface IContactMaterialOptions { + + friction?: number; + restitution?: number; + contactEquationStiffness?: number; + contactEquationRelaxation?: number; + frictionEquationStiffness?: number; + frictionEquationRelaxation?: number; + + } + + export class ContactMaterial { + + id: number; + materials: Material[]; + friction: number; + restitution: number; + contactEquationStiffness: number; + contactEquationRelaxation: number; + frictionEquationStiffness: number; + frictionEquationRelaxation: number; + + constructor(m1: Material, m2: Material, options?: IContactMaterialOptions); + + } + + export class Material { + + name: string; + id: number; + friction:number; + restitution:number; + + constructor(name: string); + + } + + export class JacobianElement { + + spatial: Vec3; + rotational: Vec3; + + multiplyElement(element: JacobianElement): number; + multiplyVectors(spacial: Vec3, rotational: Vec3): number; + + } + + export class Mat3 { + + constructor(elements?: number[]); + + identity(): void; + setZero(): void; + setTrace(vec3: Vec3): void; + getTrace(target: Vec3): void; + vmult(v: Vec3, target?: Vec3): Vec3; + smult(s: number): void; + mmult(m: Mat3): Mat3; + scale(v: Vec3, target?: Mat3): Mat3; + solve(b: Vec3, target?: Vec3): Vec3; + e(row: number, column: number, value?: number): number; + copy(source: Mat3): Mat3; + toString(): string; + reverse(target?: Mat3): Mat3; + setRotationFromQuaternion(q: Quaternion): Mat3; + transpose(target?: Mat3): Mat3; + + } + + export class Quaternion { + + x: number; + y: number; + z: number; + w: number; + + constructor(x?: number, y?: number, z?: number, w?: number); + + set(x: number, y: number, z: number, w: number): void; + toString(): string; + toArray(): number[]; + setFromAxisAngle(axis: Vec3, angle: number): void; + toAxisAngle(targetAxis?: Vec3): any[]; + setFromVectors(u: Vec3, v: Vec3): void; + mult(q: Quaternion, target?: Quaternion): Quaternion; + inverse(target?: Quaternion): Quaternion; + conjugate(target?: Quaternion): Quaternion; + normalize(): void; + normalizeFast(): void; + vmult(v: Vec3, target?: Vec3): Vec3; + copy(source: Quaternion): Quaternion; + toEuler(target: Vec3, order?: string): void; + setFromEuler(x: number, y: number, z: number, order?: string): Quaternion; + clone(): Quaternion; + + } + + export class Transform { + + static pointToLocalFrame(position: Vec3, quaternion: Quaternion, worldPoint: Vec3, result?: Vec3): Vec3; + static pointToWorldFrame(position: Vec3, quaternion: Quaternion, localPoint: Vec3, result?: Vec3): Vec3; + + position: Vec3; + quaternion: Quaternion; + + vectorToWorldFrame(localVector: Vec3, result?: Vec3): Vec3; + vectorToLocalFrame(position: Vec3, quaternion: Quaternion, worldVector: Vec3, result?: Vec3): Vec3; + + } + + export class Vec3 { + + static ZERO: Vec3; + + x: number; + y: number; + z: number; + + constructor(x?: number, y?: number, z?: number); + + cross(v: Vec3, target?: Vec3): Vec3; + set(x: number, y: number, z: number): Vec3; + setZero(): void; + vadd(v: Vec3, target?: Vec3): Vec3; + vsub(v: Vec3, target?: Vec3): Vec3; + crossmat(): Mat3; + normalize(): number; + unit(target?: Vec3): Vec3; + norm(): number; + norm2(): number; + distanceTo(p: Vec3): number; + mult(scalar: number, target?: Vec3): Vec3; + scale(scalar: number, target?: Vec3): Vec3; + dot(v: Vec3): number; + isZero(): boolean; + negate(target?: Vec3): Vec3; + tangents(t1: Vec3, t2: Vec3): void; + toString(): string; + toArray(): number[]; + copy(source: Vec3): Vec3; + lerp(v: Vec3, t: number, target?: Vec3): void; + almostEquals(v: Vec3, precision?: number): boolean; + almostZero(precision?: number): boolean; + isAntiparallelTo(v: Vec3, prescision?: number): boolean; + clone(): Vec3; + + } + + export interface IBodyOptions { + position?: Vec3; + velocity?: Vec3; + angularVelocity?: Vec3; + quaternion?: Quaternion; + mass?: number; + material?: number; + type?: number; + linearDamping?: number; + angularDamping?: number; + } + + export class Body extends EventTarget { + + static DYNAMIC: number; + static STATIC: number; + static KINEMATIC: number; + static AWAKE: number; + static SLEEPY: number; + static SLEEPING: number; + static sleepyEvent: IEvent; + static sleepEvent: IEvent; + + id: number; + world: World; + preStep: Function; + postStep: Function; + vlambda: Vec3; + collisionFilterGroup: number; + collisionFilterMask: number; + collisionResponse: boolean; + position: Vec3; + previousPosition: Vec3; + initPosition: Vec3; + velocity: Vec3; + initVelocity: Vec3; + force: Vec3; + mass: number; + invMass: number; + material: Material; + linearDamping: number; + type: number; + allowSleep: boolean; + sleepState: number; + sleepSpeedLimit: number; + sleepTimeLimit: number; + timeLastSleepy: number; + torque: Vec3; + quaternion: Quaternion; + initQuaternion: Quaternion; + angularVelocity: Vec3; + initAngularVelocity: Vec3; + interpolatedPosition: Vec3; + interpolatedQuaternion: Quaternion; + shapes: Shape[]; + shapeOffsets: any[]; + shapeOrentiations: any[]; + inertia: Vec3; + invInertia: Vec3; + invInertiaWorld: Mat3; + invMassSolve: number; + invInertiaSolve: Vec3; + invInteriaWorldSolve: Mat3; + fixedRotation: boolean; + angularDamping: number; + aabb: AABB; + aabbNeedsUpdate: boolean; + wlambda: Vec3; + + constructor(options?: IBodyOptions); + + wakeUp(): void; + sleep(): void; + sleepTick(time: number): void; + updateSolveMassProperties(): void; + pointToLocalFrame(worldPoint: Vec3, result?: Vec3): Vec3; + pointToWorldFrame(localPoint: Vec3, result?: Vec3): Vec3; + vectorToWorldFrame(localVector: Vec3, result?: Vec3): Vec3; + addShape(shape: Shape, offset?: Vec3, orientation?: Quaternion): void; + updateBoundingRadius(): void; + computeAABB(): void; + updateInertiaWorld(force: Vec3): void; + applyForce(force: Vec3, worldPoint: Vec3): void; + applyImpulse(impulse: Vec3, worldPoint: Vec3): void; + updateMassProperties(): void; + getVelocityAtWorldPoint(worldPoint: Vec3, result: Vec3): Vec3; + + } + + export interface IRaycastVehicleOptions { + + chassisBody?: Body; + indexRightAxis?: number; + indexLeftAxis?: number; + indexUpAxis?: number; + + } + + export interface IWheelInfoOptions { + + chassisConnectionPointLocal?: Vec3; + chassisConnectionPointWorld?: Vec3; + directionLocal?: Vec3; + directionWorld?: Vec3; + axleLocal?: Vec3; + axleWorld?: Vec3; + suspensionRestLength?: number; + suspensionMaxLength?: number; + radius?: number; + suspensionStiffness?: number; + dampingCompression?: number; + dampingRelaxation?: number; + frictionSlip?: number; + steering?: number; + rotation?: number; + deltaRotation?: number; + rollInfluence?: number; + maxSuspensionForce?: number; + isFronmtWheel?: boolean; + clippedInvContactDotSuspension?: number; + suspensionRelativeVelocity?: number; + suspensionForce?: number; + skidInfo?: number; + suspensionLength?: number; + maxSuspensionTravel?: number; + useCustomSlidingRotationalSpeed?: boolean; + customSlidingRotationalSpeed?: number; + + position?: Vec3; + direction?: Vec3; + axis?: Vec3; + body?: Body; + + } + + export class WheelInfo { + + maxSuspensionTravbel: number; + customSlidingRotationalSpeed: number; + useCustomSlidingRotationalSpeed: boolean; + sliding: boolean; + chassisConnectionPointLocal: Vec3; + chassisConnectionPointWorld: Vec3; + directionLocal: Vec3; + directionWorld: Vec3; + axleLocal: Vec3; + axleWorld: Vec3; + suspensionRestLength: number; + suspensionMaxLength: number; + radius: number; + suspensionStiffness: number; + dampingCompression: number; + dampingRelaxation: number; + frictionSlip: number; + steering: number; + rotation: number; + deltaRotation: number; + rollInfluence: number; + maxSuspensionForce: number; + engineForce: number; + brake: number; + isFrontWheel: boolean; + clippedInvContactDotSuspension: number; + suspensionRelativeVelocity: number; + suspensionForce: number; + skidInfo: number; + suspensionLength: number; + sideImpulse: number; + forwardImpulse: number; + raycastResult: RaycastResult; + worldTransform: Transform; + isInContact: boolean; + + constructor(options?: IWheelInfoOptions); + + } + + export class RaycastVehicle { + + chassisBody: Body; + wheelInfos: IWheelInfoOptions[]; + sliding: boolean; + world: World; + iindexRightAxis: number; + indexForwardAxis: number; + indexUpAxis: number; + + constructor(options?: IRaycastVehicleOptions); + + addWheel(options?: IWheelInfoOptions): void; + setSteeringValue(value: number, wheelIndex: number): void; + applyEngineForce(value: number, wheelIndex: number): void; + setBrake(brake: number, wheelIndex: number): void; + addToWorld(world: World): void; + getVehicleAxisWorld(axisIndex: number, result: Vec3): Vec3; + updateVehicle(timeStep: number): void; + updateSuspension(deltaTime: number): void; + removeFromWorld(world: World): void; + getWheelTransformWorld(wheelIndex: number): Transform; + + } + + export interface IRigidVehicleOptions { + + chassisBody: Body; + + } + + export class RigidVehicle { + + wheelBodies: Body[]; + coordinateSystem: Vec3; + chassisBody: Body; + constraints: Constraint[]; + wheelAxes: Vec3[]; + wheelForces: Vec3[]; + + constructor(options?: IRigidVehicleOptions); + + addWheel(options?: IWheelInfoOptions): Body; + setSteeringValue(value: number, wheelIndex: number): void; + setMotorSpeed(value: number, wheelIndex: number): void; + disableMotor(wheelIndex: number): void; + setWheelForce(value: number, wheelIndex: number): void; + applyWheelForce(value: number, wheelIndex: number): void; + addToWorld(world: World): void; + removeFromWorld(world: World): void; + getWheelSpeed(wheelIndex: number): number; + + } + + export class SPHSystem { + + particles: Particle[]; + density: number; + smoothingRadius: number; + speedOfSound: number; + viscosity: number; + eps: number; + pressures: number[]; + densities: number[]; + neighbors: number[]; + + add(particle: Particle): void; + remove(particle: Particle): void; + getNeighbors(particle: Particle, neighbors: Particle[]): void; + update(): void; + w(r: number): number; + gradw(rVec: Vec3, resultVec: Vec3): void; + nablaw(r: number): number; + + } + + export interface ISpringOptions { + + restLength?: number; + stiffness?: number; + damping?: number; + worldAnchorA?: Vec3; + worldAnchorB?: Vec3; + localAnchorA?: Vec3; + localAnchorB?: Vec3; + + } + + export class Spring { + + restLength: number; + stffness: number; + damping: number; + bodyA: Body; + bodyB: Body; + localAnchorA: Vec3; + localAnchorB: Vec3; + + constructor(options?: ISpringOptions); + + setWorldAnchorA(worldAnchorA: Vec3): void; + setWorldAnchorB(worldAnchorB: Vec3): void; + getWorldAnchorA(result: Vec3): void; + getWorldAnchorB(result: Vec3): void; + applyForce(): void; + + } + + export class Box extends Shape { + + static calculateIntertia(halfExtents: Vec3, mass: number, target: Vec3): void; + + boundingSphereRadius: number; + collisionResponse: boolean; + halfExtents: Vec3; + convexPolyhedronRepresentation: ConvexPolyhedron; + + constructor(halfExtents: Vec3); + + updateConvexPolyhedronRepresentation(): void; + calculateLocalInertia(mass: number, target?: Vec3): Vec3; + getSideNormals(sixTargetVectors: boolean, quat?: Quaternion): Vec3[]; + updateBoundingSphereRadius(): number; + volume(): number; + forEachWorldCorner(pos: Vec3, quat: Quaternion, callback: Function): void; + + } + + export class ConvexPolyhedron extends Shape { + + static computeNormal(va: Vec3, vb: Vec3, vc: Vec3, target: Vec3): void; + static project(hull: ConvexPolyhedron, axis: Vec3, pos: Vec3, quat: Quaternion, result: number[]): void; + + vertices: Vec3[]; + worldVertices: Vec3[]; + worldVerticesNeedsUpdate: boolean; + faces: number[]; + faceNormals: Vec3[]; + uniqueEdges: Vec3[]; + + constructor(points?: Vec3[], faces?: number[]); + + computeEdges(): void; + computeNormals(): void; + getFaceNormal(i: number, target: Vec3): Vec3; + clipAgainstHull(posA: Vec3, quatA: Quaternion, hullB: Vec3, quatB: Quaternion, separatingNormal: Vec3, minDist: number, maxDist: number, result: any[]): void; + findSaparatingAxis(hullB: ConvexPolyhedron, posA: Vec3, quatA: Quaternion, posB: Vec3, quatB: Quaternion, target: Vec3, faceListA: any[], faceListB: any[]): boolean; + testSepAxis(axis: Vec3, hullB: ConvexPolyhedron, posA: Vec3, quatA: Quaternion, posB: Vec3, quatB: Quaternion): number; + getPlaneConstantOfFace(face_i: number): number; + clipFaceAgainstHull(separatingNormal: Vec3, posA: Vec3, quatA: Quaternion, worldVertsB1: Vec3[], minDist: number, maxDist: number, result: any[]): void; + clipFaceAgainstPlane(inVertices: Vec3[], outVertices: Vec3[], planeNormal: Vec3, planeConstant: number): Vec3; + computeWorldVertices(position: Vec3, quat: Quaternion): void; + computeLocalAABB(aabbmin: Vec3, aabbmax: Vec3): void; + computeWorldFaceNormals(quat: Quaternion): void; + calculateWorldAABB(pos: Vec3, quat: Quaternion, min: Vec3, max: Vec3): void; + getAveragePointLocal(target: Vec3): Vec3; + transformAllPoints(offset: Vec3, quat: Quaternion): void; + pointIsInside(p: Vec3): boolean; + + } + + export class Cylinder extends Shape { + + constructor(radiusTop: number, radiusBottom: number, height: number, numSegments: number); + + } + + export interface IHightfield { + + minValue?: number; + maxValue?: number; + elementSize: number; + + } + + export class Heightfield extends Shape { + + data: number[]; + maxValue: number; + minValue: number; + elementSize: number; + cacheEnabled: boolean; + pillarConvex: ConvexPolyhedron; + pillarOffset: Vec3; + type: number; + + constructor(data: number[], options?: IHightfield); + + update(): void; + updateMinValue(): void; + updateMaxValue(): void; + setHeightValueAtIndex(xi: number, yi: number, value: number): void; + getRectMinMax(iMinX: number, iMinY: number, iMaxX: number, iMaxY: number, result: any[]): void; + getIndexOfPosition(x: number, y: number, result: any[], clamp: boolean): boolean; + getConvexTrianglePillar(xi: number, yi: number, getUpperTriangle: boolean): void; + + } + + export class Particle extends Shape { + + } + + export class Plane extends Shape { + + worldNormal: Vec3; + worldNormalNeedsUpdate: boolean; + boundingSphereRadius: number; + + computeWorldNormal(quat: Quaternion): void; + calculateWorldAABB(pos: Vec3, quat: Quaternion, min: number, max: number): void; + + } + + export class Shape { + + static types: { + + SPHERE: number; + PLANE: number; + BOX: number; + COMPOUND: number; + CONVEXPOLYHEDRON: number; + HEIGHTFIELD: number; + PARTICLE: number; + CYLINDER: number; + + } + + type: number; + boundingSphereRadius: number; + collisionResponse: boolean; + + updateBoundingSphereRadius(): number; + volume(): number; + calculateLocalInertia(mass: number, target: Vec3): Vec3; + + } + + export class Sphere extends Shape { + + radius: number; + + constructor(radius: number); + + } + + export class GSSolver extends Solver { + + iterations: number; + tolerance: number; + + solve(dy: number, world: World): number; + + + } + + export class Solver { + iterations: number; + equations: Equation[]; + + solve(dy: number, world: World): number; + addEquation(eq: Equation): void; + removeEquation(eq: Equation): void; + removeAllEquations(): void; + + } + + export class SplitSolver extends Solver { + + subsolver: Solver; + + constructor(subsolver: Solver); + + solve(dy: number, world: World): number; + + } + + export class EventTarget { + + addEventListener(type: string, listener: Function): EventTarget; + hasEventListener(type: string, listener: Function): boolean; + removeEventListener(type: string, listener: Function): EventTarget; + dispatchEvent(event: IEvent): IEvent; + + } + + export class Pool { + + objects: any[]; + type: any[]; + + release(): any; + get(): any; + constructObject(): any; + + } + + export class TupleDictionary { + + data: { + keys: any[]; + }; + + get(i: number, j: number): number; + set(i: number, j: number, value: number): void; + reset(): void; + + } + + export class Utils { + + static defaults(options?: any, defaults?: any): any; + + } + + export class Vec3Pool extends Pool { + + type: any; + + constructObject(): Vec3; + + } + + export class NarrowPhase { + + contactPointPool: Pool[]; + v3pool: Vec3Pool; + + } + + export class World extends EventTarget { + + dt: number; + allowSleep: boolean; + contacts: ContactEquation[]; + frictionEquations: FrictionEquation[]; + quatNormalizeSkip: number; + quatNormalizeFast: boolean; + time: number; + stepnumber: number; + default_dt: number; + nextId: number; + gravity: Vec3; + broadphase: NaiveBroadphase; + bodies: Body[]; + solver: Solver; + constraints: Constraint[]; + narrowPhase: NarrowPhase; + collisionMatrix: ArrayCollisionMatrix; + collisionMatrixPrevious: ArrayCollisionMatrix; + materials: Material[]; + contactmaterials: ContactMaterial[]; + contactMaterialTable: TupleDictionary; + defaultMaterial: Material; + defaultContactMaterial: ContactMaterial; + doProfiling: boolean; + profile: { + solve: number; + makeContactConstraints: number; + broadphaser: number; + integrate: number; + narrowphase: number; + }; + subsystems: any[]; + addBodyEvent: IBodyEvent; + removeBodyEvent: IBodyEvent; + + getContactMaterial(m1: Material, m2: Material): ContactMaterial; + numObjects(): number; + collisionMatrixTick(): void; + addBody(body: Body): void; + addConstraint(c: Constraint): void; + removeConstraint(c: Constraint): void; + rayTest(from: Vec3, to: Vec3, result: RaycastResult): void; + remove(body: Body): void; + addMaterial(m: Material): void; + addContactMaterial(cmat: ContactMaterial): void; + step(dy: number, timeSinceLastCalled?: number, maxSubSteps?: number): void; + + } + + export interface IEvent { + + type: string; + + } + + export interface IBodyEvent extends IEvent { + + body: Body; + + } + +} diff --git a/cannon/tsconfig.json b/cannon/tsconfig.json new file mode 100644 index 0000000000..27e01ecd7b --- /dev/null +++ b/cannon/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file diff --git a/rsvp/index.d.ts b/rsvp/index.d.ts new file mode 100644 index 0000000000..d10d3288da --- /dev/null +++ b/rsvp/index.d.ts @@ -0,0 +1,315 @@ +// Type definitions for RSVP 3.0.9 +// Project: github.com/tildeio/rsvp.js 3.0.9 +// Definitions by: Taylor Brown +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// Some of this file was taken from the type definitions for es6-promise https://github.com/borisyankov/DefinitelyTyped/blob/master/es6-promise/es6-promise.d.ts +// Credit for that file goes to: François de Campredon + +// Some of this file was taken from the type definitions for Q : https://github.com/borisyankov/DefinitelyTyped/blob/master/q/Q.d.ts +// Credit for that file goes to: Barrie Nemetchek , Andrew Gaspar , John Reilly + +declare module RSVP { + + interface Thenable { + then(onFulfilled?:(value:R) => Thenable, onRejected?:(error:any) => Thenable): Thenable; + then(onFulfilled?:(value:R) => Thenable, onRejected?:(error:any) => U): Thenable; + then(onFulfilled?:(value:R) => Thenable, onRejected?:(error:any) => void): Thenable; + then(onFulfilled?:(value:R) => U, onRejected?:(error:any) => Thenable): Thenable; + then(onFulfilled?:(value:R) => U, onRejected?:(error:any) => U): Thenable; + then(onFulfilled?:(value:R) => U, onRejected?:(error:any) => void): Thenable; + } + + interface Deferred { + promise: Promise; + resolve(value: T): void; + reject(reason: any): void; + } + + class Promise implements Thenable { + /** + * If you call resolve in the body of the callback passed to the constructor, + * your promise is fulfilled with result object passed to resolve. + * If you call reject your promise is rejected with the object passed to resolve. + * For consistency and debugging (eg stack traces), obj should be an instanceof Error. + * Any errors thrown in the constructor callback will be implicitly passed to reject(). + */ + constructor(callback:(resolve:(result?:R) => void, reject:(error:any) => void) => void, label? : string); + + /** + * If you call resolve in the body of the callback passed to the constructor, + * your promise will be fulfilled/rejected with the outcome of thenable passed to resolve. + * If you call reject your promise is rejected with the object passed to resolve. + * For consistency and debugging (eg stack traces), obj should be an instanceof Error. + * Any errors thrown in the constructor callback will be implicitly passed to reject(). + */ + constructor(callback:(resolve:(thenable?:Thenable) => void, reject:(error:any) => void) => void, label? : string); + + /** + * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. + * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called. + * Both callbacks have a single parameter , the fulfillment value or rejection reason. + * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve. + * If an error is thrown in the callback, the returned promise rejects with that error. + * + * @param onFulfilled called when/if "promise" resolves + * @param onRejected called when/if "promise" rejects + */ + then(onFulfilled?:(value:R) => Thenable, onRejected?:(error:any) => Thenable):Promise; + + /** + * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. + * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called. + * Both callbacks have a single parameter , the fulfillment value or rejection reason. + * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve. + * If an error is thrown in the callback, the returned promise rejects with that error. + * + * @param onFulfilled called when/if "promise" resolves + * @param onRejected called when/if "promise" rejects + */ + then(onFulfilled?:(value:R) => Thenable, onRejected?:(error:any) => U):Promise; + + /** + * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. + * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called. + * Both callbacks have a single parameter , the fulfillment value or rejection reason. + * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve. + * If an error is thrown in the callback, the returned promise rejects with that error. + * + * @param onFulfilled called when/if "promise" resolves + * @param onRejected called when/if "promise" rejects + */ + then(onFulfilled?:(value:R) => Thenable, onRejected?:(error:any) => void):Promise; + + /** + * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. + * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called. + * Both callbacks have a single parameter , the fulfillment value or rejection reason. + * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve. + * If an error is thrown in the callback, the returned promise rejects with that error. + * + * @param onFulfilled called when/if "promise" resolves + * @param onRejected called when/if "promise" rejects + */ + then(onFulfilled?:(value:R) => U, onRejected?:(error:any) => Thenable):Promise; + + /** + * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. + * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called. + * Both callbacks have a single parameter , the fulfillment value or rejection reason. + * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve. + * If an error is thrown in the callback, the returned promise rejects with that error. + * + * @param onFulfilled called when/if "promise" resolves + * @param onRejected called when/if "promise" rejects + */ + then(onFulfilled?:(value:R) => U, onRejected?:(error:any) => U):Promise; + + /** + * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. + * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called. + * Both callbacks have a single parameter , the fulfillment value or rejection reason. + * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve. + * If an error is thrown in the callback, the returned promise rejects with that error. + * + * @param onFulfilled called when/if "promise" resolves + * @param onRejected called when/if "promise" rejects + */ + then(onFulfilled?:(value:R) => U, onRejected?:(error:any) => void):Promise; + + /** + * Sugar for promise.then(undefined, onRejected) + * + * @param onRejected called when/if "promise" rejects + */ + catch(onRejected?:(error:any) => Thenable):Promise; + + /** + * Sugar for promise.then(undefined, onRejected) + * + * @param onRejected called when/if "promise" rejects + */ + catch(onRejected?:(error:any) => U):Promise; + + /** + * Sugar for promise.then(undefined, onRejected) + * + * @param onRejected called when/if "promise" rejects + */ + catch(onRejected?:(error:any) => void):Promise; + + finally(finallyCallback: () => any): Promise; + + static all(promises: Thenable[]): Promise; + static all(promises: any[]): Promise; + static race(promises:Promise[]):Promise; + + /** + @method resolve + @param {Any} value value that the returned promise will be resolved with + @param {String} label optional string for identifying the returned promise. + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` + */ + static resolve(object: Thenable): Promise; + static resolve(object: T): Promise; + + /** + @method cast (Deprecated in favor of resolve + @param {Any} value value that the returned promise will be resolved with + @param {String} label optional string for identifying the returned promise. + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` + */ + static cast(object: Thenable, label? : string): Promise; + static cast(object: T, label? : string): Promise; + + /** + `RSVP.Promise.reject` returns a promise rejected with the passed `reason`. + */ + static reject(reason?: any): Promise; + } + + interface PromiseState { + state: string /* "fulfilled", "rejected", "pending" */; + value?: T; + reason?: any; + } + + interface InstrumentEvent{ + guid:string; // guid of promise. Must be globally unique, not just within the implementation + childGuid:string; // child of child promise (for chained via `then`) + eventName:string; // one of ['created', 'chained', 'fulfilled', 'rejected'] + detail:any; // fulfillment value or rejection reason, if applicable + label:string; // label passed to promise's constructor + timeStamp:number; // milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now + } + + export function on(eventName : string, callback: (value:any)=>void) : void; + export function on(eventName : "error", errorHandler: (reason:any)=>void): void; + export function on(eventName : "created", listener: (event:InstrumentEvent)=>void): void; + export function on(eventName : "chained", listener: (event:InstrumentEvent)=>void): void; + export function on(eventName : "fulfilled", listener: (event:InstrumentEvent)=>void): void; + export function on(eventName : "rejected", listener: (event:InstrumentEvent)=>void): void; + + export function configure(configName : string, value : any): void; + export function configure(configName : "instrument", shouldInstrument : boolean): void; + + /** + * configure('onerror', handler) is deprecated in favor of on('error', handler) + * @param configName + * @param errorHandler + */ + export function configure(configName : "onerror", errorHandler : (reason:any)=>void): void; + + /** + * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. + * the array passed to all can be a mixture of promise-like objects and other objects. + * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. + */ + export function all(promises: Thenable[]): Promise; + export function all(promises: any[]): Promise; + /** + * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. + * the array passed to all can be a mixture of promise-like objects and other objects. + * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. + * The key difference to the all() function is that both the fulfillment value and the argument to the hash() function + * are object literals. This allows you to simply reference the results directly off the returned object without + * having to remember the initial order like you would with all(). + * + */ + export function hash(promises: Thenable[]): Promise; + export function hash(promises: any[]): Promise; + + /** + `RSVP.map` is similar to JavaScript's native `map` method, except that it + waits for all promises to become fulfilled before running the `mapFn` on + each item in given to `promises`. `RSVP.map` returns a promise that will + become fulfilled with the result of running `mapFn` on the values the promises + become fulfilled with. + */ + export function map(promises: Thenable[], mapFn : (item:any)=>any, label? : string): Promise; + export function map(promises: any[], mapFn : (item:any)=>any, label? : string): Promise; + + + /** + * `RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing + * a fail-fast method, it waits until all the promises have returned and + * shows you all the results. This is useful if you want to handle multiple + * promises' failure states together as a set. + */ + export function allSettled(promises: Thenable[]): Promise[]>; + export function allSettled(promises: any[]): Promise[]>; + + /** + * `RSVP.hashSettled` is similar to `RSVP.allSettled`, but takes an object + * instead of an array for its `promises` argument. + * + * Unlike `RSVP.all` or `RSVP.hash`, which implement a fail-fast method, + * but like `RSVP.allSettled`, `hashSettled` waits until all the + * constituent promises have returned and then shows you all the results + * with their states and values/reasons. This is useful if you want to + * handle multiple promises' failure states together as a set. + */ + export function hashSettled(promises: Thenable[]): Promise[]>; + export function hashSettled(promises: any[]): Promise[]>; + + /** + * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects. + */ + function race(promises:Promise[]):Promise; + + /** + * `RSVP.denodeify` takes a "node-style" function and returns a function that + * will return an `RSVP.Promise`. You can use `denodeify` in Node.js or the + * browser when you'd prefer to use promises over using callbacks. For example, + * `denodeify` transforms the following: + */ + export function denodeify(nodeFunction: Function, ...args: any[]): (...args: any[]) => Promise; + + /** + * Favor the Promise Constructor instead (if possible) + * + */ + export function defer(): Deferred; + + + /** + `RSVP.Promise.reject` returns a promise rejected with the passed `reason`. + */ + export function reject(reason?: any): Promise; + + /** + `RSVP.Promise.resolve` returns a promise that will become resolved with the + passed `value`. + */ + export function resolve(object: Thenable): Promise; + export function resolve(object: T): Promise; + + /** + * `RSVP.filter` is similar to JavaScript's native `filter` method, except that it + * waits for all promises to become fulfilled before running the `filterFn` on + * each item in given to `promises`. `RSVP.filter` returns a promise that will + * become fulfilled with the result of running `filterFn` on the values the + * promises become fulfilled with. + */ + export function filter(promises: Thenable[], filterFn:(value:any)=>any): Promise; + + /** + `RSVP.rethrow` will rethrow an error on the next turn of the JavaScript event + loop in order to aid debugging. + + Promises A+ specifies that any exceptions that occur with a promise must be + caught by the promises implementation and bubbled to the last handler. For + this reason, it is recommended that you always specify a second rejection + handler function to `then`. However, `RSVP.rethrow` will throw the exception + outside of the promise, so it bubbles up to your console if in the browser, + or domain/cause uncaught exception in Node. `rethrow` will also throw the + error again so the error can be handled by the promise per the spec. + */ + export function rethrow(reason : any):void; + +} + diff --git a/rsvp/tsconfig.json b/rsvp/tsconfig.json new file mode 100644 index 0000000000..27e01ecd7b --- /dev/null +++ b/rsvp/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file diff --git a/wonder-commonlib/index.d.ts b/wonder-commonlib/index.d.ts new file mode 100644 index 0000000000..2fd8d2bd88 --- /dev/null +++ b/wonder-commonlib/index.d.ts @@ -0,0 +1,258 @@ +declare module wdCb { + class JudgeUtils { + static isArray(arr: any): boolean; + static isArrayExactly(arr: any): boolean; + static isNumber(num: any): boolean; + static isNumberExactly(num: any): boolean; + static isString(str: any): boolean; + static isStringExactly(str: any): boolean; + static isBoolean(bool: any): boolean; + static isDom(obj: any): boolean; + static isObject(obj: any): boolean; + static isDirectObject(obj: any): boolean; + static isHostMethod(object: any, property: any): boolean; + static isNodeJs(): boolean; + static isFunction(func: any): boolean; + } +} + +declare var global: any, window: Window; +declare module wdCb { + var root: any; +} + +declare module wdCb { +} + +declare module wdCb { + const $BREAK: { + break: boolean; + }; + const $REMOVE: any; +} + +declare module wdCb { + class Log { + static info: { + INVALID_PARAM: string; + helperFunc: (...args: any[]) => string; + assertion: (...args: any[]) => any; + FUNC_INVALID: (...args: any[]) => any; + FUNC_MUST: (...args: any[]) => any; + FUNC_MUST_BE: (...args: any[]) => any; + FUNC_MUST_NOT_BE: (...args: any[]) => any; + FUNC_SHOULD: (...args: any[]) => any; + FUNC_SHOULD_NOT: (...args: any[]) => any; + FUNC_SUPPORT: (...args: any[]) => any; + FUNC_NOT_SUPPORT: (...args: any[]) => any; + FUNC_MUST_DEFINE: (...args: any[]) => any; + FUNC_MUST_NOT_DEFINE: (...args: any[]) => any; + FUNC_UNKNOW: (...args: any[]) => any; + FUNC_EXPECT: (...args: any[]) => any; + FUNC_UNEXPECT: (...args: any[]) => any; + FUNC_EXIST: (...args: any[]) => any; + FUNC_NOT_EXIST: (...args: any[]) => any; + FUNC_ONLY: (...args: any[]) => any; + FUNC_CAN_NOT: (...args: any[]) => any; + }; + static log(...messages: any[]): void; + static assert(cond: any, ...messages: any[]): void; + static error(cond: any, ...message: any[]): any; + static warn(...message: any[]): void; + private static _exec(consoleMethod, args, sliceBegin?); + } +} + +declare module wdCb { + class List { + protected children: Array; + getCount(): number; + hasChild(child: any): boolean; + hasChildWithFunc(func: Function): boolean; + getChildren(): T[]; + getChild(index: number): T; + addChild(child: T): this; + addChildren(arg: Array | List | any): this; + setChildren(children: Array): this; + unShiftChild(child: T): void; + removeAllChildren(): this; + forEach(func: Function, context?: any): this; + toArray(): T[]; + protected copyChildren(): T[]; + protected removeChildHelper(arg: any): Array; + private _forEach(arr, func, context?); + private _removeChild(arr, func); + } +} + +declare module wdCb { + class Collection extends List { + static create(children?: any[]): Collection; + constructor(children?: Array); + clone(): any; + clone(isDeep: boolean): any; + clone(target: Collection): any; + clone(target: Collection, isDeep: boolean): any; + filter(func: (value: T, index: number) => boolean): Collection; + findOne(func: (value: T, index: number) => boolean): T; + reverse(): Collection; + removeChild(arg: any): Collection; + sort(func: (a: T, b: T) => any, isSortSelf?: boolean): Collection; + map(func: (value: T, index: number) => any): Collection; + removeRepeatItems(): Collection; + hasRepeatItems(): false; + } +} + +declare module wdCb { + class Hash { + static create(children?: {}): Hash; + constructor(children?: { + [s: string]: T; + }); + private _children; + getChildren(): { + [s: string]: T; + }; + getCount(): number; + getKeys(): Collection; + getValues(): Collection; + getChild(key: string): T; + setValue(key: string, value: any): this; + addChild(key: string, value: any): this; + addChildren(arg: {} | Hash): this; + appendChild(key: string, value: any): this; + setChildren(children: { + [s: string]: T; + }): void; + removeChild(arg: any): Collection; + removeAllChildren(): void; + hasChild(key: string): boolean; + hasChildWithFunc(func: Function): boolean; + forEach(func: Function, context?: any): this; + filter(func: Function): Hash; + findOne(func: Function): any[]; + map(func: Function): Hash; + toCollection(): Collection; + toArray(): Array; + clone(): any; + clone(isDeep: boolean): any; + clone(target: Hash): any; + clone(target: Hash, isDeep: boolean): any; + } +} + +declare module wdCb { + class Queue extends List { + static create(children?: any[]): Queue; + constructor(children?: Array); + readonly front: T; + readonly rear: T; + push(element: T): void; + pop(): T; + clear(): void; + } +} + +declare module wdCb { + class Stack extends List { + static create(children?: any[]): Stack; + constructor(children?: Array); + readonly top: T; + push(element: T): void; + pop(): T; + clear(): void; + clone(): any; + clone(isDeep: boolean): any; + clone(target: Stack): any; + clone(target: Stack, isDeep: boolean): any; + filter(func: (value: T, index: number) => boolean): Collection; + findOne(func: (value: T, index: number) => boolean): T; + reverse(): Collection; + removeChild(arg: any): Collection; + sort(func: (a: T, b: T) => any, isSortSelf?: boolean): Collection; + map(func: (value: T, index: number) => any): Collection; + removeRepeatItems(): Collection; + hasRepeatItems(): false; + } +} + +declare module wdCb { + class AjaxUtils { + static ajax(conf: any): void; + private static _createAjax(error); + private static _isLocalFile(status); + private static _isSoundFile(dataType); + } +} + +declare module wdCb { + class ArrayUtils { + static removeRepeatItems(arr: Array, isEqual?: (a: any, b: any) => boolean): any[]; + static contain(arr: Array, ele: any): boolean; + } +} + +declare module wdCb { + class ConvertUtils { + static toString(obj: any): string; + private static _convertCodeToString(fn); + } +} + +declare module wdCb { + class EventUtils { + static bindEvent(context: any, func: any): (event: any) => any; + static addEvent(dom: any, eventName: any, handler: any): void; + static removeEvent(dom: any, eventName: any, handler: any): void; + } +} + +declare module wdCb { + class ExtendUtils { + static extendDeep(parent: any, child?: any, filter?: (val: any, i: any) => boolean): any; + static extend(destination: any, source: any): any; + static copyPublicAttri(source: any): {}; + } +} + +declare module wdCb { + class PathUtils { + static basename(path: string, ext?: string): string; + static changeExtname(pathStr: string, extname: string): string; + static changeBasename(pathStr: string, basename: string, isSameExt?: boolean): string; + static extname(path: string): string; + static dirname(path: string): string; + private static _splitPath(fileName); + } +} + +declare module wdCb { + class FunctionUtils { + static bind(object: any, func: Function): () => any; + } +} + +declare module wdCb { + class DomQuery { + static create(eleStr: string): any; + static create(dom: HTMLElement): any; + private _doms; + constructor(eleStr: string); + constructor(dom: HTMLElement); + get(index: any): HTMLElement; + prepend(eleStr: string): any; + prepend(dom: HTMLElement): any; + prependTo(eleStr: string): this; + remove(): this; + css(property: string, value: string): void; + attr(name: string): any; + attr(name: string, value: string): any; + text(str?: string): string; + private _isDomEleStr(eleStr); + private _buildDom(eleStr); + private _buildDom(dom); + private _createElement(eleStr); + } +} + diff --git a/wonder-commonlib/tsconfig.json b/wonder-commonlib/tsconfig.json new file mode 100644 index 0000000000..27e01ecd7b --- /dev/null +++ b/wonder-commonlib/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file diff --git a/wonder-frp/index.d.ts b/wonder-frp/index.d.ts new file mode 100644 index 0000000000..8f77f93723 --- /dev/null +++ b/wonder-frp/index.d.ts @@ -0,0 +1,718 @@ +declare module wdFrp { + class JudgeUtils extends wdCb.JudgeUtils { + static isPromise(obj: any): boolean; + static isEqual(ob1: Entity, ob2: Entity): boolean; + static isIObserver(i: IObserver): () => any; + } +} + +declare module wdFrp { + var fromNodeCallback: (func: Function, context?: any) => (...funcArgs: any[]) => AnonymousStream; + var fromStream: (stream: any, finishEventName?: string) => AnonymousStream; + var fromReadableStream: (stream: any) => AnonymousStream; + var fromWritableStream: (stream: any) => AnonymousStream; + var fromTransformStream: (stream: any) => AnonymousStream; +} + +declare module wdFrp { + abstract class Entity { + static UID: number; + private _uid; + uid: string; + constructor(uidPre: string); + } +} + +declare module wdFrp { + class Main { + static isTest: boolean; + } +} + +declare module wdFrp { + function assert(cond: boolean, message?: string): void; + function require(InFunc: any): (target: any, name: any, descriptor: any) => any; + function ensure(OutFunc: any): (target: any, name: any, descriptor: any) => any; + function requireGetter(InFunc: any): (target: any, name: any, descriptor: any) => any; + function requireSetter(InFunc: any): (target: any, name: any, descriptor: any) => any; + function ensureGetter(OutFunc: any): (target: any, name: any, descriptor: any) => any; + function ensureSetter(OutFunc: any): (target: any, name: any, descriptor: any) => any; + function invariant(func: any): (target: any) => void; +} + +declare module wdFrp { + interface IDisposable { + dispose(): void; + } +} + +declare module wdFrp { + class SingleDisposable extends Entity implements IDisposable { + static create(disposeHandler?: Function): SingleDisposable; + private _disposeHandler; + private _isDisposed; + constructor(disposeHandler: Function); + setDisposeHandler(handler: Function): void; + dispose(): void; + } +} + +declare module wdFrp { + class GroupDisposable extends Entity implements IDisposable { + static create(disposable?: IDisposable): GroupDisposable; + private _group; + private _isDisposed; + constructor(disposable?: IDisposable); + add(disposable: IDisposable): this; + remove(disposable: IDisposable): this; + dispose(): void; + } +} + +declare module wdFrp { + interface IObserver extends IDisposable { + next(value: any): any; + error(error: any): any; + completed(): any; + } +} + +declare module wdFrp { + class InnerSubscription implements IDisposable { + static create(subject: Subject | GeneratorSubject, observer: Observer): InnerSubscription; + private _subject; + private _observer; + constructor(subject: Subject | GeneratorSubject, observer: Observer); + dispose(): void; + } +} + +declare module wdFrp { + class InnerSubscriptionGroup implements IDisposable { + static create(): InnerSubscriptionGroup; + private _container; + addChild(child: IDisposable): void; + dispose(): void; + } +} + +declare var global: any, window: Window; +declare module wdFrp { + var root: any; +} + +declare module wdFrp { +} + +declare module wdFrp { +} + +declare module wdFrp { +} + +declare module wdFrp { + abstract class Stream extends Entity { + scheduler: Scheduler; + subscribeFunc: (observer: IObserver) => Function | void; + constructor(subscribeFunc: any); + abstract subscribe(arg1: Function | Observer | Subject, onError?: Function, onCompleted?: Function): IDisposable; + buildStream(observer: IObserver): IDisposable; + do(onNext?: Function, onError?: Function, onCompleted?: Function): DoStream; + map(selector: Function): MapStream; + flatMap(selector: Function): MergeAllStream; + concatMap(selector: Function): any; + mergeAll(): MergeAllStream; + concatAll(): any; + skipUntil(otherStream: Stream): SkipUntilStream; + takeUntil(otherStream: Stream): TakeUntilStream; + take(count?: number): AnonymousStream; + takeLast(count?: number): AnonymousStream; + takeWhile(predicate: (value: any, index: number, source: Stream) => boolean, thisArg?: this): AnonymousStream; + lastOrDefault(defaultValue?: any): AnonymousStream; + filter(predicate: (value: any) => boolean, thisArg?: this): any; + filterWithState(predicate: (value: any) => boolean, thisArg?: this): any; + concat(streamArr: Array): any; + concat(...otherStream: any[]): any; + merge(maxConcurrent: number): any; + merge(streamArr: Array): any; + merge(...otherStreams: any[]): any; + repeat(count?: number): RepeatStream; + ignoreElements(): IgnoreElementsStream; + protected handleSubject(subject: any): boolean; + private _isSubject(subject); + private _setSubject(subject); + } +} + +declare module wdFrp { + class Scheduler { + static create(...args: any[]): Scheduler; + private _requestLoopId; + requestLoopId: any; + publishRecursive(observer: IObserver, initial: any, action: Function): void; + publishInterval(observer: IObserver, initial: any, interval: number, action: Function): number; + publishIntervalRequest(observer: IObserver, action: Function): void; + publishTimeout(observer: IObserver, time: number, action: Function): number; + } +} + +declare module wdFrp { + abstract class Observer extends Entity implements IObserver { + private _isDisposed; + isDisposed: boolean; + protected onUserNext: Function; + protected onUserError: Function; + protected onUserCompleted: Function; + private _isStop; + private _disposable; + constructor(observer: IObserver); + constructor(onNext: Function, onError: Function, onCompleted: Function); + next(value: any): any; + error(error: any): void; + completed(): void; + dispose(): void; + setDisposable(disposable: IDisposable): void; + protected abstract onNext(value: any): any; + protected abstract onError(error: any): any; + protected abstract onCompleted(): any; + } +} + +declare module wdFrp { + class Subject implements IObserver { + static create(): Subject; + private _source; + source: Stream; + private _observer; + subscribe(arg1?: Function | Observer, onError?: Function, onCompleted?: Function): IDisposable; + next(value: any): void; + error(error: any): void; + completed(): void; + start(): void; + remove(observer: Observer): void; + dispose(): void; + } +} + +declare module wdFrp { + class GeneratorSubject extends Entity implements IObserver { + static create(): GeneratorSubject; + private _isStart; + isStart: boolean; + constructor(); + observer: any; + onBeforeNext(value: any): void; + onAfterNext(value: any): void; + onIsCompleted(value: any): boolean; + onBeforeError(error: any): void; + onAfterError(error: any): void; + onBeforeCompleted(): void; + onAfterCompleted(): void; + subscribe(arg1?: Function | Observer, onError?: Function, onCompleted?: Function): IDisposable; + next(value: any): void; + error(error: any): void; + completed(): void; + toStream(): any; + start(): void; + stop(): void; + remove(observer: Observer): void; + dispose(): void; + } +} + +declare module wdFrp { + class AnonymousObserver extends Observer { + static create(onNext: Function, onError: Function, onCompleted: Function): AnonymousObserver; + protected onNext(value: any): void; + protected onError(error: any): void; + protected onCompleted(): void; + } +} + +declare module wdFrp { + class AutoDetachObserver extends Observer { + static create(observer: IObserver): any; + static create(onNext: Function, onError: Function, onCompleted: Function): any; + dispose(): void; + protected onNext(value: any): void; + protected onError(error: any): void; + protected onCompleted(): void; + } +} + +declare module wdFrp { + class MapObserver extends Observer { + static create(currentObserver: IObserver, selector: Function): MapObserver; + private _currentObserver; + private _selector; + constructor(currentObserver: IObserver, selector: Function); + protected onNext(value: any): void; + protected onError(error: any): void; + protected onCompleted(): void; + } +} + +declare module wdFrp { + class DoObserver extends Observer { + static create(currentObserver: IObserver, prevObserver: IObserver): DoObserver; + private _currentObserver; + private _prevObserver; + constructor(currentObserver: IObserver, prevObserver: IObserver); + protected onNext(value: any): void; + protected onError(error: any): void; + protected onCompleted(): void; + } +} + +declare module wdFrp { + class MergeAllObserver extends Observer { + static create(currentObserver: IObserver, streamGroup: wdCb.Collection, groupDisposable: GroupDisposable): MergeAllObserver; + constructor(currentObserver: IObserver, streamGroup: wdCb.Collection, groupDisposable: GroupDisposable); + done: boolean; + currentObserver: IObserver; + private _streamGroup; + private _groupDisposable; + protected onNext(innerSource: any): void; + protected onError(error: any): void; + protected onCompleted(): void; + } +} + +declare module wdFrp { + class MergeObserver extends Observer { + static create(currentObserver: IObserver, maxConcurrent: number, streamGroup: wdCb.Collection, groupDisposable: GroupDisposable): MergeObserver; + constructor(currentObserver: IObserver, maxConcurrent: number, streamGroup: wdCb.Collection, groupDisposable: GroupDisposable); + done: boolean; + currentObserver: IObserver; + activeCount: number; + q: Array; + private _maxConcurrent; + private _groupDisposable; + private _streamGroup; + handleSubscribe(innerSource: any): void; + protected onNext(innerSource: any): void; + protected onError(error: any): void; + protected onCompleted(): void; + private _isReachMaxConcurrent(); + } +} + +declare module wdFrp { + class TakeUntilObserver extends Observer { + static create(prevObserver: IObserver): TakeUntilObserver; + private _prevObserver; + constructor(prevObserver: IObserver); + protected onNext(value: any): void; + protected onError(error: any): void; + protected onCompleted(): void; + } +} + +declare module wdFrp { + class SkipUntilSourceObserver extends Observer { + static create(prevObserver: IObserver, skipUntilStream: SkipUntilStream): SkipUntilSourceObserver; + private _prevObserver; + private _skipUntilStream; + constructor(prevObserver: IObserver, skipUntilStream: SkipUntilStream); + protected onNext(value: any): void; + protected onError(error: any): void; + protected onCompleted(): void; + } +} + +declare module wdFrp { + class SkipUntilOtherObserver extends Observer { + static create(prevObserver: IObserver, skipUntilStream: SkipUntilStream): SkipUntilOtherObserver; + otherDisposable: IDisposable; + private _prevObserver; + private _skipUntilStream; + constructor(prevObserver: IObserver, skipUntilStream: SkipUntilStream); + protected onNext(value: any): void; + protected onError(error: any): void; + protected onCompleted(): void; + } +} + +declare module wdFrp { + class ConcatObserver extends Observer { + static create(currentObserver: IObserver, startNextStream: Function): ConcatObserver; + protected currentObserver: any; + private _startNextStream; + constructor(currentObserver: IObserver, startNextStream: Function); + protected onNext(value: any): void; + protected onError(error: any): void; + protected onCompleted(): void; + } +} + +declare module wdFrp { + interface ISubjectObserver { + addChild(observer: Observer): any; + removeChild(observer: Observer): any; + } +} + +declare module wdFrp { + class SubjectObserver implements IObserver { + observers: wdCb.Collection; + private _disposable; + isEmpty(): boolean; + next(value: any): void; + error(error: any): void; + completed(): void; + addChild(observer: Observer): void; + removeChild(observer: Observer): void; + dispose(): void; + setDisposable(disposable: IDisposable): void; + } +} + +declare module wdFrp { + class IgnoreElementsObserver extends Observer { + static create(currentObserver: IObserver): IgnoreElementsObserver; + private _currentObserver; + constructor(currentObserver: IObserver); + protected onNext(value: any): void; + protected onError(error: any): void; + protected onCompleted(): void; + } +} + +declare module wdFrp { + class FilterObserver extends Observer { + static create(prevObserver: IObserver, predicate: (value: any, index?: number, source?: Stream) => boolean, source: Stream): FilterObserver; + constructor(prevObserver: IObserver, predicate: (value: any) => boolean, source: Stream); + protected prevObserver: IObserver; + protected source: Stream; + protected i: number; + protected predicate: (value: any, index?: number, source?: Stream) => boolean; + protected onNext(value: any): void; + protected onError(error: any): void; + protected onCompleted(): void; + } +} + +declare module wdFrp { + class FilterWithStateObserver extends FilterObserver { + static create(prevObserver: IObserver, predicate: (value: any, index?: number, source?: Stream) => boolean, source: Stream): FilterWithStateObserver; + private _isTrigger; + protected onNext(value: any): void; + } +} + +declare module wdFrp { + abstract class BaseStream extends Stream { + abstract subscribeCore(observer: IObserver): IDisposable; + subscribe(arg1: Function | Observer | Subject, onError?: any, onCompleted?: any): IDisposable; + buildStream(observer: IObserver): IDisposable; + } +} + +declare module wdFrp { + class DoStream extends BaseStream { + static create(source: Stream, onNext?: Function, onError?: Function, onCompleted?: Function): DoStream; + private _source; + private _observer; + constructor(source: Stream, onNext: Function, onError: Function, onCompleted: Function); + subscribeCore(observer: IObserver): IDisposable; + } +} + +declare module wdFrp { + class MapStream extends BaseStream { + static create(source: Stream, selector: Function): MapStream; + private _source; + private _selector; + constructor(source: Stream, selector: Function); + subscribeCore(observer: IObserver): IDisposable; + } +} + +declare module wdFrp { + class FromArrayStream extends BaseStream { + static create(array: Array, scheduler: Scheduler): FromArrayStream; + private _array; + constructor(array: Array, scheduler: Scheduler); + subscribeCore(observer: IObserver): SingleDisposable; + } +} + +declare module wdFrp { + class FromPromiseStream extends BaseStream { + static create(promise: any, scheduler: Scheduler): FromPromiseStream; + private _promise; + constructor(promise: any, scheduler: Scheduler); + subscribeCore(observer: IObserver): SingleDisposable; + } +} + +declare module wdFrp { + class FromEventPatternStream extends BaseStream { + static create(addHandler: Function, removeHandler: Function): FromEventPatternStream; + private _addHandler; + private _removeHandler; + constructor(addHandler: Function, removeHandler: Function); + subscribeCore(observer: IObserver): SingleDisposable; + } +} + +declare module wdFrp { + class AnonymousStream extends Stream { + static create(subscribeFunc: Function): AnonymousStream; + constructor(subscribeFunc: Function); + subscribe(subject: Subject): IDisposable; + subscribe(observer: IObserver): IDisposable; + subscribe(onNext: (value: any) => void): IDisposable; + subscribe(onNext: (value: any) => void, onError: (e: any) => void): IDisposable; + subscribe(onNext: (value: any) => void, onError: (e: any) => void, onComplete: () => void): IDisposable; + } +} + +declare module wdFrp { + class IntervalStream extends BaseStream { + static create(interval: number, scheduler: Scheduler): IntervalStream; + private _interval; + constructor(interval: number, scheduler: Scheduler); + initWhenCreate(): void; + subscribeCore(observer: IObserver): SingleDisposable; + } +} + +declare module wdFrp { + class IntervalRequestStream extends BaseStream { + static create(scheduler: Scheduler): IntervalRequestStream; + private _isEnd; + constructor(scheduler: Scheduler); + subscribeCore(observer: IObserver): SingleDisposable; + } +} + +declare module wdFrp { + class TimeoutStream extends BaseStream { + static create(time: number, scheduler: Scheduler): TimeoutStream; + private _time; + constructor(time: number, scheduler: Scheduler); + subscribeCore(observer: IObserver): SingleDisposable; + } +} + +declare module wdFrp { + class MergeAllStream extends BaseStream { + static create(source: Stream): MergeAllStream; + constructor(source: Stream); + private _source; + private _observer; + subscribeCore(observer: IObserver): GroupDisposable; + } +} + +declare module wdFrp { + class MergeStream extends BaseStream { + static create(source: Stream, maxConcurrent: number): MergeStream; + constructor(source: Stream, maxConcurrent: number); + private _source; + private _maxConcurrent; + subscribeCore(observer: IObserver): GroupDisposable; + } +} + +declare module wdFrp { + class TakeUntilStream extends BaseStream { + static create(source: Stream, otherSteam: Stream): TakeUntilStream; + private _source; + private _otherStream; + constructor(source: Stream, otherStream: Stream); + subscribeCore(observer: IObserver): GroupDisposable; + } +} + +declare module wdFrp { + class SkipUntilStream extends BaseStream { + static create(source: Stream, otherSteam: Stream): SkipUntilStream; + isOpen: boolean; + private _source; + private _otherStream; + constructor(source: Stream, otherStream: Stream); + subscribeCore(observer: IObserver): GroupDisposable; + } +} + +declare module wdFrp { + class ConcatStream extends BaseStream { + static create(sources: Array): ConcatStream; + private _sources; + constructor(sources: Array); + subscribeCore(observer: IObserver): GroupDisposable; + } +} + +declare module wdFrp { + class RepeatStream extends BaseStream { + static create(source: Stream, count: number): RepeatStream; + private _source; + private _count; + constructor(source: Stream, count: number); + subscribeCore(observer: IObserver): GroupDisposable; + } +} + +declare module wdFrp { + class IgnoreElementsStream extends BaseStream { + static create(source: Stream): IgnoreElementsStream; + private _source; + constructor(source: Stream); + subscribeCore(observer: IObserver): IDisposable; + } +} + +declare module wdFrp { + class DeferStream extends BaseStream { + static create(buildStreamFunc: Function): DeferStream; + private _buildStreamFunc; + constructor(buildStreamFunc: Function); + subscribeCore(observer: IObserver): GroupDisposable; + } +} + +declare module wdFrp { + class FilterStream extends BaseStream { + static create(source: Stream, predicate: (value: any, index?: number, source?: Stream) => boolean, thisArg: any): FilterStream; + constructor(source: Stream, predicate: (value: any, index?: number, source?: Stream) => boolean, thisArg: any); + predicate: (value: any, index?: number, source?: Stream) => boolean; + private _source; + subscribeCore(observer: IObserver): IDisposable; + internalFilter(predicate: (value: any, index?: number, source?: Stream) => boolean, thisArg: any): Stream; + protected createObserver(observer: IObserver): Observer; + protected createStreamForInternalFilter(source: Stream, innerPredicate: any, thisArg: any): Stream; + private _innerPredicate(predicate, self); + } +} + +declare module wdFrp { + class FilterWithStateStream extends FilterStream { + static create(source: Stream, predicate: (value: any, index?: number, source?: Stream) => boolean, thisArg: any): FilterWithStateStream; + protected createObserver(observer: IObserver): FilterWithStateObserver; + protected createStreamForInternalFilter(source: Stream, innerPredicate: any, thisArg: any): Stream; + } +} + +declare module wdFrp { + var createStream: (subscribeFunc: any) => AnonymousStream; + var fromArray: (array: any[], scheduler?: Scheduler) => FromArrayStream; + var fromPromise: (promise: any, scheduler?: Scheduler) => FromPromiseStream; + var fromEventPattern: (addHandler: Function, removeHandler: Function) => FromEventPatternStream; + var interval: (interval: any, scheduler?: Scheduler) => IntervalStream; + var intervalRequest: (scheduler?: Scheduler) => IntervalRequestStream; + var timeout: (time: any, scheduler?: Scheduler) => TimeoutStream; + var empty: () => AnonymousStream; + var callFunc: (func: Function, context?: any) => AnonymousStream; + var judge: (condition: Function, thenSource: Function, elseSource: Function) => any; + var defer: (buildStreamFunc: Function) => DeferStream; + var just: (returnValue: any) => AnonymousStream; +} + +declare module wdFrp { + enum FilterState { + TRIGGER = 0, + ENTER = 1, + LEAVE = 2, + } +} + +declare module wdFrp { + class Record { + static create(time: number, value: any, actionType?: ActionType, comparer?: Function): Record; + private _time; + time: number; + private _value; + value: number; + private _actionType; + actionType: ActionType; + private _comparer; + constructor(time: any, value: any, actionType: ActionType, comparer: Function); + equals(other: any): any; + } +} + +declare module wdFrp { + class MockObserver extends Observer { + static create(scheduler: TestScheduler): MockObserver; + private _messages; + messages: [Record]; + private _scheduler; + constructor(scheduler: TestScheduler); + protected onNext(value: any): void; + protected onError(error: any): void; + protected onCompleted(): void; + dispose(): void; + clone(): MockObserver; + } +} + +declare module wdFrp { + class MockPromise { + static create(scheduler: TestScheduler, messages: [Record]): MockPromise; + private _messages; + private _scheduler; + constructor(scheduler: TestScheduler, messages: [Record]); + then(successCb: Function, errorCb: Function, observer: IObserver): void; + } +} + +declare module wdFrp { + class TestScheduler extends Scheduler { + static next(tick: any, value: any): Record; + static error(tick: any, error: any): Record; + static completed(tick: any): Record; + static create(isReset?: boolean): TestScheduler; + constructor(isReset: boolean); + private _clock; + clock: number; + private _isReset; + private _isDisposed; + private _timerMap; + private _streamMap; + private _subscribedTime; + private _disposedTime; + private _observer; + setStreamMap(observer: IObserver, messages: [Record]): void; + remove(observer: Observer): void; + publishRecursive(observer: MockObserver, initial: any, recursiveFunc: Function): void; + publishInterval(observer: IObserver, initial: any, interval: number, action: Function): number; + publishIntervalRequest(observer: IObserver, action: Function): number; + publishTimeout(observer: IObserver, time: number, action: Function): number; + private _setClock(); + startWithTime(create: Function, subscribedTime: number, disposedTime: number): MockObserver; + startWithSubscribe(create: any, subscribedTime?: number): MockObserver; + startWithDispose(create: any, disposedTime?: number): MockObserver; + publicAbsolute(time: any, handler: any): void; + start(): void; + createStream(args: any): TestStream; + createObserver(): MockObserver; + createResolvedPromise(time: number, value: any): MockPromise; + createRejectPromise(time: number, error: any): MockPromise; + private _getMinAndMaxTime(); + private _exec(time, map); + private _runStream(time); + private _runAt(time, callback); + private _tick(time); + } +} + +declare module wdFrp { + enum ActionType { + NEXT = 0, + ERROR = 1, + COMPLETED = 2, + } +} + +declare module wdFrp { + class TestStream extends BaseStream { + static create(messages: [Record], scheduler: TestScheduler): TestStream; + scheduler: TestScheduler; + private _messages; + constructor(messages: [Record], scheduler: TestScheduler); + subscribeCore(observer: IObserver): SingleDisposable; + } +} diff --git a/wonder-frp/tsconfig.json b/wonder-frp/tsconfig.json new file mode 100644 index 0000000000..27e01ecd7b --- /dev/null +++ b/wonder-frp/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file From 2f4008caa8b47224f6e0e40414807a141bd7a356 Mon Sep 17 00:00:00 2001 From: durad Date: Sat, 21 Jan 2017 12:59:37 -0800 Subject: [PATCH 030/140] Added definition for lorem-ipsum (#14161) * Implemented match, isMath and find * Added all functions * Made options optional. * Added tslint.json and fixed lint errors * Fixed definition for mapping function * Fixed issue with strict nulls * Added definition for lorem-ipsum --- lorem-ipsum/index.d.ts | 63 ++++++++++++++++++++++++++++++++ lorem-ipsum/lorem-ipsum-tests.ts | 14 +++++++ lorem-ipsum/tsconfig.json | 20 ++++++++++ lorem-ipsum/tslint.json | 1 + 4 files changed, 98 insertions(+) create mode 100644 lorem-ipsum/index.d.ts create mode 100644 lorem-ipsum/lorem-ipsum-tests.ts create mode 100644 lorem-ipsum/tsconfig.json create mode 100644 lorem-ipsum/tslint.json diff --git a/lorem-ipsum/index.d.ts b/lorem-ipsum/index.d.ts new file mode 100644 index 0000000000..825136f207 --- /dev/null +++ b/lorem-ipsum/index.d.ts @@ -0,0 +1,63 @@ +// Type definitions for lorem-ipsum 1.0 +// Project: https://github.com/knicklabs/node-lorem-ipsum +// Definitions by: Dusan Radovanovic +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface LoremIpsumOptions { + /** + * Number of words, sentences, or paragraphs to generate. + */ + count?: number; + + /** + * Generate words, sentences, or paragraphs. + */ + units?: 'words' | 'sentences' | 'paragraphs'; + + /** + * Minimum words per sentence. + */ + sentenceLowerBound?: number; + + /** + * Maximum words per sentence. + */ + sentenceUpperBound?: number; + + /** + * Minimum sentences per paragraph. + */ + paragraphLowerBound?: number; + + /** + * Maximum sentences per paragraph. + */ + paragraphUpperBound?: number; + + /** + * Plain text or html. + */ + format?: 'plain' | 'html'; + + /** + * Custom word dictionary. + */ + words?: string[]; + + /** + * A PRNG function. Uses Math.random by default. + */ + random?: () => number; + + /** + * The character to insert between paragraphs. Defaults to default EOL. + */ + suffix?: string; +} + +/** + * Generate a passage of lorem ipsum text. + */ +declare function loremIpsum(options?: LoremIpsumOptions): string; + +export = loremIpsum; diff --git a/lorem-ipsum/lorem-ipsum-tests.ts b/lorem-ipsum/lorem-ipsum-tests.ts new file mode 100644 index 0000000000..dd5eb82ba6 --- /dev/null +++ b/lorem-ipsum/lorem-ipsum-tests.ts @@ -0,0 +1,14 @@ +import loremIpsum = require('lorem-ipsum'); + +let result: string; +result = loremIpsum(); +result = loremIpsum({}); +result = loremIpsum({ count: 20 }); +result = loremIpsum({ count: 20, units: 'words' }); +result = loremIpsum({ count: 3, units: 'paragraphs' }); +result = loremIpsum({ random: () => Math.random() * Math.random() }); +result = loremIpsum({ paragraphLowerBound: 3, paragraphUpperBound: 6, count: 3, units: 'paragraphs' }); +result = loremIpsum({ sentenceLowerBound: 10, sentenceUpperBound: 15, count: 5, units: 'sentences' }); +result = loremIpsum({ words: ['a', 'b', 'c'] }); +result = loremIpsum({ suffix: '-' }); +result = loremIpsum({ format: 'html' }); diff --git a/lorem-ipsum/tsconfig.json b/lorem-ipsum/tsconfig.json new file mode 100644 index 0000000000..7e756f052b --- /dev/null +++ b/lorem-ipsum/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "lorem-ipsum-tests.ts" + ] +} diff --git a/lorem-ipsum/tslint.json b/lorem-ipsum/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/lorem-ipsum/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 4923ba548ae77ba4c5e18c17df40e6dda0c6e174 Mon Sep 17 00:00:00 2001 From: Rahul Ravikumar Date: Sat, 21 Jan 2017 13:08:53 -0800 Subject: [PATCH 031/140] Add definitions for opener (#14159) --- opener/index.d.ts | 14 ++++++++++++++ opener/opener-tests.ts | 11 +++++++++++ opener/tsconfig.json | 20 ++++++++++++++++++++ opener/tslint.json | 1 + 4 files changed, 46 insertions(+) create mode 100644 opener/index.d.ts create mode 100644 opener/opener-tests.ts create mode 100644 opener/tsconfig.json create mode 100644 opener/tslint.json diff --git a/opener/index.d.ts b/opener/index.d.ts new file mode 100644 index 0000000000..b3e8c4ea73 --- /dev/null +++ b/opener/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for opener 1.4 +// Project: https://github.com/domenic/opener +// Definitions by: Rahul Ravikumar +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { ChildProcess } from 'child_process'; + +type Callback = (error: Error, stdout: string, stderr: string) => void; +declare function opener( + args: string | string[], options?: {}, callback?: Callback): ChildProcess; + +export = opener; diff --git a/opener/opener-tests.ts b/opener/opener-tests.ts new file mode 100644 index 0000000000..477fe4b3f8 --- /dev/null +++ b/opener/opener-tests.ts @@ -0,0 +1,11 @@ +import opener = require('opener'); + +// all example code should compile + +opener('http://google.com'); +opener('./my-file.txt'); +opener('firefox'); +opener('npm run lint'); + +var editor = opener('documentation.odt'); +editor.unref(); diff --git a/opener/tsconfig.json b/opener/tsconfig.json new file mode 100644 index 0000000000..963f0f48b5 --- /dev/null +++ b/opener/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "opener-tests.ts" + ] +} diff --git a/opener/tslint.json b/opener/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/opener/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 5efea302f34c3a0a57daf2fc981b494e907ac2dd Mon Sep 17 00:00:00 2001 From: Vlad Rindevich Date: Sun, 22 Jan 2017 01:53:35 +0300 Subject: [PATCH 032/140] libpq: Fix wrong definitions (#14164) * fix(libpq): change returning type of `writable` method * fix(libpq): remove optionality for `prepare` method's arguments * fix(libpq): remove optionality for `sendPrepare` method's arguments --- libpq/index.d.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libpq/index.d.ts b/libpq/index.d.ts index df2135046a..1e9e38dd5c 100644 --- a/libpq/index.d.ts +++ b/libpq/index.d.ts @@ -307,11 +307,11 @@ declare class Libpq extends EventEmitter { * (sync) Sends a named statement to the server to be prepared for later execution. blocks * until a result from the prepare operation is received. * - * @param {string} [statementName=""] a required string of name of the statement to prepare. - * @param {string} [commandText=""] a required string of the query. - * @param {number} [nParams=0] a count of the number of parameters in the commandText. + * @param {string} statementName a required string of name of the statement to prepare. + * @param {string} commandText a required string of the query. + * @param {number} nParams a count of the number of parameters in the commandText. */ - prepare(statementName?: string, commandText?: string, nParams?: number): void; + prepare(statementName: string, commandText: string, nParams: number): void; /** * Retrieves detailed error information from the current result object. Very similar to @@ -363,12 +363,12 @@ declare class Libpq extends EventEmitter { /** * (async) Sends a request to the backend to prepare a named statement with the given name. * - * @param {string} [statementName=""] a required string of name of the statement to prepare. - * @param {string} [commandText=""] a required string of the query. - * @param {number} [nParams=0] a count of the number of parameters in the commandText. + * @param {string} statementName a required string of name of the statement to prepare. + * @param {string} commandText a required string of the query. + * @param {number} nParams a count of the number of parameters in the commandText. * @returns {boolean} true if the command was sent succesfully or false if it failed to send. */ - sendPrepare(statementName?: string, commandText?: string, nParams?: number): boolean; + sendPrepare(statementName: string, commandText: string, nParams: number): boolean; /** * (async) Sends a request to execute a previously prepared statement. @@ -421,8 +421,10 @@ declare class Libpq extends EventEmitter { * and PQflush for async writing. * * @param {Function} callback + * + * @returns {Libpq} */ - writable(callback: () => void): void; + writable(callback: () => void): this; } export = Libpq; From c71435a8cb52e11f1606dcaedff1c558eb74f917 Mon Sep 17 00:00:00 2001 From: Otoha Funabashi Date: Sun, 22 Jan 2017 07:53:57 +0900 Subject: [PATCH 033/140] shelljs: update exec for after v0.6.0 (#14143) * shelljs: update for after v0.6.0 exec.output was changed to exec.stdout, and missing exec.stderr. stderr: https://github.com/shelljs/shelljs/commit/74f1ff8748ab8261ad20062dfee40d39103e0a98 stdout: https://github.com/shelljs/shelljs/commit/8a7f7ceec4d3a77a9309d935755675ac368b1eda * shelljs: update testcode --- shelljs/index.d.ts | 7 ++++--- shelljs/shelljs-tests.ts | 16 ++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/shelljs/index.d.ts b/shelljs/index.d.ts index 26f92c379f..5e812947fd 100644 --- a/shelljs/index.d.ts +++ b/shelljs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ShellJS v0.3.0 +// Type definitions for ShellJS v0.6.0 // Project: http://shelljs.org // Definitions by: Niklas Mollenhauer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -463,7 +463,7 @@ export declare function exec(command: string, options: ExecOptions, callback: Ex export declare function exec(command: string, callback: ExecCallback): child.ChildProcess; export interface ExecCallback { - (code: number, output: string, error?: string): any; + (code: number, stdout: string, stderr: string): any; } export interface ExecOptions { @@ -473,7 +473,8 @@ export interface ExecOptions { export interface ExecOutputReturnValue { code: number; - output: string; + stdout: string; + stderr: string; } /** diff --git a/shelljs/shelljs-tests.ts b/shelljs/shelljs-tests.ts index 7934046d0a..a78b8e44e1 100644 --- a/shelljs/shelljs-tests.ts +++ b/shelljs/shelljs-tests.ts @@ -86,22 +86,22 @@ var testPath = shell.env["path"]; import child = require("child_process"); -var version = shell.exec("node --version").output; +var version = shell.exec("node --version").stdout; var version2 = shell.exec("node --version", { async: false }); -var output = version2.output; +var output = version2.stdout; var asyncVersion3 = shell.exec("node --version", { async: true }); var pid = asyncVersion3.pid; -shell.exec("node --version", { silent: true }, function (code, output) { - var version = output; +shell.exec("node --version", { silent: true }, function (code, stdout, stderr) { + var version = stdout; }); -shell.exec("node --version", { silent: true, async: true }, function (code, output) { - var version = output; +shell.exec("node --version", { silent: true, async: true }, function (code, stdout, stderr) { + var version = stdout; }); -shell.exec("node --version", function (code, output) { - var version = output; +shell.exec("node --version", function (code, stdout, stderr) { + var version = stdout; }); shell.exec("node --version", function (code: number) { var num: number = code; From 3357f1a6237e4995768df3456a479f6a63c913c7 Mon Sep 17 00:00:00 2001 From: Rafael Kr Date: Sat, 21 Jan 2017 23:55:02 +0100 Subject: [PATCH 034/140] [node] zlib: move constants into zlib.constants (#13945) * [node] zlib: move constants into zlib.constants * add flush property to ZlibOptions declare constants as namespace --- node/index.d.ts | 52 ++++++++++++++++++++++++++++++++++++++++++++-- node/node-tests.ts | 4 ++-- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/node/index.d.ts b/node/index.d.ts index 5fcd4eb5d5..1f32030db7 100644 --- a/node/index.d.ts +++ b/node/index.d.ts @@ -1043,7 +1043,17 @@ declare module "cluster" { declare module "zlib" { import * as stream from "stream"; - export interface ZlibOptions { chunkSize?: number; windowBits?: number; level?: number; memLevel?: number; strategy?: number; dictionary?: any; finishFlush?: number } + + export interface ZlibOptions { + flush?: number; // default: zlib.constants.Z_NO_FLUSH + finishFlush?: number; // default: zlib.constants.Z_FINISH + chunkSize?: number; // default: 16*1024 + windowBits?: number; + level?: number; // compression only + memLevel?: number; // compression only + strategy?: number; // compression only + dictionary?: any; // deflate/inflate only, empty dictionary by default + } export interface Gzip extends stream.Transform { } export interface Gunzip extends stream.Transform { } @@ -1076,6 +1086,45 @@ declare module "zlib" { export function unzip(buf: Buffer, callback: (error: Error, result: Buffer) => void): void; export function unzipSync(buf: Buffer, options?: ZlibOptions): Buffer; + export namespace constants { + // Allowed flush values. + + export const Z_NO_FLUSH: number; + export const Z_PARTIAL_FLUSH: number; + export const Z_SYNC_FLUSH: number; + export const Z_FULL_FLUSH: number; + export const Z_FINISH: number; + export const Z_BLOCK: number; + export const Z_TREES: number; + + // Return codes for the compression/decompression functions. Negative values are errors, positive values are used for special but normal events. + + export const Z_OK: number; + export const Z_STREAM_END: number; + export const Z_NEED_DICT: number; + export const Z_ERRNO: number; + export const Z_STREAM_ERROR: number; + export const Z_DATA_ERROR: number; + export const Z_MEM_ERROR: number; + export const Z_BUF_ERROR: number; + export const Z_VERSION_ERROR: number; + + // Compression levels. + + export const Z_NO_COMPRESSION: number; + export const Z_BEST_SPEED: number; + export const Z_BEST_COMPRESSION: number; + export const Z_DEFAULT_COMPRESSION: number; + + // Compression strategy. + + export const Z_FILTERED: number; + export const Z_HUFFMAN_ONLY: number; + export const Z_RLE: number; + export const Z_FIXED: number; + export const Z_DEFAULT_STRATEGY: number; + } + // Constants export var Z_NO_FLUSH: number; export var Z_PARTIAL_FLUSH: number; @@ -1107,7 +1156,6 @@ declare module "zlib" { export var Z_ASCII: number; export var Z_UNKNOWN: number; export var Z_DEFLATED: number; - export var Z_NULL: number; } declare module "os" { diff --git a/node/node-tests.ts b/node/node-tests.ts index 1778c6e0aa..adcadb1a60 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -441,7 +441,7 @@ namespace util_tests { function stream_readable_pipe_test() { var rs = fs.createReadStream(Buffer.from('file.txt')); var r = fs.createReadStream('file.txt'); - var z = zlib.createGzip({ finishFlush: zlib.Z_FINISH }); + var z = zlib.createGzip({ finishFlush: zlib.constants.Z_FINISH }); var w = fs.createWriteStream('file.txt.gz'); assert(typeof r.bytesRead === 'number'); @@ -846,7 +846,7 @@ namespace http_tests { request.setNoDelay(true); request.abort(); } - + const options: http.RequestOptions = { timeout: 30000 }; From 756433aeb47ea33ec79bb634cef662be941178e8 Mon Sep 17 00:00:00 2001 From: Oleksii Trekhleb Date: Sun, 22 Jan 2017 00:58:37 +0200 Subject: [PATCH 035/140] Fix elastic.js typings. Adding module and namespace exports. (#14152) * Fix elastic.js typings namespace from 'elasticjs' to 'elastic.js'. This will allow using 'import' statement against elastic.js like so: import * as elasticjs from 'elastic.js'; This also makes using this typings to be TSlint "no-var-require" rule compliant. * Export elasticjs namespace. --- elastic.js/elastic.js-tests.ts | 2 ++ elastic.js/index.d.ts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/elastic.js/elastic.js-tests.ts b/elastic.js/elastic.js-tests.ts index 927cb73d91..e7bd65ea16 100644 --- a/elastic.js/elastic.js-tests.ts +++ b/elastic.js/elastic.js-tests.ts @@ -1,3 +1,5 @@ +import * as elasticjs from 'elastic.js'; + let body = new elasticjs.Request({}) .query(new elasticjs.MatchQuery('title_field', 'testQuery')) .facet(new elasticjs.TermsFacet('tags').field('tags')) diff --git a/elastic.js/index.d.ts b/elastic.js/index.d.ts index 99a45f58fa..adb0db6950 100644 --- a/elastic.js/index.d.ts +++ b/elastic.js/index.d.ts @@ -3,6 +3,10 @@ // Definitions by: Oleksii Trekhleb // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +export = elasticjs; + +export as namespace elasticjs; + declare module elasticjs { export interface Facet {} From 6ab43d89ceb253203ea9c7eb19d5acc27428cd03 Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Sun, 22 Jan 2017 08:19:18 +0800 Subject: [PATCH 036/140] fix: add header in .d.ts file fix: add tests file fix: set "strictNullChecks": true --- cannon/cannon-tests.ts | 6 ++++++ cannon/index.d.ts | 5 +++++ cannon/tsconfig.json | 2 +- cannon/tslint.json | 1 + rsvp/rsvp-tests.ts | 4 ++++ rsvp/tsconfig.json | 2 +- wonder-commonlib/index.d.ts | 5 +++++ wonder-commonlib/tsconfig.json | 2 +- wonder-commonlib/wonder-commonlib-tests.ts | 7 +++++++ wonder-frp/index.d.ts | 5 +++++ wonder-frp/tsconfig.json | 2 +- wonder-frp/wonder-frp-tests.ts | 6 ++++++ 12 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 cannon/cannon-tests.ts create mode 100644 cannon/tslint.json create mode 100644 rsvp/rsvp-tests.ts create mode 100644 wonder-commonlib/wonder-commonlib-tests.ts create mode 100644 wonder-frp/wonder-frp-tests.ts diff --git a/cannon/cannon-tests.ts b/cannon/cannon-tests.ts new file mode 100644 index 0000000000..f68a96d811 --- /dev/null +++ b/cannon/cannon-tests.ts @@ -0,0 +1,6 @@ +import cannon = require("cannon"); + +var aabb = new cannon.AABB() + +aabb.setFromPoints(new cannon.Vec3(1,2,3)); + diff --git a/cannon/index.d.ts b/cannon/index.d.ts index 90493d5edd..ea8ae89e59 100644 --- a/cannon/index.d.ts +++ b/cannon/index.d.ts @@ -1,3 +1,8 @@ +// Type definitions for cannon +// Project: https://github.com/clark-stevenson/cannon.d.ts +// Definitions by: Clark Stevenson +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + declare module CANNON { export interface IAABBOptions { diff --git a/cannon/tsconfig.json b/cannon/tsconfig.json index 27e01ecd7b..3bc13b0278 100644 --- a/cannon/tsconfig.json +++ b/cannon/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/cannon/tslint.json b/cannon/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/cannon/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file diff --git a/rsvp/rsvp-tests.ts b/rsvp/rsvp-tests.ts new file mode 100644 index 0000000000..efb3cdbff6 --- /dev/null +++ b/rsvp/rsvp-tests.ts @@ -0,0 +1,4 @@ +var rsvp = require("rsvp"); + +var promise = new rsvp.Promise(function(resolve, rejector){ +}); diff --git a/rsvp/tsconfig.json b/rsvp/tsconfig.json index 27e01ecd7b..3bc13b0278 100644 --- a/rsvp/tsconfig.json +++ b/rsvp/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/wonder-commonlib/index.d.ts b/wonder-commonlib/index.d.ts index 2fd8d2bd88..899def415f 100644 --- a/wonder-commonlib/index.d.ts +++ b/wonder-commonlib/index.d.ts @@ -1,3 +1,8 @@ +// Type definitions for wonder-commonlib v0.1.0 +// Project: https://github.com/yyc-git/Wonder-CommonLib +// Definitions by: YYC +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + declare module wdCb { class JudgeUtils { static isArray(arr: any): boolean; diff --git a/wonder-commonlib/tsconfig.json b/wonder-commonlib/tsconfig.json index 27e01ecd7b..3bc13b0278 100644 --- a/wonder-commonlib/tsconfig.json +++ b/wonder-commonlib/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/wonder-commonlib/wonder-commonlib-tests.ts b/wonder-commonlib/wonder-commonlib-tests.ts new file mode 100644 index 0000000000..fb84bc3a5e --- /dev/null +++ b/wonder-commonlib/wonder-commonlib-tests.ts @@ -0,0 +1,7 @@ +var wdCb = require("wonder-commonlib"); + +var list = wdCb.Collection.create(); + +list.addChild(1); + + diff --git a/wonder-frp/index.d.ts b/wonder-frp/index.d.ts index 8f77f93723..cf7ca6fd78 100644 --- a/wonder-frp/index.d.ts +++ b/wonder-frp/index.d.ts @@ -1,3 +1,8 @@ +// Type definitions for wonder-frp v0.1.0 +// Project: https://github.com/yyc-git/Wonder-FRP +// Definitions by: YYC +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + declare module wdFrp { class JudgeUtils extends wdCb.JudgeUtils { static isPromise(obj: any): boolean; diff --git a/wonder-frp/tsconfig.json b/wonder-frp/tsconfig.json index 27e01ecd7b..3bc13b0278 100644 --- a/wonder-frp/tsconfig.json +++ b/wonder-frp/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/wonder-frp/wonder-frp-tests.ts b/wonder-frp/wonder-frp-tests.ts new file mode 100644 index 0000000000..8bfebf55ba --- /dev/null +++ b/wonder-frp/wonder-frp-tests.ts @@ -0,0 +1,6 @@ +var wdFrp = require("wonder-frp"); + +wdFrp.fromArray([1,2,3]) + .subscribe(null,null,function(){ + console.log("completed"); + }); From e8cb9198fb92e483e1ecaec213db49483c87fa90 Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Sun, 22 Jan 2017 08:26:23 +0800 Subject: [PATCH 037/140] fix: used tests file --- cannon/tsconfig.json | 3 ++- rsvp/tsconfig.json | 3 ++- wonder-commonlib/tsconfig.json | 3 ++- wonder-frp/tsconfig.json | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cannon/tsconfig.json b/cannon/tsconfig.json index 3bc13b0278..a59be4d465 100644 --- a/cannon/tsconfig.json +++ b/cannon/tsconfig.json @@ -16,6 +16,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "cannon-tests.ts" ] } \ No newline at end of file diff --git a/rsvp/tsconfig.json b/rsvp/tsconfig.json index 3bc13b0278..58c8e605be 100644 --- a/rsvp/tsconfig.json +++ b/rsvp/tsconfig.json @@ -16,6 +16,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "rsvp-tests.ts" ] } \ No newline at end of file diff --git a/wonder-commonlib/tsconfig.json b/wonder-commonlib/tsconfig.json index 3bc13b0278..19de8e5e84 100644 --- a/wonder-commonlib/tsconfig.json +++ b/wonder-commonlib/tsconfig.json @@ -16,6 +16,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "wonder-commonlib-tests.ts" ] } \ No newline at end of file diff --git a/wonder-frp/tsconfig.json b/wonder-frp/tsconfig.json index 3bc13b0278..606dd8ac8c 100644 --- a/wonder-frp/tsconfig.json +++ b/wonder-frp/tsconfig.json @@ -16,6 +16,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "wonder-frp-tests.ts" ] } \ No newline at end of file From a8b09e012a2101035e9236334dd5b870b539420c Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Sun, 22 Jan 2017 08:39:12 +0800 Subject: [PATCH 038/140] fix --- cannon/index.d.ts | 4 ++++ rsvp/index.d.ts | 4 ++++ rsvp/rsvp-tests.ts | 4 ++-- wonder-commonlib/index.d.ts | 6 +++++- wonder-commonlib/wonder-commonlib-tests.ts | 2 +- wonder-frp/index.d.ts | 5 +++++ wonder-frp/wonder-frp-tests.ts | 2 +- 7 files changed, 22 insertions(+), 5 deletions(-) diff --git a/cannon/index.d.ts b/cannon/index.d.ts index ea8ae89e59..6b4905c7b1 100644 --- a/cannon/index.d.ts +++ b/cannon/index.d.ts @@ -992,3 +992,7 @@ declare module CANNON { } } + +declare module "cannon" { + export = CANNON; +} diff --git a/rsvp/index.d.ts b/rsvp/index.d.ts index d10d3288da..f4a8fd0a1a 100644 --- a/rsvp/index.d.ts +++ b/rsvp/index.d.ts @@ -313,3 +313,7 @@ declare module RSVP { } + +declare module "rsvp" { + export = RSVP; +} diff --git a/rsvp/rsvp-tests.ts b/rsvp/rsvp-tests.ts index efb3cdbff6..50770ba8b6 100644 --- a/rsvp/rsvp-tests.ts +++ b/rsvp/rsvp-tests.ts @@ -1,4 +1,4 @@ -var rsvp = require("rsvp"); +import rsvp = require("rsvp"); -var promise = new rsvp.Promise(function(resolve, rejector){ +var promise = new rsvp.Promise(function(resolve:any, rejector:any){ }); diff --git a/wonder-commonlib/index.d.ts b/wonder-commonlib/index.d.ts index 899def415f..ab27ce88ff 100644 --- a/wonder-commonlib/index.d.ts +++ b/wonder-commonlib/index.d.ts @@ -21,7 +21,7 @@ declare module wdCb { } } -declare var global: any, window: Window; +declare var global: any, window: any; declare module wdCb { var root: any; } @@ -261,3 +261,7 @@ declare module wdCb { } } +declare module "wonder-commonlib" { + export = wdCb; +} + diff --git a/wonder-commonlib/wonder-commonlib-tests.ts b/wonder-commonlib/wonder-commonlib-tests.ts index fb84bc3a5e..c22d61c11d 100644 --- a/wonder-commonlib/wonder-commonlib-tests.ts +++ b/wonder-commonlib/wonder-commonlib-tests.ts @@ -1,4 +1,4 @@ -var wdCb = require("wonder-commonlib"); +import wdCb = require("wonder-commonlib"); var list = wdCb.Collection.create(); diff --git a/wonder-frp/index.d.ts b/wonder-frp/index.d.ts index cf7ca6fd78..eda41a0370 100644 --- a/wonder-frp/index.d.ts +++ b/wonder-frp/index.d.ts @@ -721,3 +721,8 @@ declare module wdFrp { subscribeCore(observer: IObserver): SingleDisposable; } } + +declare module "wonder-frp" { + export = wdFrp; +} + diff --git a/wonder-frp/wonder-frp-tests.ts b/wonder-frp/wonder-frp-tests.ts index 8bfebf55ba..8f93f0462c 100644 --- a/wonder-frp/wonder-frp-tests.ts +++ b/wonder-frp/wonder-frp-tests.ts @@ -1,4 +1,4 @@ -var wdFrp = require("wonder-frp"); +import wdFrp = require("wonder-frp"); wdFrp.fromArray([1,2,3]) .subscribe(null,null,function(){ From 29bcff2afd0f1f8d5e61f1cc5513da4f8dcf9665 Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Sun, 22 Jan 2017 09:27:42 +0800 Subject: [PATCH 039/140] fix --- cannon/cannon-tests.ts | 2 +- wonder-commonlib/tsconfig.json | 3 ++- wonder-frp/index.d.ts | 4 +++- wonder-frp/wonder-frp-tests.ts | 3 +-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cannon/cannon-tests.ts b/cannon/cannon-tests.ts index f68a96d811..79ae76a6d8 100644 --- a/cannon/cannon-tests.ts +++ b/cannon/cannon-tests.ts @@ -2,5 +2,5 @@ import cannon = require("cannon"); var aabb = new cannon.AABB() -aabb.setFromPoints(new cannon.Vec3(1,2,3)); +aabb.setFromPoints([new cannon.Vec3(1,2,3)]); diff --git a/wonder-commonlib/tsconfig.json b/wonder-commonlib/tsconfig.json index 19de8e5e84..3540cf91c0 100644 --- a/wonder-commonlib/tsconfig.json +++ b/wonder-commonlib/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/wonder-frp/index.d.ts b/wonder-frp/index.d.ts index eda41a0370..a5c89af7c3 100644 --- a/wonder-frp/index.d.ts +++ b/wonder-frp/index.d.ts @@ -3,6 +3,8 @@ // Definitions by: YYC // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + declare module wdFrp { class JudgeUtils extends wdCb.JudgeUtils { static isPromise(obj: any): boolean; @@ -101,7 +103,7 @@ declare module wdFrp { } } -declare var global: any, window: Window; +declare var global: any, window: any; declare module wdFrp { var root: any; } diff --git a/wonder-frp/wonder-frp-tests.ts b/wonder-frp/wonder-frp-tests.ts index 8f93f0462c..3efceed43f 100644 --- a/wonder-frp/wonder-frp-tests.ts +++ b/wonder-frp/wonder-frp-tests.ts @@ -1,6 +1,5 @@ import wdFrp = require("wonder-frp"); wdFrp.fromArray([1,2,3]) - .subscribe(null,null,function(){ - console.log("completed"); + .subscribe(function(){ }); From fc94866d7b48d9226dde14bb3aaf87b17901acff Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Sun, 22 Jan 2017 09:34:27 +0800 Subject: [PATCH 040/140] fix --- wonder-commonlib/index.d.ts | 2 +- wonder-frp/index.d.ts | 2 +- wonder-frp/tsconfig.json | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wonder-commonlib/index.d.ts b/wonder-commonlib/index.d.ts index ab27ce88ff..3421de0125 100644 --- a/wonder-commonlib/index.d.ts +++ b/wonder-commonlib/index.d.ts @@ -21,7 +21,7 @@ declare module wdCb { } } -declare var global: any, window: any; +declare var global: any, window: Window; declare module wdCb { var root: any; } diff --git a/wonder-frp/index.d.ts b/wonder-frp/index.d.ts index a5c89af7c3..c5e69d2dd9 100644 --- a/wonder-frp/index.d.ts +++ b/wonder-frp/index.d.ts @@ -103,7 +103,7 @@ declare module wdFrp { } } -declare var global: any, window: any; +declare var global: any, window: Window; declare module wdFrp { var root: any; } diff --git a/wonder-frp/tsconfig.json b/wonder-frp/tsconfig.json index 606dd8ac8c..bc145951ba 100644 --- a/wonder-frp/tsconfig.json +++ b/wonder-frp/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, From d3ce3c24728023f0766714c623194c6fb8bb415e Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Sun, 22 Jan 2017 09:53:42 +0800 Subject: [PATCH 041/140] fix --- cannon/index.d.ts | 377 +++++++++++++++++++++++++++++++++++---------- cannon/tslint.json | 1 - 2 files changed, 292 insertions(+), 86 deletions(-) delete mode 100644 cannon/tslint.json diff --git a/cannon/index.d.ts b/cannon/index.d.ts index 6b4905c7b1..7df6671d52 100644 --- a/cannon/index.d.ts +++ b/cannon/index.d.ts @@ -19,11 +19,14 @@ declare module CANNON { constructor(options?: IAABBOptions); + clone() : AABB; setFromPoints(points: Vec3[], position?: Vec3, quaternion?: Quaternion, skinSize?: number): void; copy(aabb: AABB): void; extend(aabb: AABB): void; + getCorners( a: Vec3, b: Vec3, c: Vec3, d: Vec3, e: Vec3, f: Vec3, g: Vec3, h: Vec3 ) : void; overlaps(aabb: AABB): boolean; - + toLocalFrame( frame: Transform, target: AABB ) : AABB; + toWorldFrame( frame: Transform, target: AABB ) : AABB; } export class ArrayCollisionMatrix { @@ -37,7 +40,7 @@ declare module CANNON { } - export class BroadPhase { + export class Broadphase { world: World; useBoundingBoxes: boolean; @@ -55,7 +58,7 @@ declare module CANNON { } - export class GridBroadphase extends BroadPhase { + export class GridBroadphase extends Broadphase { nx: number; ny: number; @@ -68,7 +71,7 @@ declare module CANNON { } - export class NaiveBroadphase extends BroadPhase { + export class NaiveBroadphase extends Broadphase { } export class ObjectCollisionMatrix { @@ -82,16 +85,42 @@ declare module CANNON { } + export interface IRayIntersectWorldOptions { + + mode: number; + result: boolean; + skipBackfaces: boolean; + collisionFilterMask: number; + collisionFilterGroup: number; + from: Vec3; + to: Vec3; + callback: Function; + + } + export class Ray { + static CLOSEST: number; + static ANY: number; + static ALL: number; + from: Vec3; to: Vec3; precision: number; checkCollisionResponse: boolean; + callback: Function; + collisionFilterGroup: number; + collisionFilterMask: number; + hasHit: boolean; + mode: number; + result: RaycastResult; + skipBackfaces: boolean; constructor(from?: Vec3, to?: Vec3); getAABB(result: RaycastResult): void; + intersectBodies(bodies: Body[], result?: RaycastResult): void; + intersectWorld(world: World, options: IRayIntersectWorldOptions): boolean; } @@ -101,17 +130,19 @@ declare module CANNON { rayToWorld: Vec3; hitNormalWorld: Vec3; hitPointWorld: Vec3; + hitFaceIndex: number; hasHit: boolean; shape: Shape; body: Body; distance: number; + abort(): void; reset(): void; set(rayFromWorld: Vec3, rayToWorld: Vec3, hitNormalWorld: Vec3, hitPointWorld: Vec3, shape: Shape, body: Body, distance: number): void; } - export class SAPBroadphase extends BroadPhase { + export class SAPBroadphase extends Broadphase { static insertionSortX(a: any[]): any[]; static insertionSortY(a: any[]): any[]; @@ -147,12 +178,17 @@ declare module CANNON { constructor(bodyA: Body, bodyB: Body, options?: IConstraintOptions); update(): void; + disable(): void; + enable(): void; } export class DistanceConstraint extends Constraint { - constructor(bodyA: Body, bodyB: Body, distance: number, maxForce?: number); + distance: number; + distanceEquation: ContactEquation; + + constructor(bodyA: Body, bodyB: Body, distance?: number, maxForce?: number); } @@ -168,6 +204,10 @@ declare module CANNON { export class HingeConstraint extends Constraint { + axisA: Vec3; + axisB: Vec3; + rotationalEquation1: RotationalEquation; + rotationalEquation2: RotationalEquation; motorEnabled: boolean; motorTargetVelocity: number; motorMinForce: number; @@ -178,21 +218,41 @@ declare module CANNON { enableMotor(): void; disableMotor(): void; + setMotorMaxForce(maxForce: number): void; + setMotorSpeed(speed: number): void; } export class PointToPointConstraint extends Constraint { + equationX: ContactEquation; + equationY: ContactEquation; + equationZ: ContactEquation; + pivotA: Vec3; + pivotB: Vec3; + constructor(bodyA: Body, pivotA: Vec3, bodyB: Body, pivotB: Vec3, maxForce?: number); } + export class ConeTwistConstraint extends PointToPointConstraint { + + coneEquation: ConeEquation; + twistEquation: RotationalEquation; + + constructor(bodyA: Body, bodyB: Body, options?: IHingeConstraintOptions); - export class LockConstraint extends Constraint { - constructor(bodyA: Body, bodyB: Body, options?:any); } + export class LockConstraint extends PointToPointConstraint { + rotationalEquation1: RotationalEquation; + rotationalEquation2: RotationalEquation; + rotationalEquation3: RotationalEquation; + + constructor(bodyA: Body, bodyB: Body, maxForce?: number); + + } export class Equation { @@ -219,7 +279,7 @@ declare module CANNON { computeGiMGt(): number; addToWlamda(deltalambda: number): number; computeC(): number; - + computeInvC( eps: number ): number; } export class FrictionEquation extends Equation { @@ -228,6 +288,14 @@ declare module CANNON { } + export interface IRotationalEquationOptions { + + axisA?: Vec3; + axisB?: Vec3; + maxForce?: number; + + } + export class RotationalEquation extends Equation { ni: Vec3; @@ -239,7 +307,7 @@ declare module CANNON { relVel: Vec3; relForce: Vec3; - constructor(bodyA: Body, bodyB: Body); + constructor(bodyA: Body, bodyB: Body, options?: IRotationalEquationOptions); } @@ -255,22 +323,33 @@ declare module CANNON { } + export interface IConeEquationOptions { + + axisA?: Vec3; + axisB?: Vec3; + maxForce?: number; + + } + + export class ConeEquation extends Equation { + + angle: number; + + constructor(bodyA: Body, bodyB: Body, options?: IConeEquationOptions); + + } + export class ContactEquation extends Equation { restitution: number; ri: Vec3; rj: Vec3; - penetrationVec: Vec3; ni: Vec3; - rixn: Vec3; - rjxn: Vec3; - invIi: Mat3; - invIj: Mat3; - biInvInertiaTimesRixn: Vec3; - bjInvInertiaTimesRjxn: Vec3; constructor(bi: Body, bj: Body); + getImpactVelocityAlongNormal(): number; + } export interface IContactMaterialOptions { @@ -301,12 +380,12 @@ declare module CANNON { export class Material { - name: string; id: number; - friction:number; - restitution:number; + name: string; + friction: number; + restitution: number; - constructor(name: string); + constructor(name?: string); } @@ -322,6 +401,8 @@ declare module CANNON { export class Mat3 { + elements: number[]; + constructor(elements?: number[]); identity(): void; @@ -342,6 +423,38 @@ declare module CANNON { } + export class Trimesh extends Shape { + + aabb: AABB; + edges: number[]; + indices: number[]; + normals: number[]; + scale: Vec3; + tree: Octree; + vertices: number[]; + + static computeNormal(va: Vec3, vb: Vec3, vc: Vec3, target: Vec3): void; + static createTorus(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number): Trimesh; + + constructor(vertices: number[], indices: number[]); + + calculateWorldAABB(pos: Vec3, quat: Quaternion, min: Vec3, max: Vec3): void; + computeLocalAABB(aabb: AABB): void; + getEdgeVector(edgeIndex: number, vectorStore: Vec3): void; + getEdgeVertex(edgeIndex: number, firstOrSecond: number, vertexStore: Vec3): void; + getNormal(i: number, target: Vec3): Vec3; + getTrianglesAABB(aabb: AABB, result: number[]): void; + getTriangleVertices(i: number, a: Vec3, b: Vec3, c: Vec3): void; + getVertex(i: number, out: Vec3): Vec3; + getWorldVertex(i: number, pos: Vec3, quat: Quaternion, out: Vec3): Vec3; + setScale(scale: Vec3): void; + updateAABB(): void; + updateEdges(): void; + updateNormals(): void; + updateTree(): void; + + } + export class Quaternion { x: number; @@ -374,18 +487,23 @@ declare module CANNON { static pointToLocalFrame(position: Vec3, quaternion: Quaternion, worldPoint: Vec3, result?: Vec3): Vec3; static pointToWorldFrame(position: Vec3, quaternion: Quaternion, localPoint: Vec3, result?: Vec3): Vec3; + static vectorToWorldFrame(quaternion: Quaternion, localVector: Vec3, result: Vec3): Vec3; + static vectorToLocalFrame(position: Vec3, quaternion: Quaternion, worldVector: Vec3, result?: Vec3): Vec3; position: Vec3; quaternion: Quaternion; - vectorToWorldFrame(localVector: Vec3, result?: Vec3): Vec3; - vectorToLocalFrame(position: Vec3, quaternion: Quaternion, worldVector: Vec3, result?: Vec3): Vec3; + pointToLocal(point: Vec3, result: Vec3): Vec3; + pointToWorld(point: Vec3, result: Vec3): Vec3; } export class Vec3 { static ZERO: Vec3; + static UNIT_X: Vec3; + static UNIT_Y: Vec3; + static UNIT_Z: Vec3; x: number; y: number; @@ -404,6 +522,7 @@ declare module CANNON { norm(): number; norm2(): number; distanceTo(p: Vec3): number; + distanceSquared(p: Vec3): number; mult(scalar: number, target?: Vec3): Vec3; scale(scalar: number, target?: Vec3): Vec3; dot(v: Vec3): number; @@ -413,6 +532,8 @@ declare module CANNON { toString(): string; toArray(): number[]; copy(source: Vec3): Vec3; + length(): number; + lengthSquared(): number; lerp(v: Vec3, t: number, target?: Vec3): void; almostEquals(v: Vec3, precision?: number): boolean; almostZero(precision?: number): boolean; @@ -422,15 +543,24 @@ declare module CANNON { } export interface IBodyOptions { + position?: Vec3; velocity?: Vec3; angularVelocity?: Vec3; quaternion?: Quaternion; mass?: number; - material?: number; + material?: Material; type?: number; linearDamping?: number; angularDamping?: number; + allowSleep?: boolean; + sleepSpeedLimit?: number; + sleepTimeLimit?: number; + collisionFilterGroup?: number; + collisionFilterMask?: number; + fixedRotation?: boolean; + shape?: Shape; + } export class Body extends EventTarget { @@ -455,6 +585,7 @@ declare module CANNON { position: Vec3; previousPosition: Vec3; initPosition: Vec3; + boundingRadius: number; velocity: Vec3; initVelocity: Vec3; force: Vec3; @@ -495,30 +626,24 @@ declare module CANNON { wakeUp(): void; sleep(): void; sleepTick(time: number): void; - updateSolveMassProperties(): void; pointToLocalFrame(worldPoint: Vec3, result?: Vec3): Vec3; pointToWorldFrame(localPoint: Vec3, result?: Vec3): Vec3; + vectorToLocalFrame(worldPoint: Vec3, result?: Vec3): Vec3; vectorToWorldFrame(localVector: Vec3, result?: Vec3): Vec3; - addShape(shape: Shape, offset?: Vec3, orientation?: Quaternion): void; - updateBoundingRadius(): void; + addShape(shape: Shape, offset?: Vec3, orientation?: Vec3): void; computeAABB(): void; - updateInertiaWorld(force: Vec3): void; applyForce(force: Vec3, worldPoint: Vec3): void; applyImpulse(impulse: Vec3, worldPoint: Vec3): void; + applyLocalForce(force: Vec3, localPoint: Vec3): void; + applyLocalImplse(impulse: Vec3, localPoint: Vec3): void; + updateBoundingRadius(): void; updateMassProperties(): void; + updateInertiaWorld(force: Vec3): void; + updateSolveMassProperties(): void; getVelocityAtWorldPoint(worldPoint: Vec3, result: Vec3): Vec3; } - export interface IRaycastVehicleOptions { - - chassisBody?: Body; - indexRightAxis?: number; - indexLeftAxis?: number; - indexUpAxis?: number; - - } - export interface IWheelInfoOptions { chassisConnectionPointLocal?: Vec3; @@ -539,7 +664,7 @@ declare module CANNON { deltaRotation?: number; rollInfluence?: number; maxSuspensionForce?: number; - isFronmtWheel?: boolean; + isFrontWheel?: boolean; clippedInvContactDotSuspension?: number; suspensionRelativeVelocity?: number; suspensionForce?: number; @@ -558,46 +683,55 @@ declare module CANNON { export class WheelInfo { - maxSuspensionTravbel: number; - customSlidingRotationalSpeed: number; - useCustomSlidingRotationalSpeed: boolean; - sliding: boolean; - chassisConnectionPointLocal: Vec3; - chassisConnectionPointWorld: Vec3; - directionLocal: Vec3; - directionWorld: Vec3; axleLocal: Vec3; axleWorld: Vec3; - suspensionRestLength: number; - suspensionMaxLength: number; - radius: number; - suspensionStiffness: number; + brake: number; + chassisConnectionPointLocal: Vec3; + chassisConnectionPointWorld: Vec3; + clippedInvContactDotSuspension: number; + customSlidingRotationalSpeed: number; dampingCompression: number; dampingRelaxation: number; - frictionSlip: number; - steering: number; - rotation: number; deltaRotation: number; - rollInfluence: number; - maxSuspensionForce: number; + directionLocal: Vec3; + directionWorld: Vec3; engineForce: number; - brake: number; - isFrontWheel: boolean; - clippedInvContactDotSuspension: number; - suspensionRelativeVelocity: number; - suspensionForce: number; - skidInfo: number; - suspensionLength: number; - sideImpulse: number; forwardImpulse: number; - raycastResult: RaycastResult; - worldTransform: Transform; + frictionSlip: number; + isFrontWheel: boolean; isInContact: boolean; + maxSuspensionForce: number; + maxSuspensionTravel: number; + radius: number; + raycastResult: RaycastResult; + rollInfluence: number; + rotation: number; + sideImpulse: number; + skidInfo: number; + sliding: boolean; + steering: number; + suspensionForce: number; + suspensionLength: number; + suspensionMaxLength: number; + suspensionRelativeVelocity: number; + suspensionStiffness: number; + suspensionRestLength: number; + useCustomSlidingRotationalSpeed: boolean; + worldTransform: Transform; constructor(options?: IWheelInfoOptions); } + export interface IRaycastVehicleOptions { + + chassisBody?: Body; + indexRightAxis?: number; + indexLeftAxis?: number; + indexUpAxis?: number; + + } + export class RaycastVehicle { chassisBody: Body; @@ -618,6 +752,7 @@ declare module CANNON { getVehicleAxisWorld(axisIndex: number, result: Vec3): Vec3; updateVehicle(timeStep: number): void; updateSuspension(deltaTime: number): void; + updateWheelTransform(wheelIndex: number): void; removeFromWorld(world: World): void; getWheelTransformWorld(wheelIndex: number): Transform; @@ -708,20 +843,15 @@ declare module CANNON { export class Box extends Shape { - static calculateIntertia(halfExtents: Vec3, mass: number, target: Vec3): void; + static calculateInertia(halfExtents: Vec3, mass: number, target: Vec3): void; - boundingSphereRadius: number; - collisionResponse: boolean; halfExtents: Vec3; convexPolyhedronRepresentation: ConvexPolyhedron; constructor(halfExtents: Vec3); updateConvexPolyhedronRepresentation(): void; - calculateLocalInertia(mass: number, target?: Vec3): Vec3; getSideNormals(sixTargetVectors: boolean, quat?: Quaternion): Vec3[]; - updateBoundingSphereRadius(): number; - volume(): number; forEachWorldCorner(pos: Vec3, quat: Quaternion, callback: Function): void; } @@ -730,6 +860,7 @@ declare module CANNON { static computeNormal(va: Vec3, vb: Vec3, vc: Vec3, target: Vec3): void; static project(hull: ConvexPolyhedron, axis: Vec3, pos: Vec3, quat: Quaternion, result: number[]): void; + static getFaceNormal(va: Vec3, vb: Vec3, vc: Vec3, target: Vec3): void; vertices: Vec3[]; worldVertices: Vec3[]; @@ -737,6 +868,7 @@ declare module CANNON { faces: number[]; faceNormals: Vec3[]; uniqueEdges: Vec3[]; + uniqueAxes: Vec3[]; constructor(points?: Vec3[], faces?: number[]); @@ -744,7 +876,7 @@ declare module CANNON { computeNormals(): void; getFaceNormal(i: number, target: Vec3): Vec3; clipAgainstHull(posA: Vec3, quatA: Quaternion, hullB: Vec3, quatB: Quaternion, separatingNormal: Vec3, minDist: number, maxDist: number, result: any[]): void; - findSaparatingAxis(hullB: ConvexPolyhedron, posA: Vec3, quatA: Quaternion, posB: Vec3, quatB: Quaternion, target: Vec3, faceListA: any[], faceListB: any[]): boolean; + findSeparatingAxis(hullB: ConvexPolyhedron, posA: Vec3, quatA: Quaternion, posB: Vec3, quatB: Quaternion, target: Vec3, faceListA: any[], faceListB: any[]): boolean; testSepAxis(axis: Vec3, hullB: ConvexPolyhedron, posA: Vec3, quatA: Quaternion, posB: Vec3, quatB: Quaternion): number; getPlaneConstantOfFace(face_i: number): number; clipFaceAgainstHull(separatingNormal: Vec3, posA: Vec3, quatA: Quaternion, worldVertsB1: Vec3[], minDist: number, maxDist: number, result: any[]): void; @@ -759,13 +891,13 @@ declare module CANNON { } - export class Cylinder extends Shape { + export class Cylinder extends ConvexPolyhedron { constructor(radiusTop: number, radiusBottom: number, height: number, numSegments: number); } - export interface IHightfield { + export interface IHightfieldOptions { minValue?: number; maxValue?: number; @@ -784,7 +916,7 @@ declare module CANNON { pillarOffset: Vec3; type: number; - constructor(data: number[], options?: IHightfield); + constructor(data: number[], options?: IHightfieldOptions); update(): void; updateMinValue(): void; @@ -826,13 +958,14 @@ declare module CANNON { } + id: number; type: number; boundingSphereRadius: number; collisionResponse: boolean; updateBoundingSphereRadius(): number; volume(): number; - calculateLocalInertia(mass: number, target: Vec3): Vec3; + calculateLocalInertia(mass: number, target?: Vec3): Vec3; } @@ -855,7 +988,7 @@ declare module CANNON { } export class Solver { - iterations: number; + equations: Equation[]; solve(dy: number, world: World): number; @@ -915,7 +1048,7 @@ declare module CANNON { export class Vec3Pool extends Pool { - type: any; + static defaults(options: Object, defaults: Object): Object; constructObject(): Vec3; @@ -924,8 +1057,66 @@ declare module CANNON { export class NarrowPhase { contactPointPool: Pool[]; + enableFrictionReduction: boolean; v3pool: Vec3Pool; + convexHeightfield(convexShape: Shape, hfShape: Heightfield, convexPos: Vec3, hfPos: Vec3, convexQuat: Quaternion, hfQuat: Quaternion, convexBody: Body, hfBody: Body): void; + convexConvex(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; + convexParticle(result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; + convexTrimesh( result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; + createContactEquation(bi: Body, bj: Body, si: Shape, sj: Shape, rsi: Shape, rsj: Shape): ContactEquation; + getContacts(p1: Body[], p2: Body[], world: World, result: ContactEquation[], oldcontacts: ContactEquation[]): void; + particlePlane( result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; + particleSphere(result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; + planeBox(result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; + planeConvex(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; + planeTrimesh(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; + sphereBox(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; + sphereConvex(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; + sphereHeightfield(sphereShape: Shape, hfShape: Heightfield, spherePos: Vec3, hfPos: Vec3, sphereQuat: Quaternion, hfQuat: Quaternion, sphereBody: Body, hfBody: Body): void; + spherePlane( si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; + sphereSphere(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; + sphereTrimesh(sphereShape: Shape, trimeshShape: Shape, spherePos: Vec3, trimeshPos: Vec3, sphereQuat: Quaternion, trimeshQuat: Quaternion, sphereBody: Body, trimeshBody: Body): void; + + } + + export interface IOctreeOptions { + + root: Octree; + aabb: AABB; + + } + + export class OctreeNode { + + aabb: AABB; + children: Octree[]; + data: number[]; + root: OctreeNode; + + } + + export class Octree extends OctreeNode { + + maxDepth: number; + + constructor(aabb: AABB, options: IOctreeOptions); + + aabbQuery(aabb: AABB, result: Object[]): Object[]; + insert(aabb: AABB, elementData: Object): boolean; + rayQuery(ray: Ray, treeTransform: Transform, result: Object[]): Object[]; + removeEmptyNodes(): void; + subdivide(): void; + + } + + export interface IWorld { + + collisisonFilterMask?: number; + collisionFilterGroup?: number; + skipBackfaces?: boolean; + checkCollisionResponse?: boolean; + } export class World extends EventTarget { @@ -949,7 +1140,7 @@ declare module CANNON { collisionMatrix: ArrayCollisionMatrix; collisionMatrixPrevious: ArrayCollisionMatrix; materials: Material[]; - contactmaterials: ContactMaterial[]; + contactMaterials: ContactMaterial[]; contactMaterialTable: TupleDictionary; defaultMaterial: Material; defaultContactMaterial: ContactMaterial; @@ -965,16 +1156,23 @@ declare module CANNON { addBodyEvent: IBodyEvent; removeBodyEvent: IBodyEvent; - getContactMaterial(m1: Material, m2: Material): ContactMaterial; - numObjects(): number; - collisionMatrixTick(): void; addBody(body: Body): void; addConstraint(c: Constraint): void; - removeConstraint(c: Constraint): void; + addContactMaterial(cmat: ContactMaterial): void; + addEventListener(type: string, listener: Function): EventTarget; + addMaterial(m: Material): void; + clearForces(): void; + collisionMatrixTick(): void; + getContactMaterial(m1: Material, m2: Material): ContactMaterial; + numObjects(): number; + raycastAll(from: Vec3, to: Vec3, options: IWorld, callback: Function): boolean; + raycastAny(from: Vec3, to: Vec3, options: IWorld, result: RaycastResult): boolean; + raycastClosest(from: Vec3, to: Vec3, options: IWorld, result: RaycastResult): boolean; rayTest(from: Vec3, to: Vec3, result: RaycastResult): void; remove(body: Body): void; - addMaterial(m: Material): void; - addContactMaterial(cmat: ContactMaterial): void; + removeBody(body: Body): void; + removeConstraint(c: Constraint): void; + removeEventListener(type: string, listener: Function): EventTarget; step(dy: number, timeSinceLastCalled?: number, maxSubSteps?: number): void; } @@ -991,6 +1189,15 @@ declare module CANNON { } + export class Demo { + + constructor( options: Object ); + + addScene( title: string, initfunc: Function ): void; + restartCurrentScene(): void; + + } + } declare module "cannon" { diff --git a/cannon/tslint.json b/cannon/tslint.json deleted file mode 100644 index 2221e40e4a..0000000000 --- a/cannon/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "../tslint.json" } \ No newline at end of file From 50a4e099ba707bf937aa3bb361110a7deaf12d10 Mon Sep 17 00:00:00 2001 From: Jephir Date: Sat, 21 Jan 2017 21:09:51 -0500 Subject: [PATCH 042/140] Allow keySeperator, nsSeperator = false (2.1.0) https://github.com/i18next/i18next/blob/master/CHANGELOG.md#210 --- i18next/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i18next/index.d.ts b/i18next/index.d.ts index b0cb04b267..958bff12a6 100644 --- a/i18next/index.d.ts +++ b/i18next/index.d.ts @@ -63,8 +63,8 @@ declare namespace i18n { lowerCaseLng?: boolean; load?: string preload?: string[]; - keySeparator?: string; - nsSeparator?: string; + keySeparator?: string | false; + nsSeparator?: string | false; pluralSeparator?: string; contextSeparator?: string; saveMissing?: boolean; From 1652209bad56af434c6e9074955002d2cb2bf4b0 Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Sun, 22 Jan 2017 21:00:24 -0500 Subject: [PATCH 043/140] Add missing configuration options & tests to angular-bootstrap-ui --- .../angular-ui-bootstrap-tests.ts | 25 ++++- angular-ui-bootstrap/index.d.ts | 95 +++++++++++++++++++ 2 files changed, 118 insertions(+), 2 deletions(-) diff --git a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts index 16eaff3b39..b14af506b6 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts @@ -7,6 +7,7 @@ testApp.config(( $buttonConfig: ng.ui.bootstrap.IButtonConfig, $datepickerConfig: ng.ui.bootstrap.IDatepickerConfig, $datepickerPopupConfig: ng.ui.bootstrap.IDatepickerPopupConfig, + $dropdownConfig: ng.ui.bootstrap.IDropdownConfig, $modalProvider: ng.ui.bootstrap.IModalProvider, $paginationConfig: ng.ui.bootstrap.IPaginationConfig, $pagerConfig: ng.ui.bootstrap.IPagerConfig, @@ -47,13 +48,18 @@ testApp.config(( $datepickerConfig.showWeeks = false; $datepickerConfig.startingDay = 1; $datepickerConfig.yearRange = 10; - - + $datepickerConfig.monthColumns = 3; + $datepickerConfig.yearColumns = 9; + $datepickerConfig.yearRows = 6; + $datepickerConfig.ngModelOptions.allowInvalid = false; + $datepickerConfig.ngModelOptions.timezone = "EST"; + $datepickerConfig.ngModelOptions.updateOn = "click"; /** * $datepickerPopupConfig tests */ + $datepickerPopupConfig.altInputFormats = ["mm/dd/YYYY", "mm-dd-YY"]; $datepickerPopupConfig.appendToBody = true; $datepickerPopupConfig.currentText = 'Select Today'; $datepickerPopupConfig.clearText = 'Reset Selection'; @@ -63,8 +69,18 @@ testApp.config(( $datepickerPopupConfig.datepickerPopupTemplateUrl = 'template.html'; $datepickerPopupConfig.datepickerTemplateUrl = 'template.html'; $datepickerPopupConfig.html5Types.date = 'MM-dd-yyyy'; + $datepickerPopupConfig.html5Types['datetime-local'] = 'yyyy-MM-ddTHH:mm:ss.sss'; + $datepickerPopupConfig.html5Types.month = 'yyyy-MM'; $datepickerPopupConfig.onOpenFocus = false; $datepickerPopupConfig.showButtonBar = false; + $datepickerPopupConfig.placement = "auto bottom left"; + + + /** + * $dropdownConfig tests + */ + $dropdownConfig.appendToOpenClass = "some-thing"; + $dropdownConfig.openClass = "show"; /** @@ -77,6 +93,7 @@ testApp.config(( * $paginationConfig tests */ $paginationConfig.boundaryLinks = true; + $paginationConfig.boundaryLinkNumbers = true; $paginationConfig.directionLinks = false; $paginationConfig.firstText = 'First Page'; $paginationConfig.itemsPerPage = 25; @@ -88,6 +105,7 @@ testApp.config(( $paginationConfig.rotate = false; $paginationConfig.templateUrl = 'template.html'; $paginationConfig.totalItems = 13; + $paginationConfig.forceEllipses = true; /** @@ -121,11 +139,14 @@ testApp.config(( $timepickerConfig.hourStep = 2; $timepickerConfig.meridians = ['-AM-', '-PM-']; $timepickerConfig.minuteStep = 5; + $timepickerConfig.secondStep = 5; $timepickerConfig.mousewheel = false; $timepickerConfig.readonlyInput = true; $timepickerConfig.showMeridian = false; $timepickerConfig.arrowkeys = false; $timepickerConfig.showSpinners = false; + $timepickerConfig.showSeconds = true; + $timepickerConfig.templateUrl = "template.html"; /** * $tooltipProvider tests diff --git a/angular-ui-bootstrap/index.d.ts b/angular-ui-bootstrap/index.d.ts index 73043c4e7a..b5b4e1a5e6 100644 --- a/angular-ui-bootstrap/index.d.ts +++ b/angular-ui-bootstrap/index.d.ts @@ -11,6 +11,7 @@ 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 IDropdownConfig = angular.ui.bootstrap.IDropdownConfig; export type IModalProvider = angular.ui.bootstrap.IModalProvider; export type IModalService = angular.ui.bootstrap.IModalService; export type IModalServiceInstance = angular.ui.bootstrap.IModalServiceInstance; @@ -54,6 +55,11 @@ declare module 'angular' { toggleEvent?: string; } + interface IDropdownConfigNgOptions extends angular.INgModelOptions { + allowInvalid?: boolean; + timezone?: string; + } + interface IDatepickerConfig { /** * Format of day in month. @@ -166,9 +172,45 @@ declare module 'angular' { * @default false */ shortcutPropagation?: boolean; + + /** + * The number of columns displayed in month selection. + * + * @default 3 + */ + monthColumns?: number; + + /** + * The number of columns displayed in year selection. + * + * @default 5 + */ + yearColumns?: number; + + /** + * The number of rows displayed in year selection + * + * @default 4 + */ + yearRows?: number; + + /** + * All supported angular ngModelOptions plus some + * + * @default {} + */ + ngModelOptions?: IDropdownConfigNgOptions } interface IDatepickerPopupConfig { + + /** + * A list of alternate formats acceptable for manual entry. + * + * @default [] + */ + altInputFormats?: string[]; + /** * The format for displayed dates. * @@ -247,8 +289,26 @@ declare module 'angular' { * @default true */ onOpenFocus?: boolean; + + /** + * Passing in 'auto' separated by a space before the placement will enable auto positioning, e.g: "auto bottom-left". The popup will attempt to position where it fits in the closest scrollable ancestor. + * + * @default 'auto bottom-left' + */ + placement?: string; } + interface IDropdownConfig { + /** + * @default: 'uib-dropdown-open' + */ + appendToOpenClass?: string; + + /** + * @default: 'open' + */ + openClass?: string; + } interface IModalProvider { /** @@ -543,6 +603,13 @@ declare module 'angular' { */ boundaryLinks?: boolean; + /** + * Whether to always display the first and last page numbers. If max-size is smaller than the number of pages, then the first and last page numbers are still shown with ellipses in-between as necessary. NOTE: max-size refers to the center of the range. This option may add up to 2 more numbers on each side of the displayed range for the end value and what would be an ellipsis but is replaced by a number because it is sequential. + * + * @default false + */ + boundaryLinkNumbers?: boolean; + /** * Text for First button. * @@ -563,6 +630,13 @@ declare module 'angular' { * @default 'template/pagination/pagination.html' */ templateUrl?: string; + + /** + * Also displays ellipses when rotate is true and max-size is smaller than the number of pages. + * + * @default false + */ + forceEllipses?: boolean; } interface IPagerConfig { @@ -679,6 +753,13 @@ declare module 'angular' { */ minuteStep?: number; + /** + * Number of seconds to increase or decrease when using a button. + * + * @default 1 + */ + secondStep?: number; + /** * Whether to display 12H or 24H mode. * @@ -720,6 +801,20 @@ declare module 'angular' { * @default true */ showSpinners?: boolean; + + /** + * Show seconds input. + * + * @default false + */ + showSeconds?: boolean; + + /** + * Add the ability to override the template used on the component. + * + * @default 'uib/template/timepicker/timepicker.html' + */ + templateUrl?: string; } From 02c09ed9d8eefd5cb56c9a02b3c111821a121790 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Mon, 23 Jan 2017 02:19:26 +0000 Subject: [PATCH 044/140] webpack: add missing uglifyjs plugin typings (#14177) --- webpack/index.d.ts | 13 ++++++++++++- webpack/webpack-tests.ts | 13 +++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/webpack/index.d.ts b/webpack/index.d.ts index 1ef2fa168f..73f575c973 100644 --- a/webpack/index.d.ts +++ b/webpack/index.d.ts @@ -472,6 +472,17 @@ declare namespace webpack { apply(thisArg: Webpack, ...args: any[]): void; } + type UglifyCommentFunction = (astNode: any, comment: any) => boolean + + interface UglifyPluginOptions extends UglifyJS.MinifyOptions { + beautify?: boolean; + comments?: boolean | RegExp | UglifyCommentFunction; + sourceMap?: boolean; + test?: Condition | Condition[]; + include?: Condition | Condition[]; + exclude?: Condition | Condition[]; + } + interface Webpack { (config: Configuration, callback?: compiler.CompilerCallback): compiler.Compiler; /** @@ -1020,7 +1031,7 @@ declare namespace webpack { new (preferEntry: boolean): Plugin; } interface UglifyJsPluginStatic { - new (options?: UglifyJS.MinifyOptions): Plugin; + new (options?: UglifyPluginOptions): Plugin; } interface CommonsChunkPluginStatic { new (chunkName: string, filenames?: string | string[]): Plugin; diff --git a/webpack/webpack-tests.ts b/webpack/webpack-tests.ts index 086592b4de..8af08751ed 100644 --- a/webpack/webpack-tests.ts +++ b/webpack/webpack-tests.ts @@ -288,11 +288,24 @@ plugin = new webpack.optimize.UglifyJsPlugin({ warnings: false } }); +plugin = new webpack.optimize.UglifyJsPlugin({ + sourceMap: false, + comments: true, + beautify: true, + test: 'foo', + exclude: /node_modules/, + include: 'test' +}); plugin = new webpack.optimize.UglifyJsPlugin({ mangle: { except: ['$super', '$', 'exports', 'require'] } }); +plugin = new webpack.optimize.UglifyJsPlugin({ + comments: function(astNode: any, comment: any) { + return false; + } +}); plugin = new webpack.optimize.CommonsChunkPlugin(options); plugin = new CommonsChunkPlugin({ name: "commons", From 7a2803e589595426d80c92df28b01b0c01d8bd58 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Mon, 23 Jan 2017 03:20:03 +0100 Subject: [PATCH 045/140] [mathjs] add missing cosine declarations (#14174) --- mathjs/index.d.ts | 12 +++++++++++- mathjs/mathjs-tests.ts | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mathjs/index.d.ts b/mathjs/index.d.ts index d11a72d97b..bf20869909 100644 --- a/mathjs/index.d.ts +++ b/mathjs/index.d.ts @@ -1036,7 +1036,7 @@ declare namespace mathjs { asech(x: MathArray): MathArray; asech(x: Matrix): Matrix; - /** + /** * Calculate the inverse sine of a value. For matrices, the function is evaluated element wise. */ asin(x: number): number; @@ -1163,6 +1163,16 @@ declare namespace mathjs { sin(x: MathArray): MathArray; sin(x: Matrix): Matrix; + /** + * Calculate the cosine of a value. For matrices, the function is evaluated element wise. + */ + cos(x: number): number; + cos(x: BigNumber): BigNumber; + cos(x: Complex): Complex; + cos(x: Unit): number; + cos(x: MathArray): MathArray; + cos(x: Matrix): Matrix; + /** * Calculate the hyperbolic sine of a value, defined as sinh(x) = 1/2 * (exp(x) - exp(-x)). For matrices, the function is evaluated element wise. */ diff --git a/mathjs/mathjs-tests.ts b/mathjs/mathjs-tests.ts index c174ca1c95..3d4d87d72a 100644 --- a/mathjs/mathjs-tests.ts +++ b/mathjs/mathjs-tests.ts @@ -11,6 +11,8 @@ Basic usage examples math.log(10000, 10); // 4 math.sqrt(-4); // 2i math.pow([[-1, 2], [3, 1]], 2); // [[7, 0], [0, 7]] + var angle = 0.2; + math.add(math.pow(math.sin(angle), 2), math.pow(math.cos(angle), 2)); // returns number ~1 // expressions math.eval('1.2 * (2 + 4.5)'); // 7.8 From 0e3020531c0938d73bbd40f8f5d2fc4711ab8b27 Mon Sep 17 00:00:00 2001 From: Eldin Date: Mon, 23 Jan 2017 03:20:58 +0100 Subject: [PATCH 046/140] Update index.d.tx (#14175) Remove duplicate interface for "PerMessageDeflateOptions" --- ws/index.d.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ws/index.d.ts b/ws/index.d.ts index 733f11f608..172372d286 100644 --- a/ws/index.d.ts +++ b/ws/index.d.ts @@ -107,14 +107,6 @@ declare namespace WebSocket { memLevel?: number; } - export interface IPerMessageDeflateOptions { - serverNoContextTakeover?: boolean; - clientNoContextTakeover?: boolean; - serverMaxWindowBits?: number; - clientMaxWindowBits?: number; - memLevel?: number; - } - export interface IServerOptions { host?: string; port?: number; From db3dfdb4b4be1ea0d1481b54226d01f8b6e9e7c6 Mon Sep 17 00:00:00 2001 From: yohei1126 Date: Mon, 23 Jan 2017 14:02:26 +0900 Subject: [PATCH 047/140] mqtt: add getLastMessageId function to mqtt.Client --- mqtt/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mqtt/index.d.ts b/mqtt/index.d.ts index 256c0a5394..62e622e81d 100644 --- a/mqtt/index.d.ts +++ b/mqtt/index.d.ts @@ -235,6 +235,10 @@ declare namespace mqtt { */ handleMessage(packet: Packet, callback: Function): Client; + /** + * get last message id. This is for sent messages only. + */ + getLastMessageId(): number } /** From 0b89ca3e31eaa9cdf08d210a57e240dd950a56ca Mon Sep 17 00:00:00 2001 From: durad Date: Sun, 22 Jan 2017 21:10:12 -0800 Subject: [PATCH 048/140] Changed definition of lorem-ipsum to allow ES6 style imports (#14166) * Implemented match, isMath and find * Added all functions * Made options optional. * Added tslint.json and fixed lint errors * Fixed definition for mapping function * Fixed issue with strict nulls * Added definition for lorem-ipsum * Added namespace to lorem-ipsum to allow ES6 style imports --- lorem-ipsum/index.d.ts | 2 ++ lorem-ipsum/lorem-ipsum-tests.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lorem-ipsum/index.d.ts b/lorem-ipsum/index.d.ts index 825136f207..0a2210c0d8 100644 --- a/lorem-ipsum/index.d.ts +++ b/lorem-ipsum/index.d.ts @@ -55,6 +55,8 @@ interface LoremIpsumOptions { suffix?: string; } +declare namespace loremIpsum {} + /** * Generate a passage of lorem ipsum text. */ diff --git a/lorem-ipsum/lorem-ipsum-tests.ts b/lorem-ipsum/lorem-ipsum-tests.ts index dd5eb82ba6..697c222257 100644 --- a/lorem-ipsum/lorem-ipsum-tests.ts +++ b/lorem-ipsum/lorem-ipsum-tests.ts @@ -1,4 +1,4 @@ -import loremIpsum = require('lorem-ipsum'); +import * as loremIpsum from 'lorem-ipsum'; let result: string; result = loremIpsum(); From 5b9724a3734c5fa08c1a18c2233cd6d1ca915abd Mon Sep 17 00:00:00 2001 From: Linda_pp Date: Mon, 23 Jan 2017 14:11:34 +0900 Subject: [PATCH 049/140] node: strict platform value (#14134) * node: strict platform value From: https://nodejs.org/api/os.html#os_os_platform > Currently possible values are: > > - 'aix' > - 'darwin' > - 'freebsd' > - 'linux' > - 'openbsd' > - 'sunos' > - 'win32' > > Equivalent to process.platform. * node: add missing 'android' to platforms * node: improve platform strings also in v7 --- node/index.d.ts | 13 +++++++++++-- node/node-tests.ts | 1 - node/v6/index.d.ts | 13 +++++++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/node/index.d.ts b/node/index.d.ts index 1f32030db7..32d3f5a203 100644 --- a/node/index.d.ts +++ b/node/index.d.ts @@ -347,6 +347,15 @@ declare namespace NodeJS { openssl: string; } + type Platform = 'aix' + | 'android' + | 'darwin' + | 'freebsd' + | 'linux' + | 'openbsd' + | 'sunos' + | 'win32'; + export interface Process extends EventEmitter { stdout: WritableStream; stderr: WritableStream; @@ -399,7 +408,7 @@ declare namespace NodeJS { pid: number; title: string; arch: string; - platform: string; + platform: Platform; mainModule?: NodeModule; memoryUsage(): MemoryUsage; cpuUsage(previousValue?: CpuUsage): CpuUsage; @@ -1311,7 +1320,7 @@ declare module "os" { }, }; export function arch(): string; - export function platform(): string; + export function platform(): NodeJS.Platform; export function tmpdir(): string; export var EOL: string; export function endianness(): "BE" | "LE"; diff --git a/node/node-tests.ts b/node/node-tests.ts index adcadb1a60..2844ca8e6e 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -1481,7 +1481,6 @@ namespace os_tests { result = os.endianness(); result = os.hostname(); result = os.type(); - result = os.platform(); result = os.arch(); result = os.release(); result = os.EOL; diff --git a/node/v6/index.d.ts b/node/v6/index.d.ts index ba3a7685fc..ed07d1cad1 100644 --- a/node/v6/index.d.ts +++ b/node/v6/index.d.ts @@ -347,6 +347,15 @@ declare namespace NodeJS { openssl: string; } + type Platform = 'aix' + | 'android' + | 'darwin' + | 'freebsd' + | 'linux' + | 'openbsd' + | 'sunos' + | 'win32'; + export interface Process extends EventEmitter { stdout: WritableStream; stderr: WritableStream; @@ -399,7 +408,7 @@ declare namespace NodeJS { pid: number; title: string; arch: string; - platform: string; + platform: Platform; mainModule?: NodeModule; memoryUsage(): MemoryUsage; cpuUsage(previousValue?: CpuUsage): CpuUsage; @@ -1262,7 +1271,7 @@ declare module "os" { }, }; export function arch(): string; - export function platform(): string; + export function platform(): NodeJS.Platform; export function tmpdir(): string; export var EOL: string; export function endianness(): "BE" | "LE"; From 5f59aa79209b1ca757d0168663daa5cb9af8e67a Mon Sep 17 00:00:00 2001 From: yohei1126 Date: Mon, 23 Jan 2017 14:39:29 +0900 Subject: [PATCH 050/140] add semicolon --- mqtt/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mqtt/index.d.ts b/mqtt/index.d.ts index 62e622e81d..f52aede457 100644 --- a/mqtt/index.d.ts +++ b/mqtt/index.d.ts @@ -238,7 +238,7 @@ declare namespace mqtt { /** * get last message id. This is for sent messages only. */ - getLastMessageId(): number + getLastMessageId(): number; } /** From 392b91f8d5375288f0041d1b6b2c01566c1eae1c Mon Sep 17 00:00:00 2001 From: keika299 Date: Mon, 23 Jan 2017 16:50:02 +0900 Subject: [PATCH 051/140] add autosize method --- autosize/autosize-tests.ts | 18 ++++++++++++++++++ autosize/index.d.ts | 6 +++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/autosize/autosize-tests.ts b/autosize/autosize-tests.ts index 74be703a94..a7eea57a62 100644 --- a/autosize/autosize-tests.ts +++ b/autosize/autosize-tests.ts @@ -8,3 +8,21 @@ autosize(document.querySelector('textarea')); // from a single element autosize(document.getElementById('my-textarea')); + +// update a NodeList +autosize.update(document.querySelectorAll('textarea')); + +// update a single Node +autosize.update(document.querySelector('textarea')); + +// update a single element +autosize.update(document.getElementById('my-textarea')); + +// destroy a NodeList +autosize.destroy(document.querySelectorAll('textarea')); + +// destroy a single Node +autosize.destroy(document.querySelector('textarea')); + +// destroy a single element +autosize.destroy(document.getElementById('my-textarea')); diff --git a/autosize/index.d.ts b/autosize/index.d.ts index 5ea76d0472..0886904e3f 100644 --- a/autosize/index.d.ts +++ b/autosize/index.d.ts @@ -1,12 +1,16 @@ // Type definitions for jquery.autosize 3.0.7 // Project: http://www.jacklmoore.com/autosize/ -// Definitions by: Aaron T. King +// Definitions by: Aaron T. King , keika299 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace autosize { interface AutosizeStatic { (el: Element): void; (el: NodeList): void; + update(el: Element): void; + update(el: NodeList): void; + destroy(el: Element): void; + destroy(el: NodeList): void; } } From 52ad6adaa2a6dd74c168164c178fe33dd63f21e7 Mon Sep 17 00:00:00 2001 From: Robin maenhaut Date: Mon, 23 Jan 2017 09:05:49 +0100 Subject: [PATCH 052/140] Add support for custom style object in the PNotifyOptions --- jquery.pnotify/index.d.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/jquery.pnotify/index.d.ts b/jquery.pnotify/index.d.ts index 668590e4d6..c0ab267b7d 100644 --- a/jquery.pnotify/index.d.ts +++ b/jquery.pnotify/index.d.ts @@ -6,7 +6,7 @@ /// type NoticeTypeOptions = "notice" | "info" | "success" | "error"; -type StylingOptions = "brighttheme" | "jqueryui" | "bootstrap2" | "bootstrap3" | "fontawesome"; +type StylingOptions = "brighttheme" | "jqueryui" | "bootstrap2" | "bootstrap3" | "fontawesome" | PNotifyStyling; type StateOptions = "initializing" | "opening" | "open" | "closing" | "closed"; interface PNotifyStack { @@ -134,7 +134,7 @@ interface PNotifyOptions { */ text_escape?: boolean; /** - * What styling classes to use. (Can be either "brighttheme", "jqueryui", "bootstrap2", "bootstrap3", or "fontawesome".) + * What styling classes to use. (Can be either "brighttheme", "jqueryui", "bootstrap2", "bootstrap3", "fontawesome" or a custom style object) */ styling?: StylingOptions; /** @@ -257,6 +257,18 @@ interface PNotifyOptions { labels?: PNotifyLabel; } +interface PNotifyStyling { + container?: string, + notice?: string, + notice_icon?: string, + info?: string, + info_icon?: string, + success?: string, + success_icon?: string, + error?: string, + error_icon?: string +} + interface PNotify { /** From ad57871fe05c3a46e172a702e91b7ff20a143778 Mon Sep 17 00:00:00 2001 From: Robin maenhaut Date: Mon, 23 Jan 2017 09:33:21 +0100 Subject: [PATCH 053/140] Include pnotify.buttons styling extensions --- jquery.pnotify/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jquery.pnotify/index.d.ts b/jquery.pnotify/index.d.ts index c0ab267b7d..f15150ad20 100644 --- a/jquery.pnotify/index.d.ts +++ b/jquery.pnotify/index.d.ts @@ -266,7 +266,10 @@ interface PNotifyStyling { success?: string, success_icon?: string, error?: string, - error_icon?: string + error_icon?: string, + closer?: string, + pin_down?: string, + pin_up?: string } interface PNotify { From 4ff4f8d4fc9d5266ffbea44bc12391eefbb39695 Mon Sep 17 00:00:00 2001 From: Robin maenhaut Date: Mon, 23 Jan 2017 09:37:27 +0100 Subject: [PATCH 054/140] Add styling extensions for confirm, history and reference --- jquery.pnotify/index.d.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/jquery.pnotify/index.d.ts b/jquery.pnotify/index.d.ts index f15150ad20..7600c45a09 100644 --- a/jquery.pnotify/index.d.ts +++ b/jquery.pnotify/index.d.ts @@ -267,9 +267,24 @@ interface PNotifyStyling { success_icon?: string, error?: string, error_icon?: string, + // buttons closer?: string, pin_down?: string, - pin_up?: string + pin_up?: string, + // confirm + btn?: string, + btnhover?: string, + btnactive?: string, + btnfocus?: string, + input?: string, + text?: string, + // history + hi_menu?: string, + hi_btn?: string, + hi_btnhov?: string, + hi_hnd?: string, + // reference + athing?: string } interface PNotify { From 42636ca79f11b05f15bc5e5ceeb15d9ff2cea083 Mon Sep 17 00:00:00 2001 From: Robin maenhaut Date: Mon, 23 Jan 2017 09:51:05 +0100 Subject: [PATCH 055/140] Add test for the new styling object --- jquery.pnotify/index.d.ts | 2 +- jquery.pnotify/jquery.pnotify-tests.ts | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/jquery.pnotify/index.d.ts b/jquery.pnotify/index.d.ts index 7600c45a09..1d222efb26 100644 --- a/jquery.pnotify/index.d.ts +++ b/jquery.pnotify/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for jquery.pnotify 3.x // Project: https://github.com/sciactive/pnotify -// Definitions by: David Sichau +// Definitions by: David Sichau , Robin Maenhaut // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/jquery.pnotify/jquery.pnotify-tests.ts b/jquery.pnotify/jquery.pnotify-tests.ts index c9465e0444..41cd7d3fda 100644 --- a/jquery.pnotify/jquery.pnotify-tests.ts +++ b/jquery.pnotify/jquery.pnotify-tests.ts @@ -243,5 +243,24 @@ function test_pnotify() { animation: 'show' }); + new PNotify({ + title: 'Custom styling', + text: 'Test all custom styling properties', + styling: { + container: "alert", + notice: "alert-warning", + notice_icon: "fa fa-exclamation-circle", + info: "alert-info", + info_icon: "fa fa-info", + success: "alert-success", + success_icon: "fa fa-check", + error: "alert-danger", + error_icon: "fa fa-warning", + closer: "fa fa-times", + pin_up: "fa fa-pause", + pin_down: "fa fa-play" + } + }); + PNotify.removeAll(); } From d2be90a50693461d0e2e4dd20c3d578533a779db Mon Sep 17 00:00:00 2001 From: mkollers Date: Mon, 23 Jan 2017 10:26:59 +0100 Subject: [PATCH 056/140] added group to Node http://visjs.org/docs/network/nodes.html# --- vis/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/vis/index.d.ts b/vis/index.d.ts index 92b6ea6a08..3ee00ba03a 100644 --- a/vis/index.d.ts +++ b/vis/index.d.ts @@ -1497,6 +1497,7 @@ export interface Data { } export interface Node { + group?: string; id?: IdType; label?: string; x?: number; From 55eadf06bdcb997c6a2259de54670fd0480c073f Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Mon, 23 Jan 2017 19:15:04 +0800 Subject: [PATCH 057/140] fix cannon dts --- cannon/index.d.ts | 383 +++++++++++----------------------------------- 1 file changed, 89 insertions(+), 294 deletions(-) diff --git a/cannon/index.d.ts b/cannon/index.d.ts index 7df6671d52..6551e07b32 100644 --- a/cannon/index.d.ts +++ b/cannon/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Clark Stevenson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + declare module CANNON { export interface IAABBOptions { @@ -19,14 +20,11 @@ declare module CANNON { constructor(options?: IAABBOptions); - clone() : AABB; setFromPoints(points: Vec3[], position?: Vec3, quaternion?: Quaternion, skinSize?: number): void; copy(aabb: AABB): void; extend(aabb: AABB): void; - getCorners( a: Vec3, b: Vec3, c: Vec3, d: Vec3, e: Vec3, f: Vec3, g: Vec3, h: Vec3 ) : void; overlaps(aabb: AABB): boolean; - toLocalFrame( frame: Transform, target: AABB ) : AABB; - toWorldFrame( frame: Transform, target: AABB ) : AABB; + } export class ArrayCollisionMatrix { @@ -40,7 +38,7 @@ declare module CANNON { } - export class Broadphase { + export class BroadPhase { world: World; useBoundingBoxes: boolean; @@ -58,7 +56,7 @@ declare module CANNON { } - export class GridBroadphase extends Broadphase { + export class GridBroadphase extends BroadPhase { nx: number; ny: number; @@ -71,7 +69,7 @@ declare module CANNON { } - export class NaiveBroadphase extends Broadphase { + export class NaiveBroadphase extends BroadPhase { } export class ObjectCollisionMatrix { @@ -85,42 +83,16 @@ declare module CANNON { } - export interface IRayIntersectWorldOptions { - - mode: number; - result: boolean; - skipBackfaces: boolean; - collisionFilterMask: number; - collisionFilterGroup: number; - from: Vec3; - to: Vec3; - callback: Function; - - } - export class Ray { - static CLOSEST: number; - static ANY: number; - static ALL: number; - from: Vec3; to: Vec3; precision: number; checkCollisionResponse: boolean; - callback: Function; - collisionFilterGroup: number; - collisionFilterMask: number; - hasHit: boolean; - mode: number; - result: RaycastResult; - skipBackfaces: boolean; constructor(from?: Vec3, to?: Vec3); getAABB(result: RaycastResult): void; - intersectBodies(bodies: Body[], result?: RaycastResult): void; - intersectWorld(world: World, options: IRayIntersectWorldOptions): boolean; } @@ -130,19 +102,17 @@ declare module CANNON { rayToWorld: Vec3; hitNormalWorld: Vec3; hitPointWorld: Vec3; - hitFaceIndex: number; hasHit: boolean; shape: Shape; body: Body; distance: number; - abort(): void; reset(): void; set(rayFromWorld: Vec3, rayToWorld: Vec3, hitNormalWorld: Vec3, hitPointWorld: Vec3, shape: Shape, body: Body, distance: number): void; } - export class SAPBroadphase extends Broadphase { + export class SAPBroadphase extends BroadPhase { static insertionSortX(a: any[]): any[]; static insertionSortY(a: any[]): any[]; @@ -178,17 +148,12 @@ declare module CANNON { constructor(bodyA: Body, bodyB: Body, options?: IConstraintOptions); update(): void; - disable(): void; - enable(): void; } export class DistanceConstraint extends Constraint { - distance: number; - distanceEquation: ContactEquation; - - constructor(bodyA: Body, bodyB: Body, distance?: number, maxForce?: number); + constructor(bodyA: Body, bodyB: Body, distance: number, maxForce?: number); } @@ -204,10 +169,6 @@ declare module CANNON { export class HingeConstraint extends Constraint { - axisA: Vec3; - axisB: Vec3; - rotationalEquation1: RotationalEquation; - rotationalEquation2: RotationalEquation; motorEnabled: boolean; motorTargetVelocity: number; motorMinForce: number; @@ -218,41 +179,21 @@ declare module CANNON { enableMotor(): void; disableMotor(): void; - setMotorMaxForce(maxForce: number): void; - setMotorSpeed(speed: number): void; } export class PointToPointConstraint extends Constraint { - equationX: ContactEquation; - equationY: ContactEquation; - equationZ: ContactEquation; - pivotA: Vec3; - pivotB: Vec3; - constructor(bodyA: Body, pivotA: Vec3, bodyB: Body, pivotB: Vec3, maxForce?: number); } - export class ConeTwistConstraint extends PointToPointConstraint { - - coneEquation: ConeEquation; - twistEquation: RotationalEquation; - - constructor(bodyA: Body, bodyB: Body, options?: IHingeConstraintOptions); + export class LockConstraint extends Constraint { + constructor(bodyA: Body, bodyB: Body, options?:any); } - export class LockConstraint extends PointToPointConstraint { - rotationalEquation1: RotationalEquation; - rotationalEquation2: RotationalEquation; - rotationalEquation3: RotationalEquation; - - constructor(bodyA: Body, bodyB: Body, maxForce?: number); - - } export class Equation { @@ -279,7 +220,7 @@ declare module CANNON { computeGiMGt(): number; addToWlamda(deltalambda: number): number; computeC(): number; - computeInvC( eps: number ): number; + } export class FrictionEquation extends Equation { @@ -288,14 +229,6 @@ declare module CANNON { } - export interface IRotationalEquationOptions { - - axisA?: Vec3; - axisB?: Vec3; - maxForce?: number; - - } - export class RotationalEquation extends Equation { ni: Vec3; @@ -307,7 +240,7 @@ declare module CANNON { relVel: Vec3; relForce: Vec3; - constructor(bodyA: Body, bodyB: Body, options?: IRotationalEquationOptions); + constructor(bodyA: Body, bodyB: Body); } @@ -323,33 +256,22 @@ declare module CANNON { } - export interface IConeEquationOptions { - - axisA?: Vec3; - axisB?: Vec3; - maxForce?: number; - - } - - export class ConeEquation extends Equation { - - angle: number; - - constructor(bodyA: Body, bodyB: Body, options?: IConeEquationOptions); - - } - export class ContactEquation extends Equation { restitution: number; ri: Vec3; rj: Vec3; + penetrationVec: Vec3; ni: Vec3; + rixn: Vec3; + rjxn: Vec3; + invIi: Mat3; + invIj: Mat3; + biInvInertiaTimesRixn: Vec3; + bjInvInertiaTimesRjxn: Vec3; constructor(bi: Body, bj: Body); - getImpactVelocityAlongNormal(): number; - } export interface IContactMaterialOptions { @@ -380,12 +302,12 @@ declare module CANNON { export class Material { - id: number; name: string; - friction: number; - restitution: number; + id: number; + friction:number; + restitution:number; - constructor(name?: string); + constructor(name: string); } @@ -401,8 +323,6 @@ declare module CANNON { export class Mat3 { - elements: number[]; - constructor(elements?: number[]); identity(): void; @@ -423,38 +343,6 @@ declare module CANNON { } - export class Trimesh extends Shape { - - aabb: AABB; - edges: number[]; - indices: number[]; - normals: number[]; - scale: Vec3; - tree: Octree; - vertices: number[]; - - static computeNormal(va: Vec3, vb: Vec3, vc: Vec3, target: Vec3): void; - static createTorus(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number): Trimesh; - - constructor(vertices: number[], indices: number[]); - - calculateWorldAABB(pos: Vec3, quat: Quaternion, min: Vec3, max: Vec3): void; - computeLocalAABB(aabb: AABB): void; - getEdgeVector(edgeIndex: number, vectorStore: Vec3): void; - getEdgeVertex(edgeIndex: number, firstOrSecond: number, vertexStore: Vec3): void; - getNormal(i: number, target: Vec3): Vec3; - getTrianglesAABB(aabb: AABB, result: number[]): void; - getTriangleVertices(i: number, a: Vec3, b: Vec3, c: Vec3): void; - getVertex(i: number, out: Vec3): Vec3; - getWorldVertex(i: number, pos: Vec3, quat: Quaternion, out: Vec3): Vec3; - setScale(scale: Vec3): void; - updateAABB(): void; - updateEdges(): void; - updateNormals(): void; - updateTree(): void; - - } - export class Quaternion { x: number; @@ -487,23 +375,18 @@ declare module CANNON { static pointToLocalFrame(position: Vec3, quaternion: Quaternion, worldPoint: Vec3, result?: Vec3): Vec3; static pointToWorldFrame(position: Vec3, quaternion: Quaternion, localPoint: Vec3, result?: Vec3): Vec3; - static vectorToWorldFrame(quaternion: Quaternion, localVector: Vec3, result: Vec3): Vec3; - static vectorToLocalFrame(position: Vec3, quaternion: Quaternion, worldVector: Vec3, result?: Vec3): Vec3; position: Vec3; quaternion: Quaternion; - pointToLocal(point: Vec3, result: Vec3): Vec3; - pointToWorld(point: Vec3, result: Vec3): Vec3; + vectorToWorldFrame(localVector: Vec3, result?: Vec3): Vec3; + vectorToLocalFrame(position: Vec3, quaternion: Quaternion, worldVector: Vec3, result?: Vec3): Vec3; } export class Vec3 { static ZERO: Vec3; - static UNIT_X: Vec3; - static UNIT_Y: Vec3; - static UNIT_Z: Vec3; x: number; y: number; @@ -522,7 +405,6 @@ declare module CANNON { norm(): number; norm2(): number; distanceTo(p: Vec3): number; - distanceSquared(p: Vec3): number; mult(scalar: number, target?: Vec3): Vec3; scale(scalar: number, target?: Vec3): Vec3; dot(v: Vec3): number; @@ -532,8 +414,6 @@ declare module CANNON { toString(): string; toArray(): number[]; copy(source: Vec3): Vec3; - length(): number; - lengthSquared(): number; lerp(v: Vec3, t: number, target?: Vec3): void; almostEquals(v: Vec3, precision?: number): boolean; almostZero(precision?: number): boolean; @@ -543,24 +423,15 @@ declare module CANNON { } export interface IBodyOptions { - position?: Vec3; velocity?: Vec3; angularVelocity?: Vec3; quaternion?: Quaternion; mass?: number; - material?: Material; + material?: number; type?: number; linearDamping?: number; angularDamping?: number; - allowSleep?: boolean; - sleepSpeedLimit?: number; - sleepTimeLimit?: number; - collisionFilterGroup?: number; - collisionFilterMask?: number; - fixedRotation?: boolean; - shape?: Shape; - } export class Body extends EventTarget { @@ -585,7 +456,6 @@ declare module CANNON { position: Vec3; previousPosition: Vec3; initPosition: Vec3; - boundingRadius: number; velocity: Vec3; initVelocity: Vec3; force: Vec3; @@ -626,24 +496,30 @@ declare module CANNON { wakeUp(): void; sleep(): void; sleepTick(time: number): void; + updateSolveMassProperties(): void; pointToLocalFrame(worldPoint: Vec3, result?: Vec3): Vec3; pointToWorldFrame(localPoint: Vec3, result?: Vec3): Vec3; - vectorToLocalFrame(worldPoint: Vec3, result?: Vec3): Vec3; vectorToWorldFrame(localVector: Vec3, result?: Vec3): Vec3; - addShape(shape: Shape, offset?: Vec3, orientation?: Vec3): void; + addShape(shape: Shape, offset?: Vec3, orientation?: Quaternion): void; + updateBoundingRadius(): void; computeAABB(): void; + updateInertiaWorld(force: Vec3): void; applyForce(force: Vec3, worldPoint: Vec3): void; applyImpulse(impulse: Vec3, worldPoint: Vec3): void; - applyLocalForce(force: Vec3, localPoint: Vec3): void; - applyLocalImplse(impulse: Vec3, localPoint: Vec3): void; - updateBoundingRadius(): void; updateMassProperties(): void; - updateInertiaWorld(force: Vec3): void; - updateSolveMassProperties(): void; getVelocityAtWorldPoint(worldPoint: Vec3, result: Vec3): Vec3; } + export interface IRaycastVehicleOptions { + + chassisBody?: Body; + indexRightAxis?: number; + indexLeftAxis?: number; + indexUpAxis?: number; + + } + export interface IWheelInfoOptions { chassisConnectionPointLocal?: Vec3; @@ -664,7 +540,7 @@ declare module CANNON { deltaRotation?: number; rollInfluence?: number; maxSuspensionForce?: number; - isFrontWheel?: boolean; + isFronmtWheel?: boolean; clippedInvContactDotSuspension?: number; suspensionRelativeVelocity?: number; suspensionForce?: number; @@ -683,55 +559,46 @@ declare module CANNON { export class WheelInfo { - axleLocal: Vec3; - axleWorld: Vec3; - brake: number; + maxSuspensionTravbel: number; + customSlidingRotationalSpeed: number; + useCustomSlidingRotationalSpeed: boolean; + sliding: boolean; chassisConnectionPointLocal: Vec3; chassisConnectionPointWorld: Vec3; - clippedInvContactDotSuspension: number; - customSlidingRotationalSpeed: number; - dampingCompression: number; - dampingRelaxation: number; - deltaRotation: number; directionLocal: Vec3; directionWorld: Vec3; - engineForce: number; - forwardImpulse: number; - frictionSlip: number; - isFrontWheel: boolean; - isInContact: boolean; - maxSuspensionForce: number; - maxSuspensionTravel: number; - radius: number; - raycastResult: RaycastResult; - rollInfluence: number; - rotation: number; - sideImpulse: number; - skidInfo: number; - sliding: boolean; - steering: number; - suspensionForce: number; - suspensionLength: number; - suspensionMaxLength: number; - suspensionRelativeVelocity: number; - suspensionStiffness: number; + axleLocal: Vec3; + axleWorld: Vec3; suspensionRestLength: number; - useCustomSlidingRotationalSpeed: boolean; + suspensionMaxLength: number; + radius: number; + suspensionStiffness: number; + dampingCompression: number; + dampingRelaxation: number; + frictionSlip: number; + steering: number; + rotation: number; + deltaRotation: number; + rollInfluence: number; + maxSuspensionForce: number; + engineForce: number; + brake: number; + isFrontWheel: boolean; + clippedInvContactDotSuspension: number; + suspensionRelativeVelocity: number; + suspensionForce: number; + skidInfo: number; + suspensionLength: number; + sideImpulse: number; + forwardImpulse: number; + raycastResult: RaycastResult; worldTransform: Transform; + isInContact: boolean; constructor(options?: IWheelInfoOptions); } - export interface IRaycastVehicleOptions { - - chassisBody?: Body; - indexRightAxis?: number; - indexLeftAxis?: number; - indexUpAxis?: number; - - } - export class RaycastVehicle { chassisBody: Body; @@ -752,7 +619,6 @@ declare module CANNON { getVehicleAxisWorld(axisIndex: number, result: Vec3): Vec3; updateVehicle(timeStep: number): void; updateSuspension(deltaTime: number): void; - updateWheelTransform(wheelIndex: number): void; removeFromWorld(world: World): void; getWheelTransformWorld(wheelIndex: number): Transform; @@ -843,15 +709,20 @@ declare module CANNON { export class Box extends Shape { - static calculateInertia(halfExtents: Vec3, mass: number, target: Vec3): void; + static calculateIntertia(halfExtents: Vec3, mass: number, target: Vec3): void; + boundingSphereRadius: number; + collisionResponse: boolean; halfExtents: Vec3; convexPolyhedronRepresentation: ConvexPolyhedron; constructor(halfExtents: Vec3); updateConvexPolyhedronRepresentation(): void; + calculateLocalInertia(mass: number, target?: Vec3): Vec3; getSideNormals(sixTargetVectors: boolean, quat?: Quaternion): Vec3[]; + updateBoundingSphereRadius(): number; + volume(): number; forEachWorldCorner(pos: Vec3, quat: Quaternion, callback: Function): void; } @@ -860,7 +731,6 @@ declare module CANNON { static computeNormal(va: Vec3, vb: Vec3, vc: Vec3, target: Vec3): void; static project(hull: ConvexPolyhedron, axis: Vec3, pos: Vec3, quat: Quaternion, result: number[]): void; - static getFaceNormal(va: Vec3, vb: Vec3, vc: Vec3, target: Vec3): void; vertices: Vec3[]; worldVertices: Vec3[]; @@ -868,7 +738,6 @@ declare module CANNON { faces: number[]; faceNormals: Vec3[]; uniqueEdges: Vec3[]; - uniqueAxes: Vec3[]; constructor(points?: Vec3[], faces?: number[]); @@ -876,7 +745,7 @@ declare module CANNON { computeNormals(): void; getFaceNormal(i: number, target: Vec3): Vec3; clipAgainstHull(posA: Vec3, quatA: Quaternion, hullB: Vec3, quatB: Quaternion, separatingNormal: Vec3, minDist: number, maxDist: number, result: any[]): void; - findSeparatingAxis(hullB: ConvexPolyhedron, posA: Vec3, quatA: Quaternion, posB: Vec3, quatB: Quaternion, target: Vec3, faceListA: any[], faceListB: any[]): boolean; + findSaparatingAxis(hullB: ConvexPolyhedron, posA: Vec3, quatA: Quaternion, posB: Vec3, quatB: Quaternion, target: Vec3, faceListA: any[], faceListB: any[]): boolean; testSepAxis(axis: Vec3, hullB: ConvexPolyhedron, posA: Vec3, quatA: Quaternion, posB: Vec3, quatB: Quaternion): number; getPlaneConstantOfFace(face_i: number): number; clipFaceAgainstHull(separatingNormal: Vec3, posA: Vec3, quatA: Quaternion, worldVertsB1: Vec3[], minDist: number, maxDist: number, result: any[]): void; @@ -891,13 +760,13 @@ declare module CANNON { } - export class Cylinder extends ConvexPolyhedron { + export class Cylinder extends Shape { constructor(radiusTop: number, radiusBottom: number, height: number, numSegments: number); } - export interface IHightfieldOptions { + export interface IHightfield { minValue?: number; maxValue?: number; @@ -916,7 +785,7 @@ declare module CANNON { pillarOffset: Vec3; type: number; - constructor(data: number[], options?: IHightfieldOptions); + constructor(data: number[], options?: IHightfield); update(): void; updateMinValue(): void; @@ -958,14 +827,13 @@ declare module CANNON { } - id: number; type: number; boundingSphereRadius: number; collisionResponse: boolean; updateBoundingSphereRadius(): number; volume(): number; - calculateLocalInertia(mass: number, target?: Vec3): Vec3; + calculateLocalInertia(mass: number, target: Vec3): Vec3; } @@ -988,7 +856,7 @@ declare module CANNON { } export class Solver { - + iterations: number; equations: Equation[]; solve(dy: number, world: World): number; @@ -1048,7 +916,7 @@ declare module CANNON { export class Vec3Pool extends Pool { - static defaults(options: Object, defaults: Object): Object; + type: any; constructObject(): Vec3; @@ -1057,66 +925,8 @@ declare module CANNON { export class NarrowPhase { contactPointPool: Pool[]; - enableFrictionReduction: boolean; v3pool: Vec3Pool; - convexHeightfield(convexShape: Shape, hfShape: Heightfield, convexPos: Vec3, hfPos: Vec3, convexQuat: Quaternion, hfQuat: Quaternion, convexBody: Body, hfBody: Body): void; - convexConvex(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; - convexParticle(result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; - convexTrimesh( result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; - createContactEquation(bi: Body, bj: Body, si: Shape, sj: Shape, rsi: Shape, rsj: Shape): ContactEquation; - getContacts(p1: Body[], p2: Body[], world: World, result: ContactEquation[], oldcontacts: ContactEquation[]): void; - particlePlane( result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; - particleSphere(result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; - planeBox(result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; - planeConvex(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; - planeTrimesh(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; - sphereBox(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; - sphereConvex(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; - sphereHeightfield(sphereShape: Shape, hfShape: Heightfield, spherePos: Vec3, hfPos: Vec3, sphereQuat: Quaternion, hfQuat: Quaternion, sphereBody: Body, hfBody: Body): void; - spherePlane( si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; - sphereSphere(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void; - sphereTrimesh(sphereShape: Shape, trimeshShape: Shape, spherePos: Vec3, trimeshPos: Vec3, sphereQuat: Quaternion, trimeshQuat: Quaternion, sphereBody: Body, trimeshBody: Body): void; - - } - - export interface IOctreeOptions { - - root: Octree; - aabb: AABB; - - } - - export class OctreeNode { - - aabb: AABB; - children: Octree[]; - data: number[]; - root: OctreeNode; - - } - - export class Octree extends OctreeNode { - - maxDepth: number; - - constructor(aabb: AABB, options: IOctreeOptions); - - aabbQuery(aabb: AABB, result: Object[]): Object[]; - insert(aabb: AABB, elementData: Object): boolean; - rayQuery(ray: Ray, treeTransform: Transform, result: Object[]): Object[]; - removeEmptyNodes(): void; - subdivide(): void; - - } - - export interface IWorld { - - collisisonFilterMask?: number; - collisionFilterGroup?: number; - skipBackfaces?: boolean; - checkCollisionResponse?: boolean; - } export class World extends EventTarget { @@ -1140,7 +950,7 @@ declare module CANNON { collisionMatrix: ArrayCollisionMatrix; collisionMatrixPrevious: ArrayCollisionMatrix; materials: Material[]; - contactMaterials: ContactMaterial[]; + contactmaterials: ContactMaterial[]; contactMaterialTable: TupleDictionary; defaultMaterial: Material; defaultContactMaterial: ContactMaterial; @@ -1156,23 +966,16 @@ declare module CANNON { addBodyEvent: IBodyEvent; removeBodyEvent: IBodyEvent; - addBody(body: Body): void; - addConstraint(c: Constraint): void; - addContactMaterial(cmat: ContactMaterial): void; - addEventListener(type: string, listener: Function): EventTarget; - addMaterial(m: Material): void; - clearForces(): void; - collisionMatrixTick(): void; getContactMaterial(m1: Material, m2: Material): ContactMaterial; numObjects(): number; - raycastAll(from: Vec3, to: Vec3, options: IWorld, callback: Function): boolean; - raycastAny(from: Vec3, to: Vec3, options: IWorld, result: RaycastResult): boolean; - raycastClosest(from: Vec3, to: Vec3, options: IWorld, result: RaycastResult): boolean; + collisionMatrixTick(): void; + addBody(body: Body): void; + addConstraint(c: Constraint): void; + removeConstraint(c: Constraint): void; rayTest(from: Vec3, to: Vec3, result: RaycastResult): void; remove(body: Body): void; - removeBody(body: Body): void; - removeConstraint(c: Constraint): void; - removeEventListener(type: string, listener: Function): EventTarget; + addMaterial(m: Material): void; + addContactMaterial(cmat: ContactMaterial): void; step(dy: number, timeSinceLastCalled?: number, maxSubSteps?: number): void; } @@ -1189,17 +992,9 @@ declare module CANNON { } - export class Demo { - - constructor( options: Object ); - - addScene( title: string, initfunc: Function ): void; - restartCurrentScene(): void; - - } - } + declare module "cannon" { export = CANNON; } From ff113b3b1cfb2b7c98e2efd6e10ddb04d43bc031 Mon Sep 17 00:00:00 2001 From: darlin Date: Mon, 23 Jan 2017 20:14:41 +0800 Subject: [PATCH 058/140] add sub module export --- crypto-js/index.d.ts | 237 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 234 insertions(+), 3 deletions(-) diff --git a/crypto-js/index.d.ts b/crypto-js/index.d.ts index 5fdf193254..a2c0ee381d 100644 --- a/crypto-js/index.d.ts +++ b/crypto-js/index.d.ts @@ -3,9 +3,6 @@ // Definitions by: Michael Zabka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export = CryptoJS; -export as namespace CryptoJS; - declare var CryptoJS: CryptoJS.Hashes; declare namespace CryptoJS { type Hash = (message: string, key?: string, ...options: any[]) => string; @@ -113,5 +110,239 @@ declare namespace CryptoJS { NoPadding: Padding; }; } + } +declare module "crypto-js" { + var CryptoJS: CryptoJS.Hashes; + export = CryptoJS; +} + +/* --------------------------------- */ +declare module "crypto-js/core" { + var core: any; + export = core; +} + +declare module "crypto-js/x64-core" { + var x64: any; + export = x64; +} + +declare module "crypto-js/lib-typedarrays" { + var libWordArray: any; + export = libWordArray; +} + +/* --------------------------------- */ +declare module "crypto-js/md5" { + var MD5: CryptoJS.Hash; + export = MD5; +} + +declare module "crypto-js/sha1" { + var SHA1: CryptoJS.Hash; + export = SHA1; +} + +declare module "crypto-js/sha256" { + var SHA256: CryptoJS.Hash; + export = SHA256; +} + +declare module "crypto-js/sha224" { + var SHA224: CryptoJS.Hash; + export = SHA224; +} + +declare module "crypto-js/sha512" { + var SHA512: CryptoJS.Hash; + export = SHA512; +} + +declare module "crypto-js/sha384" { + var SHA384: CryptoJS.Hash; + export = SHA384; +} + +declare module "crypto-js/sha3" { + var SHA3: CryptoJS.Hash; + export = SHA3; +} + +declare module "crypto-js/ripemd160" { + var RIPEMD160: CryptoJS.Hash; + export = RIPEMD160; +} + +/* --------------------------------- */ +declare module "crypto-js/hmac-md5" { + var HmacMD5: CryptoJS.Hash; + export = HmacMD5; +} + +declare module "crypto-js/hmac-sha1" { + var HmacSHA1: CryptoJS.Hash; + export = HmacSHA1; +} + +declare module "crypto-js/hmac-sha256" { + var HmacSHA256: CryptoJS.Hash; + export = HmacSHA256; +} + +declare module "crypto-js/hmac-sha224" { + var HmacSHA224: CryptoJS.Hash; + export = HmacSHA224; +} + +declare module "crypto-js/hmac-sha512" { + var HmacSHA512: CryptoJS.Hash; + export = HmacSHA512; +} + +declare module "crypto-js/hmac-sha384" { + var HmacSHA384: CryptoJS.Hash; + export = HmacSHA384; +} + +declare module "crypto-js/hmac-sha3" { + var HmacSHA3: CryptoJS.Hash; + export = HmacSHA3; +} + +declare module "crypto-js/hmac-ripemd160" { + var HmacRIPEMD160: CryptoJS.Hash; + export = HmacRIPEMD160; +} + +/* --------------------------------- */ +declare module "crypto-js/pbkdf2" { + var PBKDF2: CryptoJS.Hash; + export = PBKDF2; +} + +/* --------------------------------- */ +declare module "crypto-js/aes" { + var AES: CryptoJS.Cipher; + export = AES; +} + +declare module "crypto-js/tripledes" { + var TripleDES: CryptoJS.Cipher; + export = TripleDES; +} + +declare module "crypto-js/rc4" { + var RC4: CryptoJS.Cipher; + export = RC4; +} + +declare module "crypto-js/rabbit" { + var Rabbit: CryptoJS.Cipher; + export = Rabbit; +} + +declare module "crypto-js/rabbit-legacy" { + var RabbitLegacy: CryptoJS.Cipher; + export = RabbitLegacy; +} + +declare module "crypto-js/evpkdf" { + var EvpKDF: CryptoJS.Cipher; + export = EvpKDF; +} + +/* --------------------------------- */ +declare module "crypto-js/format-openssl" { + var FormatOpenssl: any; + export = FormatOpenssl; +} + +declare module "crypto-js/format-hex" { + var FormatHex: any; + export = FormatHex; +} + +/* --------------------------------- */ +declare module "crypto-js/enc-latin1" { + var encLatin1: CryptoJS.Encoder; + export = encLatin1; +} + +declare module "crypto-js/enc-utf8" { + var encUtf8: CryptoJS.Encoder; + export = encUtf8; +} + +declare module "crypto-js/enc-hex" { + var encHex: CryptoJS.Encoder; + export = encHex; +} + +declare module "crypto-js/enc-utf16" { + var encUtf16: CryptoJS.Encoder; + export = encUtf16; +} + +declare module "crypto-js/enc-base64" { + var encBase64: CryptoJS.Encoder; + export = encBase64; +} + +/* --------------------------------- */ +declare module "crypto-js/mode-cfb" { + var modeCFB: CryptoJS.Mode; + export = modeCFB; +} + +declare module "crypto-js/mode-ctr" { + var modeCTR: CryptoJS.Mode; + export = modeCTR; +} + +declare module "crypto-js/mode-ctr-gladman" { + var modeCTRGladman: CryptoJS.Mode; + export = modeCTRGladman; +} + +declare module "crypto-js/mode-ofb" { + var modeOFB: CryptoJS.Mode; + export = modeOFB; +} + +declare module "crypto-js/mode-ecb" { + var modeECB: CryptoJS.Mode; + export = modeECB; +} + +/* --------------------------------- */ +declare module "crypto-js/pad-pkcs7" { + var padPkcs7: CryptoJS.Padding; + export = padPkcs7; +} + +declare module "crypto-js/pad-ansix923" { + var padAnsiX923: CryptoJS.Padding; + export = padAnsiX923; +} + +declare module "crypto-js/pad-iso10126" { + var padIso10126: CryptoJS.Padding; + export = padIso10126; +} + +declare module "crypto-js/pad-iso97971" { + var padIso97971: CryptoJS.Padding; + export = padIso97971; +} + +declare module "crypto-js/pad-zeropadding" { + var padZeroPadding: CryptoJS.Padding; + export = padZeroPadding; +} + +declare module "crypto-js/pad-nopadding" { + var padNoPadding: CryptoJS.Padding; + export = padNoPadding; +} From a6d113976a6f759abb85c948eca760722512a658 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Mon, 23 Jan 2017 12:20:37 +0000 Subject: [PATCH 059/140] Added @pzavolinsky and @bbenezech as maintainers --- react/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react/index.d.ts b/react/index.d.ts index e59234ae6c..9972f80998 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for React v15.0 // Project: http://facebook.github.io/react/ -// Definitions by: Asana , AssureSign , Microsoft , John Reilly +// Definitions by: Asana , AssureSign , Microsoft , John Reilly , Benoit Benezech , Patricio Zavolinsky // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = React; From fc6a9729df46769b7a50cffe4414dc913ba6da28 Mon Sep 17 00:00:00 2001 From: Kir Dergachev Date: Mon, 23 Jan 2017 16:14:33 +0300 Subject: [PATCH 060/140] Fixes errors references. Removes references to webrtc --- sip.js/index.d.ts | 68 ++++++++++++++++++++---------------------- sip.js/sip.js-tests.ts | 36 +++++++++++----------- sip.js/tslint.json | 3 +- 3 files changed, 51 insertions(+), 56 deletions(-) diff --git a/sip.js/index.d.ts b/sip.js/index.d.ts index 942a0d22b3..be01cd3682 100644 --- a/sip.js/index.d.ts +++ b/sip.js/index.d.ts @@ -3,21 +3,23 @@ // Definitions by: Kir Dergachev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +declare interface SIP { + UA: { + new (configuration?: sipjs.ConfigurationParameters): sipjs.UA; + }; + URI: { + new (scheme?: string, user?: string, host?: string, port?: number, parameters?: string[], headers?: string[]): sipjs.URI; + parse(uri: string): sipjs.URI; + }; + NameAddrHeader: { + new (uri: string | sipjs.URI, displayName: string, parameters: Array<{ key: string, value: string }>): sipjs.NameAddrHeader; + parse(name_addr_header: string): sipjs.NameAddrHeader; + }; +} -export = SIP; - -declare namespace SIP { - - class URI { - constructor( - scheme?: string, - user?: string, - host?: string, - port?: number, - parameters?: string[], - headers?: string[]); +declare namespace sipjs { + interface URI { scheme?: string; user?: string; host?: string; @@ -35,8 +37,6 @@ declare namespace SIP { clearHeaders(): void; clone(): URI; toString(): string; - - static parse(uri: string): URI; } namespace UA.EventArgs { @@ -45,8 +45,7 @@ declare namespace SIP { interface RegistrationFailedArgs extends UnregisteredArgs { } } - class UA { - constructor(configuration?: ConfigurationParameters); + interface UA { start(): void; stop(): void; register(options?: ExtraHeadersOptions): UA; @@ -59,7 +58,7 @@ declare namespace SIP { request(method: string, target: string | URI, options?: RequestOptions): ClientContext; on(name: 'connected', callback: (args: UA.EventArgs.ConnectedArgs) => void): void; - on(name: 'disconnected' | 'registered', callback: () => void): void; + on(name: 'disconnected' | 'registered' | string, callback: () => void): void; on(name: 'unregistered', callback: (args: UA.EventArgs.UnregisteredArgs) => void): void; on(name: 'registrationFailed', callback: (args: UA.EventArgs.RegistrationFailedArgs) => void): void; on(name: 'invite', callback: (session: Session) => void): void; @@ -81,7 +80,7 @@ declare namespace SIP { } } - class Session { + interface Session { startTime?: Date; endTime?: Date; ua?: UA; @@ -95,8 +94,8 @@ declare namespace SIP { dtmf(tone: string | number, options?: Session.DtmfOptions): Session; terminate(options?: Session.CommonOptions): Session; bye(options?: Session.CommonOptions): Session; - getLocalStreams(): MediaStream[]; - getRemoteStreams(): MediaStream[]; + getLocalStreams(): any[]; + getRemoteStreams(): any[]; refer(target: string | Session, options?: ExtraHeadersOptions): Session; mute(options?: ExtraHeadersOptions): void; unmute(options?: ExtraHeadersOptions): void; @@ -111,7 +110,7 @@ declare namespace SIP { on(name: 'accepted', callback: (data: { code: number, response: IncomingResponse }) => void): void; on(name: 'failed' | 'rejected', callback: (response: IncomingResponse, cause: string) => void): void; on(name: 'terminated', callback: (message: IncomingResponse, cause: string) => void): void; - on(name: 'cancel', callback: () => void): void; + on(name: 'cancel' | string, callback: () => void): void; on(name: 'replaced', callback: (newSession: Session) => void): void; on(name: 'dtmf', callback: (request: IncomingRequest, dtmf: Session.DTMF) => void): void; on(name: 'muted' | 'unmuted', callback: (data: Session.Muted) => void): void; @@ -136,7 +135,7 @@ declare namespace SIP { } interface AcceptOptions { - RTCConstraints?: RTCPeerConnection; + RTCConstraints?: any; media?: MediaOptions; } @@ -169,21 +168,21 @@ declare namespace SIP { interface Options { stunServers?: string | string[]; turnServers?: TurnServer | TurnServer[]; - RTCConstraints?: RTCPeerConnection; + RTCConstraints?: any; } type MediaHandlerFactory = (session: Session, options: Options) => MediaHandler; class MediaHandler { - getLocalStreams(): MediaStream[]; - getRemoteStreams(): MediaStream[]; + getLocalStreams(): any[]; + getRemoteStreams(): any[]; render(renderHint: RenderHint): void; on(name: 'userMediaRequest', callback: (constraints: MediaConstraints) => void): void; - on(name: 'addStream' | 'userMedia', callback: (stream: MediaStream) => void): void; + on(name: 'addStream' | 'userMedia', callback: (stream: any) => void): void; on(name: 'userMediaFailed', callback: (error: string) => void): void; - on(name: 'iceCandidate', callback: (candidate: RTCIceCandidate) => void): void; - on(name: 'iceGathering' | 'iceGatheringComplete' | 'iceConnection' | 'iceConnectionChecking' | 'iceConnectionConnected' | 'iceConnectionCompleted' | 'iceConnectionFailed' | 'iceConnectionDisconnected' | 'iceConnectionClosed', callback: () => void): void; + on(name: 'iceCandidate', callback: (candidate: any) => void): void; + on(name: 'iceGathering' | 'iceGatheringComplete' | 'iceConnection' | 'iceConnectionChecking' | 'iceConnectionConnected' | 'iceConnectionCompleted' | 'iceConnectionFailed' | 'iceConnectionDisconnected' | 'iceConnectionClosed' | string, callback: () => void): void; on(name: 'dataChannel' | 'getDescription' | 'setDescription', callback: (sdpWrapper: { type: string, sdp: string }) => void): void; } } @@ -247,7 +246,7 @@ declare namespace SIP { interface MediaOptions { constraints?: MediaConstraints; - stream?: MediaStream; + stream?: any; render?: RenderHint; } @@ -256,7 +255,7 @@ declare namespace SIP { anonymous?: boolean; rel100?: string; inviteWithoutSdp?: boolean; - RTCConstraints?: RTCPeerConnection; + RTCConstraints?: any; } interface RequestOptions extends ExtraHeadersOptions { @@ -290,6 +289,7 @@ declare namespace SIP { data: {}; on(name: 'progress' | 'accepted' | 'rejected' | 'failed', callback: (response: IncomingMessage, cause: string) => void): void; on(name: 'notify', callback: (request: IncomingRequest) => void): void; + on(name: string, callback: () => void): void; } interface ClientContext extends Context { @@ -320,9 +320,7 @@ declare namespace SIP { } /* Header */ - class NameAddrHeader { - constructor(uri: string | URI, displayName: string, parameters: Array<{ key: string, value: string }>); - + interface NameAddrHeader { uri: string | URI; displayName: string; @@ -330,7 +328,5 @@ declare namespace SIP { getParam(key: string): string; deleteParam(key: string): string; clearParams(): void; - - static parse(name_addr_header: string): NameAddrHeader; } } diff --git a/sip.js/sip.js-tests.ts b/sip.js/sip.js-tests.ts index f688fe67ae..524caf1827 100644 --- a/sip.js/sip.js-tests.ts +++ b/sip.js/sip.js-tests.ts @@ -1,11 +1,11 @@ -import SIP = require("./index"); +declare var sip: SIP; -let ua: SIP.UA = new SIP.UA(); +let ua: sipjs.UA = new sip.UA(); -const mediaHandler = (session: SIP.Session, options: SIP.WebRTC.Options) => new SIP.WebRTC.MediaHandler(); +const mediaHandler = (session: sipjs.Session, options: sipjs.WebRTC.Options) => new sipjs.WebRTC.MediaHandler(); const logConnector = (level: string, category: string, label: string, content: string) => null; -const uaWithConfig: SIP.UA = new SIP.UA({ +const uaWithConfig: sipjs.UA = new sip.UA({ uri: "wss://uri", wsServers: ["s1", "s2"], allowLegacyNotifications: true, @@ -38,7 +38,7 @@ const uaWithConfig: SIP.UA = new SIP.UA({ stunServers: ["", ""], turnServers: [ { - password: "", + password: "", username: "", urls: ["", ""] } @@ -61,15 +61,15 @@ ua.unregister({ extraHeaders: [""], all: true }); const isConnected: boolean = ua.isConnected(); const isRegistered: boolean = ua.isRegistered(); -const message: SIP.Message = ua.message("", "", { contentType: "" }); +const message: sipjs.Message = ua.message("", "", { contentType: "" }); -ua.subscribe("", "", { expires: 1, extraHeaders: [""]}); -const subscription: SIP.Subscription = ua.subscribe(new SIP.URI(), "", { expires: 1, extraHeaders: [""]}); +ua.subscribe("", "", { expires: 1, extraHeaders: [""] }); +const subscription: sipjs.Subscription = ua.subscribe(new sip.URI(), "", { expires: 1, extraHeaders: [""] }); let session = ua.invite("", new HTMLVideoElement()); -const inviteOptions: SIP.InviteOptions = { - media: { +const inviteOptions: sipjs.InviteOptions = { + media: { constraints: { audio: true, video: false }, stream: new MediaStream(), render: { remote: new Element(), local: new Element() }, @@ -77,17 +77,17 @@ const inviteOptions: SIP.InviteOptions = { anonymous: true, rel100: "", inviteWithoutSdp: true, - RTCConstraints: new RTCPeerConnection() + RTCConstraints: {} } session = ua.invite("", inviteOptions); -ua.on('connected', (args: SIP.UA.EventArgs.ConnectedArgs) => {}); -ua.on('disconnected', () => {}); -ua.on('registered', () => {}); -ua.on('unregistered', (args: SIP.UA.EventArgs.UnregisteredArgs) => {}); -ua.on('registrationFailed', (args: SIP.UA.EventArgs.RegistrationFailedArgs) => {}); -ua.on('invite', (session: SIP.Session) => { +ua.on('connected', (args: sipjs.UA.EventArgs.ConnectedArgs) => { }); +ua.on('disconnected', () => { }); +ua.on('registered', () => { }); +ua.on('unregistered', (args: sipjs.UA.EventArgs.UnregisteredArgs) => { }); +ua.on('registrationFailed', (args: sipjs.UA.EventArgs.RegistrationFailedArgs) => { }); +ua.on('invite', (session: sipjs.Session) => { session.on('progress', (response) => { }); session.on('accepted', (response) => { @@ -96,4 +96,4 @@ ua.on('invite', (session: SIP.Session) => { }); }); -ua.on('message', (message: SIP.Message) => {}); +ua.on('message', (message: sipjs.Message) => { }); diff --git a/sip.js/tslint.json b/sip.js/tslint.json index c78c443ad2..105f5736e6 100644 --- a/sip.js/tslint.json +++ b/sip.js/tslint.json @@ -1,7 +1,6 @@ { "extends": "../tslint.json", "rules": { - "no-empty-interface": false, - "export-just-namespace": false + "no-empty-interface": false } } From 63916eca261c67c465508e84ea9f02696e9bc299 Mon Sep 17 00:00:00 2001 From: BingoRUS Date: Mon, 23 Jan 2017 19:47:01 +0300 Subject: [PATCH 061/140] Update DevExtreme definitions to 16.2.4 16.2 is the new major version of DevExtreme. Read more about changes here: https://www.devexpress.com/Support/WhatsNew/DevExtreme/ --- devextreme/index.d.ts | 1819 ++++++++++++++++++++--------------------- 1 file changed, 876 insertions(+), 943 deletions(-) diff --git a/devextreme/index.d.ts b/devextreme/index.d.ts index 6aae49d6cd..e327800618 100644 --- a/devextreme/index.d.ts +++ b/devextreme/index.d.ts @@ -1,10 +1,472 @@ -// Type definitions for DevExtreme 16.1.8 +// Type definitions for DevExtreme 16.2.4 // Project: http://js.devexpress.com/ // Definitions by: DevExpress Inc. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +interface JQuery { + dxAccordion(): JQuery; + dxAccordion(options: "instance"): DevExpress.ui.dxAccordion; + dxAccordion(options: string): any; + dxAccordion(options: string, ...params: any[]): any; + dxAccordion(options: DevExpress.ui.dxAccordionOptions): JQuery; +} +interface JQuery { + dxActionSheet(): JQuery; + dxActionSheet(options: "instance"): DevExpress.ui.dxActionSheet; + dxActionSheet(options: string): any; + dxActionSheet(options: string, ...params: any[]): any; + dxActionSheet(options: DevExpress.ui.dxActionSheetOptions): JQuery; +} +interface JQuery { + dxAutocomplete(): JQuery; + dxAutocomplete(options: "instance"): DevExpress.ui.dxAutocomplete; + dxAutocomplete(options: string): any; + dxAutocomplete(options: string, ...params: any[]): any; + dxAutocomplete(options: DevExpress.ui.dxAutocompleteOptions): JQuery; +} +interface JQuery { + dxBox(): JQuery; + dxBox(options: "instance"): DevExpress.ui.dxBox; + dxBox(options: string): any; + dxBox(options: string, ...params: any[]): any; + dxBox(options: DevExpress.ui.dxBoxOptions): JQuery; +} +interface JQuery { + dxButton(): JQuery; + dxButton(options: "instance"): DevExpress.ui.dxButton; + dxButton(options: string): any; + dxButton(options: string, ...params: any[]): any; + dxButton(options: DevExpress.ui.dxButtonOptions): JQuery; +} +interface JQuery { + dxCalendar(): JQuery; + dxCalendar(options: "instance"): DevExpress.ui.dxCalendar; + dxCalendar(options: string): any; + dxCalendar(options: string, ...params: any[]): any; + dxCalendar(options: DevExpress.ui.dxCalendarOptions): JQuery; +} +interface JQuery { + dxCheckBox(): JQuery; + dxCheckBox(options: "instance"): DevExpress.ui.dxCheckBox; + dxCheckBox(options: string): any; + dxCheckBox(options: string, ...params: any[]): any; + dxCheckBox(options: DevExpress.ui.dxCheckBoxOptions): JQuery; +} +interface JQuery { + dxColorBox(): JQuery; + dxColorBox(options: "instance"): DevExpress.ui.dxColorBox; + dxColorBox(options: string): any; + dxColorBox(options: string, ...params: any[]): any; + dxColorBox(options: DevExpress.ui.dxColorBoxOptions): JQuery; +} +interface JQuery { + dxContextMenu(): JQuery; + dxContextMenu(options: "instance"): DevExpress.ui.dxContextMenu; + dxContextMenu(options: string): any; + dxContextMenu(options: string, ...params: any[]): any; + dxContextMenu(options: DevExpress.ui.dxContextMenuOptions): JQuery; +} +interface JQuery { + dxDataGrid(): JQuery; + dxDataGrid(options: "instance"): DevExpress.ui.dxDataGrid; + dxDataGrid(options: string): any; + dxDataGrid(options: string, ...params: any[]): any; + dxDataGrid(options: DevExpress.ui.dxDataGridOptions): JQuery; +} +interface JQuery { + dxDateBox(): JQuery; + dxDateBox(options: "instance"): DevExpress.ui.dxDateBox; + dxDateBox(options: string): any; + dxDateBox(options: string, ...params: any[]): any; + dxDateBox(options: DevExpress.ui.dxDateBoxOptions): JQuery; +} +interface JQuery { + dxDeferRendering(): JQuery; + dxDeferRendering(options: "instance"): DevExpress.ui.dxDeferRendering; + dxDeferRendering(options: string): any; + dxDeferRendering(options: string, ...params: any[]): any; + dxDeferRendering(options: DevExpress.ui.dxDeferRenderingOptions): JQuery; +} +interface JQuery { + dxFileUploader(): JQuery; + dxFileUploader(options: "instance"): DevExpress.ui.dxFileUploader; + dxFileUploader(options: string): any; + dxFileUploader(options: string, ...params: any[]): any; + dxFileUploader(options: DevExpress.ui.dxFileUploaderOptions): JQuery; +} +interface JQuery { + dxForm(): JQuery; + dxForm(options: "instance"): DevExpress.ui.dxForm; + dxForm(options: string): any; + dxForm(options: string, ...params: any[]): any; + dxForm(options: DevExpress.ui.dxFormOptions): JQuery; +} +interface JQuery { + dxGallery(): JQuery; + dxGallery(options: "instance"): DevExpress.ui.dxGallery; + dxGallery(options: string): any; + dxGallery(options: string, ...params: any[]): any; + dxGallery(options: DevExpress.ui.dxGalleryOptions): JQuery; +} +interface JQuery { + dxList(): JQuery; + dxList(options: "instance"): DevExpress.ui.dxList; + dxList(options: string): any; + dxList(options: string, ...params: any[]): any; + dxList(options: DevExpress.ui.dxListOptions): JQuery; +} +interface JQuery { + dxLoadIndicator(): JQuery; + dxLoadIndicator(options: "instance"): DevExpress.ui.dxLoadIndicator; + dxLoadIndicator(options: string): any; + dxLoadIndicator(options: string, ...params: any[]): any; + dxLoadIndicator(options: DevExpress.ui.dxLoadIndicatorOptions): JQuery; +} +interface JQuery { + dxLoadPanel(): JQuery; + dxLoadPanel(options: "instance"): DevExpress.ui.dxLoadPanel; + dxLoadPanel(options: string): any; + dxLoadPanel(options: string, ...params: any[]): any; + dxLoadPanel(options: DevExpress.ui.dxLoadPanelOptions): JQuery; +} +interface JQuery { + dxLookup(): JQuery; + dxLookup(options: "instance"): DevExpress.ui.dxLookup; + dxLookup(options: string): any; + dxLookup(options: string, ...params: any[]): any; + dxLookup(options: DevExpress.ui.dxLookupOptions): JQuery; +} +interface JQuery { + dxMap(): JQuery; + dxMap(options: "instance"): DevExpress.ui.dxMap; + dxMap(options: string): any; + dxMap(options: string, ...params: any[]): any; + dxMap(options: DevExpress.ui.dxMapOptions): JQuery; +} +interface JQuery { + dxMenu(): JQuery; + dxMenu(options: "instance"): DevExpress.ui.dxMenu; + dxMenu(options: string): any; + dxMenu(options: string, ...params: any[]): any; + dxMenu(options: DevExpress.ui.dxMenuOptions): JQuery; +} +interface JQuery { + dxMultiView(): JQuery; + dxMultiView(options: "instance"): DevExpress.ui.dxMultiView; + dxMultiView(options: string): any; + dxMultiView(options: string, ...params: any[]): any; + dxMultiView(options: DevExpress.ui.dxMultiViewOptions): JQuery; +} +interface JQuery { + dxNavBar(): JQuery; + dxNavBar(options: "instance"): DevExpress.ui.dxNavBar; + dxNavBar(options: string): any; + dxNavBar(options: string, ...params: any[]): any; + dxNavBar(options: DevExpress.ui.dxNavBarOptions): JQuery; +} +interface JQuery { + dxNumberBox(): JQuery; + dxNumberBox(options: "instance"): DevExpress.ui.dxNumberBox; + dxNumberBox(options: string): any; + dxNumberBox(options: string, ...params: any[]): any; + dxNumberBox(options: DevExpress.ui.dxNumberBoxOptions): JQuery; +} +interface JQuery { + dxPanorama(): JQuery; + dxPanorama(options: "instance"): DevExpress.ui.dxPanorama; + dxPanorama(options: string): any; + dxPanorama(options: string, ...params: any[]): any; + dxPanorama(options: DevExpress.ui.dxPanoramaOptions): JQuery; +} +interface JQuery { + dxPivot(): JQuery; + dxPivot(options: "instance"): DevExpress.ui.dxPivot; + dxPivot(options: string): any; + dxPivot(options: string, ...params: any[]): any; + dxPivot(options: DevExpress.ui.dxPivotOptions): JQuery; +} +interface JQuery { + dxPivotGrid(): JQuery; + dxPivotGrid(options: "instance"): DevExpress.ui.dxPivotGrid; + dxPivotGrid(options: string): any; + dxPivotGrid(options: string, ...params: any[]): any; + dxPivotGrid(options: DevExpress.ui.dxPivotGridOptions): JQuery; +} +interface JQuery { + dxPivotGridFieldChooser(): JQuery; + dxPivotGridFieldChooser(options: "instance"): DevExpress.ui.dxPivotGridFieldChooser; + dxPivotGridFieldChooser(options: string): any; + dxPivotGridFieldChooser(options: string, ...params: any[]): any; + dxPivotGridFieldChooser(options: DevExpress.ui.dxPivotGridFieldChooserOptions): JQuery; +} +interface JQuery { + dxPopover(): JQuery; + dxPopover(options: "instance"): DevExpress.ui.dxPopover; + dxPopover(options: string): any; + dxPopover(options: string, ...params: any[]): any; + dxPopover(options: DevExpress.ui.dxPopoverOptions): JQuery; +} +interface JQuery { + dxPopup(): JQuery; + dxPopup(options: "instance"): DevExpress.ui.dxPopup; + dxPopup(options: string): any; + dxPopup(options: string, ...params: any[]): any; + dxPopup(options: DevExpress.ui.dxPopupOptions): JQuery; +} +interface JQuery { + dxProgressBar(): JQuery; + dxProgressBar(options: "instance"): DevExpress.ui.dxProgressBar; + dxProgressBar(options: string): any; + dxProgressBar(options: string, ...params: any[]): any; + dxProgressBar(options: DevExpress.ui.dxProgressBarOptions): JQuery; +} +interface JQuery { + dxRadioGroup(): JQuery; + dxRadioGroup(options: "instance"): DevExpress.ui.dxRadioGroup; + dxRadioGroup(options: string): any; + dxRadioGroup(options: string, ...params: any[]): any; + dxRadioGroup(options: DevExpress.ui.dxRadioGroupOptions): JQuery; +} +interface JQuery { + dxRangeSlider(): JQuery; + dxRangeSlider(options: "instance"): DevExpress.ui.dxRangeSlider; + dxRangeSlider(options: string): any; + dxRangeSlider(options: string, ...params: any[]): any; + dxRangeSlider(options: DevExpress.ui.dxRangeSliderOptions): JQuery; +} +interface JQuery { + dxResizable(): JQuery; + dxResizable(options: "instance"): DevExpress.ui.dxResizable; + dxResizable(options: string): any; + dxResizable(options: string, ...params: any[]): any; + dxResizable(options: DevExpress.ui.dxResizableOptions): JQuery; +} +interface JQuery { + dxResponsiveBox(): JQuery; + dxResponsiveBox(options: "instance"): DevExpress.ui.dxResponsiveBox; + dxResponsiveBox(options: string): any; + dxResponsiveBox(options: string, ...params: any[]): any; + dxResponsiveBox(options: DevExpress.ui.dxResponsiveBoxOptions): JQuery; +} +interface JQuery { + dxScheduler(): JQuery; + dxScheduler(options: "instance"): DevExpress.ui.dxScheduler; + dxScheduler(options: string): any; + dxScheduler(options: string, ...params: any[]): any; + dxScheduler(options: DevExpress.ui.dxSchedulerOptions): JQuery; +} +interface JQuery { + dxScrollView(): JQuery; + dxScrollView(options: "instance"): DevExpress.ui.dxScrollView; + dxScrollView(options: string): any; + dxScrollView(options: string, ...params: any[]): any; + dxScrollView(options: DevExpress.ui.dxScrollViewOptions): JQuery; +} +interface JQuery { + dxSelectBox(): JQuery; + dxSelectBox(options: "instance"): DevExpress.ui.dxSelectBox; + dxSelectBox(options: string): any; + dxSelectBox(options: string, ...params: any[]): any; + dxSelectBox(options: DevExpress.ui.dxSelectBoxOptions): JQuery; +} +interface JQuery { + dxSlideOut(): JQuery; + dxSlideOut(options: "instance"): DevExpress.ui.dxSlideOut; + dxSlideOut(options: string): any; + dxSlideOut(options: string, ...params: any[]): any; + dxSlideOut(options: DevExpress.ui.dxSlideOutOptions): JQuery; +} +interface JQuery { + dxSlideOutView(): JQuery; + dxSlideOutView(options: "instance"): DevExpress.ui.dxSlideOutView; + dxSlideOutView(options: string): any; + dxSlideOutView(options: string, ...params: any[]): any; + dxSlideOutView(options: DevExpress.ui.dxSlideOutViewOptions): JQuery; +} +interface JQuery { + dxSlider(): JQuery; + dxSlider(options: "instance"): DevExpress.ui.dxSlider; + dxSlider(options: string): any; + dxSlider(options: string, ...params: any[]): any; + dxSlider(options: DevExpress.ui.dxSliderOptions): JQuery; +} +interface JQuery { + dxSwitch(): JQuery; + dxSwitch(options: "instance"): DevExpress.ui.dxSwitch; + dxSwitch(options: string): any; + dxSwitch(options: string, ...params: any[]): any; + dxSwitch(options: DevExpress.ui.dxSwitchOptions): JQuery; +} +interface JQuery { + dxTabPanel(): JQuery; + dxTabPanel(options: "instance"): DevExpress.ui.dxTabPanel; + dxTabPanel(options: string): any; + dxTabPanel(options: string, ...params: any[]): any; + dxTabPanel(options: DevExpress.ui.dxTabPanelOptions): JQuery; +} +interface JQuery { + dxTabs(): JQuery; + dxTabs(options: "instance"): DevExpress.ui.dxTabs; + dxTabs(options: string): any; + dxTabs(options: string, ...params: any[]): any; + dxTabs(options: DevExpress.ui.dxTabsOptions): JQuery; +} +interface JQuery { + dxTagBox(): JQuery; + dxTagBox(options: "instance"): DevExpress.ui.dxTagBox; + dxTagBox(options: string): any; + dxTagBox(options: string, ...params: any[]): any; + dxTagBox(options: DevExpress.ui.dxTagBoxOptions): JQuery; +} +interface JQuery { + dxTextArea(): JQuery; + dxTextArea(options: "instance"): DevExpress.ui.dxTextArea; + dxTextArea(options: string): any; + dxTextArea(options: string, ...params: any[]): any; + dxTextArea(options: DevExpress.ui.dxTextAreaOptions): JQuery; +} +interface JQuery { + dxTextBox(): JQuery; + dxTextBox(options: "instance"): DevExpress.ui.dxTextBox; + dxTextBox(options: string): any; + dxTextBox(options: string, ...params: any[]): any; + dxTextBox(options: DevExpress.ui.dxTextBoxOptions): JQuery; +} +interface JQuery { + dxTileView(): JQuery; + dxTileView(options: "instance"): DevExpress.ui.dxTileView; + dxTileView(options: string): any; + dxTileView(options: string, ...params: any[]): any; + dxTileView(options: DevExpress.ui.dxTileViewOptions): JQuery; +} +interface JQuery { + dxToast(): JQuery; + dxToast(options: "instance"): DevExpress.ui.dxToast; + dxToast(options: string): any; + dxToast(options: string, ...params: any[]): any; + dxToast(options: DevExpress.ui.dxToastOptions): JQuery; +} +interface JQuery { + dxToolbar(): JQuery; + dxToolbar(options: "instance"): DevExpress.ui.dxToolbar; + dxToolbar(options: string): any; + dxToolbar(options: string, ...params: any[]): any; + dxToolbar(options: DevExpress.ui.dxToolbarOptions): JQuery; +} +interface JQuery { + dxTooltip(): JQuery; + dxTooltip(options: "instance"): DevExpress.ui.dxTooltip; + dxTooltip(options: string): any; + dxTooltip(options: string, ...params: any[]): any; + dxTooltip(options: DevExpress.ui.dxTooltipOptions): JQuery; +} +interface JQuery { + dxTreeView(): JQuery; + dxTreeView(options: "instance"): DevExpress.ui.dxTreeView; + dxTreeView(options: string): any; + dxTreeView(options: string, ...params: any[]): any; + dxTreeView(options: DevExpress.ui.dxTreeViewOptions): JQuery; +} +interface JQuery { + dxValidationGroup(): JQuery; + dxValidationGroup(options: "instance"): DevExpress.ui.dxValidationGroup; + dxValidationGroup(options: string): any; + dxValidationGroup(options: string, ...params: any[]): any; + dxValidationGroup(options: DevExpress.ui.dxValidationGroupOptions): JQuery; +} +interface JQuery { + dxValidationSummary(): JQuery; + dxValidationSummary(options: "instance"): DevExpress.ui.dxValidationSummary; + dxValidationSummary(options: string): any; + dxValidationSummary(options: string, ...params: any[]): any; + dxValidationSummary(options: DevExpress.ui.dxValidationSummaryOptions): JQuery; +} +interface JQuery { + dxValidator(): JQuery; + dxValidator(options: "instance"): DevExpress.ui.dxValidator; + dxValidator(options: string): any; + dxValidator(options: string, ...params: any[]): any; + dxValidator(options: DevExpress.ui.dxValidatorOptions): JQuery; +} +interface JQuery { + dxBarGauge(): JQuery; + dxBarGauge(options: "instance"): DevExpress.viz.dxBarGauge; + dxBarGauge(options: string): any; + dxBarGauge(options: string, ...params: any[]): any; + dxBarGauge(options: DevExpress.viz.gauges.dxBarGaugeOptions): JQuery; +} +interface JQuery { + dxBullet(): JQuery; + dxBullet(options: "instance"): DevExpress.viz.dxBullet; + dxBullet(options: string): any; + dxBullet(options: string, ...params: any[]): any; + dxBullet(options: DevExpress.viz.sparklines.dxBulletOptions): JQuery; +} +interface JQuery { + dxChart(): JQuery; + dxChart(options: "instance"): DevExpress.viz.dxChart; + dxChart(options: string): any; + dxChart(options: string, ...params: any[]): any; + dxChart(options: DevExpress.viz.charts.dxChartOptions): JQuery; +} +interface JQuery { + dxCircularGauge(): JQuery; + dxCircularGauge(options: "instance"): DevExpress.viz.dxCircularGauge; + dxCircularGauge(options: string): any; + dxCircularGauge(options: string, ...params: any[]): any; + dxCircularGauge(options: DevExpress.viz.gauges.dxCircularGaugeOptions): JQuery; +} +interface JQuery { + dxLinearGauge(): JQuery; + dxLinearGauge(options: "instance"): DevExpress.viz.dxLinearGauge; + dxLinearGauge(options: string): any; + dxLinearGauge(options: string, ...params: any[]): any; + dxLinearGauge(options: DevExpress.viz.gauges.dxLinearGaugeOptions): JQuery; +} +interface JQuery { + dxPieChart(): JQuery; + dxPieChart(options: "instance"): DevExpress.viz.dxPieChart; + dxPieChart(options: string): any; + dxPieChart(options: string, ...params: any[]): any; + dxPieChart(options: DevExpress.viz.charts.dxPieChartOptions): JQuery; +} +interface JQuery { + dxPolarChart(): JQuery; + dxPolarChart(options: "instance"): DevExpress.viz.dxPolarChart; + dxPolarChart(options: string): any; + dxPolarChart(options: string, ...params: any[]): any; + dxPolarChart(options: DevExpress.viz.charts.dxPolarChartOptions): JQuery; +} +interface JQuery { + dxRangeSelector(): JQuery; + dxRangeSelector(options: "instance"): DevExpress.viz.dxRangeSelector; + dxRangeSelector(options: string): any; + dxRangeSelector(options: string, ...params: any[]): any; + dxRangeSelector(options: DevExpress.viz.rangeSelector.dxRangeSelectorOptions): JQuery; +} +interface JQuery { + dxSparkline(): JQuery; + dxSparkline(options: "instance"): DevExpress.viz.dxSparkline; + dxSparkline(options: string): any; + dxSparkline(options: string, ...params: any[]): any; + dxSparkline(options: DevExpress.viz.sparklines.dxSparklineOptions): JQuery; +} +interface JQuery { + dxTreeMap(): JQuery; + dxTreeMap(options: "instance"): DevExpress.viz.dxTreeMap; + dxTreeMap(options: string): any; + dxTreeMap(options: string, ...params: any[]): any; + dxTreeMap(options: DevExpress.viz.treeMap.dxTreeMapOptions): JQuery; +} +interface JQuery { + dxVectorMap(): JQuery; + dxVectorMap(options: "instance"): DevExpress.viz.dxVectorMap; + dxVectorMap(options: string): any; + dxVectorMap(options: string, ...params: any[]): any; + dxVectorMap(options: DevExpress.viz.map.dxVectorMapOptions): JQuery; +} declare module DevExpress { /** Formats values. */ export interface Format { @@ -68,9 +530,9 @@ declare module DevExpress { export function resetGroup(): void; /** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */ export function validateModel(model: Object): ValidationGroupValidationResult; - /** Registers all the dxValidator objects extending fields of the specified ViewModel. */ + /** Registers all the Validator objects extending fields of the specified ViewModel. */ export function registerModelForValidation(model: Object): void; - /** Unregisters all the dxValidator objects extending fields of the specified ViewModel. */ + /** Unregisters all the Validator objects extending fields of the specified ViewModel. */ export function unregisterModelForValidation(model: Object): void; } export var hardwareBackButton: JQueryCallback; @@ -78,10 +540,7 @@ declare module DevExpress { export function processHardwareBackButton(): void; /** Hides the last displayed overlay widget. */ export function hideTopOverlay(): boolean; - /** - * Specifies whether or not the entire application/site supports right-to-left representation. - * @deprecated Use the config(config) method instead. - */ + /** * Specifies whether or not the entire application/site supports right-to-left representation. * @deprecated Use the config(config) method instead. */ export var rtlEnabled: boolean; /** Gets the current global configuration object. */ export function config(): Object; @@ -265,6 +724,8 @@ declare module DevExpress { height?: any; /** Specifies the width of the widget. */ width?: any; + /** Specifies the attributes to be attached to the widget's root element. */ + elementAttr?: Object; /** A bag for holding any options that require two-way binding (Angular approach specific) */ bindingOptions?: { [key: string]: any; }; } @@ -312,6 +773,9 @@ declare module DevExpress { key?: any; } export interface LoadOptions { + searchValue?: Object; + searchExpr?: Object; + searchOperation?: Object; filter?: Object; sort?: Object; select?: Object; @@ -682,25 +1146,34 @@ declare module DevExpress { /** Creates a Query instance for accessing the remote service specified by a URL. */ export function query(url: string, queryOptions: Object): Query; /** This section describes the utility objects provided by the DevExtreme data layer. */ - export var utils: { + export module utils { /** Compiles a getter function from the getter expression. */ - compileGetter(expr: any): Function; + export function compileGetter(expr: any): Function; /** Compiles a setter function from the setter expression. */ - compileSetter(expr: any): Function; - odata: { + export function compileSetter(expr: any): Function; + export module odata { /** Holds key value converters for OData. */ - keyConverters: { - String(value: any): string; - Int32(value: any): number; - Int64(value: any): EdmLiteral; - Guid(value: any): Guid; - Boolean(value: any): boolean; - Single(value: any): EdmLiteral; - Decimal(value: any): EdmLiteral; - }; + export module keyConverters { + export function String(value: any): string; + export function Int32(value: any): number; + export function Int64(value: any): EdmLiteral; + export function Guid(value: any): Guid; + export function Boolean(value: any): boolean; + export function Single(value: any): EdmLiteral; + export function Decimal(value: any): EdmLiteral; + } } } } + /** An object that serves as a namespace for the methods that are used to localize an application. */ + export module localization { + /** Gets the current locale identifier. */ + export function locale(): string; + /** Sets the current locale identifier. */ + export function locale(locale: string): void; + /** Loads DevExtreme messages. */ + export function loadMessages(messages: any): void; + } /** An object that serves as a namespace for DevExtreme UI widgets as well as for methods implementing UI logic in DevExtreme sites/applications. */ export module ui { export interface WidgetOptions extends DOMComponentOptions { @@ -760,6 +1233,10 @@ declare module DevExpress { selectedItem?: Object; /** An array of currently selected item objects. */ selectedItems?: Array; + /** Specifies an array of currently selected item keys. */ + selectedItemKeys?: Array; + /** Specifies which data field provides keys for widget items. */ + keyExpr?: any; /** A handler for the itemDeleting event. */ onItemDeleting?: Function; /** A handler for the itemDeleted event. */ @@ -767,8 +1244,13 @@ declare module DevExpress { /** A handler for the itemReordered event. */ onItemReordered?: Function; } + export interface DataHelperMixin { + /** Allows you to get the DataSource instance. */ + getDataSource(): DevExpress.data.DataSource; + } /** The base class for widgets containing an item collection. */ - export class CollectionWidget extends Widget { + export class CollectionWidget extends Widget implements DataHelperMixin + { constructor(element: JQuery, options?: CollectionWidgetOptions); constructor(element: HTMLElement, options?: CollectionWidgetOptions); selectItem(itemElement: any): void; @@ -776,6 +1258,7 @@ declare module DevExpress { deleteItem(itemElement: any): JQueryPromise; isItemSelected(itemElement: any): boolean; reorderItem(itemElement: any, toItemElement: any): JQueryPromise; + getDataSource(): DevExpress.data.DataSource; } export interface DataExpressionMixinOptions { /** A data source used to fetch data to be displayed by the widget. */ @@ -794,6 +1277,8 @@ declare module DevExpress { export interface EditorOptions extends WidgetOptions { /** The currently specified value. */ value?: Object; + /** The value to be assigned to the name attribute of the underlying `` element. */ + name?: string; /** A handler for the valueChanged event. */ onValueChanged?: Function; /** A Boolean value specifying whether or not the widget is read-only. */ @@ -840,14 +1325,14 @@ declare module DevExpress { export function setTemplateEngine(options: Object): void; } /** An object that serves as a namespace for utility methods that can be helpful when working with the DevExtreme framework and UI widgets. */ - export var utils: { + export module utils { /** Sets parameters for the viewport meta tag. */ - initMobileViewport(options: { allowZoom?: boolean; allowPan?: boolean; allowSelection?: boolean }): void; + export function initMobileViewport(options: { allowZoom?: boolean; allowPan?: boolean; allowSelection?: boolean }): void; /** Requests that the browser call a specified function to update animation before the next repaint. */ - requestAnimationFrame(callback: Function): number; + export function requestAnimationFrame(callback: Function): number; /** Cancels an animation frame request scheduled with the requestAnimationFrame method. */ - cancelAnimationFrame(requestID: number): void; - }; + export function cancelAnimationFrame(requestID: number): void; + } /** An object that serves as a namespace for DevExtreme Data Visualization Widgets. */ export module viz { /** Applies a theme for the entire page with several DevExtreme visualization widgets. */ @@ -897,15 +1382,18 @@ declare module DevExpress.ui { export class dxValidator extends DOMComponent implements validationEngine.IValidator { constructor(element: JQuery, options?: dxValidatorOptions); constructor(element: Element, options?: dxValidatorOptions); - /** Validates the value of the editor that is controlled by the current dxValidator object against the list of the specified validation rules. */ + /** Validates the value of the editor that is controlled by the current Validator object against the list of the specified validation rules. */ validate(): validationEngine.ValidatorValidationResult; - /** Resets the value and validation result of the editor associated with the current dxValidator object. */ + /** Resets the value and validation result of the editor associated with the current Validator object. */ reset(): void; + /** Sets focus to the editor associated with the current Validator object. */ + focus(): void; } + export interface dxValidationGroupOptions extends DOMComponentOptions { } /** The widget that is used in the Knockout and AngularJS approaches to combine the editors to be validated. */ export class dxValidationGroup extends DOMComponent { - constructor(element: JQuery); - constructor(element: Element); + constructor(element: JQuery, options?: dxValidationGroupOptions); + constructor(element: Element, options?: dxValidationGroupOptions); /** Validates rules of the validators that belong to the current validation group. */ validate(): validationEngine.ValidationGroupValidationResult; /** Resets the value and validation result of the editors that are included to the current validation group. */ @@ -969,10 +1457,7 @@ declare module DevExpress.ui { valueChangeEvent?: string; /** Specifies whether or not the widget supports searching. */ searchEnabled?: boolean; - /** - * Specifies whether or not the widget displays items by pages. - * @deprecated Use the DataSource paging opportunities instead. - */ + /** * Specifies whether or not the widget displays items by pages. * @deprecated Use the DataSource paging opportunities instead. */ pagingEnabled?: boolean; /** The text or HTML markup displayed by the widget if the item collection is empty. */ noDataText?: string; @@ -983,9 +1468,10 @@ declare module DevExpress.ui { onContentReady?: Function; } /** A base class for drop-down list widgets. */ - export class dxDropDownList extends dxDropDownEditor { + export class dxDropDownList extends dxDropDownEditor implements DataHelperMixin { constructor(element: JQuery, options?: dxDropDownListOptions); constructor(element: Element, options?: dxDropDownListOptions); + getDataSource(): DevExpress.data.DataSource; } export interface dxToolbarOptions extends CollectionWidgetOptions { /** The template used to render menu items. */ @@ -1059,8 +1545,9 @@ declare module DevExpress.ui { valueChangeEvent?: string; /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ spellcheck?: boolean; - /** Specifies HTML attributes applied to the inner input element of the widget. */ attr?: Object; + /** Specifies the attributes to be passed on to the underlying `` element. */ + inputAttr?: Object; /** The read-only option that holds the text displayed by the widget input element. */ text?: string; focusStateEnabled?: boolean; @@ -1075,6 +1562,7 @@ declare module DevExpress.ui { maskInvalidMessage?: string; /** Specifies whether the value option holds only characters entered by a user or prompt characters as well. */ useMaskedValue?: boolean; + name?: string; } /** A base class for text editing widgets. */ export class dxTextEditor extends Editor { @@ -1278,6 +1766,7 @@ declare module DevExpress.ui { activeStateEnabled?: boolean; /** Specifies the radio group layout. */ layout?: string; + name?: string; } /** A widget that enables a user to select one item within a list of items represented by radio buttons. */ export class dxRadioGroup extends CollectionWidget { @@ -1356,6 +1845,20 @@ declare module DevExpress.ui { target?: any; /** Specifies the width of the widget. */ width?: any; + /** Specifies options for displaying the widget. */ + showEvent?: { + /** Specifies the event names on which the widget is shown. */ + name?: String; + /** The time span after which the widget is shown. */ + delay?: Number; + }; + /** Specifies options of popover hiding. */ + hideEvent?: { + /** Specifies the event names on which the widget is hidden. */ + name?: String; + /** The time span after which the popover is hidden. */ + delay?: Number; + }; } /** A widget that displays the required content in a popup window. */ export class dxPopover extends dxPopup { @@ -1628,10 +2131,7 @@ declare module DevExpress.ui { shading?: boolean; /** Specifies whether to display the Cancel button in the lookup window. */ showCancelButton?: boolean; - /** - * A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. - * @deprecated Use the pageLoadMode option instead. - */ + /** * A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. * @deprecated Use the pageLoadMode option instead. */ showNextButton?: boolean; /** The title of the lookup window. */ title?: string; @@ -1751,6 +2251,8 @@ declare module DevExpress.ui { showSelectionControls?: boolean; /** Specifies item selection mode. */ selectionMode?: string; + /** Specifies the mode in which all items are selected. */ + selectAllMode?: string; selectAllText?: string; /** A handler for the selectAllValueChanged event. */ onSelectAllValueChanged?: Function; @@ -1898,17 +2400,11 @@ declare module DevExpress.ui { min?: any; /** The text displayed by the widget when the widget value is not yet specified. This text is also used as a title of the date picker. */ placeholder?: string; - /** - * Specifies whether or not a user can pick out a date using the drop-down calendar. - * @deprecated Use the pickerType option instead. - */ + /** * Specifies whether or not a user can pick out a date using the drop-down calendar. * @deprecated Use the pickerType option instead. */ useCalendar?: boolean; /** An object or a value, specifying the date and time currently selected using the date box. */ value?: any; - /** - * Specifies whether or not the widget uses the native HTML input element. - * @deprecated Use the pickerType option instead. - */ + /** * Specifies whether or not the widget uses the native HTML input element. * @deprecated Use the pickerType option instead. */ useNative?: boolean; /** Specifies the interval between neighboring values in the popup list in minutes. */ interval?: number; @@ -1940,6 +2436,7 @@ declare module DevExpress.ui { value?: boolean; /** Specifies the text displayed by the check box. */ text?: string; + name?: string; } /** A check box widget. */ export class dxCheckBox extends Editor { @@ -1968,6 +2465,7 @@ declare module DevExpress.ui { minZoomLevel?: string; /** The template to be used for rendering calendar cells. */ cellTemplate?: any; + name?: string; } /** A calendar widget. */ export class dxCalendar extends Editor { @@ -1990,6 +2488,8 @@ declare module DevExpress.ui { type?: string; /** Specifies the name of the validation group to be accessed in the click event handler. */ validationGroup?: string; + /** Specifies whether the button must submit an HTML form. */ + useSubmitBehavior?: boolean; } /** A button widget. */ export class dxButton extends Widget { @@ -2134,8 +2634,6 @@ declare module DevExpress.ui { min?: number; /** The maximum value the widget can accept. */ max?: number; - /** The current widget value. */ - value?: number; } /** A base class for track bar widgets. */ export class dxTrackBar extends Editor { @@ -2149,18 +2647,18 @@ declare module DevExpress.ui { showStatus?: boolean; /** A handler for the complete event. */ onComplete?: Function; + /** The current widget value. */ + value?: number; } /** A widget used to indicate progress. */ export class dxProgressBar extends dxTrackBar { constructor(element: JQuery, options?: dxProgressBarOptions); constructor(element: Element, options?: dxProgressBarOptions); } - export interface dxSliderOptions extends dxTrackBarOptions { + export interface dxSliderBaseOptions extends dxTrackBarOptions { activeStateEnabled?: boolean; /** The slider step size. */ step?: number; - /** The current slider value. */ - value?: number; /** Specifies whether or not to highlight a range selected within the widget. */ showRange?: boolean; /** Specifies the size of a step by which a slider handle is moved when a user uses the Page up or Page down keyboard shortcuts. */ @@ -2185,17 +2683,27 @@ declare module DevExpress.ui { /** Specifies a format for labels. */ format?: any; }; + name?: string; + } + export interface dxSliderOptions extends dxSliderBaseOptions { + /** The current slider value. */ + value?: number; } /** A widget that allows a user to select a numeric value within a given range. */ export class dxSlider extends dxTrackBar { constructor(element: JQuery, options?: dxSliderOptions); constructor(element: Element, options?: dxSliderOptions); } - export interface dxRangeSliderOptions extends dxSliderOptions { + export interface dxRangeSliderOptions extends dxSliderBaseOptions { /** The left edge of the interval currently selected using the range slider. */ start?: number; /** The right edge of the interval currently selected using the range slider. */ end?: number; + /** The value to be assigned to the name attribute of the underlying `` element. */ + startName?: string; + /** The value to be assigned to the name attribute of the underlying `` element. */ + endName?: string; + value?: Array; } /** A widget that enables a user to select a range of numeric values. */ export class dxRangeSlider extends dxSlider { @@ -2226,10 +2734,12 @@ declare module DevExpress.ui { /** Specifies the number of columns spanned by the item. */ colSpan?: number; } + /** This article describes configuration options of an empty form item. */ export interface dxFormEmptyItem extends dxFormItem { /** Specifies the form item name. */ name?: string; } + /** This article describes configuration options of a simple form item. */ export interface dxFormSimpleItem extends dxFormItem { /** Specifies the path to the formData object field bound to the current form item. */ dataField?: string; @@ -2261,6 +2771,7 @@ declare module DevExpress.ui { /** The count of columns for a large screen size. */ lg?: number; } + /** This article describes configuration options of a group form item. */ export interface dxFormGroupItem extends dxFormItem { /** Specifies the group caption. */ caption?: string; @@ -2297,6 +2808,7 @@ declare module DevExpress.ui { /** The template to be used for rendering the tab content. */ template?: any; } + /** This article describes configuration options of a tabbed form item. */ export interface dxFormTabbedItem extends dxFormItem { /** Holds a configuration object for the TabPanel widget used to display the current form item. */ tabPanelOptions?: Object; @@ -2346,6 +2858,8 @@ declare module DevExpress.ui { items?: Array; /** A Boolean value specifying whether to enable or disable form scrolling. */ scrollingEnabled?: boolean; + /** Gives a name to the internal validation group. */ + validationGroup?: string; onContentReady?: Function; } /** A form widget used to display and edit values of object fields. */ @@ -2391,228 +2905,34 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxDeferRenderingOptions); } } +/* Private plugins. To be removed */ interface JQuery { - dxProgressBar(): JQuery; - dxProgressBar(options: "instance"): DevExpress.ui.dxProgressBar; - dxProgressBar(options: string): any; - dxProgressBar(options: string, ...params: any[]): any; - dxProgressBar(options: DevExpress.ui.dxProgressBarOptions): JQuery; - dxSlider(): JQuery; - dxSlider(options: "instance"): DevExpress.ui.dxSlider; - dxSlider(options: string): any; - dxSlider(options: string, ...params: any[]): any; - dxSlider(options: DevExpress.ui.dxSliderOptions): JQuery; - dxRangeSlider(): JQuery; - dxRangeSlider(options: "instance"): DevExpress.ui.dxRangeSlider; - dxRangeSlider(options: string): any; - dxRangeSlider(options: string, ...params: any[]): any; - dxRangeSlider(options: DevExpress.ui.dxRangeSliderOptions): JQuery; - dxFileUploader(): JQuery; - dxFileUploader(options: "instance"): DevExpress.ui.dxFileUploader; - dxFileUploader(options: string): any; - dxFileUploader(options: string, ...params: any[]): any; - dxFileUploader(options: DevExpress.ui.dxFileUploaderOptions): JQuery; - dxValidator(): JQuery; - dxValidator(options: "instance"): DevExpress.ui.dxValidator; - dxValidator(options: string): any; - dxValidator(options: string, ...params: any[]): any; - dxValidator(options: DevExpress.ui.dxValidatorOptions): JQuery; - dxValidationGroup(): JQuery; - dxValidationGroup(options: "instance"): DevExpress.ui.dxValidationGroup; - dxValidationGroup(options: string): any; - dxValidationGroup(options: string, ...params: any[]): any; - dxValidationSummary(): JQuery; - dxValidationSummary(options: "instance"): DevExpress.ui.dxValidationSummary; - dxValidationSummary(options: string): any; - dxValidationSummary(options: string, ...params: any[]): any; - dxValidationSummary(options: DevExpress.ui.dxValidationSummaryOptions): JQuery; - dxTooltip(): JQuery; - dxTooltip(options: "instance"): DevExpress.ui.dxTooltip; - dxTooltip(options: string): any; - dxTooltip(options: string, ...params: any[]): any; - dxTooltip(options: DevExpress.ui.dxTooltipOptions): JQuery; - dxResizable(): JQuery; - dxResizable(options: "instance"): DevExpress.ui.dxResizable; - dxResizable(options: string): any; - dxResizable(options: string, ...params: any[]): any; - dxResizable(options: DevExpress.ui.dxResizableOptions): JQuery; dxDropDownList(): JQuery; dxDropDownList(options: "instance"): DevExpress.ui.dxDropDownList; dxDropDownList(options: string): any; dxDropDownList(options: string, ...params: any[]): any; dxDropDownList(options: DevExpress.ui.dxDropDownListOptions): JQuery; - dxToolbar(): JQuery; - dxToolbar(options: "instance"): DevExpress.ui.dxToolbar; - dxToolbar(options: string): any; - dxToolbar(options: string, ...params: any[]): any; - dxToolbar(options: DevExpress.ui.dxToolbarOptions): JQuery; - dxToast(): JQuery; - dxToast(options: "instance"): DevExpress.ui.dxToast; - dxToast(options: string): any; - dxToast(options: string, ...params: any[]): any; - dxToast(options: DevExpress.ui.dxToastOptions): JQuery; dxTextEditor(): JQuery; dxTextEditor(options: "instance"): DevExpress.ui.dxTextEditor; dxTextEditor(options: string): any; dxTextEditor(options: string, ...params: any[]): any; dxTextEditor(options: DevExpress.ui.dxTextEditorOptions): JQuery; - dxTextBox(): JQuery; - dxTextBox(options: "instance"): DevExpress.ui.dxTextBox; - dxTextBox(options: string): any; - dxTextBox(options: string, ...params: any[]): any; - dxTextBox(options: DevExpress.ui.dxTextBoxOptions): JQuery; - dxTextArea(): JQuery; - dxTextArea(options: "instance"): DevExpress.ui.dxTextArea; - dxTextArea(options: string): any; - dxTextArea(options: string, ...params: any[]): any; - dxTextArea(options: DevExpress.ui.dxTextAreaOptions): JQuery; - dxTabs(): JQuery; - dxTabs(options: "instance"): DevExpress.ui.dxTabs; - dxTabs(options: string): any; - dxTabs(options: string, ...params: any[]): any; - dxTabs(options: DevExpress.ui.dxTabsOptions): JQuery; - dxTabPanel(): JQuery; - dxTabPanel(options: "instance"): DevExpress.ui.dxTabPanel; - dxTabPanel(options: string): any; - dxTabPanel(options: string, ...params: any[]): any; - dxTabPanel(options: DevExpress.ui.dxTabPanelOptions): JQuery; - dxSelectBox(): JQuery; - dxSelectBox(options: "instance"): DevExpress.ui.dxSelectBox; - dxSelectBox(options: string): any; - dxSelectBox(options: string, ...params: any[]): any; - dxSelectBox(options: DevExpress.ui.dxSelectBoxOptions): JQuery; - dxTagBox(): JQuery; - dxTagBox(options: "instance"): DevExpress.ui.dxTagBox; - dxTagBox(options: string): any; - dxTagBox(options: string, ...params: any[]): any; - dxTagBox(options: DevExpress.ui.dxTagBoxOptions): JQuery; - dxScrollView(): JQuery; - dxScrollView(options: "instance"): DevExpress.ui.dxScrollView; - dxScrollView(options: string): any; - dxScrollView(options: string, ...params: any[]): any; - dxScrollView(options: DevExpress.ui.dxScrollViewOptions): JQuery; dxScrollable(): JQuery; dxScrollable(options: "instance"): DevExpress.ui.dxScrollable; dxScrollable(options: string): any; dxScrollable(options: string, ...params: any[]): any; dxScrollable(options: DevExpress.ui.dxScrollableOptions): JQuery; - dxRadioGroup(): JQuery; - dxRadioGroup(options: "instance"): DevExpress.ui.dxRadioGroup; - dxRadioGroup(options: string): any; - dxRadioGroup(options: string, ...params: any[]): any; - dxRadioGroup(options: DevExpress.ui.dxRadioGroupOptions): JQuery; - dxPopup(): JQuery; - dxPopup(options: "instance"): DevExpress.ui.dxPopup; - dxPopup(options: string): any; - dxPopup(options: string, ...params: any[]): any; - dxPopup(options: DevExpress.ui.dxPopupOptions): JQuery; - dxPopover(): JQuery; - dxPopover(options: "instance"): DevExpress.ui.dxPopover; - dxPopover(options: string): any; - dxPopover(options: string, ...params: any[]): any; - dxPopover(options: DevExpress.ui.dxPopoverOptions): JQuery; dxOverlay(): JQuery; dxOverlay(options: "instance"): DevExpress.ui.dxOverlay; dxOverlay(options: string): any; dxOverlay(options: string, ...params: any[]): any; dxOverlay(options: DevExpress.ui.dxOverlayOptions): JQuery; - dxNumberBox(): JQuery; - dxNumberBox(options: "instance"): DevExpress.ui.dxNumberBox; - dxNumberBox(options: string): any; - dxNumberBox(options: string, ...params: any[]): any; - dxNumberBox(options: DevExpress.ui.dxNumberBoxOptions): JQuery; - dxNavBar(): JQuery; - dxNavBar(options: "instance"): DevExpress.ui.dxNavBar; - dxNavBar(options: string): any; - dxNavBar(options: string, ...params: any[]): any; - dxNavBar(options: DevExpress.ui.dxNavBarOptions): JQuery; - dxMultiView(): JQuery; - dxMultiView(options: "instance"): DevExpress.ui.dxMultiView; - dxMultiView(options: string): any; - dxMultiView(options: string, ...params: any[]): any; - dxMultiView(options: DevExpress.ui.dxMultiViewOptions): JQuery; - dxMap(): JQuery; - dxMap(options: "instance"): DevExpress.ui.dxMap; - dxMap(options: string): any; - dxMap(options: string, ...params: any[]): any; - dxMap(options: DevExpress.ui.dxMapOptions): JQuery; - dxLookup(): JQuery; - dxLookup(options: "instance"): DevExpress.ui.dxLookup; - dxLookup(options: string): any; - dxLookup(options: string, ...params: any[]): any; - dxLookup(options: DevExpress.ui.dxLookupOptions): JQuery; - dxLoadPanel(): JQuery; - dxLoadPanel(options: "instance"): DevExpress.ui.dxLoadPanel; - dxLoadPanel(options: string): any; - dxLoadPanel(options: string, ...params: any[]): any; - dxLoadPanel(options: DevExpress.ui.dxLoadPanelOptions): JQuery; - dxLoadIndicator(): JQuery; - dxLoadIndicator(options: "instance"): DevExpress.ui.dxLoadIndicator; - dxLoadIndicator(options: string): any; - dxLoadIndicator(options: string, ...params: any[]): any; - dxLoadIndicator(options: DevExpress.ui.dxLoadIndicatorOptions): JQuery; - dxList(): JQuery; - dxList(options: "instance"): DevExpress.ui.dxList; - dxList(options: string): any; - dxList(options: string, ...params: any[]): any; - dxList(options: DevExpress.ui.dxListOptions): JQuery; - dxGallery(): JQuery; - dxGallery(options: "instance"): DevExpress.ui.dxGallery; - dxGallery(options: string): any; - dxGallery(options: string, ...params: any[]): any; - dxGallery(options: DevExpress.ui.dxGalleryOptions): JQuery; dxDropDownEditor(): JQuery; dxDropDownEditor(options: "instance"): DevExpress.ui.dxDropDownEditor; dxDropDownEditor(options: string): any; dxDropDownEditor(options: string, ...params: any[]): any; dxDropDownEditor(options: DevExpress.ui.dxDropDownEditorOptions): JQuery; - dxDateBox(): JQuery; - dxDateBox(options: "instance"): DevExpress.ui.dxDateBox; - dxDateBox(options: string): any; - dxDateBox(options: string, ...params: any[]): any; - dxDateBox(options: DevExpress.ui.dxDateBoxOptions): JQuery; - dxCheckBox(): JQuery; - dxCheckBox(options: "instance"): DevExpress.ui.dxCheckBox; - dxCheckBox(options: string): any; - dxCheckBox(options: string, ...params: any[]): any; - dxCheckBox(options: DevExpress.ui.dxCheckBoxOptions): JQuery; - dxBox(): JQuery; - dxBox(options: "instance"): DevExpress.ui.dxBox; - dxBox(options: string): any; - dxBox(options: string, ...params: any[]): any; - dxBox(options: DevExpress.ui.dxBoxOptions): JQuery; - dxButton(): JQuery; - dxButton(options: "instance"): DevExpress.ui.dxButton; - dxButton(options: string): any; - dxButton(options: string, ...params: any[]): any; - dxButton(options: DevExpress.ui.dxButtonOptions): JQuery; - dxCalendar(): JQuery; - dxCalendar(options: "instance"): DevExpress.ui.dxCalendar; - dxCalendar(options: string): any; - dxCalendar(options: string, ...params: any[]): any; - dxCalendar(options: DevExpress.ui.dxCalendarOptions): JQuery; - dxAccordion(): JQuery; - dxAccordion(options: "instance"): DevExpress.ui.dxAccordion; - dxAccordion(options: string): any; - dxAccordion(options: string, ...params: any[]): any; - dxAccordion(options: DevExpress.ui.dxAccordionOptions): JQuery; - dxResponsiveBox(): JQuery; - dxResponsiveBox(options: "instance"): DevExpress.ui.dxResponsiveBox; - dxResponsiveBox(options: string): any; - dxResponsiveBox(options: string, ...params: any[]): any; - dxResponsiveBox(options: DevExpress.ui.dxResponsiveBoxOptions): JQuery; - dxAutocomplete(): JQuery; - dxAutocomplete(options: "instance"): DevExpress.ui.dxAutocomplete; - dxAutocomplete(options: string): any; - dxAutocomplete(options: string, ...params: any[]): any; - dxAutocomplete(options: DevExpress.ui.dxAutocompleteOptions): JQuery; - dxForm(): JQuery; - dxForm(options: "instance"): DevExpress.ui.dxForm; - dxForm(options: string): any; - dxForm(options: string, ...params: any[]): any; - dxForm(options: DevExpress.ui.dxFormOptions): JQuery; } - declare module DevExpress.ui { export interface dxTileViewOptions extends CollectionWidgetOptions { /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ @@ -2645,6 +2965,7 @@ declare module DevExpress.ui { onText?: string; /** A Boolean value specifying whether the current switch state is "On" or "Off". */ value?: boolean; + name?: string; } /** A switch widget. */ export class dxSwitch extends Editor { @@ -2812,43 +3133,6 @@ declare module DevExpress.ui { toggle(showing: boolean): JQueryPromise; } } -interface JQuery { - dxTileView(): JQuery; - dxTileView(options: "instance"): DevExpress.ui.dxTileView; - dxTileView(options: string): any; - dxTileView(options: string, ...params: any[]): any; - dxTileView(options: DevExpress.ui.dxTileViewOptions): JQuery; - dxSwitch(): JQuery; - dxSwitch(options: "instance"): DevExpress.ui.dxSwitch; - dxSwitch(options: string): any; - dxSwitch(options: string, ...params: any[]): any; - dxSwitch(options: DevExpress.ui.dxSwitchOptions): JQuery; - dxSlideOut(): JQuery; - dxSlideOut(options: "instance"): DevExpress.ui.dxSlideOut; - dxSlideOut(options: string): any; - dxSlideOut(options: string, ...params: any[]): any; - dxSlideOut(options: DevExpress.ui.dxSlideOutOptions): JQuery; - dxPivot(): JQuery; - dxPivot(options: "instance"): DevExpress.ui.dxPivot; - dxPivot(options: string): any; - dxPivot(options: string, ...params: any[]): any; - dxPivot(options: DevExpress.ui.dxPivotOptions): JQuery; - dxPanorama(): JQuery; - dxPanorama(options: "instance"): DevExpress.ui.dxPanorama; - dxPanorama(options: string): any; - dxPanorama(options: string, ...params: any[]): any; - dxPanorama(options: DevExpress.ui.dxPanoramaOptions): JQuery; - dxActionSheet(): JQuery; - dxActionSheet(options: "instance"): DevExpress.ui.dxActionSheet; - dxActionSheet(options: string): any; - dxActionSheet(options: string, ...params: any[]): any; - dxActionSheet(options: DevExpress.ui.dxActionSheetOptions): JQuery; - dxDropDownMenu(): JQuery; - dxDropDownMenu(options: "instance"): DevExpress.ui.dxDropDownMenu; - dxDropDownMenu(options: string): any; - dxDropDownMenu(options: string, ...params: any[]): any; - dxDropDownMenu(options: DevExpress.ui.dxDropDownMenuOptions): JQuery; -} declare module DevExpress.data { export interface XmlaStoreOptions { /** The HTTP address to an XMLA OLAP server. */ @@ -2884,7 +3168,7 @@ declare module DevExpress.data { value?: any; totalValue?: any; }) => void; - /** Specifies the function that determines how to split data from the data source into ranges for header items. Cannot be used for the XmlaStore store type. */ + /** Specifies the function that determines how to split data from the data source into ranges for header items. Cannot be used for the XmlaStore store type and along with remote operations. */ selector?: (data: Object) => any; /** Type of the area where the field is located. */ area?: string; @@ -2918,10 +3202,7 @@ declare module DevExpress.data { format?: any; /** Specifies a callback function that returns the text to be displayed in the cells of a field. */ customizeText?: (cellInfo: { value: any; valueText: string }) => string; - /** - * Specifies a precision for formatted field values. - * @deprecated Use the format | precision option instead. - */ + /** * Specifies a precision for formatted field values. * @deprecated Use the format | precision option instead. */ precision?: number; /** Specifies how to sort the header items. */ sortingMethod?: (a: Object, b: Object) => number; @@ -2989,6 +3270,8 @@ declare module DevExpress.data { filter?: Object; /** An array of pivot grid fields. */ fields?: Array; + /** Specifies whether or not all the operations (filtering, grouping and summary calculation) are performed remotely. */ + remoteOperations?: boolean; /** A handler for the changed event. */ onChanged?: () => void; /** A handler for the loadingChanged event. */ @@ -3052,6 +3335,34 @@ declare module DevExpress.data { } } declare module DevExpress.ui { + export interface dxSchedulerViewOptions { + /** The name of the view. */ + type?: string; + /** The first day of a week. */ + firstDayOfWeek?: number; + /** The resource kinds by which appointments are grouped. */ + groups?: Array; + /** The start hour of the view time scale. */ + startDayHour?: number; + /** The end hour of the view time scale. */ + endDayHour?: number; + /** The cell duration in minutes. */ + cellDuration?: number; + /** Specifies the number of dates that can be shown at a time in the agenda view. */ + agendaDuration?: number; + /** The template to be used for rendering appointments. */ + appointmentTemplate?: any; + /** The template to be used for rendering an appointment tooltip. */ + appointmentTooltipTemplate?: any; + /** The template to be used for rendering table cells. */ + dataCellTemplate?: any; + /** The template to be used for rendering time scale items. */ + timeCellTemplate?: any; + /** The template to be used for rendering date scale items. */ + dateCellTemplate?: any; + /** The template to be used for rendering resource headers. */ + resourceCellTemplate?: any; + } export interface dxSchedulerOptions extends WidgetOptions { /** Specifies a date displayed on the current scheduler view by default. */ currentDate?: any; @@ -3069,8 +3380,16 @@ declare module DevExpress.ui { appointmentTemplate?: any; /** The template to be used for rendering an appointment tooltip. */ appointmentTooltipTemplate?: any; + /** The template to be used for rendering table cells. */ + dataCellTemplate?: any; + /** The template to be used for rendering time scale items. */ + timeCellTemplate?: any; + /** The template to be used for rendering date scale items. */ + dateCellTemplate?: any; + /** The template to be used for rendering resource headers. */ + resourceCellTemplate?: any; /** Lists the views to be available within the scheduler's View Selector. */ - views?: Array; + views?: Array; /** Specifies the resource kinds by which the scheduler's appointments are grouped in a timetable. */ groups?: Array; /** Specifies a start hour in the scheduler view's time interval. */ @@ -3100,10 +3419,7 @@ declare module DevExpress.ui { resources?: Array<{ /** Indicates whether or not several resources of this kind can be assigned to an appointment. */ allowMultiple?: boolean; - /** - * Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. - * @deprecated Use the useColorAsDefault option instead. - */ + /** * Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. * @deprecated Use the useColorAsDefault option instead. */ mainColor?: boolean; /** Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. */ useColorAsDefault?: boolean; @@ -3113,13 +3429,12 @@ declare module DevExpress.ui { displayExpr?: any; /** Specifies the resource object field that is used as a value of the Resource editor in the Appointment popup window. */ valueExpr?: any; - /** - * The name of the appointment object field that specifies a resource of this kind. - * @deprecated Use the fieldExpr option instead. - */ + /** * The name of the appointment object field that specifies a resource of this kind. * @deprecated Use the fieldExpr option instead. */ field?: string; /** The name of the appointment object field that specifies a resource of this kind. */ fieldExpr?: string; + /** Specifies the resource object field that is used as a resource color. */ + colorExpr?: string; /** Specifies the label of the Appointment popup window field that allows end users to assign a resource of this kind. */ label?: string; }>; @@ -3178,7 +3493,9 @@ declare module DevExpress.ui { noDataText?: string; } /** A widget that displays scheduled data using different views and provides the capability to load, add and edit appointments. */ - export class dxScheduler extends Widget { + export class dxScheduler extends Widget + implements DataHelperMixin + { constructor(element: JQuery, options?: dxSchedulerOptions); constructor(element: Element, options?: dxSchedulerOptions); /** Add the appointment defined by the object passed as a parameter to the data associated with the widget. */ @@ -3189,12 +3506,21 @@ declare module DevExpress.ui { deleteAppointment(appointment: Object): void; /** Scrolls the scheduler work space to the specified time of the specified day. */ scrollToTime(hours: number, minutes: number, date: Date): void; - /** Displayes the Appointment Details popup. */ + /** Displays the Appointment Details popup. */ showAppointmentPopup(appointmentData: Object, createNewAppointment?: boolean, currentAppointmentData?: Object): void; + /** Hides an appointment details popup. */ + hideAppointmentPopup(saveChanges?: boolean): void; + /** Displays the appointment tooltip for the specified target element. */ + showAppointmentTooltip(appointmentData: Object, target?: JQuery, currentAppointmentData?: Object): void; + showAppointmentTooltip(appointmentData: Object, target?: Element, currentAppointmentData?: Object): void; + showAppointmentTooltip(appointmentData: Object, target?: string, currentAppointmentData?: Object): void; + /** Hides an appointment tooltip. */ + hideAppointmentTooltip(): void; /** Returns the start date of the current view. */ getStartViewDate(): Date; /** Returns the end date of the current view. */ getEndViewDate(): Date; + getDataSource(): DevExpress.data.DataSource; } export interface dxColorBoxOptions extends dxDropDownEditorOptions { /** Specifies the text displayed on the button that applies changes and closes the drop-down editor. */ @@ -3215,7 +3541,7 @@ declare module DevExpress.ui { export interface HierarchicalCollectionWidgetOptions extends CollectionWidgetOptions { /** Specifies the name of the data source item field whose value is displayed by the widget. */ displayExpr?: any; - /** Specifies the name of the data source item field used as a key. */ + /** Specifies which data field provides keys for TreeView items. */ keyExpr?: any; /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is selected. */ selectedExpr?: any; @@ -3235,10 +3561,7 @@ declare module DevExpress.ui { dataStructure?: string; /** Specifies whether or not a user can expand all tree view items by the "*" hot key. */ expandAllEnabled?: boolean; - /** - * Specifies whether or not a check box is displayed at each tree view item. - * @deprecated Use the showCheckBoxesMode options instead. - */ + /** * Specifies whether or not a check box is displayed at each tree view item. * @deprecated Use the showCheckBoxesMode options instead. */ showCheckBoxes?: boolean; /** Specifies the current check boxes display mode. */ showCheckBoxesMode?: string; @@ -3248,10 +3571,7 @@ declare module DevExpress.ui { selectNodesRecursive?: boolean; /** Specifies whether or not all parent nodes of an initially expanded node are displayed expanded. */ expandNodesRecursive?: boolean; - /** - * Specifies whether the "Select All" check box is displayed over the tree view. - * @deprecated Use the showCheckBoxesMode options instead. - */ + /** * Specifies whether the "Select All" check box is displayed over the tree view. * @deprecated Use the showCheckBoxesMode options instead. */ selectAllEnabled?: boolean; /** Specifies whether or not an item becomes selected if a user clicks it. */ selectByClick?: boolean; @@ -3281,6 +3601,18 @@ declare module DevExpress.ui { onItemContextMenu?: Function; onItemRendered?: Function; onItemHold?: Function; + /** Allows you to load nodes manually. */ + createChildren?: Function; + } + export interface dxTreeViewNode { + children: Array; + disabled: boolean; + expanded: boolean; + itemData: Object; + key: any; + parent: dxTreeViewNode; + selected: boolean; + text: string; } /** A widget displaying specified data items as a tree. */ export class dxTreeView extends HierarchicalCollectionWidget { @@ -3317,11 +3649,8 @@ declare module DevExpress.ui { cssClass?: string; /** Holds an array of menu items. */ items?: Array; - /** - * Specifies whether or not an item becomes selected if an end-user clicks it. - * @deprecated Use the selectByClick option instead. - */ - selectionByClick?: boolean; + /** * Specifies whether or not an item becomes selected if an end-user clicks it. * @deprecated Use the selectByClick option instead. */ + selectionByClick?: boolean; /** Specifies whether or not an item becomes selected if a user clicks it. */ selectByClick?: boolean; /** Specifies the selection mode supported by the menu. */ @@ -3383,13 +3712,15 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxMenuOptions); } export interface dxContextMenuOptions extends dxMenuBaseOptions { - /** Holds an object that specifies options of alternative menu invocation. */ - alternativeInvocationMode?: { - /** Specifies whether or not an alternative invocation mode is enabled. */ - enabled?: Boolean; - /** Specifies the element used to invoke the context menu. */ - invokingElement?: any; + /** Specifies options for displaying the widget. */ + showEvent?: { + /** Specifies the event names on which the widget is shown. */ + name?: String; + /** The time span after which the widget is shown. */ + delay?: Number; }; + /** A Boolean value specifying whether or not the widget is closed if a user clicks outside of the context menu. */ + closeOnOutsideClick?: any; /** A handler for the hidden event. */ onHidden?: Function; /** A handler for the hiding event. */ @@ -3429,6 +3760,8 @@ declare module DevExpress.ui { sorting?: boolean; /** Specifies whether or not grouping must be performed on the server side. */ grouping?: boolean; + /** Specifies whether or not paging by groups must be peformed on the server side. */ + groupPaging?: boolean; /** Specifies whether or not summaries calculation must be performed on the server side. */ summary?: boolean; } @@ -3440,6 +3773,7 @@ declare module DevExpress.ui { groupIndex: number; isExpanded: boolean; isSelected: boolean; + isEditing: boolean; values: Array; } export interface dxDataGridColumn { @@ -3472,7 +3806,7 @@ declare module DevExpress.ui { /** Specifies a callback function to be invoked after the cell value is edited by an end-user and before the new value is saved to the data source. */ setCellValue?: (rowData: Object, value: any) => void; /** Specifies a callback function that defines filters for customary calculated grid cells. */ - calculateFilterExpression?: (filterValue: any, selectedFilterOperation: string, target: string) => Array; + calculateFilterExpression?: (filterValue: any, selectedFilterOperation: string, target: string) => any; /** Specifies a caption for a column. */ caption?: string; /** Specifies a custom template for grid column cells. */ @@ -3539,10 +3873,7 @@ declare module DevExpress.ui { /** Specifies how header filter values should be combined into groups. */ groupInterval?: any; }; - /** - * Specifies a precision for formatted values displayed in a column. - * @deprecated Use the format | precision option instead. - */ + /** * Specifies a precision for formatted values displayed in a column. * @deprecated Use the format | precision option instead. */ precision?: number; /** Specifies the default filter operation of a column. */ selectedFilterOperation?: string; @@ -3586,6 +3917,8 @@ declare module DevExpress.ui { onRowValidating?: (e: Object) => void; /** A handler for the contextMenuPreparing event. */ onContextMenuPreparing?: (e: Object) => void; + /** A handler for the toolbarPreparing event. */ + onToolbarPreparing?: (e: Object) => void; /** A handler for the initNewRow event. */ onInitNewRow?: (e: { data: Object }) => void; /** A handler for the rowInserted event. */ @@ -3742,16 +4075,28 @@ declare module DevExpress.ui { applyFilterText?: string; /** Specifies descriptions for filter operations. */ operationDescriptions?: { - "=": string; - "<>": string; - "<": string; - "<=": string; - ">": string; - ">=": string; - "startswith": string; - "contains": string; - "notcontains": string; - "endswith": string; + /** Description for the '=' operation. */ + equal?: string; + /** Description for the '<>' operation. */ + notEqual?: string; + /** Description for the '<' operation. */ + lessThan?: string; + /** Description for the '<=' operation. */ + lessThanOrEqual?: string; + /** Description for the '>' operation. */ + greaterThan?: string; + /** Description for the '>=' operation. */ + greaterThanOrEqual?: string; + /** Description for the 'startswith' operation. */ + startsWith?: string; + /** Description for the 'contains' operation. */ + contains?: string; + /** Description for the 'notcontains' operation. */ + notContains?: string; + /** Description for the 'endswith' operation. */ + endsWith?: string; + /** Description for the 'between' operation. */ + between?: string; }; /** Specifies text for the reset operation in a filter list. */ resetOperationText?: string; @@ -3884,7 +4229,7 @@ declare module DevExpress.ui { /** Sets a search string for the search panel. */ text?: string; }; - /** Specifies the operations that must be performed on the server side. */ + /** Specifies the operations that must be performed server side. */ remoteOperations?: any; /** Allows you to sort groups according to the values of group summary items. */ sortByGroupSummaryInfo?: Array<{ @@ -3931,8 +4276,10 @@ declare module DevExpress.ui { exportSelectedRows?: string; } }; - /** Specifies the keys of the records that must appear selected initially. */ + /** Specifies the keys of the records that must appear initially selected. */ selectedRowKeys?: Array; + /** Specifies filters for the records that must appear initially selected. */ + selectionFilter?: Object; /** Specifies options of runtime selection. */ selection?: { /** Specifies the checkbox row display policy in the multiple mode. */ @@ -3941,6 +4288,11 @@ declare module DevExpress.ui { allowSelectAll?: boolean; /** Specifies the selection mode. */ mode?: string; + maxFilterLengthInRequest?: number; + /** Specifies the mode in which all the records are selected. */ + selectAllMode?: string; + /** Specifies whether or not deferred row selection is enabled. */ + deferred?: boolean; }; /** A handler for the dataErrorOccured event. */ onDataErrorOccurred?: (e: { error: Error }) => void; @@ -4043,10 +4395,7 @@ declare module DevExpress.ui { }) => string; /** Specifies a pattern for the summary item text. */ displayFormat?: string; - /** - * Specifies a precision for the summary item value of a numeric format. - * @deprecated Use the valueFormat | precision option instead. - */ + /** * Specifies a precision for the summary item value of a numeric format. * @deprecated Use the valueFormat | precision option instead. */ precision?: number; /** Specifies whether or not a summary item must be displayed in the group footer. */ showInGroupFooter?: boolean; @@ -4078,10 +4427,7 @@ declare module DevExpress.ui { }) => string; /** Specifies a pattern for the summary item text. */ displayFormat?: string; - /** - * Specifies a precision for the summary item value of a numeric format. - * @deprecated Use the valueFormat | precision option instead. - */ + /** * Specifies a precision for the summary item value of a numeric format. * @deprecated Use the valueFormat | precision option instead. */ precision?: number; /** Specifies the column that must hold the summary item. */ showInColumn?: string; @@ -4107,7 +4453,7 @@ declare module DevExpress.ui { wordWrapEnabled?: boolean; } /** A data grid widget. */ - export class dxDataGrid extends Widget { + export class dxDataGrid extends Widget implements DataHelperMixin { constructor(element: JQuery, options?: dxDataGridOptions); constructor(element: Element, options?: dxDataGridOptions); /** Ungroups grid records. */ @@ -4118,6 +4464,8 @@ declare module DevExpress.ui { getCellElement(rowIndex: number, dataField: string): any; /** Allows you to obtain a cell by its row index and the visible index of its column. */ getCellElement(rowIndex: number, visibleColumnIndex: number): any; + /** Allows you to obtain a row element by its index. */ + getRowElement(rowIndex: number): any; /** Returns the current state of the grid. */ state(): Object; /** Sets the grid state. */ @@ -4154,6 +4502,12 @@ declare module DevExpress.ui { columnOption(id: any): Object; /** Sets several options of a column at once. */ columnOption(id: any, options: Object): void; + /** Gets an array of visible columns. */ + getVisibleColumns(): Array; + /** Gets an array of visible columns at a specific hierarchical level of column headers. */ + getVisibleColumns(headerLevel?: number): Array; + /** Gets an array of visible rows. */ + getVisibleRows(): Array; /** Sets a specific cell into the editing state. */ editCell(rowIndex: number, visibleColumnIndex: number): void; /** Sets a specific cell into the editing state. */ @@ -4188,20 +4542,19 @@ declare module DevExpress.ui { filter(filterExpr?: any): void; /** Returns a filter expression applied to the grid's data source using the filter(filterExpr) method. */ filter(): any; - /** Returns a filter expression applied to the grid using all possible scenarious. */ + /** Returns a filter expression applied to the grid using all possible scenarios. */ getCombinedFilter(): any; + /** Returns a filter expression applied to the grid using all possible scenarios. */ + getCombinedFilter(returnDataField?: boolean): any; /** Gets the keys of currently selected grid records. */ - getSelectedRowKeys(): Array; - /** Gets the data objects of currently selected grid records. */ - getSelectedRowsData(): Array; + getSelectedRowKeys(): any; + /** Gets the data objects of the currently selected grid records. */ + getSelectedRowsData(): any; /** Hides the column chooser panel. */ hideColumnChooser(): void; /** Adds a new data row to a grid. */ addRow(): void; - /** - * Adds a new data row to a grid. - * @deprecated Use the addRow() method instead. - */ + /** * Adds a new data row to a grid. * @deprecated Use the addRow() method instead. */ insertRow(): void; /** Returns the key corresponding to the passed data object. */ keyOf(obj: Object): any; @@ -4217,10 +4570,7 @@ declare module DevExpress.ui { refresh(): JQueryPromise; /** Removes a specific row from a grid. */ deleteRow(rowIndex: number): void; - /** - * Removes a specific row from a grid. - * @deprecated Use the deleteRow(rowIndex) method instead. - */ + /** * Removes a specific row from a grid. * @deprecated Use the deleteRow(rowIndex) method instead. */ removeRow(rowIndex: number): void; /** Saves changes made in a grid. */ saveEditData(): JQueryPromise; @@ -4228,7 +4578,7 @@ declare module DevExpress.ui { searchByText(text: string): void; /** Selects all grid records. */ selectAll(): void; - /** Deselects the rows that are currently selected within the applied filter. */ + /** Deselects the currently selected rows. */ deselectAll(): void; /** Selects specific grid records. */ selectRows(keys: Array, preserve: boolean): void; @@ -4236,8 +4586,8 @@ declare module DevExpress.ui { deselectRows(keys: Array): void; /** Selects grid rows by indexes. */ selectRowsByIndexes(indexes: Array): void; - /** Allows you to find out whether a row is selected or not. */ - isRowSelected(key: any): boolean; + /** Allows you to find out whether or not the row with a specified data object is selected. */ + isRowSelected(arg: any): boolean; /** Invokes the column chooser panel. */ showColumnChooser(): void; startSelectionWithCheckboxes(): boolean; @@ -4257,6 +4607,11 @@ declare module DevExpress.ui { updateDimensions(): void; /** Focuses the specified cell element in the grid. */ focus(element?: JQuery): void; + getDataSource(): DevExpress.data.DataSource; + /** Gets instance of the Scrollable widget. */ + getScrollable(): dxScrollable; + /** Redraws the specified rows. */ + repaintRows(rowIndexes: Array): void; } export interface dxPivotGridOptions extends WidgetOptions { onContentReady?: Function; @@ -4492,53 +4847,6 @@ declare module DevExpress.ui { getDataSource(): DevExpress.data.PivotGridDataSource; } } -interface JQuery { - dxTreeView(): JQuery; - dxTreeView(options: "instance"): DevExpress.ui.dxTreeView; - dxTreeView(options: string): any; - dxTreeView(options: string, ...params: any[]): any; - dxTreeView(options: DevExpress.ui.dxTreeViewOptions): JQuery; - dxMenuBase(): JQuery; - dxMenuBase(options: "instance"): DevExpress.ui.dxMenuBase; - dxMenuBase(options: string): any; - dxMenuBase(options: string, ...params: any[]): any; - dxMenuBase(options: DevExpress.ui.dxMenuBaseOptions): JQuery; - dxMenu(): JQuery; - dxMenu(options: "instance"): DevExpress.ui.dxMenu; - dxMenu(options: string): any; - dxMenu(options: string, ...params: any[]): any; - dxMenu(options: DevExpress.ui.dxMenuOptions): JQuery; - dxContextMenu(): JQuery; - dxContextMenu(options: "instance"): DevExpress.ui.dxContextMenu; - dxContextMenu(options: string): any; - dxContextMenu(options: string, ...params: any[]): any; - dxContextMenu(options: DevExpress.ui.dxContextMenuOptions): JQuery; - dxColorBox(): JQuery; - dxColorBox(options: "instance"): DevExpress.ui.dxColorBox; - dxColorBox(options: string): any; - dxColorBox(options: string, ...params: any[]): any; - dxColorBox(options: DevExpress.ui.dxColorBoxOptions): JQuery; - dxDataGrid(): JQuery; - dxDataGrid(options: "instance"): DevExpress.ui.dxDataGrid; - dxDataGrid(options: string): any; - dxDataGrid(options: string, ...params: any[]): any; - dxDataGrid(options: DevExpress.ui.dxDataGridOptions): JQuery; - dxPivotGrid(): JQuery; - dxPivotGrid(options: "instance"): DevExpress.ui.dxPivotGrid; - dxPivotGrid(options: string): any; - dxPivotGrid(options: string, ...params: any[]): any; - dxPivotGrid(options: DevExpress.ui.dxPivotGridOptions): JQuery; - dxPivotGridFieldChooser(): JQuery; - dxPivotGridFieldChooser(options: "instance"): DevExpress.ui.dxPivotGridFieldChooser; - dxPivotGridFieldChooser(options: string): any; - dxPivotGridFieldChooser(options: string, ...params: any[]): any; - dxPivotGridFieldChooser(options: DevExpress.ui.dxPivotGridFieldChooserOptions): JQuery; - dxScheduler(): JQuery; - dxScheduler(options: "instance"): DevExpress.ui.dxScheduler; - dxScheduler(options: string): any; - dxScheduler(options: string, ...params: any[]): any; - dxScheduler(options: DevExpress.ui.dxSchedulerOptions): JQuery; -} declare module DevExpress.framework { /** An object used to store information on the views displayed in an application. */ export class ViewCache { @@ -4960,10 +5268,7 @@ declare module DevExpress.viz.core { paddingLeftRight?: number; /** Generates space above and below the text displayed by a tooltip. */ paddingTopBottom?: number; - /** - * Specifies the precision of formatted values in a tooltip. - * @deprecated Use the tooltip | format | precision option instead. - */ + /** * Specifies the precision of formatted values in a tooltip. * @deprecated Use the tooltip | format | precision option instead. */ precision?: number; /** Specifies the appearance of the tooltip's shadow. */ shadow?: { @@ -5092,35 +5397,17 @@ declare module DevExpress.viz.core { } } declare module DevExpress.viz { - /** - * Applies a theme for the entire page with several DevExtreme visualization widgets. - * @deprecated Use the DevExpress.viz.currentTheme(theme) method instead. - */ + /** * Applies a theme for the entire page with several DevExtreme visualization widgets. * @deprecated Use the DevExpress.viz.currentTheme(theme) method instead. */ export function currentTheme(theme: string): void; - /** - * Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. - * @deprecated Use the DevExpress.viz.currentTheme(platform, colorScheme) method instead. - */ + /** * Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. * @deprecated Use the DevExpress.viz.currentTheme(platform, colorScheme) method instead. */ export function currentTheme(platform: string, colorScheme: string): void; - /** - * Registers a new theme based on the existing one. - * @deprecated Use the DevExpress.viz.registerTheme(customTheme, baseTheme) method instead. - */ + /** * Registers a new theme based on the existing one. * @deprecated Use the DevExpress.viz.registerTheme(customTheme, baseTheme) method instead. */ export function registerTheme(customTheme: Object, baseTheme: string): void; - /** - * Applies a predefined or registered custom palette to all visualization widgets at once. - * @deprecated Use the DevExpress.viz.currentPalette(paletteName) method instead. - */ + /** * Applies a predefined or registered custom palette to all visualization widgets at once. * @deprecated Use the DevExpress.viz.currentPalette(paletteName) method instead. */ export function currentPalette(paletteName: string): void; - /** - * Obtains the color sets of a predefined or registered palette. - * @deprecated Use the DevExpress.viz.getPalette(paletteName) method instead. - */ + /** * Obtains the color sets of a predefined or registered palette. * @deprecated Use the DevExpress.viz.getPalette(paletteName) method instead. */ export function getPalette(paletteName: string): Object; - /** - * Registers a new palette. - * @deprecated Use the DevExpress.viz.registerPalette(paletteName, palette) method instead. - */ + /** * Registers a new palette. * @deprecated Use the DevExpress.viz.registerPalette(paletteName, palette) method instead. */ export function registerPalette(paletteName: string, palette: Object): void; } declare module DevExpress.viz.charts { @@ -5277,10 +5564,7 @@ declare module DevExpress.viz.charts { export interface BaseSeriesConfigLabel { /** Specifies a format for arguments displayed by point labels. */ argumentFormat?: any; - /** - * Specifies a precision for formatted point arguments displayed in point labels. - * @deprecated Use the series | label | argumentFormat | precision instead. - */ + /** * Specifies a precision for formatted point arguments displayed in point labels. * @deprecated Use the series | label | argumentFormat | precision instead. */ argumentPrecision?: number; /** Specifies a background color for point labels. */ backgroundColor?: string; @@ -5302,10 +5586,7 @@ declare module DevExpress.viz.charts { /** Specifies a format for the text displayed by point labels. */ format?: any; position?: string; - /** - * Specifies a precision for formatted point values displayed in point labels. - * @deprecated Use the series | label | format | precision option instead. - */ + /** * Specifies a precision for formatted point values displayed in point labels. * @deprecated Use the series | label | format | precision option instead. */ precision?: number; /** Specifies the angle used to rotate point labels from their initial position. */ rotationAngle?: number; @@ -5323,10 +5604,7 @@ declare module DevExpress.viz.charts { horizontalOffset?: number; /** Along with horizontalOffset, shifts point labels from their initial positions. */ verticalOffset?: number; - /** - * Specifies a precision for the percentage values displayed in the labels of a full-stacked-like series. - * @deprecated Use the series | label | format | percentPrecision instead. - */ + /** * Specifies a precision for the percentage values displayed in the labels of a full-stacked-like series. * @deprecated Use the series | label | format | percentPrecision instead. */ percentPrecision?: number; } export interface BaseCommonSeriesConfig { @@ -5580,10 +5858,7 @@ declare module DevExpress.viz.charts { export interface PieSeriesConfigLabel extends BaseSeriesConfigLabel { /** Specifies how to shift labels from their initial position in a radial direction in pixels. */ radialOffset?: number; - /** - * Specifies a precision for the percentage values displayed in labels. - * @deprecated Use the series | label | format | percentPrecision instead. - */ + /** * Specifies a precision for the percentage values displayed in labels. * @deprecated Use the series | label | format | percentPrecision instead. */ percentPrecision?: number; } /** An object that defines configuration options for chart series. */ @@ -5607,10 +5882,7 @@ declare module DevExpress.viz.charts { /** Specifies the hatching options to be applied when a point is hovered over. */ hatching?: viz.core.Hatching; }; - /** - * Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. - * @deprecated Use the innerRadius option instead. - */ + /** * Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. * @deprecated Use the innerRadius option instead. */ innerRadius?: number; /** An object defining the label configuration options. */ label?: PieSeriesConfigLabel; @@ -5618,10 +5890,7 @@ declare module DevExpress.viz.charts { maxLabelCount?: number; /** Specifies a minimal size of a displayed pie segment. */ minSegmentSize?: number; - /** - * Specifies the direction in which the PieChart series points are located. - * @deprecated Use the segmentsDirection option instead. - */ + /** * Specifies the direction in which the PieChart series points are located. * @deprecated Use the segmentsDirection option instead. */ segmentsDirection?: string; /**

Specifies the chart elements to highlight when the series is selected.

*/ selectionMode?: string; @@ -5645,10 +5914,7 @@ declare module DevExpress.viz.charts { /** Specifies how many segments must not be grouped. */ topCount?: number; }; - /** - * Specifies a start angle for a pie chart in arc degrees. - * @deprecated Use the startAngle option instead. - */ + /** * Specifies a start angle for a pie chart in arc degrees. * @deprecated Use the startAngle option instead. */ startAngle?: number; /**

Specifies the name of the data source field that provides data about a point.

*/ tagField?: string; @@ -5656,17 +5922,11 @@ declare module DevExpress.viz.charts { valueField?: string; } export interface CommonPieSeriesSettings extends CommonPieSeriesConfig { - /** - * Specifies the type of the pie chart series. - * @deprecated Use the type option instead. - */ + /** * Specifies the type of the pie chart series. * @deprecated Use the type option instead. */ type?: string; } export interface PieSeriesConfig extends CommonPieSeriesConfig { - /** - * Sets the series type. - * @deprecated Use the type option instead. - */ + /** * Sets the series type. * @deprecated Use the type option instead. */ type?: string; /** Specifies the name that identifies the series. */ name?: string; @@ -5879,10 +6139,7 @@ declare module DevExpress.viz.charts { customizeText?: (argument: { value: any; valueText: string }) => string; /** Specifies a format for the text displayed by axis labels. */ format?: any; - /** - * Specifies a precision for the formatted value displayed in the axis labels. - * @deprecated Use the valueAxis | label | format | precision option instead. - */ + /** * Specifies a precision for the formatted value displayed in the axis labels. * @deprecated Use the valueAxis | label | format | precision option instead. */ precision?: number; } export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel { } @@ -6018,15 +6275,9 @@ declare module DevExpress.viz.charts { export interface BaseChartTooltip extends viz.core.Tooltip { /** Specifies a format for arguments of the chart's series points. */ argumentFormat?: any; - /** - * Specifies a precision for formatted arguments displayed in tooltips. - * @deprecated Use the tooltip | argumentFormat | precision option instead. - */ + /** * Specifies a precision for formatted arguments displayed in tooltips. * @deprecated Use the tooltip | argumentFormat | precision option instead. */ argumentPrecision?: number; - /** - * Specifies a precision for a percent value displayed in tooltips for stacked series and PieChart series. - * @deprecated Use the tooltip | format | percentPrecision option instead. - */ + /** * Specifies a precision for a percent value displayed in tooltips for stacked series and PieChart series. * @deprecated Use the tooltip | format | percentPrecision option instead. */ percentPrecision?: number; } export interface BaseChartOptions extends viz.core.BaseWidgetOptions, viz.core.MarginOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { @@ -6047,7 +6298,7 @@ declare module DevExpress.viz.charts { customizePoint?: (pointInfo: Object) => Object; /** Specifies the origin of data for the widget. */ dataSource?: any; - /** Specifies options of a Chart's or PieChart's legend. */ + /** Specifies options of a Chart's (PieChart's) legend. */ legend?: core.BaseLegend; /** Sets the name of the palette to be used in the chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ palette?: any; @@ -6101,6 +6352,8 @@ declare module DevExpress.viz.charts { getSeriesByName(seriesName: string): BaseSeries; /** Gets a series within the chart's series collection by its position number. */ getSeriesByPos(seriesIndex: number): BaseSeries; + /** Returns the DataSource instance. */ + getDataSource(): DevExpress.data.DataSource; /** Hides all widget tooltips. */ hideTooltip(): void; showLoadingIndicator(): void; @@ -6199,9 +6452,9 @@ declare module DevExpress.viz.charts { /** Specifies the width of the crosshair lines. */ width?: number; /** Configures the horizontal crosshair line individually. */ - horizontalLine?: CrosshaierWithLabel; + horizontalLine?: CrosshairWithLabel; /** Configures the vertical crosshair line individually. */ - verticalLine?: CrosshaierWithLabel; + verticalLine?: CrosshairWithLabel; /** Configures the crosshair labels. */ label?: { /** Paints the background of the crosshair labels. */ @@ -6212,10 +6465,7 @@ declare module DevExpress.viz.charts { font?: viz.core.Font; /** Formats the point value/argument before it will be displayed in the crosshair label. */ format?: any; - /** - * Specifies a precision for formatted values. - * @deprecated Use the crosshair | label | format | precision option instead. - */ + /** * Specifies a precision for formatted values. * @deprecated Use the crosshair | label | format | precision option instead. */ precision?: number; /** Customizes the text displayed by the crosshair labels. */ customizeText?: (info: { value: any; valueText: string; point: ChartPoint; }) => string; @@ -6272,7 +6522,7 @@ declare module DevExpress.viz.charts { position?: string; }; } - interface CrosshaierWithLabel extends viz.core.DashedBorderWithOpacity { + interface CrosshairWithLabel extends viz.core.DashedBorderWithOpacity { /** Configures the label that belongs to the horizontal crosshair line. */ label?: { /** Paints the background of the label that belongs to the horizontal crosshair line. */ @@ -6283,10 +6533,7 @@ declare module DevExpress.viz.charts { font?: viz.core.Font; /** Formats the point value before it will be displayed in the crosshair label. */ format?: any; - /** - * Specifies a precision for formatted values. - * @deprecated Use the crosshair | horizontalLine | label | format | precision option instead. - */ + /** * Specifies a precision for formatted values. * @deprecated Use the crosshair | horizontalLine | label | format | precision option instead. */ precision?: number; /** Customizes the text displayed by the label that belongs to the horizontal crosshair line. */ customizeText?: (info: { value: any; valueText: string; point: ChartPoint; }) => string; @@ -6367,10 +6614,7 @@ declare module DevExpress.viz { export class dxPieChart extends DevExpress.viz.charts.BaseChart { constructor(element: JQuery, options?: DevExpress.viz.charts.dxPieChartOptions); constructor(element: Element, options?: DevExpress.viz.charts.dxPieChartOptions); - /** - * Provides access to the PieChart series. - * @deprecated Use the getAllSeries() method instead. - */ + /** * Provides access to the PieChart series. * @deprecated Use the getAllSeries() method instead. */ getSeries(): DevExpress.viz.charts.PieSeries; } /** A chart widget displaying data in a polar coordinate system. */ @@ -6379,17 +6623,6 @@ declare module DevExpress.viz { constructor(element: Element, options?: DevExpress.viz.charts.dxPolarChartOptions); } } -interface JQuery { - dxChart(options?: DevExpress.viz.charts.dxChartOptions): JQuery; - dxChart(methodName: string, ...params: any[]): any; - dxChart(methodName: "instance"): DevExpress.viz.dxChart; - dxPieChart(options?: DevExpress.viz.charts.dxPieChartOptions): JQuery; - dxPieChart(methodName: string, ...params: any[]): any; - dxPieChart(methodName: "instance"): DevExpress.viz.dxPieChart; - dxPolarChart(options?: DevExpress.viz.charts.dxPolarChartOptions): JQuery; - dxPolarChart(methodName: string, ...params: any[]): any; - dxPolarChart(methodName: "instance"): DevExpress.viz.dxPolarChart; -} declare module DevExpress.viz.gauges { export interface BaseRangeContainer { /** Specifies a range container's background color. */ @@ -6410,22 +6643,13 @@ declare module DevExpress.viz.gauges { export interface ScaleTick { /** Specifies the color of the scale's minor ticks. */ color?: string; - /** - * Specifies an array of custom minor ticks. - * @deprecated Use the scale | customMinorTicks option instead. - */ + /** * Specifies an array of custom minor ticks. * @deprecated Use the scale | customMinorTicks option instead. */ customTickValues?: Array; /** Specifies the length of the scale's minor ticks. */ length?: number; - /** - * Indicates whether automatically calculated minor ticks are visible or not. - * @deprecated This feature is no longer available. - */ + /** * Indicates whether automatically calculated minor ticks are visible or not. * @deprecated This feature is no longer available. */ showCalculatedTicks?: boolean; - /** - * Specifies an interval between minor ticks. - * @deprecated Use the scale | minorTickInterval option instead. - */ + /** * Specifies an interval between minor ticks. * @deprecated Use the scale | minorTickInterval option instead. */ tickInterval?: number; /** Indicates whether scale minor ticks are visible or not. */ visible?: boolean; @@ -6433,10 +6657,7 @@ declare module DevExpress.viz.gauges { width?: number; } export interface ScaleMajorTick extends ScaleTick { - /** - * Specifies whether or not to expand the current major tick interval if labels overlap each other. - * @deprecated Use the overlappingBehavior | useAutoArrangement option instead. - */ + /** * Specifies whether or not to expand the current major tick interval if labels overlap each other. * @deprecated Use the overlappingBehavior | useAutoArrangement option instead. */ useTicksAutoArrangement?: boolean; } export interface ScaleMinorTick extends ScaleTick { @@ -6459,10 +6680,7 @@ declare module DevExpress.viz.gauges { font?: viz.core.Font; /** Specifies a format for the text displayed in scale labels. */ format?: any; - /** - * Specifies a precision for the formatted value displayed in the scale labels. - * @deprecated Use the scale | label | format | precision option instead. - */ + /** * Specifies a precision for the formatted value displayed in the scale labels. * @deprecated Use the scale | label | format | precision option instead. */ precision?: number; /** Specifies whether or not scale labels are visible on the gauge. */ visible?: boolean; @@ -6470,25 +6688,13 @@ declare module DevExpress.viz.gauges { export interface BaseScale { /** Specifies the end value for the scale of the gauge. */ endValue?: number; - /** - * Specifies whether or not to hide the first scale label. - * @deprecated This feature is no longer available. - */ + /** * Specifies whether or not to hide the first scale label. * @deprecated This feature is no longer available. */ hideFirstLabel?: boolean; - /** - * Specifies whether or not to hide the first major tick on the scale. - * @deprecated This feature is no longer available. - */ + /** * Specifies whether or not to hide the first major tick on the scale. * @deprecated This feature is no longer available. */ hideFirstTick?: boolean; - /** - * Specifies whether or not to hide the last scale label. - * @deprecated This feature is no longer available. - */ + /** * Specifies whether or not to hide the last scale label. * @deprecated This feature is no longer available. */ hideLastLabel?: boolean; - /** - * Specifies whether or not to hide the last major tick on the scale. - * @deprecated This feature is no longer available. - */ + /** * Specifies whether or not to hide the last major tick on the scale. * @deprecated This feature is no longer available. */ hideLastTick?: boolean; /** Specifies an interval between major ticks. */ tickInterval?: number; @@ -6500,10 +6706,7 @@ declare module DevExpress.viz.gauges { customMinorTicks?: Array; /** Specifies common options for scale labels. */ label?: BaseScaleLabel; - /** - * Specifies options of the gauge's major ticks. - * @deprecated Use the tick option instead. - */ + /** * Specifies options of the gauge's major ticks. * @deprecated Use the tick option instead. */ majorTick?: ScaleMajorTick; /** Specifies options of the gauge's major ticks. */ tick?: { @@ -6542,10 +6745,7 @@ declare module DevExpress.viz.gauges { format?: any; /** Specifies the range bar's label indent in pixels. */ indent?: number; - /** - * Specifies a precision for the formatted value displayed by an indicator. - * @deprecated Use the text | format | precision option instead. - */ + /** * Specifies a precision for the formatted value displayed by an indicator. * @deprecated Use the text | format | precision option instead. */ precision?: number; }; offset?: number; @@ -6573,20 +6773,11 @@ declare module DevExpress.viz.gauges { export interface SharedGaugeOptions extends viz.core.MarginOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { /** Specifies animation options. */ animation?: viz.core.Animation; - /** - * Specifies a subtitle for the widget. - * @deprecated Use the title | subtitle option instead. - */ + /** * Specifies a subtitle for the widget. * @deprecated Use the title | subtitle option instead. */ subtitle?: { - /** - * Specifies font options for the subtitle. - * @deprecated Use the title | subtitle | font option instead. - */ + /** * Specifies font options for the subtitle. * @deprecated Use the title | subtitle | font option instead. */ font?: viz.core.Font; - /** - * Specifies a text for the subtitle. - * @deprecated Use the title | subtitle | text option instead. - */ + /** * Specifies a text for the subtitle. * @deprecated Use the title | subtitle | text option instead. */ text?: string; }; /** Configures tooltips. */ @@ -6723,10 +6914,7 @@ declare module DevExpress.viz.gauges { format?: any; /** Specifies the distance between the upper bar and bar labels in pixels. */ indent?: number; - /** - * Specifies a precision for the formatted value displayed by labels. - * @deprecated Use the label | format | precision option instead. - */ + /** * Specifies a precision for the formatted value displayed by labels. * @deprecated Use the label | format | precision option instead. */ precision?: number; /** Specifies whether bar labels appear on a gauge or not. */ visible?: boolean; @@ -6764,17 +6952,6 @@ declare module DevExpress.viz { values(values: Array): void; } } -interface JQuery { - dxLinearGauge(options?: DevExpress.viz.gauges.dxLinearGaugeOptions): JQuery; - dxLinearGauge(methodName: string, ...params: any[]): any; - dxLinearGauge(methodName: "instance"): DevExpress.viz.dxLinearGauge; - dxCircularGauge(options?: DevExpress.viz.gauges.dxCircularGaugeOptions): JQuery; - dxCircularGauge(methodName: string, ...params: any[]): any; - dxCircularGauge(methodName: "instance"): DevExpress.viz.dxCircularGauge; - dxBarGauge(options?: DevExpress.viz.gauges.dxBarGaugeOptions): JQuery; - dxBarGauge(methodName: string, ...params: any[]): any; - dxBarGauge(methodName: "instance"): DevExpress.viz.dxBarGauge; -} declare module DevExpress.viz.rangeSelector { export interface dxRangeSelectorOptions extends viz.core.BaseWidgetOptions, viz.core.MarginOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { /** Specifies the options for the range selector's background. */ @@ -6797,8 +6974,10 @@ declare module DevExpress.viz.rangeSelector { allowSlidersSwap?: boolean; /** Indicates whether or not animation is enabled. */ animationEnabled?: boolean; - /** Specifies when to call the onSelectedRangeChanged function. */ + /** * Specifies when to call the onSelectedRangeChanged function. * @deprecated Use the callValueChanged option instead. */ callSelectedRangeChanged?: string; + /** Specifies when to call the onValueChanged function. */ + callValueChanged?: string; /** Indicates whether or not an end user can specify the range using a mouse, without the use of sliders. */ manualRangeSelectionEnabled?: boolean; /** Indicates whether or not an end user can shift the selected range to the required location on a scale by clicking. */ @@ -6871,10 +7050,7 @@ declare module DevExpress.viz.rangeSelector { font?: viz.core.Font; /** Specifies a format for the text displayed in scale labels. */ format?: any; - /** - * Specifies a precision for the formatted value displayed in the scale labels. - * @deprecated Use the scale | label | format | precision option instead. - */ + /** * Specifies a precision for the formatted value displayed in the scale labels. * @deprecated Use the scale | label | format | precision option instead. */ precision?: number; /** Specifies a spacing between scale labels and the background bottom edge. */ topIndent?: number; @@ -6883,10 +7059,7 @@ declare module DevExpress.viz.rangeSelector { }; /** Specifies the value to be raised to a power when generating ticks for a logarithmic scale. */ logarithmBase?: number; - /** - * Specifies an interval between major ticks. - * @deprecated Use the tickInterval option instead. - */ + /** * Specifies an interval between major ticks. * @deprecated Use the tickInterval option instead. */ majorTickInterval?: any; /** Specifies an interval between axis ticks. */ tickInterval?: any; @@ -6924,10 +7097,7 @@ declare module DevExpress.viz.rangeSelector { setTicksAtUnitBeginning?: boolean; /** Specifies whether or not to show ticks for the boundary scale values, when neither major ticks nor minor ticks are created for these values. */ showCustomBoundaryTicks?: boolean; - /** - * Indicates whether or not to show minor ticks on the scale. - * @deprecated Use the minorTick | visible option instead. - */ + /** * Indicates whether or not to show minor ticks on the scale. * @deprecated Use the minorTick | visible option instead. */ showMinorTicks?: boolean; /** Specifies the scale's start value. */ startValue?: any; @@ -6957,16 +7127,18 @@ declare module DevExpress.viz.rangeSelector { useTicksAutoArrangement?: boolean; /** Specifies the type of values on the scale. */ valueType?: string; - /** Specifies the order of arguments on a discrete scale. */ - categories?: Array; + /** Specifies the order of arguments on a discrete scale. */ + categories?: Array; }; - /** Specifies the range to be selected when displaying the RangeSelector. */ + /** * Specifies the range to be selected when displaying the RangeSelector. * @deprecated Use the value option instead. */ selectedRange?: { /** Specifies the start value of the range to be selected when displaying the RangeSelector widget on a page. */ startValue?: any; /** Specifies the end value of the range to be selected when displaying the RangeSelector widget on a page. */ endValue?: any; }; + /** The selected range, initial or current. */ + value?: Array; /** Specifies the color of the selected range. */ selectedRangeColor?: string; /** Range selector's indent options. */ @@ -6976,13 +7148,20 @@ declare module DevExpress.viz.rangeSelector { /** Specifies range selector's right indent. */ right?: number; }; - /** A handler for the selectedRangeChanged event. */ + /** * A handler for the selectedRangeChanged event. * @deprecated Use the onValueChanged option instead. */ onSelectedRangeChanged?: (e: { startValue: any; endValue: any; component: dxRangeSelector; element: Element; }) => void; + /** A handler for the valueChanged event. */ + onValueChanged?: (e: { + value: Array; + previousValue: Array; + component: dxRangeSelector; + element: Element; + }) => void; /** Specifies range selector shutter options. */ shutter?: { /** Specifies shutter color. */ @@ -7011,10 +7190,7 @@ declare module DevExpress.viz.rangeSelector { format?: any; /** Specifies the color used for the slider marker text when the currently selected range does not match the minRange and maxRange values. */ invalidRangeColor?: string; - /** - * Specifies the empty space between the marker's border and the marker’s text. - * @deprecated Use the paddingTopBottom and paddingLeftRight options instead. - */ + /** * Specifies the empty space between the marker's border and the marker’s text. * @deprecated Use the paddingTopBottom and paddingLeftRight options instead. */ padding?: number; /** Specifies the empty space between the marker's top and bottom borders and the marker's text. */ paddingTopBottom?: number; @@ -7022,10 +7198,7 @@ declare module DevExpress.viz.rangeSelector { paddingLeftRight?: number; /** Specifies the placeholder height of the slider marker. */ placeholderHeight?: number; - /** - * Specifies in pixels the height and width of the space reserved for the range selector slider markers. - * @deprecated Use the placeholderHeight and indent options instead. - */ + /** * Specifies in pixels the height and width of the space reserved for the range selector slider markers. * @deprecated Use the placeholderHeight and indent options instead. */ placeholderSize?: { /** Specifies the height of the placeholder for the left and right slider markers. */ height?: number; @@ -7037,10 +7210,7 @@ declare module DevExpress.viz.rangeSelector { right?: number; }; }; - /** - * Specifies a precision for the formatted value displayed in slider markers. - * @deprecated Use the sliderMarker | format | precision option instead. - */ + /** * Specifies a precision for the formatted value displayed in slider markers. * @deprecated Use the sliderMarker | format | precision option instead. */ precision?: number; /** Indicates whether or not the slider markers are visible. */ visible?: boolean; @@ -7056,17 +7226,18 @@ declare module DevExpress.viz { hideLoadingIndicator(): void; /** Redraws a widget. */ render(skipChartAnimation?: boolean): void; - /** Returns the currently selected range. */ + /** * Returns the currently selected range. * @deprecated Use the getValue() method instead. */ getSelectedRange(): { startValue: any; endValue: any; }; - /** Sets a specified range. */ + /** * Sets a specified range. * @deprecated Use the setValue(value) method instead. */ setSelectedRange(selectedRange: { startValue: any; endValue: any; }): void; + /** Gets the currently selected range. */ + getValue(): Array; + /** Selects a specific range. */ + setValue(value: Array): void; + /** Returns the DataSource instance. */ + getDataSource(): DevExpress.data.DataSource; } } -interface JQuery { - dxRangeSelector(options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions): JQuery; - dxRangeSelector(methodName: string, ...params: any[]): any; - dxRangeSelector(methodName: "instance"): DevExpress.viz.dxRangeSelector; -} declare module DevExpress.viz.map { /** This section describes the fields and methods that can be used in code to manipulate the Layer object. */ export interface MapLayer { @@ -7082,6 +7253,8 @@ declare module DevExpress.viz.map { getElements(): Array; /** Deselects all layer elements. */ clearSelection(): void; + /** Returns the DataSource instance. */ + getDataSource(): DevExpress.data.DataSource; } /** This section describes the fields and methods that can be used in code to manipulate the Layer Element object. */ export interface MapLayerElement { @@ -7100,91 +7273,40 @@ declare module DevExpress.viz.map { /** Applies the layer element settings and updates element appearance. */ applySettings(settings: any): void; } - /** - * This section describes the fields and methods that can be used in code to manipulate the Area object. - * @deprecated Use the Layer Element instead. - */ + /** * This section describes the fields and methods that can be used in code to manipulate the Area object. * @deprecated Use the Layer Element instead. */ export interface Area { - /** - * Contains the element type. - * @deprecated Use the Layer | type instead. - */ + /** * Contains the element type. * @deprecated Use the Layer | type instead. */ type: string; - /** - * Return the value of an attribute. - * @deprecated Use the Layer Element | attribute(name, value) method instead. - */ + /** * Return the value of an attribute. * @deprecated Use the Layer Element | attribute(name, value) method instead. */ attribute(name: string): any; - /** - * Provides information about the selection state of an area. - * @deprecated Use the Layer Element | selected() method instead. - */ + /** * Provides information about the selection state of an area. * @deprecated Use the Layer Element | selected() method instead. */ selected(): boolean; - /** - * Sets a new selection state for an area. - * @deprecated Use the Layer Element | selected(state) method instead. - */ + /** * Sets a new selection state for an area. * @deprecated Use the Layer Element | selected(state) method instead. */ selected(state: boolean): void; - /** - * Applies the area settings specified as a parameter and updates the area appearance. - * @deprecated Use the Layer Element | applySettings(settings) method instead. - */ + /** * Applies the area settings specified as a parameter and updates the area appearance. * @deprecated Use the Layer Element | applySettings(settings) method instead. */ applySettings(settings: any): void; } - /** - * This section describes the fields and methods that can be used in code to manipulate the Markers object. - * @deprecated Use the Layer Element instead. - */ + /** * This section describes the fields and methods that can be used in code to manipulate the Markers object. * @deprecated Use the Layer Element instead. */ export interface Marker { - /** - * Contains the descriptive text accompanying the map marker. - * @deprecated Get the text using the Layer Element | attribute(name) method. The name parameter value for text is set at the dataField option. - */ + /** * Contains the descriptive text accompanying the map marker. * @deprecated Get the text using the Layer Element | attribute(name) method. The name parameter value for text is set at the dataField option. */ text: string; - /** - * Contains the type of the element. - * @deprecated Use the Layer | type instead. - */ + /** * Contains the type of the element. * @deprecated Use the Layer | type instead. */ type: string; - /** - * Contains the URL of an image map marker. - * @deprecated Get the image URL using the Layer Element | attribute(name) method. The name parameter value for the image URL is set at the dataField option. - */ + /** * Contains the URL of an image map marker. * @deprecated Get the image URL using the Layer Element | attribute(name) method. The name parameter value for the image URL is set at the dataField option. */ url: string; - /** - * Contains the value of a bubble map marker. - * @deprecated Get the bubble value using the Layer Element | attribute(name) method. The name parameter for the bubble value is set at the dataField option. - */ + /** * Contains the value of a bubble map marker. * @deprecated Get the bubble value using the Layer Element | attribute(name) method. The name parameter for the bubble value is set at the dataField option. */ value: number; - /** - * Contains the values of a pie map marker. - * @deprecated Get the pie values using the Layer Element | attribute(name) method. The name parameter for pie values is set at the dataField option. - */ + /** * Contains the values of a pie map marker. * @deprecated Get the pie values using the Layer Element | attribute(name) method. The name parameter for pie values is set at the dataField option. */ values: Array; - /** - * Returns the value of an attribute. - * @deprecated Use the Layer Element | attribute(name, value) method instead. - */ + /** * Returns the value of an attribute. * @deprecated Use the Layer Element | attribute(name, value) method instead. */ attribute(name: string): any; - /** - * Returns the coordinates of a specific marker. - * @deprecated Use the Layer Element | coordinates() method instead. - */ + /** * Returns the coordinates of a specific marker. * @deprecated Use the Layer Element | coordinates() method instead. */ coordinates(): Array; - /** - * Provides information about the selection state of a marker. - * @deprecated Use the Layer Element | selected() method instead. - */ + /** * Provides information about the selection state of a marker. * @deprecated Use the Layer Element | selected() method instead. */ selected(): boolean; - /** - * Sets a new selection state for a marker. - * @deprecated Use the Layer Element | selected(state) method instead. - */ + /** * Sets a new selection state for a marker. * @deprecated Use the Layer Element | selected(state) method instead. */ selected(state: boolean): void; - /** - * Applies the marker settings specified as a parameter and updates marker appearance. - * @deprecated Use the Layer Element | applySettings(settings) method instead. - */ + /** * Applies the marker settings specified as a parameter and updates marker appearance. * @deprecated Use the Layer Element | applySettings(settings) method instead. */ applySettings(settings: any): void; } export interface MapLayerSettings { @@ -7253,241 +7375,103 @@ declare module DevExpress.viz.map { }; } export interface AreaSettings { - /** - * Specifies the width of the area border in pixels. - * @deprecated Use the layers | borderWidth option instead. - */ + /** * Specifies the width of the area border in pixels. * @deprecated Use the layers | borderWidth option instead. */ borderWidth?: number; - /** - * Specifies a color for the area border. - * @deprecated Use the layers | borderColor option instead. - */ + /** * Specifies a color for the area border. * @deprecated Use the layers | borderColor option instead. */ borderColor?: string; - /** - * Specifies a color for an area. - * @deprecated Use the layers | color option instead. - */ + /** * Specifies a color for an area. * @deprecated Use the layers | color option instead. */ color?: string; - /** - * Specifies the function that customizes each area individually. - * @deprecated Use the layers | customize option instead. - */ + /** * Specifies the function that customizes each area individually. * @deprecated Use the layers | customize option instead. */ customize?: (areaInfo: Area) => AreaSettings; - /** - * Specifies a color for the area border when the area is hovered over. - * @deprecated Use the layers | hoveredBorderColor option instead. - */ + /** * Specifies a color for the area border when the area is hovered over. * @deprecated Use the layers | hoveredBorderColor option instead. */ hoveredBorderColor?: string; - /** - * Specifies the pixel-measured width of the area border when the area is hovered over. - * @deprecated Use the layers | hoveredBorderWidth option instead. - */ + /** * Specifies the pixel-measured width of the area border when the area is hovered over. * @deprecated Use the layers | hoveredBorderWidth option instead. */ hoveredBorderWidth?: number; - /** - * Specifies a color for an area when this area is hovered over. - * @deprecated Use the layers | hoveredColor option instead. - */ + /** * Specifies a color for an area when this area is hovered over. * @deprecated Use the layers | hoveredColor option instead. */ hoveredColor?: string; - /** - * Specifies whether or not to change the appearance of an area when it is hovered over. - * @deprecated Use the layers | hoverEnabled option instead. - */ + /** * Specifies whether or not to change the appearance of an area when it is hovered over. * @deprecated Use the layers | hoverEnabled option instead. */ hoverEnabled?: boolean; - /** - * Configures area labels. - * @deprecated Use the layers | label option instead. - */ + /** * Configures area labels. * @deprecated Use the layers | label option instead. */ label?: { - /** - * Specifies the data field that provides data for area labels. - * @deprecated Use the layers | label | dataField option instead. - */ + /** * Specifies the data field that provides data for area labels. * @deprecated Use the layers | label | dataField option instead. */ dataField?: string; - /** - * Enables area labels. - * @deprecated Use the layers | label | enabled option instead. - */ + /** * Enables area labels. * @deprecated Use the layers | label | enabled option instead. */ enabled?: boolean; - /** - * Specifies font options for area labels. - * @deprecated Use the layers | label | font option instead. - */ + /** * Specifies font options for area labels. * @deprecated Use the layers | label | font option instead. */ font?: viz.core.Font; }; - /** - * Specifies the name of the palette or a custom range of colors to be used for coloring a map. - * @deprecated Use the layers | palette option instead. - */ + /** * Specifies the name of the palette or a custom range of colors to be used for coloring a map. * @deprecated Use the layers | palette option instead. */ palette?: any; - /** - * Specifies the number of colors in a palette. - * @deprecated Use the layers | paletteSize option instead. - */ + /** * Specifies the number of colors in a palette. * @deprecated Use the layers | paletteSize option instead. */ paletteSize?: number; - /** - * Allows you to paint areas with similar attributes in the same color. - * @deprecated Use the layers | colorGroups option instead. - */ + /** * Allows you to paint areas with similar attributes in the same color. * @deprecated Use the layers | colorGroups option instead. */ colorGroups?: Array; - /** - * Specifies the field that provides data to be used for coloring areas. - * @deprecated Use the layers | colorGroupingField option instead. - */ + /** * Specifies the field that provides data to be used for coloring areas. * @deprecated Use the layers | colorGroupingField option instead. */ colorGroupingField?: string; - /** - * Specifies a color for the area border when the area is selected. - * @deprecated Use the layers | selectedBorderColor option instead. - */ + /** * Specifies a color for the area border when the area is selected. * @deprecated Use the layers | selectedBorderColor option instead. */ selectedBorderColor?: string; - /** - * Specifies a color for an area when this area is selected. - * @deprecated Use the layers | selectedColor option instead. - */ + /** * Specifies a color for an area when this area is selected. * @deprecated Use the layers | selectedColor option instead. */ selectedColor?: string; - /** - * Specifies the pixel-measured width of the area border when the area is selected. - * @deprecated Use the layers | selectedBorderWidth option instead. - */ + /** * Specifies the pixel-measured width of the area border when the area is selected. * @deprecated Use the layers | selectedBorderWidth option instead. */ selectedBorderWidth?: number; - /** - * Specifies whether single or multiple areas can be selected on a vector map. - * @deprecated Use the layers | selectionMode option instead. - */ + /** * Specifies whether single or multiple areas can be selected on a vector map. * @deprecated Use the layers | selectionMode option instead. */ selectionMode?: string; } export interface MarkerSettings { - /** - * Specifies a color for the marker border. - * @deprecated Use the layers | borderColor option instead. - */ + /** * Specifies a color for the marker border. * @deprecated Use the layers | borderColor option instead. */ borderColor?: string; - /** - * Specifies the width of the marker border in pixels. - * @deprecated Use the layers | borderWidth option instead. - */ + /** * Specifies the width of the marker border in pixels. * @deprecated Use the layers | borderWidth option instead. */ borderWidth?: number; - /** - * Specifies a color for a marker of the dot or bubble type. - * @deprecated Use the layers | color option instead. - */ + /** * Specifies a color for a marker of the dot or bubble type. * @deprecated Use the layers | color option instead. */ color?: string; - /** - * Specifies the function that customizes each marker individually. - * @deprecated Use the layers | customize option instead. - */ + /** * Specifies the function that customizes each marker individually. * @deprecated Use the layers | customize option instead. */ customize?: (markerInfo: Marker) => MarkerSettings; - /** - * Specifies the pixel-measured width of the marker border when the marker is hovered over. - * @deprecated Use the layers | hoveredBorderWidth option instead. - */ + /** * Specifies the pixel-measured width of the marker border when the marker is hovered over. * @deprecated Use the layers | hoveredBorderWidth option instead. */ hoveredBorderWidth?: number; - /** - * Specifies a color for the marker border when the marker is hovered over. - * @deprecated Use the layers | hoveredBorderColor option instead. - */ + /** * Specifies a color for the marker border when the marker is hovered over. * @deprecated Use the layers | hoveredBorderColor option instead. */ hoveredBorderColor?: string; - /** - * Specifies a color for a marker of the dot or bubble type when this marker is hovered over. - * @deprecated Use the layers | hoveredColor option instead. - */ + /** * Specifies a color for a marker of the dot or bubble type when this marker is hovered over. * @deprecated Use the layers | hoveredColor option instead. */ hoveredColor?: string; - /** - * Specifies whether or not to change the appearance of a marker when it is hovered over. - * @deprecated Use the layers | hoverEnabled option instead. - */ + /** * Specifies whether or not to change the appearance of a marker when it is hovered over. * @deprecated Use the layers | hoverEnabled option instead. */ hoverEnabled?: boolean; - /** - * Specifies marker label options. - * @deprecated Use the layers | label option instead. - */ + /** * Specifies marker label options. * @deprecated Use the layers | label option instead. */ label?: { - /** - * Enables marker labels. - * @deprecated Use the layers | label | enabled option instead. - */ + /** * Enables marker labels. * @deprecated Use the layers | label | enabled option instead. */ enabled?: boolean; - /** - * Specifies font options for marker labels. - * @deprecated Use the layers | label | font option instead. - */ + /** * Specifies font options for marker labels. * @deprecated Use the layers | label | font option instead. */ font?: viz.core.Font; }; - /** - * Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if you use markers of the bubble type. - * @deprecated Use the layers | maxSize option instead. - */ + /** * Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if you use markers of the bubble type. * @deprecated Use the layers | maxSize option instead. */ maxSize?: number; - /** - * Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if you use markers of the bubble type. - * @deprecated Use the layers | minSize option instead. - */ + /** * Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if you use markers of the bubble type. * @deprecated Use the layers | minSize option instead. */ minSize?: number; - /** - * Specifies the opacity of markers. Setting this option makes sense only if you use markers of the bubble type. - * @deprecated Use the layers | opacity option instead. - */ + /** * Specifies the opacity of markers. Setting this option makes sense only if you use markers of the bubble type. * @deprecated Use the layers | opacity option instead. */ opacity?: number; - /** - * Specifies the pixel-measured width of the marker border when the marker is selected. - * @deprecated Use the layers | selectedBorderWidth option instead. - */ + /** * Specifies the pixel-measured width of the marker border when the marker is selected. * @deprecated Use the layers | selectedBorderWidth option instead. */ selectedBorderWidth?: number; - /** - * Specifies a color for the marker border when the marker is selected. - * @deprecated Use the layers | selectedBorderColor option instead. - */ + /** * Specifies a color for the marker border when the marker is selected. * @deprecated Use the layers | selectedBorderColor option instead. */ selectedBorderColor?: string; - /** - * Specifies a color for a marker of the dot or bubble type when this marker is selected. - * @deprecated Use the layers | selectedColor option instead. - */ + /** * Specifies a color for a marker of the dot or bubble type when this marker is selected. * @deprecated Use the layers | selectedColor option instead. */ selectedColor?: string; - /** - * Specifies whether a single or multiple markers can be selected on a vector map. - * @deprecated Use the layers | selectionMode option instead. - */ + /** * Specifies whether a single or multiple markers can be selected on a vector map. * @deprecated Use the layers | selectionMode option instead. */ selectionMode?: string; - /** - * Specifies the size of markers. Setting this option makes sense for any type of marker except bubble. - * @deprecated Use the layers | size option instead. - */ + /** * Specifies the size of markers. Setting this option makes sense for any type of marker except bubble. * @deprecated Use the layers | size option instead. */ size?: number; - /** - * Specifies the type of markers to be used on the map. - * @deprecated Use the layers | elementType option instead. - */ + /** * Specifies the type of markers to be used on the map. * @deprecated Use the layers | elementType option instead. */ type?: string; - /** - * Specifies the name of a palette or a custom set of colors to be used for coloring markers of the pie type. - * @deprecated Use the layers | palette option instead. - */ + /** * Specifies the name of a palette or a custom set of colors to be used for coloring markers of the pie type. * @deprecated Use the layers | palette option instead. */ palette?: any; - /** - * Allows you to paint markers with similar attributes in the same color. - * @deprecated Use the layers | colorGroups option instead. - */ + /** * Allows you to paint markers with similar attributes in the same color. * @deprecated Use the layers | colorGroups option instead. */ colorGroups?: Array; - /** - * Specifies the field that provides data to be used for coloring markers. - * @deprecated Use the layers | colorGroupingField option instead. - */ + /** * Specifies the field that provides data to be used for coloring markers. * @deprecated Use the layers | colorGroupingField option instead. */ colorGroupingField?: string; - /** - * Allows you to display bubbles with similar attributes in the same size. - * @deprecated Use the layers | sizeGroups option instead. - */ + /** * Allows you to display bubbles with similar attributes in the same size. * @deprecated Use the layers | sizeGroups option instead. */ sizeGroups?: Array; - /** - * Specifies the field that provides data to be used for sizing bubble markers. - * @deprecated Use the layers | sizeGroupingField option instead. - */ + /** * Specifies the field that provides data to be used for sizing bubble markers. * @deprecated Use the layers | sizeGroupingField option instead. */ sizeGroupingField?: string; } export interface dxVectorMapOptions extends viz.core.BaseWidgetOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { - /** - * An object specifying options for the map areas. - * @deprecated Use the "area" type element of the layers array. - */ + /** * An object specifying options for the map areas. * @deprecated Use the "area" type element of the layers array. */ areaSettings?: AreaSettings; /** Specifies the options for the map background. */ background?: { @@ -7519,20 +7503,11 @@ declare module DevExpress.viz.map { /** Specifies the opacity of the control bar. */ opacity?: number; }; - /** - * Specifies a data source for the map area. - * @deprecated Use the layers | dataSource option instead. - */ + /** * Specifies a data source for the map area. * @deprecated Use the layers | dataSource option instead. */ mapData?: any; - /** - * Specifies a data source for the map markers. - * @deprecated Use the layers | dataSource option instead. - */ + /** * Specifies a data source for the map markers. * @deprecated Use the layers | dataSource option instead. */ markers?: any; - /** - * An object specifying options for the map markers. - * @deprecated Use the "marker" type element of the layers array. - */ + /** * An object specifying options for the map markers. * @deprecated Use the "marker" type element of the layers array. */ markerSettings?: MarkerSettings; /** Configures tooltips. */ tooltip?: viz.core.Tooltip; @@ -7582,29 +7557,17 @@ declare module DevExpress.viz.map { element: Element; target: MapLayerElement; }) => void; - /** - * A handler for the areaClick event. - * @deprecated Use the onClick option instead. - */ + /** * A handler for the areaClick event. * @deprecated Use the onClick option instead. */ onAreaClick?: any; - /** - * A handler for the areaSelectionChanged event. - * @deprecated Use the onSelectionChanged option instead. - */ + /** * A handler for the areaSelectionChanged event. * @deprecated Use the onSelectionChanged option instead. */ onAreaSelectionChanged?: (e: { target: Area; component: dxVectorMap; element: Element; }) => void; - /** - * A handler for the markerClick event. - * @deprecated Use the onClick option instead. - */ + /** * A handler for the markerClick event. * @deprecated Use the onClick option instead. */ onMarkerClick?: any; - /** - * A handler for the markerSelectionChanged event. - * @deprecated Use the onSelecitonChanged option instead. - */ + /** * A handler for the markerSelectionChanged event. * @deprecated Use the onSelecitonChanged option instead. */ onMarkerSelectionChanged?: (e: { target: Marker; component: dxVectorMap; @@ -7644,7 +7607,7 @@ declare module DevExpress.viz.map { add(name: string, projection: Object): void; } } -declare module DevExpress.viz{ +declare module DevExpress.viz { /** A vector map widget. */ export class dxVectorMap extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { constructor(element: JQuery, options?: DevExpress.viz.map.dxVectorMapOptions); @@ -7655,15 +7618,9 @@ declare module DevExpress.viz{ center(): Array; /** Sets the coordinates of the map center. */ center(centerCoordinates: Array): void; - /** - * Deselects all the selected areas on a map. The areas are displayed in their initial style after. - * @deprecated Use the layer's clearSelection() method instead. - */ + /** * Deselects all the selected areas on a map. The areas are displayed in their initial style after. * @deprecated Use the layer's clearSelection() method instead. */ clearAreaSelection(): void; - /** - * Deselects all the selected markers on a map. The markers are displayed in their initial style after. - * @deprecated Use the layer's clearSelection() method instead. - */ + /** * Deselects all the selected markers on a map. The markers are displayed in their initial style after. * @deprecated Use the layer's clearSelection() method instead. */ clearMarkerSelection(): void; /** Deselects all the selected area and markers on a map at once. The areas and markers are displayed in their initial style after. */ clearSelection(): void; @@ -7675,15 +7632,9 @@ declare module DevExpress.viz{ getLayerByIndex(index: number): DevExpress.viz.map.MapLayer; /** Gets the layer by its name. */ getLayerByName(name: string): DevExpress.viz.map.MapLayer; - /** - * Returns an array with all the map areas. - * @deprecated Use the layer's getElements() method instead. - */ + /** * Returns an array with all the map areas. * @deprecated Use the layer's getElements() method instead. */ getAreas(): Array; - /** - * Returns an array with all the map markers. - * @deprecated Use the layer's getElements() method instead. - */ + /** * Returns an array with all the map markers. * @deprecated Use the layer's getElements() method instead. */ getMarkers(): Array; /** Gets the current coordinates of the map viewport. */ viewport(): Array; @@ -7695,22 +7646,11 @@ declare module DevExpress.viz{ zoomFactor(zoomFactor: number): void; } } -interface JQuery { - dxVectorMap(options?: DevExpress.viz.map.dxVectorMapOptions): JQuery; - dxVectorMap(methodName: string, ...params: any[]): any; - dxVectorMap(methodName: "instance"): DevExpress.viz.dxVectorMap; -} declare module DevExpress.viz.sparklines { export interface SparklineTooltip extends viz.core.Tooltip { - /** - * Specifies how a tooltip is horizontally aligned relative to the graph. - * @deprecated Tooltip alignment is no longer useful because the tooltips are aligned automatically. - */ + /** * Specifies how a tooltip is horizontally aligned relative to the graph. * @deprecated Tooltip alignment is no longer useful because the tooltips are aligned automatically. */ horizontalAlignment?: string; - /** - * Specifies how a tooltip is vertically aligned relative to the graph. - * @deprecated Tooltip alignment is no longer useful because the tooltips are aligned automatically. - */ + /** * Specifies how a tooltip is vertically aligned relative to the graph. * @deprecated Tooltip alignment is no longer useful because the tooltips are aligned automatically. */ verticalAlignment?: string; } export interface BaseSparklineOptions extends viz.core.BaseWidgetOptions, viz.core.MarginOptions { @@ -7807,16 +7747,10 @@ declare module DevExpress.viz { export class dxSparkline extends DevExpress.viz.sparklines.BaseSparkline { constructor(element: JQuery, options?: DevExpress.viz.sparklines.dxSparklineOptions); constructor(element: Element, options?: DevExpress.viz.sparklines.dxSparklineOptions); + /** Returns the DataSource instance. */ + getDataSource(): DevExpress.data.DataSource; } } -interface JQuery { - dxBullet(options?: DevExpress.viz.sparklines.dxBulletOptions): JQuery; - dxBullet(methodName: string, ...params: any[]): any; - dxBullet(methodName: "instance"): DevExpress.viz.dxBullet; - dxSparkline(options?: DevExpress.viz.sparklines.dxSparklineOptions): JQuery; - dxSparkline(methodName: string, ...params: any[]): any; - dxSparkline(methodName: "instance"): DevExpress.viz.dxSparkline; -} declare module DevExpress.viz.treeMap { export interface dxTreeMapOptions extends viz.core.BaseWidgetOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { /** Specifies the origin of data for the widget. */ @@ -7837,6 +7771,8 @@ declare module DevExpress.viz.treeMap { layoutAlgorithm?: any; /** Specifies the direction in which the items will be laid out. */ layoutDirection?: string; + /** Decides whether those labels that overflow their tile/group should be hidden or truncated with ellipsis. */ + resolveLabelOverflow?: string; /** Configures tiles. */ tile?: { /** Configures the tile borders. */ @@ -8043,10 +7979,7 @@ declare module DevExpress.viz { resetDrillDown(): void; showLoadingIndicator(): void; hideLoadingIndicator(): void; + /** Returns the DataSource instance. */ + getDataSource(): DevExpress.data.DataSource; } } -interface JQuery { - dxTreeMap(options?: DevExpress.viz.treeMap.dxTreeMapOptions): JQuery; - dxTreeMap(methodName: string, ...params: any[]): any; - dxTreeMap(methodName: "instance"): DevExpress.viz.dxTreeMap; -} From 2bde4f64d0acdb1212281225665249d73876b25d Mon Sep 17 00:00:00 2001 From: Steve Ognibene Date: Mon, 23 Jan 2017 12:39:51 -0500 Subject: [PATCH 062/140] Revise node.js definition to respond to feedback on PR #13877 --- node/index.d.ts | 6 ++---- node/node-tests.ts | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/node/index.d.ts b/node/index.d.ts index 32d3f5a203..6e4fbce84e 100644 --- a/node/index.d.ts +++ b/node/index.d.ts @@ -4016,10 +4016,8 @@ declare module "v8" { physical_space_size: number; } - enum DoesZapCodeSpaceFlag { - Disabled = 0, - Enabled = 1 - } + //** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */ + type DoesZapCodeSpaceFlag = 0 | 1; interface HeapInfo { total_heap_size: number; diff --git a/node/node-tests.ts b/node/node-tests.ts index 2844ca8e6e..03c3e9a1b6 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -24,6 +24,7 @@ import * as string_decoder from "string_decoder"; import * as stream from "stream"; import * as timers from "timers"; import * as repl from "repl"; +import * as v8 from "v8"; // Specifically test buffer module regression. import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer"; @@ -2071,6 +2072,21 @@ namespace constants_tests { str = constants.defaultCipherList } + +//////////////////////////////////////////////////// +/// v8 tests : https://nodejs.org/api/v8.html +//////////////////////////////////////////////////// + +namespace v8_tests { + + const heapStats = v8.getHeapStatistics(); + const heapSpaceStats = v8.getHeapSpaceStatistics(); + + const zapsGarbage: number = heapStats.does_zap_garbage; + + v8.setFlagsFromString('--collect_maps'); +} + /////////////////////////////////////////////////////////// /// Debugger Tests /// /////////////////////////////////////////////////////////// From 9b5329839558a78550bf078c3e5f323c2f0f3b86 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Mon, 23 Jan 2017 15:36:53 -0500 Subject: [PATCH 063/140] Support Pick<> on setState now that TS 2.1 is out (#13155) * Support Partial<> on setState now that TS 2.1 is out * Update readme to reflect setState being typed correctly * Switch setState to Pick * Restore cloneELement portion of readme * Use Pick<> | S for setState due to cast issue * state and props should be readonly * Fix nit + document why we * Add typescript compiler header * Update to properly order headers * Update readme to reflect 2.1.5 fixing stPick * Update readme now that 2.1.5 is out * All that depend on react now require 2.1 * Fix definition that fails due to readonly state --- 3d-bin-packing/index.d.ts | 1 + alt/index.d.ts | 1 + antd/index.d.ts | 1 + aphrodite/index.d.ts | 1 + chai-enzyme/index.d.ts | 1 + enzyme/index.d.ts | 1 + fixed-data-table/index.d.ts | 1 + flux/index.d.ts | 1 + fluxxor/index.d.ts | 1 + gaea-model/index.d.ts | 2 ++ halogen/index.d.ts | 1 + jsnox/index.d.ts | 1 + material-ui/index.d.ts | 1 + mobservable-react/index.d.ts | 1 + navigation-react/index.d.ts | 2 ++ ngreact/index.d.ts | 1 + radium/index.d.ts | 1 + rc-select/index.d.ts | 1 + rc-tooltip/index.d.ts | 1 + react-addons-create-fragment/index.d.ts | 1 + react-addons-css-transition-group/index.d.ts | 1 + react-addons-linked-state-mixin/index.d.ts | 1 + react-addons-pure-render-mixin/index.d.ts | 1 + react-addons-shallow-compare/index.d.ts | 1 + react-addons-test-utils/index.d.ts | 1 + react-addons-transition-group/index.d.ts | 1 + react-addons-update/index.d.ts | 1 + react-autosuggest/index.d.ts | 1 + react-big-calendar/index.d.ts | 1 + react-body-classname/index.d.ts | 1 + react-bootstrap-date-picker/index.d.ts | 1 + react-bootstrap-daterangepicker/index.d.ts | 1 + react-bootstrap-table/index.d.ts | 1 + react-bootstrap/index.d.ts | 1 + react-breadcrumbs/index.d.ts | 1 + react-bytesize-icons/index.d.ts | 1 + react-calendar-timeline/index.d.ts | 1 + react-codemirror/index.d.ts | 1 + react-color/index.d.ts | 1 + react-cropper/index.d.ts | 1 + react-css-transition-replace/index.d.ts | 1 + react-data-grid/index.d.ts | 1 + react-datagrid/index.d.ts | 1 + react-datepicker/index.d.ts | 1 + react-daterange-picker/index.d.ts | 1 + react-day-picker/index.d.ts | 2 +- react-dnd-html5-backend/index.d.ts | 1 + react-dnd/index.d.ts | 1 + react-dom/index.d.ts | 1 + react-dropzone/index.d.ts | 2 +- react-easy-chart/index.d.ts | 1 + react-event-listener/index.d.ts | 1 + react-fa/index.d.ts | 1 + react-facebook-login/index.d.ts | 1 + react-file-input/index.d.ts | 1 + react-file-reader-input/index.d.ts | 1 + react-flex/index.d.ts | 1 + react-flexr/index.d.ts | 1 + react-fontawesome/index.d.ts | 1 + react-gravatar/index.d.ts | 1 + react-helmet/index.d.ts | 1 + react-highlight-words/index.d.ts | 1 + react-holder/index.d.ts | 1 + react-hot-loader/index.d.ts | 1 + react-i18next/index.d.ts | 1 + react-imageloader/index.d.ts | 1 + react-infinite/index.d.ts | 1 + react-input-calendar/index.d.ts | 1 + react-input-mask/index.d.ts | 1 + react-intl-redux/index.d.ts | 1 + react-intl/index.d.ts | 1 + react-intl/v1/index.d.ts | 1 + react-is-deprecated/index.d.ts | 1 + react-joyride/index.d.ts | 1 + react-json-tree/index.d.ts | 1 + react-jsonschema-form/index.d.ts | 1 + .../react-jsonschema-form-tests.tsx | 11 +++++--- react-maskedinput/index.d.ts | 1 + react-mdl/index.d.ts | 1 + react-measure/index.d.ts | 1 + react-mixin/index.d.ts | 1 + react-modal/index.d.ts | 1 + react-motion-slider/index.d.ts | 1 + react-motion/index.d.ts | 1 + react-native-fs/index.d.ts | 1 + react-native-scrollable-tab-view/index.d.ts | 1 + react-native-sortable-list/index.d.ts | 1 + react-native-swiper/index.d.ts | 1 + react-native/index.d.ts | 1 + react-notification-system-redux/index.d.ts | 1 + react-notification-system/index.d.ts | 1 + react-onclickoutside/index.d.ts | 1 + react-overlays/index.d.ts | 1 + react-paginate/index.d.ts | 1 + react-props-decorators/index.d.ts | 1 + react-recaptcha/index.d.ts | 1 + react-redux-i18n/index.d.ts | 1 + react-redux-toastr/index.d.ts | 1 + react-redux/index.d.ts | 1 + react-relay/index.d.ts | 1 + react-responsive/index.d.ts | 1 + react-router-bootstrap/index.d.ts | 1 + react-router-redux/index.d.ts | 1 + react-router/index.d.ts | 1 + react-scroll/index.d.ts | 1 + react-scrollbar/index.d.ts | 1 + react-select/index.d.ts | 1 + react-side-effect/index.d.ts | 1 + react-slick/index.d.ts | 1 + react-smooth-scrollbar/index.d.ts | 1 + react-sortable-hoc/index.d.ts | 1 + react-spinkit/index.d.ts | 1 + react-split-pane/index.d.ts | 1 + react-swf/index.d.ts | 1 + react-swipeable-views/index.d.ts | 1 + react-swipeable/index.d.ts | 1 + react-syntax-highlighter/index.d.ts | 1 + react-tabs/index.d.ts | 1 + react-tagcloud/index.d.ts | 1 + react-test-renderer/index.d.ts | 1 + react-textarea-autosize/index.d.ts | 1 + react-toggle/index.d.ts | 1 + react-user-tour/index.d.ts | 1 + react-virtualized/index.d.ts | 1 + react-widgets/index.d.ts | 1 + react/README.md | 27 +++++++++++++++++-- react/index.d.ts | 9 ++++--- reactcss/index.d.ts | 1 + rebass/index.d.ts | 1 + recompose/index.d.ts | 1 + redux-bootstrap/index.d.ts | 1 + redux-devtools-dock-monitor/index.d.ts | 1 + redux-devtools-log-monitor/index.d.ts | 1 + redux-devtools/index.d.ts | 1 + redux-form/v4/index.d.ts | 1 + redux-router/index.d.ts | 1 + spectacle/index.d.ts | 1 + victory/index.d.ts | 1 + why-did-you-update/index.d.ts | 1 + 139 files changed, 175 insertions(+), 12 deletions(-) diff --git a/3d-bin-packing/index.d.ts b/3d-bin-packing/index.d.ts index 2461538194..14228f3141 100644 --- a/3d-bin-packing/index.d.ts +++ b/3d-bin-packing/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/betterwaysystems/packer // Definitions by: Jeongho Nam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/alt/index.d.ts b/alt/index.d.ts index 561de28ac3..00e171484b 100644 --- a/alt/index.d.ts +++ b/alt/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/goatslacker/alt // Definitions by: Michael Shearer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/antd/index.d.ts b/antd/index.d.ts index e2865c6927..f262eda45f 100644 --- a/antd/index.d.ts +++ b/antd/index.d.ts @@ -2,6 +2,7 @@ // Project: http://ant.design // Definitions by: bang88 , Bruce Mitchener // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/aphrodite/index.d.ts b/aphrodite/index.d.ts index 2f53e133fd..63eba46927 100644 --- a/aphrodite/index.d.ts +++ b/aphrodite/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Khan/aphrodite // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react"; diff --git a/chai-enzyme/index.d.ts b/chai-enzyme/index.d.ts index 72842332ad..23e9058ef6 100644 --- a/chai-enzyme/index.d.ts +++ b/chai-enzyme/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/producthunt/chai-enzyme // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/enzyme/index.d.ts b/enzyme/index.d.ts index 94b60fc199..5502b0eb85 100644 --- a/enzyme/index.d.ts +++ b/enzyme/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/airbnb/enzyme // Definitions by: Marian Palkus , Cap3 , Ivo Stratev , Tom Crockett // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { ReactElement, Component, StatelessComponent, ComponentClass, HTMLAttributes as ReactHTMLAttributes, SVGAttributes as ReactSVGAttributes } from "react"; diff --git a/fixed-data-table/index.d.ts b/fixed-data-table/index.d.ts index cb5809bf5a..a131501348 100644 --- a/fixed-data-table/index.d.ts +++ b/fixed-data-table/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/facebook/fixed-data-table // Definitions by: Petar Paar , Stephen Jelfs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/flux/index.d.ts b/flux/index.d.ts index 4b9c261040..54fecd3a4e 100644 --- a/flux/index.d.ts +++ b/flux/index.d.ts @@ -2,6 +2,7 @@ // Project: http://facebook.github.io/flux/ // Definitions by: Steve Baker , Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/fluxxor/index.d.ts b/fluxxor/index.d.ts index 4c8f773b1d..64c917cdf5 100644 --- a/fluxxor/index.d.ts +++ b/fluxxor/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/BinaryMuse/fluxxor // Definitions by: Yuichi Murata // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/gaea-model/index.d.ts b/gaea-model/index.d.ts index 769a1658d0..ec2ebe9976 100644 --- a/gaea-model/index.d.ts +++ b/gaea-model/index.d.ts @@ -2,6 +2,8 @@ // Project: https://github.com/ascoders/gaea-model // Definitions by: ascoders // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + import * as React from 'react'; export as namespace GaeaModel; diff --git a/halogen/index.d.ts b/halogen/index.d.ts index 72d57ace51..5735737f41 100644 --- a/halogen/index.d.ts +++ b/halogen/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/yuanyan/halogen // Definitions by: Vincent Rouffiat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as react from "react"; diff --git a/jsnox/index.d.ts b/jsnox/index.d.ts index f49cef58c4..9587afc8f1 100644 --- a/jsnox/index.d.ts +++ b/jsnox/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/af/jsnox // Definitions by: Steve Baker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/material-ui/index.d.ts b/material-ui/index.d.ts index 716505987d..665cdc6a24 100644 --- a/material-ui/index.d.ts +++ b/material-ui/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/callemall/material-ui // Definitions by: Nathan Brown , Oliver Herrmann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/mobservable-react/index.d.ts b/mobservable-react/index.d.ts index a5f77cf5d4..4c035c2b5f 100644 --- a/mobservable-react/index.d.ts +++ b/mobservable-react/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mweststrate/mobservable-react // Definitions by: Michel Weststrate // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; diff --git a/navigation-react/index.d.ts b/navigation-react/index.d.ts index 131ce29735..32ee6570f3 100644 --- a/navigation-react/index.d.ts +++ b/navigation-react/index.d.ts @@ -2,6 +2,8 @@ // Project: http://grahammendick.github.io/navigation/ // Definitions by: Graham Mendick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + import { StateNavigator } from 'navigation'; import { Component, HTMLProps } from 'react'; diff --git a/ngreact/index.d.ts b/ngreact/index.d.ts index f9df0f694f..b20a35cad2 100644 --- a/ngreact/index.d.ts +++ b/ngreact/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/ngReact/ngReact // Definitions by: Vicky Lai // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/radium/index.d.ts b/radium/index.d.ts index 89ee64dc45..8345b9516f 100644 --- a/radium/index.d.ts +++ b/radium/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/formidablelabs/radium // Definitions by: Alex Gorbatchev , Philipp Holzer , Alexey Svetliakov , Mikael Hermansson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import React = require('react'); import ReactComponent = React.Component; diff --git a/rc-select/index.d.ts b/rc-select/index.d.ts index f85e9c1e4e..d9d9723b5b 100644 --- a/rc-select/index.d.ts +++ b/rc-select/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/react-component/select // Definitions by: Denis Tirilis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/rc-tooltip/index.d.ts b/rc-tooltip/index.d.ts index 91904c623a..3916c8cfd6 100644 --- a/rc-tooltip/index.d.ts +++ b/rc-tooltip/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/react-component/tooltip // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-addons-create-fragment/index.d.ts b/react-addons-create-fragment/index.d.ts index 247d82618c..928ddc3a5d 100644 --- a/react-addons-create-fragment/index.d.ts +++ b/react-addons-create-fragment/index.d.ts @@ -2,6 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; diff --git a/react-addons-css-transition-group/index.d.ts b/react-addons-css-transition-group/index.d.ts index c8ccf83ebe..b74c38e264 100644 --- a/react-addons-css-transition-group/index.d.ts +++ b/react-addons-css-transition-group/index.d.ts @@ -2,6 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import 'react-addons-transition-group'; import { ComponentClass, TransitionGroupProps, CSSTransitionGroupProps } from 'react'; diff --git a/react-addons-linked-state-mixin/index.d.ts b/react-addons-linked-state-mixin/index.d.ts index a689ca35a0..d1b0a1b6c7 100644 --- a/react-addons-linked-state-mixin/index.d.ts +++ b/react-addons-linked-state-mixin/index.d.ts @@ -2,6 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { Mixin } from 'react'; diff --git a/react-addons-pure-render-mixin/index.d.ts b/react-addons-pure-render-mixin/index.d.ts index 5265eb4ff2..73c87ed592 100644 --- a/react-addons-pure-render-mixin/index.d.ts +++ b/react-addons-pure-render-mixin/index.d.ts @@ -2,6 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { Mixin } from 'react'; diff --git a/react-addons-shallow-compare/index.d.ts b/react-addons-shallow-compare/index.d.ts index dfaf03b873..9d16c35de1 100644 --- a/react-addons-shallow-compare/index.d.ts +++ b/react-addons-shallow-compare/index.d.ts @@ -2,6 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { Component } from 'react'; diff --git a/react-addons-test-utils/index.d.ts b/react-addons-test-utils/index.d.ts index b2aa5d97f6..3b5ec31bf6 100644 --- a/react-addons-test-utils/index.d.ts +++ b/react-addons-test-utils/index.d.ts @@ -2,6 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { AbstractView, Component, ComponentClass, ReactElement, ReactInstance, ClassType, diff --git a/react-addons-transition-group/index.d.ts b/react-addons-transition-group/index.d.ts index 9ccb4440bb..bfadb6850c 100644 --- a/react-addons-transition-group/index.d.ts +++ b/react-addons-transition-group/index.d.ts @@ -2,6 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { ReactElement, ComponentClass, ReactType, TransitionGroupProps } from 'react'; diff --git a/react-addons-update/index.d.ts b/react-addons-update/index.d.ts index ad3bbf43e1..76f5b32d3c 100644 --- a/react-addons-update/index.d.ts +++ b/react-addons-update/index.d.ts @@ -2,6 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; diff --git a/react-autosuggest/index.d.ts b/react-autosuggest/index.d.ts index ed12888833..d0d6bec839 100644 --- a/react-autosuggest/index.d.ts +++ b/react-autosuggest/index.d.ts @@ -2,6 +2,7 @@ // Project: http://react-autosuggest.js.org/ // Definitions by: Nicolas Schmitt , Philip Ottesen , Robert Essig // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; diff --git a/react-big-calendar/index.d.ts b/react-big-calendar/index.d.ts index 5cfbebb65e..c55a3c126c 100644 --- a/react-big-calendar/index.d.ts +++ b/react-big-calendar/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/intljusticemission/react-big-calendar // Definitions by: Piotr Witek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare module 'react-big-calendar' { import * as React from 'react'; diff --git a/react-body-classname/index.d.ts b/react-body-classname/index.d.ts index 91c0ccd668..e20bffdc73 100644 --- a/react-body-classname/index.d.ts +++ b/react-body-classname/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/PactCoffee/react-body-classname // Definitions by: Mohamed Hegazy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import React = require("react"); diff --git a/react-bootstrap-date-picker/index.d.ts b/react-bootstrap-date-picker/index.d.ts index 59aac6683f..f905dc77a7 100644 --- a/react-bootstrap-date-picker/index.d.ts +++ b/react-bootstrap-date-picker/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/pushtell/react-bootstrap-date-picker#readme // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { ComponentClass, StatelessComponent, ReactNode, FocusEventHandler, HTMLAttributes } from "react"; diff --git a/react-bootstrap-daterangepicker/index.d.ts b/react-bootstrap-daterangepicker/index.d.ts index 793886cb11..e2ac7d49c6 100644 --- a/react-bootstrap-daterangepicker/index.d.ts +++ b/react-bootstrap-daterangepicker/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/skratchdot/react-bootstrap-daterangepicker // Definitions by: Ian Ker-Seymer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/react-bootstrap-table/index.d.ts b/react-bootstrap-table/index.d.ts index 72db1aaf40..566019ab94 100644 --- a/react-bootstrap-table/index.d.ts +++ b/react-bootstrap-table/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/AllenFang/react-bootstrap-table // Definitions by: Frank Laub , Aleksander Lode // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/react-bootstrap/index.d.ts b/react-bootstrap/index.d.ts index 76d046e10d..3e5c69c034 100644 --- a/react-bootstrap/index.d.ts +++ b/react-bootstrap/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/react-bootstrap/react-bootstrap // Definitions by: Walker Burgin , Vincent Siao , Danilo Barros , Batbold Gansukh , Raymond May Jr. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; export = ReactBootstrap; diff --git a/react-breadcrumbs/index.d.ts b/react-breadcrumbs/index.d.ts index 1d247f215d..af35bccaa1 100644 --- a/react-breadcrumbs/index.d.ts +++ b/react-breadcrumbs/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/svenanders/react-breadcrumbs // Definitions by: Kostya Esmukov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/react-bytesize-icons/index.d.ts b/react-bytesize-icons/index.d.ts index 99339d1b18..b2e5a3b8ae 100644 --- a/react-bytesize-icons/index.d.ts +++ b/react-bytesize-icons/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/abdelhai/react-bytesize-icons // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react"; diff --git a/react-calendar-timeline/index.d.ts b/react-calendar-timeline/index.d.ts index 029ea8b65b..c8269f9cf1 100644 --- a/react-calendar-timeline/index.d.ts +++ b/react-calendar-timeline/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/namespace-ee/react-calendar-timeline // Definitions by: Rajab Shakirov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-codemirror/index.d.ts b/react-codemirror/index.d.ts index 20176c2ae3..841fc34a0e 100644 --- a/react-codemirror/index.d.ts +++ b/react-codemirror/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/JedWatson/react-codemirror // Definitions by: Vicky Lai // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/react-color/index.d.ts b/react-color/index.d.ts index cdf723d33b..bed3ae46ff 100644 --- a/react-color/index.d.ts +++ b/react-color/index.d.ts @@ -2,6 +2,7 @@ // Project: https://casesandberg.github.io/react-color/ // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-cropper/index.d.ts b/react-cropper/index.d.ts index cfdd359148..aa29c6d4dc 100644 --- a/react-cropper/index.d.ts +++ b/react-cropper/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/roadmanfong/react-cropper // Definitions by: Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/react-css-transition-replace/index.d.ts b/react-css-transition-replace/index.d.ts index 88a8d11ffd..ce09917fbe 100644 --- a/react-css-transition-replace/index.d.ts +++ b/react-css-transition-replace/index.d.ts @@ -2,6 +2,7 @@ // Project: http://marnusw.github.io/react-css-transition-replace/ // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react"; import * as CSSTransitionGroup from "react-addons-css-transition-group"; diff --git a/react-data-grid/index.d.ts b/react-data-grid/index.d.ts index d378476670..3ec11776f9 100644 --- a/react-data-grid/index.d.ts +++ b/react-data-grid/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/adazzle/react-data-grid.git // Definitions by: Simon Gellis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-datagrid/index.d.ts b/react-datagrid/index.d.ts index 31462d2619..eddd5701fa 100644 --- a/react-datagrid/index.d.ts +++ b/react-datagrid/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/zippyui/react-datagrid.git // Definitions by: Stephen Jelfs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-datepicker/index.d.ts b/react-datepicker/index.d.ts index aec8b61b72..895dcac4ce 100644 --- a/react-datepicker/index.d.ts +++ b/react-datepicker/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Hacker0x01/react-datepicker // Definitions by: Rajab Shakirov , Andrey Balokha // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-daterange-picker/index.d.ts b/react-daterange-picker/index.d.ts index 102b8bac16..280c730df1 100644 --- a/react-daterange-picker/index.d.ts +++ b/react-daterange-picker/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/onefinestay/react-daterange-picker // Definitions by: UNCOVER TRUTH Inc. // Definitions: https://github.com/borisyankov/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react"; import * as moment from "moment-range"; diff --git a/react-day-picker/index.d.ts b/react-day-picker/index.d.ts index f1a987cab3..01c5492922 100644 --- a/react-day-picker/index.d.ts +++ b/react-day-picker/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gpbl/react-day-picker // Definitions by: Giampaolo Bellavite , Jason Killian // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.0 +// TypeScript Version: 2.1 /// diff --git a/react-dnd-html5-backend/index.d.ts b/react-dnd-html5-backend/index.d.ts index f9f3ad1a2c..299e47dbae 100644 --- a/react-dnd-html5-backend/index.d.ts +++ b/react-dnd-html5-backend/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/gaearon/react-dnd // Definitions by: Pedro Pereira // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as ReactDnd from "react-dnd"; diff --git a/react-dnd/index.d.ts b/react-dnd/index.d.ts index 41b0e33eb6..0b98006be3 100644 --- a/react-dnd/index.d.ts +++ b/react-dnd/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/gaearon/react-dnd // Definitions by: Asana // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-dom/index.d.ts b/react-dom/index.d.ts index 45f62060ff..00520fc6ed 100644 --- a/react-dom/index.d.ts +++ b/react-dom/index.d.ts @@ -2,6 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 export as namespace ReactDOM; export = ReactDOM; diff --git a/react-dropzone/index.d.ts b/react-dropzone/index.d.ts index b4ed4ded43..f6627c26d7 100644 --- a/react-dropzone/index.d.ts +++ b/react-dropzone/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/okonet/react-dropzone // Definitions by: Mathieu Larouche Dube , Ivo Jesus , Luís Rodrigues // Definitions: https://github.com/Vooban/DefinitelyTyped - +// TypeScript Version: 2.1 /// declare module "react-dropzone" { diff --git a/react-easy-chart/index.d.ts b/react-easy-chart/index.d.ts index 8728ad0eaf..66914c9cd5 100644 --- a/react-easy-chart/index.d.ts +++ b/react-easy-chart/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/rma-consulting/react-easy-chart // Definitions by: Dave Leaver // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-event-listener/index.d.ts b/react-event-listener/index.d.ts index 7fefddbe7b..c6d05b313b 100644 --- a/react-event-listener/index.d.ts +++ b/react-event-listener/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/oliviertassinari/react-event-listener // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react"; diff --git a/react-fa/index.d.ts b/react-fa/index.d.ts index 1335f0a918..bab8fec196 100644 --- a/react-fa/index.d.ts +++ b/react-fa/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/andreypopp/react-fa // Definitions by: Frank Laub , Pat Sissons , Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { Component, ComponentClass, HTMLProps, StatelessComponent } from "react"; diff --git a/react-facebook-login/index.d.ts b/react-facebook-login/index.d.ts index 3b95e684e4..8716b03217 100644 --- a/react-facebook-login/index.d.ts +++ b/react-facebook-login/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/keppelen/react-facebook-login // Definitions by: Alexandre Paré // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react"; diff --git a/react-file-input/index.d.ts b/react-file-input/index.d.ts index 9ec64fc1ec..3ae22e055f 100644 --- a/react-file-input/index.d.ts +++ b/react-file-input/index.d.ts @@ -2,6 +2,7 @@ // Project: https://www.npmjs.com/package/react-file-input // Definitions by: Dmitry Rogozhny // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-file-reader-input/index.d.ts b/react-file-reader-input/index.d.ts index 649f0f688c..37f9357f5c 100644 --- a/react-file-reader-input/index.d.ts +++ b/react-file-reader-input/index.d.ts @@ -2,6 +2,7 @@ // Project: https://www.npmjs.com/package/react-file-reader-input // Definitions by: Dmitry Rogozhny // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-flex/index.d.ts b/react-flex/index.d.ts index 3bd87f1493..5cfd68da2b 100644 --- a/react-flex/index.d.ts +++ b/react-flex/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/zippyui/react-flex // Definitions by: Jeffery Grajkowski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react"; diff --git a/react-flexr/index.d.ts b/react-flexr/index.d.ts index ad89e2c775..a0ec7128c0 100644 --- a/react-flexr/index.d.ts +++ b/react-flexr/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/kodyl/react-flexr // Definitions by: Jeffery Grajkowski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-fontawesome/index.d.ts b/react-fontawesome/index.d.ts index 0950d66d95..76568cc43e 100644 --- a/react-fontawesome/index.d.ts +++ b/react-fontawesome/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/danawoodman/react-fontawesome // Definitions by: Timur Rustamov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare module "react-fontawesome" { diff --git a/react-gravatar/index.d.ts b/react-gravatar/index.d.ts index 804fe440bc..3e33584a4b 100644 --- a/react-gravatar/index.d.ts +++ b/react-gravatar/index.d.ts @@ -2,6 +2,7 @@ // Project: http://kyleamathews.github.io/react-gravatar/ // Definitions by: invliD // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react"; diff --git a/react-helmet/index.d.ts b/react-helmet/index.d.ts index d38c23f27d..730bfb6df3 100644 --- a/react-helmet/index.d.ts +++ b/react-helmet/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/nfl/react-helmet // Definitions by: Evan Bremer , Isman Usoh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-highlight-words/index.d.ts b/react-highlight-words/index.d.ts index a9ccc36fc6..aae2eff04e 100644 --- a/react-highlight-words/index.d.ts +++ b/react-highlight-words/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/bvaughn/react-highlight-words#readme // Definitions by: Mohamed Hegazy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import React = require("react"); diff --git a/react-holder/index.d.ts b/react-holder/index.d.ts index ea2cf79945..1f4f773783 100644 --- a/react-holder/index.d.ts +++ b/react-holder/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Moeriki/react-holder // Definitions by: Isman Usoh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-hot-loader/index.d.ts b/react-hot-loader/index.d.ts index 9987a4f28f..3355ec47e6 100644 --- a/react-hot-loader/index.d.ts +++ b/react-hot-loader/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/gaearon/react-hot-loader // Definitions by: Jacek Jagiello // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react" diff --git a/react-i18next/index.d.ts b/react-i18next/index.d.ts index 41daf14c4a..7114087cd6 100644 --- a/react-i18next/index.d.ts +++ b/react-i18next/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/i18next/react-i18next // Definitions by: Kostya Esmukov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as I18next from "i18next"; import * as React from "react"; diff --git a/react-imageloader/index.d.ts b/react-imageloader/index.d.ts index 8132058aa0..8f39d72aa9 100644 --- a/react-imageloader/index.d.ts +++ b/react-imageloader/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/hzdg/react-imageloader // Definitions by: Stephen Jelfs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-infinite/index.d.ts b/react-infinite/index.d.ts index 20105017e5..b8999b0817 100644 --- a/react-infinite/index.d.ts +++ b/react-infinite/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/seatgeek/react-infinite // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-input-calendar/index.d.ts b/react-input-calendar/index.d.ts index 8684b9b4a5..11e6fd6fe8 100644 --- a/react-input-calendar/index.d.ts +++ b/react-input-calendar/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Rudeg/react-input-calendar // Definitions by: Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-input-mask/index.d.ts b/react-input-mask/index.d.ts index 3764b61122..6fc8c6008f 100644 --- a/react-input-mask/index.d.ts +++ b/react-input-mask/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/sanniassin/react-input-mask // Definitions by: Alexandre Paré // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react"; diff --git a/react-intl-redux/index.d.ts b/react-intl-redux/index.d.ts index 79ab678c33..6182c38cab 100644 --- a/react-intl-redux/index.d.ts +++ b/react-intl-redux/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/ratson/react-intl-redux // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { Action } from "redux" import { Provider as ReduxProvider } from "react-redux" diff --git a/react-intl/index.d.ts b/react-intl/index.d.ts index e0d9d3f623..a9629c4009 100644 --- a/react-intl/index.d.ts +++ b/react-intl/index.d.ts @@ -2,6 +2,7 @@ // Project: http://formatjs.io/react/ // Definitions by: Bruno Grieder , Christian Droulers , Fedor Nezhivoi , Till Wolff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-intl/v1/index.d.ts b/react-intl/v1/index.d.ts index 1ba7481a84..e5f2c7e906 100644 --- a/react-intl/v1/index.d.ts +++ b/react-intl/v1/index.d.ts @@ -2,6 +2,7 @@ // Project: http://formatjs.io/react/ // Definitions by: Bruno Grieder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-is-deprecated/index.d.ts b/react-is-deprecated/index.d.ts index a896b68619..78b69921cd 100644 --- a/react-is-deprecated/index.d.ts +++ b/react-is-deprecated/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Aweary/react-is-deprecated // Definitions by: Sean Kelley // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare module 'react-is-deprecated' { import { Validator, Requireable, ValidationMap, ReactPropTypes } from 'react'; diff --git a/react-joyride/index.d.ts b/react-joyride/index.d.ts index 3e8e1e58ed..1a6d674ed4 100644 --- a/react-joyride/index.d.ts +++ b/react-joyride/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/gilbarbara/react-joyride // Definitions by: Daniel Rosenwasser // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import React = require("react"); diff --git a/react-json-tree/index.d.ts b/react-json-tree/index.d.ts index dd20fdb6e6..5939638495 100644 --- a/react-json-tree/index.d.ts +++ b/react-json-tree/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/alexkuz/react-json-tree/ // Definitions by: Grant Nestor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { Component, diff --git a/react-jsonschema-form/index.d.ts b/react-jsonschema-form/index.d.ts index 1ff2487144..6786862ea8 100644 --- a/react-jsonschema-form/index.d.ts +++ b/react-jsonschema-form/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mozilla-services/react-jsonschema-form // Definitions by: Dan Fox // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare module "react-jsonschema-form" { import * as React from "react"; diff --git a/react-jsonschema-form/react-jsonschema-form-tests.tsx b/react-jsonschema-form/react-jsonschema-form-tests.tsx index b5fdfff1c9..9f2c05086d 100644 --- a/react-jsonschema-form/react-jsonschema-form-tests.tsx +++ b/react-jsonschema-form/react-jsonschema-form-tests.tsx @@ -57,15 +57,18 @@ interface IExampleState { } export class Example extends React.Component { - constructor(props: any) { - super(props); - this.state.formData = { + public state: IExampleState = { + formData: { firstName: "Chuck", lastName: "Norris", age: 75, bio: "Roundhouse kicking asses since 1940", password: "noneed" - }; + } + } + + constructor(props: any) { + super(props); } public render() { diff --git a/react-maskedinput/index.d.ts b/react-maskedinput/index.d.ts index 3ef7333e77..6602240c67 100644 --- a/react-maskedinput/index.d.ts +++ b/react-maskedinput/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/insin/react-maskedinput // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { ComponentClass, HTMLAttributes } from "react"; diff --git a/react-mdl/index.d.ts b/react-mdl/index.d.ts index 48a38ac342..9f962d0156 100644 --- a/react-mdl/index.d.ts +++ b/react-mdl/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/tleunen/react-mdl // Definitions by: Brad Zacher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; diff --git a/react-measure/index.d.ts b/react-measure/index.d.ts index 8735747bac..be96956dfd 100644 --- a/react-measure/index.d.ts +++ b/react-measure/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/souporserious/react-measure // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare module "react-measure" { import * as React from "react"; diff --git a/react-mixin/index.d.ts b/react-mixin/index.d.ts index 64bcd99869..03781e659d 100644 --- a/react-mixin/index.d.ts +++ b/react-mixin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/brigand/react-mixin // Definitions by: Qubo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-modal/index.d.ts b/react-modal/index.d.ts index 59842fe99a..e5db7d66f0 100644 --- a/react-modal/index.d.ts +++ b/react-modal/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/reactjs/react-modal // Definitions by: Rajab Shakirov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-motion-slider/index.d.ts b/react-motion-slider/index.d.ts index e6046079b7..49c8caedd7 100644 --- a/react-motion-slider/index.d.ts +++ b/react-motion-slider/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/souporserious/react-motion-slider // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare module "react-motion-slider" { import * as React from "react"; diff --git a/react-motion/index.d.ts b/react-motion/index.d.ts index 1384f6c2df..8254ad78aa 100644 --- a/react-motion/index.d.ts +++ b/react-motion/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/chenglou/react-motion // Definitions by: Stepan Mikhaylyuk , Alexey Svetliakov // Definitions: https://github.com/borisyankov/DefinitelyTyped +// TypeScript Version: 2.1 import { Component, ReactElement } from 'react'; diff --git a/react-native-fs/index.d.ts b/react-native-fs/index.d.ts index 934d684a74..398657967c 100644 --- a/react-native-fs/index.d.ts +++ b/react-native-fs/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/johanneslumpe/react-native-fs // Definitions by: Paulo Cesar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-native-scrollable-tab-view/index.d.ts b/react-native-scrollable-tab-view/index.d.ts index b2d447c23c..2f22f1bcf4 100644 --- a/react-native-scrollable-tab-view/index.d.ts +++ b/react-native-scrollable-tab-view/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/brentvatne/react-native-scrollable-tab-view#readme // Definitions by: CaiHuan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; import { diff --git a/react-native-sortable-list/index.d.ts b/react-native-sortable-list/index.d.ts index f0349e12e5..777f26369b 100644 --- a/react-native-sortable-list/index.d.ts +++ b/react-native-sortable-list/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/gitim/react-native-sortable-list // Definitions by: Michael Sivolobov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; import { ViewStyle } from 'react-native'; diff --git a/react-native-swiper/index.d.ts b/react-native-swiper/index.d.ts index f1ff914346..f41a771caf 100644 --- a/react-native-swiper/index.d.ts +++ b/react-native-swiper/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/leecade/react-native-swiper#readme // Definitions by: CaiHuan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; import { diff --git a/react-native/index.d.ts b/react-native/index.d.ts index d63a339d0a..c46db449f8 100644 --- a/react-native/index.d.ts +++ b/react-native/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/facebook/react-native // Definitions by: Needs A Maintainer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/react-notification-system-redux/index.d.ts b/react-notification-system-redux/index.d.ts index da071f6142..5820a48da5 100644 --- a/react-notification-system-redux/index.d.ts +++ b/react-notification-system-redux/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/gor181/react-notification-system-redux // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { Component } from "react"; import { Action } from "redux"; diff --git a/react-notification-system/index.d.ts b/react-notification-system/index.d.ts index 046677e8f2..fcf5f41120 100644 --- a/react-notification-system/index.d.ts +++ b/react-notification-system/index.d.ts @@ -2,6 +2,7 @@ // Project: https://www.npmjs.com/package/react-notification-system // Definitions by: Giedrius Grabauskas , Deividas Bakanas , Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react"; diff --git a/react-onclickoutside/index.d.ts b/react-onclickoutside/index.d.ts index 8f1192496e..98bef683ad 100644 --- a/react-onclickoutside/index.d.ts +++ b/react-onclickoutside/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Pomax/react-onclickoutside // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react"; diff --git a/react-overlays/index.d.ts b/react-overlays/index.d.ts index 5d132a0ecd..10b67d9d51 100644 --- a/react-overlays/index.d.ts +++ b/react-overlays/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/react-bootstrap/react-overlays // Definitions by: Aaron Beall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react"; diff --git a/react-paginate/index.d.ts b/react-paginate/index.d.ts index 982f2fd65b..aaa3931b74 100644 --- a/react-paginate/index.d.ts +++ b/react-paginate/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/AdeleD/react-paginate // Definitions by: Simon Hartcher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react"; diff --git a/react-props-decorators/index.d.ts b/react-props-decorators/index.d.ts index 96280fd86b..d577f7b175 100644 --- a/react-props-decorators/index.d.ts +++ b/react-props-decorators/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/popkirby/react-props-decorators // Definitions by: Qubo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-recaptcha/index.d.ts b/react-recaptcha/index.d.ts index d17ed8ef34..39cca4037c 100644 --- a/react-recaptcha/index.d.ts +++ b/react-recaptcha/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/appleboy/react-recaptcha // Definitions by: Mohamed Hegazy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { Component } from "react"; export = Recaptcha; diff --git a/react-redux-i18n/index.d.ts b/react-redux-i18n/index.d.ts index d7851b23dc..a8ea035511 100644 --- a/react-redux-i18n/index.d.ts +++ b/react-redux-i18n/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/zoover/react-redux-i18n // Definitions by: Clément Devos // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare module 'react-redux-i18n' { import * as react from "react" diff --git a/react-redux-toastr/index.d.ts b/react-redux-toastr/index.d.ts index 8853924fce..af40ec724a 100644 --- a/react-redux-toastr/index.d.ts +++ b/react-redux-toastr/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/diegoddox/react-redux-toastr // Definitions by: Aleksandar Ivanov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare module "react-redux-toastr" { import * as React from "react"; diff --git a/react-redux/index.d.ts b/react-redux/index.d.ts index 3303908a01..2d76aaac00 100644 --- a/react-redux/index.d.ts +++ b/react-redux/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/rackt/react-redux // Definitions by: Qubo , Sean Kelley // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; import * as Redux from 'redux'; diff --git a/react-relay/index.d.ts b/react-relay/index.d.ts index 8e7a06d010..b238b53f77 100644 --- a/react-relay/index.d.ts +++ b/react-relay/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/facebook/relay // Definitions by: Johannes Schickling // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare module "react-relay" { import * as React from "react"; diff --git a/react-responsive/index.d.ts b/react-responsive/index.d.ts index 126a27f5b7..b88f33697a 100644 --- a/react-responsive/index.d.ts +++ b/react-responsive/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/contra/react-responsive // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare module "react-responsive" { import * as React from "react"; diff --git a/react-router-bootstrap/index.d.ts b/react-router-bootstrap/index.d.ts index b4b36006ec..7cf6ebaafc 100644 --- a/react-router-bootstrap/index.d.ts +++ b/react-router-bootstrap/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/react-bootstrap/react-router-bootstrap // Definitions by: Vincent Lesierse // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/react-router-redux/index.d.ts b/react-router-redux/index.d.ts index 16438f9452..62c6137a7a 100644 --- a/react-router-redux/index.d.ts +++ b/react-router-redux/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/rackt/react-router-redux // Definitions by: Isman Usoh , Noah Shipley , Dimitri Rosenberg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-router/index.d.ts b/react-router/index.d.ts index 80b1b97154..b1a577c617 100644 --- a/react-router/index.d.ts +++ b/react-router/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/rackt/react-router // Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík , Nathan Brown , Alex Wendland , Kostya Esmukov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-scroll/index.d.ts b/react-scroll/index.d.ts index 93e09acc2b..1f31f5f4c3 100644 --- a/react-scroll/index.d.ts +++ b/react-scroll/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/fisshy/react-scroll // Definitions by: Ioannis Kokkinidis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; diff --git a/react-scrollbar/index.d.ts b/react-scrollbar/index.d.ts index dcfc90d02e..8d5628f4a5 100644 --- a/react-scrollbar/index.d.ts +++ b/react-scrollbar/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/souhe/reactScrollbar // Definitions by: Stephen Jelfs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-select/index.d.ts b/react-select/index.d.ts index 336eb5460b..e59322d0dc 100644 --- a/react-select/index.d.ts +++ b/react-select/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/JedWatson/react-select // Definitions by: ESQUIBET Hugo , Gilad Gray , Izaak Baker , Tadas Dailyda , Mark Vujevits // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; diff --git a/react-side-effect/index.d.ts b/react-side-effect/index.d.ts index ed76d56af4..10f25ae1e3 100644 --- a/react-side-effect/index.d.ts +++ b/react-side-effect/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/gaearon/react-side-effect // Definitions by: Remo H. Jansen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import React = require("react"); diff --git a/react-slick/index.d.ts b/react-slick/index.d.ts index 9bd267cad1..07179c4daa 100644 --- a/react-slick/index.d.ts +++ b/react-slick/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/akiran/react-slick // Definitions by: Andrey Balokha // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-smooth-scrollbar/index.d.ts b/react-smooth-scrollbar/index.d.ts index df5746f9d4..6aea289136 100644 --- a/react-smooth-scrollbar/index.d.ts +++ b/react-smooth-scrollbar/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/idiotWu/react-smooth-scrollbar // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react"; import SmoothScrollbar, { ScrollbarOptions, ScrollStatusObject } from "smooth-scrollbar"; diff --git a/react-sortable-hoc/index.d.ts b/react-sortable-hoc/index.d.ts index b65bae7641..64a17f4800 100644 --- a/react-sortable-hoc/index.d.ts +++ b/react-sortable-hoc/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/clauderic/react-sortable-hoc // Definitions by: Ivo Stratev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare module 'react-sortable-hoc' { import React = require('react'); diff --git a/react-spinkit/index.d.ts b/react-spinkit/index.d.ts index 13c3542af6..9a14db213a 100644 --- a/react-spinkit/index.d.ts +++ b/react-spinkit/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/KyleAMathews/react-spinkit // Definitions by: Qubo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-split-pane/index.d.ts b/react-split-pane/index.d.ts index 3a6bc7bc6e..cdbb05d4c1 100644 --- a/react-split-pane/index.d.ts +++ b/react-split-pane/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/tomkp/react-split-pane // Definitions by: Roger Chen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-swf/index.d.ts b/react-swf/index.d.ts index ba300908ba..c03f2748b2 100644 --- a/react-swf/index.d.ts +++ b/react-swf/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/syranide/react-swf // Definitions by: Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; export as namespace ReactSWF; diff --git a/react-swipeable-views/index.d.ts b/react-swipeable-views/index.d.ts index 745ebb4582..91b0cfa45b 100644 --- a/react-swipeable-views/index.d.ts +++ b/react-swipeable-views/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/oliviertassinari/react-swipeable-views // Definitions by: Michael Ledin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; diff --git a/react-swipeable/index.d.ts b/react-swipeable/index.d.ts index 52d0e9c178..fadf0f057f 100644 --- a/react-swipeable/index.d.ts +++ b/react-swipeable/index.d.ts @@ -2,6 +2,7 @@ // Project: https://www.npmjs.com/package/react-swipeable // Definitions by: Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-syntax-highlighter/index.d.ts b/react-syntax-highlighter/index.d.ts index 35019a7b7e..57d81c9d6d 100644 --- a/react-syntax-highlighter/index.d.ts +++ b/react-syntax-highlighter/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/conorhastings/react-syntax-highlighter // Definitions by: Ivo Stratev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare module 'react-syntax-highlighter' { import SyntaxHighlighter from 'react-syntax-highlighter/dist/light'; diff --git a/react-tabs/index.d.ts b/react-tabs/index.d.ts index ebb5ae644b..9e8abce3cb 100644 --- a/react-tabs/index.d.ts +++ b/react-tabs/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/reactjs/react-tabs/ // Definitions by: Yuu Igarashi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; diff --git a/react-tagcloud/index.d.ts b/react-tagcloud/index.d.ts index 9759e99094..c1e8990bf6 100644 --- a/react-tagcloud/index.d.ts +++ b/react-tagcloud/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/madox2/react-tagcloud // Definitions by: wassname // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-test-renderer/index.d.ts b/react-test-renderer/index.d.ts index e3c27a057a..9908394888 100644 --- a/react-test-renderer/index.d.ts +++ b/react-test-renderer/index.d.ts @@ -2,6 +2,7 @@ // Project: https://facebook.github.io/react/ // Definitions by: Arvitaly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { ReactElement } from "react"; diff --git a/react-textarea-autosize/index.d.ts b/react-textarea-autosize/index.d.ts index ebf589f873..647d19c6ac 100644 --- a/react-textarea-autosize/index.d.ts +++ b/react-textarea-autosize/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/andreypopp/react-textarea-autosize // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare module "react-textarea-autosize" { import * as React from "react"; diff --git a/react-toggle/index.d.ts b/react-toggle/index.d.ts index af00deac09..29b3a547fd 100644 --- a/react-toggle/index.d.ts +++ b/react-toggle/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/aaronshaf/react-toggle // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { Component, HTMLAttributes, ReactNode } from "react"; diff --git a/react-user-tour/index.d.ts b/react-user-tour/index.d.ts index f1a0de4d46..2753a6f8b6 100644 --- a/react-user-tour/index.d.ts +++ b/react-user-tour/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/socialtables/react-user-tour // Definitions by: Carlo Cancellieri // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-virtualized/index.d.ts b/react-virtualized/index.d.ts index cff271ae5f..963af32a27 100644 --- a/react-virtualized/index.d.ts +++ b/react-virtualized/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/bvaughn/react-virtualized // Definitions by: Andrew de Waal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/react-widgets/index.d.ts b/react-widgets/index.d.ts index 04b63d8a95..9db30eb706 100644 --- a/react-widgets/index.d.ts +++ b/react-widgets/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jquense/react-widgets // Definitions by: Rogier Schouten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; diff --git a/react/README.md b/react/README.md index 7d2b3d80ab..c09dc060c2 100644 --- a/react/README.md +++ b/react/README.md @@ -1,8 +1,31 @@ ## Known Problems & Workarounds -### **The type of `setState` is incorrect.** -The `setState(state)` method on `React.Component` takes an object with a subset of the properties on `S`, but there's no way to express this in TypeScript currently. The workaround is simple: make all properties on `S` optional. There are a number of [proposals](https://github.com/Microsoft/TypeScript/issues/2710) on [ways](https://github.com/Microsoft/TypeScript/issues/4889) to [solve](https://github.com/Microsoft/TypeScript/issues/7355) this problem, but nothing seems to have been approved yet. +### **The type of `setState` is will be overly strict prior to TS 2.1.5** +Starting with TypeScript 2.1, its more correct than it used to be, with a caveat: optional parameters on state interfaces are no longer valid. This issue is corrected in 2.1.5 (and beyond) and thus `Pick` becomes ideal. +```ts +interface FooState { + bar: string; + foo?: string; +} + +const defaultFooState: FooState = { + bar: "Hi", + foo: undefined, +}; + +class Foo extends React.Component<{}, FooState> { + public doStuff() { + this.setState(defaultFooState); + } +} +``` + +Prior to 2.1.5, this code will produce an error. The other way the types could be written (using `Partial<>` instead of `Pick<>`) would allow for you to set `undefined` to a parameter that is not allowed +to be `undefined`, which could lead to bugs. Users who want to keep optional state parameters should continue to use the hack of `setState({...} as any);` in versions prior to 2.1.5. + +(This caveat should be dropped after no later than March 2017, maybe sooner.) + ### **The type of `cloneElement` is incorrect.** This is similar to the `setState` problem, in that `cloneElement(element, props)` should should accept a `props` object with a subset of the properties on `element.props`. There is an additional complication, however—React attributes, such as `key` and `ref`, should also be accepted in `props`, but should not exist on `element.props`. The "correct" way to model this, then, is with ```ts diff --git a/react/index.d.ts b/react/index.d.ts index 9972f80998..a840e4b64d 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -2,6 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft , John Reilly , Benoit Benezech , Patricio Zavolinsky // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 export = React; export as namespace React; @@ -165,8 +166,8 @@ declare namespace React { class Component implements ComponentLifecycle { constructor(props?: P, context?: any); constructor(...args: any[]); - setState(f: (prevState: S, props: P) => S, callback?: () => any): void; - setState(state: S, callback?: () => any): void; + setState(f: (prevState: S, props: P) => Pick, callback?: () => any): void; + setState(state: Pick, callback?: () => any): void; forceUpdate(callBack?: () => any): void; render(): JSX.Element | null; @@ -175,8 +176,8 @@ declare namespace React { // always pass children as variadic arguments to `createElement`. // In the future, if we can define its call signature conditionally // on the existence of `children` in `P`, then we should remove this. - props: { children?: ReactNode } & P; - state: S; + props: Readonly<{ children?: ReactNode }> & Readonly

; + state: Readonly; context: any; refs: { [key: string]: ReactInstance diff --git a/reactcss/index.d.ts b/reactcss/index.d.ts index 19faf7e9fa..2d571674f7 100644 --- a/reactcss/index.d.ts +++ b/reactcss/index.d.ts @@ -2,6 +2,7 @@ // Project: http://reactcss.com/ // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from "react" diff --git a/rebass/index.d.ts b/rebass/index.d.ts index 17708ae115..ae37b9fa2a 100644 --- a/rebass/index.d.ts +++ b/rebass/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jxnblk/rebass // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/recompose/index.d.ts b/recompose/index.d.ts index 5668d773d5..e72302415f 100644 --- a/recompose/index.d.ts +++ b/recompose/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/acdlite/recompose // Definitions by: Iskander Sierra // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/redux-bootstrap/index.d.ts b/redux-bootstrap/index.d.ts index 6a539853b7..171cf4d764 100644 --- a/redux-bootstrap/index.d.ts +++ b/redux-bootstrap/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/remojansen/redux-bootstrap // Definitions by: Remo H. Jansen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare module "redux-bootstrap" { import * as Redux from "redux"; diff --git a/redux-devtools-dock-monitor/index.d.ts b/redux-devtools-dock-monitor/index.d.ts index c1f8743292..de90f9a36e 100644 --- a/redux-devtools-dock-monitor/index.d.ts +++ b/redux-devtools-dock-monitor/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/gaearon/redux-devtools-dock-monitor // Definitions by: Petryshyn Sergii // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/redux-devtools-log-monitor/index.d.ts b/redux-devtools-log-monitor/index.d.ts index cc6f8cc7df..32062607c2 100644 --- a/redux-devtools-log-monitor/index.d.ts +++ b/redux-devtools-log-monitor/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/gaearon/redux-devtools-log-monitor // Definitions by: Petryshyn Sergii // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react' import {ColorScheme} from 'base16' diff --git a/redux-devtools/index.d.ts b/redux-devtools/index.d.ts index 28a551313f..f94239ff2e 100644 --- a/redux-devtools/index.d.ts +++ b/redux-devtools/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/gaearon/redux-devtools // Definitions by: Petryshyn Sergii // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; import { GenericStoreEnhancer } from 'redux'; diff --git a/redux-form/v4/index.d.ts b/redux-form/v4/index.d.ts index 77a3004710..fa4cd9dbaa 100644 --- a/redux-form/v4/index.d.ts +++ b/redux-form/v4/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/erikras/redux-form // Definitions by: Daniel Lytkin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; import { Component, SyntheticEvent, FormEventHandler } from 'react'; diff --git a/redux-router/index.d.ts b/redux-router/index.d.ts index 144f53c048..0c0f0ff29b 100644 --- a/redux-router/index.d.ts +++ b/redux-router/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/rackt/redux-router // Definitions by: Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as React from 'react'; import * as ReactRouter from 'react-router'; diff --git a/spectacle/index.d.ts b/spectacle/index.d.ts index 55227fbb2c..41095a5839 100644 --- a/spectacle/index.d.ts +++ b/spectacle/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/FormidableLabs/victory // Definitions by: Zachary Maybury // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/victory/index.d.ts b/victory/index.d.ts index 9be6990469..70d1ecb6f1 100644 --- a/victory/index.d.ts +++ b/victory/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/FormidableLabs/victory // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/why-did-you-update/index.d.ts b/why-did-you-update/index.d.ts index 09b2754438..4cd4567223 100644 --- a/why-did-you-update/index.d.ts +++ b/why-did-you-update/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/garbles/why-did-you-update // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// From 1f4489bff8ff00fbc82e2c4f92c51a458830e1f7 Mon Sep 17 00:00:00 2001 From: Craig Nishina Date: Thu, 19 Jan 2017 12:00:10 -0800 Subject: [PATCH 064/140] types(jasminewd): add new typings for jasminewd --- jasminewd2/index.d.ts | 73 +++++++++++++++++++ jasminewd2/jasminewd2-tests.ts | 123 +++++++++++++++++++++++++++++++++ jasminewd2/tsconfig.json | 20 ++++++ jasminewd2/tslint.json | 6 ++ 4 files changed, 222 insertions(+) create mode 100644 jasminewd2/index.d.ts create mode 100644 jasminewd2/jasminewd2-tests.ts create mode 100644 jasminewd2/tsconfig.json create mode 100644 jasminewd2/tslint.json diff --git a/jasminewd2/index.d.ts b/jasminewd2/index.d.ts new file mode 100644 index 0000000000..cff5236b50 --- /dev/null +++ b/jasminewd2/index.d.ts @@ -0,0 +1,73 @@ +// Type definitions for jasminewd2 2.0 +// Project: https://github.com/angular/jasminewd +// Definitions by: Sammy Jelin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare function it(expectation: string, assertion?: () => Promise, timeout?: number): void; +declare function fit(expectation: string, assertion?: () => Promise, timeout?: number): void; +declare function xit(expectation: string, assertion?: () => Promise, timeout?: number): void; +declare function beforeEach(action: () => Promise, timeout?: number): void; +declare function afterEach(action: () => Promise, timeout?: number): void; +declare function beforeAll(action: () => Promise, timeout?: number): void; +declare function afterAll(action: () => Promise, timeout?: number): void; + +declare namespace jasmine { + // The global `Promise` type is too strict and kinda wrong + interface Promise { + then(onFulfill?: (value: T) => U | Promise, onReject?: (error: any) => U | Promise): Promise; + } + + interface Matchers { + toBe(expected: any, expectationFailOutput?: any): Promise; + toEqual(expected: any, expectationFailOutput?: any): Promise; + toMatch(expected: string | RegExp | Promise, expectationFailOutput?: any): Promise; + toBeDefined(expectationFailOutput?: any): Promise; + toBeUndefined(expectationFailOutput?: any): Promise; + toBeNull(expectationFailOutput?: any): Promise; + toBeNaN(): Promise; + toBeTruthy(expectationFailOutput?: any): Promise; + toBeFalsy(expectationFailOutput?: any): Promise; + toHaveBeenCalled(): Promise; + toHaveBeenCalledWith(...params: any[]): Promise; + toHaveBeenCalledTimes(expected: number | Promise): Promise; + toContain(expected: any, expectationFailOutput?: any): Promise; + toBeLessThan(expected: number | Promise, expectationFailOutput?: any): Promise; + toBeLessThanOrEqual(expected: number | Promise, expectationFailOutput?: any): Promise; + toBeGreaterThan(expected: number | Promise, expectationFailOutput?: any): Promise; + toBeGreaterThanOrEqual(expected: number | Promise, expectationFailOutput?: any): Promise; + toBeCloseTo(expected: number | Promise, precision?: any, expectationFailOutput?: any): Promise; + toThrow(expected?: any): Promise; + toThrowError(message?: string | RegExp | Promise): Promise; + toThrowError(expected?: new (...args: any[]) => Error | Promise Error>, message?: string | RegExp | Promise): Promise; + } + + function addMatchers(matchers: AsyncCustomMatcherFactories): void; + + interface Env { + addMatchers(matchers: AsyncCustomMatcherFactories): void; + } + + interface Spec { + addMatchers(matchers: AsyncCustomMatcherFactories): void; + } + + interface AsyncCustomMatcherFactories { + [index: string]: AsyncCustomMatcherFactory; + } + + interface AsyncCustomMatcherFactory { + (util: MatchersUtil, customEqualityTesters: CustomEqualityTester[]): AsyncCustomMatcher; + } + + interface AsyncCustomMatcher { + compare(actual: T, expected: T): AsyncCustomMatcherResult; + compare(actual: any, expected: any): AsyncCustomMatcherResult; + } + + interface AsyncCustomMatcherResult { + pass: boolean | Promise; + message?: string; + } +} diff --git a/jasminewd2/jasminewd2-tests.ts b/jasminewd2/jasminewd2-tests.ts new file mode 100644 index 0000000000..c6612ae422 --- /dev/null +++ b/jasminewd2/jasminewd2-tests.ts @@ -0,0 +1,123 @@ +let promise = new Promise((resolve, reject) => { + resolve(); +}); + +describe('jasminewd', () => { + describe('global it, fit, xit, before and after', () => { + it('should be able to return promises', () => { + return promise; + }); + + fit('should be able to return promises', () => { + return promise; + }); + + xit('should be able to return promises', () => { + return promise; + }); + + beforeEach(() => { + return promise; + }); + + afterEach(() => { + return promise; + }); + + beforeAll(() => { + return promise; + }); + + afterAll(() => { + return promise; + }); + }); + + describe('matchers', () => { + it('should work', () => { + let expectedAny: any; + let expectationFailOutputAny: any; + let expectedString: string; + let expectedNumber: number; + let expectedRegExp: RegExp; + let expectedPromiseString: Promise; + let expectedPromiseNumber: Promise; + let expectedPromiseRegExp: Promise; + let paramsAny: any[]; + let error: Error; + let errorPromise: Promise; + + expect(expectedAny).toBe(expectationFailOutputAny); + expect(expectedAny).toEqual(expectationFailOutputAny); + expect(expectedString).toMatch(expectationFailOutputAny); + expect(expectedRegExp).toMatch(expectationFailOutputAny); + expect(expectedPromiseString).toMatch(expectationFailOutputAny); + expect(expectedPromiseRegExp).toMatch(expectationFailOutputAny); + expect(expectationFailOutputAny).toBeDefined(); + expect(expectationFailOutputAny).toBeUndefined(); + expect(expectationFailOutputAny).toBeNull(); + expect(expectedAny).toBeNaN(); + expect(expectedAny).toBeTruthy(); + expect(expectedAny).toBeFalsy(); + expect(expectedAny).toHaveBeenCalled(); + expect(expectedAny).toHaveBeenCalledWith(paramsAny); + expect(expectedAny).toHaveBeenCalledTimes(expectedNumber); + expect(expectedAny).toHaveBeenCalledTimes(expectedPromiseNumber); + expect(expectedAny).toContain(expectationFailOutputAny); + expect(expectedNumber).toBeLessThan(expectedNumber); + expect(expectedNumber).toBeLessThan(expectedPromiseNumber); + expect(expectedNumber).toBeLessThanOrEqual(expectedNumber); + expect(expectedNumber).toBeLessThanOrEqual(expectedPromiseNumber); + expect(expectedNumber).toBeGreaterThan(expectedNumber); + expect(expectedNumber).toBeGreaterThan(expectedPromiseNumber); + expect(expectedNumber).toBeGreaterThanOrEqual(expectedNumber); + expect(expectedNumber).toBeGreaterThanOrEqual(expectedPromiseNumber); + expect(expectedNumber).toBeCloseTo(expectedNumber, expectedNumber); + expect(expectedPromiseNumber).toBeCloseTo(expectationFailOutputAny, expectedNumber); + expect(expectedAny).toThrow(expectationFailOutputAny); + expect(expectedAny).toThrowError(expectedString); + expect(expectedAny).toThrowError(expectedRegExp); + expect(expectedAny).toThrowError(expectedPromiseString); + expect(expectedAny).toThrowError(expectedPromiseRegExp); + expect(error).toThrowError(expectedString); + expect(error).toThrowError(expectedRegExp); + expect(error).toThrowError(expectedPromiseString); + expect(error).toThrowError(expectedPromiseRegExp); + expect(error).toThrowError(expectedString); + expect(errorPromise).toThrowError(expectedString); + expect(errorPromise).toThrowError(expectedRegExp); + expect(errorPromise).toThrowError(expectedPromiseString); + expect(errorPromise).toThrowError(expectedPromiseRegExp); + expect(errorPromise).toThrowError(expectedString); + }); + }); + + describe('jasmine matchers', () => { + it('should be able to add matchers', () => { + let matchers = { + toBeLotsMoreThan: function() { + return { + compare: function(actual: number, expected: number) { + return { + pass: actual > expected + 100 + }; + } + }; + }, + // Example custom matcher returning a promise that resolves to true/false. + toBeDisplayed: function() { + return { + compare: function(actual: any, expected: void) { + return { + pass: (actual.isDisplayed() as Promise) + }; + } + }; + } + }; + jasmine.addMatchers(matchers); + jasmine.getEnv().addMatchers(matchers); + jasmine.getEnv().currentSpec.addMatchers(matchers); + }); + }); +}); diff --git a/jasminewd2/tsconfig.json b/jasminewd2/tsconfig.json new file mode 100644 index 0000000000..81aa80fe8e --- /dev/null +++ b/jasminewd2/tsconfig.json @@ -0,0 +1,20 @@ +{ + "files": [ + "index.d.ts", + "jasminewd2-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ "es6" ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/jasminewd2/tslint.json b/jasminewd2/tslint.json new file mode 100644 index 0000000000..9ca86427bd --- /dev/null +++ b/jasminewd2/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "callable-types": false + } +} From 4a2ed872c1f2228bc8d76b4007fe42484c500031 Mon Sep 17 00:00:00 2001 From: YYC <395976266@qq.com> Date: Tue, 24 Jan 2017 07:45:49 +0800 Subject: [PATCH 065/140] fix: cannon add version (#14201) * fix: cannon add version * fix: fix version --- cannon/index.d.ts | 2 +- wonder-commonlib/index.d.ts | 2 +- wonder-frp/index.d.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cannon/index.d.ts b/cannon/index.d.ts index 6551e07b32..45e005d53d 100644 --- a/cannon/index.d.ts +++ b/cannon/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cannon +// Type definitions for cannon 0.1 // Project: https://github.com/clark-stevenson/cannon.d.ts // Definitions by: Clark Stevenson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/wonder-commonlib/index.d.ts b/wonder-commonlib/index.d.ts index 3421de0125..464b6ada4e 100644 --- a/wonder-commonlib/index.d.ts +++ b/wonder-commonlib/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for wonder-commonlib v0.1.0 +// Type definitions for wonder-commonlib 0.1 // Project: https://github.com/yyc-git/Wonder-CommonLib // Definitions by: YYC // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/wonder-frp/index.d.ts b/wonder-frp/index.d.ts index c5e69d2dd9..c7459d6690 100644 --- a/wonder-frp/index.d.ts +++ b/wonder-frp/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for wonder-frp v0.1.0 +// Type definitions for wonder-frp 0.1 // Project: https://github.com/yyc-git/Wonder-FRP // Definitions by: YYC // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 1001a8eae92aff3d95aee7082459a36a51f2ca45 Mon Sep 17 00:00:00 2001 From: Justin Bay Date: Mon, 23 Jan 2017 19:33:00 -0500 Subject: [PATCH 066/140] Revert 80e4d8b/#11612. Fixes #14176 --- react/index.d.ts | 1 - react/test/index.ts | 14 -------------- 2 files changed, 15 deletions(-) diff --git a/react/index.d.ts b/react/index.d.ts index a840e4b64d..4a19ec723c 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -165,7 +165,6 @@ declare namespace React { // Base component for plain JS classes class Component implements ComponentLifecycle { constructor(props?: P, context?: any); - constructor(...args: any[]); setState(f: (prevState: S, props: P) => Pick, callback?: () => any): void; setState(state: Pick, callback?: () => any): void; forceUpdate(callBack?: () => any): void; diff --git a/react/test/index.ts b/react/test/index.ts index 0900926cf6..b575055514 100644 --- a/react/test/index.ts +++ b/react/test/index.ts @@ -659,20 +659,6 @@ React.createFactory(TransitionGroup)({ component: "div" }); let newObjShallow = update(obj, { $merge: { b: 6, c: 7 } }); // => {a: 5, b: 6, c: 7} } -// -// React Component classes super spread arguments -// -------------------------------------------------------------------------- -class ConstructorSpreadArgsComponent extends React.Component<{}, {}> { - constructor(...args: any[]) { - super(...args); - } -} -class ConstructorSpreadArgsPureComponent extends React.PureComponent<{}, {}> { - constructor(...args: any[]) { - super(...args); - } -} - // // The SyntheticEvent.target.value should be accessible for onChange // -------------------------------------------------------------------------- From 99d41f818c2de87790ce1f02956cbc39bce40f40 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 23 Jan 2017 17:22:52 -0800 Subject: [PATCH 067/140] Add UMD namespace declaration to 'roslib'. (#14203) --- roslib/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/roslib/index.d.ts b/roslib/index.d.ts index fbb6deff6e..c195387901 100644 --- a/roslib/index.d.ts +++ b/roslib/index.d.ts @@ -11,6 +11,7 @@ ---------------------------------- */ export = ROSLIB; +export as namespace ROSLIB; declare namespace ROSLIB { export class Ros { From 24c9f897f0f17c9cdcdf11184a25c33ee94aac3a Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Mon, 23 Jan 2017 22:08:03 -0500 Subject: [PATCH 068/140] Fix react-router-redux v3 --- react-router-redux/v3/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/react-router-redux/v3/index.d.ts b/react-router-redux/v3/index.d.ts index 83c9313e1e..e0b3a62698 100644 --- a/react-router-redux/v3/index.d.ts +++ b/react-router-redux/v3/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/rackt/react-router-redux // Definitions by: Isman Usoh , Noah Shipley , Dimitri Rosenberg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as Redux from "redux"; import * as History from "history"; From 12b8c9de5fd892dff77280988b7d40c542675b4f Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Mon, 23 Jan 2017 22:17:24 -0500 Subject: [PATCH 069/140] Try adding a package for redux --- react-router-redux/v3/package.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 react-router-redux/v3/package.json diff --git a/react-router-redux/v3/package.json b/react-router-redux/v3/package.json new file mode 100644 index 0000000000..36ce503807 --- /dev/null +++ b/react-router-redux/v3/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "redux": "^3.6.0" + } +} From 7e3ebd00f0ece65fc556713c5fad39c7253d7a90 Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Mon, 23 Jan 2017 19:58:07 -0800 Subject: [PATCH 070/140] raw-body: conditional return type based on options --- raw-body/index.d.ts | 21 ++++++++++++--------- raw-body/raw-body-tests.ts | 6 +++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/raw-body/index.d.ts b/raw-body/index.d.ts index a99f2c51c2..94131c5764 100644 --- a/raw-body/index.d.ts +++ b/raw-body/index.d.ts @@ -4,13 +4,16 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// + import { Readable } from "stream"; declare namespace getRawBody { + export type Encoding = string | true; + export interface Options { length?: number; limit?: number; - encoding?: string; + encoding?: Encoding; } export interface RawBodyError extends Error { @@ -19,18 +22,18 @@ declare namespace getRawBody { expected?: number; received?: number; encoding?: string; - status?: number; - statusCode?: number; - type?: string; + status: number; + statusCode: number; + type: string; } - - export type Callback = (err: RawBodyError, res: string | Buffer) => void; } -declare function getRawBody(stream: Readable, callback: getRawBody.Callback): void; -declare function getRawBody(stream: Readable, options: getRawBody.Options | string, callback: getRawBody.Callback): void; +declare function getRawBody(stream: Readable, callback: (err: getRawBody.RawBodyError, body: Buffer) => void): void; +declare function getRawBody(stream: Readable, options: (getRawBody.Options & { encoding: getRawBody.Encoding }) | getRawBody.Encoding, callback: (err: getRawBody.RawBodyError, body: string) => void): void; +declare function getRawBody(stream: Readable, options: getRawBody.Options, callback: (err: getRawBody.RawBodyError, body: Buffer) => void): void; -declare function getRawBody(stream: Readable, options?: getRawBody.Options | string): Promise; +declare function getRawBody(stream: Readable, options: (getRawBody.Options & { encoding: getRawBody.Encoding }) | getRawBody.Encoding): Promise; +declare function getRawBody(stream: Readable, options?: getRawBody.Options): Promise; export = getRawBody; diff --git a/raw-body/raw-body-tests.ts b/raw-body/raw-body-tests.ts index f23160c876..ad6065537d 100644 --- a/raw-body/raw-body-tests.ts +++ b/raw-body/raw-body-tests.ts @@ -2,11 +2,11 @@ import getRawBody = require("raw-body"); const stream: any = {}; -const simple = getRawBody(stream); +const simple: Promise = getRawBody(stream); -const withEncoding = getRawBody(stream, "utf-8"); +const withEncoding: Promise = getRawBody(stream, "utf-8"); -const withOptions = getRawBody(stream, { +const withOptions: Promise = getRawBody(stream, { encoding: "utf-8", length: 1024, limit: 512 From 928c0be342b96390221e1cc69d8c85031f945704 Mon Sep 17 00:00:00 2001 From: Fredrik Nicol Date: Sat, 21 Jan 2017 11:58:33 +0100 Subject: [PATCH 071/140] Add constructor arguments in `ClassType` --- react/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/react/index.d.ts b/react/index.d.ts index a840e4b64d..bfc41b609a 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -230,8 +230,8 @@ declare namespace React { */ type ClassType, C extends ComponentClass

> = C & - (new () => T) & - (new () => { props: P }); + (new (props?: P, context?: any) => T) & + (new (props?: P, context?: any) => { props: P }); // // Component Specs and Lifecycle From 0e50ed4cc33b26a7f3396cd61ed6e6d4ad9206ec Mon Sep 17 00:00:00 2001 From: Takenaka Simon Date: Tue, 24 Jan 2017 20:13:02 +0900 Subject: [PATCH 072/140] [storejs] Add forEach to type defintion --- storejs/index.d.ts | 3 ++- storejs/storejs-tests.ts | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/storejs/index.d.ts b/storejs/index.d.ts index ad5d8e979c..0068d94722 100644 --- a/storejs/index.d.ts +++ b/storejs/index.d.ts @@ -16,10 +16,11 @@ interface StoreJSStatic { getAll(): any; serialize(value: any): string; deserialize(value: string): any; + forEach(command: (key: string, value: any) => void): void; } declare var store: StoreJSStatic; declare module 'store' { - export = store; + export = store; } diff --git a/storejs/storejs-tests.ts b/storejs/storejs-tests.ts index 19e0ae898b..13c937c3c9 100644 --- a/storejs/storejs-tests.ts +++ b/storejs/storejs-tests.ts @@ -5,7 +5,7 @@ import * as store from 'store'; store.set('username', 'marcus'); // Get 'username' -var userName:any = store.get('username'); +var userName: any = store.get('username'); var all: Object = store.getAll(); @@ -22,3 +22,10 @@ store.set('user', { name: 'marcus', likes: 'javascript' }); var user: any = store.get('user'); alert(user.name + ' likes ' + user.likes); +// Get all stored values +store.getAll().user.name; + +// Loop over all stored values +store.forEach(function(key, val) { + console.log(key, '==', val); +}); From 35c3b91e095b7a5aa4cfd6d51e9bfbbda3b5a3b6 Mon Sep 17 00:00:00 2001 From: a8775 Date: Tue, 24 Jan 2017 14:48:02 +0100 Subject: [PATCH 073/140] detailing declaration for dgram socket.close () --- node/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/index.d.ts b/node/index.d.ts index 6e4fbce84e..93c0d7c709 100644 --- a/node/index.d.ts +++ b/node/index.d.ts @@ -2124,7 +2124,7 @@ declare module "dgram" { send(msg: Buffer | String | any[], offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void; bind(port?: number, address?: string, callback?: () => void): void; bind(options: BindOptions, callback?: Function): void; - close(callback?: any): void; + close(callback?: () => void): void; address(): AddressInfo; setBroadcast(flag: boolean): void; setTTL(ttl: number): void; From f0cbff79a4ed0b58d50b5a6475726cf02d2cc6a7 Mon Sep 17 00:00:00 2001 From: Peter Keuter Date: Tue, 24 Jan 2017 15:17:08 +0100 Subject: [PATCH 074/140] importDocument declaration --- xmlbuilder/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/xmlbuilder/index.d.ts b/xmlbuilder/index.d.ts index 4367a7fb10..20dabf97ca 100644 --- a/xmlbuilder/index.d.ts +++ b/xmlbuilder/index.d.ts @@ -62,6 +62,7 @@ declare class XMLElementOrXMLNode { declaration(version: string, encoding: string, standalone: boolean): XMLElementOrXMLNode; doctype(pubID: string, sysID: string): XMLDocType; up(): XMLElementOrXMLNode; + importDocument(input: XMLElementOrXMLNode): XMLElementOrXMLNode; root(): XMLElementOrXMLNode; document(): any; end(options?: Object): string; From 940a72926dd0b003374e1deb425652aa8e04744c Mon Sep 17 00:00:00 2001 From: Sebastian Sebald Date: Tue, 24 Jan 2017 16:50:07 +0100 Subject: [PATCH 075/140] redux-immutable: improve typings Current available typings for `redux-immutable` do only allow to have a `Reducer` and allow to be pass an arbitrary object to `combineReducers`. This patch updates the typings and brings them in-sync with the official `redux` typings. --- redux-immutable/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/redux-immutable/index.d.ts b/redux-immutable/index.d.ts index 2c378f02d8..386a3a1613 100644 --- a/redux-immutable/index.d.ts +++ b/redux-immutable/index.d.ts @@ -1,8 +1,8 @@ -// Type definitions for redux-immutable v3.0.5 +// Type definitions for redux-immutable v3.0.10 // Project: https://github.com/gajus/redux-immutable -// Definitions by: Pedro Pereira +// Definitions by: Sebastian Sebald // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Redux from 'redux'; -export declare function combineReducers(reducers: Object): Redux.Reducer; +export declare function combineReducers(reducers: Redux.ReducersMapObject): Redux.Reducer; From e22fc912b9109557b2878001055b66a52374d1c0 Mon Sep 17 00:00:00 2001 From: Joshua Sheard Date: Tue, 24 Jan 2017 18:15:13 +0000 Subject: [PATCH 076/140] Fix typo in TrianglesDrawModes enum --- three/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/three/index.d.ts b/three/index.d.ts index 3b0917f577..36263993c7 100644 --- a/three/index.d.ts +++ b/three/index.d.ts @@ -217,7 +217,7 @@ declare namespace THREE { // Triangle Draw modes export enum TrianglesDrawModes { } - export const TrianglesDrawModesMode: TrianglesDrawModes; + export const TrianglesDrawMode: TrianglesDrawModes; export const TriangleStripDrawMode: TrianglesDrawModes; export const TriangleFanDrawMode: TrianglesDrawModes; From 8d5006eaf0676765863624e059884e1ac066c5a4 Mon Sep 17 00:00:00 2001 From: Sebastian Sebald Date: Tue, 24 Jan 2017 20:20:56 +0100 Subject: [PATCH 077/140] Use original author --- redux-immutable/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redux-immutable/index.d.ts b/redux-immutable/index.d.ts index 386a3a1613..c8b2276c22 100644 --- a/redux-immutable/index.d.ts +++ b/redux-immutable/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for redux-immutable v3.0.10 // Project: https://github.com/gajus/redux-immutable -// Definitions by: Sebastian Sebald +// Definitions by: Pedro Pereira // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Redux from 'redux'; From 386cc89aa9abc7775600e80096e22787253d82ef Mon Sep 17 00:00:00 2001 From: Sebastian Sebald Date: Tue, 24 Jan 2017 22:34:26 +0100 Subject: [PATCH 078/140] Add myself as author --- redux-immutable/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redux-immutable/index.d.ts b/redux-immutable/index.d.ts index c8b2276c22..483de7c9bf 100644 --- a/redux-immutable/index.d.ts +++ b/redux-immutable/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for redux-immutable v3.0.10 // Project: https://github.com/gajus/redux-immutable -// Definitions by: Pedro Pereira +// Definitions by: Pedro Pereira , Sebastian Sebald // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Redux from 'redux'; From 1989ed4c5a8f0cfea032a30220afb81dab98ca88 Mon Sep 17 00:00:00 2001 From: Simon Ramsay Date: Tue, 24 Jan 2017 16:33:36 -0500 Subject: [PATCH 079/140] added additional typing for assigning result of dot-object conversion - bumped version number --- dot-object/dot-object-tests.ts | 23 ++++++++++++++--------- dot-object/index.d.ts | 25 ++++++++++++++++--------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/dot-object/dot-object-tests.ts b/dot-object/dot-object-tests.ts index 603a66c57e..a553c6c68d 100644 --- a/dot-object/dot-object-tests.ts +++ b/dot-object/dot-object-tests.ts @@ -16,10 +16,10 @@ var src = { } }; -var tgt = {name: 'Brandon'}; +var tgt = { name: 'Brandon' }; dot.copy('stuff.phone', 'wanna.haves.phone', src, tgt, [(arg: any) => { - return arg; + return arg; }]); dot.transfer('stuff.phone', 'wanna.haves.phone', src, tgt); @@ -37,17 +37,17 @@ var row = { }; dot.object(row, (arg: any) => { - return arg; + return arg; }); dot.str('this.is.my.string', 'value', tgt); var newObj = { - some: { - nested: { - value: 'Hi there!' - } - } + some: { + nested: { + value: 'Hi there!' + } + } }; var val = dot.pick('some.nested.value', newObj); @@ -62,4 +62,9 @@ val = dot.remove('some.nested.value', newObj); // or use the alias `del` val = dot.del('some.nested.value', newObj); -var dotWithArrow = new dot('=>'); \ No newline at end of file +// convert object to dot object +var result = {}; +dot.dot({ test: 'something' }, result); +result = dot.dot({ test: 'something' }); + +var dotWithArrow = new dot('=>'); diff --git a/dot-object/index.d.ts b/dot-object/index.d.ts index 953291c631..176e1c0daf 100644 --- a/dot-object/index.d.ts +++ b/dot-object/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Dot-Object v1.4.1 +// Type definitions for Dot-Object v1.4.2 // Project: https://github.com/rhalff/dot-object // Definitions by: Niko Kovačič // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -6,14 +6,14 @@ declare namespace DotObject { interface DotConstructor extends Dot { - new(separator: string): Dot; + new (separator: string): Dot; } interface ModifierFunctionWrapper { (arg: any): any; } - interface Dot { + interface Dot { /** * * Copy a property from one object to another object. @@ -34,11 +34,6 @@ declare namespace DotObject { * Convert object to dotted-key/value pair * * Usage: - * - * var tgt = dot.dot(obj) - * - * or - * * var tgt = {} * dot.dot(obj, tgt) * @@ -46,6 +41,18 @@ declare namespace DotObject { * @param {Object} tgt target object */ dot(obj: any, tgt: any): void + /** + * + * Convert object to dotted-key/value pair + * + * Usage: + * + * var tgt = dot.dot(obj) + * @param {Object} obj source object + * @return {Object} result + */ + dot(obj: any): any + /** * * Remove value from an object using dot notation. @@ -166,4 +173,4 @@ declare var dot: DotObject.DotConstructor; declare module 'dot-object' { export = dot; -} \ No newline at end of file +} From c960430ff9a47bb94ef53ad79fbb759343ea3abb Mon Sep 17 00:00:00 2001 From: Mohsen Azimi Date: Tue, 24 Jan 2017 13:43:22 -0800 Subject: [PATCH 080/140] Fix typo in webpack PerformanceOptions s/maxEntryPointSize/maxEntrypointSize --- webpack/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack/index.d.ts b/webpack/index.d.ts index 73f575c973..a557034131 100644 --- a/webpack/index.d.ts +++ b/webpack/index.d.ts @@ -1146,7 +1146,7 @@ declare namespace webpack { /** * An entrypoint represents all assets that would be utilized during initial load time for a specific entry. This option controls when webpack should emit performance hints based on the maximum entrypoint size. The default value is 250000 (bytes). */ - maxEntryPointSize?: number; + maxEntrypointSize?: number; /** * An asset is any emitted file from webpack. This option controls when webpack emits a performance hint based on individual asset size. The default value is 250000 (bytes). */ From a70e784fec04cf50367ebcd11d88c67a66058614 Mon Sep 17 00:00:00 2001 From: Mohsen Azimi Date: Tue, 24 Jan 2017 14:59:01 -0800 Subject: [PATCH 081/140] fix test --- webpack/webpack-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack/webpack-tests.ts b/webpack/webpack-tests.ts index 8af08751ed..7c1f109a2d 100644 --- a/webpack/webpack-tests.ts +++ b/webpack/webpack-tests.ts @@ -544,7 +544,7 @@ const resolve: webpack.Resolve = { const performance: webpack.PerformanceOptions = { hints: 'error', - maxEntryPointSize: 400000, + maxEntrypointSize: 400000, maxAssetSize: 100000, assetFilter: function(assetFilename) { return assetFilename.endsWith('.js'); From ae3b2e73d3045104dc0ba279f2363ec7746dce00 Mon Sep 17 00:00:00 2001 From: Homa Wong Date: Tue, 24 Jan 2017 16:29:09 -0800 Subject: [PATCH 082/140] Update index.d.ts --- redux-logger/index.d.ts | 78 ++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/redux-logger/index.d.ts b/redux-logger/index.d.ts index edcb2b9152..2c02273d60 100644 --- a/redux-logger/index.d.ts +++ b/redux-logger/index.d.ts @@ -5,46 +5,46 @@ import * as Redux from "redux"; -type LoggerPredicate = (getState: () => any, action: any) => boolean; - -type StateToString = (state: any) => string; -type ActionToString = (action: any) => string; -type ErrorToString = (error: any, prevState: any) => string; - -interface ColorsObject { - title?: boolean | ActionToString; - prevState?: boolean | StateToString; - action?: boolean | ActionToString; - nextState?: boolean | StateToString; - error?: boolean | ErrorToString; -} - -interface LevelObject { - prevState?: string | boolean | StateToString; - action?: string | boolean | ActionToString; - nextState?: string | boolean | StateToString; - error?: string | boolean | ErrorToString; -} - -interface ReduxLoggerOptions { - level?: string | ActionToString | LevelObject; - duration?: boolean; - timestamp?: boolean; - colors?: ColorsObject; - logger?: any; - logErrors?: boolean; - collapsed?: boolean | LoggerPredicate; - predicate?: LoggerPredicate; - stateTransformer?: (state: any) => any; - actionTransformer?: (action: any) => any; - errorTransformer?: (error: any) => any; - diff?: boolean; - diffPredicate?: LoggerPredicate; -} - // Trickery to get TypeScript to accept that our anonymous, non-default export is a function. // see https://github.com/Microsoft/TypeScript/issues/3612 for more -declare namespace createLogger { } -declare function createLogger(options?: ReduxLoggerOptions): Redux.Middleware; +declare namespace createLogger { + export type LoggerPredicate = (getState: () => any, action: any) => boolean; + + export type StateToString = (state: any) => string; + export type ActionToString = (action: any) => string; + export type ErrorToString = (error: any, prevState: any) => string; + + export interface ColorsObject { + title?: boolean | ActionToString; + prevState?: boolean | StateToString; + action?: boolean | ActionToString; + nextState?: boolean | StateToString; + error?: boolean | ErrorToString; + } + + export interface LevelObject { + prevState?: string | boolean | StateToString; + action?: string | boolean | ActionToString; + nextState?: string | boolean | StateToString; + error?: string | boolean | ErrorToString; + } + + export interface ReduxLoggerOptions { + level?: string | ActionToString | LevelObject; + duration?: boolean; + timestamp?: boolean; + colors?: ColorsObject; + logger?: any; + logErrors?: boolean; + collapsed?: boolean | LoggerPredicate; + predicate?: LoggerPredicate; + stateTransformer?: (state: any) => any; + actionTransformer?: (action: any) => any; + errorTransformer?: (error: any) => any; + diff?: boolean; + diffPredicate?: LoggerPredicate; + } +} +declare function createLogger(options?: createLogger.ReduxLoggerOptions): Redux.Middleware; export = createLogger; From afa6e180c8cd8ab091b4f38a885df70633e937ba Mon Sep 17 00:00:00 2001 From: Homa Wong Date: Tue, 24 Jan 2017 16:35:38 -0800 Subject: [PATCH 083/140] Update index.d.ts --- redux-logger/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/redux-logger/index.d.ts b/redux-logger/index.d.ts index 2c02273d60..257f070d44 100644 --- a/redux-logger/index.d.ts +++ b/redux-logger/index.d.ts @@ -5,7 +5,6 @@ import * as Redux from "redux"; - // Trickery to get TypeScript to accept that our anonymous, non-default export is a function. // see https://github.com/Microsoft/TypeScript/issues/3612 for more declare namespace createLogger { From 95bd599bc879a80a389b3f43fd132737a004ce72 Mon Sep 17 00:00:00 2001 From: Alvaro Dias Date: Tue, 24 Jan 2017 20:47:04 -0800 Subject: [PATCH 084/140] documentdb: Add typings for user-defined functions --- documentdb/documentdb-tests.ts | 25 +++++++++++++++++++++++++ documentdb/index.d.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/documentdb/documentdb-tests.ts b/documentdb/documentdb-tests.ts index 34d6b5236b..f4a06d3fb7 100644 --- a/documentdb/documentdb-tests.ts +++ b/documentdb/documentdb-tests.ts @@ -55,6 +55,31 @@ docDBClient.createStoredProcedure('collection', procedure, undefined, (error, re } }); +var userDefinedFunction: docDB.UserDefinedFunction = { + id: 'udf1', + body: function () { + console.log('foo'); + } +}; + +docDBClient.createUserDefinedFunction('collection', userDefinedFunction, undefined, (error, result) => { + if (error) { + throw new Error(error.body); + } + else { + console.log('Created function: ' + result.id); + } +}); + +docDBClient.queryUserDefinedFunctions('collection', "SELECT * FROM root", undefined).toArray((error, results) => { + if (error) { + throw new Error(error.body); + } + else { + console.log('Number of functions in collection: ' + results.length); + } +}); + var trigger: docDB.Trigger = { id: 'trigger-one', body: function () { diff --git a/documentdb/index.d.ts b/documentdb/index.d.ts index 406affe2c8..048825b492 100644 --- a/documentdb/index.d.ts +++ b/documentdb/index.d.ts @@ -154,6 +154,10 @@ interface ProcedureMeta extends AbstractMeta { body: string; } +/** Represents the meta data for a user-defined function. */ +interface UserDefinedFunctionMeta extends AbstractMeta { +} + /** Represents the meta data for a trigger. */ interface TriggerMeta extends AbstractMeta { body: string; @@ -181,6 +185,13 @@ export interface Procedure extends UniqueId { body(...params: any[]): void; } +/** Represents a DocumentDB user-defined function. */ +export interface UserDefinedFunction extends UniqueId { + + /** The function representing the user-defined function. */ + body(...params: any[]): void; +} + /** Represents a DocumentDB trigger. */ export interface Trigger extends UniqueId { /** The type of the trigger. Should be either 'pre' or 'post'. */ @@ -290,6 +301,19 @@ export declare class DocumentClient { */ public createStoredProcedure(collectionLink: string, procedure: Procedure, options: RequestOptions, callback: RequestCallback): void; + /** + * Create a UserDefinedFunction. + *

+ * DocumentDB supports JavaScript UDFs which can be used inside queries, stored procedures and triggers.
+ * For additional details, refer to the server-side JavaScript API documentation. + *

+ * @param collectionLink - The self-link of the collection. + * @param udf - Represents the body of the userDefinedFunction. + * @param [options] - The request options. + * @param callback - The callback for the request. + */ + public createUserDefinedFunction(collectionLink: string, udf: UserDefinedFunction, options: RequestOptions, callback: RequestCallback): void; + /** * Create a trigger. *

@@ -349,6 +373,15 @@ export declare class DocumentClient { */ public queryStoredProcedures(collectionLink: string, query: string | SqlQuerySpec): QueryIterator; + /** + * Query the user-defined functions for the collection. + * @param collectionLink - The self-link of the collection. + * @param query - A SQL query string. + * @param [options] - Represents the feed options. + * @returns - An instance of queryIterator to handle reading feed. + */ + public queryUserDefinedFunctions(collectionLink: string, query: string | SqlQuerySpec, options?: FeedOptions): QueryIterator; + /** * Query the documents for the collection. * @param collectionLink - The self-link of the collection. From a6e94fdb0a80fbeacea1786d60cc0a67deaf9d6b Mon Sep 17 00:00:00 2001 From: Shun Date: Tue, 24 Jan 2017 21:54:20 -0800 Subject: [PATCH 085/140] Add module --- forever-monitor/forever-monitor-tests.ts | 0 forever-monitor/index.d.ts | 104 +++++++++++++++++++++++ forever-monitor/tsconfig.json | 20 +++++ forever-monitor/tslint.json | 1 + 4 files changed, 125 insertions(+) create mode 100644 forever-monitor/forever-monitor-tests.ts create mode 100644 forever-monitor/index.d.ts create mode 100644 forever-monitor/tsconfig.json create mode 100644 forever-monitor/tslint.json diff --git a/forever-monitor/forever-monitor-tests.ts b/forever-monitor/forever-monitor-tests.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/forever-monitor/index.d.ts b/forever-monitor/index.d.ts new file mode 100644 index 0000000000..b22905cae2 --- /dev/null +++ b/forever-monitor/index.d.ts @@ -0,0 +1,104 @@ +// Type definitions for forever-monitor 1.7 +// Project: https://github.com/nodejitsu/forever-monitor#readme +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + +interface spawnWith { + customFds: number[]; + setsid: boolean; + uid: number; + gid: number; +} + +interface parserArgs { + command: string; + args: string[]; +} + +interface Options { + silent?: boolean; + uid?: "autogen" | string; + pidFile?: string; + max?: number; + killTree?: boolean; + minUptime?: number; + spinSleepTime?: number; + command?: "node" | string; + args?: string[]; + sourceDir?: string; + watch?: boolean; + watchIgnoreDotFiles?: boolean; + watchIgnorePatters?: string[]; + watchDirectory?: string; + spawnWith?: spawnWith; + env?: { [envKey: string]: string; }; + cwd?: string; + logFile?: string; + outFile?: string; + errFile?: string; + parser?: (command: string, args: string[]) => { command: string, args: string[] }; +} + + +export declare class Monitor extends NodeJS.EventEmitter { + + /** + * @param script - Location of the target script to run. + * @param [options] - Configuration for this instance. + */ + constructor(script: string, options?: Options); + + /** + * @description Start the process that this instance is configured for + * @param [restart] - Value indicating whether this is a restart. + */ + public start(restart?: boolean): this; + + /** + * @description Tries to spawn the target Forever child process. + */ + public trySpawn(): boolean; + + /** + * @description Restarts the target script associated with this instance. + */ + public restart(): this; + + /** + * @description Stops the target script associated with this instance. Prevents it from auto-respawning + */ + public stop(): this; + + /** + * @description Kills the ChildProcess object associated with this instance + * @param [forceStop] - Value indicating whether short circuit forever auto-restart + */ + public kill(forceStop?: boolean): this; + + /** + * @description Sends a message to a forked ChildProcess object associated with this instance + */ + public send(msg?: any): this; + + /** + * respond with JSON for this instance + */ + public toString(): string; + + /** + * @param command - Command string to parse + * @param args - Additional default arguments + */ + public parseCommand(command: string, args?: string[]): (false | { command: string, args?: string[]}); +} + +interface forever { + Monitor: Monitor; + start: (script: string, options: Options) => Monitor; + kill: (pid: number, killTree?: boolean, signal?: string, callback?: () => any) => void; + checkProcess: (pid: number) => boolean; + version: string; +} + +export default forever; diff --git a/forever-monitor/tsconfig.json b/forever-monitor/tsconfig.json new file mode 100644 index 0000000000..8c6d4986b5 --- /dev/null +++ b/forever-monitor/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "forever-monitor-tests.ts" + ] +} diff --git a/forever-monitor/tslint.json b/forever-monitor/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/forever-monitor/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 1ca0a1b3f98ad5ce8713543791b97014d5250bd6 Mon Sep 17 00:00:00 2001 From: darlin Date: Wed, 25 Jan 2017 14:26:11 +0800 Subject: [PATCH 086/140] update submodule --- crypto-js/aes/index.d.ts | 3 + crypto-js/core/index.d.ts | 3 + crypto-js/enc-base64/index.d.ts | 4 + crypto-js/enc-hex/index.d.ts | 4 + crypto-js/enc-latin1/index.d.ts | 4 + crypto-js/enc-utf16/index.d.ts | 4 + crypto-js/enc-utf8/index.d.ts | 4 + crypto-js/evpkdf/index.d.ts | 3 + crypto-js/format-hex/index.d.ts | 4 + crypto-js/format-openssl/index.d.ts | 4 + crypto-js/hmac-md5/index.d.ts | 3 + crypto-js/hmac-ripemd160/index.d.ts | 3 + crypto-js/hmac-sha1/index.d.ts | 3 + crypto-js/hmac-sha224/index.d.ts | 3 + crypto-js/hmac-sha256/index.d.ts | 3 + crypto-js/hmac-sha3/index.d.ts | 3 + crypto-js/hmac-sha384/index.d.ts | 3 + crypto-js/hmac-sha512/index.d.ts | 3 + crypto-js/index.d.ts | 237 +------------------------- crypto-js/lib-typedarrays/index.d.ts | 2 + crypto-js/md5/index.d.ts | 3 + crypto-js/mode-cfb/index.d.ts | 4 + crypto-js/mode-ctr-gladman/index.d.ts | 4 + crypto-js/mode-ctr/index.d.ts | 4 + crypto-js/mode-ecb/index.d.ts | 4 + crypto-js/mode-ofb/index.d.ts | 4 + crypto-js/pad-ansix923/index.d.ts | 4 + crypto-js/pad-iso10126/index.d.ts | 4 + crypto-js/pad-iso97971/index.d.ts | 4 + crypto-js/pad-nopadding/index.d.ts | 4 + crypto-js/pad-pkcs7/index.d.ts | 4 + crypto-js/pad-zeropadding/index.d.ts | 4 + crypto-js/pbkdf2/index.d.ts | 3 + crypto-js/rabbit-legacy/index.d.ts | 3 + crypto-js/rabbit/index.d.ts | 3 + crypto-js/rc4/index.d.ts | 3 + crypto-js/ripemd160/index.d.ts | 3 + crypto-js/sha1/index.d.ts | 3 + crypto-js/sha224/index.d.ts | 3 + crypto-js/sha256/index.d.ts | 3 + crypto-js/sha3/index.d.ts | 3 + crypto-js/sha384/index.d.ts | 3 + crypto-js/sha512/index.d.ts | 3 + crypto-js/tripledes/index.d.ts | 3 + crypto-js/x64-core/index.d.ts | 3 + 45 files changed, 152 insertions(+), 234 deletions(-) create mode 100644 crypto-js/aes/index.d.ts create mode 100644 crypto-js/core/index.d.ts create mode 100644 crypto-js/enc-base64/index.d.ts create mode 100644 crypto-js/enc-hex/index.d.ts create mode 100644 crypto-js/enc-latin1/index.d.ts create mode 100644 crypto-js/enc-utf16/index.d.ts create mode 100644 crypto-js/enc-utf8/index.d.ts create mode 100644 crypto-js/evpkdf/index.d.ts create mode 100644 crypto-js/format-hex/index.d.ts create mode 100644 crypto-js/format-openssl/index.d.ts create mode 100644 crypto-js/hmac-md5/index.d.ts create mode 100644 crypto-js/hmac-ripemd160/index.d.ts create mode 100644 crypto-js/hmac-sha1/index.d.ts create mode 100644 crypto-js/hmac-sha224/index.d.ts create mode 100644 crypto-js/hmac-sha256/index.d.ts create mode 100644 crypto-js/hmac-sha3/index.d.ts create mode 100644 crypto-js/hmac-sha384/index.d.ts create mode 100644 crypto-js/hmac-sha512/index.d.ts create mode 100644 crypto-js/lib-typedarrays/index.d.ts create mode 100644 crypto-js/md5/index.d.ts create mode 100644 crypto-js/mode-cfb/index.d.ts create mode 100644 crypto-js/mode-ctr-gladman/index.d.ts create mode 100644 crypto-js/mode-ctr/index.d.ts create mode 100644 crypto-js/mode-ecb/index.d.ts create mode 100644 crypto-js/mode-ofb/index.d.ts create mode 100644 crypto-js/pad-ansix923/index.d.ts create mode 100644 crypto-js/pad-iso10126/index.d.ts create mode 100644 crypto-js/pad-iso97971/index.d.ts create mode 100644 crypto-js/pad-nopadding/index.d.ts create mode 100644 crypto-js/pad-pkcs7/index.d.ts create mode 100644 crypto-js/pad-zeropadding/index.d.ts create mode 100644 crypto-js/pbkdf2/index.d.ts create mode 100644 crypto-js/rabbit-legacy/index.d.ts create mode 100644 crypto-js/rabbit/index.d.ts create mode 100644 crypto-js/rc4/index.d.ts create mode 100644 crypto-js/ripemd160/index.d.ts create mode 100644 crypto-js/sha1/index.d.ts create mode 100644 crypto-js/sha224/index.d.ts create mode 100644 crypto-js/sha256/index.d.ts create mode 100644 crypto-js/sha3/index.d.ts create mode 100644 crypto-js/sha384/index.d.ts create mode 100644 crypto-js/sha512/index.d.ts create mode 100644 crypto-js/tripledes/index.d.ts create mode 100644 crypto-js/x64-core/index.d.ts diff --git a/crypto-js/aes/index.d.ts b/crypto-js/aes/index.d.ts new file mode 100644 index 0000000000..4f435688c5 --- /dev/null +++ b/crypto-js/aes/index.d.ts @@ -0,0 +1,3 @@ +import { AES } from '../index'; + +export = AES; diff --git a/crypto-js/core/index.d.ts b/crypto-js/core/index.d.ts new file mode 100644 index 0000000000..c5d6e00410 --- /dev/null +++ b/crypto-js/core/index.d.ts @@ -0,0 +1,3 @@ +import * as Core from '../index'; + +export = Core; diff --git a/crypto-js/enc-base64/index.d.ts b/crypto-js/enc-base64/index.d.ts new file mode 100644 index 0000000000..55001a7115 --- /dev/null +++ b/crypto-js/enc-base64/index.d.ts @@ -0,0 +1,4 @@ +import { enc } from '../index'; + +declare const Base64: typeof enc.Base64; +export = Base64; diff --git a/crypto-js/enc-hex/index.d.ts b/crypto-js/enc-hex/index.d.ts new file mode 100644 index 0000000000..3718860123 --- /dev/null +++ b/crypto-js/enc-hex/index.d.ts @@ -0,0 +1,4 @@ +import { enc } from '../index'; + +declare const Hex: typeof enc.Hex; +export = Hex; diff --git a/crypto-js/enc-latin1/index.d.ts b/crypto-js/enc-latin1/index.d.ts new file mode 100644 index 0000000000..7f27822daf --- /dev/null +++ b/crypto-js/enc-latin1/index.d.ts @@ -0,0 +1,4 @@ +import { enc } from '../index'; + +declare const Latin1: typeof enc.Latin1; +export = Latin1; diff --git a/crypto-js/enc-utf16/index.d.ts b/crypto-js/enc-utf16/index.d.ts new file mode 100644 index 0000000000..76fa98774a --- /dev/null +++ b/crypto-js/enc-utf16/index.d.ts @@ -0,0 +1,4 @@ +import { enc } from '../index'; + +declare const Utf16: typeof enc.Utf16; +export = Utf16; diff --git a/crypto-js/enc-utf8/index.d.ts b/crypto-js/enc-utf8/index.d.ts new file mode 100644 index 0000000000..828dcb9391 --- /dev/null +++ b/crypto-js/enc-utf8/index.d.ts @@ -0,0 +1,4 @@ +import { enc } from '../index'; + +declare const Utf8: typeof enc.Utf8; +export = Utf8; diff --git a/crypto-js/evpkdf/index.d.ts b/crypto-js/evpkdf/index.d.ts new file mode 100644 index 0000000000..8946b9d3a1 --- /dev/null +++ b/crypto-js/evpkdf/index.d.ts @@ -0,0 +1,3 @@ +import { EvpKDF } from '../index'; + +export = EvpKDF; diff --git a/crypto-js/format-hex/index.d.ts b/crypto-js/format-hex/index.d.ts new file mode 100644 index 0000000000..1b0f573824 --- /dev/null +++ b/crypto-js/format-hex/index.d.ts @@ -0,0 +1,4 @@ +import { format } from '../index'; + +declare const Hex: typeof format.Hex; +export = Hex; diff --git a/crypto-js/format-openssl/index.d.ts b/crypto-js/format-openssl/index.d.ts new file mode 100644 index 0000000000..02c35a3688 --- /dev/null +++ b/crypto-js/format-openssl/index.d.ts @@ -0,0 +1,4 @@ +import { format } from '../index'; + +declare const OpenSSL: typeof format.OpenSSL; +export = OpenSSL; diff --git a/crypto-js/hmac-md5/index.d.ts b/crypto-js/hmac-md5/index.d.ts new file mode 100644 index 0000000000..7240576710 --- /dev/null +++ b/crypto-js/hmac-md5/index.d.ts @@ -0,0 +1,3 @@ +import { HmacMD5 } from '../index'; + +export = HmacMD5; diff --git a/crypto-js/hmac-ripemd160/index.d.ts b/crypto-js/hmac-ripemd160/index.d.ts new file mode 100644 index 0000000000..6c371e9435 --- /dev/null +++ b/crypto-js/hmac-ripemd160/index.d.ts @@ -0,0 +1,3 @@ +import { HmacRIPEMD160 } from '../index'; + +export = HmacRIPEMD160; diff --git a/crypto-js/hmac-sha1/index.d.ts b/crypto-js/hmac-sha1/index.d.ts new file mode 100644 index 0000000000..1995cf87f6 --- /dev/null +++ b/crypto-js/hmac-sha1/index.d.ts @@ -0,0 +1,3 @@ +import { HmacSHA1 } from '../index'; + +export = HmacSHA1; diff --git a/crypto-js/hmac-sha224/index.d.ts b/crypto-js/hmac-sha224/index.d.ts new file mode 100644 index 0000000000..f25334c64c --- /dev/null +++ b/crypto-js/hmac-sha224/index.d.ts @@ -0,0 +1,3 @@ +import { HmacSHA224 } from '../index'; + +export = HmacSHA224; diff --git a/crypto-js/hmac-sha256/index.d.ts b/crypto-js/hmac-sha256/index.d.ts new file mode 100644 index 0000000000..ca1a1ca267 --- /dev/null +++ b/crypto-js/hmac-sha256/index.d.ts @@ -0,0 +1,3 @@ +import { HmacSHA256 } from '../index'; + +export = HmacSHA256; diff --git a/crypto-js/hmac-sha3/index.d.ts b/crypto-js/hmac-sha3/index.d.ts new file mode 100644 index 0000000000..0fa0db9321 --- /dev/null +++ b/crypto-js/hmac-sha3/index.d.ts @@ -0,0 +1,3 @@ +import { HmacSHA3 } from '../index'; + +export = HmacSHA3; diff --git a/crypto-js/hmac-sha384/index.d.ts b/crypto-js/hmac-sha384/index.d.ts new file mode 100644 index 0000000000..2e17420c1b --- /dev/null +++ b/crypto-js/hmac-sha384/index.d.ts @@ -0,0 +1,3 @@ +import { HmacSHA384 } from '../index'; + +export = HmacSHA384; diff --git a/crypto-js/hmac-sha512/index.d.ts b/crypto-js/hmac-sha512/index.d.ts new file mode 100644 index 0000000000..439b2ffd5e --- /dev/null +++ b/crypto-js/hmac-sha512/index.d.ts @@ -0,0 +1,3 @@ +import { HmacSHA512 } from '../index'; + +export = HmacSHA512; diff --git a/crypto-js/index.d.ts b/crypto-js/index.d.ts index a2c0ee381d..a8068161e1 100644 --- a/crypto-js/index.d.ts +++ b/crypto-js/index.d.ts @@ -3,6 +3,9 @@ // Definitions by: Michael Zabka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +export = CryptoJS; +export as namespace CryptoJS; + declare var CryptoJS: CryptoJS.Hashes; declare namespace CryptoJS { type Hash = (message: string, key?: string, ...options: any[]) => string; @@ -112,237 +115,3 @@ declare namespace CryptoJS { } } - -declare module "crypto-js" { - var CryptoJS: CryptoJS.Hashes; - export = CryptoJS; -} - -/* --------------------------------- */ -declare module "crypto-js/core" { - var core: any; - export = core; -} - -declare module "crypto-js/x64-core" { - var x64: any; - export = x64; -} - -declare module "crypto-js/lib-typedarrays" { - var libWordArray: any; - export = libWordArray; -} - -/* --------------------------------- */ -declare module "crypto-js/md5" { - var MD5: CryptoJS.Hash; - export = MD5; -} - -declare module "crypto-js/sha1" { - var SHA1: CryptoJS.Hash; - export = SHA1; -} - -declare module "crypto-js/sha256" { - var SHA256: CryptoJS.Hash; - export = SHA256; -} - -declare module "crypto-js/sha224" { - var SHA224: CryptoJS.Hash; - export = SHA224; -} - -declare module "crypto-js/sha512" { - var SHA512: CryptoJS.Hash; - export = SHA512; -} - -declare module "crypto-js/sha384" { - var SHA384: CryptoJS.Hash; - export = SHA384; -} - -declare module "crypto-js/sha3" { - var SHA3: CryptoJS.Hash; - export = SHA3; -} - -declare module "crypto-js/ripemd160" { - var RIPEMD160: CryptoJS.Hash; - export = RIPEMD160; -} - -/* --------------------------------- */ -declare module "crypto-js/hmac-md5" { - var HmacMD5: CryptoJS.Hash; - export = HmacMD5; -} - -declare module "crypto-js/hmac-sha1" { - var HmacSHA1: CryptoJS.Hash; - export = HmacSHA1; -} - -declare module "crypto-js/hmac-sha256" { - var HmacSHA256: CryptoJS.Hash; - export = HmacSHA256; -} - -declare module "crypto-js/hmac-sha224" { - var HmacSHA224: CryptoJS.Hash; - export = HmacSHA224; -} - -declare module "crypto-js/hmac-sha512" { - var HmacSHA512: CryptoJS.Hash; - export = HmacSHA512; -} - -declare module "crypto-js/hmac-sha384" { - var HmacSHA384: CryptoJS.Hash; - export = HmacSHA384; -} - -declare module "crypto-js/hmac-sha3" { - var HmacSHA3: CryptoJS.Hash; - export = HmacSHA3; -} - -declare module "crypto-js/hmac-ripemd160" { - var HmacRIPEMD160: CryptoJS.Hash; - export = HmacRIPEMD160; -} - -/* --------------------------------- */ -declare module "crypto-js/pbkdf2" { - var PBKDF2: CryptoJS.Hash; - export = PBKDF2; -} - -/* --------------------------------- */ -declare module "crypto-js/aes" { - var AES: CryptoJS.Cipher; - export = AES; -} - -declare module "crypto-js/tripledes" { - var TripleDES: CryptoJS.Cipher; - export = TripleDES; -} - -declare module "crypto-js/rc4" { - var RC4: CryptoJS.Cipher; - export = RC4; -} - -declare module "crypto-js/rabbit" { - var Rabbit: CryptoJS.Cipher; - export = Rabbit; -} - -declare module "crypto-js/rabbit-legacy" { - var RabbitLegacy: CryptoJS.Cipher; - export = RabbitLegacy; -} - -declare module "crypto-js/evpkdf" { - var EvpKDF: CryptoJS.Cipher; - export = EvpKDF; -} - -/* --------------------------------- */ -declare module "crypto-js/format-openssl" { - var FormatOpenssl: any; - export = FormatOpenssl; -} - -declare module "crypto-js/format-hex" { - var FormatHex: any; - export = FormatHex; -} - -/* --------------------------------- */ -declare module "crypto-js/enc-latin1" { - var encLatin1: CryptoJS.Encoder; - export = encLatin1; -} - -declare module "crypto-js/enc-utf8" { - var encUtf8: CryptoJS.Encoder; - export = encUtf8; -} - -declare module "crypto-js/enc-hex" { - var encHex: CryptoJS.Encoder; - export = encHex; -} - -declare module "crypto-js/enc-utf16" { - var encUtf16: CryptoJS.Encoder; - export = encUtf16; -} - -declare module "crypto-js/enc-base64" { - var encBase64: CryptoJS.Encoder; - export = encBase64; -} - -/* --------------------------------- */ -declare module "crypto-js/mode-cfb" { - var modeCFB: CryptoJS.Mode; - export = modeCFB; -} - -declare module "crypto-js/mode-ctr" { - var modeCTR: CryptoJS.Mode; - export = modeCTR; -} - -declare module "crypto-js/mode-ctr-gladman" { - var modeCTRGladman: CryptoJS.Mode; - export = modeCTRGladman; -} - -declare module "crypto-js/mode-ofb" { - var modeOFB: CryptoJS.Mode; - export = modeOFB; -} - -declare module "crypto-js/mode-ecb" { - var modeECB: CryptoJS.Mode; - export = modeECB; -} - -/* --------------------------------- */ -declare module "crypto-js/pad-pkcs7" { - var padPkcs7: CryptoJS.Padding; - export = padPkcs7; -} - -declare module "crypto-js/pad-ansix923" { - var padAnsiX923: CryptoJS.Padding; - export = padAnsiX923; -} - -declare module "crypto-js/pad-iso10126" { - var padIso10126: CryptoJS.Padding; - export = padIso10126; -} - -declare module "crypto-js/pad-iso97971" { - var padIso97971: CryptoJS.Padding; - export = padIso97971; -} - -declare module "crypto-js/pad-zeropadding" { - var padZeroPadding: CryptoJS.Padding; - export = padZeroPadding; -} - -declare module "crypto-js/pad-nopadding" { - var padNoPadding: CryptoJS.Padding; - export = padNoPadding; -} diff --git a/crypto-js/lib-typedarrays/index.d.ts b/crypto-js/lib-typedarrays/index.d.ts new file mode 100644 index 0000000000..91c5a7933b --- /dev/null +++ b/crypto-js/lib-typedarrays/index.d.ts @@ -0,0 +1,2 @@ +declare const libWordArray: any; +export = libWordArray; diff --git a/crypto-js/md5/index.d.ts b/crypto-js/md5/index.d.ts new file mode 100644 index 0000000000..faa064511e --- /dev/null +++ b/crypto-js/md5/index.d.ts @@ -0,0 +1,3 @@ +import { MD5 } from '../index'; + +export = MD5; diff --git a/crypto-js/mode-cfb/index.d.ts b/crypto-js/mode-cfb/index.d.ts new file mode 100644 index 0000000000..74c5c6e3d1 --- /dev/null +++ b/crypto-js/mode-cfb/index.d.ts @@ -0,0 +1,4 @@ +import { mode } from '../index'; + +declare const CFB: typeof mode.CFB; +export = CFB; diff --git a/crypto-js/mode-ctr-gladman/index.d.ts b/crypto-js/mode-ctr-gladman/index.d.ts new file mode 100644 index 0000000000..3ca8f8b367 --- /dev/null +++ b/crypto-js/mode-ctr-gladman/index.d.ts @@ -0,0 +1,4 @@ +import { mode } from '../index'; + +declare const CTRGladman: typeof mode.CTRGladman; +export = CTRGladman; diff --git a/crypto-js/mode-ctr/index.d.ts b/crypto-js/mode-ctr/index.d.ts new file mode 100644 index 0000000000..6007a4ca88 --- /dev/null +++ b/crypto-js/mode-ctr/index.d.ts @@ -0,0 +1,4 @@ +import { mode } from '../index'; + +declare const CTR: typeof mode.CTR; +export = CTR; diff --git a/crypto-js/mode-ecb/index.d.ts b/crypto-js/mode-ecb/index.d.ts new file mode 100644 index 0000000000..569d2b2286 --- /dev/null +++ b/crypto-js/mode-ecb/index.d.ts @@ -0,0 +1,4 @@ +import { mode } from '../index'; + +declare const ECB: typeof mode.ECB; +export = ECB; diff --git a/crypto-js/mode-ofb/index.d.ts b/crypto-js/mode-ofb/index.d.ts new file mode 100644 index 0000000000..484406979d --- /dev/null +++ b/crypto-js/mode-ofb/index.d.ts @@ -0,0 +1,4 @@ +import { mode } from '../index'; + +declare const OFB: typeof mode.OFB; +export = OFB; diff --git a/crypto-js/pad-ansix923/index.d.ts b/crypto-js/pad-ansix923/index.d.ts new file mode 100644 index 0000000000..2bb6c2dffb --- /dev/null +++ b/crypto-js/pad-ansix923/index.d.ts @@ -0,0 +1,4 @@ +import { pad } from '../index'; + +declare const AnsiX923: typeof pad.AnsiX923; +export = AnsiX923; diff --git a/crypto-js/pad-iso10126/index.d.ts b/crypto-js/pad-iso10126/index.d.ts new file mode 100644 index 0000000000..6e52e96197 --- /dev/null +++ b/crypto-js/pad-iso10126/index.d.ts @@ -0,0 +1,4 @@ +import { pad } from '../index'; + +declare const Iso10126: typeof pad.Iso10126; +export = Iso10126; diff --git a/crypto-js/pad-iso97971/index.d.ts b/crypto-js/pad-iso97971/index.d.ts new file mode 100644 index 0000000000..0ab1cecbfb --- /dev/null +++ b/crypto-js/pad-iso97971/index.d.ts @@ -0,0 +1,4 @@ +import { pad } from '../index'; + +declare const Iso97971: typeof pad.Iso97971; +export = Iso97971; diff --git a/crypto-js/pad-nopadding/index.d.ts b/crypto-js/pad-nopadding/index.d.ts new file mode 100644 index 0000000000..f71bb2de73 --- /dev/null +++ b/crypto-js/pad-nopadding/index.d.ts @@ -0,0 +1,4 @@ +import { pad } from '../index'; + +declare const NoPadding: typeof pad.NoPadding; +export = NoPadding; diff --git a/crypto-js/pad-pkcs7/index.d.ts b/crypto-js/pad-pkcs7/index.d.ts new file mode 100644 index 0000000000..1b194673a2 --- /dev/null +++ b/crypto-js/pad-pkcs7/index.d.ts @@ -0,0 +1,4 @@ +import { pad } from '../index'; + +declare const Pkcs7: typeof pad.Pkcs7; +export = Pkcs7; diff --git a/crypto-js/pad-zeropadding/index.d.ts b/crypto-js/pad-zeropadding/index.d.ts new file mode 100644 index 0000000000..cf481402ab --- /dev/null +++ b/crypto-js/pad-zeropadding/index.d.ts @@ -0,0 +1,4 @@ +import { pad } from '../index'; + +declare const ZeroPadding: typeof pad.ZeroPadding; +export = ZeroPadding; diff --git a/crypto-js/pbkdf2/index.d.ts b/crypto-js/pbkdf2/index.d.ts new file mode 100644 index 0000000000..e242e6fe05 --- /dev/null +++ b/crypto-js/pbkdf2/index.d.ts @@ -0,0 +1,3 @@ +import { PBKDF2 } from '../index'; + +export = PBKDF2; diff --git a/crypto-js/rabbit-legacy/index.d.ts b/crypto-js/rabbit-legacy/index.d.ts new file mode 100644 index 0000000000..6befe37563 --- /dev/null +++ b/crypto-js/rabbit-legacy/index.d.ts @@ -0,0 +1,3 @@ +import { RabbitLegacy } from '../index'; + +export = RabbitLegacy; diff --git a/crypto-js/rabbit/index.d.ts b/crypto-js/rabbit/index.d.ts new file mode 100644 index 0000000000..f708a6f20b --- /dev/null +++ b/crypto-js/rabbit/index.d.ts @@ -0,0 +1,3 @@ +import { Rabbit } from '../index'; + +export = Rabbit; diff --git a/crypto-js/rc4/index.d.ts b/crypto-js/rc4/index.d.ts new file mode 100644 index 0000000000..38a929f490 --- /dev/null +++ b/crypto-js/rc4/index.d.ts @@ -0,0 +1,3 @@ +import { RC4 } from '../index'; + +export = RC4; diff --git a/crypto-js/ripemd160/index.d.ts b/crypto-js/ripemd160/index.d.ts new file mode 100644 index 0000000000..90e3e770ce --- /dev/null +++ b/crypto-js/ripemd160/index.d.ts @@ -0,0 +1,3 @@ +import { RIPEMD160 } from '../index'; + +export = RIPEMD160; diff --git a/crypto-js/sha1/index.d.ts b/crypto-js/sha1/index.d.ts new file mode 100644 index 0000000000..14fb4d2a6b --- /dev/null +++ b/crypto-js/sha1/index.d.ts @@ -0,0 +1,3 @@ +import { SHA1 } from '../index'; + +export = SHA1; diff --git a/crypto-js/sha224/index.d.ts b/crypto-js/sha224/index.d.ts new file mode 100644 index 0000000000..3ff1ff4596 --- /dev/null +++ b/crypto-js/sha224/index.d.ts @@ -0,0 +1,3 @@ +import { SHA224 } from '../index'; + +export = SHA224; diff --git a/crypto-js/sha256/index.d.ts b/crypto-js/sha256/index.d.ts new file mode 100644 index 0000000000..59781b01f3 --- /dev/null +++ b/crypto-js/sha256/index.d.ts @@ -0,0 +1,3 @@ +import { SHA256 } from '../index'; + +export = SHA256; diff --git a/crypto-js/sha3/index.d.ts b/crypto-js/sha3/index.d.ts new file mode 100644 index 0000000000..241574a711 --- /dev/null +++ b/crypto-js/sha3/index.d.ts @@ -0,0 +1,3 @@ +import { SHA3 } from '../index'; + +export = SHA3; diff --git a/crypto-js/sha384/index.d.ts b/crypto-js/sha384/index.d.ts new file mode 100644 index 0000000000..5bad55498a --- /dev/null +++ b/crypto-js/sha384/index.d.ts @@ -0,0 +1,3 @@ +import { SHA384 } from '../index'; + +export = SHA384; diff --git a/crypto-js/sha512/index.d.ts b/crypto-js/sha512/index.d.ts new file mode 100644 index 0000000000..0f764329e2 --- /dev/null +++ b/crypto-js/sha512/index.d.ts @@ -0,0 +1,3 @@ +import { SHA512 } from '../index'; + +export = SHA512; diff --git a/crypto-js/tripledes/index.d.ts b/crypto-js/tripledes/index.d.ts new file mode 100644 index 0000000000..ea22173d98 --- /dev/null +++ b/crypto-js/tripledes/index.d.ts @@ -0,0 +1,3 @@ +import { TripleDES } from '../index'; + +export = TripleDES; diff --git a/crypto-js/x64-core/index.d.ts b/crypto-js/x64-core/index.d.ts new file mode 100644 index 0000000000..1ef7a67477 --- /dev/null +++ b/crypto-js/x64-core/index.d.ts @@ -0,0 +1,3 @@ +import * as X64Core from '../index'; + +export = X64Core; From 9be29e7b530932ecc1b0165713a1e49936de78a1 Mon Sep 17 00:00:00 2001 From: darlin Date: Wed, 25 Jan 2017 15:10:10 +0800 Subject: [PATCH 087/140] add files in tsconfig --- crypto-js/lib-typedarrays/index.d.ts | 4 +-- crypto-js/tsconfig.json | 48 ++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/crypto-js/lib-typedarrays/index.d.ts b/crypto-js/lib-typedarrays/index.d.ts index 91c5a7933b..761e38b1cd 100644 --- a/crypto-js/lib-typedarrays/index.d.ts +++ b/crypto-js/lib-typedarrays/index.d.ts @@ -1,2 +1,2 @@ -declare const libWordArray: any; -export = libWordArray; +declare const LibTypedarrays: any; +export = LibTypedarrays; diff --git a/crypto-js/tsconfig.json b/crypto-js/tsconfig.json index 94793c83ae..7fc335c24a 100644 --- a/crypto-js/tsconfig.json +++ b/crypto-js/tsconfig.json @@ -18,6 +18,50 @@ }, "files": [ "index.d.ts", - "crypto-js-tests.ts" + "crypto-js-tests.ts", + "core/index.d.ts", + "x64-core/index.d.ts", + "lib-typedarrays/index.d.ts", + "md5/index.d.ts", + "sha1/index.d.ts", + "sha256/index.d.ts", + "sha224/index.d.ts", + "sha512/index.d.ts", + "sha384/index.d.ts", + "sha3/index.d.ts", + "ripemd160/index.d.ts", + "hmac-md5/index.d.ts", + "hmac-sha1/index.d.ts", + "hmac-sha256/index.d.ts", + "hmac-sha224/index.d.ts", + "hmac-sha512/index.d.ts", + "hmac-sha384/index.d.ts", + "hmac-sha3/index.d.ts", + "hmac-ripemd160/index.d.ts", + "pbkdf2/index.d.ts", + "aes/index.d.ts", + "tripledes/index.d.ts", + "rc4/index.d.ts", + "rabbit/index.d.ts", + "rabbit-legacy/index.d.ts", + "evpkdf/index.d.ts", + "format-openssl/index.d.ts", + "format-hex/index.d.ts", + "enc-latin1/index.d.ts", + "enc-utf8/index.d.ts", + "enc-hex/index.d.ts", + "enc-utf16/index.d.ts", + "enc-base64/index.d.ts", + "mode-cfb/index.d.ts", + "mode-ctr/index.d.ts", + "mode-ctr-gladman/index.d.ts", + "mode-ofb/index.d.ts", + "mode-ecb/index.d.ts", + "pad-pkcs7/index.d.ts", + "pad-ansix923/index.d.ts", + "pad-iso10126/index.d.ts", + "pad-iso97971/index.d.ts", + "pad-zeropadding/index.d.ts", + "pad-nopadding/index.d.ts" ] -} \ No newline at end of file +} From d2febcc480606fab9d8564fd6e2d77f576ae39d7 Mon Sep 17 00:00:00 2001 From: darlin Date: Wed, 25 Jan 2017 16:03:50 +0800 Subject: [PATCH 088/140] add submodule tests --- crypto-js/index.d.ts | 1 - crypto-js/test/submodule-tests.ts | 184 ++++++++++++++++++++++++++++++ crypto-js/tsconfig.json | 1 + 3 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 crypto-js/test/submodule-tests.ts diff --git a/crypto-js/index.d.ts b/crypto-js/index.d.ts index a8068161e1..07a8d18dfc 100644 --- a/crypto-js/index.d.ts +++ b/crypto-js/index.d.ts @@ -113,5 +113,4 @@ declare namespace CryptoJS { NoPadding: Padding; }; } - } diff --git a/crypto-js/test/submodule-tests.ts b/crypto-js/test/submodule-tests.ts new file mode 100644 index 0000000000..0cfd8cd83f --- /dev/null +++ b/crypto-js/test/submodule-tests.ts @@ -0,0 +1,184 @@ +import Core = require('../core'); +import X64Core = require('../x64-core'); +import LibTypedarrays = require('../lib-typedarrays'); +// --- +import MD5 = require('../md5'); +import SHA1 = require('../sha1'); +import SHA256 = require('../sha256'); +import SHA224 = require('../sha224'); +import SHA512 = require('../sha512'); +import SHA384 = require('../sha384'); +import SHA3 = require('../sha3'); +import RIPEMD160 = require('../ripemd160'); +// --- +import HmacMD5 = require('../hmac-md5'); +import HmacSHA1 = require('../hmac-sha1'); +import HmacSHA256 = require('../hmac-sha256'); +import HmacSHA224 = require('../hmac-sha224'); +import HmacSHA512 = require('../hmac-sha512'); +import HmacSHA384 = require('../hmac-sha384'); +import HmacSHA3 = require('../hmac-sha3'); +import HmacRIPEMD160 = require('../hmac-ripemd160'); +// --- +import PBKDF2 = require('../pbkdf2'); +// --- +import AES = require('../aes'); +import TripleDES = require('../tripledes'); +import RC4 = require('../rc4'); +import Rabbit = require('../rabbit'); +import RabbitLegacy = require('../rabbit-legacy'); +import EvpKDF = require('../evpkdf'); +// --- +import FormatOpenSSL = require('../format-openssl'); +import FormatHex = require('../format-hex'); +// --- +import EncLatin1 = require('../enc-latin1'); +import EncUtf8 = require('../enc-utf8'); +import EncHex = require('../enc-hex'); +import EncUtf16 = require('../enc-utf16'); +import EncBase64 = require('../enc-base64'); +// --- +import ModeCFB = require('../mode-cfb'); +import ModeCTR = require('../mode-ctr'); +import ModeCTRGladman = require('../mode-ctr-gladman'); +import ModeOFB = require('../mode-ofb'); +import ModeECB = require('../mode-ecb'); +// --- +import PadPkcs7 = require('../pad-pkcs7'); +import PadAnsiX923 = require('../pad-ansix923'); +import PadIso10126 = require('../pad-iso10126'); +import PadIso97971 = require('../pad-iso97971'); +import PadZeroPadding = require('../pad-zeropadding'); +import PadNoPadding = require('../pad-nopadding'); + +// Hashers +var str: string; +str = MD5('some message'); +str = MD5('some message', 'some key'); + +str = SHA1('some message'); +str = SHA1('some message', 'some key', { any: true }); + +str = FormatOpenSSL('some message'); +str = FormatOpenSSL('some message', 'some key'); + + +// Ciphers +var encrypted: CryptoJS.WordArray; +var decrypted: CryptoJS.DecryptedMessage; + +encrypted = AES.encrypt("Message", "Secret Passphrase"); +decrypted = AES.decrypt(encrypted, "Secret Passphrase"); + +encrypted = Core.DES.encrypt("Message", "Secret Passphrase"); +decrypted = Core.DES.decrypt(encrypted, "Secret Passphrase"); + +encrypted = TripleDES.encrypt("Message", "Secret Passphrase"); +decrypted = TripleDES.decrypt(encrypted, "Secret Passphrase"); + + +encrypted = Rabbit.encrypt("Message", "Secret Passphrase"); +decrypted = Rabbit.decrypt(encrypted, "Secret Passphrase"); + +encrypted = RC4.encrypt("Message", "Secret Passphrase"); +decrypted = RC4.decrypt(encrypted, "Secret Passphrase"); + +encrypted = Core.RC4Drop.encrypt("Message", "Secret Passphrase"); +encrypted = Core.RC4Drop.encrypt("Message", "Secret Passphrase", { drop: 3072 / 4 }); +decrypted = Core.RC4Drop.decrypt(encrypted, "Secret Passphrase", { drop: 3072 / 4 }); + +var key = EncHex.parse('000102030405060708090a0b0c0d0e0f'); +var iv = EncHex.parse('101112131415161718191a1b1c1d1e1f'); +encrypted = AES.encrypt("Message", key, { iv: iv }); + +encrypted = AES.encrypt("Message", "Secret Passphrase", { + mode: ModeCFB, + padding: PadAnsiX923 +}); + + +// The Cipher Output +encrypted = AES.encrypt("Message", "Secret Passphrase"); +alert(encrypted.key); +// 74eb593087a982e2a6f5dded54ecd96d1fd0f3d44a58728cdcd40c55227522223 +alert(encrypted.iv); +// 7781157e2629b094f0e3dd48c4d786115 +alert(encrypted.salt); +// 7a25f9132ec6a8b34 +alert(encrypted.ciphertext); +// 73e54154a15d1beeb509d9e12f1e462a0 +alert(encrypted); +// U2FsdGVkX1+iX5Ey7GqLND5UFUoV0b7rUJ2eEvHkYqA= + +var JsonFormatter = { + stringify: function(cipherParams: any) { + // create json object with ciphertext + var jsonObj: any = { + ct: cipherParams.ciphertext.toString(EncBase64) + }; + // optionally add iv and salt + if (cipherParams.iv) { + jsonObj.iv = cipherParams.iv.toString(); + } + if (cipherParams.salt) { + jsonObj.s = cipherParams.salt.toString(); + } + // stringify json object + return JSON.stringify(jsonObj); + }, + parse: function (jsonStr: any) { + // parse json string + var jsonObj = JSON.parse(jsonStr); + // extract ciphertext from json object, and create cipher params object + var cipherParams = (Core).lib.CipherParams.create({ + ciphertext: EncBase64.parse(jsonObj.ct) + }); + // optionally extract iv and salt + if (jsonObj.iv) { + cipherParams.iv = EncHex.parse(jsonObj.iv); + } + if (jsonObj.s) { + cipherParams.salt = EncHex.parse(jsonObj.s); + } return cipherParams; + } +}; +encrypted = AES.encrypt("Message", "Secret Passphrase", { + format: JsonFormatter +}); +alert(encrypted); +// {"ct":"tZ4MsEnfbcDOwqau68aOrQ==","iv":"8a8c8fd8fe33743d3638737ea4a00698","s":"ba06373c8f57179c"} +decrypted = AES.decrypt(encrypted, "Secret Passphrase", { + format: JsonFormatter +}); +alert(decrypted.toString(EncUtf8)); // Message + + +// Progressive Ciphering +var key = EncHex.parse('000102030405060708090a0b0c0d0e0f'); +var iv = EncHex.parse('101112131415161718191a1b1c1d1e1f'); +var aesEncryptor = Core.algo.AES.createEncryptor(key, { iv: iv }); +var ciphertextPart1 = aesEncryptor.process("Message Part 1"); +var ciphertextPart2 = aesEncryptor.process("Message Part 2"); +var ciphertextPart3 = aesEncryptor.process("Message Part 3"); +var ciphertextPart4 = aesEncryptor.finalize(); +var aesDecryptor = Core.algo.AES.createDecryptor(key, { iv: iv }); +var plaintextPart1 = aesDecryptor.process(ciphertextPart1); +var plaintextPart2 = aesDecryptor.process(ciphertextPart2); +var plaintextPart3 = aesDecryptor.process(ciphertextPart3); +var plaintextPart4 = aesDecryptor.process(ciphertextPart4); +var plaintextPart5 = aesDecryptor.finalize(); + + +// Encoders +var words = EncBase64.parse('SGVsbG8sIFdvcmxkIQ=='); +var base64 = EncBase64.stringify(words); +var words = EncLatin1.parse('Hello, World!'); +var latin1 = EncLatin1.stringify(words); +var words = EncHex.parse('48656c6c6f2c20576f726c6421'); +var hex = EncHex.stringify(words); +var words = EncUtf8.parse('𤭢'); +var utf8 = EncUtf8.stringify(words); +var words = EncUtf16.parse('Hello, World!'); +var utf16 = EncUtf16.stringify(words); +var words = Core.enc.Utf16LE.parse('Hello, World!'); +var utf16 = Core.enc.Utf16LE.stringify(words); diff --git a/crypto-js/tsconfig.json b/crypto-js/tsconfig.json index 7fc335c24a..10865613d3 100644 --- a/crypto-js/tsconfig.json +++ b/crypto-js/tsconfig.json @@ -19,6 +19,7 @@ "files": [ "index.d.ts", "crypto-js-tests.ts", + "test/submodule-tests.ts", "core/index.d.ts", "x64-core/index.d.ts", "lib-typedarrays/index.d.ts", From 1221959579dc6d1795b05241f291d640751ad3ab Mon Sep 17 00:00:00 2001 From: James Milner Date: Wed, 25 Jan 2017 11:32:22 +0000 Subject: [PATCH 089/140] Adds clickable to marker options Adds clickable to marker options; this is currently omitted for one reason or another --- leaflet/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/leaflet/index.d.ts b/leaflet/index.d.ts index c031df81bc..4112082f54 100644 --- a/leaflet/index.d.ts +++ b/leaflet/index.d.ts @@ -1397,6 +1397,7 @@ declare namespace L { export interface MarkerOptions extends InteractiveLayerOptions { icon?: Icon; + clickable?: boolean; draggable?: boolean; keyboard?: boolean; title?: string; From 201dab6133daa473861a04631e2e6bc1abe914a8 Mon Sep 17 00:00:00 2001 From: york yao Date: Wed, 25 Jan 2017 23:58:49 +0800 Subject: [PATCH 090/140] add types of node-zookeeper-client --- node-zookeeper-client/index.d.ts | 168 ++++++++++++ .../node-zookeeper-client-tests.ts | 253 ++++++++++++++++++ node-zookeeper-client/tsconfig.json | 22 ++ node-zookeeper-client/tslint.json | 1 + 4 files changed, 444 insertions(+) create mode 100644 node-zookeeper-client/index.d.ts create mode 100644 node-zookeeper-client/node-zookeeper-client-tests.ts create mode 100644 node-zookeeper-client/tsconfig.json create mode 100644 node-zookeeper-client/tslint.json diff --git a/node-zookeeper-client/index.d.ts b/node-zookeeper-client/index.d.ts new file mode 100644 index 0000000000..f405aeffc7 --- /dev/null +++ b/node-zookeeper-client/index.d.ts @@ -0,0 +1,168 @@ +// Type definitions for Jasmine 2.5 +// Project: https://github.com/alexguan/node-zookeeper-client +// Definitions by: York Yao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as EventEmitter from "events"; + +export class Id { + scheme: string; + id: string; + constructor(scheme: string, id: string); +} + +export class ACL { + perms: number; + id: Id; + constructor(perms: number, id: Id); +} + +export const Permission: { + READ: number, + WRITE: number, + CREATE: number, + DELETE: number, + ADMIN: number, + ALL: number, +}; + +export interface Stat { + czxid: number; + mzxid: number; + ctime: number; + mtime: number; + version: number; + cversion: number; + aversion: number; + ephemeralOwner: number; + dataLength: number; + numChildren: number; + pzxid: number; +} + +export class State { + static DISCONNECTED: State; + static SYNC_CONNECTED: State; + static AUTH_FAILED: State; + static CONNECTED_READ_ONLY: State; + static SASL_AUTHENTICATED: State; + static EXPIRED: State; + + name: string; + code: number; + constructor(name: string, code: number); + toString(): string; +} + +export class Event { + static NODE_CREATED: number; + static NODE_DELETED: number; + static NODE_DATA_CHANGED: number; + static NODE_CHILDREN_CHANGED: number; + type: string; + name: string; + path: string; + constructor(type: string, name: string, path: string); + toString(): string; + getType(): string; + getName(): string; + getPath(): string; +} + +export class Transaction { + create(path: string, dataOrAclsOrmode1?: Buffer | ACL[] | number, dataOrAclsOrmode2?: Buffer | ACL[] | number, dataOrAclsOrmode3?: Buffer | ACL[] | number): this; + setData(path: string, data: Buffer | null, version?: number): this; + check(path: string, version?: number): this; + remove(path: string, version?: number): this; + commit(callback: (error: Error | Exception, results: any) => void): void; +} + +export class Client extends EventEmitter { + connect(): void; + close(): void; + create(path: string, callback: (error: Error | Exception, path: string) => void): void; + create(path: string, dataOrAclsOrmode1: Buffer | ACL[] | number, callback: (error: Error | Exception, path: string) => void): void; + create(path: string, dataOrAclsOrmode1: Buffer | ACL[] | number, dataOrAclsOrmode2: Buffer | ACL[] | number, callback: (error: Error | Exception, path: string) => void): void; + create(path: string, dataOrAclsOrmode1: Buffer | ACL[] | number, dataOrAclsOrmode2: Buffer | ACL[] | number, dataOrAclsOrmode3: Buffer | ACL[] | number, callback: (error: Error | Exception, path: string) => void): void; + remove(path: string, callback: (error: Error | Exception) => void): void; + remove(path: string, version: number, callback: (error: Error | Exception) => void): void; + exists(path: string, callback: (error: Error | Exception, stat: Stat) => void): void; + exists(path: string, watcher: (event: Event) => void, callback: (error: Error | Exception, stat: Stat) => void): void; + getChildren(path: string, callback: (error: Error | Exception, children: string[], stat: Stat) => void): void; + getChildren(path: string, watcher: (event: Event) => void, callback: (error: Error | Exception, children: string[], stat: Stat) => void): void; + getData(path: string, callback: (error: Error | Exception, data: Buffer, stat: Stat) => void): void; + getData(path: string, watcher: (event: Event) => void, callback: (error: Error | Exception, data: Buffer, stat: Stat) => void): void; + setData(path: string, data: Buffer | null, callback: (error: Error | Exception, stat: Stat) => void): void; + setData(path: string, data: Buffer | null, version: number, callback: (error: Error | Exception, stat: Stat) => void): void; + getACL(path: string, callback: (error: Error | Exception, acls: ACL[], stat: Stat) => void): void; + setACL(path: string, acls: ACL[], callback: (error: Error | Exception, stat: Stat) => void): void; + setACL(path: string, acls: ACL[], version: number, callback: (error: Error | Exception, stat: Stat) => void): void; + transaction(): Transaction; + mkdirp(path: string, callback: (error: Error | Exception, path: string) => void): void; + mkdirp(path: string, dataOrAclsOrmode1: Buffer | ACL[] | number, callback: (error: Error | Exception, path: string) => void): void; + mkdirp(path: string, dataOrAclsOrmode1: Buffer | ACL[] | number, dataOrAclsOrmode2: Buffer | ACL[] | number, callback: (error: Error | Exception, path: string) => void): void; + mkdirp(path: string, dataOrAclsOrmode1: Buffer | ACL[] | number, dataOrAclsOrmode2: Buffer | ACL[] | number, dataOrAclsOrmode3: Buffer | ACL[] | number, callback: (error: Error | Exception, path: string) => void): void; + addAuthInfo(scheme: string, auth: Buffer): void; + getState(): State; + getSessionId(): Buffer; + getSessionPassword(): Buffer; + getSessionTimeout(): number; + + on(event: "state", cb: (state: State) => void): this; + on(event: "connected" | "connectedReadOnly" | "disconnected" | "expired" | "authenticationFailed" | string, cb: () => void): this; + + once(event: "state", cb: (state: State) => void): this; + once(event: "connected" | "connectedReadOnly" | "disconnected" | "expired" | "authenticationFailed" | string, cb: () => void): this; + + addListener(event: "state", cb: (state: State) => void): this; + addListener(event: "connected" | "connectedReadOnly" | "disconnected" | "expired" | "authenticationFailed" | string, cb: () => void): this; +} + +export interface Option { + sessionTimeout: number; + spinDelay: number; + retries: number; +} + +export function createClient(connectionString: string, options?: Partial

wonderful world

'); +str = v('

wonderful world

').escapeHtml().value(); +str = v.chain('

wonderful world

').escapeHtml().value(); + +str = v.escapeRegExp(); +str = v.escapeRegExp('(hours)[minutes]{seconds}'); +str = v('(hours)[minutes]{seconds}').escapeRegExp().value(); +str = v.chain('(hours)[minutes]{seconds}').escapeRegExp().value(); + +str = v.unescapeHtml(); +str = v.unescapeHtml('<p>wonderful world</p>'); +str = v('<p>wonderful world</p>').unescapeHtml().value(); +str = v.chain('<p>wonderful world</p>').unescapeHtml().value(); + +// Format +str = v.sprintf(); +str = v.sprintf('%s, %s!', 'Hello', 'World'); +str = v.sprintf('%s costs $%d', 'coffee', 2); +str = v.sprintf('%1$s %2$s %1$s %2$s, watcha gonna %3$s', 'bad', 'boys', 'do') +str = v.sprintf('% 6s', 'bird'); +str = v.sprintf('%d %i %+d', 15, -2, 25); +str = v.sprintf("%06d", 15); +str = v.sprintf('%.2e %g', 100.5, 0.455); +str = v('%s, %s!').sprintf('Hello', 'World').value(); +str = v.chain('%s, %s!').sprintf('Hello', 'World').value(); + +str = v.vprintf(); +str = v.vprintf('%s', ['Welcome']) +str = v.vprintf('%s has %d apples', ['Alexandra', 3]); +str = v('%s').vprintf(['Welcome']).value(); +str = v.chain('%s').vprintf(['Welcome']).value(); + +// Index +num = v.indexOf(); +num = v.indexOf('morning'); +num = v.indexOf('morning', 'n'); +num = v('morning').indexOf('n'); +num = v.chain('morning').indexOf('n').value(); + +num = v.lastIndexOf(); +num = v.lastIndexOf('morning'); +num = v.lastIndexOf('morning', 'n'); +num = v('morning').lastIndexOf('n'); +num = v.chain('morning').lastIndexOf('n').value(); + +num = v.search('morning', /rn/); +num = v.search('evening', '/\d/'); + +// Manipulate +str = v.insert(); +str = v.insert('ct'); +str = v.insert('ct', 'a'); +str = v.insert('ct', 'a', 1); +str = v('ct').insert('a', 1).value(); +str = v.chain('ct').insert('a', 1).value(); + +str = v.latinise(); +str = v.latinise('cafe\u0301'); + +str = v.pad(); +str = v.pad('dog'); +str = v.pad('dog', 5); +str = v.pad('bird', 6, '-'); + +str = v.padLeft(); +str = v.padLeft('dog'); +str = v.padLeft('dog', 5); +str = v.padLeft('bird', 6, '-'); + +str = v.padRight(); +str = v.padRight('dog'); +str = v.padRight('dog', 5); +str = v.padRight('bird', 6, '-'); + +str = v.repeat(); +str = v.repeat('w'); +str = v.repeat('w', 3); + +str = v.replace(); +str = v.replace('swan', 'wa', 'u'); +str = v.replace('domestic duck', /domestic\s/, ''); +str = v.replace('nice duck', /(nice)(duck)/, (match: string, nice: string, duck: string) => { + return 'the ' + duck + ' is ' + nice; +}); + +str = v.replaceAll(); +str = v.replaceAll('good morning', 'o', '*'); +str = v.replaceAll('evening', /n/, 's'); + +str = v.reverse(); +str = v.reverse('winter'); + +str = v.reverseGrapheme(); +str = v.reverseGrapheme('summer'); + +str = v.slugify(); +str = v.slugify('Italian cappuccino drink'); + +str = v.splice(); +str = v.splice('new year'); +str = v.splice('new year', 0); +str = v.splice('new year', 0, 4); +str = v.splice('new year', 0, 3, 'happy'); + +str = v.trim(); +str = v.trim(' Mother nature '); +str = v.trim('--Earth--', '-'); + +str = v.trimLeft(); +str = v.trimLeft(' Starship Troopers'); +str = v.trimLeft('***Mobile Infantry', '*'); + +str = v.trimRight(); +str = v.trimRight('the fire rises '); +str = v.trimRight('do you feel in charge?!!!', '!'); + +str = v.wordWrap(); +str = v.wordWrap('Hello world'); +str = v.wordWrap('Hello world', { + width: 5 +}); +str = v.wordWrap('Hello world', { + width: 5, + newLine: '
', + indent: '__' +}); +str = v.wordWrap('Wonderful world', { + width: 5, + cut: true +}); + +// Query +bool = v.endsWith(); +bool = v.endsWith('red alert'); +bool = v.endsWith('red alert', 'alert'); +bool = v.endsWith('Murphy', 'ph', 5); +bool = v('Murphy').endsWith('ph', 5); +bool = v.chain('Murphy').endsWith('ph', 5).value(); + +bool = v.includes(); +bool = v.includes('starship'); +bool = v.includes('starship', 'star'); +bool = v.includes('galaxy', 'g', 1); +bool = v('galaxy').includes('g', 1); +bool = v.chain('galaxy').includes('g', 1).value(); + +bool = v.isAlpha(); +bool = v.isAlpha('bart'); + +bool = v.isAlphaDigit(); +bool = v.isAlphaDigit('year2020'); + +bool = v.isBlank(); +bool = v.isBlank(''); + +bool = v.isDigit(); +bool = v.isDigit('35'); + +bool = v.isEmpty(); +bool = v.isEmpty(''); + +bool = v.isLowerCase(); +bool = v.isLowerCase('motorcycle'); + +bool = v.isNumeric(); +bool = v.isNumeric('350'); + +bool = v.isString(); +bool = v.isString('vacation'); +bool = v.isString(560); +bool = v('vacation').isString(); +bool = v(560).isString(); +bool = v.chain('vacation').isString().value(); +bool = v.chain(560).isString().value(); + +bool = v.isUpperCase(); +bool = v.isUpperCase('ACDC'); + +bool = v.matches(); +bool = v.matches('pluto'); +bool = v.matches('pluto', /plu.{2}/); +bool = v.matches('sun', 'S', 'i'); +bool = v.matches('apollo 11', '\\d{3}'); + +bool = v.startsWith(); +bool = v.startsWith('say hello to my little friend'); +bool = v.startsWith('say hello to my little friend', 'say hello'); +bool = v.startsWith('tony', 'on', 1); +bool = v.startsWith('the world is yours', 'world'); + +// Split +strAry = v.chars(); +strAry = v.chars('cloud'); + +numAry = v.codePoints(); +numAry = v.codePoints('rain'); + +strAry = v.graphemes(); +strAry = v.graphemes('\uD835\uDC00\uD835\uDC01'); + +strAry = v.split('rage against the dying of the light', ' '); +strAry = v.split('the dying of the light', /\s/, 3); + +strAry = v.words(); +strAry = v.words('gravity can cross dimensions'); +strAry = v.words('Earth gravity', /[^\s]+/g); + +// Strip +str = v.stripBom(); +str = v.stripBom('\uFEFFsummertime sadness'); + +str = v.stripTags(); +str = v.stripTags('Summer is nice'); +str = v.stripTags('Winter is cold', ['b', 'i']); +str = v.stripTags('Sun
set', '', '-'); + +// Util +var voca: v.VocaStatic = v.noConflict(); +var version: String = v.version; From 4c4b7eb90069d7eb7acb32bab636c29a3ceddeeb Mon Sep 17 00:00:00 2001 From: Olmo del Corral Date: Wed, 25 Jan 2017 21:14:54 +0100 Subject: [PATCH 098/140] add defaultCurrentDate --- react-widgets/lib/DateTimePicker.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/react-widgets/lib/DateTimePicker.d.ts b/react-widgets/lib/DateTimePicker.d.ts index 37e1474416..3c4aadde29 100644 --- a/react-widgets/lib/DateTimePicker.d.ts +++ b/react-widgets/lib/DateTimePicker.d.ts @@ -31,6 +31,10 @@ interface DateTimePickerProps extends React.Props { * @default Date() */ currentDate?: Date; + /* + * Default value for current date. Usefull for suggesting a date when the caldenar opens without keep forcing it once 'value' is set. + */ + defaultCurrentDate?: Date /** * Change event Handler that is called when the currentDate is changed. The handler is * called with the currentDate object. From 1ad011f1f6668cc9ea8fe008ca53b6d38dfbd34f Mon Sep 17 00:00:00 2001 From: Olmo del Corral Date: Wed, 25 Jan 2017 21:22:54 +0100 Subject: [PATCH 099/140] add defaultOpen --- react-widgets/lib/DropdownList.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/react-widgets/lib/DropdownList.d.ts b/react-widgets/lib/DropdownList.d.ts index f8ac6d6579..aac6ba4765 100644 --- a/react-widgets/lib/DropdownList.d.ts +++ b/react-widgets/lib/DropdownList.d.ts @@ -87,10 +87,14 @@ interface DropdownListProps extends React.Props { onSearch?: (searchTerm: string) => void; /** * Whether or not the DropdownList is open. When unset (undefined) the DropdownList will - * handle the opening and closing internally. The defaultOpen prop can be used to set an - * initialization value for uncontrolled widgets. + * handle the opening and closing internally. */ open?: boolean; + /** + * The defaultOpen prop can be used to set an + * initialization value for uncontrolled widgets. + */ + defaultOpen?: boolean; /** * Called when the DropdownList is about to open or close. onToggle should be used when the * open prop is set otherwise the widget open buttons won't work. From fbe1aee12d05e849bb728896a20b1b30e53758f8 Mon Sep 17 00:00:00 2001 From: Jeff Kenney Date: Wed, 25 Jan 2017 11:58:55 -0800 Subject: [PATCH 100/140] knex: use import = require() syntax --- knex/index.d.ts | 4 ++-- knex/knex-tests.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/knex/index.d.ts b/knex/index.d.ts index 910bab9d04..5196f47eb0 100644 --- a/knex/index.d.ts +++ b/knex/index.d.ts @@ -6,8 +6,8 @@ /// /// -import * as events from "events"; -import * as Promise from "bluebird"; +import events = require("events"); +import Promise = require("bluebird"); type Callback = Function; type Client = Function; diff --git a/knex/knex-tests.ts b/knex/knex-tests.ts index 8c1878760b..420aafd724 100644 --- a/knex/knex-tests.ts +++ b/knex/knex-tests.ts @@ -1,7 +1,7 @@ "use strict"; -import * as Knex from 'knex'; -import * as Promise from 'bluebird'; -import * as _ from 'lodash'; +import Knex = require('knex'); +import Promise = require('bluebird'); +import _ = require('lodash'); // Initializing the Library var knex = Knex({ From 68f67afc33480c9e218fe5d8c31b26b1e07b0c93 Mon Sep 17 00:00:00 2001 From: Olmo del Corral Date: Wed, 25 Jan 2017 22:34:16 +0100 Subject: [PATCH 101/140] fix semicolon and add DateTimePicker defaultOpen --- react-widgets/lib/DateTimePicker.d.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/react-widgets/lib/DateTimePicker.d.ts b/react-widgets/lib/DateTimePicker.d.ts index 3c4aadde29..fe090507d3 100644 --- a/react-widgets/lib/DateTimePicker.d.ts +++ b/react-widgets/lib/DateTimePicker.d.ts @@ -34,7 +34,7 @@ interface DateTimePickerProps extends React.Props { /* * Default value for current date. Usefull for suggesting a date when the caldenar opens without keep forcing it once 'value' is set. */ - defaultCurrentDate?: Date + defaultCurrentDate?: Date; /** * Change event Handler that is called when the currentDate is changed. The handler is * called with the currentDate object. @@ -97,11 +97,16 @@ interface DateTimePickerProps extends React.Props { onSelect?: (date?: Date) => void; /** * Whether or not the DateTimePicker is open. When unset (undefined) the DateTimePicker will - * handle the opening and closing internally. The defaultOpen prop can be used to set an - * initialization value for uncontrolled widgets. + * handle the opening and closing internally. * @enum false "calendar" "time" */ open?: boolean | "calendar" | "time"; + /** + * The defaultOpen prop can be used to set an + * initialization value for uncontrolled widgets. + * @enum false "calendar" "time" + */ + defaultOpen?: boolean | "calendar" | "time"; /** * Called when the DateTimePicker is about to open or close. onToggle should be used when * the open prop is set otherwise the widget will never open or close. From 1934bbf00f9981b0250c5a57db046b5318eb7c2c Mon Sep 17 00:00:00 2001 From: Olmo del Corral Date: Wed, 25 Jan 2017 23:04:21 +0100 Subject: [PATCH 102/140] switch tab -> spaces --- react-widgets/lib/DateTimePicker.d.ts | 2 +- react-widgets/lib/DropdownList.d.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/react-widgets/lib/DateTimePicker.d.ts b/react-widgets/lib/DateTimePicker.d.ts index fe090507d3..6428927cf4 100644 --- a/react-widgets/lib/DateTimePicker.d.ts +++ b/react-widgets/lib/DateTimePicker.d.ts @@ -31,7 +31,7 @@ interface DateTimePickerProps extends React.Props { * @default Date() */ currentDate?: Date; - /* + /* * Default value for current date. Usefull for suggesting a date when the caldenar opens without keep forcing it once 'value' is set. */ defaultCurrentDate?: Date; diff --git a/react-widgets/lib/DropdownList.d.ts b/react-widgets/lib/DropdownList.d.ts index aac6ba4765..52a8e83a99 100644 --- a/react-widgets/lib/DropdownList.d.ts +++ b/react-widgets/lib/DropdownList.d.ts @@ -90,11 +90,11 @@ interface DropdownListProps extends React.Props { * handle the opening and closing internally. */ open?: boolean; - /** + /** * The defaultOpen prop can be used to set an * initialization value for uncontrolled widgets. */ - defaultOpen?: boolean; + defaultOpen?: boolean; /** * Called when the DropdownList is about to open or close. onToggle should be used when the * open prop is set otherwise the widget open buttons won't work. From df1efcebfb309e85d4d22cccec8cd42b6a9236bb Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 25 Jan 2017 14:08:40 -0800 Subject: [PATCH 103/140] Issue template: Clarify that authors should be found in the header --- ISSUE_TEMPLATE.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index a9ae498738..252df5994f 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -1,5 +1,4 @@ -- [ ] I tried using the latest `xxxx/xxxx.d.ts` file in this repo and had problems. +- [ ] I tried using the `@types/xxxx` package and had problems. - [ ] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript - [ ] I have a question that is inappropriate for [StackOverflow](https://stackoverflow.com/). (Please ask any appropriate questions there). -- [ ] I want to talk about `xxxx/xxxx.d.ts`. - - The authors of that type definition are cc/ @.... +- The authors (see `Definitions by:` in `index.d.ts`) are cc/ @.... From 59244e309ee9dbf6de35e3c9a8454940e4d70dff Mon Sep 17 00:00:00 2001 From: york yao Date: Thu, 26 Jan 2017 07:26:23 +0800 Subject: [PATCH 104/140] add typescript version --- node-zookeeper-client/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/node-zookeeper-client/index.d.ts b/node-zookeeper-client/index.d.ts index f405aeffc7..cb9979e9f4 100644 --- a/node-zookeeper-client/index.d.ts +++ b/node-zookeeper-client/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/alexguan/node-zookeeper-client // Definitions by: York Yao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// From 2157659af755ca9ab5fc959562f5033c5d7a1398 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Wed, 25 Jan 2017 20:11:21 -0500 Subject: [PATCH 105/140] Add type definitions for semantic-ui. --- semantic-ui/index.d.ts | 5434 ++++++++++++++++++++++++++++++ semantic-ui/semantic-ui-tests.ts | 140 + semantic-ui/tsconfig.json | 20 + semantic-ui/tslint.json | 3 + 4 files changed, 5597 insertions(+) create mode 100644 semantic-ui/index.d.ts create mode 100644 semantic-ui/semantic-ui-tests.ts create mode 100644 semantic-ui/tsconfig.json create mode 100644 semantic-ui/tslint.json diff --git a/semantic-ui/index.d.ts b/semantic-ui/index.d.ts new file mode 100644 index 0000000000..0c8ddda9be --- /dev/null +++ b/semantic-ui/index.d.ts @@ -0,0 +1,5434 @@ +// Type definitions for Semantic UI 2.2 +// Project: http://semantic-ui.com/ +// Definitions by: Leonard Thieu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +// tslint:disable:unified-signatures + +interface JQuery { + // TODO: Do all modules have a 'setting' behavior? + + // region Modules + + // region Accordion + + /** + * Refreshes all cached selectors and data + */ + accordion(behavior: 'refresh'): JQuery; + /** + * Opens accordion content at index + */ + accordion(behavior: 'open', index: number): JQuery; + /** + * Closes accordion content that are not active + */ + accordion(behavior: 'close others'): JQuery; + /** + * Closes accordion content at index + */ + accordion(behavior: 'close', index: number): JQuery; + /** + * Toggles accordion content at index + */ + accordion(behavior: 'toggle', index: number): JQuery; + accordion(settings: SemanticUI.AccordionSettings): JQuery; + accordion(): JQuery; + + // endregion + + // region Checkbox + + /** + * Switches a checkbox from current state + */ + checkbox(behavior: 'toggle'): JQuery; + /** + * Set a checkbox state to checked + */ + checkbox(behavior: 'check'): JQuery; + /** + * Set a checkbox state to unchecked + */ + checkbox(behavior: 'uncheck'): JQuery; + /** + * Set as indeterminate checkbox + */ + checkbox(behavior: 'indeterminate'): JQuery; + /** + * Set as determinate checkbox + */ + checkbox(behavior: 'determinate'): JQuery; + /** + * Enable interaction with a checkbox + */ + checkbox(behavior: 'enable'): JQuery; + /** + * Set a checkbox state to checked without callbacks + */ + checkbox(behavior: 'set checked'): JQuery; + /** + * Set a checkbox state to unchecked without callbacks + */ + checkbox(behavior: 'set unchecked'): JQuery; + /** + * Set as indeterminate checkbox without callbacks + */ + checkbox(behavior: 'set indeterminate'): JQuery; + /** + * Set as determinate checkbox without callbacks + */ + checkbox(behavior: 'set determinate'): JQuery; + /** + * Enable interaction with a checkbox without callbacks + */ + checkbox(behavior: 'set enabled'): JQuery; + /** + * Disable interaction with a checkbox without callbacks + */ + checkbox(behavior: 'set disabled'): JQuery; + /** + * Attach checkbox events to another element + */ + checkbox(behavior: 'attach events', selector: string, event: string): JQuery; + /** + * Returns whether element is radio selection + */ + checkbox(behavior: 'is radio'): boolean; + /** + * Returns whether element is currently checked + */ + checkbox(behavior: 'is checked'): boolean; + /** + * Returns whether element is not checked + */ + checkbox(behavior: 'is unchecked'): boolean; + /** + * Returns whether element is able to be changed + */ + checkbox(behavior: 'can change'): boolean; + /** + * Returns whether element can be checked (checking if already checked or `beforeChecked` would cancel) + */ + checkbox(behavior: 'should allow check'): boolean; + /** + * Returns whether element can be unchecked (checking if already unchecked or `beforeUnchecked` would cancel) + */ + checkbox(behavior: 'should allow uncheck'): boolean; + /** + * Returns whether element can be determinate (checking if already determinate or `beforeDeterminate` would cancel) + */ + checkbox(behavior: 'should allow determinate'): boolean; + /** + * Returns whether element can be indeterminate (checking if already indeterminate or `beforeIndeterminate` would cancel) + */ + checkbox(behavior: 'should allow indeterminate'): boolean; + /** + * Returns whether element is able to be unchecked + */ + checkbox(behavior: 'can uncheck'): boolean; + checkbox(settings: SemanticUI.CheckboxSettings): JQuery; + checkbox(): JQuery; + + // endregion + + // region Dimmer + + /** + * Detaches a given element from DOM and reattaches element inside dimmer + */ + dimmer(behavior: 'add content', element: SemanticUI.Selector): JQuery; + /** + * Shows dimmer + */ + dimmer(behavior: 'show'): JQuery; + /** + * Hides dimmer + */ + dimmer(behavior: 'hide'): JQuery; + /** + * Toggles current dimmer visibility + */ + dimmer(behavior: 'toggle'): JQuery; + /** + * Changes dimmer opacity + */ + dimmer(behavior: 'set opacity', opacity: number): JQuery; + /** + * Creates a new dimmer in dimmable context + */ + dimmer(behavior: 'create'): JQuery; + /** + * Returns current duration for show or hide event depending on current visibility + */ + dimmer(behavior: 'get duration'): number; + /** + * Returns DOM element for dimmer + */ + dimmer(behavior: 'get dimmer'): JQuery; + /** + * Returns whether current dimmable has a dimmer + */ + dimmer(behavior: 'has dimmer'): boolean; + /** + * Whether section's dimmer is active + */ + dimmer(behavior: 'is active'): boolean; + /** + * Whether dimmer is animating + */ + dimmer(behavior: 'is animating'): boolean; + /** + * Whether current element is a dimmer + */ + dimmer(behavior: 'is dimmer'): boolean; + /** + * Whether current element is a dimmable section + */ + dimmer(behavior: 'is dimmable'): boolean; + /** + * Whether dimmer is disabled + */ + dimmer(behavior: 'is disabled'): boolean; + /** + * Whether dimmer is not disabled + */ + dimmer(behavior: 'is enabled'): boolean; + /** + * Whether dimmable section is body + */ + dimmer(behavior: 'is page'): boolean; + /** + * Whether dimmer is a page dimmer + */ + dimmer(behavior: 'is page dimmer'): boolean; + /** + * Sets page dimmer to active + */ + dimmer(behavior: 'set active'): JQuery; + /** + * Sets an element as a dimmable section + */ + dimmer(behavior: 'set dimmable'): JQuery; + /** + * Sets a dimmable section as dimmed + */ + dimmer(behavior: 'set dimmed'): JQuery; + /** + * Sets current dimmer as a page dimmer + */ + dimmer(behavior: 'set page dimmer'): JQuery; + /** + * Sets a dimmer as disabled + */ + dimmer(behavior: 'set disabled'): JQuery; + dimmer(settings: SemanticUI.DimmerSettings): JQuery; + dimmer(): JQuery; + + // endregion + + // region Dropdown + + // TODO: Should 'value'/'values' parameters be of type 'string' instead of 'any'? + + /** + * Recreates dropdown menu from select option values. + */ + dropdown(behavior: 'setup menu'): JQuery; + /** + * Refreshes all cached selectors and data + */ + dropdown(behavior: 'refresh'): JQuery; + /** + * Toggles current visibility of dropdown + */ + dropdown(behavior: 'toggle'): JQuery; + /** + * Shows dropdown + */ + dropdown(behavior: 'show'): JQuery; + /** + * Hides dropdown + */ + dropdown(behavior: 'hide'): JQuery; + /** + * Clears dropdown of selection + */ + dropdown(behavior: 'clear'): JQuery; + /** + * Hides all other dropdowns that is not current dropdown + */ + dropdown(behavior: 'hide others'): JQuery; + /** + * Restores dropdown text and value to its value on page load + */ + dropdown(behavior: 'restore defaults'): JQuery; + /** + * Restores dropdown text to its value on page load + */ + dropdown(behavior: 'restore default text'): JQuery; + /** + * Restores dropdown text to its prompt, placeholder text + */ + dropdown(behavior: 'restore placeholder text'): JQuery; + /** + * Restores dropdown value to its value on page load + */ + dropdown(behavior: 'restore default value'): JQuery; + /** + * Saves current text and value as new defaults (for use with restore) + */ + dropdown(behavior: 'save defaults'): JQuery; + /** + * Sets value as selected + */ + dropdown(behavior: 'set selected', value: any): JQuery; + /** + * Remove value from selected + */ + dropdown(behavior: 'remove selected', value: any): JQuery; + /** + * Adds a group of values as selected + */ + dropdown(behavior: 'set selected', values: any[]): JQuery; + /** + * Sets selected values to exactly specified values, removing current selection + */ + dropdown(behavior: 'set exactly', values: any[]): JQuery; + /** + * Sets dropdown text to a value + */ + dropdown(behavior: 'set text', text: string): JQuery; + /** + * Sets dropdown input to value (does not update display state) + */ + dropdown(behavior: 'set value', value: any): JQuery; + /** + * Returns current dropdown text + */ + dropdown(behavior: 'get text'): string; + /** + * Returns current dropdown input value + */ + dropdown(behavior: 'get value'): any; + /** + * Returns DOM element that matches a given input value + */ + dropdown(behavior: 'get item', value: any): JQuery; + /** + * Adds touch events to element + */ + dropdown(behavior: 'bind touch events'): JQuery; + /** + * Adds mouse events to element + */ + dropdown(behavior: 'bind mouse events'): JQuery; + /** + * Binds a click to document to determine if you click away from a dropdown + */ + dropdown(behavior: 'bind intent'): JQuery; + /** + * Unbinds document intent click + */ + dropdown(behavior: 'unbind intent'): JQuery; + /** + * Returns whether event occurred inside dropdown + */ + dropdown(behavior: 'determine intent'): boolean; + /** + * Triggers preset item selection action based on settings passing text/value + */ + dropdown(behavior: 'determine select action', text: string, value: any): JQuery; + /** + * Sets dropdown to active state + */ + dropdown(behavior: 'set active'): JQuery; + /** + * Sets dropdown to visible state + */ + dropdown(behavior: 'set visible'): JQuery; + /** + * Removes dropdown active state + */ + dropdown(behavior: 'remove active'): JQuery; + /** + * Removes dropdown visible state + */ + dropdown(behavior: 'remove visible'): JQuery; + /** + * Returns whether dropdown is a selection dropdown + */ + dropdown(behavior: 'is selection'): boolean; + /** + * Returns whether dropdown is animated + */ + dropdown(behavior: 'is animated'): boolean; + /** + * Returns whether dropdown is visible + */ + dropdown(behavior: 'is visible'): boolean; + /** + * Returns whether dropdown is hidden + */ + dropdown(behavior: 'is hidden'): boolean; + /** + * Returns dropdown value as set on page load + */ + dropdown(behavior: 'get default text'): string; + /** + * Returns placeholder text + */ + dropdown(behavior: 'get placeholder text'): string; + dropdown(settings: SemanticUI.DropdownSettings): JQuery; + dropdown(): JQuery; + + // endregion + + // region Embed + + /** + * Changes iframe to a new content source + */ + embed(behavior: 'change', source: string, id: string, url: string): JQuery; + /** + * Removes embed and shows placeholder content if available + */ + embed(behavior: 'reset'): JQuery; + /** + * Shows embed content + */ + embed(behavior: 'show'): JQuery; + /** + * Hides embed content and shows placeholder content + */ + embed(behavior: 'hide'): JQuery; + /** + * Returns current content id + */ + embed(behavior: 'get id'): string; + /** + * Returns placeholder image url + */ + embed(behavior: 'get placeholder'): string; + /** + * Returns source name + */ + embed(behavior: 'get sources'): string; + /** + * Returns source type + */ + embed(behavior: 'get type'): string; + /** + * Returns URL with all parameters added + */ + embed(behavior: 'get url'): string; + /** + * Returns whether embed content has placeholder + */ + embed(behavior: 'has placeholder'): boolean; + /** + * Destroys instance and removes all events + */ + embed(behavior: 'destroy'): JQuery; + embed(settings: SemanticUI.EmbedSettings): JQuery; + embed(): JQuery; + + // endregion + + // region Modal + + /** + * Shows the modal + */ + modal(behavior: 'show'): JQuery; + /** + * Hides the modal + */ + modal(behavior: 'hide'): JQuery; + /** + * Toggles the modal + */ + modal(behavior: 'toggle'): JQuery; + /** + * Refreshes centering of modal on page + */ + modal(behavior: 'refresh'): JQuery; + /** + * Shows associated page dimmer + */ + modal(behavior: 'show dimmer'): JQuery; + /** + * Hides associated page dimmer + */ + modal(behavior: 'hide dimmer'): JQuery; + /** + * Hides all modals not selected modal in a dimmer + */ + modal(behavior: 'hide others'): JQuery; + /** + * Hides all visible modals in the same dimmer + */ + modal(behavior: 'hide all'): JQuery; + /** + * Caches current modal size + */ + modal(behavior: 'cache sizes'): JQuery; + /** + * Returns whether the modal can fit on the page + */ + modal(behavior: 'can fit'): boolean; + /** + * Returns whether the modal is active + */ + modal(behavior: 'is active'): boolean; + /** + * Sets modal to active + */ + modal(behavior: 'set active'): JQuery; + modal(behavior: 'attach events', selector: SemanticUI.Selector, event?: string): JQuery; + modal(behavior: 'setting', name: string, value: any): JQuery; + modal(settings: SemanticUI.ModalSettings): JQuery; + modal(): JQuery; + + // endregion + + // region Nag + + // TODO: Documentation is lacking. Is it possible to infer intended behaviors? + + nag(behavior: 'show'): JQuery; + /** + * Clears cookie so nag shows again + */ + nag(behavior: 'clear'): JQuery; + nag(settings: SemanticUI.NagSettings): JQuery; + + // endregion + + // region Popup + + /** + * Shows popup + */ + popup(behavior: 'show'): JQuery; + /** + * Hides popup + */ + popup(behavior: 'hide'): JQuery; + /** + * Hides all visible pop ups on the page + */ + popup(behavior: 'hide all'): JQuery; + /** + * Returns current popup dom element + */ + popup(behavior: 'get popup'): JQuery; + /** + * Changes current popup content + */ + popup(behavior: 'change content', html: string): JQuery; + /** + * Toggles visibility of popup + */ + popup(behavior: 'toggle'): JQuery; + /** + * Returns whether popup is visible + */ + popup(behavior: 'is visible'): boolean; + /** + * Returns whether popup is hidden + */ + popup(behavior: 'is hidden'): boolean; + /** + * Returns whether popup is created and inserted into the page + */ + popup(behavior: 'exists'): boolean; + /** + * Adjusts popup when content size changes (only necessary for centered popups) + */ + popup(behavior: 'reposition'): JQuery; + /** + * Repositions a popup + */ + popup(behavior: 'set position', position: string): JQuery; + /** + * Removes popup from the page and removes all events + */ + popup(behavior: 'destroy'): JQuery; + /** + * Removes popup from the page + */ + popup(behavior: 'remove popup'): JQuery; + popup(settings: SemanticUI.PopupSettings): JQuery; + popup(): JQuery; + + // endregion + + // region Progress + + /** + * Sets current percent of progress to value. If using a total will convert from percent to estimated value. + */ + progress(behavior: 'set percent', percent: number): JQuery; + /** + * Sets progress to specified value. Will automatically calculate percent from total. + */ + progress(behavior: 'set progress', value: number): JQuery; + /** + * Increments progress by increment value, if not passed a value will use random amount specified in settings + */ + progress(behavior: 'increment', incrementValue: number): JQuery; + /** + * Decrements progress by decrement value, if not passed a value will use random amount specified in settings + */ + progress(behavior: 'decrement', decrementValue: number): JQuery; + /** + * Immediately updates progress to value, ignoring progress animation interval delays + */ + progress(behavior: 'update progress', value: number): JQuery; + /** + * Finishes progress and sets loaded to 100% + */ + progress(behavior: 'complete'): JQuery; + /** + * Resets progress to zero + */ + progress(behavior: 'reset'): JQuery; + /** + * Set total to a new value + */ + progress(behavior: 'set total', total: number): JQuery; + /** + * Replaces templated string with value, total, percent left and percent. + */ + progress(behavior: 'get text', text: string): string; + /** + * Returns normalized value inside acceptable range specified by total. + */ + progress(behavior: 'get normalized value', value: number): number; + /** + * Returns percent as last specified + */ + progress(behavior: 'get percent'): number; + /** + * Returns current progress value + */ + progress(behavior: 'get value'): number; + /** + * Returns total + */ + progress(behavior: 'get total'): number; + /** + * Returns whether progress is completed + */ + progress(behavior: 'is complete'): boolean; + /** + * Returns whether progress was a success + */ + progress(behavior: 'is success'): boolean; + /** + * Returns whether progress is in warning state + */ + progress(behavior: 'is warning'): boolean; + /** + * Returns whether progress is in error state + */ + progress(behavior: 'is error'): boolean; + /** + * Returns whether progress is in active state + */ + progress(behavior: 'is active'): boolean; + /** + * Sets progress to active state + */ + progress(behavior: 'set active'): JQuery; + /** + * Sets progress to warning state + */ + progress(behavior: 'set warning'): JQuery; + /** + * Sets progress to success state + */ + progress(behavior: 'set success'): JQuery; + /** + * Sets progress to error state + */ + progress(behavior: 'set error'): JQuery; + /** + * Changes progress animation speed + */ + progress(behavior: 'set duration', value: number): JQuery; + /** + * Sets progress exterior label to text + */ + progress(behavior: 'set label', text: string): JQuery; + /** + * Sets progress bar label to text + */ + progress(behavior: 'set bar label', text: string): JQuery; + /** + * Removes progress to active state + */ + progress(behavior: 'remove active'): JQuery; + /** + * Removes progress to warning state + */ + progress(behavior: 'remove warning'): JQuery; + /** + * Removes progress to success state + */ + progress(behavior: 'remove success'): JQuery; + /** + * Removes progress to error state + */ + progress(behavior: 'remove error'): JQuery; + progress(settings: SemanticUI.ProgressSettings): JQuery; + progress(): JQuery; + + // endregion + + // region Rating + + /** + * Sets rating programmatically + */ + rating(behavior: 'set rating', rating: number): JQuery; + /** + * Gets current rating + */ + rating(behavior: 'get rating'): number; + /** + * Disables interactive rating mode + */ + rating(behavior: 'disable'): JQuery; + /** + * Enables interactive rating mode + */ + rating(behavior: 'enable'): JQuery; + /** + * Clears current rating + */ + rating(behavior: 'clear rating'): JQuery; + rating(settings: SemanticUI.RatingSettings): JQuery; + rating(): JQuery; + + // endregion + + // region Search + + /** + * Search for value currently set in search input + */ + search(behavior: 'query'): JQuery; + /** + * Displays message in search results with text, using template matching type + */ + search(behavior: 'display message', text: string, type: string): JQuery; + /** + * Cancels current remote search query + */ + search(behavior: 'cancel query'): JQuery; + /** + * Search local object for specified query and display results + */ + search(behavior: 'search local', query: string): JQuery; + /** + * Whether has minimum characters + */ + search(behavior: 'has minimum characters'): boolean; + /** + * Search remote endpoint for specified query and display results + */ + search(behavior: 'search remote', query: string): JQuery; + /** + * Search object for specified query and return results + */ + search(behavior: 'search object', query: string, object: any, searchFields: string[]): any; + /** + * Cancels current remote search request + */ + search(behavior: 'cancel query'): JQuery; + /** + * Whether search is currently focused + */ + search(behavior: 'is focused'): boolean; + /** + * Whether search results are visible + */ + search(behavior: 'is visible'): boolean; + /** + * Whether search results are empty + */ + search(behavior: 'is empty'): boolean; + /** + * Returns current search value + */ + search(behavior: 'get value'): any; + /** + * Returns JSON object matching searched title or id (see above) + */ + search(behavior: 'get result', value: any): any; + /** + * Sets search input to value + */ + search(behavior: 'set value', value: any): JQuery; + /** + * Reads cached results for query + */ + search(behavior: 'read cache', query: string): JQuery; + /** + * Clears value from cache, if no parameter passed clears all cache + */ + search(behavior: 'clear cache', query?: string): JQuery; + /** + * Writes cached results for query + */ + search(behavior: 'write cache', query: string): JQuery; + /** + * Adds HTML to results and displays + */ + search(behavior: 'add results', html: string): JQuery; + /** + * Shows results container + */ + search(behavior: 'show results'): JQuery; + /** + * Hides results container + */ + search(behavior: 'hide results'): JQuery; + /** + * Generates results using parser specified by settings.template + */ + search(behavior: 'generate results', response: any): JQuery; + /** + * Removes all events + */ + search(behavior: 'destroy'): JQuery; + search(settings: SemanticUI.SearchSettings): JQuery; + search(): JQuery; + + // endregion + + // region Shape + + /** + * Flips the shape upward + */ + shape(behavior: 'flip up'): JQuery; + /** + * Flips the shape downward + */ + shape(behavior: 'flip down'): JQuery; + /** + * Flips the shape right + */ + shape(behavior: 'flip right'): JQuery; + /** + * Flips the shape left + */ + shape(behavior: 'flip left'): JQuery; + /** + * Flips the shape over clock-wise + */ + shape(behavior: 'flip over'): JQuery; + /** + * Flips the shape over counter-clockwise + */ + shape(behavior: 'flip back'): JQuery; + /** + * Set the next side to a specific selector + */ + shape(behavior: 'set next side', selector: SemanticUI.Selector): JQuery; + /** + * Returns whether shape is currently animating + */ + shape(behavior: 'is animating'): boolean; + /** + * Removes all inline styles + */ + shape(behavior: 'reset'): JQuery; + /** + * Queues an animation until after current animation + */ + shape(behavior: 'queue', animation: string): JQuery; + /** + * Forces a reflow on element + */ + shape(behavior: 'repaint'): JQuery; + /** + * Set the next side to next sibling to active element + */ + shape(behavior: 'set default side'): JQuery; + /** + * Sets shape to the content size of the next side + */ + shape(behavior: 'set stage size'): JQuery; + /** + * Refreshes the selector cache for element sides + */ + shape(behavior: 'refresh'): JQuery; + /** + * Returns translation for next side staged below + */ + shape(behavior: 'get transform down'): SemanticUI.Translation; + /** + * Returns translation for next side staged left + */ + shape(behavior: 'get transform left'): SemanticUI.Translation; + /** + * Returns translation for next side staged right + */ + shape(behavior: 'get transform right'): SemanticUI.Translation; + /** + * Returns translation for next side staged up + */ + shape(behavior: 'get transform up'): SemanticUI.Translation; + /** + * Returns translation for next side staged down + */ + shape(behavior: 'get transform down'): SemanticUI.Translation; + shape(settings: SemanticUI.ShapeSettings): JQuery; + shape(): JQuery; + + // endregion + + // region Sidebar + + /** + * Attaches sidebar action to given selector. Default event if none specified is toggle + */ + sidebar(behavior: 'attach events', selector: string, event?: string): JQuery; + /** + * Shows sidebar + */ + sidebar(behavior: 'show'): JQuery; + /** + * Hides sidebar + */ + sidebar(behavior: 'hide'): JQuery; + /** + * Toggles visibility of sidebar + */ + sidebar(behavior: 'toggle'): JQuery; + /** + * Returns whether sidebar is visible + */ + sidebar(behavior: 'is visible'): boolean; + /** + * Returns whether sidebar is hidden + */ + sidebar(behavior: 'is hidden'): boolean; + /** + * Pushes page content to be visible alongside sidebar + */ + sidebar(behavior: 'push page'): JQuery; + /** + * Returns direction of current sidebar + */ + sidebar(behavior: 'get direction'): string; + /** + * Returns page content to original position + */ + sidebar(behavior: 'pull page'): JQuery; + /** + * Adds stylesheet to page head to trigger sidebar animations + */ + sidebar(behavior: 'add body CSS'): JQuery; + /** + * Removes any inline stylesheets for sidebar animation + */ + sidebar(behavior: 'remove body CSS'): JQuery; + /** + * Returns vendor prefixed transition end event + */ + sidebar(behavior: 'get transition event'): string; + sidebar(settings: SemanticUI.SidebarSettings): JQuery; + sidebar(): JQuery; + + // endregion + + // region Sticky + + /** + * recalculates offsets + */ + sticky(behavior: 'refresh'): JQuery; + sticky(settings: SemanticUI.StickySettings): JQuery; + sticky(): JQuery; + + // endregion + + // region Tab + + /** + * Attaches tab action to given selector. Default event if none specified is toggle + */ + tab(behavior: 'attach events', selector: string, event?: string): JQuery; + /** + * Changes tab to path + */ + tab(behavior: 'change tab', path: string): JQuery; + /** + * Sets current path to state + */ + tab(behavior: 'set state', path: string): JQuery; + /** + * Returns current path + */ + tab(behavior: 'get path'): string; + /** + * Returns whether tab exists + */ + tab(behavior: 'is tab'): boolean; + /** + * Returns cached HTML for path + */ + tab(behavior: 'cache read', path: string): string | false; + /** + * Sets cached HTML for path + */ + tab(behavior: 'cache add', path: string, html: string): JQuery; + /** + * Removes cached HTML for path + */ + tab(behavior: 'cache remove', path: string): JQuery; + tab(settings: SemanticUI.TabSettings): JQuery; + tab(): JQuery; + + // endregion + + // region Transition + + /** + * Stop current animation and preserve queue + */ + transition(behavior: 'stop'): JQuery; + /** + * Stop current animation and queued animations + */ + transition(behavior: 'stop all'): JQuery; + /** + * Clears all queued animations + */ + transition(behavior: 'clear queue'): JQuery; + /** + * Stop current animation and show element + */ + transition(behavior: 'show'): JQuery; + /** + * Stop current animation and hide element + */ + transition(behavior: 'hide'): JQuery; + /** + * Toggles between hide and show + */ + transition(behavior: 'toggle'): JQuery; + /** + * Forces reflow using a more expensive but stable method + */ + transition(behavior: 'force repaint'): JQuery; + /** + * Triggers reflow on element + */ + transition(behavior: 'repaint'): JQuery; + /** + * Resets all conditions changes during transition + */ + transition(behavior: 'reset'): JQuery; + /** + * Enables animation looping + */ + transition(behavior: 'looping'): JQuery; + /** + * Removes looping state from element + */ + transition(behavior: 'remove looping'): JQuery; + /** + * Adds disabled state (stops ability to animate) + */ + transition(behavior: 'disable'): JQuery; + /** + * Removes disabled state + */ + transition(behavior: 'enable'): JQuery; + /** + * Modifies element animation duration + */ + transition(behavior: 'set duration', duration: number): JQuery; + /** + * Saves all class names and styles to cache to be retrieved after animation + */ + transition(behavior: 'save conditions'): JQuery; + /** + * Adds back cached names and styles to element + */ + transition(behavior: 'restore conditions'): JQuery; + /** + * Returns vendor prefixed animation property for animationname + */ + transition(behavior: 'get animation name'): string; + /** + * Returns vendor prefixed animation property for animationend + */ + transition(behavior: 'get animation event'): string; + /** + * Returns whether element is currently visible + */ + transition(behavior: 'is visible'): boolean; + /** + * Returns whether transition is currently occurring + */ + transition(behavior: 'is animating'): boolean; + /** + * Returns whether animation looping is set + */ + transition(behavior: 'is looping'): boolean; + /** + * Returns whether animations are supported + */ + transition(behavior: 'is supported'): boolean; + transition(transition: string): JQuery; + transition(settings: SemanticUI.TransitionSettings): JQuery; + transition(): JQuery; + + // endregion + + // endregion + + // region Behaviors + + // region API + + /** + * Execute query using existing API settings + */ + api(behavior: 'query'): JQuery; + /** + * Adds data to existing templated url and returns full url string + */ + api(behavior: 'add url data', url: string, data: any): string; + /** + * Gets promise for current API request + */ + api(behavior: 'get request'): JQueryDeferred | false; + /** + * Aborts current API request + */ + api(behavior: 'abort'): JQuery; + /** + * Removes loading and error state from element + */ + api(behavior: 'reset'): JQuery; + /** + * Returns whether last request was cancelled + */ + api(behavior: 'was cancelled'): boolean; + /** + * Returns whether last request was failure + */ + api(behavior: 'was failure'): boolean; + /** + * Returns whether last request was successful + */ + api(behavior: 'was successful'): boolean; + /** + * Returns whether last request was completed + */ + api(behavior: 'was complete'): boolean; + /** + * Returns whether element is disabled + */ + api(behavior: 'is disabled'): boolean; + /** + * Returns whether element response is mocked + */ + api(behavior: 'is mocked'): boolean; + /** + * Returns whether element is loading + */ + api(behavior: 'is loading'): boolean; + /** + * Sets loading state to element + */ + api(behavior: 'set loading'): JQuery; + /** + * Sets error state to element + */ + api(behavior: 'set error'): JQuery; + /** + * Removes loading state to element + */ + api(behavior: 'remove loading'): JQuery; + /** + * Removes error state to element + */ + api(behavior: 'remove error'): JQuery; + /** + * Gets event that API request will occur on + */ + api(behavior: 'get event'): string; + /** + * Returns encodeURIComponent value only if value passed is not already encoded + */ + api(behavior: 'get url encoded value', value: any): string; + /** + * Reads a locally cached response for a URL + */ + api(behavior: 'read cached response', url: string): any; + /** + * Writes a cached response for a URL + */ + api(behavior: 'write cached response', url: string, response: any): JQuery; + /** + * Creates new cache, removing all locally cached URLs + */ + api(behavior: 'create cache'): JQuery; + /** + * Removes API settings from the page and all events + */ + api(behavior: 'destroy'): JQuery; + api(settings: SemanticUI.ApiSettings): JQuery; + api(): JQuery; + + // endregion + + // region Form Validation + + /** + * Submits selected form + */ + form(behavior: 'submit'): JQuery; + /** + * Returns true/false whether a form passes its validation rules + */ + form(behavior: 'is valid'): boolean; + /** + * Validates form and calls onSuccess or onFailure + */ + form(behavior: 'validate form'): JQuery; + /** + * gets browser property change event + */ + form(behavior: 'get change event'): string; + /** + * Returns element with matching name, id, or data-validate metadata to ID + */ + form(behavior: 'get field', id: string): JQuery; + /** + * Returns value of element with id + */ + form(behavior: 'get value', id: string): any; + /** + * Returns object of element values that match array of ids. If no IDS are passed will return all fields + */ + form(behavior: 'get values', ids?: string[]): any; + /** + * Sets value of element with id + */ + form(behavior: 'set value', id: string): JQuery; + /** + * Sets key/value pairs from passed values object to matching ids + */ + form(behavior: 'set values', values: any): JQuery; + /** + * Returns validation rules for a given jQuery-referenced input field + */ + form(behavior: 'get validation', element: JQuery): any; + /** + * Returns whether a field exists + */ + form(behavior: 'has field', identifier: string): boolean; + /** + * Adds errors to form, given an array errors + */ + form(behavior: 'add errors', errors: string[]): JQuery; + form(settings: SemanticUI.FormSettings): JQuery; + form(): JQuery; + + // endregion + + // region Visibility + + /** + * Disable callbacks temporarily. This is useful if you need to adjust scroll position and do not want to trigger callbacks during the position change. + */ + visibility(behavior: 'disable callbacks'): JQuery; + /** + * Re-enable callbacks + */ + visibility(behavior: 'enable callbacks'): JQuery; + /** + * Returns whether element is on screen + */ + visibility(behavior: 'is on screen'): boolean; + /** + * Returns whether element is off screen + */ + visibility(behavior: 'is off screen'): boolean; + /** + * Returns number of pixels passed in current element from top of element + */ + visibility(behavior: 'get pixels passed'): number; + /** + * Returns element calculations as object + */ + visibility(behavior: 'get element calculations'): SemanticUI.ElementCalculations; + /** + * Returns screen calculations as object + */ + visibility(behavior: 'get screen calculations'): SemanticUI.ScreenCalculations; + /** + * Returns screen size as object + */ + visibility(behavior: 'get screen size'): SemanticUI.ScreenSize; + visibility(settings: SemanticUI.VisibilitySettings): JQuery; + visibility(): JQuery; + + // endregion + + // endregion +} + +declare namespace SemanticUI { + type Selector = string | JQuery; + + /** + * These settings are native to all modules, and define how the component ties content to DOM attributes, and debugging settings for the module. + */ + interface ComponentSettings { + // region DOM Settings + + /** + * Event namespace. Makes sure module teardown does not effect other events attached to an element. + */ + namespace?: string; + + // endregion + + // region Debug Settings + + /** + * Name used in log statements + */ + name?: string; + /** + * Silences all console output including error messages, regardless of other debug settings. + */ + silent?: boolean; + /** + * Debug output to console + */ + debug?: boolean; + /** + * Show console.table output with performance metrics + */ + performance?: boolean; + /** + * Debug output includes all internal behaviors + */ + verbose?: boolean; + + // endregion + } + + // region Modules + + // region Accordion + + /** + * @see {@link http://semantic-ui.com/modules/accordion.html#/settings} + */ + interface AccordionSettings extends ComponentSettings { + // region Behavior + + /** + * Only allow one section open at a time + * + * @default true + */ + exclusive?: boolean; + /** + * Event on title that will cause accordion to open + * + * @default 'click' + */ + on?: string; + /** + * Whether child content opacity should be animated (may cause performance issues with many child elements) + * + * @default true + */ + animateChildren?: boolean; + /** + * Close open nested accordion content when an element closes + * + * @default true + */ + closeNested?: boolean; + /** + * Allow active sections to collapse + * + * @default true + */ + collapsible?: boolean; + /** + * Duration in ms of opening animation + * + * @default 500 + */ + duration?: number; + /** + * Easing of opening animation. EaseInOutQuint is included with accordion, for additional options you must include easing equations. + * + * @default 'easeInOutQuint' + * @see {@link http://gsgd.co.uk/sandbox/jquery/easing/} + */ + easing?: string; + // TODO: Undocumented but probably intended to be public? + // observeChanges?: boolean; + + // endregion + + // region Callbacks + + /** + * Callback before element opens + */ + onOpening?: (this: JQuery) => void; + /** + * Callback after element is open + */ + onOpen?: (this: JQuery) => void; + /** + * Callback before element closes + */ + onClosing?: (this: JQuery) => void; + /** + * Callback after element is closed + */ + onClose?: (this: JQuery) => void; + /** + * Callback on element open or close + */ + onChange?: (this: JQuery) => void; + + // endregion + + // region DOM Settings + + /** + * Selectors used to find parts of a module + */ + selector?: { + /** + * @default '.accordion' + */ + accordion?: string; + /** + * @default '.title' + */ + title?: string; + /** + * @default '.title' + */ + trigger?: string; + /** + * @default '.content' + */ + content?: string; + }; + /** + * Class names used to determine element state + */ + className?: { + /** + * @default 'active' + */ + active?: string; + /** + * @default 'animating' + */ + animating?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'The method you called is not defined.' + */ + method?: string; + }; + + // endregion + } + + // endregion + + // region Checkbox + + /** + * @see {@link http://semantic-ui.com/modules/checkbox.html#/settings} + */ + interface CheckboxSettings extends ComponentSettings { + // region Behavior + + /** + * Setting to true/false will determine whether an input will allow no selection. Auto will set disallow this behavior only for radio boxes + * + * @default 'auto' + */ + uncheckable?: 'auto' | boolean; + /** + * Whether callbacks for checked status should be fired on init as well as change + * + * @default false + */ + fireOnInit?: boolean; + + // endregion + + // region Callbacks + + /** + * Callback after a checkbox is either checked or unchecked. + */ + onChange?: (this: HTMLElement) => void; + /** + * Callback after a checkbox is checked. + */ + onChecked?: (this: HTMLElement) => void; + /** + * Callback after a checkbox is set to undeterminate. + */ + onIndeterminate?: (this: HTMLElement) => void; + /** + * Callback after a checkbox is set to determinate. + */ + onDeterminate?: (this: HTMLElement) => void; + /** + * Callback after a checkbox is unchecked. + */ + onUnchecked?: (this: HTMLElement) => void; + /** + * Callback before a checkbox is checked. Can cancel change by returning false + */ + beforeChecked?: (this: HTMLElement) => boolean; + /** + * Callback before a checkbox is set to undeterminate. Can cancel change by returning false + */ + beforeIndeterminate?: (this: HTMLElement) => boolean; + /** + * Callback before a checkbox is set to determinate. Can cancel change by returning false + */ + beforeDeterminate?: (this: HTMLElement) => boolean; + /** + * Callback before a checkbox is unchecked. Can cancel change by returning false + */ + beforeUnchecked?: (this: HTMLElement) => boolean; + /** + * Callback after a checkbox is enabled. + */ + onEnable?: (this: HTMLElement) => void; + /** + * Callback after a checkbox is disabled. + */ + onDisable?: (this: HTMLElement) => void; + /** + * Callback after a checkbox is enabled. + * + * @deprecated + */ + onEnabled?: (this: HTMLElement) => void; + /** + * Callback after a checkbox is disabled. + * + * @deprecated + */ + onDisabled?: (this: HTMLElement) => void; + + // endregion + + // region DOM Settings + + /** + * Selectors used to find parts of a module + */ + selector?: { + /** + * @default 'input[type=checkbox], input[type=radio]' + */ + input?: string; + /** + * @default 'label' + */ + label?: string; + }; + /** + * Class names used to determine element state + */ + className?: { + /** + * @default 'checked' + */ + checked?: string; + /** + * @default 'disabled' + */ + disabled?: string; + /** + * @default 'radio' + */ + radio?: string; + /** + * @default 'read-only' + */ + readOnly?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'The method you called is not defined.' + */ + method?: string; + }; + + // endregion + } + + // endregion + + // region Dimmer + + /** + * @see {@link http://semantic-ui.com/modules/dimmer.html#/settings} + */ + interface DimmerSettings extends ComponentSettings { + // region Behavior + + /** + * Dimmers opacity from 0-1. Defaults to auto which uses the CSS specified opacity. + * + * @default 'auto' + */ + opacity?: 'auto' | number; + /** + * Specify a variation to add when generating dimmer, like inverted + * + * @default false + */ + variation?: false | string; + /** + * If initializing a dimmer on a dimmable context, you can use dimmerName to distinguish between multiple dimmers in that context. + * + * @default false + */ + dimmerName?: false | string; + /** + * Whether clicking on the dimmer should hide the dimmer (Defaults to auto, closable only when settings.on is not hover + * + * @default 'auto' + */ + closable?: 'auto' | boolean; + /** + * Can be set to hover or click to show/hide dimmer on dimmable event + * + * @default false + */ + on?: false | 'hover' | 'click'; + /** + * Whether to dim dimmers using CSS transitions. + * + * @default true + */ + useCSS?: boolean; + /** + * Animation duration of dimming. If an integer is used, that value will apply to both show and hide animations. + */ + duration?: number | { + /** + * @default 500 + */ + show?: number; + /** + * @default 500 + */ + hide?: number; + }; + /** + * Named transition to use when animating menu in and out. Fade and slide down are available without including ui transitions + * + * @default 'fade' + * @see {@link http://semantic-ui.com/modules/transition.html} + */ + transition?: string; + + // endregion + + // region Callbacks + + /** + * Callback on element show + */ + onShow?: (this: JQuery) => void; + /** + * Callback on element hide + */ + onHide?: (this: JQuery) => void; + /** + * Callback on element show or hide + */ + onchange?: (this: JQuery) => void; + + // endregion + + // region DOM Settings + + /** + * Object containing selectors used by module. + */ + selector?: { + /** + * @default '.dimmable' + */ + dimmable?: string; + /** + * @default '.ui.dimmer' + */ + dimmer?: string; + /** + * @default '.ui.dimmer > .content, .ui.dimmer > .content > .center' + */ + content?: string; + }; + /** + * Templates used to generate dimmer content + */ + template?: { + dimmer?: () => JQuery; + }; + /** + * Class names used to attach style to state + */ + className?: { + /** + * @default 'active' + */ + active?: string; + /** + * @default 'dimmable' + */ + dimmable?: string; + /** + * @default 'dimmed' + */ + dimmed?: string; + /** + * @default 'disabled' + */ + disabled?: string; + /** + * @default 'page' + */ + pageDimmer?: string; + /** + * @default 'hide' + */ + hide?: string; + /** + * @default 'show' + */ + show?: string; + /** + * @default 'transition' + */ + transition?: string; + }; + + // endregion + + // region Debug Settings + + /** + * Error messages displayed to console + */ + error?: { + /** + * @default 'The method you called is not defined.' + */ + method?: string; + }; + + // endregion + } + + // endregion + + // region Dropdown + + /** + * @see {@link http://semantic-ui.com/modules/dropdown.html#/settings} + */ + interface DropdownSettings extends ComponentSettings { + // TODO: Should 'value'/'values' parameters be of type 'string' instead of 'any'? + + // region Frequently Used Settings + + /** + * Event used to trigger dropdown (Hover, Click, Custom Event) + * + * @default 'click' + */ + on?: string; + /** + * When set to true will fire onChange even when the value a user select matches the currently selected value. + * + * @default false + */ + allowReselection?: boolean; + /** + * Whether search selection should allow users to add their own selections, works for single or multi-select. + * + * @default false + */ + allowAdditions?: boolean; + /** + * When disabled user additions will appear in the results menu using a specially formatted selection item formatted by templates.addition. + * + * @default true + */ + hideAdditions?: boolean; + /** + * Sets a default action to occur. (See usage guide) + * + * @default 'activate' + * @see {@link http://semantic-ui.com/modules/dropdown.html#/usage} + */ + action?: 'activate' | 'select' | 'combo' | 'nothing' | 'hide' | ((this: JQuery, text: string, value: string | false, element: JQuery) => void); + /** + * The minimum characters for a search to begin showing results + * + * @default 1 + */ + minCharacters?: number; + /** + * When using search selection specifies how to match values. + * + * @default 'both' + */ + match?: 'both' | 'value' | 'text'; + /** + * Whether dropdown should select new option when using keyboard shortcuts. Setting to false will require enter or left click to confirm a choice. + * + * @default true + */ + selectOnKeydown?: boolean; + /** + * Whether search selection will force currently selected choice when element is blurred. + * + * @default true + */ + forceSelection?: boolean; + /** + * Whether menu items with sub-menus (categories) should be selectable + * + * @default false + */ + allowCategorySelection?: boolean; + /** + * @default 'auto' + */ + placeholder?: 'auto' | 'value' | false; + + // endregion + + // region Remote Settings + + /** + * Can be set to an object to specify API settings for retrieving remote selection menu content from an API endpoint + * + * @default false + * @see {@link http://semantic-ui.com/behaviors/api.html} + */ + apiSettings?: false | ApiSettings; + /** + * List mapping dropdown content to JSON Property when using API + */ + fields?: { + /** + * grouping for api results + * + * @default 'results' + */ + remoteValues?: string; + /** + * grouping for all dropdown values + * + * @default 'values' + */ + values?: string; + /** + * displayed dropdown text + * + * @default 'name' + */ + name?: string; + /** + * actual dropdown value + * + * @default 'value' + */ + value?: string; + }; + /** + * When enabled will automatically store selected name/value pairs in sessionStorage to preserve user selection on page refresh. Disabling will clear remote dropdown values on refresh. + * + * @default true + */ + saveRemoteData?: boolean; + + // endregion + + // region Multiple Select Settings + + /** + * Whether multiselect should use labels. Must be set to true when allowAdditions is true + * + * @default true + */ + useLabels?: boolean; + /** + * When set to a number, sets the maximum number of selections + * + * @default false + */ + maxSelections?: boolean; + /** + * Maximum glyph width, used to calculate search size. This is usually size of a "W" in your font in em + * + * @default 1.0714 + */ + glyphWidth?: number; + /** + * Allows customization of multi-select labels + */ + label?: { + /** + * @default 'horizontal flip' + */ + transition?: string; + /** + * @default 200 + */ + duration?: number; + /** + * @default false + */ + variation?: false | string; + }; + + // endregion + + // region Additional Settings + + /** + * When set to auto determines direction based on whether dropdown can fit on screen. Set to upward or downward to always force a direction. + * + * @default 'auto' + */ + direction?: 'auto' | 'upward' | 'downward'; + /** + * Whether dropdown should try to keep itself on screen by checking whether menus display position in its context (Default context is page). + * + * @default true + */ + keepOnScreen?: boolean; + /** + * Element context to use when checking whether can show when keepOnScreen: true + * + * @default 'window' + */ + context?: Selector; + /** + * Specifying to "true" will use a fuzzy full text search, setting to "exact" will force the exact search to be matched somewhere in the string + * + * @default false + */ + fullTextSearch?: boolean | 'exact'; + /** + * Whether HTML included in dropdown values should be preserved. (Allows icons to show up in selected value) + * + * @default true + */ + preserveHTML?: boolean; + /** + * Whether to sort values when creating a dropdown automatically from a select element. + * + * @default false + */ + sortSelect?: boolean; + /** + * Whether to show dropdown menu automatically on element focus. + * + * @default true + */ + showOnFocus?: boolean; + /** + * Whether to allow the element to be navigable by keyboard, by automatically creating a tabindex + * + * @default true + */ + allowTab?: boolean; + /** + * Named transition to use when animating menu in and out. Defaults to slide down or slide up depending on dropdown direction. Fade and slide down are available without including ui transitions + * + * @default 'auto' + * @see {@link http://semantic-ui.com/modules/transition.html} + */ + transition?: 'auto' | string; + /** + * Duration of animation events + * + * @default 200 + */ + duration?: number; + /** + * The keycode used to represent keyboard shortcuts. To avoid issues with some foreign languages, you can pass false for comma delimiter's value + */ + keys?: { + /** + * @default 8 + */ + backspace?: number; + /** + * @default 188 + */ + delimiter?: number | false; + /** + * @default 46 + */ + deleteKey?: number; + /** + * @default 13 + */ + enter?: number; + /** + * @default 27 + */ + escape?: number; + /** + * @default 33 + */ + pageUp?: number; + /** + * @default 34 + */ + pageDown?: number; + /** + * @default 37 + */ + leftArrow?: number; + /** + * @default 38 + */ + upArrow?: number; + /** + * @default 39 + */ + rightArrow?: number; + /** + * @default 40 + */ + downArrow?: number; + }; + /** + * Time in milliseconds to debounce show or hide behavior when on: hover is used, or when touch is used. + */ + delay?: { + /** + * @default 300 + */ + hide?: number; + /** + * @default 200 + */ + show?: number; + /** + * @default 50 + */ + search?: number; + /** + * @default 50 + */ + touch?: number; + }; + + // endregion + + // region Callbacks + + /** + * Is called after a dropdown value changes. Receives the name and value of selection and the active menu element + */ + onChange?: (this: JQuery, value: any, text: string, $choice: JQuery) => void; + /** + * Is called after a dropdown selection is added using a multiple select dropdown, only receives the added value + */ + onAdd?: (this: JQuery, addedValue: any, addedText: string, $addedChoice: JQuery) => void; + /** + * Is called after a dropdown selection is removed using a multiple select dropdown, only receives the removed value + */ + onRemove?: (this: JQuery, removedValue: any, removedText: string, $removedChoice: JQuery) => void; + /** + * Allows you to modify a label before it is added. Expects the jQ DOM element for a label to be returned. + */ + onLabelCreate?: (this: JQuery, value: any, text: string) => JQuery; + /** + * Called when a label is remove, return false; will prevent the label from being removed. + */ + onLabelRemove?: (this: JQuery, value: any) => false | void; + /** + * Is called after a label is selected by a user + */ + onLabelSelect?: (this: JQuery, $selectedLabels: JQuery) => void; + /** + * Is called after a dropdown is searched with no matching values + */ + onNoResults?: (this: JQuery, searchValue: any) => void; + /** + * Is called before a dropdown is shown. If false is returned, dropdown will not be shown. + */ + onShow?: (this: JQuery) => false | void; + /** + * Is called before a dropdown is hidden. If false is returned, dropdown will not be hidden. + */ + onHide?: (this: JQuery) => false | void; + + // endregion + + // region DOM Settings + + /** + * You can specify site wide messages by modifying $.fn.dropdown.settings.message that will apply on any dropdown if it appears in the page. + */ + message?: { + /** + * @default 'Add {term}' + */ + addResult?: string; + /** + * @default '{count} selected' + */ + count?: string; + /** + * @default 'Max {maxCount} selections' + */ + maxSelections?: string; + /** + * 'No results found.' + */ + noResults?: string; + }; + selector?: { + /** + * @default '.addition' + */ + addition?: string; + /** + * @default '.ui.dropdown' + */ + dropdown?: string; + /** + * @default '> .dropdown.icon' + */ + icon?: string; + /** + * @default '> input[type="hidden"], > select' + */ + input?: string; + /** + * @default '.item' + */ + item?: string; + /** + * @default '> .label' + */ + label?: string; + /** + * @default '> .label > .delete.icon' + */ + remove?: string; + /** + * @default '.label' + */ + siblingLabel?: string; + /** + * @default '.menu' + */ + menu?: string; + /** + * @default '.message' + */ + message?: string; + /** + * @default '.dropdown.icon' + */ + menuIcon?: string; + /** + * @default 'input.search, .menu > .search > input' + */ + search?: string; + /** + * @default '> .text:not(.icon)' + */ + text?: string; + }; + regExp?: { + /** + * @default /[-[\]{}()*+?.,\\^$|#\s]/g + */ + escape?: RegExp; + }; + metadata?: { + /** + * @default 'defaultText' + */ + defaultText?: string; + /** + * @default 'defaultValue' + */ + defaultValue?: string; + /** + * @default 'placeholderText' + */ + placeholderText?: string; + /** + * @default 'text' + */ + text?: string; + /** + * @default 'value' + */ + value?: string; + }; + className?: { + /** + * @default 'active' + */ + active?: string; + /** + * @default 'addition' + */ + addition?: string; + /** + * @default 'animating' + */ + animating?: string; + /** + * @default 'disabled' + */ + disabled?: string; + /** + * @default 'ui dropdown' + */ + dropdown?: string; + /** + * @default 'filtered' + */ + filtered?: string; + /** + * @default 'hidden transition' + */ + hidden?: string; + /** + * @default 'item' + */ + item?: string; + /** + * @default 'ui label' + */ + label?: string; + /** + * @default 'loading' + */ + loading?: string; + /** + * @default 'menu' + */ + menu?: string; + /** + * @default 'message' + */ + message?: string; + /** + * @default 'multiple' + */ + multiple?: string; + /** + * @default 'default' + */ + placeholder?: string; + /** + * @default 'search' + */ + search?: string; + /** + * @default 'selected' + */ + selected?: string; + /** + * @default 'selection' + */ + selection?: string; + /** + * @default 'upward' + */ + upward?: string; + /** + * @default 'visible' + */ + visible?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'You called a dropdown action that was not defined' + */ + action?: string; + /** + * @default 'Once a select has been initialized behaviors must be called on the created ui dropdown' + */ + alreadySetup?: string; + /** + * @default 'Allowing user additions currently requires the use of labels.' + */ + labels?: string; + /** + * @default 'The method you called is not defined.' + */ + method?: string; + /** + * @default 'This module requires ui transitions ' + */ + noTransition?: string; + }; + + // endregion + } + + // endregion + + // region Embed + + /** + * @see {@link http://semantic-ui.com/modules/embed.html#/settings} + */ + interface EmbedSettings extends ComponentSettings { + /** + * Specifies a url to use for embed + * + * @default false + */ + url?: false | string; + + // region Embed Settings + + /** + * Specifies an icon to use with placeholder content + * + * @default false + */ + icon?: false | string; + /** + * Specifies a source to use, if no source is provided it will be determined from the domain of a specified url. + * + * @default false + */ + source?: false | string; + /** + * Specifies an id value to replace with the {id} value found in templated urls + * + * @default false + */ + id?: false | string; + /** + * Specify an object containing key/value pairs to add to the iframes GET parameters + * + * @default false + */ + parameters?: false | any; + + // endregion + + // region Video Settings + + /** + * Default setting auto will only autoplay content when a placeholder is specified. Setting to true or false will force autoplay. + * + * @default 'auto' + */ + autoplay?: 'auto' | boolean; + /** + * Specifies a default chrome color with Vimeo or YouTube. + * + * @default '#444444' + */ + color?: string; + /** + * Whether to prefer HD content + * + * @default true + */ + hd?: boolean; + /** + * Whether to show networks branded UI like title cards, or after video calls to action. + * + * @default false + */ + brandedUI?: boolean; + + // endregion + + // region Callbacks + + /** + * Callback when iframe is generated + */ + onCreate?: (this: JQuery, url: string) => void; + /** + * Whenever an iframe contents is shown + */ + onDisplay?: (this: JQuery) => void; + /** + * Callback immediately before Embed is removed from DOM + */ + onPlaceholderDisplay?: (this: JQuery) => void; + /** + * Callback when module parameters are determined. Allows you to adjust parameters at run time by returning a new parameters object. + */ + onEmbed?: (this: JQuery, parameters: any) => any; + + // endregion + + // region DOM Settings + + /** + * DOM Selectors used internally + */ + selector?: { + /** + * @default '.embed' + */ + embed?: string; + /** + * @default '.placeholder' + */ + placeholder?: string; + /** + * @default '.play' + */ + play?: string; + }; + /** + * HTML Data attributes used to store data + */ + metadata?: { + /** + * @default 'id' + */ + id?: string; + /** + * @default 'icon' + */ + icon?: string; + /** + * @default 'placeholder' + */ + placeholder?: string; + /** + * @default 'source' + */ + source?: string; + /** + * @default 'url' + */ + url?: string; + }; + /** + * Class names used to attach style to state + */ + className?: { + /** + * @default 'active' + */ + active?: string; + /** + * @default 'embed' + */ + embed?: string; + }; + templates?: { + /** + * returns html for iframe + */ + iframe?: (url: string, parameters: string) => string; + /** + * returns html for placeholder element + */ + placeholder?: (image: string, icon: string) => string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'No URL specified' + */ + noURL?: string; + /** + * @default 'The method you called is not defined' + */ + method?: string; + }; + + // endregion + } + + // endregion + + // region Modal + + /** + * @see {@link http://semantic-ui.com/modules/modal.html#/settings} + */ + interface ModalSettings extends ComponentSettings { + // region Modal Settings + + /** + * If set to false will prevent the modal from being moved to inside the dimmer + * + * @default true + */ + detachable?: boolean; + /** + * When true, the first form input inside the modal will receive focus when shown. Set this to false to prevent this behavior. + * + * @default true + */ + autofocus?: boolean; + /** + * Whether any change in modal DOM should automatically refresh cached positions + * + * @default false + */ + observeChanges?: boolean; + /** + * If set to true will not close other visible modals when opening a new one + * + * @default false + */ + allowMultiple?: boolean; + /** + * Whether to automatically bind keyboard shortcuts + * + * @default true + */ + keyboardShortcuts?: boolean; + /** + * A vertical offset to allow for content outside of modal, for example a close button, to be centered. + * + * @default 0 + */ + offset?: number; + /** + * Selector or jquery object specifying the area to dim + * + * @default 'body' + */ + context?: Selector; + /** + * Setting to false will not allow you to close the modal by clicking on the dimmer + * + * @default true + */ + closable?: boolean; + /** + * You can specify custom settings to extend UI dimmer + * + * @see {@link http://semantic-ui.com/modules/dimmer.html} + */ + dimmerSettings?: DimmerSettings; + /** + * Named transition to use when animating menu in and out, full list can be found in ui transitions docs. + * + * @default 'scale' + * @see {@link http://semantic-ui.com/modules/transition.html} + */ + transition?: string; + /** + * Duration of animation + * + * @default 400 + */ + duration?: number; + /** + * Whether additional animations should queue + * + * @default false + */ + queue?: boolean; + + // endregion + + // region Callbacks + + /** + * Is called when a modal starts to show. + */ + onShow?: (this: JQuery) => void; + /** + * Is called after a modal has finished showing animating. + */ + onVisible?: (this: JQuery) => void; + /** + * Is called after a modal starts to hide. If the function returns false, the modal will not hide. + */ + onHide?: (this: JQuery, $element: JQuery) => false | void; + /** + * Is called after a modal has finished hiding animation. + */ + onHidden?: (this: JQuery) => void; + /** + * Is called after a positive, approve or ok button is pressed. If the function returns false, the modal will not hide. + */ + onApprove?: (this: JQuery, $element: JQuery) => false | void; + /** + * Is called after a negative, deny or cancel button is pressed. If the function returns false the modal will not hide. + */ + onDeny?: (this: JQuery, $element: JQuery) => false | void; + + // endregion + + // region DOM Settings + + selector?: { + /** + * @default '.close, .actions .button' + */ + close?: string; + /** + * @default '.actions .positive, .actions .approve, .actions .ok' + */ + approve?: string; + /** + * @default '.actions .negative, .actions .deny, .actions .cancel' + */ + deny?: string; + }; + className?: { + /** + * @default 'active' + */ + active?: string; + /** + * @default 'scrolling' + */ + scrolling?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'The method you called is not defined.' + */ + method?: string; + }; + + // endregion + } + + // endregion + + // region Nag + + /** + * @see {@link http://semantic-ui.com/modules/nag.html} + */ + interface NagSettings extends ComponentSettings { + // region Behavior + + /** + * allows cookie to be overridden + * + * @default false + */ + persist?: boolean; + /** + * set to zero to require manually dismissal, otherwise hides on its own + * + * @default 0 + */ + displayTime?: number; + animation?: { + /** + * @default 'slide' + */ + show?: string; + /** + * @default 'slide' + */ + hide?: string; + }; + /** + * @default false + */ + context?: false | Selector; + /** + * @default false + */ + detachable?: boolean; + + /** + * @default 30 + */ + expires?: number; + /** + * @default false + */ + domain?: false | string; + /** + * @default '/' + */ + path?: string; + + /** + * type of storage to use + * + * @default 'cookie' + */ + storageMethod?: 'cookie' | 'localstorage' | 'sessionstorage'; + + /** + * @default 'nag' + */ + key?: any; + /** + * @default 'dismiss' + */ + value?: any; + + /** + * @default 500 + */ + speed?: number; + /** + * @default 'easeOutQuad' + */ + easing?: string; + + // endregion + + // region Callbacks + + onHide?: (this: JQuery) => void; + + // endregion + + // region DOM Settings + + className?: { + /** + * @default 'bottom' + */ + bottom?: string; + /** + * @default 'fixed' + */ + fixed?: string; + }; + selector?: { + /** + * @default '.close.icon' + */ + close?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default '$.cookie is not included. A storage solution is required.' + */ + noCookieStorage?: string; + /** + * @default 'Neither $.cookie or store is defined. A storage solution is required for storing state' + */ + noStorage?: string; + /** + * @default 'The method you called is not defined.' + */ + method?: string; + }; + + // endregion + } + + // endregion + + // region Popup + + /** + * @see {@link http://semantic-ui.com/modules/popup.html#/settings} + */ + interface PopupSettings extends ComponentSettings { + // region Popup Settings + + /** + * Can specify a DOM element that should be used as the popup. This is useful for including a pre-formatted popup. + * + * @default false + */ + popup?: false | Selector; + /** + * Whether all other popups should be hidden when this popup is opened + * + * @default false + */ + exclusive?: boolean; + /** + * Whether to move popup to same offset container as target element when popup already exists on the page. + * Using a popup inside of an element without overflow:visible, like a sidebar, may require you to set this to false + * + * @default true + */ + movePopup?: boolean; + /** + * Whether popup should attach mutationObservers to automatically run destroy when the element is removed from the page's DOM. + * + * @default true + */ + observeChanges?: boolean; + /** + * When the popup surpasses the boundary of this element, it will attempt to find another display position. + */ + boundary?: Selector; + /** + * Selector or jquery object specifying where the popup should be created. + * + * @default 'body' + */ + context?: Selector; + /** + * Will automatically hide a popup on scroll event in this context + */ + scrollContext?: Selector; + /** + * Number of pixels that a popup is allowed to appear outside the boundaries of its context. + * This allows for permissible rounding errors when an element is against the edge of its context. + * + * @default 2 + */ + jitter?: number; + /** + * Position that the popup should appear + * + * @default 'top left' + */ + position?: string; + /** + * If a popup is inline it will be created next to current element, allowing for local css rules to apply. + * It will not be removed from the DOM after being hidden. + * Otherwise popups will appended to body and removed after being hidden. + * + * @default false + */ + inline?: boolean; + /** + * Whether popup contents should be preserved in the page after being hidden, allowing it to re-appear slightly faster on subsequent loads. + * + * @default false + */ + preserve?: boolean; + /** + * Can be set to adjacent or opposite to prefer adjacent or opposite position if popup cannot fit on screen + * + * @default 'adjacent' + */ + prefer?: 'adjacent' | 'opposite'; + /** + * When set to false, a popup will not appear and produce an error message if it cannot entirely fit on page. + * Setting this to a position like, right center forces the popup to use this position as a last resort even if it is partially offstage. + * Setting this to true will use the last attempted position. + * + * @default false + */ + lastResort?: boolean | string; + /** + * Event used to trigger popup. Can be either focus, click, hover, or manual. Manual popups must be triggered with $('.element').popup('show'); + * + * @default 'hover' + */ + on?: 'focus' | 'click' | 'hover' | 'manual'; + /** + * Delay in milliseconds before showing or hiding a popup on hover or focus + */ + delay?: { + show?: number; + hide?: number; + }; + /** + * Named transition to use when animating menu in and out. Fade and slide down are available without including ui transitions + * + * @default 'slide down' + * @see {@link http://semantic-ui.com/modules/transition.html} + */ + transition?: string; + /** + * Duration of animation events + * + * @default 200 + */ + duration?: number; + /** + * Whether popup should set fluid popup variation width on load to avoid width: 100% including padding + * + * @default true + */ + setFluidWidth?: boolean; + /** + * Whether popup should not close on hover (useful for popup navigation menus) + * + * @default false + */ + hoverable?: boolean; + /** + * When using on: 'click' specifies whether clicking the page should close the popup + * + * @default true + */ + closable?: boolean; + /** + * When using on: 'hover' whether touchstart events should be added to allow the popup to be triggered + */ + addTouchEvents?: boolean; + /** + * Whether popup should hide on scroll or touchmove, auto only hides for popups without on: 'click'. + * Set this to false to prevent mobile browsers from closing popups when you tap inside input fields. + * + * @default 'auto' + */ + hideOnScroll?: 'auto' | false; + /** + * If a selector or jQuery object is specified this allows the popup to be positioned relative to that element. + * + * @default false + */ + target?: false | Selector; + /** + * Offset for distance of popup from element + * + * @default 0 + */ + distanceAway?: number; + /** + * Offset in pixels from calculated position + * + * @default 0 + */ + offset?: number; + /** + * Number of iterations before giving up search for popup position when a popup cannot fit on screen + * + * @default 10 + */ + maxSearchDepth?: number; + + // endregion + + // region Callbacks + + /** + * Callback on popup element creation, with created popup + */ + onCreate?: (this: JQuery, $module: JQuery) => void; + /** + * Callback immediately before Popup is removed from DOM + */ + onRemove?: (this: JQuery, $module: JQuery) => void; + /** + * Callback before popup is shown. Returning false from this callback will cancel the popup from showing. + */ + onShow?: (this: JQuery, $module: JQuery) => false | void; + /** + * Callback after popup is shown + */ + onVisible?: (this: JQuery, $module: JQuery) => void; + /** + * Callback before popup is hidden. Returning false from this callback will cancel the popup from hiding. + */ + onHide?: (this: JQuery, $module: JQuery) => false | void; + /** + * Callback after popup is hidden + */ + onHidden?: (this: JQuery, $module: JQuery) => void; + /** + * Callback after popup cannot be plaed on screen + */ + onUnplaceable?: (this: JQuery, $module: JQuery) => void; + + // endregion + + // region Content Settings + + /** + * Popup variation to use, can use multiple variations with a space delimiter + */ + variation?: string; + /** + * Content to display + */ + content?: string; + /** + * Title to display alongside content + */ + title?: string; + /** + * HTML content to display instead of preformatted title and content + */ + html?: string; + + // endregion + + // region DOM Settings + + /** + * DOM Selectors used internally + */ + selector?: { + /** + * @default '.ui.popup' + */ + popup?: string; + }; + /** + * HTML Data attributes used to store data + */ + metadata?: { + /** + * @default 'content' + */ + content?: string; + /** + * @default 'html' + */ + html?: string; + /** + * @default 'offset' + */ + offset?: string; + /** + * @default 'position' + */ + position?: string; + /** + * @default 'title' + */ + title?: string; + /** + * @default 'variation' + */ + variation?: string; + }; + /** + * Class names used to attach style to state + */ + className?: { + /** + * @default 'loading' + */ + loading?: string; + /** + * @default 'ui popup' + */ + popup?: string; + /** + * @default 'top left center bottom right' + */ + position?: string; + /** + * @default 'visible' + */ + visible?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'The position you specified is not a valid position' + */ + invalidPosition?: string; + /** + * @default 'Popup does not fit within the boundaries of the viewport' + */ + cannotPlace?: string; + /** + * @default 'The method you called is not defined.' + */ + method?: string; + /** + * @default 'This module requires ui transitions ' + */ + noTransition?: string; + /** + * @default 'The target or popup you specified does not exist on the page' + */ + notFound?: string; + }; + + // endregion + } + + // endregion + + // region Progress + + /** + * @see {@link http://semantic-ui.com/modules/progress.html#/settings} + */ + interface ProgressSettings extends ComponentSettings { + // region Progress Settings + + /** + * Whether success state should automatically trigger when progress completes + * + * @default true + */ + autoSuccess?: boolean; + /** + * Whether progress should automatically show activity when incremented + * + * @default true + */ + showActivity?: boolean; + /** + * When set to true, values that calculate to above 100% or below 0% will be adjusted. + * When set to false, inappropriate values will produce an error. + * + * @default true + */ + limitValues?: boolean; + /** + * Can be set to either to display progress as percent or ratio. Matches up to corresponding text template with the same name. + * + * @default 'percent' + */ + label?: 'percent' | 'ratio'; + /** + * When incrementing without value, sets range for random increment value + */ + random?: { + /** + * @default 2 + */ + min?: number; + /** + * @default 5 + */ + max?: number; + }; + /** + * Decimal point precision for calculated progress + * + * @default 1 + */ + precision?: number; + /** + * Setting a total value will make each call to increment get closer to this total (i.e. 1/20, 2/20 etc) + * + * @default false + */ + total?: false | number; + /** + * Sets current value, when total is specified, this is used to calculate a ratio of the total, with percent this should be the overall percent + * + * @default false + */ + value?: false | number; + + // endregion + + // region Callbacks + + /** + * Callback on percentage change + */ + onChange?: (this: JQuery, percent: number, value: number, total: number) => void; + /** + * Callback on success state + */ + onSuccess?: (this: JQuery, total: number) => void; + /** + * Callback on active state + */ + onActive?: (this: JQuery, value: number, total: number) => void; + /** + * Callback on error state + */ + onError?: (this: JQuery, value: number, total: number) => void; + /** + * Callback on warning state + */ + onWarning?: (this: JQuery, value: number, total: number) => void; + + // endregion + + // region DOM Settings + + /** + * Text content for each state, uses simple templating with {percent}, {value}, {total} + */ + text?: { + /** + * @default false + */ + active?: false | string; + /** + * @default false + */ + error?: false | string; + /** + * @default false + */ + success?: false | string; + /** + * @default false + */ + warning?: false | string; + /** + * @default '{percent}%' + */ + percent?: false | string; + /** + * @default '{value} of {total}' + */ + ratio?: false | string; + }; + /** + * Regular expressions used by module + */ + regExp?: { + /** + * @default /\{\$*[A-z0-9]+\}/g + */ + variable?: RegExp; + }; + /** + * Selectors used by module + */ + selector?: { + /** + * @default '> .bar + */ + bar?: string; + /** + * @default '> .label' + */ + label?: string; + /** + * @default '.bar > .progress' + */ + progress?: string; + }; + /** + * DOM metadata used by module + */ + metadata?: { + /** + * @default 'percent' + */ + percent?: string; + /** + * @default 'total' + */ + total?: string; + /** + * @default 'value' + */ + value?: string; + }; + /** + * Class names used to attach style to state + */ + className?: { + /** + * @default 'active' + */ + active?: string; + /** + * @default 'error' + */ + error?: string; + /** + * @default 'success' + */ + success?: string; + /** + * @default 'warning' + */ + warning?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'The method you called is not defined.' + */ + method?: string; + /** + * @default 'Progress value is non numeric' + */ + nonNumeric?: string; + }; + + // endregion + } + + // endregion + + // region Rating + + /** + * @see {@link http://semantic-ui.com/modules/rating.html#/settings} + */ + interface RatingSettings extends ComponentSettings { + // region Rating Settings + + /** + * A number representing the default rating to apply + * + * @default 0 + */ + initialRating?: number; + /** + * Whether callbacks like onRate should fire immediately after initializing with the current value. + * + * @default false + */ + fireOnInit?: boolean; + /** + * By default a rating will be only clearable if there is 1 icon. Setting to true/false will allow or disallow a user to clear their rating + * + * @default 'auto' + */ + clearable?: 'auto' | boolean; + /** + * Whether to enable user's ability to rate + * + * @default true + */ + interactive?: boolean; + + // endregion + + // region Callbacks + + /** + * Is called after user selects a new rating + */ + onRate?: (this: JQuery, value: number) => void; + + // endregion + + // region DOM Settings + + selector?: { + /** + * @default '.icon' + */ + icon?: string; + }; + className?: { + /** + * @default 'active' + */ + active?: string; + /** + * @default 'hover' + */ + hover?: string; + /** + * @default 'loading' + */ + loading?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'You called a rating action that was not defined' + */ + action?: string; + }; + + // endregion + } + + // endregion + + // region Search + + /** + * @see {@link http://semantic-ui.com/modules/search.html#/settings} + */ + interface SearchSettings extends ComponentSettings { + // region Behavior + + /** + * Settings for API call. + * + * @see {@link http://semantic-ui.com/behaviors/api.html#/usage} + */ + apiSettings?: ApiSettings; + /** + * Minimum characters to query for results + * + * @default 1 + */ + minCharacters?: number; + /** + * Named transition to use when animating menu in and out. Fade and slide down are available without including ui transitions + * + * @default 'fade' + * @see {@link http://semantic-ui.com/modules/transition.html} + */ + transition?: string; + /** + * Duration of animation events + * + * @default 300 + */ + duration?: number; + /** + * Maximum results to display when using local and simple search, maximum category count for category search + * + * @default 7 + */ + maxResults?: number; + /** + * Caches results locally to avoid requerying server + * + * @default true + */ + cache?: boolean; + /** + * Specify a Javascript object which will be searched locally + * + * @default false + */ + source?: false | any; + /** + * Whether the search should automatically select the first search result after searching + * + * @default false + */ + selectFirstResult?: boolean; + /** + * Whether a "no results" message should be shown if no results are found. (These messages can be modified using the template object specified below) + * + * @default false + */ + showNoResults?: boolean; + /** + * Return local results that match anywhere inside your content + * + * @default true + */ + searchFullText?: boolean; + /** + * List mapping display content to JSON property, either with API or source. + */ + fields?: { + /** + * array of categories (category view) + * + * @default 'results' + */ + categories?: string; + /** + * name of category (category view) + * + * @default 'name' + */ + categoryName?: string; + /** + * array of results (category view) + * + * @default 'results' + */ + categoryResults?: string; + /** + * result description + * + * @default 'description' + */ + description?: string; + /** + * result image + * + * @default 'image' + */ + image?: string; + /** + * result price + * + * @default 'price' + */ + price?: string; + /** + * array of results (standard) + * + * @default 'results' + */ + results?: string; + /** + * result title + * + * @default 'title' + */ + title?: string; + /** + * "view more" object name + * + * @default 'action' + */ + action?: string; + /** + * "view more" text + * + * @default 'text' + */ + actionText?: string; + /** + * "view more" url + * + * @default 'url' + */ + actionURL?: string; + }; + /** + * Specify object properties inside local source object which will be searched + */ + searchFields?: string[]; + /** + * Delay before hiding results after search blur + * + * @default 0 + */ + hideDelay?: number; + /** + * Delay before querying results on inputchange + * + * @default 100 + */ + searchDelay?: number; + /** + * Easing equation when using fallback Javascript animation + * + * @default 'easeOutExpo' + */ + easing?: string; + + // endregion + + // region Callbacks + + /** + * Callback on element selection by user. + * The first parameter includes the filtered response results for that element. + * The function should return false to prevent default action (closing search results and selecting value). + */ + onSelect?: (this: JQuery, result: any, response: any) => false | void; + /** + * Callback after processing element template to add HTML to results. Function should return false to prevent default actions. + */ + onResultsAdd?: (this: JQuery, html: string) => false | void; + /** + * Callback on search query + */ + onSearchQuery?: (this: JQuery, query: string) => void; + /** + * Callback on server response + */ + onResults?: (this: JQuery, response: any) => void; + /** + * Callback when results are opened + */ + onResultsOpen?: (this: JQuery) => void; + /** + * Callback when results are closed + */ + onResultsClose?: (this: JQuery) => void; + + // endregion + + // region Templates + + templates?: { + escape?: (string: string) => string; + message?: (message: string, type: string) => string; + category?: (response: any) => string; + standard?: (response: any) => string; + }; + + // endregion + + // region DOM Settings + + /** + * Regular expressions used for matching + */ + regExp?: { + /** + * @default /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g + */ + escape?: RegExp; + /** + * @default '(?:\s|^)' + */ + beginsWith?: string; + }; + /** + * Selectors used to find parts of a module + */ + selector?: { + /** + * @default '.prompt' + */ + prompt?: string; + /** + * @default '.search.button' + */ + searchButton?: string; + /** + * @default '.results' + */ + results?: string; + /** + * @default '.category' + */ + category?: string; + /** + * @default '.result' + */ + result?: string; + }; + /** + * HTML5 metadata attributes used internally + */ + metadata?: { + /** + * @default 'cache' + */ + cache?: string; + /** + * @default 'results' + */ + results?: string; + }; + /** + * Class names used to determine element state + */ + className?: { + /** + * @default 'active' + */ + active?: string; + /** + * @default 'empty' + */ + empty?: string; + /** + * @default 'focus' + */ + focus?: string; + /** + * @default 'loading' + */ + loading?: string; + /** + * @default 'down' + */ + pressed?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'Cannot search. No source used, and Semantic API module was not included' + */ + source?: string; + /** + * @default 'Your search returned no results' + */ + noResults?: string; + /** + * @default 'Error in debug logging, exiting.' + */ + logging?: string; + /** + * @default 'A valid template name was not specified.' + */ + noTemplate?: string; + /** + * @default 'There was an issue with querying the server.' + */ + serverError?: string; + /** + * @default 'Results must be an array to use maxResults setting' + */ + maxResults?: string; + /** + * @default 'The method you called is not defined.' + */ + method?: string; + }; + + // endregion + } + + // endregion + + // region Shape + + /** + * @see {@link http://semantic-ui.com/modules/shape.html#/settings} + */ + interface ShapeSettings extends ComponentSettings { + // region Shape Settings + + /** + * Duration of side change animation + * + * @default 700 + */ + duration?: number; + /** + * When set to next will use the width of the next side during the shape's animation. + * When set to initial it will use the width of the shape at initialization. + * When set to a specific pixel height, will force the width to that height. + * + * @default 'initial' + * @since 2.2 + */ + width?: 'next' | 'initial' | number; + /** + * When set to next will use the height of the next side during the shape's animation. + * When set to initial it will use the height of the shape at initialization. + * When set to a specific pixel height, will force the height to that height. + * + * @default 'initial' + * @since 2.2 + */ + height?: 'next' | 'initial' | number; + + // endregion + + // region Callbacks + + /** + * Is called before side change + */ + beforeChange?: (this: JQuery) => void; + /** + * Is called after visible side change + */ + onChange?: (this: JQuery) => void; + + // endregion + + // region DOM Settings + + selector?: { + /** + * @default '.sides' + */ + sides?: string; + /** + * @default '.side' + */ + side?: string; + }; + className?: { + /** + * @default 'animating' + */ + animating?: string; + /** + * @default 'hidden' + */ + hidden?: string; + /** + * @default 'loading' + */ + loading?: string; + /** + * @default 'active' + */ + active?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'You tried to switch to a side that does not exist.' + */ + side?: string; + /** + * @default 'The method you called is not defined' + */ + method?: string; + }; + + // endregion + } + + interface Translation { + transform: string; + } + + // endregion + + // region Sidebar + + /** + * @see {@link http://semantic-ui.com/modules/sidebar.html#/settings} + */ + interface SidebarSettings extends ComponentSettings { + // region Behavior + + /** + * Context which sidebar will appear inside + * + * @default 'body' + */ + context?: Selector; + /** + * Whether multiple sidebars can be open at once + * + * @default false + */ + exclusive?: boolean; + /** + * Whether sidebar can be closed by clicking on page + * + * @default true + */ + closable?: boolean; + /** + * Whether to dim page contents when sidebar is visible + * + * @default true + */ + dimPage?: boolean; + /** + * Whether to lock page scroll when sidebar is visible + * + * @default false + */ + scrollLock?: boolean; + /** + * Whether to return to original scroll position when sidebar is hidden, automatically occurs with transition: scale + * + * @default false + */ + returnScroll?: boolean; + /** + * When sidebar is initialized without the proper HTML, using this option will defer creation of DOM to use requestAnimationFrame. + * + * @default false + */ + delaySetup?: boolean; + + // endregion + + // region Animation + + /** + * Named transition to use when animating sidebar. Defaults to 'auto' which selects transition from defaultTransition based on direction. + * + * @default 'auto' + */ + transition?: string; + /** + * Named transition to use when animating when detecting mobile device. Defaults to 'auto' which selects transition from defaultTransition based on direction. + * + * @default 'auto' + */ + mobileTransition?: string; + /** + * Default transitions for each direction and screen size, used with transition: auto + */ + defaultTransition?: { + computer?: { + /** + * @default 'uncover' + */ + left?: string; + /** + * @default 'uncover' + */ + right?: string; + /** + * @default 'overlay' + */ + top?: string; + /** + * @default 'overlay' + */ + bottom?: string; + }; + mobile?: { + /** + * @default 'uncover' + */ + left?: string; + /** + * @default 'uncover' + */ + right?: string; + /** + * @default 'overlay' + */ + top?: string; + /** + * @default 'overlay' + */ + bottom?: string; + }; + }; + /** + * Whether Javascript animations should be used. Defaults to false. Setting to auto will use legacy animations only for browsers that do not support CSS transforms + * + * @default false + */ + useLegacy?: 'auto' | boolean; + /** + * Duration of sidebar animation when using legacy Javascript animation + * + * @default 500 + */ + duration?: number; + /** + * Easing to use when using legacy Javascript animation + * + * @default 'easeInOutQuint' + */ + easing?: string; + + // endregion + + // region Callbacks + + /** + * Is called when a sidebar begins animating in. + */ + onVisible?: (this: JQuery) => void; + /** + * Is called when a sidebar has finished animating in. + */ + onShow?: (this: JQuery) => void; + /** + * Is called when a sidebar begins to hide or show + */ + onChange?: (this: JQuery) => void; + /** + * Is called before a sidebar begins to animate out. + */ + onHide?: (this: JQuery) => void; + /** + * Is called after a sidebar has finished animating out. + */ + onHidden?: (this: JQuery) => void; + + // endregion + + // region DOM Settings + + className?: { + /** + * @default 'active' + */ + active?: string; + /** + * @default 'animating' + */ + animating?: string; + /** + * @default 'dimmed' + */ + dimmed?: string; + /** + * @default 'ios' + */ + ios?: string; + /** + * @default 'pushable' + */ + pushable?: string; + /** + * @default 'pushed' + */ + pushed?: string; + /** + * @default 'right' + */ + right?: string; + /** + * @default 'top' + */ + top?: string; + /** + * @default 'left' + */ + left?: string; + /** + * @default 'bottom' + */ + bottom?: string; + /** + * @default 'visible' + */ + visible?: string; + }; + regExp?: { + /** + * @default /(iPad|iPhone|iPod)/g + */ + ios?: RegExp; + /** + * @default /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g + */ + mobile?: RegExp; + }; + selector?: { + /** + * @default '.fixed' + */ + fixed?: string; + /** + * @default 'script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed' + */ + omitted?: string; + /** + * @default '.pusher' + */ + pusher?: string; + /** + * @default '.ui.sidebar' + */ + sidebar?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'The method you called is not defined.' + */ + method?: string; + /** + * @default 'Had to add pusher element. For optimal performance make sure body content is inside a pusher element' + */ + pusher?: string; + /** + * @default 'Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag' + */ + movedSidebar?: string; + /** + * @default 'The overlay setting is no longer supported, use animation: overlay' + */ + overlay?: string; + /** + * @default 'There were no elements that matched the specified selector' + */ + notFound?: string; + }; + + // endregion + } + + // endregion + + // region Sticky + + /** + * @see {@link http://semantic-ui.com/modules/sticky.html#/settings} + */ + interface StickySettings extends ComponentSettings { + // region Sticky Settings + + /** + * Whether element should be "pushed" by the viewport, attaching to the bottom of the screen when scrolling up + * + * @default false + */ + pushing?: boolean; + /** + * Sticky container height will only be set if the difference between heights of container and context is larger than this jitter value. + * + * @default 5 + */ + jitter?: number; + /** + * Whether any change in context DOM should automatically refresh cached sticky positions + * + * @default false + */ + observeChanges?: boolean; + /** + * Context which sticky element should stick to + * + * @default false + */ + context?: false | Selector; + /** + * Context which sticky should attach onscroll events. + * + * @default 'window' + */ + scrollContext?: Selector; + /** + * Offset in pixels from the top of the screen when fixing element to viewport + * + * @default 0 + */ + offset?: number; + /** + * Offset in pixels from the bottom of the screen when fixing element to viewport + * + * @default 0 + */ + bottomOffset?: number; + + // endregion + + // region Callbacks + + /** + * Callback when element is repositioned from layout change + */ + onReposition?: (this: JQuery) => void; + /** + * Callback when requestAnimationFrame fires from scroll handler. + */ + onScroll?: (this: JQuery) => void; + /** + * Callback when element is fixed to page + */ + onStick?: (this: JQuery) => void; + /** + * Callback when element is unfixed from page + */ + onUnstick?: (this: JQuery) => void; + /** + * Callback when element is bound to top of parent container + */ + onTop?: (this: JQuery) => void; + /** + * Callback when element is bound to bottom of parent container + */ + onBottom?: (this: JQuery) => void; + + // endregion + + // region DOM Settings + + /** + * Class names used to attach style to state + */ + className?: { + /** + * @default 'bound' + */ + bound?: string; + /** + * @default 'fixed' + */ + fixed?: string; + /** + * @default 'native' + */ + supported?: string; + /** + * @default 'top' + */ + top?: string; + /** + * @default 'bottom' + */ + bottom?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'Sticky element must be inside a relative container' + */ + container?: string; + /** + * @default 'Element is hidden, you must call refresh after element becomes visible' + */ + visible?: string; + /** + * @default 'The method you called is not defined.' + */ + method?: string; + /** + * @default 'Context specified does not exist' + */ + invalidContext?: string; + /** + * @default 'Sticky element is larger than its container, cannot create sticky.' + */ + elementSize?: string; + }; + + // endregion + } + + // endregion + + // region Tab + + /** + * @see {@link http://semantic-ui.com/modules/tab.html#/settings} + */ + interface TabSettings extends ComponentSettings { + // region Tab Settings + + /** + * Whether tab should load remote content as same url as history + * + * @default false + */ + auto?: boolean; + /** + * When set to siblings will only deactivate elements that are DOM siblings with the activated element. + * When set to all the component will deactivate all other elements initialized at the same time. + * + * @default 'siblings' + * @since 2.2 + */ + deactivate?: 'siblings' | 'all'; + /** + * Whether to record history events for tab changes + * + * @default false + */ + history?: boolean; + /** + * Do not load content remotely on first tab load. Useful when open tab is rendered on server. + * + * @default false + */ + ignoreFirstLoad?: boolean; + /** + * Whether inline scripts in tab HTML should be parsed on tab load. + * Defaults to once, parsing only on first load. + * Can also be set to true or false to always parse or never parse inline scripts. + * + * @default 'once' + */ + evaluateScripts?: 'once' | boolean; + /** + * Tab should reload content every time it is opened + */ + alwaysRefresh?: boolean; + /** + * Can be set to either response, DOM or html. + * Using DOM will cache the a clone of the DOM tree, preserving all events as they existed on render. + * response will cache the original response on load, this way callbacks always receive the same content. + * Using html will cache the resulting html after all callbacks, making sure any changes to content are preserved. + * + * @default 'response' + */ + cacheType?: 'response' | 'DOM' | 'html'; + /** + * Tab should cache content after loading locally to avoid server trip on second load + * + * @default true + */ + cache?: boolean; + /** + * Settings object for $.api call + * + * @default false + * @see {@link http://semantic-ui.com/behaviors/api.html} + */ + apiSettings?: ApiSettings; + /** + * Can be set to hash or state. + * Hash will use an in-page link to create history events. + * State will use DOM History and load pages from server on refresh. + * + * @default 'hash' + * @see {@link https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history} + */ + historyType?: 'hash' | 'state'; + /** + * When using historyType state you must specify the base URL for all internal links. + * + * @default false + */ + path?: false | string; + /** + * Tabs are limited to those found inside this context + * + * @default false + */ + context?: false | Selector; + /** + * If enabled limits tabs to children of passed context + * + * @default false + */ + childrenOnly?: boolean; + /** + * Maximum amount of nested tabs allowed (avoids recursion) + * + * @default 25 + */ + maxDepth?: number; + + // endregion + + // region Callbacks + + /** + * Callback only the first time a tab is loaded + */ + onFirstLoad?: (this: JQuery, tabPath: string, parameterArray: any[], historyEvent: any) => void; + /** + * Callback every time a tab is loaded + */ + onLoad?: (this: JQuery, tabPath: string, parameterArray: any[], historyEvent: any) => void; + /** + * Called when a tab begins loading remote content + */ + onRequest?: (this: JQuery, tabPath: string) => void; + /** + * Called after a tab becomes visible + */ + onVisible?: (this: JQuery, tabPath: string) => void; + + // endregion + + // region DOM Settings + + /** + * Functions used to return content + */ + templates?: { + /** + * returns page title + */ + determineTitle?: (tabArray: any[]) => string; + }; + /** + * Selectors used by module + */ + selector?: { + /** + * @default '.ui.tab' + */ + tabs?: string; + /** + * @default '.ui:not(.menu)' + */ + parent?: string; + }; + /** + * DOM metadata used by module + */ + metadata?: { + /** + * @default 'tab' + */ + tab?: string; + /** + * @default 'loaded' + */ + loaded?: string; + /** + * @default 'promise' + */ + promise?: string; + }; + /** + * Class names used to attach style to state + */ + className?: { + /** + * @default 'loading' + */ + loading?: string; + /** + * @default 'active' + */ + active?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'You attempted to load content without API module' + */ + api?: string; + /** + * @default 'The method you called is not defined' + */ + method?: string; + /** + * @default 'Activated tab cannot be found for this context.' + */ + missingTab?: string; + /** + * @default 'The tab you specified is missing a content url.' + */ + noContent?: string; + /** + * @default 'History enabled, but no path was specified' + */ + path?: string; + /** + * @default 'Max recursive depth reached' + */ + recursion?: string; + /** + * @default 'The state library has not been initialized' + */ + state?: string; + }; + + // endregion + } + + // endregion + + // region Transition + + /** + * @see {@link http://semantic-ui.com/modules/transition.html#/settings} + */ + interface TransitionSettings extends ComponentSettings { + // region Transition Settings + + /** + * Named animation event to used. Must be defined in CSS. + * + * @default 'fade' + */ + animation?: string; + /** + * Interval in MS between each elements transition + * + * @default 0 + */ + interval?: number; + /** + * When an interval is specified, sets order of animations. auto reverses only animations that are hiding. + * + * @default 'auto' + */ + reverse?: 'auto' | boolean; + /** + * Specify the final display type (block, inline-block etc) so that it doesn't have to be calculated. + * + * @default false + */ + displayType?: false | string; + /** + * Duration of the CSS transition animation + * + * @default 500 + */ + duration?: number; + /** + * If enabled a timeout will be added to ensure animationend callback occurs even if element is hidden + */ + useFailSafe?: boolean; + /** + * If enabled will allow same animation to be queued while it is already occurring + */ + allowRepeats?: boolean; + /** + * Whether to automatically queue animation if another is occurring + */ + queue?: boolean; + + // endregion + + // region Callbacks + + /** + * Callback on each transition that changes visibility to shown + */ + onShow?: (this: JQuery) => void; + /** + * Callback on each transition that changes visibility to hidden + */ + onHide?: (this: JQuery) => void; + /** + * Callback on animation start, useful for queued animations + */ + onStart?: (this: JQuery) => void; + /** + * Callback on each transition complete + */ + onComplete?: (this: JQuery) => void; + + // endregion + + // region DOM Settings + + /** + * Class names used to attach style to state + */ + className?: { + /** + * @default 'animating' + */ + animating?: string; + /** + * @default 'disabled' + */ + disabled?: string; + /** + * @default 'hidden' + */ + hidden?: string; + /** + * @default 'in' + */ + inward?: string; + /** + * @default 'loading' + */ + loading?: string; + /** + * @default 'looping' + */ + looping?: string; + /** + * @default 'out' + */ + outward?: string; + /** + * @default 'transition' + */ + transition?: string; + /** + * @default 'visible' + */ + visible?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'There is no CSS animation matching the one you specified.' + */ + noAnimation?: string; + /** + * @default 'The method you called is not defined' + */ + method?: string; + }; + + // endregion + } + + // endregion + + // endregion + + // region Behaviors + + // region API + + /** + * @see {@link http://semantic-ui.com/behaviors/api.html#/settings} + */ + interface ApiSettings extends ComponentSettings { + // region Behavior + + /** + * When API event should occur + * + * @default 'auto' + */ + on?: string; + /** + * Can be set to 'local' to cache successful returned AJAX responses when using a JSON API. + * This helps avoid server round trips when API endpoints will return the same results when accessed repeatedly. + * Setting to false, will add cache busting parameters to the URL. + * + * @default true + */ + cache?: 'local' | boolean; + /** + * UI state will be applied to this element, defaults to triggering element. + */ + stateContext?: Selector; + /** + * Whether to encode parameters with encodeURIComponent before adding into url string + * + * @default true + */ + encodeParameters?: boolean; + /** + * Whether to automatically include default data like {value} and {text} + * + * @default true + */ + defaultData?: boolean; + /** + * Whether to serialize closest form and include in request + * + * @default false + */ + serializeForm?: boolean; + /** + * How long to wait when a request is made before triggering request, useful for rate limiting oninput + * + * @default 0 + */ + throttle?: number; + /** + * When set to false will not delay the first request made, when no others are queued + * + * @default true + */ + throttleFirstRequest?: boolean; + /** + * Whether an API request can occur while another request is still pending + * + * @default false + */ + interruptRequests?: boolean; + /** + * Minimum duration to show loading indication + * + * @default 0 + */ + loadingDuration?: number; + /** + * The default auto will automatically remove error state after error duration, unless the element is a form + * + * @default 'auto' + */ + hideError?: 'auto' | boolean; + /** + * Setting to true, will not remove error. + * Setting to a duration in milliseconds to show error state after request error. + * + * @default 2000 + */ + errorDuration?: true | number; + + // endregion + + // region Request Settings + + /** + * Named API action for query, originally specified in $.fn.settings.api + */ + action?: string | false; + /** + * Templated URL for query, will override specified action + */ + url?: string | false; + /** + * Variables to use for replacement + */ + urlData?: any | false; + /** + * Can be set to a Javascript object which will be returned automatically instead of requesting JSON from server + */ + response?: any | false; + /** + * When specified, this function can be used to retrieve content from a server and return it asynchronously instead of a standard AJAX call. + * The callback function should return the server response. + * + * @default false + */ + responseAsync?: ((settings: ApiSettings, callback: (response: any) => void) => void) | false; + /** + * @see response + */ + mockResponse?: any | false; + /** + * @see responseAsync + */ + mockResponseAsync?: ((settings: ApiSettings, callback: (response: any) => void) => void) | false; + /** + * Method for transmitting request to server + */ + method?: 'post' | 'get'; + /** + * Expected data type of response + */ + dataType?: 'xml' | 'json' | 'jsonp' | 'script' | 'html' | 'text'; + /** + * POST/GET Data to Send with Request + */ + data?: any; + + // endregion + + // region Callbacks + + /** + * Allows modifying settings before request, or cancelling request + */ + beforeSend?: (settings: ApiSettings) => any; + /** + * Allows modifying XHR object for request + */ + beforeXHR?: (xhrObject: JQueryXHR) => any; + /** + * Callback that occurs when request is made. Receives both the API success promise and the XHR request promise. + */ + onRequest?: (promise: JQueryDeferred, xhr: JQueryXHR) => void; + /** + * Allows modifying the server's response before parsed by other callbacks to determine API event success + */ + onResponse?: (response: any) => void; + /** + * Determines whether completed JSON response should be treated as successful + * + * @see {@link http://semantic-ui.com/behaviors/api.html#determining-json-success} + */ + successTest?: (response: any) => boolean; + /** + * Callback after successful response, JSON response must pass successTest + */ + onSuccess?: (response: any, element: JQuery, xhr: JQueryXHR) => void; + /** + * Callback on request complete regardless of conditions + */ + onComplete?: (response: any, element: JQuery, xhr: JQueryXHR) => void; + /** + * Callback on failed response, or JSON response that fails successTest + */ + onFailure?: (response: any, element: JQuery) => void; + /** + * Callback on server error from returned status code, or XHR failure. + */ + onError?: (errorMessage: string, element: JQuery, xhr: JQueryXHR) => void; + /** + * Callback on abort caused by user clicking a link or manually cancelling request. + */ + onAbort?: (errorMessage: string, element: JQuery, xhr: JQueryXHR) => void; + + // endregion + + // region DOM Settings + + /** + * Regular expressions used for template matching + */ + regExp?: { + /** + * @default /\{\$*[A-z0-9]+\}/g + */ + required?: RegExp; + /** + * @default /\{\/\$*[A-z0-9]+\}/g + */ + optional?: RegExp; + }; + /** + * Selectors used to find parts of a module + */ + selector?: { + /** + * @default '.disabled' + */ + disabled?: string; + /** + * @default 'form' + */ + form?: string; + }; + /** + * Class names used to determine element state + */ + className?: { + /** + * @default 'loading' + */ + loading?: string; + /** + * @default 'error' + */ + error?: string; + }; + /** + * Metadata used to store XHR and response promise + */ + metadata?: { + /** + * @default 'action' + */ + action?: string; + /** + * @default 'url' + */ + url?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'The before send function has aborted the request' + */ + beforeSend?: string; + /** + * @default 'There was an error with your request' + */ + error?: string; + /** + * @default 'API Request Aborted. Exit conditions met' + */ + exitConditions?: string; + /** + * @default 'JSON could not be parsed during error handling' + */ + JSONParse?: string; + /** + * @default 'You are using legacy API success callback names' + */ + legacyParameters?: string; + /** + * @default 'API action used but no url was defined' + */ + missingAction?: string; + /** + * @default 'Required dependency jquery-serialize-object missing, using basic serialize' + */ + missingSerialize?: string; + /** + * @default 'No URL specified for API event' + */ + missingURL?: string; + /** + * @default 'The beforeSend callback must return a settings object, beforeSend ignored.' + */ + noReturnedValue?: string; + /** + * @default 'There was an error parsing your request' + */ + parseError?: string; + /** + * @default 'Missing a required URL parameter: ' + */ + requiredParameter?: string; + /** + * @default 'Server gave an error: ' + */ + statusMessage?: string; + /** + * @default 'Your request timed out' + */ + timeout?: string; + }; + + // endregion + } + + // endregion + + // region Form Validation + + /** + * @see {@link http://semantic-ui.com/behaviors/form.html#/settings} + */ + interface FormSettings extends ComponentSettings { + // region Form Settings + + /** + * Adds keyboard shortcuts for enter and escape keys to submit form and blur fields respectively + * + * @default true + */ + keyboardShortcuts?: boolean; + /** + * Event used to trigger validation. Can be either submit, blur or change. + * + * @default 'submit' + */ + on?: 'submit' | 'blur' | 'change'; + /** + * If set to true will revalidate fields with errors on input change + * + * @default true + */ + revalidate?: boolean; + /** + * Delay from last typed letter to validate a field when using on: change or when revalidating a field. + * + * @default true + */ + delay?: boolean; + /** + * Adds inline error on field validation error + * + * @default false + */ + inline?: boolean; + /** + * Named transition to use when animating validation errors. Fade and slide down are available without including ui transitions + * + * @default 'scale' + * @see {@link http://semantic-ui.com/modules/transition.html} + */ + transition?: string; + /** + * Animation speed for inline prompt + * + * @default 150 + */ + duration?: number; + + // endregion + + // region Form Prompts + + text?: { + /** + * @default 'Please enter a valid value' + */ + unspecifiedRule?: string; + /** + * @default 'This field' + */ + unspecifiedField?: string; + }; + prompt?: { + /** + * @default '{name} must have a value' + */ + empty?: string; + /** + * @default '{name} must be checked' + */ + checked?: string; + /** + * @default '{name} must be a valid e-mail' + */ + email?: string; + /** + * @default '{name} must be a valid url' + */ + url?: string; + /** + * @default '{name} is not formatted correctly' + */ + regExp?: string; + /** + * @default '{name} must be an integer' + */ + integer?: string; + /** + * @default '{name} must be a decimal number' + */ + decimal?: string; + /** + * @default '{name} must be set to a number' + */ + number?: string; + /** + * @default '{name} must be \'{ruleValue}\'' + */ + is?: string; + /** + * @default '{name} must be exactly \'{ruleValue}\'' + */ + isExactly?: string; + /** + * @default '{name} cannot be set to \'{ruleValue}\'' + */ + not?: string; + /** + * @default '{name} cannot be set to exactly \'{ruleValue}\'' + */ + notExactly?: string; + /** + * @default '{name} cannot contain \'{ruleValue}\'' + */ + contain?: string; + /** + * @default '{name} cannot contain exactly \'{ruleValue}\'' + */ + containExactly?: string; + /** + * @default '{name} must contain \'{ruleValue}\'' + */ + doesntContain?: string; + /** + * @default '{name} must contain exactly \'{ruleValue}\'' + */ + doesntContainExactly?: string; + /** + * @default '{name} must be at least {ruleValue} characters' + */ + minLength?: string; + /** + * @default '{name} must be at least {ruleValue} characters' + */ + length?: string; + /** + * @default '{name} must be exactly {ruleValue} characters' + */ + exactLength?: string; + /** + * @default '{name} cannot be longer than {ruleValue} characters' + */ + maxLength?: string; + /** + * @default '{name} must match {ruleValue} field' + */ + match?: string; + /** + * @default '{name} must have a different value than {ruleValue} field' + */ + different?: string; + /** + * @default '{name} must be a valid credit card number' + */ + creditCard?: string; + /** + * @default '{name} must have at least {ruleValue} choices' + */ + minCount?: string; + /** + * @default '{name} must have exactly {ruleValue} choices' + */ + exactCount?: string; + /** + * @default '{name} must have {ruleValue} or less choices' + */ + maxCount?: string; + }; + + // endregion + + // region Callbacks + + /** + * Callback on each valid field + */ + onValid?: (this: JQuery) => void; + /** + * Callback on each invalid field + */ + onInvalid?: (this: JQuery) => void; + /** + * Callback if a form is all valid + */ + onSuccess?: (this: JQuery, event: JQueryEventObject, fields: any) => void; + /** + * Callback if any form field is invalid + */ + onFailure?: (this: JQuery, formErrors: string[], fields: any) => void; + + // endregion + + // region DOM Settings + + /** + * Selectors used to match functionality to DOM + */ + selector?: { + /** + * @default '.error.message' + */ + message?: string; + /** + * @default 'input, textarea, select' + */ + field?: string; + /** + * @default '.field' + */ + group?: string; + /** + * @default 'input' + */ + input?: string; + /** + * @default '.prompt' + */ + prompt?: string; + /** + * @default '.submit' + */ + submit?: string; + }; + /** + * HTML5 metadata attributes + */ + metadata?: { + /** + * @default 'validate' + */ + validate?: string; + }; + /** + * Class names used to attach style to state + */ + className?: { + /** + * @default 'active' + */ + active?: string; + /** + * @default 'default' + */ + placeholder?: string; + /** + * @default 'disabled' + */ + disabled?: string; + /** + * @default 'visible' + */ + visible?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'The method you called is not defined.' + */ + method?: string; + }; + + // endregion + } + + // endregion + + // region Visibility + + /** + * @see {@link http://semantic-ui.com/behaviors/visibility.html#/settings} + */ + interface VisibilitySettings extends ComponentSettings { + // region Functionality + + /** + * When set to false a callback will occur each time an element passes the threshold for a condition. + * + * @default true + */ + once?: boolean; + /** + * When set to true a callback will occur anytime an element passes a condition not just immediately after the threshold is met. + * + * @default false + */ + continuous?: boolean; + /** + * Set to image to load images when on screen. Set to fixed to add class name fixed when passed. + * + * @default false + */ + type?: false | 'image' | 'fixed'; + /** + * Whether visibility conditions should be checked immediately on init + * + * @default true + */ + initialCheck?: boolean; + /** + * The scroll context visibility should use. + * + * @default 'window' + */ + context?: Selector; + /** + * Whether visibility conditions should be checked on window load. This ensures that after images load content positions will be updated correctly. + * + * @default true + */ + refreshOnLoad?: boolean; + /** + * Whether visibility conditions should be checked on window resize. Useful when content resizes causes continuous changes in position + * + * @default true + */ + refreshOnResize?: boolean; + /** + * Whether visibility conditions should be checked on calls to refresh. + * These calls can be triggered from either resize, load or manually calling $('.foo').visibility('refresh') + * + * @default true + */ + checkOnRefresh?: boolean; + /** + * Specify a z-index when using type: 'fixed'. + * + * @default 1 + * @since 2.2 + */ + zIndex?: number; + /** + * Value that context scrollTop should be adjusted in pixels. Useful for making content appear below content fixed to the page. + * + * @default 0 + */ + offset?: number; + /** + * Whether element calculations should include its margin + * + * @default false + */ + includeMargin?: boolean; + /** + * When set to an integer, scroll position will be debounced using this ms value. false will debounce with requestAnimationFrame. + * + * @default false + */ + throttle?: false | number; + /** + * Whether to automatically refresh content when changes are made to the element's DOM subtree + * + * @default true + */ + observeChanges?: boolean; + /** + * When using type: image allows you to specify transition when showing a loaded image + * + * @default false + */ + transition?: false | string; + /** + * When using type: image allows you to specify transition duration + * + * @default 1000 + */ + duration?: number; + + // endregion + + // region Visibility Callbacks + + /** + * Element's top edge has passed bottom of screen + */ + onTopVisible?: (this: JQuery) => void; + /** + * Element's top edge has passed top of the screen + */ + onTopPassed?: (this: JQuery) => void; + /** + * Element's bottom edge has passed bottom of screen + */ + onBottomVisible?: (this: JQuery) => void; + /** + * Any part of an element is visible on screen + */ + onPassing?: (this: JQuery) => void; + /** + * Element's bottom edge has passed top of screen + */ + onBottomPassed?: (this: JQuery) => void; + /** + * Element's top edge has not passed bottom of screen + */ + onTopVisibleReverse?: (this: JQuery) => void; + /** + * Element's top edge has not passed top of the screen + */ + onTopPassedReverse?: (this: JQuery) => void; + /** + * Element's bottom edge has not passed bottom of screen + */ + onBottomVisibleReverse?: (this: JQuery) => void; + /** + * Element's top has not passed top of screen but bottom has + */ + onPassingReverse?: (this: JQuery) => void; + /** + * Element's bottom edge has not passed top of screen + */ + onBottomPassedReverse?: (this: JQuery) => void; + + // endregion + + // region Image Callbacks + + /** + * Occurs after an image has completed loading + * + * @since 2.2 + */ + onLoad?: (this: JQuery) => void; + /** + * Occurs after all img initialized at the same time have loaded. + * + * @since 2.2 + */ + onAllLoaded?: (this: JQuery) => void; + + // endregion + + // region Fixed Callbacks + + /** + * Occurs after element has been assigned position fixed + * + * @since 2.2 + */ + onFixed?: (this: JQuery) => void; + /** + * Occurs after element has been removed from fixed position + * + * @since 2.2 + */ + onUnfixed?: (this: JQuery) => void; + + // endregion + + // region Utility Callbacks + + /** + * Occurs each time an elements calculations are updated + */ + onUpdate?: (this: JQuery, calculations: ElementCalculations) => void; + /** + * Occurs whenever element's visibility is refreshed + */ + onRefresh?: (this: JQuery) => void; + + // endregion + + // region DOM Settings + + /** + * Class names used to attach style to state + */ + className?: { + /** + * @default 'fixed' + */ + fixed?: string; + }; + + // endregion + + // region Debug Settings + + error?: { + /** + * @default 'The method you called is not defined.' + */ + method?: string; + }; + + // endregion + } + + interface ElementPosition { + fits: boolean; + offset: JQueryCoordinates; + width: number; + height: number; + } + + interface ElementCalculations extends ElementPosition { + margin?: { + top: number; + bottom: number; + }; + top: number; + bottom: number; + + topVisible: boolean; + topPassed: boolean; + bottomVisible: boolean; + bottomPassed: boolean; + pixelsPassed: number; + percentagePassed: number; + + onScreen: boolean; + passing: boolean; + offScreen: boolean; + } + + interface ScreenCalculations { + top: number; + bottom: number; + } + + interface ScreenSize { + height: number; + } + + // endregion + + // endregion +} diff --git a/semantic-ui/semantic-ui-tests.ts b/semantic-ui/semantic-ui-tests.ts new file mode 100644 index 0000000000..f116507459 --- /dev/null +++ b/semantic-ui/semantic-ui-tests.ts @@ -0,0 +1,140 @@ +function test_Accordion() { + const selector = '.ui.accordion'; + $(selector).accordion('refresh'); + $(selector).accordion('open', 0); + $(selector).accordion('close others'); + $(selector).accordion('close', 0); + $(selector).accordion('toggle', 0); + $(selector).accordion({ + selector: { + trigger: '.title .icon' + } + }); + $(selector).accordion(); +} +test_Accordion(); + +function test_Checkbox() { + const selector = '.ui.checkbox'; + $(selector).checkbox({}); + $(selector).checkbox(); +} +test_Checkbox(); + +function test_Dimmer() { + const selector = '.ui.dimmer'; + $(selector).dimmer({}); + $(selector).dimmer(); +} +test_Dimmer(); + +function test_Dropdown() { + const selector = '.ui.dropdown'; + $(selector).dropdown({}); + $(selector).dropdown(); +} +test_Dropdown(); + +function test_Embed() { + const selector = '.ui.embed'; + $(selector).embed({}); + $(selector).embed(); +} +test_Embed(); + +function test_Modal() { + const selector = '.ui.modal'; + $(selector).modal({}); + $(selector).modal(); +} +test_Modal(); + +function test_Nag() { + const selector = '.ui.nag'; + $(selector).nag({}); +} +test_Nag(); + +function test_Popup() { + const selector = '.ui.popup'; + $(selector).popup({}); + $(selector).popup(); +} +test_Popup(); + +function test_Progress() { + const selector = '.ui.progress'; + $(selector).progress({}); + $(selector).progress(); +} +test_Progress(); + +function test_Rating() { + const selector = '.ui.rating'; + $(selector).rating({}); + $(selector).rating(); +} +test_Rating(); + +function test_Search() { + const selector = '.ui.search'; + $(selector).search({}); + $(selector).search(); +} +test_Search(); + +function test_Shape() { + const selector = '.ui.shape'; + $(selector).shape({}); + $(selector).shape(); +} +test_Shape(); + +function test_Sidebar() { + const selector = '.ui.sidebar'; + $(selector).sidebar({}); + $(selector).sidebar(); +} +test_Sidebar(); + +function test_Sticky() { + const selector = '.ui.sticky'; + $(selector).sticky({}); + $(selector).sticky(); +} +test_Sticky(); + +function test_Tab() { + const selector = '.ui.tab'; + $(selector).tab({}); + $(selector).tab(); +} +test_Tab(); + +function test_Transition() { + const selector = '.ui.transition'; + $(selector).transition({}); + $(selector).transition(); +} +test_Transition(); + +function test_Api() { + const selector = '.ui.api'; + $(selector).api({}); + $(selector).api(); +} +test_Api(); + +function test_Form() { + const selector = '.ui.form'; + $(selector).form({}); + $(selector).form(); +} +test_Form(); + +function test_Visibility() { + const selector = '.ui.visibility'; + $(selector).visibility({}); + $(selector).visibility(); +} +test_Visibility(); diff --git a/semantic-ui/tsconfig.json b/semantic-ui/tsconfig.json new file mode 100644 index 0000000000..f57f321023 --- /dev/null +++ b/semantic-ui/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "semantic-ui-tests.ts" + ] +} diff --git a/semantic-ui/tslint.json b/semantic-ui/tslint.json new file mode 100644 index 0000000000..ec365f164b --- /dev/null +++ b/semantic-ui/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} From 57db8d571f777dfef1277a01f30107665e362eeb Mon Sep 17 00:00:00 2001 From: Brett Epps Date: Thu, 26 Jan 2017 00:22:29 -0600 Subject: [PATCH 106/140] Add types for keycloak-authz.js in keycloak-js package --- keycloak-js/index.d.ts | 2 +- keycloak-js/keycloak-authz.d.ts | 39 ++++++++++++++++++++++++++++++++ keycloak-js/keycloak-js-tests.ts | 4 ++++ keycloak-js/tsconfig.json | 3 ++- 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 keycloak-js/keycloak-authz.d.ts diff --git a/keycloak-js/index.d.ts b/keycloak-js/index.d.ts index 2cd417da6b..540084d6fd 100644 --- a/keycloak-js/index.d.ts +++ b/keycloak-js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for keycloak-js 2.4 +// Type definitions for keycloak-js 2.5 // Project: https://github.com/keycloak/keycloak // Definitions by: Brett Epps // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/keycloak-js/keycloak-authz.d.ts b/keycloak-js/keycloak-authz.d.ts new file mode 100644 index 0000000000..4db057ad97 --- /dev/null +++ b/keycloak-js/keycloak-authz.d.ts @@ -0,0 +1,39 @@ +import * as Keycloak from 'keycloak-js'; + +export as namespace KeycloakAuthorization; + +export = KeycloakAuthorization; + +/** + * Creates a new Keycloak client instance. + * @param config Path to a JSON config file or a plain config object. + */ +declare function KeycloakAuthorization(keycloak: Keycloak.KeycloakInstance): KeycloakAuthorization.KeycloakAuthorizationInstance; + +declare namespace KeycloakAuthorization { + export interface KeycloakAuthorizationPromise { + then(onGrant: (rpt: string) => void, onDeny: () => void, onError: () => void): void; + } + + export interface KeycloakAuthorizationInstance { + rpt: any; + config: { rpt_endpoint: string }; + + init(): void; + + /** + * This method enables client applications to better integrate with resource servers protected by a Keycloak + * policy enforcer. + * + * In this case, the resource server will respond with a 401 status code and a WWW-Authenticate header holding the + * necessary information to ask a Keycloak server for authorization data using both UMA and Entitlement protocol, + * depending on how the policy enforcer at the resource server was configured. + */ + authorize(wwwAuthenticateHeader: string): KeycloakAuthorizationPromise; + + /** + * Obtains all entitlements from a Keycloak server based on a given resourceServerId. + */ + entitlement(resourceServerId: string, entitlementRequest: {}): KeycloakAuthorizationPromise; + } +} diff --git a/keycloak-js/keycloak-js-tests.ts b/keycloak-js/keycloak-js-tests.ts index f0957d2114..dc97d8da18 100644 --- a/keycloak-js/keycloak-js-tests.ts +++ b/keycloak-js/keycloak-js-tests.ts @@ -11,4 +11,8 @@ import { KeycloakResponseType } from 'keycloak-js'; +import * as KeycloakAuthorization from 'keycloak-js/keycloak-authz'; +import { KeycloakAuthorizationPromise } from 'keycloak-js/keycloak-authz'; + let keycloak = Keycloak(); +let keycloakAuthz = KeycloakAuthorization(keycloak); diff --git a/keycloak-js/tsconfig.json b/keycloak-js/tsconfig.json index 02d8f5053a..7ac994a5dc 100644 --- a/keycloak-js/tsconfig.json +++ b/keycloak-js/tsconfig.json @@ -17,6 +17,7 @@ }, "files": [ "index.d.ts", + "keycloak-authz.d.ts", "keycloak-js-tests.ts" ] -} \ No newline at end of file +} From b3d69dbd466bc3876d7e411fa39e325433d4818d Mon Sep 17 00:00:00 2001 From: Olmo del Corral Date: Thu, 26 Jan 2017 07:47:00 +0100 Subject: [PATCH 107/140] fix Useful --- react-widgets/lib/DateTimePicker.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-widgets/lib/DateTimePicker.d.ts b/react-widgets/lib/DateTimePicker.d.ts index 6428927cf4..0760648984 100644 --- a/react-widgets/lib/DateTimePicker.d.ts +++ b/react-widgets/lib/DateTimePicker.d.ts @@ -32,7 +32,7 @@ interface DateTimePickerProps extends React.Props { */ currentDate?: Date; /* - * Default value for current date. Usefull for suggesting a date when the caldenar opens without keep forcing it once 'value' is set. + * Default value for current date. Useful for suggesting a date when the caldenar opens without keep forcing it once 'value' is set. */ defaultCurrentDate?: Date; /** From 748431211f8bc7306c1384f44f4b9bbe05222cee Mon Sep 17 00:00:00 2001 From: Shun Date: Wed, 25 Jan 2017 23:37:18 -0800 Subject: [PATCH 108/140] Add typing files for forever-monitor 1.7 --- forever-monitor/forever-monitor-tests.ts | 15 +++++++++++++++ forever-monitor/index.d.ts | 18 +++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/forever-monitor/forever-monitor-tests.ts b/forever-monitor/forever-monitor-tests.ts index e69de29bb2..f679c4704a 100644 --- a/forever-monitor/forever-monitor-tests.ts +++ b/forever-monitor/forever-monitor-tests.ts @@ -0,0 +1,15 @@ +// Test from https://github.com/foreverjs/forever-monitor + +import * as forever from "forever-monitor"; + +const child = new (forever.Monitor)('your-filename.js', { + max: 3, + silent: true, + args: [] +}); + +child.on('exit', function() { + console.log('your-filename.js has exited after 3 restarts'); +}); + +child.start(); diff --git a/forever-monitor/index.d.ts b/forever-monitor/index.d.ts index b22905cae2..58c32ec5e6 100644 --- a/forever-monitor/index.d.ts +++ b/forever-monitor/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for forever-monitor 1.7 // Project: https://github.com/nodejitsu/forever-monitor#readme -// Definitions by: My Self +// Definitions by: Shun Takahashi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -53,44 +53,44 @@ export declare class Monitor extends NodeJS.EventEmitter { * @description Start the process that this instance is configured for * @param [restart] - Value indicating whether this is a restart. */ - public start(restart?: boolean): this; + start(restart?: boolean): this; /** * @description Tries to spawn the target Forever child process. */ - public trySpawn(): boolean; + trySpawn(): boolean; /** * @description Restarts the target script associated with this instance. */ - public restart(): this; + restart(): this; /** * @description Stops the target script associated with this instance. Prevents it from auto-respawning */ - public stop(): this; + stop(): this; /** * @description Kills the ChildProcess object associated with this instance * @param [forceStop] - Value indicating whether short circuit forever auto-restart */ - public kill(forceStop?: boolean): this; + kill(forceStop?: boolean): this; /** * @description Sends a message to a forked ChildProcess object associated with this instance */ - public send(msg?: any): this; + send(msg?: any): this; /** * respond with JSON for this instance */ - public toString(): string; + toString(): string; /** * @param command - Command string to parse * @param args - Additional default arguments */ - public parseCommand(command: string, args?: string[]): (false | { command: string, args?: string[]}); + parseCommand(command: string, args?: string[]): (false | { command: string, args?: string[]}); } interface forever { From e297d2677fb7bb82e6c06ef4a34532c8d65bcb0b Mon Sep 17 00:00:00 2001 From: york yao Date: Thu, 26 Jan 2017 19:20:44 +0800 Subject: [PATCH 109/140] fix name, class to interface, var to const, enable strictNullChecks --- node-zookeeper-client/index.d.ts | 6 +++--- .../node-zookeeper-client-tests.ts | 14 +++++++------- node-zookeeper-client/tsconfig.json | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/node-zookeeper-client/index.d.ts b/node-zookeeper-client/index.d.ts index cb9979e9f4..a85d14b7cc 100644 --- a/node-zookeeper-client/index.d.ts +++ b/node-zookeeper-client/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Jasmine 2.5 +// Type definitions for node-zookeeper-client 0.2 // Project: https://github.com/alexguan/node-zookeeper-client // Definitions by: York Yao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -72,7 +72,7 @@ export class Event { getPath(): string; } -export class Transaction { +interface Transaction { create(path: string, dataOrAclsOrmode1?: Buffer | ACL[] | number, dataOrAclsOrmode2?: Buffer | ACL[] | number, dataOrAclsOrmode3?: Buffer | ACL[] | number): this; setData(path: string, data: Buffer | null, version?: number): this; check(path: string, version?: number): this; @@ -80,7 +80,7 @@ export class Transaction { commit(callback: (error: Error | Exception, results: any) => void): void; } -export class Client extends EventEmitter { +interface Client extends EventEmitter { connect(): void; close(): void; create(path: string, callback: (error: Error | Exception, path: string) => void): void; diff --git a/node-zookeeper-client/node-zookeeper-client-tests.ts b/node-zookeeper-client/node-zookeeper-client-tests.ts index 19cca8628b..91c434bafa 100644 --- a/node-zookeeper-client/node-zookeeper-client-tests.ts +++ b/node-zookeeper-client/node-zookeeper-client-tests.ts @@ -1,8 +1,8 @@ import * as zookeeper from "node-zookeeper-client"; { - var client = zookeeper.createClient('localhost:2181'); - var path = process.argv[2]; + const client = zookeeper.createClient('localhost:2181'); + const path = process.argv[2]; client.once('connected', function () { console.log('Connected to the server.'); @@ -44,8 +44,8 @@ function listChildren(client: zookeeper.Client, path: string) { } { - var client = zookeeper.createClient('localhost:2181'); - var path = process.argv[2]; + const client = zookeeper.createClient('localhost:2181'); + const path = process.argv[2]; client.once('connected', function () { console.log('Connected to ZooKeeper.'); @@ -55,7 +55,7 @@ function listChildren(client: zookeeper.Client, path: string) { client.connect(); } -var client = zookeeper.createClient( +const client = zookeeper.createClient( 'localhost:2181/test', { sessionTimeout: 10000 } ); @@ -188,12 +188,12 @@ var client = zookeeper.createClient( } { - var state = client.getState(); + const state = client.getState(); console.log('Current state is: %s', state); } { - var id = client.getSessionId(); + const id = client.getSessionId(); console.log('Session id is: %s', id.toString('hex')); } diff --git a/node-zookeeper-client/tsconfig.json b/node-zookeeper-client/tsconfig.json index d93291d45b..1f5ffdedf8 100644 --- a/node-zookeeper-client/tsconfig.json +++ b/node-zookeeper-client/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" From c4cee4d79eb3b6d8eb5e99424913ea5af103ec10 Mon Sep 17 00:00:00 2001 From: york yao Date: Thu, 26 Jan 2017 20:01:15 +0800 Subject: [PATCH 110/140] fix wrong CreateMode value --- node-zookeeper-client/index.d.ts | 2 +- node-zookeeper-client/node-zookeeper-client-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node-zookeeper-client/index.d.ts b/node-zookeeper-client/index.d.ts index a85d14b7cc..227ebd45ad 100644 --- a/node-zookeeper-client/index.d.ts +++ b/node-zookeeper-client/index.d.ts @@ -132,7 +132,7 @@ export function createClient(connectionString: string, options?: Partial